summaryrefslogtreecommitdiff
path: root/test/Analysis
Commit message (Collapse)AuthorAge
...
* Restore commits 142790 and 142843 - they weren't breaking the buildDuncan Sands2011-10-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | bots. Original commit messages: - Reapply r142781 with fix. Original message: Enhance SCEV's brute force loop analysis to handle multiple PHI nodes in the loop header when computing the trip count. With this, we now constant evaluate: struct ListNode { const struct ListNode *next; int i; }; static const struct ListNode node1 = {0, 1}; static const struct ListNode node2 = {&node1, 2}; static const struct ListNode node3 = {&node2, 3}; int test() { int sum = 0; for (const struct ListNode *n = &node3; n != 0; n = n->next) sum += n->i; return sum; } - Now that we look at all the header PHIs, we need to consider all the header PHIs when deciding that the loop has stopped evolving. Fixes miscompile in the gcc torture testsuite! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142919 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the API usage in loop probability heuristics. It was incorrectlyChandler Carruth2011-10-25
| | | | | | | | | | | | | | | classifying many edges as exiting which were in fact not. These mainly formed edges into sub-loops. It was also not correctly classifying all returning edges out of loops as leaving the loop. With this match most of the loop heuristics are more rational. Several serious regressions on loop-intesive benchmarks like perlbench's loop tests when built with -enable-block-placement are fixed by these updated heuristics. Unfortunately they in turn uncover some other regressions. There are still several improvemenst that should be made to loop heuristics including trip-count, and early back-edge management. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142917 91177308-0d34-0410-b5e6-96231b3b80d8
* Speculatively revert commits 142790 and 142843 to see if it fixesDuncan Sands2011-10-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | the dragonegg and llvm-gcc self-host buildbots. Original commit messages: - Reapply r142781 with fix. Original message: Enhance SCEV's brute force loop analysis to handle multiple PHI nodes in the loop header when computing the trip count. With this, we now constant evaluate: struct ListNode { const struct ListNode *next; int i; }; static const struct ListNode node1 = {0, 1}; static const struct ListNode node2 = {&node1, 2}; static const struct ListNode node3 = {&node2, 3}; int test() { int sum = 0; for (const struct ListNode *n = &node3; n != 0; n = n->next) sum += n->i; return sum; } - Now that we look at all the header PHIs, we need to consider all the header PHIs when deciding that the loop has stopped evolving. Fixes miscompile in the gcc torture testsuite! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142916 91177308-0d34-0410-b5e6-96231b3b80d8
* Now that we look at all the header PHIs, we need to consider all the header PHIsNick Lewycky2011-10-24
| | | | | | | | when deciding that the loop has stopped evolving. Fixes miscompile in the gcc torture testsuite! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142843 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove return heuristics from the static branch probabilities, andChandler Carruth2011-10-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | introduce no-return or unreachable heuristics. The return heuristics from the Ball and Larus paper don't work well in practice as they pessimize early return paths. The only good hitrate return heuristics are those for: - NULL return - Constant return - negative integer return Only the last of these three can possibly require significant code for the returning block, and even the last is fairly rare and usually also a constant. As a consequence, even for the cold return paths, there is little code on that return path, and so little code density to be gained by sinking it. The places where sinking these blocks is valuable (inner loops) will already be weighted appropriately as the edge is a loop-exit branch. All of this aside, early returns are nearly as common as all three of these return categories, and should actually be predicted as taken! Rather than muddy the waters of the static predictions, just remain silent on returns and let the CFG itself dictate any layout or other issues. However, the return heuristic was flagging one very important case: unreachable. Unfortunately it still gave a 1/4 chance of the branch-to-unreachable occuring. It also didn't do a rigorous job of finding those blocks which post-dominate an unreachable block. This patch builds a more powerful analysis that should flag all branches to blocks known to then reach unreachable. It also has better worst-case runtime complexity by not looping through successors for each block. The previous code would perform an N^2 walk in the event of a single entry block branching to N successors with a switch where each successor falls through to the next and they finally fall through to a return. Test case added for noreturn heuristics. Also doxygen comments improved along the way. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142793 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r142781 with fix. Original message:Nick Lewycky2011-10-24
| | | | | | | | | | | | | | | | | | | | Enhance SCEV's brute force loop analysis to handle multiple PHI nodes in the loop header when computing the trip count. With this, we now constant evaluate: struct ListNode { const struct ListNode *next; int i; }; static const struct ListNode node1 = {0, 1}; static const struct ListNode node2 = {&node1, 2}; static const struct ListNode node3 = {&node2, 3}; int test() { int sum = 0; for (const struct ListNode *n = &node3; n != 0; n = n->next) sum += n->i; return sum; } git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142790 91177308-0d34-0410-b5e6-96231b3b80d8
* Speculatively revert r142781. Bots are showingNick Lewycky2011-10-24
| | | | | | | | Assertion `i_nocapture < OperandTraits<PHINode>::operands(this) && "getOperand() out of range!"' failed. coming out of indvars. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142786 91177308-0d34-0410-b5e6-96231b3b80d8
* Enhance SCEV's brute force loop analysis to handle multiple PHI nodes in theNick Lewycky2011-10-23
| | | | | | | | | | | | | | | | | | | loop header when computing the trip count. With this, we now constant evaluate: struct ListNode { const struct ListNode *next; int i; }; static const struct ListNode node1 = {0, 1}; static const struct ListNode node2 = {&node1, 2}; static const struct ListNode node3 = {&node2, 3}; int test() { int sum = 0; for (const struct ListNode *n = &node3; n != 0; n = n->next) sum += n->i; return sum; } git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142781 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach the BranchProbabilityInfo pass to print its results, and use thatChandler Carruth2011-10-23
| | | | | | | | | | to bring it under direct test instead of merely indirectly testing it in the BlockFrequencyInfo pass. The next step is to start adding tests for the various heuristics employed, and to start fixing those heuristics once they're under test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142778 91177308-0d34-0410-b5e6-96231b3b80d8
* Make SCEV's brute force analysis stronger in two ways. Firstly, we should beNick Lewycky2011-10-22
| | | | | | | | | | | | | | | | | 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; } git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142731 91177308-0d34-0410-b5e6-96231b3b80d8
* Generalize the reading of probability metadata to work for both branchesChandler Carruth2011-10-19
| | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142493 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach the BranchProbabilityInfo analysis pass to read any metadataChandler Carruth2011-10-19
| | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142492 91177308-0d34-0410-b5e6-96231b3b80d8
* Add pass printing support to BlockFrequencyInfo pass. The implementationChandler Carruth2011-10-19
| | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142491 91177308-0d34-0410-b5e6-96231b3b80d8
* Missing test case for r141164.Andrew Trick2011-10-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141166 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r140979 with fix! We never did get a testcase, but careful review of theNick Lewycky2011-10-03
| | | | | | | logic by David Meyer revealed this bug. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140992 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r140979 due to reports of bootstrap failure.Nick Lewycky2011-10-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140980 91177308-0d34-0410-b5e6-96231b3b80d8
* Add one more case we compute a max trip count.Nick Lewycky2011-10-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140979 91177308-0d34-0410-b5e6-96231b3b80d8
* PR10628: Fix getModRefInfo so it queries the underlying alias() ↵Eli Friedman2011-09-28
| | | | | | implementation correctly while checking nocapture calls. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140666 91177308-0d34-0410-b5e6-96231b3b80d8
* Enhance alias analysis for atomic instructions a bit. Upgrade a couple ↵Eli Friedman2011-09-26
| | | | | | alias-analysis tests to the new atomic instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140557 91177308-0d34-0410-b5e6-96231b3b80d8
* This test only makes sense with -enable-iv-rewrite.Andrew Trick2011-09-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139576 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the logic in BasicAliasAnalysis::aliasGEP for comparing GEP's with ↵Eli Friedman2011-09-08
| | | | | | variable differences so that it actually does something sane. Fixes PR10881. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139276 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach BasicAA about the aliasing properties of memset_pattern16.Owen Anderson2011-09-06
| | | | | | | Fixes PR10872 and <rdar://problem/10065079>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139204 91177308-0d34-0410-b5e6-96231b3b80d8
* This transform only handles two-operand AddRec's. Prevent it from trying toNick Lewycky2011-09-06
| | | | | | | handle anything more complex. Fixes PR10383 again! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139186 91177308-0d34-0410-b5e6-96231b3b80d8
* The logic inside getMulExpr to simplify {a,+,b}*{c,+,d} was wrong, which wasNick Lewycky2011-09-06
| | | | | | | | visible given a=b=c=d=1, on iteration #1 (the second iteration). Replace it with correct math. Fixes PR10383! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139133 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r139126 due to selfhost failures reported by buildbots.Nick Lewycky2011-09-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139130 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach SCEV to report a max backedge count in one interesting case inNick Lewycky2011-09-05
| | | | | | | HowFarToZero; the case for a canonical loop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139126 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the loads after the calls so that the fix forRafael Espindola2011-07-09
| | | | | | | PR10292 doesn't show that the loads don't alias the allocas. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134852 91177308-0d34-0410-b5e6-96231b3b80d8
* Use CHECK-NEXT.Rafael Espindola2011-07-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134850 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove support for parsing the "type i32" syntax for defining a numberedChris Lattner2011-06-19
| | | | | | | | | top level type without a specified number. This syntax isn't documented and blocks forward progress. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133371 91177308-0d34-0410-b5e6-96231b3b80d8
* rip out a ton of intrinsic modernization logic from AutoUpgrade.cpp, which isChris Lattner2011-06-18
| | | | | | | | | | | for pre-2.9 bitcode files. We keep x86 unaligned loads, movnt, crc32, and the target indep prefetch change. As usual, updating the testsuite is a PITA. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133337 91177308-0d34-0410-b5e6-96231b3b80d8
* make the asmparser reject function and type redefinitions. 'Merging' hasn't ↵Chris Lattner2011-06-17
| | | | | | | | | been needed since llvm-gcc 3.4 days. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133248 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove support for using "foo" as symbols instead of %"foo". This is ancientChris Lattner2011-06-17
| | | | | | | | syntax and has been long obsolete. As usual, updating the tests is the nasty part of this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133242 91177308-0d34-0410-b5e6-96231b3b80d8
* manually upgrade a bunch of tests to modern syntax, and remove some thatChris Lattner2011-06-17
| | | | | | | | are either unreduced or only test old syntax. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133228 91177308-0d34-0410-b5e6-96231b3b80d8
* Test case for r132797.John McCall2011-06-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132962 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r131781, now that the GVN bug with partially-aliasing loadsDan Gohman2011-06-04
| | | | | | | is disabled. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132632 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove this test, which should have been reverted along with r131781.Dan Gohman2011-06-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132628 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r131781 again. Apparently there is more going on here.Dan Gohman2011-06-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132625 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r131781 (revert r131809), now that some BasicAA shortcomingsDan Gohman2011-06-04
| | | | | | | it exposed are fixed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132611 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix BasicAA's recursion detection so that it doesn't pessimizeDan Gohman2011-06-04
| | | | | | | | | | queries in the case of a DAG, where a query reaches a node visited earlier, but it's not on a cycle. This avoids MayAlias results in cases where BasicAA is expected to return MustAlias or PartialAlias in order to protect TBAA. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132609 91177308-0d34-0410-b5e6-96231b3b80d8
* When merging MustAlias and PartialAlias, chose PartialAlias insteadDan Gohman2011-06-03
| | | | | | | of conservatively choosing MayAlias. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132579 91177308-0d34-0410-b5e6-96231b3b80d8
* Make DecomposeGEPExpression check SimplifyInstruction onlyDan Gohman2011-05-24
| | | | | | | | | after checking for a GEP, so that it matches what GetUnderlyingObject does. This fixes an obscure bug turned up by bugpoint in the testcase for PR9931. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131971 91177308-0d34-0410-b5e6-96231b3b80d8
* I missed a checking with my GVN change. Chris Lattner2011-05-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131851 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert commit 131781, to see if it fixes the x86-64 dragonegg buildbot.Duncan Sands2011-05-21
| | | | | | | | | | Original log message: When BasicAA can determine that two pointers have the same base but differ by a dynamic offset, return PartialAlias instead of MayAlias. See the comment in the code for details. This fixes PR9971. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131809 91177308-0d34-0410-b5e6-96231b3b80d8
* When BasicAA can determine that two pointers have the same base butDan Gohman2011-05-21
| | | | | | | | differ by a dynamic offset, return PartialAlias instead of MayAlias. See the comment in the code for details. This fixes PR9971. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131781 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach BasicAA about arm.neon.vld1 and vst1.Dan Gohman2011-04-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130327 91177308-0d34-0410-b5e6-96231b3b80d8
* When analyzing functions known to only access argument pointees,Dan Gohman2011-04-27
| | | | | | | | | | only check arguments with pointer types. Update the documentation of IntrReadArgMem reflect this. While here, add support for TBAA tags on intrinsic calls. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130317 91177308-0d34-0410-b5e6-96231b3b80d8
* Test case and comment for PR9633.Andrew Trick2011-04-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130294 91177308-0d34-0410-b5e6-96231b3b80d8
* Make tests more useful.Benjamin Kramer2011-04-25
| | | | | | lit needs a linter ... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130126 91177308-0d34-0410-b5e6-96231b3b80d8
* PR9634: Don't unconditionally tell the AliasSetTracker that the PreheaderLoadEli Friedman2011-04-07
| | | | | | | | | | | | | is equivalent to any other relevant value; it isn't true in general. If it is equivalent, the LoopPromoter will tell the AST the equivalence. Also, delete the PreheaderLoad if it is unused. Chris, since you were the last one to make major changes here, can you check that this is sane? git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129049 91177308-0d34-0410-b5e6-96231b3b80d8
* remove postdom frontiers, because it is dead. Forward dom frontiers areChris Lattner2011-04-05
| | | | | | | still used by RegionInfo :( git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128943 91177308-0d34-0410-b5e6-96231b3b80d8