aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/GVN/condprop.ll
Commit message (Collapse)AuthorAgeFilesLines
* Update Transforms tests to use CHECK-LABEL for easier debugging. No ↵Stephen Lin2013-07-141-11/+11
| | | | | | | | | | | | | | | | | | | | | | | functionality change. This update was done with the following bash script: find test/Transforms -name "*.ll" | \ while read NAME; do echo "$NAME" if ! grep -q "^; *RUN: *llc" $NAME; then TEMP=`mktemp -t temp` cp $NAME $TEMP sed -n "s/^define [^@]*@\([A-Za-z0-9_]*\)(.*$/\1/p" < $NAME | \ while read FUNC; do sed -i '' "s/;\(.*\)\([A-Za-z0-9_]*\):\( *\)@$FUNC\([( ]*\)\$/;\1\2-LABEL:\3@$FUNC(/g" $TEMP done mv $TEMP $NAME fi done git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186268 91177308-0d34-0410-b5e6-96231b3b80d8
* Nick pointed out on IRC that GVN's propagateEquality wasn't propagatingDuncan Sands2012-03-041-0/+17
| | | | | | | | | | | equalities into phi node operands for which the equality is known to hold in the incoming basic block. That's because replaceAllDominatedUsesWith wasn't handling phi nodes correctly in general (that this didn't give wrong results was just luck: the specific way GVN uses replaceAllDominatedUsesWith precluded wrong changes to phi nodes). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152006 91177308-0d34-0410-b5e6-96231b3b80d8
* Have GVN also do condition propagation when the right-hand side is notDuncan Sands2012-02-291-0/+57
| | | | | | | a constant. This fixes PR1768. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151713 91177308-0d34-0410-b5e6-96231b3b80d8
* When performing a conditional branch depending on the value of a comparisonDuncan Sands2012-02-271-0/+64
| | | | | | | | | | %cmp (eg: A==B) we already replace %cmp with "true" under the true edge, and with "false" under the false edge. This change enhances this to replace the negated compare (A!=B) with "false" under the true edge and "true" under the false edge. Reported to improve perlbench results by 1%. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151517 91177308-0d34-0410-b5e6-96231b3b80d8
* Reduce the number of dom queries made by GVN's conditional propagationDuncan Sands2012-02-051-19/+0
| | | | | | | | | | | | | logic by half: isOnlyReachableViaThisEdge was trying to be clever and handle the case of a branch to a basic block which is contained in a loop. This costs a domtree lookup and is completely useless due to GVN's position in the pass pipeline: all loops have preheaders at this point, which means it is enough for isOnlyReachableViaThisEdge to check that Dst has only one predecessor. (I checked this theoretical argument by running over the entire nightly testsuite, and indeed it is so!). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149838 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach GVN to also propagate switch cases. For example, in this codeDuncan Sands2011-10-071-0/+33
| | | | | | | | | | | | | | | switch (n) { case 27: do_something(x); ... } the call do_something(x) will be replaced with do_something(27). In gcc-as-one-big-file this results in the removal of about 500 lines of bitcode (about 0.02%), so has about 1/10 of the effect of propagating branch conditions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141360 91177308-0d34-0410-b5e6-96231b3b80d8
* GVN does simple propagation of conditions: when it sees a conditionalDuncan Sands2011-10-051-9/+33
| | | | | | | | | | | | | | | | | | | | branch "br i1 %x, label %if_true, label %if_false" then it replaces "%x" with "true" in places only reachable via the %if_true arm, and with "false" in places only reachable via the %if_false arm. Except that actually it doesn't: if value numbering shows that %y is equal to %x then, yes, %y will be turned into true/false in this way, but any occurrences of %x itself are not transformed. Fix this. What's more, it's often the case that %x is an equality comparison such as "%x = icmp eq %A, 0", in which case every occurrence of %A that is only reachable via the %if_true arm can be replaced with 0. Implement this and a few other variations on this theme. This reduces the number of lines of LLVM IR in "GCC as one big file" by 0.2%. It has a bigger impact on Ada code, typically reducing the number of lines of bitcode by around 0.4% by removing repeated compiler generated checks. Passes the LLVM nightly testsuite and the Ada ACATS testsuite. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141177 91177308-0d34-0410-b5e6-96231b3b80d8
* Generalize GVN's conditional propagation logic slightly:Duncan Sands2011-10-051-1/+21
| | | | | | | | | it's OK for the false/true destination to have multiple predecessors as long as the extra ones are dominated by the branch destination. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141176 91177308-0d34-0410-b5e6-96231b3b80d8
* Give GVN back the ability to perform simple conditional propagation on ↵Owen Anderson2010-12-211-0/+55
| | | | | | | | | | conditional branch values. I still think that LVI should be handling this, but that capability is some ways off in the future, and this matters for some significant benchmarks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122378 91177308-0d34-0410-b5e6-96231b3b80d8
* Completely rework the datastructure GVN uses to represent the value number ↵Owen Anderson2010-11-181-52/+0
| | | | | | | | | | | | | | | | | | | | | | | | to leader mapping. Previously, this was a tree of hashtables, and a query recursed into the table for the immediate dominator ad infinitum if the initial lookup failed. This led to really bad performance on tall, narrow CFGs. We can instead replace it with what is conceptually a multimap of value numbers to leaders (actually represented by a hashtable with a list of Value*'s as the value type), and then determine which leader from that set to use very cheaply thanks to the DFS numberings maintained by DominatorTree. Because there are typically few duplicates of a given value, this scan tends to be quite fast. Additionally, we use a custom linked list and BumpPtr allocation to avoid any unnecessary allocation in representing the value-side of the multimap. This change brings with it a 15% (!) improvement in the total running time of GVN on 403.gcc, which I think is pretty good considering that includes all the "real work" being done by MemDep as well. The one downside to this approach is that we can no longer use GVN to perform simple conditional progation, but that seems like an acceptable loss since we now have LVI and CorrelatedValuePropagation to pick up the slack. If you see conditional propagation that's not happening, please file bugs against LVI or CVP. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119714 91177308-0d34-0410-b5e6-96231b3b80d8
* Make BasicAliasAnalysis a normal AliasAnalysis implementation whichDan Gohman2010-10-181-1/+1
| | | | | | | | | | | | | does normal initialization and normal chaining. Change the default AliasAnalysis implementation to NoAlias. Update StandardCompileOpts.h and friends to explicitly request BasicAliasAnalysis. Update tests to explicitly request -basicaa. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116720 91177308-0d34-0410-b5e6-96231b3b80d8
* Change tests from "opt %s" to "opt < %s" so that opt doesn't see theDan Gohman2009-09-111-1/+1
| | | | | | | | | input filename so that opt doesn't print the input filename in the output so that grep lines in the tests don't unintentionally match strings in the input filename. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81537 91177308-0d34-0410-b5e6-96231b3b80d8
* Use opt -S instead of piping bitcode output through llvm-dis.Dan Gohman2009-09-081-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81257 91177308-0d34-0410-b5e6-96231b3b80d8
* Change these tests to feed the assembly files to opt directly, insteadDan Gohman2009-09-081-1/+1
| | | | | | | of using llvm-as, now that opt supports this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81226 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r68211, with the miscompilations it caused fixed.Owen Anderson2009-04-011-0/+52
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68262 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r68172. It caused regressions inDan Gohman2009-04-011-52/+0
| | | | | | | | | Applications/Burg/burg Applications/ClamAV/clamscan and many other tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68211 91177308-0d34-0410-b5e6-96231b3b80d8
* Enhance GVN to propagate simple conditionals. This fixes PR3921.Owen Anderson2009-04-011-0/+52
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68172 91177308-0d34-0410-b5e6-96231b3b80d8