diff options
author | Bill Wendling <isanbard@gmail.com> | 2012-05-04 04:22:32 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2012-05-04 04:22:32 +0000 |
commit | 98bda3dfefcb08e6ce81fa9545b05eb433cd5b87 (patch) | |
tree | e50a9434a68b0e4447cd59918724d3201cbb539f /lib/Transforms/Scalar/Reassociate.cpp | |
parent | 11ac1f81a8d3cb9c58ec93e424429df9dccffe36 (diff) | |
download | external_llvm-98bda3dfefcb08e6ce81fa9545b05eb433cd5b87.zip external_llvm-98bda3dfefcb08e6ce81fa9545b05eb433cd5b87.tar.gz external_llvm-98bda3dfefcb08e6ce81fa9545b05eb433cd5b87.tar.bz2 |
Add 'landingpad' instructions to the list of instructions to ignore.
Also combine the code in the 'assert' statement.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156155 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/Reassociate.cpp')
-rw-r--r-- | lib/Transforms/Scalar/Reassociate.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp index 577a143..cc98ba0 100644 --- a/lib/Transforms/Scalar/Reassociate.cpp +++ b/lib/Transforms/Scalar/Reassociate.cpp @@ -175,6 +175,7 @@ void Reassociate::RemoveDeadBinaryOp(Value *V) { 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 @@ static Instruction *LowerNegateToMultiply(Instruction *Neg, // 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. |