instr_iterator

Is it safe or legal to call isInsideBundle even when I == E?

MachineBasicBlock::iterator MachineBasicBlock::getFirstNonPHI() {
instr_iterator I = instr_begin(), E = instr_end();
while (I != E && I->isPHI())
++I;
assert(!I->isInsideBundle() && “First non-phi MI cannot be inside a bundle!”);
return I;
}

I am seeing an assert when I run llc.
The code is in lib/CodeGen/MachineBasicBlock.cpp:145.

No, neither.

Please see the attached patch.
There was one more line which was calling isInsideBundle without any check.

instriter1.patch (836 Bytes)

Please see the attached patch.
There was one more line which was calling isInsideBundle without any check.

Looks good.

Thanks.