Don't perform an expensive check if it's not necessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37620 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2007-06-18 04:30:44 +00:00
parent 910b4b8479
commit 60e174495a

View File

@ -329,7 +329,12 @@ void GVNPRE::clean(std::set<Value*, ExprLT>& set) {
lhsValid = true;
break;
}
lhsValid &= !dependsOnInvoke(BO->getOperand(0));
// Check for dependency on invoke insts
// NOTE: This check is expensive, so don't do it if we
// don't have to
if (lhsValid)
lhsValid = !dependsOnInvoke(BO->getOperand(0));
bool rhsValid = !isa<Instruction>(BO->getOperand(1));
if (!rhsValid)
@ -339,7 +344,12 @@ void GVNPRE::clean(std::set<Value*, ExprLT>& set) {
rhsValid = true;
break;
}
rhsValid &= !dependsOnInvoke(BO->getOperand(1));
// Check for dependency on invoke insts
// NOTE: This check is expensive, so don't do it if we
// don't have to
if (rhsValid)
rhsValid = !dependsOnInvoke(BO->getOperand(1));
if (!lhsValid || !rhsValid)
set.erase(BO);