aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2013-01-04 22:17:31 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2013-01-04 22:17:31 +0000
commit73a853f05c913f6127e93cf0df3ba6398bcfc213 (patch)
tree321dba381b4f48973763201e7557820f75d8dc14
parent5767d919569f7b4be51c0a13bff24f722625d9f3 (diff)
Move an assertion so it doesn't dereference end().
The R600 target has test cases that exercises this code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171538 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/MachineInstrBundle.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/CodeGen/MachineInstrBundle.cpp b/lib/CodeGen/MachineInstrBundle.cpp
index ffca550f8b..77bcd1d7c8 100644
--- a/lib/CodeGen/MachineInstrBundle.cpp
+++ b/lib/CodeGen/MachineInstrBundle.cpp
@@ -224,14 +224,13 @@ bool llvm::finalizeBundles(MachineFunction &MF) {
bool Changed = false;
for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) {
MachineBasicBlock &MBB = *I;
-
MachineBasicBlock::instr_iterator MII = MBB.instr_begin();
- assert(!MII->isInsideBundle() &&
- "First instr cannot be inside bundle before finalization!");
-
MachineBasicBlock::instr_iterator MIE = MBB.instr_end();
if (MII == MIE)
continue;
+ assert(!MII->isInsideBundle() &&
+ "First instr cannot be inside bundle before finalization!");
+
for (++MII; MII != MIE; ) {
if (!MII->isInsideBundle())
++MII;