diff options
author | Dan Gohman <gohman@apple.com> | 2011-02-02 02:02:34 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2011-02-02 02:02:34 +0000 |
commit | 08d2c98c23824e1b9c28e089f2a31006ab07547f (patch) | |
tree | e66f8cf8e2db99e793581d7c4e28e5f004af1adf /llvm/lib/Transforms | |
parent | 31f7d460fab75a107fe8f7cbcdfe77582362f1d2 (diff) | |
download | bcm5719-llvm-08d2c98c23824e1b9c28e089f2a31006ab07547f.tar.gz bcm5719-llvm-08d2c98c23824e1b9c28e089f2a31006ab07547f.zip |
Fix reassociate to clear optional flags, such as nsw.
llvm-svn: 124712
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/Reassociate.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp index 396b3299807..5df6f3725a3 100644 --- a/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp @@ -240,6 +240,12 @@ void Reassociate::LinearizeExpr(BinaryOperator *I) { RHS->setOperand(0, LHS); I->setOperand(0, RHS); + // Conservatively clear all the optional flags, which may not hold + // after the reassociation. + I->clearSubclassOptionalData(); + LHS->clearSubclassOptionalData(); + RHS->clearSubclassOptionalData(); + ++NumLinear; MadeChange = true; DEBUG(dbgs() << "Linearized: " << *I << '\n'); @@ -341,6 +347,11 @@ void Reassociate::RewriteExprTree(BinaryOperator *I, DEBUG(dbgs() << "RA: " << *I << '\n'); I->setOperand(0, Ops[i].Op); I->setOperand(1, Ops[i+1].Op); + + // Conservatively clear all the optional flags, which may not hold + // after the reassociation. + I->clearSubclassOptionalData(); + DEBUG(dbgs() << "TO: " << *I << '\n'); MadeChange = true; ++NumChanged; @@ -356,6 +367,11 @@ void Reassociate::RewriteExprTree(BinaryOperator *I, if (I->getOperand(1) != Ops[i].Op) { DEBUG(dbgs() << "RA: " << *I << '\n'); I->setOperand(1, Ops[i].Op); + + // Conservatively clear all the optional flags, which may not hold + // after the reassociation. + I->clearSubclassOptionalData(); + DEBUG(dbgs() << "TO: " << *I << '\n'); MadeChange = true; ++NumChanged; |