aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/ARM/Thumb2SizeReduction.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2009-08-16 11:56:42 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2009-08-16 11:56:42 +0000
commit9ae7d44d95de16be5ed7bea7e1117160d9e2d5ce (patch)
tree41d4f0d271cc78d6437d7f260d07e1078396f82a /lib/Target/ARM/Thumb2SizeReduction.cpp
parent80c76436fe22a5481fac2cafe3c0a652fa6ddb31 (diff)
Fix use after free in Thumb2SizeReduction (PR4707). A MachineInstr was used after erasure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79189 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/Thumb2SizeReduction.cpp')
-rw-r--r--lib/Target/ARM/Thumb2SizeReduction.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Target/ARM/Thumb2SizeReduction.cpp b/lib/Target/ARM/Thumb2SizeReduction.cpp
index b3ed8e84f9..e6f45bb5ca 100644
--- a/lib/Target/ARM/Thumb2SizeReduction.cpp
+++ b/lib/Target/ARM/Thumb2SizeReduction.cpp
@@ -654,8 +654,11 @@ bool Thumb2SizeReduce::ReduceMBB(MachineBasicBlock &MBB) {
}
// Try to transform ro a 16-bit non-two-address instruction.
- if (Entry.NarrowOpc1 && ReduceToNarrow(MBB, MI, Entry, LiveCPSR))
+ if (Entry.NarrowOpc1 && ReduceToNarrow(MBB, MI, Entry, LiveCPSR)) {
Modified = true;
+ MachineBasicBlock::iterator I = prior(NextMII);
+ MI = &*I;
+ }
}
ProcessNext: