aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2010-09-15 00:32:40 +0000
committerBill Wendling <isanbard@gmail.com>2010-09-15 00:32:40 +0000
commited70cc3e1ba3b7b511c1bd6d3358ba58cc0eae63 (patch)
treeca2ba2bb09f7c2467c42a0875f2a5dce147c349c
parent7e789a2e81fa5640053eb61f5fc8b434d4fd19ef (diff)
$ svn merge -c 113848 https://llvm.org/svn/llvm-project/llvm/trunk
--- Merging r113848 into '.': U lib/CodeGen/PeepholeOptimizer.cpp must not peephole away side effects git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_28@113913 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/PeepholeOptimizer.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/CodeGen/PeepholeOptimizer.cpp b/lib/CodeGen/PeepholeOptimizer.cpp
index ea14d276d5..17cee46ca1 100644
--- a/lib/CodeGen/PeepholeOptimizer.cpp
+++ b/lib/CodeGen/PeepholeOptimizer.cpp
@@ -272,7 +272,8 @@ bool PeepholeOptimizer::runOnMachineFunction(MachineFunction &MF) {
MII = I->begin(), ME = I->end(); MII != ME; ) {
MachineInstr *MI = &*MII;
- if (MI->getDesc().isCompare()) {
+ if (MI->getDesc().isCompare() &&
+ !MI->getDesc().hasUnmodeledSideEffects()) {
++MII; // The iterator may become invalid if the compare is deleted.
Changed |= OptimizeCmpInstr(MI, MBB);
} else {