summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Reduce the maximum recursion depth, 5 seems pointlessly too much.Duncan Sands2010-11-101-1/+1
| | | | | | Probably it should just be 1, but compromise with 3. llvm-svn: 118718
* Enhance GVN to do more precise alias queries for non-local memoryDan Gohman2010-11-102-15/+55
| | | | | | | | | | | | | | | 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
* Teach InstructionSimplify how to look through PHI nodes. Since PHIDuncan Sands2010-11-101-32/+163
| | | | | | | | | nodes can be used in loops, this could result in infinite looping if there is no recursion limit, so add such a limit. It is also used for the SelectInst case because in theory there could be an infinite loop there too if the basic block is unreachable. llvm-svn: 118694
* Add a doesAccessArgPointees helper function, and update code to useDan Gohman2010-11-101-22/+24
| | | | | | it, and to be consistent. llvm-svn: 118692
* Simplify binary operations where one operand is a select instruction.Duncan Sands2010-11-101-28/+113
| | | | | | | | | | | | | | | | | The simplifications performed here never create new instructions, they only return existing instructions (or a constant), and so are always a win. In theory they should transform (for example) %z = and i32 %x, %y %s = select i1 %cond, i32 %y, i32 %z %r = and i32 %x, %s into %r = and i32 %x, y but in practice they get into a fight with instcombine, and lose. Unfortunately instcombine does a poor job in this case. Nonetheless I'm committing this transform to make it easier to discuss what to do to make peace with instcombine. llvm-svn: 118679
* Make ModRefBehavior a lattice. Use this to clean up AliasAnalysisDan Gohman2010-11-104-19/+29
| | | | | | chaining and simplify FunctionAttrs' GetModRefBehavior logic. llvm-svn: 118660
* VAArg doesn't capture its operand.Dan Gohman2010-11-091-0/+3
| | | | llvm-svn: 118623
* Teach AliasAnalysis about AccessesArgumentsReadonly.Dan Gohman2010-11-091-6/+8
| | | | llvm-svn: 118621
* Teach LICM and AliasSetTracker about AccessesArgumentsReadonly.Dan Gohman2010-11-091-1/+1
| | | | llvm-svn: 118618
* Factorize code, no functionality change.Duncan Sands2010-11-091-34/+31
| | | | llvm-svn: 118516
* Re-introduce the MaxLookup limit to BasicAliasAnalysis'Dan Gohman2010-11-081-2/+8
| | | | | | | pointsToConstantMemory code to guard against possible compile time slowdowns. llvm-svn: 118440
* Implement getModRefBehavior for TypeBasedAliasAnalysis.Dan Gohman2010-11-081-0/+23
| | | | llvm-svn: 118416
* Extend the AliasAnalysis::pointsToConstantMemory interface to allow itDan Gohman2010-11-086-23/+71
| | | | | | | | | | | | 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
* Delete getIntrinsicModRefBehavior. Clients can just use the normalDan Gohman2010-11-081-7/+0
| | | | | | | getModRefBehavior now, since it now understands intrinsics as well as normal functions. llvm-svn: 118411
* Teach BasicAliasAnalysis::getModRefBehavior(const Function *F)Dan Gohman2010-11-081-3/+11
| | | | | | to analyze intrinsic functions. llvm-svn: 118409
* Add simplification of floating point comparisons with the resultDuncan Sands2010-11-071-0/+20
| | | | | | | of a select instruction, the same as already exists for integer comparisons. llvm-svn: 118379
* Fix a README item: when doing a comparison with the resultDuncan Sands2010-11-071-2/+21
| | | | | | | | of a select instruction, see if doing the compare with the true and false values of the select gives the same result. If so, that can be used as the value of the comparison. llvm-svn: 118378
* Use arrays instead of constant-sized SmallVectors.Benjamin Kramer2010-11-041-132/+143
| | | | llvm-svn: 118257
* Introduce DIBuilder. It is intended to be a front-end friendly interface to ↵Devang Patel2010-11-042-0/+250
| | | | | | | | | | | | | emit debuggging information entries in LLVM IR. To create debugging information for a pointer, using DIBUilder front-end just needs DBuilder.CreatePointerType(Ty, Size); instead of DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type, TheCU, "", getOrCreateMainFile(), 0, Size, 0, 0, 0, OCTy); llvm-svn: 118248
* Fix DIType verifier. The element 3 is DIFile now.Devang Patel2010-11-021-3/+4
| | | | llvm-svn: 118054
* Make ScalarEvolution::forgetLoop forget all contained loops too, becauseDan Gohman2010-10-291-0/+5
| | | | | | | they may have ValuesAtScopes map entries referencing their outer loops. This fixes a user-after-free reported in PR8471. llvm-svn: 117698
* Teach memdep to use pointsToConstantMemory to determine that loadsDan Gohman2010-10-291-5/+10
| | | | | | from constant memory don't alias any stores. llvm-svn: 117636
* Support TBAA attachments on calls. This is somewhat experimental.Dan Gohman2010-10-251-0/+36
| | | | llvm-svn: 117317
* Fix chaining in TBAA's pointsToConstantMemory.Dan Gohman2010-10-251-1/+1
| | | | llvm-svn: 117314
* Only read one bit for testing for a readonly type, leaving the otherDan Gohman2010-10-251-2/+1
| | | | | | bits open for future uses. llvm-svn: 117301
* Add a comment.Dan Gohman2010-10-251-1/+3
| | | | llvm-svn: 117288
* Update comments; BasicAA is no longer necessarily the end of the chain.Dan Gohman2010-10-251-3/+3
| | | | llvm-svn: 117268
OpenPOWER on IntegriCloud