From: Owen Anderson Date: Mon, 18 Jun 2007 04:30:44 +0000 (+0000) Subject: Don't perform an expensive check if it's not necessary. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=60e174495a88c85b9f2c47db3cef94c3e492cda2;p=oota-llvm.git 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 --- diff --git a/lib/Transforms/Scalar/GVNPRE.cpp b/lib/Transforms/Scalar/GVNPRE.cpp index a2a77436672..ef45dbc4d7a 100644 --- a/lib/Transforms/Scalar/GVNPRE.cpp +++ b/lib/Transforms/Scalar/GVNPRE.cpp @@ -329,7 +329,12 @@ void GVNPRE::clean(std::set& 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(BO->getOperand(1)); if (!rhsValid) @@ -339,7 +344,12 @@ void GVNPRE::clean(std::set& 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);