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

Bill Wendling isanbard at gmail.com
Thu May 3 21:22:33 PDT 2012


Author: void
Date: Thu May  3 23:22:32 2012
New Revision: 156155

URL: http://llvm.org/viewvc/llvm-project?rev=156155&view=rev
Log:
Add 'landingpad' instructions to the list of instructions to ignore.
Also combine the code in the 'assert' statement.

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=156155&r1=156154&r2=156155&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Thu May  3 23:22:32 2012
@@ -175,6 +175,7 @@
 
 static bool isUnmovableInstruction(Instruction *I) {
   if (I->getOpcode() == Instruction::PHI ||
+      I->getOpcode() == Instruction::LandingPad ||
       I->getOpcode() == Instruction::Alloca ||
       I->getOpcode() == Instruction::Load ||
       I->getOpcode() == Instruction::Invoke ||
@@ -272,13 +273,14 @@
 // linearize it as well.  Besides that case, this does not recurse into A,B, or
 // C.
 void Reassociate::LinearizeExpr(BinaryOperator *I) {
-  BinaryOperator *LHS = cast<BinaryOperator>(I->getOperand(0));
-  BinaryOperator *RHS = cast<BinaryOperator>(I->getOperand(1));
-  assert(isReassociableOp(LHS, I->getOpcode()) &&
-         isReassociableOp(RHS, I->getOpcode()) &&
-         "Not an expression that needs linearization?");
-
-  DEBUG(dbgs() << "Linear" << *LHS << '\n' << *RHS << '\n' << *I << '\n');
+  BinaryOperator *LHS = isReassociableOp(I->getOperand(0), I->getOpcode());
+  BinaryOperator *RHS = isReassociableOp(I->getOperand(1), I->getOpcode());
+  assert(LHS && RHS && "Not an expression that needs linearization?");
+
+  DEBUG({
+      dbgs() << "Linear:\n";
+      dbgs() << '\t' << *LHS << "\t\n" << *RHS << "\t\n" << *I << '\n';
+    });
 
   // Move the RHS instruction to live immediately before I, avoiding breaking
   // dominator properties.





More information about the llvm-commits mailing list