Don't perform an expensive check if it's not necessary.
authorOwen Anderson <resistor@mac.com>
Mon, 18 Jun 2007 04:30:44 +0000 (04:30 +0000)
committerOwen Anderson <resistor@mac.com>
Mon, 18 Jun 2007 04:30:44 +0000 (04:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37620 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/GVNPRE.cpp

index a2a7743667278e2506a4518ae94af4332f99d062..ef45dbc4d7af7c6e4ff2aa4c7a9322c1f189b8f7 100644 (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);