Commit Graph

37688 Commits

Author SHA1 Message Date
Chris Lattner
69a74ab421 Add an issue that is preventing instcombine from doing a simplification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48356 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-14 06:00:19 +00:00
Duncan Sands
d1ba3338d1 Simplify using getIntPtrConstant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48355 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-14 05:23:57 +00:00
Bill Wendling
b9d4f8df70 The inst combining of inttoptr into GEP with one index was using the bit size of
the type instead of the byte size. This was causing troublesome mis-compilations.

True to form, this took 2 days to find and is a one-line fix. :-P


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48354 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-14 05:12:19 +00:00
Evan Cheng
15fda403f3 Add an MO_Undef MachineOperandType, intended for INSERT_SUBREG. Next up MO_Undead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48353 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-14 01:47:49 +00:00
Nate Begeman
5922f561c6 Tabs -> spaces
Use getIntPtrConstant in a couple places to shorten stuff up
Handle splitting vector shuffles with undefs in the mask


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48351 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-14 00:53:31 +00:00
Evan Cheng
1090fc99cd Forgot this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48349 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-14 00:17:29 +00:00
Evan Cheng
db2d773fe6 Livein copy scheduling fixes: do not coalesce physical register copies, correctly determine the safe location to insert the copies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48348 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-14 00:14:55 +00:00
Dan Gohman
704df9fcbd Use SDTNone instead of duplicating it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48346 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 23:07:40 +00:00
Dan Gohman
8131a50f44 Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48345 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 23:04:27 +00:00
Dan Gohman
002e5d0a17 More APInt-ification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48344 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 22:13:53 +00:00
Owen Anderson
8a97fddbc2 Fix a bug in GVN that Duncan noticed, where we potentially need to insert a
pointer bitcast when performing return slot optimization.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48343 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 22:07:10 +00:00
Tanya Lattner
200d607b45 Fix error in testing for END. notation.
Patch by Julien Lerouge. Thanks!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48342 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 22:02:51 +00:00
Evan Cheng
c438f35df9 Undo tweak. It had no obvious benefit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48341 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 17:42:48 +00:00
Devang Patel
a13341737d Remove unused GetAddressOfSymbol()
Thanks Daniel Dunbar!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48340 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 16:55:34 +00:00
Evan Cheng
a56516ee08 New test case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48338 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 08:05:02 +00:00
Evan Cheng
a2248682ae Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48337 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 08:04:35 +00:00
Evan Cheng
0099ae2468 Don't try to sink 3-address instruction if convertToThreeAddress created more than one instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48336 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 07:56:58 +00:00
Evan Cheng
d99464d647 A test case I forgot to check in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48335 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 06:42:46 +00:00
Evan Cheng
f3ff6992a3 Remove an unused command line option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48334 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 06:38:28 +00:00
Evan Cheng
875357d213 TwoAddressInstructionPass enhancement. After it converts a two address instruction into a 3-address one, sink it past the instruction that kills the read-mod-write register if its definition is used past the kill. This reduces the number of live register by one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48333 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 06:37:55 +00:00
Christopher Lamb
6634e26aa1 Get rid of a pseudo instruction and replace it with subreg based operation on real instructions, ridding the asm printers of the hack used to do this previously. In the process, update LowerSubregs to be careful about eliminating copies that have side affects.
Note: the coalescer will have to be careful about this too, when it starts coalescing insert_subreg nodes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48329 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 05:47:01 +00:00
Chris Lattner
3bdfa04cbe Fix Path::GetMainExecutable on cygwin, patch by Sam Bishop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48328 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 05:22:05 +00:00
Chris Lattner
a17fa28ac2 remove extraneous namespace qualifier, PR2142
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48327 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 05:17:59 +00:00
Chris Lattner
d5d94df73f move a bunch of trivial methods to be inline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48326 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 05:00:21 +00:00
Chris Lattner
041221c097 Various improvements suggested by Duncan
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48325 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 04:33:03 +00:00
Chris Lattner
7520fcd7a5 Fix an incorrect comment, PR2147.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48323 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 03:29:42 +00:00
Evan Cheng
fe666a3592 Improve VarInfo::removeKill() by using std::find instead of linear search.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48321 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 02:42:55 +00:00
Nick Lewycky
6e7aeb16fa Update -mem2reg to use succ_iterator instead of iterating across TerminatorInst
successors. This makes it support nounwind.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48320 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 02:42:41 +00:00
Evan Cheng
1c9b8cf28c Remove unused options.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48319 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 02:41:34 +00:00
Dan Gohman
59ef015c65 Eliminate a few unnecessary uses of dynamic_cast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48318 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 02:08:36 +00:00
Dan Gohman
9769cee9f7 Fix a typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48317 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 01:58:48 +00:00
Dan Gohman
5fe6e33ef8 Don't redundantly clear std::vector members in destructors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48316 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 01:57:34 +00:00
Dan Gohman
0961ec1afe Change PMTopLevelManager's PassManagers vector element type from
Pass* to PMDataManager*. PMDataManager is more specific than Pass,
so this more accurately describes the objects that are being stored.

This eliminates the need for several dynamic_casts to PMDataManager*.
It does introduce one dynamic_cast though, in dumpPasses(). Give
this one a comment describing why a dynamic_cast is being used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48315 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 01:48:32 +00:00
Dan Gohman
c2f12ab5e5 Change PMStack::push to accept a PMDataManager* instead of
a Pass*. PMDataManager* is what it actually holds, so this
makes it clearer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48314 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 01:21:31 +00:00
Dan Gohman
0ecd4c1a55 Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48313 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 01:08:50 +00:00
Dan Gohman
59746c2516 No need for typedefs with enums in C++.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48312 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 01:07:53 +00:00
Evan Cheng
b27087f5aa Refactor some code out of MachineSink into a MachineInstr query.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48311 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 00:44:09 +00:00
Dale Johannesen
d75686a471 Do not promote float params to double in varargs
calls here.  This was done earlier for params in
the varargs part of the params; any float params
that survive to here are in the non-varargs part,
and must not be promoted.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48310 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 23:40:01 +00:00
Evan Cheng
9e23336d0c Experimental scheduler change to schedule / coalesce the copies added for function livein's. Take 2008-03-10-RegAllocInfLoop.ll, the schedule looks like this after these copies are inserted:
entry: 0x12049d0, LLVM BB @0x1201fd0, ID#0:
Live Ins: %EAX %EDX %ECX
        %reg1031<def> = MOVPC32r 0
        %reg1032<def> = ADD32ri %reg1031, <es:_GLOBAL_OFFSET_TABLE_>, %EFLAGS<imp-def>
        %reg1028<def> = MOV32rr %EAX
        %reg1029<def> = MOV32rr %EDX
        %reg1030<def> = MOV32rr %ECX
        %reg1027<def> = MOV8rm %reg0, 1, %reg0, 0, Mem:LD(1,1) [0x1201910 + 0]
        %reg1025<def> = MOV32rr %reg1029
        %reg1026<def> = MOV32rr %reg1030
        %reg1024<def> = MOV32rr %reg1028

The copies unnecessarily increase register pressure and it will end up requiring a physical register to be spilled.

With -schedule-livein-copies:
entry: 0x12049d0, LLVM BB @0x1201fa0, ID#0:
Live Ins: %EAX %EDX %ECX
        %reg1031<def> = MOVPC32r 0
        %reg1032<def> = ADD32ri %reg1031, <es:_GLOBAL_OFFSET_TABLE_>, %EFLAGS<imp-def>
        %reg1024<def> = MOV32rr %EAX
        %reg1025<def> = MOV32rr %EDX
        %reg1026<def> = MOV32rr %ECX
        %reg1027<def> = MOV8rm %reg0, 1, %reg0, 0, Mem:LD(1,1) [0x12018e0 + 0]

Much better!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48307 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 22:19:41 +00:00
Duncan Sands
d8742eeb2f Initial soft-float support for LegalizeTypes. I rewrote
the fcopysign expansion from LegalizeDAG to get rid of
what seems to be a bug: the use of sign extension means
that when copying the sign bit from an f32 to an f64,
the upper 32 bits of the f64 (now an i64) are set, not
just the top bit...  I also generalized it to work for
any sized floating point types, and removed the bogosity:
  SDOperand Mask1 = (SrcVT == MVT::f64)
    ? DAG.getConstantFP(BitsToDouble(1ULL << 63), SrcVT)
    : DAG.getConstantFP(BitsToFloat(1U << 31), SrcVT);
  Mask1 = DAG.getNode(ISD::BIT_CONVERT, SrcNVT, Mask1);
(here SrcNVT is an integer with the same size as SrcVT).
As far as I can see this takes a 1 << 63, converts to
a double, converts that to a floating point constant
then converts that to an integer constant, ending up
with... 1 << 63 as an integer constant!  So I just
generate this integer constant directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48305 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 21:27:04 +00:00
Dan Gohman
b576931ca2 Change VirtRegMap's dump to dump to cerr, not DOUT, so that it
can be called from within a debuger without having -debug specified
on the command-line.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48298 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 20:52:10 +00:00
Dan Gohman
39e33acf0a Fix typos in comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48297 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 20:50:04 +00:00
Dan Gohman
89964b4ca1 Fix this test on hosts that don't have sse2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48296 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 20:40:51 +00:00
Duncan Sands
87a8615015 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48295 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 20:35:19 +00:00
Duncan Sands
25eb043759 Don't try to extract an i32 from an f64. This
getCopyToParts problem was noticed by the new
LegalizeTypes infrastructure.  In order to avoid
this kind of thing in the future I've added a
check that EXTRACT_ELEMENT is only used with
integers.  Once LegalizeTypes is up and running
most likely BUILD_PAIR and EXTRACT_ELEMENT can
be removed, in favour of using apints instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48294 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 20:30:08 +00:00
Chris Lattner
58d74910c6 Reimplement the parameter attributes support, phase #1. hilights:
1. There is now a "PAListPtr" class, which is a smart pointer around
   the underlying uniqued parameter attribute list object, and manages
   its refcount.  It is now impossible to mess up the refcount.
2. PAListPtr is now the main interface to the underlying object, and
   the underlying object is now completely opaque.
3. Implementation details like SmallVector and FoldingSet are now no
   longer part of the interface.
4. You can create a PAListPtr with an arbitrary sequence of
   ParamAttrsWithIndex's, no need to make a SmallVector of a specific 
   size (you can just use an array or scalar or vector if you wish).
5. All the client code that had to check for a null pointer before
   dereferencing the pointer is simplified to just access the 
   PAListPtr directly.
6. The interfaces for adding attrs to a list and removing them is a
   bit simpler.

Phase #2 will rename some stuff (e.g. PAListPtr) and do other less 
invasive changes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48289 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 17:45:29 +00:00
Chris Lattner
37f603f5d7 no need to keep around this output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48285 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 17:14:06 +00:00
Evan Cheng
709d19fb66 Document an implementation detail about EXTRACT_SUBREG and INSERT_SUBREG sub-register operand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48283 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 07:52:15 +00:00
Owen Anderson
6bb0bd52ec Improve the return slot optimization to be both more aggressive (not limited to sret parameters), and
safer (when the passed pointer might be invalid).  Thanks to Duncan and Chris for the idea behind this, 
and extra thanks to Duncan for helping me work out the trap-safety.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48280 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 07:37:44 +00:00
Evan Cheng
c8e3b147ee Clean up my own mess.
X86 lowering normalize vector 0 to v4i32. However DAGCombine can fold (sub x, x) -> 0 after legalization. It can create a zero vector of a type that's not expected (e.g. v8i16). We don't want to disable the optimization since leaving a (sub x, x) is really bad. Add isel patterns for other types of vector 0 to ensure correctness. It's highly unlikely to happen other than in bugpoint reduced test cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48279 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 07:02:50 +00:00