diff options
author | Owen Anderson <resistor@mac.com> | 2007-06-18 04:30:44 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2007-06-18 04:30:44 +0000 |
commit | 60e174495a88c85b9f2c47db3cef94c3e492cda2 (patch) | |
tree | 95130656ef7cd2377cc47f32504547c854cf8b37 | |
parent | 910b4b84798c814dab1d1e50c95854be8fef8772 (diff) |
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
-rw-r--r-- | lib/Transforms/Scalar/GVNPRE.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/GVNPRE.cpp b/lib/Transforms/Scalar/GVNPRE.cpp index a2a7743667..ef45dbc4d7 100644 --- a/lib/Transforms/Scalar/GVNPRE.cpp +++ b/lib/Transforms/Scalar/GVNPRE.cpp @@ -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); |