Don't call lookupNumber more than we have to.
authorOwen Anderson <resistor@mac.com>
Fri, 11 Jul 2008 20:05:13 +0000 (20:05 +0000)
committerOwen Anderson <resistor@mac.com>
Fri, 11 Jul 2008 20:05:13 +0000 (20:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53470 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/GVN.cpp

index 86a8238ee425a5df8a19cffdb486262c4f06e6e9..18a9661684f35c72d7e27c2938979d4c3bc2a80e 100644 (file)
@@ -1267,11 +1267,14 @@ bool GVN::performPRE(Function& F) {
         Value* op = BI->getOperand(i);
         if (isa<Argument>(op) || isa<Constant>(op) || isa<GlobalValue>(op))
           PREInstr->setOperand(i, op);
-        else if (!lookupNumber(PREPred, VN.lookup(op))) {
-          success = false;
-          break;
-        } else
-          PREInstr->setOperand(i, lookupNumber(PREPred, VN.lookup(op)));
+        else {
+          Value* V = lookupNumber(PREPred, VN.lookup(op));
+          if (!V) {
+            success = false;
+            break;
+          } else
+            PREInstr->setOperand(i, V);
+        }
       }
       
       // Fail out if we encounter an operand that is not available in