Eric Christopher [Tue, 14 Oct 2014 07:22:00 +0000 (07:22 +0000)]
Grab the subtarget and subtarget dependent variables off of
MachineFunction rather than TargetMachine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219671
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Tue, 14 Oct 2014 07:17:23 +0000 (07:17 +0000)]
Grab the subtarget and subtarget dependent variables off of
MachineFunction rather than TargetMachine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219670
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Tue, 14 Oct 2014 07:17:20 +0000 (07:17 +0000)]
Instead of the TargetMachine cache the MachineFunction
and TargetRegisterInfo in the peephole optimizer. This
makes it easier to grab subtarget dependent variables off
of the MachineFunction rather than the TargetMachine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219669
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Tue, 14 Oct 2014 07:00:33 +0000 (07:00 +0000)]
Access subtarget specific variables off of the MachineFunction's
cached subtarget and not the TargetMachine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219668
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Tue, 14 Oct 2014 06:56:28 +0000 (06:56 +0000)]
Add lld to the parallel set of directories since it doesn't depend
on any of the other tools directories.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219667
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Tue, 14 Oct 2014 06:56:25 +0000 (06:56 +0000)]
Access the subtarget off of the MachineFunction via the DAG
scheduler or via the SelectionDAG if available. Otherwise
grab the subtarget off of the MachineFunction by going up
the parent chain.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219666
91177308-0d34-0410-b5e6-
96231b3b80d8
Hao Liu [Tue, 14 Oct 2014 06:50:36 +0000 (06:50 +0000)]
[AArch64]Select wide immediate offset into [Base+XReg] addressing mode
e.g Currently we'll generate following instructions if the immediate is too wide:
MOV X0, WideImmediate
ADD X1, BaseReg, X0
LDR X2, [X1, 0]
Using [Base+XReg] addressing mode can save one ADD as following:
MOV X0, WideImmediate
LDR X2, [BaseReg, X0]
Differential Revision: http://reviews.llvm.org/D5477
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219665
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Tue, 14 Oct 2014 06:26:57 +0000 (06:26 +0000)]
Remove the use and member variable of the TargetMachine from
MachineLICM as we can get the same data off of the MachineFunction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219663
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Tue, 14 Oct 2014 06:26:55 +0000 (06:26 +0000)]
Have MachineInstrBundle use the MachineFunction for subtarget
access rather than the TargetMachine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219662
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Tue, 14 Oct 2014 06:26:53 +0000 (06:26 +0000)]
Access the subtarget off of the MachineFunction rather than
through the TargetMachine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219661
91177308-0d34-0410-b5e6-
96231b3b80d8
Marcello Maggioni [Tue, 14 Oct 2014 01:58:26 +0000 (01:58 +0000)]
Switch to select optimization for two-case switches
This is the same optimization of r219233 with modifications to support PHIs with multiple incoming edges from the same block
and a test to check that this condition is handled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219656
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Tue, 14 Oct 2014 01:13:53 +0000 (01:13 +0000)]
Don't include DFAPacketizer in TargetInstrInfo, there's no reason.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219653
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Tue, 14 Oct 2014 01:13:51 +0000 (01:13 +0000)]
Include map into the A15SDOptimizer rather than pick it up
transitively from the DFAPacketizer via TargetInstrInfo.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219652
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Tue, 14 Oct 2014 01:03:16 +0000 (01:03 +0000)]
Remove the TargetMachine from DFAPacketizer since it was only
being used to grab subtarget specific things that we can grab
from the MachineFunction anyhow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219650
91177308-0d34-0410-b5e6-
96231b3b80d8
Peter Collingbourne [Tue, 14 Oct 2014 00:40:53 +0000 (00:40 +0000)]
Introduce Go coding standards for LLVM.
Rather than define our own standards, we adopt a set of best practices that
are already in use by the Go community.
Differential Revision: http://reviews.llvm.org/D5761
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219646
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjay Patel [Tue, 14 Oct 2014 00:33:23 +0000 (00:33 +0000)]
fix formatting; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219645
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Tue, 14 Oct 2014 00:31:29 +0000 (00:31 +0000)]
Add some optional passes around the vectorizer to both better prepare
the IR going into it and to clean up the IR produced by the vectorizers.
Note that these are *off by default* right now while folks collect data
on whether the performance tradeoff is reasonable.
In a build of the 'opt' binary, I see about 2% compile time regression
due to this change on average. This is in my mind essentially the worst
expected case: very little of the opt binary is going to *benefit* from
these extra passes.
I've seen several benchmarks improve in performance my small amounts due
to running these passes, and there are certain (rare) cases where these
passes make a huge difference by either enabling the vectorizer at all
or by hoisting runtime checks out of the outer loop. My primary
motivation is to prevent people from seeing runtime check overhead in
benchmarks where the existing passes and optimizers would be able to
eliminate that.
I've chosen the sequence of passes based on the kinds of things that
seem likely to be relevant for the code at each stage: rotaing loops for
the vectorizer, finding correlated values, loop invariants, and
unswitching opportunities from any runtime checks, and cleaning up
commonalities exposed by the SLP vectorizer.
I'll be pinging existing threads where some of these issues have come up
and will start new threads to get folks to benchmark and collect data on
whether this is the right tradeoff or we should do something else.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219644
91177308-0d34-0410-b5e6-
96231b3b80d8
Peter Collingbourne [Tue, 14 Oct 2014 00:30:59 +0000 (00:30 +0000)]
Introduce LLVMWriteBitcodeToMemoryBuffer C API function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219643
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Bieneman [Mon, 13 Oct 2014 23:03:45 +0000 (23:03 +0000)]
Updating documentation as per Chandler's feedback.
This goes with the earlier commit to remove the static destructor from ManagedStatic.cpp by controlling the allocation and de-allocation of the mutex.
Summary: This is part of the ongoing work to remove static constructors and destructors.
Reviewers: chandlerc, rnk
Reviewed By: rnk
Subscribers: rnk, llvm-commits
Differential Revision: http://reviews.llvm.org/D5473
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219640
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Mon, 13 Oct 2014 22:37:51 +0000 (22:37 +0000)]
InstCombine: Fix miscompile in X % -Y -> X % Y transform
We assumed that negation operations of the form (0 - %Z) resulted in a
negative number. This isn't true if %Z was originally negative.
Substituting the negative number into the remainder operation may result
in undefined behavior because the dividend might be INT_MIN.
This fixes PR21256.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219639
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Bieneman [Mon, 13 Oct 2014 22:37:25 +0000 (22:37 +0000)]
Removing the static destructor from ManagedStatic.cpp by controlling the allocation and de-allocation of the mutex.
This patch adds a new llvm_call_once function which is used by the ManagedStatic implementation to safely initialize a global to avoid static construction and destruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219638
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Mon, 13 Oct 2014 21:57:44 +0000 (21:57 +0000)]
Migrate another set of getSubtargetImpl away.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219636
91177308-0d34-0410-b5e6-
96231b3b80d8
Peter Collingbourne [Mon, 13 Oct 2014 21:50:30 +0000 (21:50 +0000)]
Remove unused debug info constants.
These became unused in r219010.
Differential Revision: http://reviews.llvm.org/D5760
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219635
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Mon, 13 Oct 2014 21:48:30 +0000 (21:48 +0000)]
InstCombine: Don't miscompile (x lshr C1) udiv C2
We have a transform that changes:
(x lshr C1) udiv C2
into:
x udiv (C2 << C1)
However, it is unsafe to do so if C2 << C1 discards any of C2's bits.
This fixes PR21255.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219634
91177308-0d34-0410-b5e6-
96231b3b80d8
Reed Kotler [Mon, 13 Oct 2014 21:46:41 +0000 (21:46 +0000)]
Make first of several changes to bring up to AArch64 fast-isel style
Summary:
Make Mips fast-isel track the form of AArch64 where practical.
This makes it easier for people to review the code, to borrow similar code, and to see how to eventually move a lot of this
target code for fast-isels into target independent code.
These are just cosmetic changes. Should be no functional difference.
Test Plan:
make check
test-suite for 4 flavors mips32 r1/r2 , -O0/-O2
Reviewers: dsanders
Reviewed By: dsanders
Subscribers: aemerson, llvm-commits, rfuhler
Differential Revision: http://reviews.llvm.org/D5595
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219633
91177308-0d34-0410-b5e6-
96231b3b80d8
Paul Robinson [Mon, 13 Oct 2014 21:11:22 +0000 (21:11 +0000)]
Update the example of using a command-line option custom parser to
match the current implementation.
Patch by Douglas Yung!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219631
91177308-0d34-0410-b5e6-
96231b3b80d8
Adrian Prantl [Mon, 13 Oct 2014 20:44:58 +0000 (20:44 +0000)]
Add an assertion about the integrity of the iterator.
Broken parent scope pointers in inlined DIVariables can cause
ensureAbstractVariableIsCreated to insert new abstract scopes, thus
invalidating the iterator in this loop and leading to hard-to-debug
crashes. Useful when manually reducing IR for testcases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219628
91177308-0d34-0410-b5e6-
96231b3b80d8
Adrian Prantl [Mon, 13 Oct 2014 20:43:47 +0000 (20:43 +0000)]
constify the getters in SDNodeDbgValue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219627
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Mon, 13 Oct 2014 19:46:39 +0000 (19:46 +0000)]
Refactor debug statement and remove dead argument. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219626
91177308-0d34-0410-b5e6-
96231b3b80d8
Timur Iskhodzhanov [Mon, 13 Oct 2014 17:03:13 +0000 (17:03 +0000)]
Add VS2012-generated test inputs for test/tools/llvm-readobj/codeview-linetables.test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219621
91177308-0d34-0410-b5e6-
96231b3b80d8
Filipe Cabecinhas [Mon, 13 Oct 2014 16:16:16 +0000 (16:16 +0000)]
Fix a broadcast related regression on the vector shuffle lowering.
Summary: Test by Robert Lougher!
Reviewers: chandlerc
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D5745
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219617
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Mon, 13 Oct 2014 15:47:59 +0000 (15:47 +0000)]
R600/SI: Minor cleanup of function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219616
91177308-0d34-0410-b5e6-
96231b3b80d8
Yuri Gorshenin [Mon, 13 Oct 2014 11:44:06 +0000 (11:44 +0000)]
[asan-asm-instrumentation] Follow-up fixes to r219602: asserts are moved into
function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219610
91177308-0d34-0410-b5e6-
96231b3b80d8
Renato Golin [Mon, 13 Oct 2014 10:22:19 +0000 (10:22 +0000)]
Adds support for the Cortex-A17 to the ARM backend
Patch by Matthew Wahab.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219606
91177308-0d34-0410-b5e6-
96231b3b80d8
Daniel Sanders [Mon, 13 Oct 2014 10:18:02 +0000 (10:18 +0000)]
[mips] Mark redundant instructions with a comment in test/CodeGen/Mips/Fast-ISel/icmpa.ll.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219605
91177308-0d34-0410-b5e6-
96231b3b80d8
Bradley Smith [Mon, 13 Oct 2014 10:12:35 +0000 (10:12 +0000)]
[AArch64] Add workaround for Cortex-A53 erratum (835769)
Some early revisions of the Cortex-A53 have an erratum (835769) whereby it is
possible for a 64-bit multiply-accumulate instruction in AArch64 state to
generate an incorrect result. The details are quite complex and hard to
determine statically, since branches in the code may exist in some
circumstances, but all cases end with a memory (load, store, or prefetch)
instruction followed immediately by the multiply-accumulate operation.
The safest work-around for this issue is to make the compiler avoid emitting
multiply-accumulate instructions immediately after memory instructions and the
simplest way to do this is to insert a NOP.
This patch implements such work-around in the backend, enabled via the option
-aarch64-fix-cortex-a53-835769.
The work-around code generation is not enabled by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219603
91177308-0d34-0410-b5e6-
96231b3b80d8
Yuri Gorshenin [Mon, 13 Oct 2014 09:37:47 +0000 (09:37 +0000)]
[asan-asm-instrumentation] Fixed memory references which includes %rsp as a base or an index register.
Summary: [asan-asm-instrumentation] Fixed memory references which includes %rsp as a base or an index register.
Reviewers: eugenis
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D5599
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219602
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Mon, 13 Oct 2014 04:32:43 +0000 (04:32 +0000)]
Unix/Signals.inc: Let findModulesAndOffsets() built conditionally regarding to (defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)). [-Wunused-function]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219596
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Mon, 13 Oct 2014 04:17:34 +0000 (04:17 +0000)]
Revert r219584, "[X86] Memory folding for commutative instructions."
It broke i686 selfhosting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219595
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Mon, 13 Oct 2014 00:41:03 +0000 (00:41 +0000)]
[modules] Stop excluding Support/Debug.h from the Support module. This header
has been modular since r206822, and excluding it was leading to workarounds
such as the one in r219592, which this change removes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219593
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Sun, 12 Oct 2014 22:49:26 +0000 (22:49 +0000)]
[Modules] Add some missing includes to make files compile stand-alone.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219592
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Sun, 12 Oct 2014 17:56:40 +0000 (17:56 +0000)]
Modernize old-style static asserts. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219588
91177308-0d34-0410-b5e6-
96231b3b80d8
Joerg Sonnenberger [Sun, 12 Oct 2014 17:16:04 +0000 (17:16 +0000)]
Revert r219223, it creates invalid PHI nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219587
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Sun, 12 Oct 2014 15:36:31 +0000 (15:36 +0000)]
APSInt: Simplify code to reduce the number of copies. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219586
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Sun, 12 Oct 2014 14:02:34 +0000 (14:02 +0000)]
InstCombine: Turn (x != 0 & x <u C) into the canonical range check form (x-1 <u C-1)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219585
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sun, 12 Oct 2014 10:52:55 +0000 (10:52 +0000)]
[X86] Memory folding for commutative instructions.
This patch improves support for commutative instructions in the x86 memory folding implementation by attempting to fold a commuted version of the instruction if the original folding fails - if that folding fails as well the instruction is 're-commuted' back to its original order before returning.
This mainly helps the stack inliner better fold reloads of 3 (or more) operand instructions (VEX encoded SSE etc.) but by performing this in the lowest foldMemoryOperandImpl implementation it also replaces the X86InstrInfo::optimizeLoadInstr version and is now used by FastISel too.
Differential Revision: http://reviews.llvm.org/D5701
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219584
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Sun, 12 Oct 2014 08:34:24 +0000 (08:34 +0000)]
InstCombine: Simplify commonIDivTransforms
A helper routine, MultiplyOverflows, was a less efficient
reimplementation of APInt's smul_ov and umul_ov. While we are here,
clean up the code so it's more uniform.
No functionality change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219583
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Sun, 12 Oct 2014 06:47:47 +0000 (06:47 +0000)]
llvm/test/CodeGen: Some tests don't REQUIRE asserts any more. Remove them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219581
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Sat, 11 Oct 2014 22:21:27 +0000 (22:21 +0000)]
Suppress llvm-ar's MRI tests for now on win32, since line_iterator is incompatible to CRLF.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219579
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sat, 11 Oct 2014 20:28:56 +0000 (20:28 +0000)]
Test commit access (email fix)
Indentation tidyup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219577
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Sat, 11 Oct 2014 19:13:01 +0000 (19:13 +0000)]
AssumptionTracker: Don't create temporary CallbackVHs.
Those are expensive to create in cold cache scenarios. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219575
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Sat, 11 Oct 2014 17:57:27 +0000 (17:57 +0000)]
MC: Shrink MCSymbolRefExpr by only storing the bits we need.
32 -> 16 bytes on x86_64. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219574
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Sat, 11 Oct 2014 15:07:21 +0000 (15:07 +0000)]
MC: Bit pack MCSymbolData.
On x86_64 this brings it from 80 bytes to 64 bytes. Also make any member
variables private and clean up uses to go through the existing accessors.
NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219573
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sat, 11 Oct 2014 14:23:36 +0000 (14:23 +0000)]
Test commit access
Fix comment typo + spelling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219572
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Sat, 11 Oct 2014 10:20:04 +0000 (10:20 +0000)]
InstCombine: Don't fold (X <<s log(INT_MIN)) /s INT_MIN to X
Consider the case where X is 2. (2 <<s 31)/s-
2147483648 is zero but we
would fold to X. Note that this is valid when we are in the unsigned
domain because we require NUW: 2 <<u 31 results in poison.
This fixes PR21245.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219568
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Sat, 11 Oct 2014 10:20:01 +0000 (10:20 +0000)]
InstCombine, InstSimplify: (%X /s C1) /s C2 isn't always 0 when C1 * C2 overflow
consider:
C1 = INT_MIN
C2 = -1
C1 * C2 overflows without a doubt but consider the following:
%x = i32 INT_MIN
This means that (%X /s C1) is 1 and (%X /s C1) /s C2 is -1.
N. B. Move the unsigned version of this transform to InstSimplify, it
doesn't create any new instructions.
This fixes PR21243.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219567
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Sat, 11 Oct 2014 10:19:52 +0000 (10:19 +0000)]
InstCombine: mul to shl shouldn't preserve nsw
consider:
mul i32 nsw %x, -
2147483648
this instruction will not result in poison if %x is 1
however, if we transform this into:
shl i32 nsw %x, 31
then we will be generating poison because we just shifted into the sign
bit.
This fixes PR21242.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219566
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 11 Oct 2014 05:28:30 +0000 (05:28 +0000)]
[SCEV] Fix one more caller blindly passing the latch to SCEV's
getSmallConstantTripCount even when it isn't the exiting block.
I missed this in my first audit, very sorry. This was found in LNT and
elsewhere. I don't have a test case, but it was completely obvious from
inspection that this was the problem. I'll see if I can reduce a test
case, but I'm not really hopeful, and the value seems quite low.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219562
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 11 Oct 2014 01:04:40 +0000 (01:04 +0000)]
Guard the definition of the stack tracing function with the same macros
that guard its usage. Without this, we can get unused function warnings
when backtraces are disabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219558
91177308-0d34-0410-b5e6-
96231b3b80d8
Reed Kotler [Sat, 11 Oct 2014 00:55:18 +0000 (00:55 +0000)]
Add basic conditional branches in mips fast-isel
Summary: Implement the most basic form of conditional branches in Mips fast-isel.
Test Plan:
br1.ll
run 4 flavors of test-suite. mips32 r1/r2 and at -O0/O2
Reviewers: dsanders
Reviewed By: dsanders
Subscribers: llvm-commits, rfuhler
Differential Revision: http://reviews.llvm.org/D5583
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219556
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 11 Oct 2014 00:12:11 +0000 (00:12 +0000)]
[SCEV] Add some asserts to the recently improved trip count computation
routines and fix all of the bugs they expose.
I hit a test case that crashed even without these asserts due to passing
a non-exiting latch to the ExitingBlock parameter of the trip count
computation machinery. However, when I add the nice asserts, it turns
out we have plenty of coverage of these bugs, they just didn't manifest
in crashers.
The core problem seems to stem from an assumption that the latch *is*
the exiting block. While this is often true, and somewhat the "normal"
way to think about loops, it isn't necessarily true. The correct way to
call the trip count routines in a *generic* fashion (that is, without
a particular exit in mind) is to just use the loop's single exiting
block if it has one. The trip count can't be computed generically unless
it does. This works great for the loop vectorizer. The loop unroller
actually *wants* to select the latch when it has to chose between
multiple exits because for unrolling it is the latch trips that matter.
But if this is the desire, it needs to explicitly guard for non-exiting
latches and check for the generic trip count in that case.
I've added the asserts, and added convenience APIs for querying the trip
count generically that check for a single exit block. I've kept the APIs
consistent between computing trip count and trip multiples.
Thansk to Mark for the help debugging and tracking down the *right* fix
here!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219550
91177308-0d34-0410-b5e6-
96231b3b80d8
Lang Hames [Fri, 10 Oct 2014 23:07:09 +0000 (23:07 +0000)]
[MCJIT] Replace memcpy with readBytesUnaligned in RuntimeDyldMachOI386.
This should fix the failures of the MachO_i386_DynNoPIC_relocations.s test case
on MIPS hosts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219543
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjay Patel [Fri, 10 Oct 2014 23:00:21 +0000 (23:00 +0000)]
Return undef on FP <-> Int conversions that overflow (PR21330).
The LLVM Lang Ref states for signed/unsigned int to float conversions:
"If the value cannot fit in the floating point value, the results are undefined."
And for FP to signed/unsigned int:
"If the value cannot fit in ty2, the results are undefined."
This matches the C definitions.
The existing behavior pins to infinity or a max int value, but that may just
lead to more confusion as seen in:
http://llvm.org/bugs/show_bug.cgi?id=21130
Returning undef will hopefully lead to a less silent failure.
Differential Revision: http://reviews.llvm.org/D5603
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219542
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Fri, 10 Oct 2014 22:58:26 +0000 (22:58 +0000)]
Follow-up to r219534 to make symbolization more robust.
1) Explicitly provide important arguments to llvm-symbolizer,
not relying on defaults.
2) Be more defensive about symbolizer output.
This might fix weird failures on ninja-x64-msvc-RA-centos6 buildbot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219541
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Fri, 10 Oct 2014 22:16:07 +0000 (22:16 +0000)]
R600/SI: Change how DS offsets are printed
Match SC by using offset/offset0/offset1 and printing
in decimal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219537
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Fri, 10 Oct 2014 22:12:32 +0000 (22:12 +0000)]
R600/SI: Match read2/write2 stride 64 versions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219536
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Fri, 10 Oct 2014 22:06:59 +0000 (22:06 +0000)]
Re-land r219354: Use llvm-symbolizer to symbolize LLVM/Clang crash dumps.
In fact, symbolization is now expected to work only on Linux and
FreeBSD/NetBSD, where we have dl_iterate_phdr and can learn the
main executable name without argv0 (it will be possible on BSD systems
after http://reviews.llvm.org/D5693 lands). #ifdef-out the code for
all the rest Unix systems.
Reviewed in http://reviews.llvm.org/D5610
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219534
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Fri, 10 Oct 2014 22:01:59 +0000 (22:01 +0000)]
R600/SI: Add load / store machine optimizer pass.
Currently this only functions to match simple cases
where ds_read2_* / ds_write2_* instructions can be used.
In the future it might match some of the other weird
load patterns, such as direct to LDS loads.
Currently enabled only with a subtarget feature to enable
easier testing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219533
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Fri, 10 Oct 2014 21:22:34 +0000 (21:22 +0000)]
This patch teaches ScalarEvolution to pick and use !range metadata.
It also makes it more aggressive in querying range information by
adding a call to isKnownPredicateWithRanges to
isLoopBackedgeGuardedByCond and isLoopEntryGuardedByCond.
phabricator: http://reviews.llvm.org/D5638
Reviewed by: atrick, hfinkel
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219532
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Fri, 10 Oct 2014 21:07:03 +0000 (21:07 +0000)]
[mips] Actually mark that the default case is unreachable as this switch
is over a subset of condition codes.
This fixes the -Werror build which warns about use of uninitialized
variables in the default case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219531
91177308-0d34-0410-b5e6-
96231b3b80d8
Reed Kotler [Fri, 10 Oct 2014 20:46:28 +0000 (20:46 +0000)]
Implement floating point compare for mips fast-isel
Summary: Expand SelectCmp to handle floating point compare
Test Plan:
fpcmpa.ll
run 4 flavors of test-suite, mips32 r1/r2 O0/O2
Reviewers: dsanders
Reviewed By: dsanders
Subscribers: llvm-commits, rfuhler
Differential Revision: http://reviews.llvm.org/D5567
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219530
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 10 Oct 2014 18:46:21 +0000 (18:46 +0000)]
Revert "DebugInfo: Ensure that all debug location scope chains from instructions within a function, lead to the function itself."
This invariant is violated (& the assertions fire) on some Objective C++
in the test-suite. Reverting while I investigate.
This reverts commit r219215.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219523
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Fri, 10 Oct 2014 18:33:51 +0000 (18:33 +0000)]
llvm-ar: Start adding support for mri scripts.
I was quiet surprised to find this feature being used. Fortunately the uses
I found look fairly simple. In fact, they are just a very verbose version
of the regular ar commands.
Start implementing it then by parsing the script and setting the command
variables as if we had a regular command line.
This patch adds just enough support to create an empty archive and do a bit
of error checking. In followup patches I will implement at least addmod
and addlib.
From the description in the manual, even the more general case should not
be too hard to implement if needed. The features that don't map 1:1 to
the simple command line are
* Reading from multiple archives.
* Creating multiple archives.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219521
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Fri, 10 Oct 2014 17:44:47 +0000 (17:44 +0000)]
R600/SI: Disable copying of SCC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219519
91177308-0d34-0410-b5e6-
96231b3b80d8
Reed Kotler [Fri, 10 Oct 2014 17:39:51 +0000 (17:39 +0000)]
implement integer compare in mips fast-isel
Summary: implement SelectCmp (integer compare ) in mips fast-isel
Test Plan:
icmpa.ll
also ran 4 test-suite flavors mips32 r1/r2 O0/O2
Reviewers: dsanders
Reviewed By: dsanders
Subscribers: llvm-commits, rfuhler, mcrosier
Differential Revision: http://reviews.llvm.org/D5566
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219518
91177308-0d34-0410-b5e6-
96231b3b80d8
Mark Heffernan [Fri, 10 Oct 2014 17:39:11 +0000 (17:39 +0000)]
This patch de-pessimizes the calculation of loop trip counts in
ScalarEvolution in the presence of multiple exits. Previously all
loops exits had to have identical counts for a loop trip count to be
considered computable. This pessimization was implemented by calling
getBackedgeTakenCount(L) rather than getExitCount(L, ExitingBlock)
inside of ScalarEvolution::getSmallConstantTripCount() (see the FIXME
in the comments of that function). The pessimization was added to fix
a corner case involving undefined behavior (pr/16130). This patch more
precisely handles the undefined behavior case allowing the pessimization
to be removed.
ControlsExit replaces IsSubExpr to more precisely track the case where
undefined behavior is expected to occur. Because undefined behavior is
tracked more precisely we can remove MustExit from ExitLimit. MustExit
was used to track the case where the limit was computed potentially
assuming undefined behavior even if undefined behavior didn't necessarily
occur.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219517
91177308-0d34-0410-b5e6-
96231b3b80d8
Fariborz Jahanian [Fri, 10 Oct 2014 17:34:30 +0000 (17:34 +0000)]
Add couple of missing 'override' keyword. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219516
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Schmidt [Fri, 10 Oct 2014 17:21:15 +0000 (17:21 +0000)]
[PowerPC] Reduce names from Power8Vector to P8Vector
Per Hal Finkel's review, improving typability of some variable names.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219514
91177308-0d34-0410-b5e6-
96231b3b80d8
Hal Finkel [Fri, 10 Oct 2014 17:06:20 +0000 (17:06 +0000)]
[MiSched] Fix a logic error in tryPressure()
Fixes a logic error in the MachineScheduler found by Steve Montgomery (and
confirmed by Andy). This has gone unfixed for months because the fix has been
found to introduce some small performance regressions. However, Andy has
recommended that, at this point, we fix this to avoid further dependence on the
incorrect behavior (and then follow-up separately on any regressions), and I
agree.
Fixes PR18883.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219512
91177308-0d34-0410-b5e6-
96231b3b80d8
Reed Kotler [Fri, 10 Oct 2014 17:00:46 +0000 (17:00 +0000)]
Implement floating point to integer conversion in mips fast-isel
Summary: Add the ability to convert 64 or 32 bit floating point values to integer in mips fast-isel
Test Plan:
fpintconv.ll
ran 4 flavors of test-suite with no errors, misp32 r1/r2 O0/O2
Reviewers: dsanders
Reviewed By: dsanders
Subscribers: llvm-commits, rfuhler, mcrosier
Differential Revision: http://reviews.llvm.org/D5562
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219511
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 10 Oct 2014 16:59:52 +0000 (16:59 +0000)]
Simplify a few uses of DwarfDebug::SPMap
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219510
91177308-0d34-0410-b5e6-
96231b3b80d8
Timur Iskhodzhanov [Fri, 10 Oct 2014 16:05:32 +0000 (16:05 +0000)]
Reorder functions in WinCodeViewLineTables.cpp [NFC]
This helps read the comments and understand the code in a natural order
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219508
91177308-0d34-0410-b5e6-
96231b3b80d8
Frederic Riss [Fri, 10 Oct 2014 15:51:10 +0000 (15:51 +0000)]
[dwarfdump] Prettyprint DW_AT_APPLE_property_attribute bitfield values.
This change depends on the ApplePropertyString helper that I sent spearately.
Not sure how you want this tested: as a tool test by adding a binary to dump, or as an llvm test starting from an IR file?
Reviewers: dblaikie, samsonov
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D5689
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219507
91177308-0d34-0410-b5e6-
96231b3b80d8
Frederic Riss [Fri, 10 Oct 2014 15:51:02 +0000 (15:51 +0000)]
[dwarfdump] Resolve also variable specifications/abstract_origins.
DW_AT_specification and DW_AT_abstract_origin resolving was only performed
on subroutine DIEs because it used the getSubroutineName method. Introduce
a more generic getName() and use it to dump the reference attributes.
Testcases have been updated to check the printed names instead of the offsets
except when the name could be ambiguous.
Reviewers: dblaikie, samsonov
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D5625
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219506
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Fri, 10 Oct 2014 15:32:50 +0000 (15:32 +0000)]
Reduce double set lookups. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219505
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Schmidt [Fri, 10 Oct 2014 15:09:28 +0000 (15:09 +0000)]
[PowerPC] Add feature for Power8 vector extensions
The current VSX feature for PowerPC specifies availability of the VSX
instructions added with the 2.06 architecture version. With 2.07, the
architecture adds new instructions to both the Category:Vector and
Category:VSX instruction sets. Additionally, unaligned vector storage
operations have improved performance.
This patch adds a feature to provide access to the new instructions
and performance capabilities of Power8. For compatibility with GCC,
the feature is controlled via a new -mpower8-vector switch, and the
feature causes the __POWER8_VECTOR__ builtin define to be generated by
the preprocessor.
There is a companion patch for cfe being committed at the same time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219501
91177308-0d34-0410-b5e6-
96231b3b80d8
Zoran Jovanovic [Fri, 10 Oct 2014 14:37:30 +0000 (14:37 +0000)]
[mips][microMIPS] Implement ADDIUSP instruction
Differential Revision: http://reviews.llvm.org/D5084
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219500
91177308-0d34-0410-b5e6-
96231b3b80d8
Zoran Jovanovic [Fri, 10 Oct 2014 14:02:44 +0000 (14:02 +0000)]
[mips][microMIPS] Implement JR16 instruction
Differential Revision: http://reviews.llvm.org/D5062
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219498
91177308-0d34-0410-b5e6-
96231b3b80d8
Zoran Jovanovic [Fri, 10 Oct 2014 13:45:34 +0000 (13:45 +0000)]
[mips][microMIPS] Implement ADDIUS5 instruction
Differential Revision: http://reviews.llvm.org/D5049
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219495
91177308-0d34-0410-b5e6-
96231b3b80d8
Zoran Jovanovic [Fri, 10 Oct 2014 13:31:18 +0000 (13:31 +0000)]
ps][microMIPS] Implement JRC instruction
Differential Revision: http://reviews.llvm.org/D5045
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219494
91177308-0d34-0410-b5e6-
96231b3b80d8
Zoran Jovanovic [Fri, 10 Oct 2014 13:22:28 +0000 (13:22 +0000)]
[mips][microMIPS] Implement JALRS16 instruction
Differential Revision: http://reviews.llvm.org/D5027
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219493
91177308-0d34-0410-b5e6-
96231b3b80d8
Timur Iskhodzhanov [Fri, 10 Oct 2014 12:52:58 +0000 (12:52 +0000)]
Fix a small typo, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219492
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Fri, 10 Oct 2014 10:18:12 +0000 (10:18 +0000)]
APInt: Unfold return expressions so RVO can work.
Saves a couple of expensive deep copies. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219487
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Fri, 10 Oct 2014 08:27:22 +0000 (08:27 +0000)]
[ADT] Add an (ADL-friendly) abs free function for APFloat that returns
by value having cleared the sign bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219485
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Fri, 10 Oct 2014 08:27:19 +0000 (08:27 +0000)]
Don't use an unqualified 'abs' function call with a builtin type.
This is dangerous for numerous reasons. The primary risk here is with
floating point or double types where if the wrong header files are
included in a strange order this can implicitly convert to integers and
then call the C abs function on the integers. There is a secondary risk
that even impacts integers where if the namespace the code is written in
ever defines an abs overload for types within that namespace the global
abs will be hidden. The correct form is to call std::abs or write 'using
std::abs' for builtin types (and only the latter is correct in any
generic context).
I've also added the requisite header to be a bit more explicit here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219484
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Fri, 10 Oct 2014 06:59:05 +0000 (06:59 +0000)]
Add tests for r219479.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219480
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Fri, 10 Oct 2014 06:58:11 +0000 (06:58 +0000)]
Object, COFF: Relax aux symbols for section definitions
We, I suppose naïvely, believed the COFF specification with regard to
auxiliary symbol records which defined sections: they specified that the
symbol value should be zero. However, dumpbin and MinGW's objdump do
not consider the symbol value as a restriction. Relaxing this allows us
to properly dump MinGW linked executables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219479
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 10 Oct 2014 06:39:29 +0000 (06:39 +0000)]
Sink the per-CU part of DwarfDebug::finishSubprogramDefinitions into DwarfCompileUnit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219477
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Fri, 10 Oct 2014 06:39:26 +0000 (06:39 +0000)]
Sink most of DwarfDebug::constructAbstractSubprogramScopeDIE down into DwarfCompileUnit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219476
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Fri, 10 Oct 2014 05:21:32 +0000 (05:21 +0000)]
Add minnum / maxnum to APFloat
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219475
91177308-0d34-0410-b5e6-
96231b3b80d8