summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
* Expand a little on the description of what InstructionSimplify does.Duncan Sands2010-11-231-2/+4
| | | | llvm-svn: 120016
* Clarify that constant folding of instructions applies when all operandsDuncan Sands2010-11-231-10/+11
| | | | | | | | are constant. There was in fact one exception to this (phi nodes) - so remove that exception (InstructionSimplify handles this so there should be no loss). llvm-svn: 120015
* If a GEP index simply advances by multiples of a type of zero size,Duncan Sands2010-11-221-1/+1
| | | | | | then replace the index with zero. llvm-svn: 119974
* Move the "gep undef" -> "undef" transform from instcombine toDuncan Sands2010-11-221-4/+11
| | | | | | InstructionSimplify. llvm-svn: 119970
* Initialize MemDep's TD member so buildbots don't trip over an uninitialized ↵Benjamin Kramer2010-11-211-0/+2
| | | | | | | | pointer (TD is passed to PHITransAddr). I wonder why this didn't explode earlier. llvm-svn: 119944
* Add a rather pointless InstructionSimplify transform, inspired by recent ↵Duncan Sands2010-11-211-2/+10
| | | | | | | | | | constant folding improvements: if P points to a type of size zero, turn "gep P, N" into "P". More generally, if a gep index type has size zero, instcombine could replace the index with zero, but that is not done here. llvm-svn: 119942
* Fix spelling.Duncan Sands2010-11-211-2/+2
| | | | llvm-svn: 119941
* apply Dan's fix for PR8268 which allows constant folding to handle indexes overChris Lattner2010-11-211-7/+15
| | | | | | | | | | | zero sized elements. This allows us to compile: #include <string> void foo() { std::string s; } into an empty function. llvm-svn: 119933
* add "getLocation" method to AliasAnalysis for getting the source andChris Lattner2010-11-211-0/+23
| | | | | | | | destination location of a memcpy/memmove. I'm not clear about whether TBAA works on these, so I'm leaving it out for now. Dan, please revisit this when convenient. llvm-svn: 119928
* implement PR8576, deleting dead stores with intervening may-alias stores.Chris Lattner2010-11-211-2/+2
| | | | llvm-svn: 119927
* Simplify code. No change in functionality.Benjamin Kramer2010-11-201-2/+2
| | | | llvm-svn: 119908
* Silence warning about an uninitialized variable.Benjamin Kramer2010-11-191-1/+1
| | | | llvm-svn: 119800
* Remove threading of Xor over selects and phis, with an explanationDuncan Sands2010-11-191-13/+18
| | | | | | of why such threading is pointless. llvm-svn: 119798
* Factor code for testing whether replacing one value with anotherDuncan Sands2010-11-181-17/+2
| | | | | | | | preserves LCSSA form out of ScalarEvolution and into the LoopInfo class. Use it to check that SimplifyInstruction simplifications are not breaking LCSSA form. Fixes PR8622. llvm-svn: 119727
* Strip trailing whitespace.Dan Gohman2010-11-181-48/+48
| | | | llvm-svn: 119706
* Use llvm_unreachable for "impossible" situations.Dan Gohman2010-11-181-3/+6
| | | | llvm-svn: 119705
* Add support for PHI-translating sext, zext, and trunc instructions,Dan Gohman2010-11-181-18/+26
| | | | | | enabling more PRE. PR8586. llvm-svn: 119704
* Introduce memoization for ScalarEvolution dominates and properlyDominatesDan Gohman2010-11-182-74/+83
| | | | | | queries, and SCEVExpander getRelevantLoop queries. llvm-svn: 119595
* Factor out the code for purging a SCEV from all the various memoization maps.Dan Gohman2010-11-171-26/+13
| | | | | | | Some of these maps may merge in the future, but for now it's convenient to have a utility function for them. llvm-svn: 119587
* Merge the implementations of isLoopInvariant and hasComputableLoopEvolution, andDan Gohman2010-11-171-71/+58
| | | | | | | memoize the results. This improves compile time in code which highly complex expressions which get queried many times. llvm-svn: 119584
* Make SCEV::getType() and SCEV::print non-virtual. Move SCEV::hasOperandDan Gohman2010-11-171-105/+167
| | | | | | to ScalarEvolution. Delete SCEV::~SCEV. SCEV is no longer virtual. llvm-svn: 119578
* Move SCEV::dominates and properlyDominates to ScalarEvolution.Dan Gohman2010-11-172-60/+93
| | | | llvm-svn: 119570
* Move SCEV::isLoopInvariant and hasComputableLoopEvolution to be memberDan Gohman2010-11-173-84/+138
| | | | | | | functions of ScalarEvolution, in preparation for memoization and other optimizations. llvm-svn: 119562
* Before replacing a phi node with a different value, itDuncan Sands2010-11-171-11/+15
| | | | | | | | | | needs to be checked that this won't break LCSSA form. Change the existing checking method to a more direct one: rather than seeing if all predecessors belong to the loop, check that the replacing value is either not in any loop or is in a loop that contains the phi node. llvm-svn: 119556
* Verify SCEVAddRecExpr's invariant in ScalarEvolution::getAddRecExprDan Gohman2010-11-171-0/+3
| | | | | | | instead of in SCEVAddRecExpr's constructor, in preparation for an upcoming change. llvm-svn: 119554
* Fix ScalarEvolution's range memoization to avoid using aDan Gohman2010-11-171-44/+43
| | | | | | default ctor with ConstantRange. llvm-svn: 119550
* Move some those Xor simplifications which don't require creating newDuncan Sands2010-11-171-30/+78
| | | | | | | | 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
* Now that hasConstantValue has been made simpler, it may return theDuncan Sands2010-11-171-1/+2
| | | | | | | phi node itself if it occurs in an unreachable basic block. Protect against this. Hopefully this will fix some more buildbots. llvm-svn: 119493
* Previously SimplifyInstruction could report that an instructionDuncan Sands2010-11-172-17/+32
| | | | | | | | simplified to itself (this can only happen in unreachable blocks). Change it to return null instead. Hopefully this will fix some buildbot failures. llvm-svn: 119490
* Fix a layering violation: hasConstantValue, which is part of the PHINodeDuncan Sands2010-11-172-5/+39
| | | | | | | | | | | | | | class, uses DominatorTree which is an analysis. This change moves all of the tricky hasConstantValue logic to SimplifyInstruction, and replaces it with a very simple literal implementation. I already taught users of hasConstantValue that need tricky stuff to use SimplifyInstruction instead. I didn't update InlineFunction because the IR looks like it might be in a funky state at the point it calls hasConstantValue, which makes calling SimplifyInstruction dangerous since it can in theory do a lot of tricky reasoning. This may be a pessimization, for example in the case where all phi node operands are either undef or a fixed constant. llvm-svn: 119459
* Have ScalarEvolution use SimplifyInstruction rather than hasConstantValue.Duncan Sands2010-11-171-1/+5
| | | | | | While there, add a note about an inefficiency I noticed. llvm-svn: 119458
* Memoize results from ScalarEvolution's getUnsignedRange and getSignedRange.Dan Gohman2010-11-171-43/+80
| | | | | | This fixes some extreme compile times on unrolled sha512 code. llvm-svn: 119455
* In which I discover the existence of loops. Threading an operationDuncan Sands2010-11-162-62/+104
| | | | | | | | | | | over a phi node by applying it to each operand may be wrong if the operation and the phi node are mutually interdependent (the testcase has a simple example of this). So only do this transform if it would be correct to perform the operation in each predecessor of the block containing the phi, i.e. if the other operands all dominate the phi. This should fix the FFMPEG snow.c regression reported by İsmail Dönmez. llvm-svn: 119347
* Teach InstructionSimplify the trick of skipping incoming phiDuncan Sands2010-11-151-4/+9
| | | | | | values that are equal to the phi itself. llvm-svn: 119161
* If dom tree information is available, make it possible to passDuncan Sands2010-11-141-5/+7
| | | | | | it to get better phi node simplification. llvm-svn: 119055
* Teach InstructionSimplify about phi nodes. I chose to have it simplyDuncan Sands2010-11-141-0/+2
| | | | | | | | | | 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
* Boost the power of phi node constant folding slightly: if allDuncan Sands2010-11-141-12/+18
| | | | | | | | | | | operands are the phi node itself or undef, then return undef. This logic already existed at a higher level so in practice it shouldn't make the slightest difference. Note that this code could be replaced by a call to PN->hasConstantValue(). However since we bail out the moment we see a non-constant operand, it is more efficient to have a specialized version of that logic. llvm-svn: 119041
* Strip trailing whitespace.Duncan Sands2010-11-141-50/+49
| | | | llvm-svn: 119038
* Fix typo pointed out by Trevor Harmon.Duncan Sands2010-11-131-1/+1
| | | | llvm-svn: 119001
* Re-disable TBAA for now; it broke MultiSource/Applications/JM/lencod,Dan Gohman2010-11-121-1/+1
| | | | | | at least. llvm-svn: 118890
* Enable TBAA.Dan Gohman2010-11-121-1/+1
| | | | llvm-svn: 118884
* Add helper functions for computing the Location of load, store,Dan Gohman2010-11-113-42/+30
| | | | | | and vaarg instructions. llvm-svn: 118845
* Don't forget the TBAA info, if available.Dan Gohman2010-11-111-1/+6
| | | | llvm-svn: 118842
* Avoid calling alias on non-pointer values.Dan Gohman2010-11-111-3/+4
| | | | llvm-svn: 118822
* It's not necessary to clear out the Size and TBAATag at each ofDan Gohman2010-11-111-12/+1
| | | | | | these points. llvm-svn: 118752
* Set NonLocalDepInfo's Size field to UnknownSize when invalidatingDan Gohman2010-11-111-5/+5
| | | | | | it, so that it doesn't appear to be a known size. llvm-svn: 118748
* When clearing a non-local pointer dependency cache entry, clearDan Gohman2010-11-101-0/+8
| | | | | | the reverse map too. This fixes seflhost build errors. llvm-svn: 118729
* Take care of special characters while creating named MDNode name to hold ↵Devang Patel2010-11-101-3/+35
| | | | | | | | function specific local variable's info. This fixes radar 8653152. I am checking in testcase as a separate check-in. llvm-svn: 118726
* Factor out the code for computing an AliasAnalysis::LocationDan Gohman2010-11-101-82/+101
| | | | | | for a given instruction into a helper function. llvm-svn: 118723
* Fully invalidate cached results when a prior query's size orDan Gohman2010-11-101-10/+23
| | | | | | type is insufficient for, or incompatible with, the current query. llvm-svn: 118721
OpenPOWER on IntegriCloud