From 8e462e9a82a875e956eb81d66e14a3e90e5504d6 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Fri, 11 Jul 2008 20:05:13 +0000 Subject: Don't call lookupNumber more than we have to. llvm-svn: 53470 --- llvm/lib/Transforms/Scalar/GVN.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'llvm/lib') diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp index 86a8238ee42..18a9661684f 100644 --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/lib/Transforms/Scalar/GVN.cpp @@ -1267,11 +1267,14 @@ bool GVN::performPRE(Function& F) { Value* op = BI->getOperand(i); if (isa(op) || isa(op) || isa(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 -- cgit v1.2.3