summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
Commit message (Collapse)AuthorAgeFilesLines
* Teach DSE to eliminate useless trampolines.Duncan Sands2009-11-101-6/+19
| | | | llvm-svn: 86683
* Add brackets to make gcc-4.4 happy.Duncan Sands2009-11-101-3/+3
| | | | llvm-svn: 86681
* unify the code that determines whether it is a good idea to change the typeChris Lattner2009-11-101-27/+36
| | | | | | | of a computation. This fixes some infinite loops when dealing with TD that has no native types. llvm-svn: 86670
* Simplify.Nick Lewycky2009-11-101-3/+1
| | | | llvm-svn: 86668
* Reapply r86359, "Teach dead store elimination that certain intrinsics write toNick Lewycky2009-11-101-63/+118
| | | | | | | memory just like a store" with bug fixed (partial-overwrite.ll is the regression test). llvm-svn: 86667
* make jump threading recursively simplify expressions instead of doing it Chris Lattner2009-11-101-20/+42
| | | | | | | | | | | | | | | | | | | just one level deep. On the testcase we go from getting this: F1: ; preds = %T2 %F = and i1 true, %cond ; <i1> [#uses=1] br i1 %F, label %X, label %Y to a fully threaded: F1: ; preds = %T2 br label %Y This changes gets us to the point where we're forming (too many) switch instructions on doug's strswitch testcase. llvm-svn: 86646
* don't invalidate PN, rewrite of this code is in progress anyway.Chris Lattner2009-11-101-4/+5
| | | | llvm-svn: 86639
* add a new SimplifyInstruction API, which is like ConstantFoldInstruction, Chris Lattner2009-11-101-6/+5
| | | | | | | | except that the result may not be a constant. Switch jump threading to use it so that it gets things like (X & 0) -> 0, which occur when phi preds are deleted and the remaining phi pred was a zero. llvm-svn: 86637
* Fix DenseMap iterator constness.Jeffrey Yasskin2009-11-103-6/+6
| | | | | | | | | | | | | | | | | | | This patch forbids implicit conversion of DenseMap::const_iterator to DenseMap::iterator which was possible because DenseMapIterator inherited (publicly) from DenseMapConstIterator. Conversion the other way around is now allowed as one may expect. The template DenseMapConstIterator is removed and the template parameter IsConst which specifies whether the iterator is constant is added to DenseMapIterator. Actually IsConst parameter is not necessary since the constness can be determined from KeyT but this is not relevant to the fix and can be addressed later. Patch by Victor Zverovich! llvm-svn: 86636
* factor simplification logic for AND and OR out to InstSimplify from instcombine.Chris Lattner2009-11-101-85/+34
| | | | llvm-svn: 86635
* pull a bunch of logic out of instcombine into instsimplify for compare Chris Lattner2009-11-091-56/+13
| | | | | | simplification, this handles the foldable fcmp x,x cases among many others. llvm-svn: 86627
* inline a simple function.Chris Lattner2009-11-091-17/+20
| | | | llvm-svn: 86625
* rename SimplifyCompare -> SimplifyCmpInst and split it into Chris Lattner2009-11-092-1/+2
| | | | | | | Simplify[IF]Cmp pieces. Add some predicates to CmpInst to determine whether a predicate is fp or int. llvm-svn: 86624
* use instructionsimplify instead of a weak clone of ad-hoc folding stuff.Chris Lattner2009-11-091-22/+2
| | | | llvm-svn: 86616
* stub out a new form of BasicBlock::RemovePredecessorAndSimplify whichChris Lattner2009-11-091-5/+65
| | | | | | | simplifies instruction users of PHIs when the phi is eliminated. This will be moved to transforms/utils after some other refactoring. llvm-svn: 86603
* if a 'with overflow' intrinsic just has the normal result used, simplifyChris Lattner2009-11-091-0/+41
| | | | | | it to a normal binop. Patch by Alastair Lynn, testcase by me. llvm-svn: 86524
* fix PR5104: when printing a single character, return the result ofChris Lattner2009-11-091-9/+13
| | | | | | putchar in case there is an error. llvm-svn: 86515
* enhance PHI slicing to handle the case when a slicable PHI is beginChris Lattner2009-11-091-74/+167
| | | | | | used by a chain of other PHIs. llvm-svn: 86503
* Small cleanups.Owen Anderson2009-11-091-8/+4
| | | | llvm-svn: 86499
* Revert my previous patch to ABCD and fix things the right way. There are ↵Owen Anderson2009-11-091-13/+28
| | | | | | | | | | | | | two problems addressed here: 1) We need to avoid processing sigma nodes as phi nodes for constraint generation. 2) We need to generate constraints for comparisons against constants properly. This includes our first working ABCD test! llvm-svn: 86498
* comment typos pointed out by DuncanChris Lattner2009-11-091-3/+3
| | | | llvm-svn: 86497
* Fix an issue where the ordering of blocks within a function could lead to ↵Owen Anderson2009-11-081-2/+4
| | | | | | | | | | | | | different constraint graphs being produced. The cause was that we were incorrectly marking sigma instructions as processed after handling the sigma-specific constraints for them, potentially neglecting to process them as normal instructions as well. Unfortunately, the testcase that inspired this still doesn't work because of a bug in the solver, which is next on the list to debug. llvm-svn: 86486
* Teach an instcombine to not pull trunc instructions through PHI nodesChris Lattner2009-11-081-10/+30
| | | | | | | | | when both the source and dest are illegal types, since it would cause the phi to grow (for example, we shouldn't transform test14b's phi to a phi on i320). This fixes an infinite loop on i686 bootstrap with phi slicing turned on, so turn it back on. llvm-svn: 86483
* reapply r8644[3-5] with only the scary part Chris Lattner2009-11-081-8/+151
| | | | | | (SliceUpIllegalIntegerPHI) disabled. llvm-svn: 86480
* Speculatively revert r8644[3-5], they seem to be leading to infinite loops inDaniel Dunbar2009-11-081-151/+8
| | | | | | llvm-gcc bootstrap. llvm-svn: 86478
* teach a couple of instcombine transformations involving PHIs toChris Lattner2009-11-081-8/+151
| | | | | | | | not turn a PHI in a legal type into a PHI of an illegal type, and add a new optimization that breaks up insane integer PHI nodes into small pieces (PR3451). llvm-svn: 86443
* Improve tail call elimination to handle the switch statement.Nick Lewycky2009-11-071-2/+11
| | | | llvm-svn: 86403
* make instcombine only rewrite a chain of computation Chris Lattner2009-11-071-19/+5
| | | | | | | | | | (eliminating some extends) if the new type of the computation is legal or if both the source and dest are illegal. This prevents instcombine from changing big chains of computation into i64 on 32-bit targets for example. llvm-svn: 86398
* Revert r86359, it is breaking the self host on theChris Lattner2009-11-071-117/+62
| | | | | | llvm-gcc-i386-darwin9 build bot. llvm-svn: 86391
* Teach dead store elimination that certain intrinsics write to memory just likeNick Lewycky2009-11-071-62/+117
| | | | | | a store. llvm-svn: 86359
* reapply 86289, 86278, 86270, 86267, 86266 & 86264 plus a fixChris Lattner2009-11-071-243/+363
| | | | | | | | | (making pred factoring only happen if threading is guaranteed to be successful). This now survives an X86-64 bootstrap of llvm-gcc. llvm-svn: 86355
* Oops, FunctionContainsEscapingAllocas is really used to mean two differentNick Lewycky2009-11-071-2/+10
| | | | | | things. Back out part of r86349 for a moment. llvm-svn: 86353
* Dust off tail recursion elimination. Fix a fixme by applying CaptureTrackingNick Lewycky2009-11-071-21/+8
| | | | | | and add a .ll to demo the new capability. llvm-svn: 86349
* Revert following patches to fix llvmgcc bootstrap.Devang Patel2009-11-071-350/+234
| | | | | | | 86289, 86278, 86270, 86267, 86266 & 86264 Chris, please take a look. llvm-svn: 86321
* Avoid "ambiguous 'else'" warning from gcc.Jeffrey Yasskin2009-11-071-1/+2
| | | | llvm-svn: 86314
* Fix a bug where we'd call SplitBlockPredecessors with a pred in the Chris Lattner2009-11-061-2/+11
| | | | | | set only once even if it has multiple edges to BB. llvm-svn: 86299
* Remove function left over from other jump threading cleanup.Eli Friedman2009-11-061-24/+0
| | | | llvm-svn: 86289
* Fix a problem discovered on self host.Chris Lattner2009-11-061-1/+1
| | | | llvm-svn: 86278
* remove more code subsumed by r86264Chris Lattner2009-11-061-83/+17
| | | | llvm-svn: 86270
* eliminate some more code subsumed by r86264Chris Lattner2009-11-061-41/+4
| | | | llvm-svn: 86267
* remove now redundant code, r86264 handles this case.Chris Lattner2009-11-061-66/+0
| | | | llvm-svn: 86266
* Extend jump threading to support much more general threadingChris Lattner2009-11-061-27/+325
| | | | | | | | | | | | | | | | | | | | predicates. This allows us to jump thread things like: _ZN12StringSwitchI5ColorE4CaseILj7EEERS1_RAT__KcRKS0_.exit119: %tmp1.i24166 = phi i8 [ 1, %bb5.i117 ], [ %tmp1.i24165, %_Z....exit ], [ %tmp1.i24165, %bb4.i114 ] %toBoolnot.i87 = icmp eq i8 %tmp1.i24166, 0 ; <i1> [#uses=1] %tmp4.i90 = icmp eq i32 %tmp2.i, 6 ; <i1> [#uses=1] %or.cond173 = and i1 %toBoolnot.i87, %tmp4.i90 ; <i1> [#uses=1] br i1 %or.cond173, label %bb4.i96, label %_ZN12... Where it is "obvious" that when coming from %bb5.i117 that the 'and' is always false. This triggers a surprisingly high number of times in the testsuite, and gets us closer to generating good code for doug's strswitch testcase. This also make a bunch of other code in jump threading redundant, I'll rip out in the next patch. This survived an enable-checking llvm-gcc bootstrap. llvm-svn: 86264
* remove some more Context arguments.Chris Lattner2009-11-061-1/+1
| | | | llvm-svn: 86235
* remove a bunch of extraneous LLVMContext argumentsChris Lattner2009-11-065-10/+7
| | | | | | from various APIs, addressing PR5325. llvm-svn: 86231
* Teach LSR to avoid calling SplitCriticalEdge on edges with indirectbr.Dan Gohman2009-11-051-0/+1
| | | | llvm-svn: 86193
* LoopDeletion depends on loops having dedicated exits.Dan Gohman2009-11-051-0/+4
| | | | llvm-svn: 86180
* Update various Loop optimization passes to cope with the possibility thatDan Gohman2009-11-056-9/+25
| | | | | | LoopSimplify form may not be available. llvm-svn: 86175
* Call getAnalysis<LoopInfo> the normal way, instead of asking passed-inDan Gohman2009-11-051-2/+2
| | | | | | LoopPassManager for it. llvm-svn: 86163
* Teach SimplifyLibCalls to fold memcmp calls with constant arguments.Benjamin Kramer2009-11-051-4/+11
| | | | llvm-svn: 86141
* Do map insert+find in one step. TODO -= 2.Benjamin Kramer2009-11-051-15/+15
| | | | llvm-svn: 86133
OpenPOWER on IntegriCloud