Evan Cheng
c419350132
Throttle back "fold select into operand" transformation. InstCombine should not generate selects of two constants unless they are selects of 0 and 1.
...
e.g.
define i32 @t1(i32 %c, i32 %x) nounwind {
%t1 = icmp eq i32 %c, 0
%t2 = lshr i32 %x, 18
%t3 = select i1 %t1, i32 %t2, i32 %x
ret i32 %t3
}
was turned into
define i32 @t2(i32 %c, i32 %x) nounwind {
%t1 = icmp eq i32 %c, 0
%t2 = select i1 %t1, i32 18, i32 0
%t3 = lshr i32 %x, %t2
ret i32 %t3
}
For most targets, that means materializing two constants and then a select. e.g. On x86-64
movl %esi, %eax
shrl $18, %eax
testl %edi, %edi
cmovne %esi, %eax
ret
=>
xorl %eax, %eax
testl %edi, %edi
movl $18, %ecx
cmovne %eax, %ecx
movl %esi, %eax
shrl %cl, %eax
ret
Also, the optimizer and codegen can reason about shl / and / add, etc. by a constant. This optimization will hinder optimizations using ComputeMaskedBits.
llvm-svn: 68142
2009-03-31 20:42:45 +00:00
Evan Cheng
0674a512bf
Fully general expansion of integer shift of any size.
...
llvm-svn: 68134
2009-03-31 19:39:24 +00:00
Evan Cheng
44fdb5d570
i128 shift libcalls are not available on x86.
...
llvm-svn: 68133
2009-03-31 19:38:51 +00:00
Dan Gohman
86e4d0130c
Reapply 68073, with fixes. EH Landing-pad basic blocks are not
...
entered via fall-through. Don't miss fallthroughs from blocks
terminated by conditional branches. Also, move
isOnlyReachableByFallthrough out of line.
llvm-svn: 68129
2009-03-31 18:39:13 +00:00
Mikhail Glushenkov
98603f97fa
Do not pass '-relocation-model=pic' to llc.
...
Does not work well on 32 bit targets. Bug reported by Albert Graef.
This patch also adds new "-Wllc,option" syntax to pass options to llc.
llvm-svn: 68127
2009-03-31 18:33:54 +00:00
Douglas Gregor
50b29cfe51
Stop guessing, start thinking, and make PointerUnion3::is actually be correct.
...
llvm-svn: 68126
2009-03-31 18:31:03 +00:00
Dan Gohman
9f7d1f2bd4
Add an explicit -asm-verbose to these tests, to make it
...
possible to run the tests with -asm-verbose defaulting
to false.
llvm-svn: 68124
2009-03-31 18:20:47 +00:00
Devang Patel
7fa69ef109
Update call graph after inlining invoke.
...
Patch by Jay Foad.
llvm-svn: 68120
2009-03-31 17:36:12 +00:00
Daniel Dunbar
aec3d9857f
Add llvm::sys::getHostTriple and remove
...
llvm::sys::getOS{Name,Version}.
Right now the implementation just derives from LLVM_HOSTTRIPLE (which
is wrong, but it doesn't look like we have a define for the target
triple). Ideally this routine would actually be able to compute the
triple for targets we care about.
llvm-svn: 68118
2009-03-31 17:30:15 +00:00
Dan Gohman
5f64e10d8d
Minor top-level comment fix.
...
llvm-svn: 68113
2009-03-31 16:51:18 +00:00
Dan Gohman
9ab58351ba
Tidy up some comments.
...
llvm-svn: 68112
2009-03-31 16:48:35 +00:00
Dan Gohman
ae2ffc985b
Add a comment.
...
llvm-svn: 68111
2009-03-31 16:46:45 +00:00
Rafael Espindola
3d866ac20c
remove unused arguments.
...
llvm-svn: 68109
2009-03-31 16:16:57 +00:00
Bill Wendling
28fad6fcc1
Really temporarily revert r68073.
...
llvm-svn: 68100
2009-03-31 08:42:40 +00:00
Bill Wendling
1c40c8c242
Oy! When reverting r68073, I added in experimental code. Sorry...
...
llvm-svn: 68099
2009-03-31 08:41:31 +00:00
Owen Anderson
59cff6919d
Remove the "fast" cases for spill and restore point determination, as these were subtlely wrong in obscure cases. Patch the testcase
...
to account for this change.
llvm-svn: 68093
2009-03-31 08:27:09 +00:00
Bill Wendling
4706abded2
Revert r68073. It's causing a failure in the Apple-style builds.
...
llvm-svn: 68092
2009-03-31 08:26:26 +00:00
Chris Lattner
95a32aa18b
shrink subclassid, liberating some bits for future (ab)use.
...
llvm-svn: 68087
2009-03-31 07:25:22 +00:00
Dan Gohman
cba99ee717
Fix live-out reg logic to not insert over-aggressive AssertZExt
...
instructions. This fixes lua.
llvm-svn: 68083
2009-03-31 01:38:29 +00:00
Evan Cheng
5c02e62620
X86 address mode isel tweak. If the base of the address is also used by a CopyToReg (i.e. it's likely live-out), do not fold the sub-expressions into the addressing mode to avoid computing the address twice. The CopyToReg use will be isel'ed to a LEA, re-use it for address instead.
...
This is not yet enabled.
llvm-svn: 68082
2009-03-31 01:13:53 +00:00
Douglas Gregor
41ab75e9ef
Really, really fix PointerUnion3::is
...
llvm-svn: 68079
2009-03-31 00:34:31 +00:00
Dan Gohman
29694088d3
Except in asm-verbose mode, avoid printing labels for blocks that are
...
only reachable via fall-through edges. This dramatically reduces the
number of labels printed, and thus also the number of labels the
assembler must parse and remember.
llvm-svn: 68073
2009-03-30 22:55:17 +00:00
Devang Patel
ec65625744
Loop Index Split can eliminate a loop if it can determin if loop body is executed only once. There was a bug in determining IV based value of the iteration for which the loop body is executed. Fix it.
...
llvm-svn: 68071
2009-03-30 22:24:10 +00:00
Douglas Gregor
0beaefea25
Make PointerUnion3::get work properly
...
llvm-svn: 68067
2009-03-30 21:44:13 +00:00
Evan Cheng
3e30bcbd69
When optimzing a mul by immediate into two, the resulting mul's should get a x86 specific node to avoid dag combiner from hacking on them further.
...
llvm-svn: 68066
2009-03-30 21:36:47 +00:00
Evan Cheng
d7824e208a
Turn a 2-address instruction into a 3-address one when it's profitable even if the two-address operand is killed.
...
e.g.
%reg1024<def> = MOV r1
%reg1025<def> = ADD %reg1024, %reg1026
r0 = MOV %reg1025
If it's not possible / profitable to commute ADD, then turning ADD into a LEA saves a copy.
llvm-svn: 68065
2009-03-30 21:34:07 +00:00
Chris Lattner
ccc73c9327
update comment.
...
llvm-svn: 68060
2009-03-30 20:44:04 +00:00
Bill Wendling
76042faa52
Balance out quote in debug output.
...
llvm-svn: 68059
2009-03-30 20:32:22 +00:00
Bill Wendling
3b2cea6ef5
Fix grammar-o in comment.
...
llvm-svn: 68057
2009-03-30 20:30:02 +00:00
Chris Lattner
a172ae1d4f
add a PointerUnion3 class and generalize PointerUnion to work with
...
anything pointer-like, which may or may not actually be a pointer.
llvm-svn: 68056
2009-03-30 20:29:27 +00:00
Chris Lattner
2d00a451cb
fix the PointerLikeTypeTraits specialization for PointerIntPair to
...
allow the traits to be specified as well.
llvm-svn: 68055
2009-03-30 20:28:50 +00:00
Dan Gohman
abcfb30fc2
Constify arguments in isSuccessor and isLayoutSuccessor.
...
llvm-svn: 68054
2009-03-30 20:06:29 +00:00
Dan Gohman
d85cf9d361
Update the polygen grammer to reflect that zext and sext are no longer
...
valid argument attributes (zeroext and signext are).
llvm-svn: 68053
2009-03-30 19:59:02 +00:00
John Mosby
9b1b8d54fe
docs/TestingGuide.html: correction to prev. text (objdir!=srcdir required for running test-suite), removed refs to llvm-test
...
llvm-svn: 68051
2009-03-30 18:56:53 +00:00
Bob Wilson
d59a64d436
Fix comment to match function name.
...
llvm-svn: 68050
2009-03-30 18:49:37 +00:00
Devang Patel
94dbbb5768
getEntryFor() may invalidate DenseMap iterator.
...
Walking an invalidated iterator is not a good idea.
llvm-svn: 68047
2009-03-30 18:34:47 +00:00
Mike Stump
b50565295f
Add ccc back for now.
...
llvm-svn: 68038
2009-03-30 17:43:04 +00:00
Anton Korobeynikov
a11549d252
Clearify local/global relocations wording
...
llvm-svn: 68037
2009-03-30 17:38:00 +00:00
Anton Korobeynikov
880f98920c
Fix thinko: put stuff with both global and local relocations into data.rel{.ro}, not .local
...
llvm-svn: 68036
2009-03-30 17:37:43 +00:00
Anton Korobeynikov
497fd0e996
Tweak test for recent relro stuff
...
llvm-svn: 68035
2009-03-30 15:28:40 +00:00
Anton Korobeynikov
d03a7a7e8c
Fix infinite looping
...
llvm-svn: 68034
2009-03-30 15:28:21 +00:00
Anton Korobeynikov
b026804e7c
Properly propagate Kind.
...
llvm-svn: 68033
2009-03-30 15:28:00 +00:00
Anton Korobeynikov
0404baca28
Do not propagate ELF-specific stuff (data.rel) into other targets. This simplifies code and also ensures correctness.
...
llvm-svn: 68032
2009-03-30 15:27:43 +00:00
Anton Korobeynikov
2ea565a37b
Add data.rel stuff
...
llvm-svn: 68031
2009-03-30 15:27:03 +00:00
Chris Lattner
1901988355
fix some validation problems.
...
llvm-svn: 68026
2009-03-30 06:34:59 +00:00
Evan Cheng
5c460dbc3d
Forgot this test.
...
llvm-svn: 68025
2009-03-30 06:17:34 +00:00
John Mosby
8d4d6376bb
Clarify section on setting up and running test-suite
...
llvm-svn: 68023
2009-03-30 04:37:51 +00:00
Misha Brukman
78da0fbc46
Updated the comment for isArithmeticShift() to match reality.
...
llvm-svn: 68016
2009-03-29 20:41:38 +00:00
Bill Wendling
668e03b2b8
Constify check. This fixes PR3900.
...
llvm-svn: 68013
2009-03-29 20:08:56 +00:00
Anton Korobeynikov
d24f576124
Testcase for recent ro/relocs stuff
...
llvm-svn: 68008
2009-03-29 17:14:57 +00:00