When disabling PRE for a value is directly redundant with itself
authorDan Gohman <dan433584@gmail.com>
Tue, 12 Feb 2013 19:05:10 +0000 (19:05 +0000)
committerDan Gohman <dan433584@gmail.com>
Tue, 12 Feb 2013 19:05:10 +0000 (19:05 +0000)
(through a loop), don't continue to iterate through the reamining
predecessors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174994 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/GVN.cpp

index 0fe10960cc74ee78e16fac7d3405709ad33dece2..ff55f6fc2f2d0af423e8a41c2e46e4f34e65b261 100644 (file)
@@ -2455,7 +2455,9 @@ bool GVN::performPRE(Function &F) {
           PREPred = P;
           ++NumWithout;
         } else if (predV == CurInst) {
+          /* CurInst dominates this predecessor. */
           NumWithout = 2;
+          break;
         } else {
           predMap[P] = predV;
           ++NumWith;