diff options
-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 |