summaryrefslogtreecommitdiff
path: root/lib/Target/ARM/Thumb2ITBlockPass.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-06-25 23:14:54 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-06-25 23:14:54 +0000
commite39e06af38281bb8923d28b554a11a74e4eb67b7 (patch)
tree35d87b83cec0b07f8d1454ce875baffcfce68605 /lib/Target/ARM/Thumb2ITBlockPass.cpp
parent9f054f017c7bced071f5a4de606cec6751edd23f (diff)
downloadllvm-e39e06af38281bb8923d28b554a11a74e4eb67b7.tar.gz
llvm-e39e06af38281bb8923d28b554a11a74e4eb67b7.tar.bz2
llvm-e39e06af38281bb8923d28b554a11a74e4eb67b7.tar.xz
Thumb2ITBlockPass: Fix a possible dereference of an invalid iterator. This was
introduced in r106343, but only showed up recently (with a particular compiler & linker combination) because of the particular check, and because we have no builtin checking for dereferencing the end of an array, which is truly unfortunate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106908 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/Thumb2ITBlockPass.cpp')
-rw-r--r--lib/Target/ARM/Thumb2ITBlockPass.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Target/ARM/Thumb2ITBlockPass.cpp b/lib/Target/ARM/Thumb2ITBlockPass.cpp
index 57f8eecf31..417059dc92 100644
--- a/lib/Target/ARM/Thumb2ITBlockPass.cpp
+++ b/lib/Target/ARM/Thumb2ITBlockPass.cpp
@@ -310,9 +310,9 @@ Thumb2ITBlockPass::MoveCopyOutOfITBlock(MachineInstr *MI,
// If not, then there is nothing to be gained by moving the copy.
MachineBasicBlock::iterator I = MI; ++I;
MachineBasicBlock::iterator E = MI->getParent()->end();
+ while (I != E && I->isDebugValue())
+ ++I;
if (I != E) {
- while (I != E && I->isDebugValue())
- ++I;
unsigned NPredReg = 0;
ARMCC::CondCodes NCC = llvm::getITInstrPredicate(I, NPredReg);
if (NCC == CC || NCC == OCC)