summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-02-17 01:29:24 +0000
committerChris Lattner <sabre@nondot.org>2011-02-17 01:29:24 +0000
commit3eb0af94c4062fa42519a8bc46d14ac64fb8fbc5 (patch)
tree4a8e096f1088d49bd32aa509c115f79b1c72b0d5 /llvm/lib/Transforms
parent05d389f407d039f65d6e16e2002e9620550636fc (diff)
downloadbcm5719-llvm-3eb0af94c4062fa42519a8bc46d14ac64fb8fbc5.tar.gz
bcm5719-llvm-3eb0af94c4062fa42519a8bc46d14ac64fb8fbc5.zip
fix PR9215, preventing -reassociate from clearing nsw/nuw when
it swaps the LHS/RHS of a single binop. llvm-svn: 125700
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/Reassociate.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp
index 5df6f3725a3..e093b52571a 100644
--- a/llvm/lib/Transforms/Scalar/Reassociate.cpp
+++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp
@@ -348,9 +348,10 @@ void Reassociate::RewriteExprTree(BinaryOperator *I,
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();
+ // Clear all the optional flags, which may not hold after the
+ // reassociation if the expression involved more than just this operation.
+ if (Ops.size() != 2)
+ I->clearSubclassOptionalData();
DEBUG(dbgs() << "TO: " << *I << '\n');
MadeChange = true;
OpenPOWER on IntegriCloud