[llvm-commits] [llvm] r92370 - /llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp

Chris Lattner sabre at nondot.org
Thu Dec 31 11:34:45 PST 2009


Author: lattner
Date: Thu Dec 31 13:34:45 2009
New Revision: 92370

URL: http://llvm.org/viewvc/llvm-project?rev=92370&view=rev
Log:
make reassociate more careful about not leaving around dead mul's

Modified:
    llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=92370&r1=92369&r2=92370&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Thu Dec 31 13:34:45 2009
@@ -530,7 +530,13 @@
     return 0;
   }
   
-  if (Factors.size() == 1) return Factors[0].Op;
+  // If this was just a single multiply, remove the multiply and return the only
+  // remaining operand.
+  if (Factors.size() == 1) {
+    ValueRankMap.erase(BO);
+    BO->eraseFromParent();
+    return Factors[0].Op;
+  }
   
   RewriteExprTree(BO, Factors);
   return BO;





More information about the llvm-commits mailing list