summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
...
* Add compare operators to BranchProbability and use it to determine if an ↵Benjamin Kramer2011-10-231-8/+4
| | | | | | edge is hot. llvm-svn: 142751
* Make SCEV's brute force analysis stronger in two ways. Firstly, we should beNick Lewycky2011-10-221-26/+145
| | | | | | | | | | | | | | | | able to constant fold load instructions where the argument is a constant. Second, we should be able to watch multiple PHI nodes through the loop; this patch only supports PHIs in loop headers, more can be done here. With this patch, we now constant evaluate: static const int arr[] = {1, 2, 3, 4, 5}; int test() { int sum = 0; for (int i = 0; i < 5; ++i) sum += arr[i]; return sum; } llvm-svn: 142731
* Extend the floating point heuristic to consider NaN checks unlikely.Benjamin Kramer2011-10-211-4/+17
| | | | llvm-svn: 142687
* BranchProbabilityInfo: floating point equality is unlikely.Benjamin Kramer2011-10-211-2/+34
| | | | | | This is from the same paper from Ball and Larus as the rest of the currently implemented heuristics. llvm-svn: 142677
* A FIXME about block addresses and indirectbr.Eli Friedman2011-10-201-0/+6
| | | | llvm-svn: 142569
* Simplify; no intended functional change.Eli Friedman2011-10-201-10/+3
| | | | llvm-svn: 142567
* "@string = constant i8 0" is a value i8* string of length zero. Analyze thatNick Lewycky2011-10-201-6/+13
| | | | | | correctly in GetStringLength, fixing PR11181! llvm-svn: 142558
* Generalize the reading of probability metadata to work for both branchesChandler Carruth2011-10-191-16/+24
| | | | | | | | | and switches, with arbitrary numbers of successors. Still optimized for the common case of 2 successors for a conditional branch. Add a test case for switch metadata showing up in the BlockFrequencyInfo pass. llvm-svn: 142493
* Teach the BranchProbabilityInfo analysis pass to read any metadataChandler Carruth2011-10-191-0/+38
| | | | | | | | | | | encoding of probabilities. In the absense of metadata, it continues to fall back on static heuristics. This allows __builtin_expect, after lowering through llvm.expect a branch instruction's metadata, to actually enter the branch probability model. This is one component of resolving PR2577. llvm-svn: 142492
* Add pass printing support to BlockFrequencyInfo pass. The implementationChandler Carruth2011-10-191-0/+4
| | | | | | | | | | | | | layer already had support for printing the results of this analysis, but the wiring was missing. Now that printing the analysis works, actually bring some of this analysis, and the BranchProbabilityInfo analysis that it wraps, under test! I'm planning on fixing some bugs and doing other work here, so having a nice place to add regression tests and a way to observe the results is really useful. llvm-svn: 142491
* Update DebugInfoFinder to match recent debug info encoding changes.Devang Patel2011-10-171-3/+24
| | | | llvm-svn: 142295
* Correct over-zealous removal of hack.Bill Wendling2011-10-171-1/+1
| | | | | | | Some code want to check that *any* call within a function has the 'returns twice' attribute, not just that the current function has one. llvm-svn: 142221
* Now that we have the ReturnsTwice function attribute, this method isBill Wendling2011-10-171-6/+5
| | | | | | | obsolete. Check the attribute instead. <rdar://problem/8031714> llvm-svn: 142212
* Delete a dead member. Dunno if this was ever used, but the current codeChandler Carruth2011-10-161-6/+3
| | | | | | | directly manipulates the weights inside of the BranchProbabilityInfo that is passed in. llvm-svn: 142163
* Fix SCEVExpander assert during LSR: "argument of incompatible type".Andrew Trick2011-10-151-6/+5
| | | | | | | | | Just because we're dealing with a GEP doesn't mean we can assert the SCEV has a pointer type. The fix is simply to ignore the SCEV pointer type, which we really didn't need. Fixes PR11138 webkit crash. llvm-svn: 142058
* An instruction's operands aren't necessarily instructions or constants. TheyNick Lewycky2011-10-141-1/+2
| | | | | | | | could be arguments, for example. No testcase because this is a bug-fix broken out of a larger optimization patch. llvm-svn: 141951
* Enhance the memdep interface so that users can tell the difference between a ↵Eli Friedman2011-10-132-35/+42
| | | | | | | | dependency which cannot be calculated and a path reaching the entry point of the function. This patch introduces isNonFuncLocal, which replaces isUnknown in some cases. Patch by Xiaoyi Guo. llvm-svn: 141896
* Reapply r141870, SCEV expansion of post-inc.Andrew Trick2011-10-131-2/+14
| | | | | | | Speculatively reapply to see if this test case still crashes on linux. I may have fixed it in my last checkin. llvm-svn: 141895
* Fix memory corruption I introduced a few checkins ago.Andrew Trick2011-10-131-5/+6
| | | | | | Self-review easily caught this obvious bug. llvm-svn: 141880
* Revert r141870. The test case crashes on linux with data corruption. A ↵Andrew Trick2011-10-131-14/+2
| | | | | | deeper issue was exposed. llvm-svn: 141873
* LSR: Reuse the post-inc expansion of expressions.Andrew Trick2011-10-131-2/+14
| | | | | | | | This avoids unnecessary expansion of expressions and allows the SCEV expander to work on expression DAGs, not just trees. Fixes PR11090. llvm-svn: 141870
* SCEV: Rewrite TrandformForPostIncUse to handle expression DAGs, notAndrew Trick2011-10-131-30/+70
| | | | | | | | just expression trees. Partially fixes PR11090. Test case will be with the full fix. llvm-svn: 141868
* Slightly more useful tracing.Andrew Trick2011-10-131-1/+2
| | | | llvm-svn: 141867
* Add a new wrapper node for a DILexicalBlock that encapsulates it and aEric Christopher2011-10-112-1/+43
| | | | | | | | | | | | | file. Since it should only be used when necessary propagate it through the backend code generation and tweak testcases accordingly. This helps with code like in clang's test/CodeGen/debug-info-line.c where we have multiple #line directives within a single lexical block and want to generate only a single block that contains each file change. Part of rdar://10246360 llvm-svn: 141729
* Move replaceCongruentIVs into SCEVExapander and bias toward "expanded"Andrew Trick2011-10-111-0/+100
| | | | | | | | | | | IVs. Indvars previously chose randomly between congruent IVs. Now it will bias the decision toward IVs that SCEVExpander likes to create. This was not done to fix any problem, it's just a welcome side effect of factoring code. llvm-svn: 141633
* Add an extra safety check in front of the optimization in r141442.Andrew Trick2011-10-081-0/+9
| | | | llvm-svn: 141470
* LSR should only reuse phis that match its formula.Andrew Trick2011-10-071-61/+113
| | | | | | Fixes rdar://problem/5064068 llvm-svn: 141442
* Remove the old atomic instrinsics. autoupgrade functionality is included ↵Eli Friedman2011-10-061-20/+0
| | | | | | with this patch. llvm-svn: 141333
* Fixes PR11070 - assert in SCEV getConstantEvolvingPHIOperands.Andrew Trick2011-10-051-16/+10
| | | | llvm-svn: 141219
* Typo. Thanks Bob.Andrew Trick2011-10-051-1/+1
| | | | llvm-svn: 141188
* Fix a broken assert found by -Wparentheses.Chandler Carruth2011-10-051-1/+1
| | | | llvm-svn: 141168
* Fix disabled SCEV analysis caused r141161 and add unit test.Andrew Trick2011-10-051-17/+32
| | | | | | | | I noticed during self-review that my previous checkin disabled some analysis. Even with the reenabled analysis the test case runs in about 5ms. Without the fix, it will take several minutes at least. llvm-svn: 141164
* Avoid exponential recursion in SCEV getConstantEvolvingPHI and ↵Andrew Trick2011-10-051-34/+82
| | | | | | | | | | EvaluateExpression. Note to compiler writers: never recurse on multiple instruction operands without memoization. Fixes rdar://10187945. Was taking 45s, now taking 5ms. llvm-svn: 141161
* The product of two chrec's can always be represented as a chrec.Nick Lewycky2011-10-041-32/+72
| | | | llvm-svn: 141066
* Reapply r140979 with fix! We never did get a testcase, but careful review of theNick Lewycky2011-10-031-4/+15
| | | | | | logic by David Meyer revealed this bug. llvm-svn: 140992
* Revert r140979 due to reports of bootstrap failure.Nick Lewycky2011-10-031-8/+4
| | | | llvm-svn: 140980
* Add one more case we compute a max trip count.Nick Lewycky2011-10-031-4/+8
| | | | llvm-svn: 140979
* Inlining and unrolling heuristics should be aware of free truncs.Andrew Trick2011-10-011-12/+20
| | | | | | | | | | We want heuristics to be based on accurate data, but more importantly we don't want llvm to behave randomly. A benign trunc inserted by an upstream pass should not cause a wild swings in optimization level. See PR11034. It's a general problem with threshold-based heuristics, but we can make it less bad. llvm-svn: 140919
* whitespaceAndrew Trick2011-10-011-46/+46
| | | | llvm-svn: 140916
* indvars: generalize SCEV getPreStartForSignExtend.Andrew Trick2011-09-281-2/+14
| | | | | | | Handle general Add expressions to avoid leaving around redundant 32-bit IVs. llvm-svn: 140701
* PR10628: Fix getModRefInfo so it queries the underlying alias() ↵Eli Friedman2011-09-281-1/+1
| | | | | | implementation correctly while checking nocapture calls. llvm-svn: 140666
* Stop emitting instructions with the name "tmp" they eat up memory and have ↵Benjamin Kramer2011-09-271-7/+7
| | | | | | | | to be uniqued, without any benefit. If someone prefers %tmp42 to %42, run instnamer. llvm-svn: 140634
* Enhance alias analysis for atomic instructions a bit. Upgrade a couple ↵Eli Friedman2011-09-261-0/+40
| | | | | | alias-analysis tests to the new atomic instructions. llvm-svn: 140557
* Fix for DbgInfoPrinter.cpp:174:12: warning: ‘LineNo’ may be used ↵Galina Kistanova2011-09-211-1/+1
| | | | | | uninitialized in this function. llvm-svn: 140281
* Add support to emit debug info for C++0x nullptr type.Devang Patel2011-09-142-1/+28
| | | | llvm-svn: 139751
* Fix typo.Eric Christopher2011-09-121-1/+1
| | | | llvm-svn: 139530
* Add asserts to keep front-ends honest while encoding debug info into LLVM IR ↵Devang Patel2011-09-121-0/+9
| | | | | | using DIBuilder. llvm-svn: 139515
* Set NSW/NUW flags on SCEVAddExpr when the operation is flagged asAndrew Trick2011-09-101-1/+7
| | | | | | | | | | such. I'm doing this now for completeness because I can't think of/remember any reason that it was left out. I'm not sure it will help anything, but if we don't do it we need to explain why in comments. llvm-svn: 139450
* A couple minor corrections to r139276.Eli Friedman2011-09-081-14/+14
| | | | llvm-svn: 139277
* Fix the logic in BasicAliasAnalysis::aliasGEP for comparing GEP's with ↵Eli Friedman2011-09-081-33/+33
| | | | | | variable differences so that it actually does something sane. Fixes PR10881. llvm-svn: 139276
OpenPOWER on IntegriCloud