Commit Graph

3076 Commits

Author SHA1 Message Date
Chris Lattner
569a7f087a oops, I intended to remove this, not comment it out. Thanks Duncan!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67657 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-24 23:48:25 +00:00
Chris Lattner
a0e6969bbe canonicalize inttoptr and ptrtoint instructions which cast pointers
to/from integer types that are not intptr_t to convert to intptr_t
then do an integer conversion to the dest type.  This exposes the
cast to the optimizer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67638 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-24 18:35:40 +00:00
Chris Lattner
4f9797d683 two changes:
1. Make instcombine always canonicalize trunc x to i1 into an icmp(x&1).  This 
   exposes the AND to other instcombine xforms and is more of what the code
   generator expects.
2. Rewrite the remaining trunc pattern match to use 'match', which 
   simplifies it a lot.
   


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67635 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-24 18:15:30 +00:00
Duncan Sands
64da9409cb Factorize out a concept - no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67454 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-21 21:27:31 +00:00
Chris Lattner
344c7c5cc4 Fix instcombine to not introduce undefined shifts when merging two
shifts together.  This fixes PR3851.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67411 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-20 22:41:15 +00:00
Duncan Sands
ab6b226978 Don't load values out of global constants with weak
linkage: the value may be replaced with something
different at link time.  (Frontends that want to
allow values to be loaded out of weak constants can
give their constants weak_odr linkage).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67407 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-20 21:53:29 +00:00
Dale Johannesen
f4978e2094 This pass keeps a map of Instructions to Rank numbers,
and was deleting Instructions without clearing the
corresponding map entry.  This led to nondeterministic
behavior if the same address got allocated to another
Instruction within a short time.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67306 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-19 17:22:53 +00:00
Nick Lewycky
9c0f146d50 Remove strange extra semicolons.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67287 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-19 05:51:39 +00:00
Chris Lattner
b44b3666f9 Fix PR3826 - InstComb assert with vector shift, by not calling ComputeNumSignBits on a vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67211 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 16:32:19 +00:00
Zhou Sheng
b0c4199a55 Explicitly check for StoreInst, do not lose the chance to delete
unused loads or bitcasts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67202 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 12:48:48 +00:00
Zhou Sheng
16767c6b49 Revert my previous change on Local.cpp, instead, fix the bug on scalarrepl.
If the instruction has no users, it is also not only used by debug info 
and should not be deleted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67194 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 10:13:08 +00:00
Chris Lattner
b7e64ac3ac LSR shouldn't ever try to hack on integer IV's larger than 64-bits. Right now
it is not APInt clean, but even when it is it needs to be evaluated carefully
to determine whether it is actually profitable.

This fixes a crash on PR3806


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67134 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 23:58:30 +00:00
Chris Lattner
46d232d4bc Remove a condition which is always true.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67089 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 17:55:15 +00:00
Dale Johannesen
6b23339502 Fix a debug info dependency in jump threading.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67064 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 00:38:24 +00:00
Evan Cheng
fc0b80d974 Fix PR3784: If the source of a phi comes from a bb ended with an invoke, make sure the copy is inserted before the try range (unless it's used as an input to the invoke, then insert it after the last use), not at the end of the bb.
Also re-apply r66140 which was disabled as a workaround.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66976 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 22:59:14 +00:00
Bill Wendling
9a507cd915 Revert r66920. It was causing failures in the self-hosting buildbot (in release
mode).

Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/dg.exp ...
FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll -bugpoint-crashcalls -silence-passes > /dev/null
0   bugpoint          0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1   bugpoint          0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2   libSystem.B.dylib 0x92f112bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4   bugpoint          0x00021d1c main + 92
5   bugpoint          0x00002106 start + 54
6   bugpoint          0x00000004 start + 18446744073709543220
Stack dump:
0.    Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll -bugpoint-crashcalls -silence-passes 

FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll -dce -bugpoint-deletecalls -simplifycfg -silence-passes
0   bugpoint          0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1   bugpoint          0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2   libSystem.B.dylib 0x92f112bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4   bugpoint          0x00021d1c main + 92
5   bugpoint          0x00002106 start + 54
6   bugpoint          0x00000006 start + 18446744073709543222
Stack dump:
0.    Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll -dce -bugpoint-deletecalls -simplifycfg -silence-passes 

FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll  -bugpoint-crashcalls -silence-passes
0   bugpoint          0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1   bugpoint          0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2   libSystem.B.dylib 0x92f112bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4   bugpoint          0x00021d1c main + 92
5   bugpoint          0x00002106 start + 54
Stack dump:
0.    Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll -bugpoint-crashcalls -silence-passes 

--- Reverse-merging (from foreign repository) r66920 into '.':
U    include/llvm/Support/CallSite.h
U    include/llvm/Instructions.h
U    lib/Analysis/IPA/GlobalsModRef.cpp
U    lib/Analysis/IPA/Andersens.cpp
U    lib/Bitcode/Writer/BitcodeWriter.cpp
U    lib/VMCore/Instructions.cpp
U    lib/VMCore/Verifier.cpp
U    lib/VMCore/AsmWriter.cpp
U    lib/Transforms/Utils/LowerInvoke.cpp
U    lib/Transforms/Scalar/SimplifyCFGPass.cpp
U    lib/Transforms/IPO/PruneEH.cpp
U    lib/Transforms/IPO/DeadArgumentElimination.cpp



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66953 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 21:15:59 +00:00
Dale Johannesen
d1c135c6e6 One more place where debug info affects codegen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66930 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 19:23:20 +00:00
Gabor Greif
b14cda3c0d Second installment of "BasicBlock operands to the back"
changes.

For InvokeInst now all arguments begin at op_begin().
The Callee, Cont and Fail are now faster to get by
access relative to op_end().

This patch introduces some temporary uglyness in CallSite.
Next I'll bring CallInst up to a similar scheme and then
the uglyness will magically vanish.

This patch also exposes all the reliance of the libraries
on InvokeInst's operand ordering. I am thinking of taking
care of that too.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66920 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 18:27:29 +00:00
Bill Wendling
0582ae99ba Oops...I committed too much.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66867 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 04:39:26 +00:00
Bill Wendling
c7a09ab311 Temporarily XFAIL this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66866 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 04:37:11 +00:00
Duncan Sands
58256f83c8 Revert commit 66140 since it caused several failures
in the Ada testcase.  Reverting this only covers up
the real problem, which is a nasty conceptual difficulty
in the phi elimination pass: when eliminating phi nodes
in landing pads, the register copies need to come before
the invoke, not at the end of the basic block which is
too late...  See PR3784.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66826 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 21:13:42 +00:00
Dale Johannesen
a891518c4d Skip interleaved debug info when fast-forwarding through
allocations.  Apparently the assumption is there is an
instruction (terminator?) following the allocation so I
am allowing the same assumption.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66716 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 22:19:43 +00:00
Dale Johannesen
ff278b11bf Removing a dead debug intrinsic shouldn't trigger
another instcombine pass if we weren't going to make
one without debug info.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66576 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 21:19:49 +00:00
John Criswell
090c0a2ffd Do not attempt to do parial redundancy elimination on void values.
Also fixed a punctuation error in the header comment.
This fixes PR3775.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66542 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 15:04:53 +00:00
Dan Gohman
9d10086797 Don't record the increment instruction; just recompute it from the Phi
if needed. This simplifies the code a little, and is needed for an
upcoming refactoring.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66479 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 22:04:01 +00:00
Dan Gohman
3cfe6a4bc2 Fix a few more places where induction variable types were used
where memory access types are needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66470 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 21:22:12 +00:00
Dan Gohman
bb5b49cb8d Use ReplacedTy instead of recomputing the same value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66469 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 21:19:58 +00:00
Dan Gohman
0daeed270b Use LoopInfo's getLoopLatch() instead of doing what it does manualy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66467 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 21:14:16 +00:00
Dan Gohman
53f2ae268a Don't use an induction variable type as a memory access type.
Use VoidTy instead, to be properly conservative.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66463 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 21:04:19 +00:00
Dan Gohman
21e7722868 Factor out the code that determines the memory access type
of an instruction into a helper function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66460 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 21:01:17 +00:00
Dan Gohman
f7912df4cb Move the sorting of the StrideOrder array earlier so that it doesn't
have to be done twice.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66449 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 20:46:50 +00:00
Dan Gohman
9f4ac31a94 Delete the isOnlyStride argument, which is unused.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66446 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 20:41:15 +00:00
Dan Gohman
80b0f8c062 Tidy some LSR debug output: announce the loop it's about to process
before it does any processing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66443 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 20:34:59 +00:00
Chris Lattner
d7168ddb11 reimplement AliasSetTracker in terms of DenseMap instead of hash_map,
hopefully no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66398 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 05:11:09 +00:00
Chris Lattner
29e641761e teach SROA to handle promoting vector allocas with a memset into them into
a vector type instead of into an integer type.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66368 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 04:17:04 +00:00
Chris Lattner
c570487d45 Enhance SROA to "promote to scalar" allocas which are
memcpy/memmove'd into or out of.  This fixes a serious
perf issue that Nate ran into.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66366 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 04:04:21 +00:00
Chris Lattner
dfe964ce8c change the MemIntrinsic get/setAlignment method to take an unsigned
instead of a Constant*, which is what the clients of it really want.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66364 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 03:59:00 +00:00
Chris Lattner
3ce5e887ae Introduce a new MemTransferInst pseudo class, which is a common
parent between MemCpyInst and MemMoveInst, simplify some code to
use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66361 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 03:37:16 +00:00
Chris Lattner
57c03831cc add a bunch more passes to the C bindings (PR3734), patch by
Lennart Augustsson!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66272 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 16:52:18 +00:00
Devang Patel
00e389c8c8 While converting an aggregate to scalare, ignore and remove aggregate's debug info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66262 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 07:03:54 +00:00
Chris Lattner
0070ce511e this wasn't intended to go in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66252 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 05:42:30 +00:00
Chris Lattner
cc14d25dd9 Change various llvm utilities to use PrettyStackTraceProgram in
their main routines.  This makes the tools print their argc/argv
commands if they crash.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66248 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 05:34:10 +00:00
Devang Patel
3f43a7021f Do not count DbgInfoIntrinsic while estimating loop header size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66245 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 03:51:30 +00:00
Devang Patel
c64bc16cae Skip DbgInfoIntrinsic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66244 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 02:59:27 +00:00
Dale Johannesen
03afd02ca2 Don't assign rank numbers to debug intrinsic "calls".
This is needed so debug info doesn't change codegen.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66235 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 01:41:59 +00:00
Evan Cheng
67fca63da2 SRThreshold is meant to be inclusive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66227 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 00:56:43 +00:00
Evan Cheng
6fb8f421ee Do not split edges to EH landing pads. It will cause code size explosion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66140 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 06:31:26 +00:00
Dale Johannesen
4084c4ee34 Fix another case where debug info was affecting
codegen.  I convinced myself it was OK to skip all
pointer bitcasts here too.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66122 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 02:06:48 +00:00
Bill Wendling
e562149cdb Add comment to emphasize that the while body is empty.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66115 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 01:08:35 +00:00
Dale Johannesen
a0a6637b25 Fix another case where a dbg.declare meant something
had 2 uses instead of 1.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66112 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 00:39:02 +00:00