mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-12 05:56:28 +00:00
MachineVerifier: Don't crash if MachineOperand has no parent
If you somehow added a MachineOperand to an instruction that did not have the parent set, the verifier would crash since it attempts to use the operand's parent. llvm-svn: 236249
This commit is contained in:
parent
54ecccfd00
commit
07ee8a89f5
@ -329,8 +329,18 @@ bool MachineVerifier::runOnMachineFunction(MachineFunction &MF) {
|
||||
} else if (!CurBundle)
|
||||
report("No bundle header", MBBI);
|
||||
visitMachineInstrBefore(MBBI);
|
||||
for (unsigned I = 0, E = MBBI->getNumOperands(); I != E; ++I)
|
||||
visitMachineOperand(&MBBI->getOperand(I), I);
|
||||
for (unsigned I = 0, E = MBBI->getNumOperands(); I != E; ++I) {
|
||||
const MachineInstr &MI = *MBBI;
|
||||
const MachineOperand &Op = MI.getOperand(I);
|
||||
if (Op.getParent() != &MI) {
|
||||
// Make sure to use correct addOperand / RmeoveOperand / ChangeTo
|
||||
// functions when replacing operands of a MachineInstr.
|
||||
report("Instruction has operand with wrong parent set", &MI);
|
||||
}
|
||||
|
||||
visitMachineOperand(&Op, I);
|
||||
}
|
||||
|
||||
visitMachineInstrAfter(MBBI);
|
||||
|
||||
// Was this the last bundled instruction?
|
||||
|
Loading…
Reference in New Issue
Block a user