summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
* Remove the the block_node_iterator of Region, replace it by the block_iterator.Hongbin Zheng2012-08-272-24/+5
| | | | llvm-svn: 162672
* Fix integer undefined behavior due to signed left shift overflow in LLVM.Richard Smith2012-08-241-1/+1
| | | | | | Reviewed offline by chandlerc. llvm-svn: 162623
* BranchProb: modify the definition of an edge in BranchProbabilityInfo to handleManman Ren2012-08-241-57/+77
| | | | | | | | | | | | | | the case of multiple edges from one block to another. A simple example is a switch statement with multiple values to the same destination. The definition of an edge is modified from a pair of blocks to a pair of PredBlock and an index into the successors. Also set the weight correctly when building SelectionDAG from LLVM IR, especially when converting a Switch. IntegersSubsetMapping is updated to calculate the weight for each cluster. llvm-svn: 162572
* Fix floating-point divide by zero, in a case where the value was not going ↵Richard Smith2012-08-241-1/+1
| | | | | | to be used anyway. llvm-svn: 162518
* Reduce duplicated hash map lookups.Benjamin Kramer2012-08-222-7/+8
| | | | llvm-svn: 162362
* MemoryBuiltins: Properly guard ObjectSizeOffsetVisitor against cycles in the IR.Benjamin Kramer2012-08-171-18/+14
| | | | | | | | | | The previous fix only checked for simple cycles, use a set to catch longer cycles too. Drop the broken check from the ObjectSizeOffsetEvaluator. The BoundsChecking pass doesn't have to deal with invalid IR like InstCombine does. llvm-svn: 162120
* Guard MemoryBuiltins against self-looping GEPs, which can occur in ↵Benjamin Kramer2012-08-171-0/+4
| | | | | | | | unreachable code due to constant propagation. Fixes PR13621. llvm-svn: 162098
* Set the branch probability of branching to the 'normal' destination of an invokeBill Wendling2012-08-151-2/+30
| | | | | | | | | | instruction to something absurdly high, while setting the probability of branching to the 'unwind' destination to the bare minimum. This should set cause the normal destination's invoke blocks to be moved closer to the invoke. PR13612 llvm-svn: 161944
* MemoryDependenceAnalysis attempts to find the first memory dependency for ↵Nadav Rotem2012-08-131-2/+7
| | | | | | | | | | | function calls. Currently, if GetLocation reports that it did not find a valid pointer (this is the case for volatile load/stores), we ignore the result. This patch adds code to handle the cases where we did not obtain a valid pointer. rdar://11872864 PR12899 llvm-svn: 161802
* PR13095: Give an inline cost bonus to functions using byval arguments.Benjamin Kramer2012-08-071-3/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | We give a bonus for every argument because the argument setup is not needed anymore when the function is inlined. With this patch we interpret byval arguments as a compact representation of many arguments. The byval argument setup is implemented in the backend as an inline memcpy, so to model the cost as accurately as possible we take the number of pointer-sized elements in the byval argument and give a bonus of 2 instructions for every one of those. The bonus is capped at 8 elements, which is the number of stores at which the x86 backend switches from an expanded inline memcpy to a real memcpy. It would be better to use the real memcpy threshold from the backend, but it's not available via TargetData. This change brings the performance of c-ray in line with gcc 4.7. The included test case tries to reproduce the c-ray problem to catch regressions for this benchmark early, its performance is dominated by the inline decision of a specific call. This only has a small impact on most code, more on x86 and arm than on x86_64 due to the way the ABI works. When building LLVM for x86 it gives a small inline cost boost to virtually any function using StringRef or STL allocators, but only a 0.01% increase in overall binary size. The size of gcc compiled by clang actually shrunk by a couple bytes with this patch applied, but not significantly. llvm-svn: 161413
* Fix PR13412, a nasty miscompile due to the interleavedChandler Carruth2012-08-071-11/+17
| | | | | | | | | | | | | | | | | | instsimplify+inline strategy. The crux of the problem is that instsimplify was reasonably relying on an invariant that is true within any single function, but is no longer true mid-inline the way we use it. This invariant is that an argument pointer != a local (alloca) pointer. The fix is really light weight though, and allows instsimplify to be resiliant to these situations: when checking the relation ships to function arguments, ensure that the argumets come from the same function. If they come from different functions, then none of these assumptions hold. All credit to Benjamin Kramer for coming up with this clever solution to the problem. llvm-svn: 161410
* Implement the block_iterator of Region based on df_iterator.Hongbin Zheng2012-08-021-16/+0
| | | | llvm-svn: 161177
* Stay rational; don't assert trying to take the square root of a negative value.Nick Lewycky2012-08-011-0/+6
| | | | | | If it's negative, the loop is already proven to be infinite. Fixes PR13489! llvm-svn: 161107
* When constant folding GEP expressions, keep the address space information of ↵Nadav Rotem2012-07-301-3/+19
| | | | | | | | pointers. Together with Ran Chachick <ran.chachick@intel.com> llvm-svn: 160954
* fix PR13390: do not loop forever with self-referencing self instructionsNuno Lopes2012-07-271-0/+8
| | | | llvm-svn: 160876
* revert r160742: it's breaking CMake buildNuno Lopes2012-07-251-18/+7
| | | | | | | original commit msg: MemoryBuiltins: add support to determine the size of strdup'ed non-constant strings llvm-svn: 160751
* MemoryBuiltins: add support to determine the size of strdup'ed non-constant ↵Nuno Lopes2012-07-251-7/+18
| | | | | | strings llvm-svn: 160742
* When folding a load from a global constant, if the load started in the middleDuncan Sands2012-07-251-5/+8
| | | | | | | | | | of an array element (rather than at the beginning of the element) and extended into the next element, then the load from the second element was being handled wrong due to incorrect updating of the notion of which byte to load next. This fixes PR13442. Thanks to Chris Smowton for reporting the problem, analyzing it and providing a fix. llvm-svn: 160711
* teach objectsize about strdup() and strndup()Nuno Lopes2012-07-241-3/+16
| | | | llvm-svn: 160676
* Fix a typo (the the => the)Sylvestre Ledru2012-07-231-1/+1
| | | | llvm-svn: 160621
* baby steps toward fixing some problems with inbound GEPs that overflow, as ↵Nuno Lopes2012-07-201-1/+1
| | | | | | | | discussed 2 months ago or so. Make sure we do not emit index computations with NSW flags so that we dont get an undef value if the GEP overflows llvm-svn: 160589
* Remove unused private member variables uncovered by the recent changes to ↵Benjamin Kramer2012-07-201-1/+1
| | | | | | clang's -Wunused-private-field. llvm-svn: 160583
* Move llvm/Support/TypeBuilder.h -> llvm/TypeBuilder.h. This completesChandler Carruth2012-07-151-1/+1
| | | | | | | | | | | | the move of *Builder classes into the Core library. No uses of this builder in Clang or DragonEgg I could find. If there is a desire to have an IR-building-support library that contains all of these builders, that can be easily added, but currently it seems likely that these add no real overhead to VMCore. llvm-svn: 160243
* LSR Fix: check SCEV expression safety before expansion.Andrew Trick2012-07-131-0/+41
| | | | | | | | | | All SCEV expressions used by LSR formulae must be safe to expand. i.e. they may not contain UDiv unless we can prove nonzero denominator. Fixes PR11356: LSR hoists UDiv. llvm-svn: 160205
* IVUsers should only generate SCEV's for values that are safe to speculate.Andrew Trick2012-07-131-0/+7
| | | | | | | | | | This allows SCEVExpander to run on the IV expressions. This codifies an assumption made by LSR to complete the fix for PR11356, but I haven't been able to generate a separate unit test for this part. I'm adding it as an extra safety check. llvm-svn: 160204
* Factor SCEV traversal code so I can use it elsewhere. No functionality.Andrew Trick2012-07-131-51/+19
| | | | llvm-svn: 160203
* Delete code for folding undefs in ScalarEvolution. It's invalid inDan Gohman2012-07-091-14/+0
| | | | | | obscure ways, and it isn't actually important in the real world. llvm-svn: 159969
* PHINode::hasConstantValue(): return undef if the PHI is fully recursive.Nuno Lopes2012-07-031-1/+1
| | | | | | Thanks Duncan for the idea llvm-svn: 159687
* fold PHI nodes in SizeOffsetEvaluator whenever possible.Nuno Lopes2012-07-031-1/+13
| | | | | | Unfortunately this change requires the cache map to hold WeakVHs instead llvm-svn: 159667
* Reduce use list thrashing by using DenseMap's find_as for maps with ↵Benjamin Kramer2012-06-302-9/+11
| | | | | | | | ValueHandle keys. No functionality change. llvm-svn: 159497
* RefreshCallGraph: ignore 'invoke intrinsic'. IntrinsicInst doesnt not ↵Nuno Lopes2012-06-291-1/+3
| | | | | | recognize invoke, and shouldnt at this point, since the rest of LLVM codebase doesnt expect invoke of intrinsics llvm-svn: 159441
* Update the CMake files.Bill Wendling2012-06-291-1/+0
| | | | llvm-svn: 159417
* The DIBuilder class is just a wrapper around debug info creationBill Wendling2012-06-291-1018/+0
| | | | | | | (a.k.a. MDNodes). The module doesn't belong in Analysis. Move it to the VMCore instead. llvm-svn: 159414
* If the step value is a constant zero, the loop isn't going to terminate. FixesNick Lewycky2012-06-281-1/+1
| | | | | | the assert reported in PR13228! llvm-svn: 159393
* MemoryBuiltins:Nuno Lopes2012-06-281-14/+37
| | | | | | | | - recognize C++ new(std::nothrow) friends - ignore ExtractElement and ExtractValue instructions in size/offset analysis (all easy cases are probably folded away before we get here) - also recognize realloc as noalias llvm-svn: 159356
* make LazyValueInfo analyze the default case of switch statements (we know ↵Nuno Lopes2012-06-281-16/+15
| | | | | | that in the default branch the value cannot be any of the switch cases) llvm-svn: 159353
* make LVI::getEdgeValue() always intersect the constraints of the edge with ↵Nuno Lopes2012-06-281-36/+53
| | | | | | the range of the block. Previously it was only performing the intersection for a few cases, thus losing precision llvm-svn: 159320
* Fix cmake failure from moving files around.Bill Wendling2012-06-281-1/+0
| | | | llvm-svn: 159314
* Move lib/Analysis/DebugInfo.cpp to lib/VMCore/DebugInfo.cpp andBill Wendling2012-06-284-1188/+6
| | | | | | | | | include/llvm/Analysis/DebugInfo.h to include/llvm/DebugInfo.h. The reasoning is because the DebugInfo module is simply an interface to the debug info MDNodes and has nothing to do with analysis. llvm-svn: 159312
* Reduce indentation in function. Rearrange some methods. No functionality change.Bill Wendling2012-06-261-223/+222
| | | | llvm-svn: 159239
* Revamp how debugging information is emitted for debug info objects.Bill Wendling2012-06-261-134/+84
| | | | | | | | | It's not necessary for each DI class to have its own copy of `print' and `dump'. Instead, just give DIDescriptor those methods and have it call the appropriate debugging printing routine based on the type of the debug information. llvm-svn: 159237
* Enable the new LoopInfo algorithm by default.Andrew Trick2012-06-262-11/+8
| | | | | | | | | | | | | | | | | | | | | | | | The primary advantage is that loop optimizations will be applied in a stable order. This helps debugging and unit test creation. It is also a better overall implementation without pathologically bad performance on deep functions. On large functions (llvm-stress --size=200000 | opt -loops) Before: 0.1263s After: 0.0225s On deep functions (after tweaking llvm-stress, thanks Nadav): Before: 0.2281s After: 0.0227s See r158790 for more comments. The loop tree is now consistently generated in forward order, but loop passes are applied in reverse order over the program. If we have a loop optimization that prefers forward order, that can easily be achieved by adding a different type of LoopPassManager. llvm-svn: 159183
* Remove unnecessary FIXMEAndrew Trick2012-06-261-3/+0
| | | | llvm-svn: 159182
* check for the NoAlias attribute through CallSiteNuno Lopes2012-06-251-2/+2
| | | | llvm-svn: 159145
* llvm/lib: [CMake] Add explicit dependency to intrinsics_gen.NAKAMURA Takumi2012-06-242-0/+4
| | | | llvm-svn: 159112
* simplify code from previous commits (Thanks Duncan)Nuno Lopes2012-06-221-7/+2
| | | | llvm-svn: 158999
* remove extractMallocCallFromBitCast, since it was tailor maded for its sole ↵Nuno Lopes2012-06-221-8/+1
| | | | | | user. Update GlobalOpt accordingly. llvm-svn: 158952
* Add support for invoke to the MemoryBuiltin analysid.Nuno Lopes2012-06-211-15/+22
| | | | | | | | Update comments accordingly. Make instcombine remove useless invokes to C++'s 'new' allocation function (test attached). llvm-svn: 158937
* fix build in C++11 mode.Nuno Lopes2012-06-211-7/+7
| | | | | | Thanks to Chandler for pointing out the problem. llvm-svn: 158928
* hopefully fix the buildbots: some tests have wrong definitions of malloc ↵Nuno Lopes2012-06-211-3/+5
| | | | | | and were crashing this code on 64 bits machines llvm-svn: 158923
OpenPOWER on IntegriCloud