diff options
| author | Dan Gohman <gohman@apple.com> | 2011-02-02 02:05:46 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2011-02-02 02:05:46 +0000 |
| commit | c6f0bda83900d479c9b8d62478a59f098c550763 (patch) | |
| tree | 24d0ab567321339cf97f27c0ba4ee58ab4400f4f /llvm/lib/Transforms | |
| parent | 08d2c98c23824e1b9c28e089f2a31006ab07547f (diff) | |
| download | bcm5719-llvm-c6f0bda83900d479c9b8d62478a59f098c550763.tar.gz bcm5719-llvm-c6f0bda83900d479c9b8d62478a59f098c550763.zip | |
Conservatively, clear optional flags, such as nsw, when performing
reassociation. No testcase, because I wasn't able to create a testcase
which actually demonstrates a problem.
llvm-svn: 124713
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstructionCombining.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index 2d5773a31fc..7208ad0c7cc 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -157,6 +157,9 @@ bool InstCombiner::SimplifyAssociativeOrCommutative(BinaryOperator &I) { // It simplifies to V. Form "A op V". I.setOperand(0, A); I.setOperand(1, V); + // Conservatively clear the optional flags, since they may not be + // preserved by the reassociation. + I.clearSubclassOptionalData(); Changed = true; ++NumReassoc; continue; @@ -174,6 +177,9 @@ bool InstCombiner::SimplifyAssociativeOrCommutative(BinaryOperator &I) { // It simplifies to V. Form "V op C". I.setOperand(0, V); I.setOperand(1, C); + // Conservatively clear the optional flags, since they may not be + // preserved by the reassociation. + I.clearSubclassOptionalData(); Changed = true; ++NumReassoc; continue; @@ -193,6 +199,9 @@ bool InstCombiner::SimplifyAssociativeOrCommutative(BinaryOperator &I) { // It simplifies to V. Form "V op B". I.setOperand(0, V); I.setOperand(1, B); + // Conservatively clear the optional flags, since they may not be + // preserved by the reassociation. + I.clearSubclassOptionalData(); Changed = true; ++NumReassoc; continue; @@ -210,6 +219,9 @@ bool InstCombiner::SimplifyAssociativeOrCommutative(BinaryOperator &I) { // It simplifies to V. Form "B op V". I.setOperand(0, B); I.setOperand(1, V); + // Conservatively clear the optional flags, since they may not be + // preserved by the reassociation. + I.clearSubclassOptionalData(); Changed = true; ++NumReassoc; continue; @@ -234,6 +246,9 @@ bool InstCombiner::SimplifyAssociativeOrCommutative(BinaryOperator &I) { Worklist.Add(New); I.setOperand(0, New); I.setOperand(1, Folded); + // Conservatively clear the optional flags, since they may not be + // preserved by the reassociation. + I.clearSubclassOptionalData(); Changed = true; continue; } |

