6 years ago[WebAssembly] Call TargetPassConfig base class functions in overriding functions.
Dan Gohman [Sat, 5 Dec 2015 19:24:17 +0000 (19:24 +0000)]
[WebAssembly] Call TargetPassConfig base class functions in overriding functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254855 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Expand frem as a floating point library function.
Dan Gohman [Sat, 5 Dec 2015 19:15:57 +0000 (19:15 +0000)]
[WebAssembly] Expand frem as a floating point library function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254854 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Don't call getNumImplicitDefs and then iterate over the count. getNumImplic...
Craig Topper [Sat, 5 Dec 2015 17:34:07 +0000 (17:34 +0000)]
[Hexagon] Don't call getNumImplicitDefs and then iterate over the count. getNumImplicitDefs contains a loop so its better to just loop over the null terminated implicit def list. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254852 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ASAN] Add doFinalization to reset state
Keno Fischer [Sat, 5 Dec 2015 14:42:34 +0000 (14:42 +0000)]
[ASAN] Add doFinalization to reset state

Summary: If the same pass manager is used for multiple modules ASAN
complains about GlobalsMD being initialized twice. Fix this by
resetting GlobalsMD in a new doFinalization method to allow this
use case.

Reviewers: kcc

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D14962

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254851 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86][ADX] Added memory folding patterns and stack folding tests
Simon Pilgrim [Sat, 5 Dec 2015 07:27:50 +0000 (07:27 +0000)]
[X86][ADX] Added memory folding patterns and stack folding tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254844 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoReplace uint16_t with the MCPhysReg typedef in many places. A lot of physical registe...
Craig Topper [Sat, 5 Dec 2015 07:13:35 +0000 (07:13 +0000)]
Replace uint16_t with the MCPhysReg typedef in many places. A lot of physical register arrays already use this typedef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254843 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUse std::fill instead of memset to initialize an array to avoid hardcoded count and...
Craig Topper [Sat, 5 Dec 2015 07:13:25 +0000 (07:13 +0000)]
Use std::fill instead of memset to initialize an array to avoid hardcoded count and a multiply. The outputed code is identical.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254842 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86][FMA4] Explicitly set the domain of FMA4 float/double scalar instructions
Simon Pilgrim [Sat, 5 Dec 2015 07:07:42 +0000 (07:07 +0000)]
[X86][FMA4] Explicitly set the domain of FMA4 float/double scalar instructions

Both were defaulting to the float domain - now matches the packed instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254841 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PGO] Add version to getPGOFuncName method
Xinliang David Li [Sat, 5 Dec 2015 05:16:36 +0000 (05:16 +0000)]
[PGO] Add version to getPGOFuncName method

Different version of indexed format may use different
name uniquing schemes for static functions. Pass the
version info to the name interface so that different
schmes can be picked (for profile lookup).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254838 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoNormalize successors' probabilities when building MBBs for jump table.
Cong Hou [Sat, 5 Dec 2015 05:00:55 +0000 (05:00 +0000)]
Normalize successors' probabilities when building MBBs for jump table.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254837 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-dwp] Add coverage for both the presence and absence of type units, and fix...
David Blaikie [Sat, 5 Dec 2015 03:41:53 +0000 (03:41 +0000)]
[llvm-dwp] Add coverage for both the presence and absence of type units, and fix/remove the emission of a broken tu_index when no type units are present

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254833 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-dwp] Fix the type_units.test since I renamed its inputs as well
David Blaikie [Sat, 5 Dec 2015 03:11:17 +0000 (03:11 +0000)]
[llvm-dwp] Fix the type_units.test since I renamed its inputs as well

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254830 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-dwp] Rename the sufficiently-modified test to reflect it's non-simplicity
David Blaikie [Sat, 5 Dec 2015 03:10:05 +0000 (03:10 +0000)]
[llvm-dwp] Rename the sufficiently-modified test to reflect it's non-simplicity

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254829 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-dwp] clang-format this to catch anything I've missed along the way
David Blaikie [Sat, 5 Dec 2015 03:06:30 +0000 (03:06 +0000)]
[llvm-dwp] clang-format this to catch anything I've missed along the way

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254828 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-dwp] Support debug_tu_index
David Blaikie [Sat, 5 Dec 2015 03:05:45 +0000 (03:05 +0000)]
[llvm-dwp] Support debug_tu_index

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254827 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Implement ReverseBranchCondition, and re-enable MachineBlockPlacement
Dan Gohman [Sat, 5 Dec 2015 03:03:35 +0000 (03:03 +0000)]
[WebAssembly] Implement ReverseBranchCondition, and re-enable MachineBlockPlacement

This patch introduces a codegen-only instruction currently named br_unless,
which makes it convenient to implement ReverseBranchCondition and re-enable
the MachineBlockPlacement pass. Then in a late pass, it lowers br_unless
back into br_if.

Differential Revision: http://reviews.llvm.org/D14995

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254826 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[libFuzzer] one more trophie
Kostya Serebryany [Sat, 5 Dec 2015 02:23:49 +0000 (02:23 +0000)]
[libFuzzer] one more trophie

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254825 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[libFuzzer] don't reload the corpus more than once every second
Kostya Serebryany [Sat, 5 Dec 2015 02:09:22 +0000 (02:09 +0000)]
[libFuzzer] don't reload the corpus more than once every second

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254824 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoWhitespace.
Lang Hames [Sat, 5 Dec 2015 01:44:20 +0000 (01:44 +0000)]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254821 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[opt] Fix run-twice option for non-idempotent passes
Keno Fischer [Sat, 5 Dec 2015 01:38:12 +0000 (01:38 +0000)]
[opt] Fix run-twice option for non-idempotent passes

Cloning the module was supposed to guard against the possibility
that the passes may be non-idempotent. However, for some reason
I decided to put that AFTER the passes had already run on the
module, defeating the point entirely. Fix that by moving up the
CloneModule as is done in llc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254819 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[MC] Add a test for state reset in MCMachOStreamer
Keno Fischer [Sat, 5 Dec 2015 01:02:53 +0000 (01:02 +0000)]
[MC] Add a test for state reset in MCMachOStreamer

This was fixed in r254751, but untestable until r254774, which
added the necessary command line flag to llc. Add a test now
to make sure this doesn't regress again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254814 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix a typo in LoopVectorize.cpp. NFC.
Cong Hou [Sat, 5 Dec 2015 01:00:22 +0000 (01:00 +0000)]
Fix a typo in LoopVectorize.cpp. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254813 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Fix scheduling dependencies in register-stackified code
Dan Gohman [Sat, 5 Dec 2015 00:51:40 +0000 (00:51 +0000)]
[WebAssembly] Fix scheduling dependencies in register-stackified code

Add physical register defs to instructions used from stackified
instructions to prevent them from being scheduled into the middle of
a stack sequence. This is a conservative measure which may be loosened
in the future.

Differential Revision: http://reviews.llvm.org/D15252

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254811 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoCodeGen: Let the BumpPtrAllocator free the elements of indexList
Justin Bogner [Sat, 5 Dec 2015 00:39:14 +0000 (00:39 +0000)]
CodeGen: Let the BumpPtrAllocator free the elements of indexList

The indexList's nodes are all allocated on a BumpPtrAllocator, so it's
more efficient to let them be freed when it goes away, rather than
deleting them directly. This is a follow up to r254794.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254808 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Support constant offsets on loads and stores
Derek Schuff [Sat, 5 Dec 2015 00:26:39 +0000 (00:26 +0000)]
[WebAssembly] Support constant offsets on loads and stores

This is just prototype for load/store for i32 types. I'll add them to
the rest of the types if we like this direction.

Differential Revision: http://reviews.llvm.org/D15197

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254807 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[EarlyCSE] IsSimple vs IsVolatile naming clarification (NFC)
Philip Reames [Sat, 5 Dec 2015 00:18:33 +0000 (00:18 +0000)]
[EarlyCSE] IsSimple vs IsVolatile naming clarification (NFC)

When the notion of target specific memory intrinsics was introduced to EarlyCSE, the commit confused the notions of volatile and simple memory access.  Since I'm about to start working on this area, cleanup the naming so that patches aren't horribly confusing.  Note that the actual implementation was always bailing if the load or store wasn't simple.

- "volatile" - C++ volatile, can't remove any memory operations, but in principal unordered
- "ordered" - imposes ordering constraints on other nearby memory operations
- "atomic" - can't be split or sheared.  In LLVM terms, all "ordered" operations are also atomic so the predicate "isAtomic" is often used.
- "simple" - a load which is none of the above.  These are normal loads and what most of the optimizer works with.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254805 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[opt] Fix sanitizer complaints about r254774
Keno Fischer [Sat, 5 Dec 2015 00:06:37 +0000 (00:06 +0000)]
[opt] Fix sanitizer complaints about r254774

`Out` can be null if no output is requested, so move any access
to it inside the conditional. Thanks to Justin Bogner for finding

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254804 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PassManager] Ensure destructors of cached AnalysisUsage objects are run
Philip Reames [Fri, 4 Dec 2015 23:48:19 +0000 (23:48 +0000)]
[PassManager] Ensure destructors of cached AnalysisUsage objects are run

In 254760, I introduced the usage of a BumpPtrAllocator for the AnalysisUsage instances held by the PassManger.  This turns out to have been incorrect since a BumpPtrAllocator does not run the destructors of objects when deallocating memory.  Since a few of our SmallVector's had grown beyond their small size, we end up with some leaked memory.  We need to use a SpecificBumpPtrAllocator instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254803 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ThinLTO] Helper for performing renaming/promotion on a module
Teresa Johnson [Fri, 4 Dec 2015 23:40:22 +0000 (23:40 +0000)]
[ThinLTO] Helper for performing renaming/promotion on a module

Creates a module and performs necessary renaming/promotion of locals
that may be exported to another module.

Split out of D15024.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254802 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd FeatureLAHFSAHF to amdfam10 as well.
Hans Wennborg [Fri, 4 Dec 2015 23:32:19 +0000 (23:32 +0000)]
Add FeatureLAHFSAHF to amdfam10 as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254801 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Initial varargs support.
Dan Gohman [Fri, 4 Dec 2015 23:22:35 +0000 (23:22 +0000)]
[WebAssembly] Initial varargs support.

Full varargs support will depend on prologue/epilogue support, but this patch
gets us started with most of the basic infrastructure.

Differential Revision: http://reviews.llvm.org/D15231

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254799 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAddress a memory leak in 254760
Philip Reames [Fri, 4 Dec 2015 23:06:33 +0000 (23:06 +0000)]
Address a memory leak in 254760

The issue appears to have been that the copy constructor of the SmallVector was being invoked and this was somehow leading to leaked memory.  This patch avoids the symptom, but likely doesn't address the underlying problem.  I'm still investigating the root cause, but wanted to avoid the memory leak in the mean time.  Even with the underlying fix, avoiding the redundant allocation is worthwhile.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254795 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoCodeGen: Move the SlotIndexes BumpPtrAllocator before the list it allocates
Justin Bogner [Fri, 4 Dec 2015 23:00:54 +0000 (23:00 +0000)]
CodeGen: Move the SlotIndexes BumpPtrAllocator before the list it allocates

When a `SlotIndexes` is destroyed, `ileAllocator` will currently be
destructed before `IndexList`, but all of `IndexList`'s storage has
been allocated by `ileAllocator`. This means we'll call destructors on
garbage data, which is very bad. This can be avoided by putting the
BumpPtrAllocator earlier in the class than anything it allocates.

Unfortunately, I don't know how to test this. It depends very much on
memory layout, and the only evidence I have that this is actually
happening in practice are backtraces that might be explained by this.
By inspection though, the code is obviously dangerous/wrong, and this
is the right thing to do.

I'll follow up later with a patch that calls clearAndLeakNodesUnsafely
on the list, since there isn't much point in destructing them when
they're allocated in a BPA anyway, but I figured it makes sense to
commit the correctness fix separately from that optimization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254794 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoX86: Don't emit SAHF/LAHF for 64-bit targets unless explicitly supported
Hans Wennborg [Fri, 4 Dec 2015 23:00:33 +0000 (23:00 +0000)]
X86: Don't emit SAHF/LAHF for 64-bit targets unless explicitly supported

These instructions are not supported by all CPUs in 64-bit mode. Emitting them
causes Chromium to crash on start-up for users with such chips.

(GCC puts these instructions behind -msahf on 64-bit for the same reason.)

This patch adds FeatureLAHFSAHF, enables it by default for 32-bit targets
and modern CPUs, and changes X86InstrInfo::copyPhysReg back to the lowering
from before r244503 when the instructions are not available.

Differential Revision: http://reviews.llvm.org/D15240

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254793 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd TransformUtils to list of required libraries for llc
Derek Schuff [Fri, 4 Dec 2015 22:47:58 +0000 (22:47 +0000)]
Add TransformUtils to list of required libraries for llc

This dependency was added in r254774

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254786 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[libFuzzer] compute base64 in-process instead of using an external lib. Since libFuzz...
Kostya Serebryany [Fri, 4 Dec 2015 22:29:39 +0000 (22:29 +0000)]
[libFuzzer] compute base64 in-process instead of using an external lib. Since libFuzzer should not depend on anything, just re-implement base64 encoder. PR25746

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254784 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMSVC complains about this being ambiguous.
Rafael Espindola [Fri, 4 Dec 2015 22:26:21 +0000 (22:26 +0000)]
MSVC complains about this being ambiguous.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254782 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Orc] Move some code up into the JITCompileCallbackManager base class. NFC.
Lang Hames [Fri, 4 Dec 2015 22:09:19 +0000 (22:09 +0000)]
[Orc] Move some code up into the JITCompileCallbackManager base class. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254778 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAlways pass a diagnostic handler to the linker.
Rafael Espindola [Fri, 4 Dec 2015 22:08:53 +0000 (22:08 +0000)]
Always pass a diagnostic handler to the linker.

Before this patch the diagnostic handler was optional. If it was not
passed, the one in the LLVMContext was used.

That is probably not a pattern we want to follow. If each area has an
optional callback, there is a sea of callbacks and it is hard to follow
which one is called.

Doing this also found cases where the callback is a nice addition, like
testing that no errors or warnings are reported.

The other option is to always use the diagnostic handler in the
LLVMContext. That has a few problems

* To implement the C API we would have to set the diag handler and then
  set it back to the original value.
* Code that creates the context might be far away from code that wants
  the diagnostics.

I do have a patch that implements the second option and will send that as
an RFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254777 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SimplifyLibCalls] Optimization for pow(x, n) where n is some constant
Weiming Zhao [Fri, 4 Dec 2015 22:00:47 +0000 (22:00 +0000)]
[SimplifyLibCalls] Optimization for pow(x, n) where n is some constant

    In order to avoid calling pow function we generate repeated fmul when n is a
    positive or negative whole number.

    For each exponent we pre-compute Addition Chains in order to minimize the no.
    of fmuls.
    Refer: http://wwwhomes.uni-bielefeld.de/achim/addition_chain.html

    We pre-compute addition chains for exponents upto 32 (which results in a max of
    7 fmuls).

    For eg:
    4 = 2+2
    5 = 2+3
    6 = 3+3 and so on

    pow(x, 4.0) ==> y = fmul x, x
                    x = fmul y, y
                    ret x

    For negative exponents, we simply compute the reciprocal of the final result.

    Note: This transformation is only enabled under fast-math.

    Patch by Mandeep Singh Grang <mgrang@codeaurora.org>

Reviewers: weimingz, majnemer, escha, davide, scanon, joerg

Subscribers: probinson, escha, llvm-commits

Differential Revision: http://reviews.llvm.org/D13994

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254776 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix incorrect quote. NFC
Pete Cooper [Fri, 4 Dec 2015 21:59:04 +0000 (21:59 +0000)]
Fix incorrect quote.  NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254775 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llc/opt] Add an option to run all passes twice
Keno Fischer [Fri, 4 Dec 2015 21:56:46 +0000 (21:56 +0000)]
[llc/opt] Add an option to run all passes twice

Summary: Lately, I have submitted a number of patches to fix bugs that
only occurred when using the same pass manager to compile multiple
modules (generally these bugs are failure to reset some persistent
state). Unfortunately I don't think there is currently a way to test
that from the command line. This adds a very simple flag to both llc
and opt, under which the tools will simply re-run their respective
pass pipelines using the same pass manager on (a clone of the same
module). Additionally, we verify that both outputs are bitwise the

Reviewers: yaron.keren

Subscribers: loladiro, yaron.keren, kcc, llvm-commits

Differential Revision: http://reviews.llvm.org/D14965

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254774 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AArch64] Expand vector SDIVREM/UDIVREM operations.
Chad Rosier [Fri, 4 Dec 2015 21:38:44 +0000 (21:38 +0000)]
[AArch64] Expand vector SDIVREM/UDIVREM operations.

Patch by Ana Pazos <apazos@codeaurora.org>!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254773 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-dwp] Remove some out of date comments
David Blaikie [Fri, 4 Dec 2015 21:38:39 +0000 (21:38 +0000)]
[llvm-dwp] Remove some out of date comments

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254772 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-dwp] Implement the required on-disk probed hash table
David Blaikie [Fri, 4 Dec 2015 21:30:23 +0000 (21:30 +0000)]
[llvm-dwp] Implement the required on-disk probed hash table

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254770 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix llvm-readobj build on Windows, match noreturn attribute on reportError in headers
Reid Kleckner [Fri, 4 Dec 2015 21:29:53 +0000 (21:29 +0000)]
Fix llvm-readobj build on Windows, match noreturn attribute on reportError in headers

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254769 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-dwp] Include the debug_line.dwo section
David Blaikie [Fri, 4 Dec 2015 21:16:42 +0000 (21:16 +0000)]
[llvm-dwp] Include the debug_line.dwo section

This probably shouldn't be generated in the .dwo file for CUs, only for
TUs, but it's in the sample .dwos (generated by clang) so dwp should
reflect that.

Arguably the DWP tool could be smart enough to know that the CUs
shouldn't need a debug_line.dwo section and skip that even when it's
legitimately generated for TUs, but that's a bit more off-book.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254767 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[OperandBundles] Allow operand-specific attributes in operand bundles
Sanjoy Das [Fri, 4 Dec 2015 20:34:37 +0000 (20:34 +0000)]
[OperandBundles] Allow operand-specific attributes in operand bundles

Currently `OperandBundleUse::operandsHaveAttr` computes its result
without being given a specific operand.  This is problematic because it
forces us to say that, e.g., even non-pointer operands in `"deopt"`
operand bundles are `readonly`, which doesn't make sense.

This commit changes `operandsHaveAttr` to work in the context of a
specific operand, so that we can give the operand attributes that make
sense for the operands's `llvm::Type`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254764 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LegacyPassManager] Reduce memory usage for AnalysisUsage
Philip Reames [Fri, 4 Dec 2015 20:05:04 +0000 (20:05 +0000)]
[LegacyPassManager] Reduce memory usage for AnalysisUsage

The LegacyPassManager was storing an instance of AnalysisUsage for each instance of each pass. In practice, most instances of a single pass class share the same dependencies. We can't rely on this because passes can (and some do) have dynamic dependencies based on instance options.

We can exploit the likely commonality by uniqueing the usage information after querying the pass, but before storing it into the pass manager. This greatly reduces memory consumption by the AnalysisUsage objects. For a long pass pipeline, I measured a decrease in memory consumption for this storage of about 50%. I have not measured on the default O3 pipeline, but I suspect it will see some benefit as well since many passes are repeated (e.g. InstCombine).

Differential Revision: http://reviews.llvm.org/D14677

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254760 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoScheduleDAGInstrs: Move LiveIntervals field to ScheduleDAGMI
Matthias Braun [Fri, 4 Dec 2015 19:54:24 +0000 (19:54 +0000)]
ScheduleDAGInstrs: Move LiveIntervals field to ScheduleDAGMI

Now that ScheduleDAGInstrs doesn't need it anymore we can move the field
down the class hierarcy to ScheduleDAGMI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254759 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-readobj] reportError() never returns. Mark with the correct attribute.
Davide Italiano [Fri, 4 Dec 2015 19:29:49 +0000 (19:29 +0000)]
[llvm-readobj] reportError() never returns. Mark with the correct attribute.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254752 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-readobj/ELF] Simplify Verdef handling.
Davide Italiano [Fri, 4 Dec 2015 19:27:58 +0000 (19:27 +0000)]
[llvm-readobj/ELF] Simplify Verdef handling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254751 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agofixing Makefile
Mike Aizatsky [Fri, 4 Dec 2015 19:11:54 +0000 (19:11 +0000)]
fixing Makefile

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254749 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoadding MC dependencies in hopes to pacify the hexagon build.
Mike Aizatsky [Fri, 4 Dec 2015 18:50:18 +0000 (18:50 +0000)]
adding MC dependencies in hopes to pacify the hexagon build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254745 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agosancov -not-covered-functions.
Mike Aizatsky [Fri, 4 Dec 2015 18:35:37 +0000 (18:35 +0000)]
sancov -not-covered-functions.

Summary: The command prints out list of functions that were not entered.
To do this, addresses are first converted to function locations. Set
operations are used for function locations.

Differential Revision: http://reviews.llvm.org/D14889


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254742 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Add several more calling conventions to the supported list.
Dan Gohman [Fri, 4 Dec 2015 18:27:03 +0000 (18:27 +0000)]
[WebAssembly] Add several more calling conventions to the supported list.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254741 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agodon't repeat function names in comments; NFC
Sanjay Patel [Fri, 4 Dec 2015 17:54:31 +0000 (17:54 +0000)]
don't repeat function names in comments; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254740 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agofix formatting; NFC
Sanjay Patel [Fri, 4 Dec 2015 17:51:55 +0000 (17:51 +0000)]
fix formatting; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254739 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CXX TLS calling convention] Add CXX TLS calling convention.
Manman Ren [Fri, 4 Dec 2015 17:40:13 +0000 (17:40 +0000)]
[CXX TLS calling convention] Add CXX TLS calling convention.

This commit adds a new target-independent calling convention for C++ TLS
access functions. It aims to minimize overhead in the caller by perserving as
many registers as possible.

The target-specific implementation for X86-64 is defined as following:
  Arguments are passed as for the default C calling convention
  The same applies for the return value(s)
  The callee preserves all GPRs - except RAX and RDI

The access function makes C-style TLS function calls in the entry and exit
block, C-style TLS functions save a lot more registers than normal calls.
The added calling convention ties into the existing implementation of the
C-style TLS functions, so we can't simply use existing calling conventions
such as preserve_mostcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254737 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-dwp] Retrieve the DWOID from the CU for the cu_index entry
David Blaikie [Fri, 4 Dec 2015 17:20:04 +0000 (17:20 +0000)]
[llvm-dwp] Retrieve the DWOID from the CU for the cu_index entry

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254731 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Give names to the callseq begin and end instructions.
Dan Gohman [Fri, 4 Dec 2015 17:19:44 +0000 (17:19 +0000)]
[WebAssembly] Give names to the callseq begin and end instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254730 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] clang-format CallingConvSupported. NFC.
Dan Gohman [Fri, 4 Dec 2015 17:18:32 +0000 (17:18 +0000)]
[WebAssembly] clang-format CallingConvSupported. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254729 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Factor out the list of supported calling conventions.
Dan Gohman [Fri, 4 Dec 2015 17:16:07 +0000 (17:16 +0000)]
[WebAssembly] Factor out the list of supported calling conventions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254728 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Check for more unsupported ABI flags.
Dan Gohman [Fri, 4 Dec 2015 17:12:52 +0000 (17:12 +0000)]
[WebAssembly] Check for more unsupported ABI flags.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254727 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Use SelectionDAG::getUNDEF. NFC.
Dan Gohman [Fri, 4 Dec 2015 17:09:42 +0000 (17:09 +0000)]
[WebAssembly] Use SelectionDAG::getUNDEF. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254726 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Simplify LowerCONCAT_VECTORS, handle different types better
Krzysztof Parzyszek [Fri, 4 Dec 2015 16:18:15 +0000 (16:18 +0000)]
[Hexagon] Simplify LowerCONCAT_VECTORS, handle different types better

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254724 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoModernize the C++ APIs for creating LTO modules.
Rafael Espindola [Fri, 4 Dec 2015 16:14:31 +0000 (16:14 +0000)]
Modernize the C++ APIs for creating LTO modules.

This is a continuation of r253367.

These functions return is owned by the caller, so they return
std::unique_ptr now.

The call can fail, so the return is wrapped in ErrorOr.

They have a context where to report diagnostics, so they don't need to
take a string out parameter.

With this there are no call to getGlobalContext in lib/LTO.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254721 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoARM/AArch64: update reference documentation.
Tim Northover [Fri, 4 Dec 2015 16:10:48 +0000 (16:10 +0000)]
ARM/AArch64: update reference documentation.

There's a more comprehensive ACLE and a real v8 ARM ARM now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254720 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Using multiply instead of shift on signed number which can be UB
Colin LeMahieu [Fri, 4 Dec 2015 15:48:45 +0000 (15:48 +0000)]
[Hexagon] Using multiply instead of shift on signed number which can be UB

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254719 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SystemZ] Bugfix: Don't add CC twice to new three-address instruction.
Jonas Paulsson [Fri, 4 Dec 2015 12:48:51 +0000 (12:48 +0000)]
[SystemZ] Bugfix: Don't add CC twice to new three-address instruction.

Since BuildMI() automatically adds the implicit operands for a new instruction,
adding the old instructions CC operand resulted in that there were two CC imp-def
operands, where only one was marked as dead. This caused buildSchedGraph() to
miss dependencies on the CC reg.

Review by Ulrich Weigand

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254714 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoLEA code size optimization pass (Part 1): Remove redundant address recalculations...
Alexey Bataev [Fri, 4 Dec 2015 10:53:15 +0000 (10:53 +0000)]
LEA code size optimization pass (Part 1): Remove redundant address recalculations, by Andrey Turetsky

Add new x86 pass which replaces address calculations in load or store instructions with def register of existing LEA (must be in the same basic block), if the LEA calculates address that differs only by a displacement. Works only with -Os or -Oz.
Differential Revision: http://reviews.llvm.org/D13294

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254712 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AArch64] Clean up statistical profiling test
Oliver Stannard [Fri, 4 Dec 2015 09:45:18 +0000 (09:45 +0000)]
[AArch64] Clean up statistical profiling test

This check has nothing to do with the statistical profiling extension, so
shouldn't be in this test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254709 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[asan] Fix dynamic allocas unpoisoning on PowerPC64.
Yury Gribov [Fri, 4 Dec 2015 09:19:14 +0000 (09:19 +0000)]
[asan] Fix dynamic allocas unpoisoning on PowerPC64.

For PowerPC64 we cannot just pass SP extracted from @llvm.stackrestore to
_asan_allocas_unpoison due to specific ABI requirements
This patch adds the value returned by @llvm.get.dynamic.area.offset to
extracted from @llvm.stackrestore stack pointer, so dynamic allocas unpoisoning
stuff would work correctly on PowerPC64.

Patch by Max Ostapenko.

Differential Revision: http://reviews.llvm.org/D15108

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254707 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "[BranchFolding] Merge MMOs during tail merge"
Rafael Espindola [Fri, 4 Dec 2015 04:15:05 +0000 (04:15 +0000)]
Revert "[BranchFolding] Merge MMOs during tail merge"

This reverts commit r254694.

It broke bootstrap.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254700 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMove a call to getGlobalContext out of lib/LTO.
Rafael Espindola [Fri, 4 Dec 2015 02:42:28 +0000 (02:42 +0000)]
Move a call to getGlobalContext out of lib/LTO.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254696 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Orc] Fix Kaleidoscope example for change in r254693.
Lang Hames [Fri, 4 Dec 2015 02:32:32 +0000 (02:32 +0000)]
[Orc] Fix Kaleidoscope example for change in r254693.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254695 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[BranchFolding] Merge MMOs during tail merge
Junmo Park [Fri, 4 Dec 2015 02:29:25 +0000 (02:29 +0000)]
[BranchFolding] Merge MMOs during tail merge

If we remove the MMOs from Load/Store instructions,
they are treated as volatile. This makes other optimization passes unhappy.
eg. Load/Store Optimization

So, it looks better to merge, not remove.

Reviewers: gberry, mcrosier

Subscribers: gberry, llvm-commits

Differential Revision: http://reviews.llvm.org/D14797

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254694 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Orc] Rename JITCompileCallbackManagerBase to JITCompileCallbackManager.
Lang Hames [Fri, 4 Dec 2015 02:15:39 +0000 (02:15 +0000)]
[Orc] Rename JITCompileCallbackManagerBase to JITCompileCallbackManager.

This class is turning into a useful interface, rather than an implementation
detail, so I'm dropping the 'Base' suffix.

No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254693 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoIR: Use format_hex instead of handrolling the conversion. NFC
Justin Bogner [Fri, 4 Dec 2015 02:14:34 +0000 (02:14 +0000)]
IR: Use format_hex instead of handrolling the conversion. NFC

Cleans up some very old code in AsmWriter's WriteConstantInternal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254688 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "[llvm-profdata] Add support for weighted merge of profile data"
Nathan Slingerland [Fri, 4 Dec 2015 02:13:58 +0000 (02:13 +0000)]
Revert "[llvm-profdata] Add support for weighted merge of profile data"

This reverts commit b7250858d96b8ce567681214273ac0e62713c661.

Reverting in order to investigate Windows test failure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254687 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agogit-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254686 91177308-0d34-0410...
Junmo Park [Fri, 4 Dec 2015 02:06:59 +0000 (02:06 +0000)]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254686 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMove llvm/test/CodeGen/Generic/function-alias.ll to X86. It is incompatible to PECOFF.
NAKAMURA Takumi [Fri, 4 Dec 2015 02:00:12 +0000 (02:00 +0000)]
Move llvm/test/CodeGen/Generic/function-alias.ll to X86. It is incompatible to PECOFF.

FIXME: It may be ELF-generic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254685 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ARM] When a bitcast is about to be turned into a VMOVDRR, try to combine it
Quentin Colombet [Fri, 4 Dec 2015 01:53:14 +0000 (01:53 +0000)]
[ARM] When a bitcast is about to be turned into a VMOVDRR, try to combine it
with its source instead of forcing the values on GPRs.

This improves the lowering of vector code when such bitcasts happen in the
middle of vector computations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254684 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoScheduleDAGInstrs: Rework schedule graph builder.
Matthias Braun [Fri, 4 Dec 2015 01:51:19 +0000 (01:51 +0000)]
ScheduleDAGInstrs: Rework schedule graph builder.

Re-comitting with a change that avoids undefined uses getting put into
the VRegUses list.

The new algorithm remembers the uses encountered while walking backwards
until a matching def is found. Contrary to the previous version this:
- Works without LiveIntervals being available
- Allows to increase the precision to subregisters/lanemasks
  (not used for now)

The changes in the AMDGPU tests are necessary because the R600 scheduler
is not stable with respect to the order of nodes in the ready queues.

Differential Revision: http://reviews.llvm.org/D9068

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254683 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoraw_ostream: << operator for callables with raw_ostream argument
Matthias Braun [Fri, 4 Dec 2015 01:31:59 +0000 (01:31 +0000)]
raw_ostream: << operator for callables with raw_ostream argument

This is a revised version of r254655 which uses a Printable wrapper
class to avoid ambiguous overload problems.

Differential Revision: http://reviews.llvm.org/D14348

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254681 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoX86InstrInfo::copyPhysReg: workaround reg liveness
JF Bastien [Fri, 4 Dec 2015 01:18:17 +0000 (01:18 +0000)]
X86InstrInfo::copyPhysReg: workaround reg liveness

computeRegisterLiveness and analyzePhysReg are currently getting
confused about liveness in some cases, breaking copyPhysReg's
calculation of whether AX is dead in some cases. Work around this issue
temporarily by assuming that AX is always live.

See detail in: https://llvm.org/bugs/show_bug.cgi?id=25033#c7
And associated bugs PR24535 PR25033 PR24991 PR24992 PR25201.

This workaround makes the code correct but slightly inefficient, but it
seems to confuse the machine instr verifier which now things EAX was
undefined in some cases where it's being conservatively saved /

Reviewers: majnemer, sanjoy
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D15198

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254680 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoIR: Update a comment and a bool that've been out of date since 2012
Justin Bogner [Fri, 4 Dec 2015 01:14:24 +0000 (01:14 +0000)]
IR: Update a comment and a bool that've been out of date since 2012

It became impossible to get here with a half in r157393, over 3 years

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254679 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PGO] Unify VP data format between raw and indexed profile (Reader)
Xinliang David Li [Fri, 4 Dec 2015 01:02:10 +0000 (01:02 +0000)]
[PGO] Unify VP data format between raw and indexed profile (Reader)

With the latest refactoring and code sharing patches landed,
it is possible to unify the value profile implementation between
raw and indexed profile. This is the patch in raw profile reader
that uses the common interface.

Differential Revision: http://reviews.llvm.org/D15056

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254677 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix function-alias.ll test on non-X86 targets.
Evgeniy Stepanov [Fri, 4 Dec 2015 00:57:25 +0000 (00:57 +0000)]
Fix function-alias.ll test on non-X86 targets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254676 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoSimplify the error handling in llvm-lto a bit.
Rafael Espindola [Fri, 4 Dec 2015 00:45:57 +0000 (00:45 +0000)]
Simplify the error handling in llvm-lto a bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254675 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoEmit function alias to data as a function symbol.
Evgeniy Stepanov [Fri, 4 Dec 2015 00:45:43 +0000 (00:45 +0000)]
Emit function alias to data as a function symbol.

CFI emits jump slots for indirect functions as a byte array
constant, and declares function-typed aliases to these constants.

This change fixes AsmPrinter to emit these aliases as function
symbols and not data symbols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254674 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDon't punish vectorized arithmetic instruction whose type will be split to multiple...
Cong Hou [Fri, 4 Dec 2015 00:36:58 +0000 (00:36 +0000)]
Don't punish vectorized arithmetic instruction whose type will be split to multiple registers

Currently in LLVM's cost model, a vectorized arithmetic instruction will have
high cost if its type is split into multiple registers. However, this
punishment is too heavy and unnecessary. The overhead of the split should not
be on arithmetic instructions but instructions that implement the split. Note
that during vectorization we have calculated the register pressure, and we
only choose proper interleaving factor (and also vectorization factor) so
that we don't use more registers than the maximum number.

Here is a very simple example: if a vadd has the cost 1, and if we double VF
so that we need two registers to perform it, then its cost will become 4 with
the current implementation, which will prevent us to use larger VF.

Differential revision: http://reviews.llvm.org/D15159

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254671 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-profdata] Add support for weighted merge of profile data
Nathan Slingerland [Fri, 4 Dec 2015 00:00:20 +0000 (00:00 +0000)]
[llvm-profdata] Add support for weighted merge of profile data

This change adds support for an optional weight when merging profile data with the llvm-profdata tool.
Weights are specified by adding an option ':<weight>' suffix to the input file names.

Adding support for arbitrary weighting of input profile data allows for relative importance to be placed on the
input data from multiple training runs.

Both sampled and instrumented profiles are supported.

Reviewers: dnovillo, bogner, davidxl

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D14547

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254669 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CodeGen] Minor correction to comment on PhysRegInfo.
Kevin B. Smith [Fri, 4 Dec 2015 00:00:10 +0000 (00:00 +0000)]
[CodeGen] Minor correction to comment on PhysRegInfo.
Differential revision: http://reviews.llvm.org/D15216

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254668 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoSimplify since this function never fails.
Rafael Espindola [Thu, 3 Dec 2015 23:56:42 +0000 (23:56 +0000)]
Simplify since this function never fails.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254667 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoCodeGen peephole: fold redundant phys reg copies
JF Bastien [Thu, 3 Dec 2015 23:43:56 +0000 (23:43 +0000)]
CodeGen peephole: fold redundant phys reg copies

Code generation often exposes redundant physical register copies through
virtual registers such as:

  %vreg = COPY %PHYSREG
  %PHYSREG = COPY %vreg

There are cases where no intervening clobber of %PHYSREG occurs, and the
later copy could therefore be removed. In some cases this further allows
us to remove the initial copy.

This patch contains a motivating example which comes from the x86 build
of Chrome, specifically cc::ResourceProvider::UnlockForRead uses
libstdc++'s implementation of hash_map. That example has two tests live
at the same time, and after machine sinking LLVM has confused itself
enough and things spilling EFLAGS is a great idea even though it's
never restored and the comparison results are both live.

Before this patch we have:
  DEC32m %RIP, 1, %noreg, <ga:@L>, %noreg, %EFLAGS<imp-def>
  %vreg1<def> = COPY %EFLAGS; GR64:%vreg1
  %EFLAGS<def> = COPY %vreg1; GR64:%vreg1
  JNE_1 <BB#1>, %EFLAGS<imp-use>

Both copies are useless. This patch tries to eliminate the later copy in
a generic manner.

dec is especially confusing to LLVM when compared with sub.

I wrote this patch to treat all physical registers generically, but only
remove redundant copies of non-allocatable physical registers because
the allocatable ones caused issues (e.g. when calling conventions weren't
properly modeled) and should be handled later by the register allocator

The following tests used to failed when the patch also replaced allocatable
This happens because COPY has other special meaning for e.g. dependency
breakage and x87 FP stack.

Note that all other backends' tests pass.

Reviewers: qcolombet
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D15157

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254665 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAsmPrinter: Simplify emitting FP elements in sequential data. NFC
Justin Bogner [Thu, 3 Dec 2015 23:28:35 +0000 (23:28 +0000)]
AsmPrinter: Simplify emitting FP elements in sequential data. NFC

Use APFloat APIs here Rather than manually type-punning through

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254664 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Fix dominance check for PHIs in the StoreResult pass
Dan Gohman [Thu, 3 Dec 2015 23:07:03 +0000 (23:07 +0000)]
[WebAssembly] Fix dominance check for PHIs in the StoreResult pass

When a block has no terminator instructions, getFirstTerminator() returns
end(), which can't be used in dominance checks. Check dominance for phi
operands separately.

Also, remove some bits from WebAssemblyRegStackify.cpp that were causing
trouble on the same testcase; they were left behind from an earlier

Differential Revision: http://reviews.llvm.org/D15210

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254662 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "raw_ostream: << operator for callables with raw_stream argument"
Matthias Braun [Thu, 3 Dec 2015 23:00:28 +0000 (23:00 +0000)]
Revert "raw_ostream: << operator for callables with raw_stream argument"

This commit provoked "error C2593: 'operator <<' is ambiguous" on MSVC.

This reverts commit r254655.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254661 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CMake] Fixing bots
Chris Bieneman [Thu, 3 Dec 2015 22:55:36 +0000 (22:55 +0000)]
[CMake] Fixing bots

CMake calls to set_property with APPEND string need to have a leading space.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254659 91177308-0d34-0410-b5e6-96231b3b80d8