diff options
author | Owen Anderson <resistor@mac.com> | 2008-07-11 20:05:13 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2008-07-11 20:05:13 +0000 |
commit | c45996bf7464d4b5bc038abeff362f47fea401d9 (patch) | |
tree | 832d13e6ed2ddc913eb392162358f4a998cfb6d2 | |
parent | 92e0834ac7d9ff2539706522ef521bd2319dc15f (diff) |
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
-rw-r--r-- | lib/Transforms/Scalar/GVN.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index 86a8238ee4..18a9661684 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -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 |