diff options
| author | Bob Wilson <bob.wilson@apple.com> | 2010-03-02 00:09:29 +0000 |
|---|---|---|
| committer | Bob Wilson <bob.wilson@apple.com> | 2010-03-02 00:09:29 +0000 |
| commit | 0fd415820ba7af8dac30e62ad74b5630f3ce9612 (patch) | |
| tree | 21087e04bb073363905bd01945076eedbd9b8da4 /llvm/lib | |
| parent | c1f2e153323915a70cef92dbfedf3c0137a15980 (diff) | |
| download | bcm5719-llvm-0fd415820ba7af8dac30e62ad74b5630f3ce9612.tar.gz bcm5719-llvm-0fd415820ba7af8dac30e62ad74b5630f3ce9612.zip | |
Don't attempt load PRE when there is no real redundancy (i.e., the load is in
a loop and is itself the only dependency).
llvm-svn: 97526
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/GVN.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp index a4c07160249..fcb802a72ae 100644 --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/lib/Transforms/Scalar/GVN.cpp @@ -1542,11 +1542,13 @@ bool GVN::processNonLocalLoad(LoadInst *LI, // at least one of the values is LI. Since this means that we won't be able // to eliminate LI even if we insert uses in the other predecessors, we will // end up increasing code size. Reject this by scanning for LI. - if (!EnableFullLoadPRE) { - for (unsigned i = 0, e = ValuesPerBlock.size(); i != e; ++i) - if (ValuesPerBlock[i].isSimpleValue() && - ValuesPerBlock[i].getSimpleValue() == LI) + for (unsigned i = 0, e = ValuesPerBlock.size(); i != e; ++i) { + if (ValuesPerBlock[i].isSimpleValue() && + ValuesPerBlock[i].getSimpleValue() == LI) { + // Skip cases where LI is the only definition, even for EnableFullLoadPRE. + if (!EnableFullLoadPRE || e == 1) return false; + } } // FIXME: It is extremely unclear what this loop is doing, other than |

