aboutsummaryrefslogtreecommitdiffstats
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
commit84b4f2ce266b1bf1616f0f29cdc61db461f53b00 (patch)
tree41d4f0d271cc78d6437d7f260d07e1078396f82a /lib/Target/ARM/Thumb2SizeReduction.cpp
parent3ad91621c3496f496aab945e2bfafda1b44d5536 (diff)
downloadexternal_llvm-84b4f2ce266b1bf1616f0f29cdc61db461f53b00.zip
external_llvm-84b4f2ce266b1bf1616f0f29cdc61db461f53b00.tar.gz
external_llvm-84b4f2ce266b1bf1616f0f29cdc61db461f53b00.tar.bz2
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 b3ed8e8..e6f45bb 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: