Don't call lookupNumber more than we have to.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53470 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp
index 86a8238..18a9661 100644
--- a/lib/Transforms/Scalar/GVN.cpp
+++ b/lib/Transforms/Scalar/GVN.cpp
@@ -1267,11 +1267,14 @@
         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