summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Move SCEV::isLoopInvariant and hasComputableLoopEvolution to be memberDan Gohman2010-11-172-15/+15
| | | | | | | functions of ScalarEvolution, in preparation for memoization and other optimizations. llvm-svn: 119562
* Reference ScalarEvolution by name rather than directly in LICM,Dan Gohman2010-11-171-2/+1
| | | | | | to avoid an unneeded dependence. llvm-svn: 119557
* InstCombine: Add a missing irem identity (X % X -> 0).Benjamin Kramer2010-11-171-0/+4
| | | | llvm-svn: 119538
* Move some those Xor simplifications which don't require creating newDuncan Sands2010-11-171-31/+2
| | | | | | | | instructions out of InstCombine and into InstructionSimplify. While there, introduce an m_AllOnes pattern to simplify matching with integers and vectors with all bits equal to one. llvm-svn: 119536
* Have InlineFunction use SimplifyInstruction rather thanDuncan Sands2010-11-171-9/+11
| | | | | | | | | hasConstantValue. I was leery of using SimplifyInstruction while the IR was still in a half-baked state, which is the reason for delaying the simplification until the IR is fully cooked. llvm-svn: 119494
* Have RemovePredecessorAndSimplify you SimplifyInstructionDuncan Sands2010-11-171-4/+4
| | | | | | rather than hasConstantValue. llvm-svn: 119457
* Remove dead code in GVN: now that SimplifyInstruction is calledDuncan Sands2010-11-171-43/+2
| | | | | | | | | | systematically, CollapsePhi will always return null here. Note that CollapsePhi did an extra check, isSafeReplacement, which the SimplifyInstruction logic does not do. I think that check was bogus - I guess we will soon find out! (It was originally added in commit 41998 without a testcase). llvm-svn: 119456
* Have a few places that want to simplify phi nodes use SimplifyInstructionDuncan Sands2010-11-165-13/+18
| | | | | | rather than calling hasConstantValue. No intended functionality change. llvm-svn: 119352
* If dom tree information is available, make it possible to passDuncan Sands2010-11-142-2/+2
| | | | | | it to get better phi node simplification. llvm-svn: 119055
* Teach InstructionSimplify about phi nodes. I chose to have it simplyDuncan Sands2010-11-141-2/+3
| | | | | | | | | | offload the work to hasConstantValue rather than do something more complicated (such handling mutually recursive phis) because (1) it is not clear it is worth it; and (2) if it is worth it, maybe such logic would be better placed in hasConstantValue. Adjust some GVN tests which are now cleaned up much further (eg: all phi nodes are removed). llvm-svn: 119043
* Generalize the reassociation transform in SimplifyCommutative (now renamed toDuncan Sands2010-11-135-46/+128
| | | | | | | | | | | | | | | | SimplifyAssociativeOrCommutative) "(A op C1) op C2" -> "A op (C1 op C2)", which previously was only done if C1 and C2 were constants, to occur whenever "C1 op C2" simplifies (a la InstructionSimplify). Since the simplifying operand combination can no longer be assumed to be the right-hand terms, consider all of the possible permutations. When compiling "gcc as one big file", transform 2 (i.e. using right-hand operands) fires about 4000 times but it has to be said that most of the time the simplifying operands are both constants. Transforms 3, 4 and 5 each fired once. Transform 6, which is an existing transform that I didn't change, never fired. With this change, the testcase is now optimized perfectly with one run of instcombine (previously it required instcombine + reassociate + instcombine, and it may just have been luck that this worked). llvm-svn: 119002
* Have GVN simplify instructions as it goes. For example, considerDuncan Sands2010-11-121-18/+20
| | | | | | | | | | | | | | | "%z = %x and %y". If GVN can prove that %y equals %x, then it turns this into "%z = %x and %x". With the new code, %z will be replaced with %x everywhere (and then deleted). Previously %z would be value numbered too, which is a waste of time. Also, while a clever value numbering algorithm would give %z the same value number as %x, our current one doesn't do so (at least I don't think it does). The new logic has an essentially equivalent effect to what you would get if %z was given the same value number as %x, i.e. it should make value numbering smarter. While there, get hold of target data once at the start rather than a gazillion times all over the place. llvm-svn: 118923
* Enhance DSE to handle the case where a free call makes more thanDan Gohman2010-11-121-12/+24
| | | | | | | one store dead. This is especially noticeable in SingleSource/Benchmarks/Shootout/objinst. llvm-svn: 118875
* Add helper functions for computing the Location of load, store,Dan Gohman2010-11-114-24/+7
| | | | | | and vaarg instructions. llvm-svn: 118845
* Factor out Instruction::isSafeToSpeculativelyExecute's code forDan Gohman2010-11-111-14/+1
| | | | | | | | | | | | testing for dereferenceable pointers into a helper function, isDereferenceablePointer. Teach it how to reason about GEPs with simple non-zero indices. Also eliminate ArgumentPromtion's IsAlwaysValidPointer, which didn't check for weak externals or out of range gep indices. llvm-svn: 118840
* TBAA-enable ArgumentPromotion.Dan Gohman2010-11-111-8/+8
| | | | llvm-svn: 118804
* Make Sink tbaa-aware.Dan Gohman2010-11-111-1/+4
| | | | llvm-svn: 118788
* It's safe to sink some instructions which are not safe to speculativelyDan Gohman2010-11-111-1/+4
| | | | | | execute. Make Sink's predicate more precise. llvm-svn: 118787
* Enhance GVN to do more precise alias queries for non-local memoryDan Gohman2010-11-101-2/+4
| | | | | | | | | | | | | | | references. For example, this allows gvn to eliminate the load in this example: void foo(int n, int* p, int *q) { p[0] = 0; p[1] = 1; if (n) { *q = p[0]; } } llvm-svn: 118714
* Use getValueOperand() and getPointerOperand() on load and storeDan Gohman2010-11-101-12/+13
| | | | | | instructions instead of hard-coding operand numbers. llvm-svn: 118698
* Add a doesAccessArgPointees helper function, and update code to useDan Gohman2010-11-101-1/+1
| | | | | | it, and to be consistent. llvm-svn: 118692
* Factor out the code for testing whether a function accessesDan Gohman2010-11-101-3/+2
| | | | | | arbitrary memory into a helper function, and adjust some comments. llvm-svn: 118687
* When checking that the necessary bits are zero inDale Johannesen2010-11-101-2/+2
| | | | | | | order to reduce ((x<<30)>>24) to x<<6, check the correct bits. PR 8547. llvm-svn: 118665
* Make ModRefBehavior a lattice. Use this to clean up AliasAnalysisDan Gohman2010-11-101-44/+31
| | | | | | chaining and simplify FunctionAttrs' GetModRefBehavior logic. llvm-svn: 118660
* Teach FunctionAttrs about the VAArg instruction.Dan Gohman2010-11-091-0/+7
| | | | llvm-svn: 118627
* Use the AliasAnalysis interface to determine how a Function accessesDan Gohman2010-11-091-2/+3
| | | | | | | memory. This isn't a real improvement with present day AliasAnalysis implementations; it's mainly for consistency. llvm-svn: 118624
* Teach LICM and AliasSetTracker about AccessesArgumentsReadonly.Dan Gohman2010-11-091-1/+1
| | | | llvm-svn: 118618
* Teach FunctionAttrs about AccessesArgumentsReadonly.Dan Gohman2010-11-091-0/+19
| | | | llvm-svn: 118617
* Fix a thinko that Duncan spotted.Dan Gohman2010-11-081-1/+1
| | | | llvm-svn: 118430
* Make FunctionAttrs TBAA-aware.Dan Gohman2010-11-081-12/+24
| | | | llvm-svn: 118417
* Extend the AliasAnalysis::pointsToConstantMemory interface to allow itDan Gohman2010-11-081-52/+5
| | | | | | | | | | | | to optionally look for constant or local (alloca) memory. Teach BasicAliasAnalysis::pointsToConstantMemory to look through Select and Phi nodes, and to support looking for local memory. Remove FunctionAttrs' PointsToLocalOrConstantMemory function, now that AliasAnalysis knows all the tricks that it knew. llvm-svn: 118412
* Make FunctionAttrs use AliasAnalysis::getModRefBehavior, now that itDan Gohman2010-11-081-18/+33
| | | | | | knows about intrinsic functions. llvm-svn: 118410
* Rename PointsToLocalMemory to PointsToLocalOrConstantMemory to makeDuncan Sands2010-11-031-8/+11
| | | | | | the code more self-documenting. llvm-svn: 118171
* Let the -inline-threshold command line argument take precedence over theJakob Stoklund Olesen2010-11-021-1/+2
| | | | | | | | threshold given to createFunctionInliningPass(). Both opt -O3 and clang would silently ignore the -inline-threshold option. llvm-svn: 118117
* When folding away a (shl (shr)) pair, we need to check that the bits that ↵Owen Anderson2010-11-011-1/+1
| | | | | | | | will BECOME the low bits are zero, not that the current low bits are zero. Fixes <rdar://problem/8606771>. llvm-svn: 117953
* Now that the MallocInst no longer exists, this workaround forDuncan Sands2010-10-301-5/+0
| | | | | | it claiming not to have side-effects is no longer needed. llvm-svn: 117789
* If a function does a volatile load from a global constant, do notDuncan Sands2010-10-301-4/+4
| | | | | | | | | consider it to be readonly. In fact, don't even consider it to be readonly if it does a volatile load from an AllocaInst either (it is debatable as to whether readonly would be correct or not in this case; play safe for the moment). This fixes PR8279. llvm-svn: 117783
* Clean up indentation and other whitespace.Bob Wilson2010-10-291-11/+9
| | | | llvm-svn: 117728
* Remove trailing whitespace.Bob Wilson2010-10-291-70/+69
| | | | llvm-svn: 117727
* Fix 80-column violation.Bob Wilson2010-10-291-1/+2
| | | | llvm-svn: 117722
* Change instcombine's getShuffleMask to represent undef with negative values.Bob Wilson2010-10-291-40/+36
| | | | | | | | This code had previously used 2*N, where N is the mask length, to represent undef. That is not safe because the shufflevector operands may have more than N elements -- they don't have to match the result type. llvm-svn: 117721
* Make instcombine a little more aggressive in combining vector shuffles.Bob Wilson2010-10-291-15/+22
| | | | | | | | Allow splats even if they don't match either of the original shuffles, possibly due to undef entries in the shuffles masks. Radar 8597790. Also fix some 80-column violations. llvm-svn: 117719
* Give up on doing in-line instruction simplification during correlated value ↵Owen Anderson2010-10-291-10/+1
| | | | | | | | | | | | | propagation. Instruction simplification needs to be guaranteed never to be run on an unreachable block. However, earlier block simplifications may have changed the CFG to make block that were reachable when we began our iteration unreachable by the time we try to simplify them. (Note that this also means that our depth-first iterators were potentially being invalidated). This should not have a large impact on code quality, since later runs of instcombine should pick up these simplifications. Fixes PR8506. llvm-svn: 117709
* Inline asm multiple alternative constraints development phase 2 - improved ↵John Thompson2010-10-292-2/+2
| | | | | | basic logic, added initial platform support. llvm-svn: 117667
* Teach InstCombine not to use Add and Neg on FP. PR 8490.Dale Johannesen2010-10-271-1/+8
| | | | llvm-svn: 117510
* Fix a case where instcombine was stripping metadata (and alignment)Dan Gohman2010-10-251-1/+3
| | | | | | from stores when folding in bitcasts. llvm-svn: 117265
* Fix PR8445: a block with no predecessors may be the entry block, in which caseDuncan Sands2010-10-241-12/+10
| | | | | | | | | it isn't unreachable and should not be zapped. The check for the entry block was missing in one case: a block containing a unwind instruction. While there, do some small cleanups: "M" is not a great name for a Function* (it would be more appropriate for a Module*), change it to "Fn"; use Fn in more places. llvm-svn: 117224
* SmallVectorize.Benjamin Kramer2010-10-231-3/+1
| | | | llvm-svn: 117213
* Switch attribute macros to use 'LLVM_' as a prefix. We retain the old namesChandler Carruth2010-10-231-1/+2
| | | | | | until other LLVM projects using these are cleaned up. llvm-svn: 117200
* Teach instcombine to set the alignment arguments for NEON load/store intrinsics.Bob Wilson2010-10-221-0/+26
| | | | llvm-svn: 117154
OpenPOWER on IntegriCloud