diff options
author | Cameron Zwarich <zwarich@apple.com> | 2013-02-17 01:45:04 +0000 |
---|---|---|
committer | Cameron Zwarich <zwarich@apple.com> | 2013-02-17 01:45:04 +0000 |
commit | 0c222835982bae5e4831e16090f6ce594ef541a6 (patch) | |
tree | 2ff3981372b12b1b419d68ef46e201dc745c3e7d | |
parent | f0b2535344e8c9e2912da78010918a44c5a18cab (diff) |
Fix a conversion from a forward iterator to a reverse iterator in
MachineBasicBlock::SplitCriticalEdge. Since this is an iterator rather than
an instr_iterator, the isBundled() check only passes if getFirstTerminator()
returned end() and the garbage memory happens to lean that way.
Multiple successors can be present without any terminator instructions in the
case of exception handling with a fallthrough.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175383 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/MachineBasicBlock.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/CodeGen/MachineBasicBlock.cpp b/lib/CodeGen/MachineBasicBlock.cpp index 3d754366ee..f22a70716e 100644 --- a/lib/CodeGen/MachineBasicBlock.cpp +++ b/lib/CodeGen/MachineBasicBlock.cpp @@ -852,12 +852,13 @@ MachineBasicBlock::SplitCriticalEdge(MachineBasicBlock *Succ, Pass *P) { // Update all intervals for registers whose uses may have been modified by // updateTerminator(). iterator FirstTerminator = getFirstTerminator(); - MachineInstr *FirstTerminatorMI = FirstTerminator; - if (FirstTerminatorMI->isBundled()) - FirstTerminatorMI = getBundleStart(FirstTerminatorMI); - reverse_iterator PreTerminators = - (FirstTerminator == begin()) ? rend() - : reverse_iterator(FirstTerminatorMI); + reverse_iterator PreTerminators; + if (FirstTerminator == begin()) + PreTerminators = rend(); + else if (FirstTerminator == end()) + PreTerminators = rbegin(); + else + PreTerminators = reverse_iterator(FirstTerminator); LIS->repairIntervalsInRange(this, rbegin(), PreTerminators, UsedRegs); } |