Commit Graph

9272 Commits

Author SHA1 Message Date
Evan Cheng
6e5dfd4bf5 Instcombine constant folding can normalize gep with negative index to index with large offset. When instcombine objsize checking transformation sees these geps where the offset seemingly point out of bound, it should just return "i don't know" rather than asserting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96825 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 23:34:00 +00:00
Dan Gohman
12f9168bc3 Add a test for canonicalizing ConstantExpr operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96820 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 23:07:52 +00:00
Dan Gohman
0e488b3d1c Canonicalize ConstantInts to the right operand of commutative
operators.

The test difference is just due to the multiplication operands
being commuted (and thus requiring a more elaborate match). In
optimized code, that expression would be folded.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96816 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 22:43:23 +00:00
Dan Gohman
fc90d4c0f4 Actually enable the -enable-unsafe-fp-math tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96796 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 18:53:26 +00:00
Arnold Schwaighofer
9265275a9a Mark the return address stack slot as mutable when moving the return address
during a tail call. A parameter might overwrite this stack slot during the tail
call. 

The sequence during a tail call is:
1.) load return address to temp reg
2.) move parameters (might involve storing to return address stack slot)
3.) store return address to new location from temp reg

If the stack location is marked immutable CodeGen can colocate load (1) with the
store (3).

This fixes bug 6225.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96783 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 16:18:09 +00:00
Daniel Dunbar
3591b90843 LLVMC/MultiplePluginPriorities.td: Generally XFAIL this test for now, it is
still failing during (one) llvm-gcc powerpc build, and is also failing on my
x86_64-apple-darwin10.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96781 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 05:55:32 +00:00
Dan Gohman
6b617a7213 Constant-fold certain comparisons with infinity and negative infinity.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96777 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 04:06:03 +00:00
Dan Gohman
8ce05daf54 Remove the logic for reasoning about NaNs from the code that forms
SSE min and max instructions. The real thing this code needs to be
concerned about is negative zero.

Update the sse-minmax.ll test accordingly, and add tests for
-enable-unsafe-fp-math mode as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96775 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 04:03:39 +00:00
Dan Gohman
278f958c61 When emitting an instruction which depends on both a post-incremented
induction variable value and a loop-variant value, don't force the
insert position to be at the post-increment position, because it may
not be dominated by the loop-variant value. This fixes a
use-before-def problem noticed on PPC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96774 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 03:59:54 +00:00
Chris Lattner
728ea19ece add some no-unwinds, other minor cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96756 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 20:33:20 +00:00
Chris Lattner
25e0f91d05 add a triple so that this doesn't fail due to linux/ppc register printing
syntax.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96748 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 19:27:38 +00:00
Chris Lattner
ad14fcc4c2 filecheckize and add nouwinds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96745 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 18:53:28 +00:00
Anton Korobeynikov
455080ff10 IT turns out that during jumpless setcc lowering eq and ne were swapped.
This fixes PR6348

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96734 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 12:28:58 +00:00
Chris Lattner
f1c6428164 fix and un-xfail X86/vec_ss_load_fold.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96720 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 04:53:34 +00:00
Chris Lattner
7f6de7df46 temporarily disable this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96717 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 03:24:41 +00:00
Dan Gohman
aae01f17a6 Check for overflow when scaling up an add or an addrec for
scaled reuse.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96692 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 19:32:49 +00:00
Charles Davis
5dfa26795d Add support for the 'alignstack' attribute to the x86 backend. Fixes PR5254.
Also, FileCheck'ize a test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96686 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 18:17:13 +00:00
Dan Gohman
00cb5b7245 Teach ScalarEvolution how to compute a tripcount for a loop with
true or false as its exit condition. These are usually eliminated by
SimplifyCFG, but the may be left around during a pass which wishes
to preserve the CFG.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96683 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 18:12:07 +00:00
Duncan Sands
3eba667081 Revert commits 96556 and 96640, because commit 96556 breaks the
dragonegg self-host build.  I reverted 96640 in order to revert
96556 (96640 goes on top of 96556), but it also looks like with
both of them applied the breakage happens even earlier.  The
symptom of the 96556 miscompile is the following crash:

  llvm[3]: Compiling AlphaISelLowering.cpp for Release build
  cc1plus: /home/duncan/tmp/tmp/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:4982: void llvm::SelectionDAG::ReplaceAllUsesWith(llvm::SDNode*, llvm::SDNode*, llvm::SelectionDAG::DAGUpdateListener*): Assertion `(!From->hasAnyUseOfValue(i) || From->getValueType(i) == To->getValueType(i)) && "Cannot use this version of ReplaceAllUsesWith!"' failed.
  Stack dump:
  0.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@_ZN4llvm19AlphaTargetLowering14LowerOperationENS_7SDValueERNS_12SelectionDAGE'
  g++: Internal error: Aborted (program cc1plus)

This occurs when building LLVM using LLVM built by LLVM (via
dragonegg).  Probably LLVM has miscompiled itself, though it
may have miscompiled GCC and/or dragonegg itself: at this point
of the self-host build, all of GCC, LLVM and dragonegg were built
using LLVM.  Unfortunately this kind of thing is extremely hard
to debug, and while I did rummage around a bit I didn't find any
smoking guns, aka obviously miscompiled code.

Found by bisection.

r96556 | evancheng | 2010-02-18 03:13:50 +0100 (Thu, 18 Feb 2010) | 5 lines

Some dag combiner goodness:
Transform br (xor (x, y)) -> br (x != y)
Transform br (xor (xor (x,y), 1)) -> br (x == y)
Also normalize (and (X, 1) == / != 1 -> (and (X, 1)) != / == 0 to match to "test on x86" and "tst on arm"

r96640 | evancheng | 2010-02-19 01:34:39 +0100 (Fri, 19 Feb 2010) | 16 lines

Transform (xor (setcc), (setcc)) == / != 1 to
(xor (setcc), (setcc)) != / == 1.

e.g. On x86_64
  %0 = icmp eq i32 %x, 0
  %1 = icmp eq i32 %y, 0
  %2 = xor i1 %1, %0
  br i1 %2, label %bb, label %return
=>
	testl   %edi, %edi
	sete    %al
	testl   %esi, %esi
	sete    %cl
	cmpb    %al, %cl
	je      LBB1_2



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96672 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 11:30:41 +00:00
Devang Patel
7b9d6d2e55 Test case for r96656.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96657 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 02:58:33 +00:00
Evan Cheng
97a35fc3a7 Transform (xor (setcc), (setcc)) == / != 1 to
(xor (setcc), (setcc)) != / == 1.

e.g. On x86_64
  %0 = icmp eq i32 %x, 0
  %1 = icmp eq i32 %y, 0
  %2 = xor i1 %1, %0
  br i1 %2, label %bb, label %return
=>
	testl   %edi, %edi
	sete    %al
	testl   %esi, %esi
	sete    %cl
	cmpb    %al, %cl
	je      LBB1_2


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96640 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 00:34:39 +00:00
Dan Gohman
1b7bf18def When determining the set of interesting reuse factors, consider
strides in foreign loops. This helps locate reuse opportunities
with existing induction variables in foreign loops and reduces
the need for inserting new ones. This fixes rdar://7657764.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96629 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 00:05:23 +00:00
Mon P Wang
1c40e188c5 getSplatIndex assumes that the first element of the mask contains the splat index
which is not always true if the mask contains undefs. Modified it to return
the first non undef value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96621 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 22:33:18 +00:00
Jakob Stoklund Olesen
352d352c02 Always normalize spill weights, also for intervals created by spilling.
Moderate the weight given to very small intervals.

The spill weight given to new intervals created when spilling was not
normalized in the same way as the original spill weights calculated by
CalcSpillWeights. That meant that restored registers would tend to hang around
because they had a much higher spill weight that unspilled registers.

This improves the runtime of a few tests by up to 10%, and there are no
significant regressions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96613 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 21:33:05 +00:00
Dan Gohman
49d7f8d341 Make CodePlacementOpt detect special EH control flow by
checking whether AnalyzeBranch disagrees with the CFG
directly, rather than looking for EH_LABEL instructions.
EH_LABEL instructions aren't always at the end of the
block, due to FP_REG_KILL and other things. This fixes
an infinite loop compiling MultiSource/Benchmarks/Bullet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96611 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 21:25:53 +00:00
Devang Patel
16c1e79cb2 Ignore target dependent value in grep search.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96604 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 19:52:12 +00:00
Chris Lattner
7954926aeb remove empty file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96573 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 06:29:06 +00:00
Bob Wilson
9f6c4c141f Use NEON vmin/vmax instructions for floating-point selects.
Radar 7461718.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96572 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 06:05:53 +00:00
Jeffrey Yasskin
2155d459a7 Roll back the shared library, r96559. It broke two darwins and arm, mysteriously.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96569 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 04:43:02 +00:00
Jeffrey Yasskin
f6afae2f49 Add a shared library for LLVM, named libLLVM2.7svn.(so|dylib), and add an
--enable-shared configure flag to have the tools linked shared. (2.7svn is just
$(LLVMVersion) so it'll change to "2.7" in the release.)  Always link the
example programs shared to test that the shared library keeps working.

On my mac laptop, Debug libLLVM2.7svn.dylib is 39MB, and opt (for example) is
16M static vs 440K shared.

Two things are less than ideal here:
1) The library doesn't include any version information. Since we expect to break
the ABI with every release, this shouldn't be much of a problem. If we do
release a compatible 2.7.1, we may be able to hack its library to work with
binaries compiled against 2.7.0, or we can just ask them to recompile. I'm
hoping to get a real packaging expert to look at this for the 2.8 release.
2) llvm-config doesn't yet have an option to print link options for the shared
library. I'll add this as a subsequent patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96559 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 02:36:02 +00:00
Evan Cheng
89bb7b5640 Some dag combiner goodness:
Transform br (xor (x, y)) -> br (x != y)
Transform br (xor (xor (x,y), 1)) -> br (x == y)
Also normalize (and (X, 1) == / != 1 -> (and (X, 1)) != / == 0 to match to "test on x86" and "tst on arm"


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96556 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 02:13:50 +00:00
Devang Patel
ca82a15ad1 New test case for r96543.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96544 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 00:53:49 +00:00
Eric Christopher
a8572bbd39 Revert:
r95605 | dpatel | 2010-02-08 15:27:46 -0800 (Mon, 08 Feb 2010) | 2 lines

test case for r95604.

Which was the testcase for the patch reverted from llvm-gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96474 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-17 08:53:27 +00:00
Devang Patel
22fb4b2a57 Before setting scope end marker, pay attention to scope begin marker and existing scope end marker, if any. Scope must begin before it ends and nested inlined scope do not truncate surrounding scope.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96445 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-17 02:20:34 +00:00
Dan Gohman
2a5431e004 Don't check for comments, which vary between subtargets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96434 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-17 01:08:57 +00:00
Dan Gohman
9ee7123ab4 Fold bswap(undef) to undef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96432 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-17 00:54:58 +00:00
Dan Gohman
968cb939e5 Don't attempt to divide INT_MIN by -1; consider such cases to
have overflowed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96428 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-17 00:41:53 +00:00
Chris Lattner
ca0aacc5aa roundss is an sse 4 thing, fix the test on non-sse41 builders
like llvm-gcc-x86_64-darwin10-selfhost


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96417 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-17 00:29:06 +00:00
Dale Johannesen
4a12de72b0 Make g5 target explicit; scheduling affects register choice.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96413 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 23:25:23 +00:00
Chris Lattner
92d3ada814 fix rdar://7653908, a crash on a case where we would fold a load
into a roundss intrinsic, producing a cyclic dag.  The root cause
of this is badness handling ComplexPattern nodes in the old dagisel
that I noticed through inspection.  Eliminate a copy of the of the
code that handled ComplexPatterns by making EmitChildMatchCode call
into EmitMatchCode.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96408 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 22:35:06 +00:00
Dale Johannesen
55f9adf543 Adjust register numbers in tests to compensate for the
new lack of R2.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96407 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 22:31:31 +00:00
Chris Lattner
5583b83dd4 filecheckize
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96404 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 22:13:43 +00:00
Devang Patel
08d3561eee New testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96391 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 21:16:08 +00:00
Evan Cheng
ae3ecf9603 Look for SSE and instructions of this form: (and x, (build_vector c1,c2,c3,c4)).
If there exists a use of a build_vector that's the bitwise complement of the mask,
then transform the node to
(and (xor x, (build_vector -1,-1,-1,-1)), (build_vector ~c1,~c2,~c3,~c4)).

Since this transformation is only useful when 1) the given build_vector will
become a load from constpool, and 2) (and (xor x -1), y) matches to a single
instruction, I decided this is appropriate as a x86 specific transformation.
rdar://7323335


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96389 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 21:09:44 +00:00
David Greene
8939b0d8a9 Add support for emitting non-temporal stores for DAGs marked
non-temporal.  Fix from r96241 for botched encoding of MOVNTDQ.

Add documentation for !nontemporal metadata.

Add a simpler movnt testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96386 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 20:50:18 +00:00
Bob Wilson
713bc585ef Testcase for critical edge splitting with load PRE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96385 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 20:48:55 +00:00
Bob Wilson
1665b0a224 Fix pr6111: Avoid using the LR register for the target address of an indirect
branch in ARM v4 code, since it gets clobbered by the return address before
it is used.  Instead of adding a new register class containing all the GPRs
except LR, just use the existing tGPR class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96360 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 17:24:15 +00:00
Chris Lattner
a08b587494 make pcrel immediate values relative to the start of the field,
not the end of the field, fixing rdar://7651978


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96330 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 05:03:17 +00:00
Dan Gohman
c2385a0741 Split the main for-each-use loop again, this time for GenerateTruncates,
as it also peeks at which registers are being used by other uses. This
makes LSR less sensitive to use-list order.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96308 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 01:42:53 +00:00
Anton Korobeynikov
9184b25fa5 Preliminary patch to improve dwarf EH generation - Hooks to return Personality / FDE / LSDA / TType encoding depending on target / options (e.g. code model / relocation model) - MCIzation of Dwarf EH printer to use encoding information - Stub generation for ELF target (needed for indirect references) - Some other small changes here and there
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96285 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-15 22:35:59 +00:00