Chris Lattner
d729d0dcdb
don't lose TD info
...
llvm-svn: 122556
2010-12-25 20:52:04 +00:00
Chris Lattner
6fcd32e7d7
Move getOrEnforceKnownAlignment out of instcombine into Transforms/Utils.
...
llvm-svn: 122554
2010-12-25 20:37:57 +00:00
Chris Lattner
b438ef236c
remove the pointless check of MemoryUseIntrinsic from
...
is trivially dead, since these have side effects. This makes the
(misnamed) MemoryUseIntrinsic class dead, so remove it.
llvm-svn: 120382
2010-11-30 02:03:47 +00:00
Duncan Sands
ba0b22c785
Have RemovePredecessorAndSimplify you SimplifyInstruction
...
rather than hasConstantValue.
llvm-svn: 119457
2010-11-17 04:12:05 +00:00
Dan Gohman
4a63fad976
Teach SimplifyCFG how to simplify indirectbr instructions.
...
- Eliminate redundant successors.
- Convert an indirectbr with one successor into a direct branch.
Also, generalize SimplifyCFG to be able to be run on a function entry block.
It knows quite a few simplifications which are applicable to the entry
block, and it only needs a few checks to avoid trouble with the entry block.
llvm-svn: 111060
2010-08-14 00:29:42 +00:00
Chris Lattner
e41ab07c61
make various clients of ReplaceAndSimplifyAllUses tolerate
...
it *changing* the things it replaces, not just causing them
to drop to null. There is no functionality change yet, but
this is required for a subsequent patch.
llvm-svn: 108414
2010-07-15 06:06:04 +00:00
Gabor Greif
d993402df3
cache dereferenced iterators
...
llvm-svn: 108132
2010-07-12 10:49:54 +00:00
Dan Gohman
826bdf8c10
Move FindAvailableLoadedValue isSafeToLoadUnconditionally out of
...
lib/Transforms/Utils and into lib/Analysis so that Analysis passes
can use them.
llvm-svn: 104949
2010-05-28 16:19:17 +00:00
Duncan Sands
19d0b47b1f
There are two ways of checking for a given type, for example isa<PointerType>(T)
...
and T->isPointerTy(). Convert most instances of the first form to the second form.
Requested by Chris.
llvm-svn: 96344
2010-02-16 11:11:14 +00:00
Chris Lattner
6fbfe5897c
fix PR6305 by handling BlockAddress in a helper function
...
called by jump threading.
llvm-svn: 96263
2010-02-15 20:47:49 +00:00
Bob Wilson
f65ba356e1
Fix pr6198 by moving the isSized() check to an outer conditional.
...
The testcase from pr6198 does not crash for me -- I don't know what's up with
that -- so I'm not adding it to the tests.
llvm-svn: 94984
2010-02-01 17:41:44 +00:00
Bob Wilson
56600a15ad
Check alignment of loads when deciding whether it is safe to execute them
...
unconditionally. Besides checking the offset, also check that the underlying
object is aligned as much as the load itself.
llvm-svn: 94875
2010-01-30 04:42:39 +00:00
Bob Wilson
34e10c2218
Use uint64_t instead of unsigned for offsets and sizes.
...
llvm-svn: 94835
2010-01-29 20:34:28 +00:00
Bob Wilson
7c42b9d51e
Improve isSafeToLoadUnconditionally to recognize that GEPs with constant
...
indices are safe if the result is known to be within the bounds of the
underlying object.
llvm-svn: 94829
2010-01-29 19:19:08 +00:00
Victor Hernandez
1df65186d1
DbgInfoIntrinsics no longer appear in an instruction's use list; so clean up looking for them in use iterations and remove OnlyUsedByDbgInfoIntrinsics()
...
llvm-svn: 94111
2010-01-21 23:05:53 +00:00
Chris Lattner
7c743f2c74
add a helper function.
...
llvm-svn: 93251
2010-01-12 19:40:54 +00:00
Dan Gohman
c3c031bb37
Nick Lewycky pointed out that this code makes changes unconditionally.
...
llvm-svn: 92739
2010-01-05 17:50:58 +00:00
Dan Gohman
28943873e6
Use do+while instead of while for loops which obviously have a
...
non-zero trip count. Use SmallVector's pop_back_val().
llvm-svn: 92734
2010-01-05 16:27:25 +00:00
Dan Gohman
cb99fe9839
Make RecursivelyDeleteTriviallyDeadInstructions,
...
RecursivelyDeleteDeadPHINode, and DeleteDeadPHIs return a flag
indicating whether they made any changes.
llvm-svn: 92732
2010-01-05 15:45:31 +00:00
David Greene
084b0dde9d
Change errs() to dbgs().
...
llvm-svn: 92606
2010-01-05 01:26:57 +00:00
Chris Lattner
22e13ba4e5
prune #includes.
...
llvm-svn: 92260
2009-12-29 09:12:29 +00:00
Jim Grosbach
d831ef4945
Move EliminateDuplicatePHINodes() from SimplifyCFG.cpp to Local.cpp
...
llvm-svn: 90324
2009-12-02 17:06:45 +00:00
Duncan Sands
ba61fed5d3
Don't trivially delete unused calls to llvm.invariant.start. This allows
...
llvm.invariant.start to be used without necessarily being paired with a call
to llvm.invariant.end. If you run the entire optimization pipeline then such
calls are in fact deleted (adce does it), but that's actually a good thing since
we probably do want them to be zapped late in the game. There should really be
an integration test that checks that the llvm.invariant.start call lasts long
enough that all passes that do interesting things with it get to do their stuff
before it is deleted. But since no passes do anything interesting with it yet
this will have to wait for later.
llvm-svn: 86840
2009-11-11 15:34:13 +00:00
Chris Lattner
852d6d64ff
move some generally useful functions out of jump threading
...
into libanalysis and transformutils.
llvm-svn: 86735
2009-11-10 22:26:15 +00:00
Chris Lattner
cbd18fc93d
refactor TryToSimplifyUncondBranchFromEmptyBlock out of SimplifyCFG.
...
llvm-svn: 86666
2009-11-10 05:59:26 +00:00
Chris Lattner
5a3832496a
remove a isFreeCall check: it is a callinst that can write to memory already.
...
llvm-svn: 85863
2009-11-03 05:33:46 +00:00
Chris Lattner
54a4b84012
constant fold indirectbr(blockaddress(%bb)) -> br label %bb.
...
llvm-svn: 85704
2009-11-01 03:40:38 +00:00
Victor Hernandez
f390e04a47
Rename MallocFreeHelper as MemoryBuiltins
...
llvm-svn: 85286
2009-10-27 20:05:49 +00:00
Victor Hernandez
762195bd01
Rename MallocHelper as MallocFreeHelper, since it now also identifies calls to free()
...
llvm-svn: 85181
2009-10-26 23:58:56 +00:00
Victor Hernandez
de5ad42aa1
Remove FreeInst.
...
Remove LowerAllocations pass.
Update some more passes to treate free calls just like they were treating FreeInst.
llvm-svn: 85176
2009-10-26 23:43:48 +00:00
Victor Hernandez
e297149e26
Auto-upgrade free instructions to calls to the builtin free function.
...
Update all analysis passes and transforms to treat free calls just like FreeInst.
Remove RaiseAllocations and all its tests since FreeInst no longer needs to be raised.
llvm-svn: 84987
2009-10-24 04:23:03 +00:00
Andreas Neustifter
f8cb758ba8
Preserve ProfileInfo during CodeGenPrepare.
...
llvm-svn: 82034
2009-09-16 09:26:52 +00:00
Owen Anderson
b292b8ce70
Move more code back to 2.5 APIs.
...
llvm-svn: 77635
2009-07-30 23:03:37 +00:00
Owen Anderson
47db941fd3
Get rid of the Pass+Context magic.
...
llvm-svn: 76702
2009-07-22 00:24:57 +00:00
Owen Anderson
1e5f00e7a7
This started as a small change, I swear. Unfortunately, lots of things call the [I|F]CmpInst constructors. Who knew!?
...
llvm-svn: 75200
2009-07-09 23:48:35 +00:00
Owen Anderson
38264b1554
"LLVMContext* " --> "LLVMContext *"
...
llvm-svn: 74878
2009-07-06 23:00:19 +00:00
Owen Anderson
e70b637033
More LLVMContext-ification.
...
llvm-svn: 74807
2009-07-05 22:41:43 +00:00
Devang Patel
0f2eb5b9f7
Remove unused routines.
...
llvm-svn: 74351
2009-06-26 22:53:22 +00:00
Chris Lattner
945d08d76f
Generalize instcombine's isSafeToLoadUnconditionally() function
...
to ignore readonly calls, and factor it out of instcombine so
that it can be used by other passes. Patch by Frits van Bommel!
llvm-svn: 73506
2009-06-16 17:23:12 +00:00
Dan Gohman
9a6fef0a52
Simplify code by using SmallVector's pop_back_val() instead of
...
separate back() and pop_back() calls.
llvm-svn: 71089
2009-05-06 17:22:41 +00:00
Duncan Sands
1efabaaa2a
Allow readonly functions to unwind exceptions. Teach
...
the optimizers about this. For example, a readonly
function with no uses cannot be removed unless it is
also marked nounwind.
llvm-svn: 71071
2009-05-06 06:49:50 +00:00
Dan Gohman
48f8222293
Re-apply 70645, converting ScalarEvolution to use
...
CallbackVH, with fixes. allUsesReplacedWith need to
walk the def-use chains and invalidate all users of a
value that is replaced. SCEVs of users need to be
recalcualted even if the new value is equivalent. Also,
make forgetLoopPHIs walk def-use chains, since any
SCEV that depends on a PHI should be recalculated when
more information about that PHI becomes available.
llvm-svn: 70927
2009-05-04 22:30:44 +00:00
Dan Gohman
5036695c32
Revert r70645 for now; it's causing a variety of regressions.
...
llvm-svn: 70661
2009-05-03 05:46:20 +00:00
Dan Gohman
e9a38d16fe
Convert ScalarEvolution to use CallbackVH for its internal map. This
...
makes ScalarEvolution::deleteValueFromRecords, and it's code that
subtly needed to be called before ReplaceAllUsesWith, unnecessary.
It also makes ValueDeletionListener unnecessary.
llvm-svn: 70645
2009-05-02 21:19:20 +00:00
Dan Gohman
ff08995589
Previously, RecursivelyDeleteDeadInstructions provided an option
...
of returning a list of pointers to Values that are deleted. This was
unsafe, because the pointers in the list are, by nature of what
RecursivelyDeleteDeadInstructions does, always dangling. Replace this
with a simple callback mechanism. This may eventually be removed if
all clients can reasonably be expected to use CallbackVH.
Use this to factor out the dead-phi-cycle-elimination code from LSR
utility function, and generalize it to use the
RecursivelyDeleteTriviallyDeadInstructions utility function.
This makes LSR more aggressive about eliminating dead PHI cycles;
adjust tests to either be less trivial or to simply expect fewer
instructions.
llvm-svn: 70636
2009-05-02 18:29:22 +00:00
Zhou Sheng
05bea906c1
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.
llvm-svn: 67194
2009-03-18 10:13:08 +00:00
Zhou Sheng
64a6a092b1
Fix a bug.
...
If I->use_empty(), this method should return false.
llvm-svn: 67180
2009-03-18 07:56:13 +00:00
Devang Patel
0c970f94e9
Add "check/remove dbg var" helper routines.
...
llvm-svn: 66223
2009-03-06 00:19:37 +00:00
Dale Johannesen
738c60f259
Marking debug info intrinsics as not touching memory
...
caused them to be considered trivially dead. Fix this.
llvm-svn: 65979
2009-03-03 23:30:00 +00:00
Devang Patel
caf4485781
Enable scalar replacement of AllocaInst whose one of the user is dbg info.
...
llvm-svn: 64207
2009-02-10 07:00:59 +00:00