This is an archive of the discontinued LLVM Phabricator instance.

MachineVerifier: Don't crash if MachineOperand has no parent
ClosedPublic

Authored by arsenm on Apr 29 2015, 3:16 PM.

Details

Reviewers
qcolombet
Summary

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.

Diff Detail

Event Timeline

arsenm updated this revision to Diff 24661.Apr 29 2015, 3:16 PM
arsenm retitled this revision from to MachineVerifier: Don't crash if MachineOperand has no parent .
arsenm updated this object.
arsenm edited the test plan for this revision. (Show Details)
arsenm added a subscriber: Unknown Object (MLST).

Hi Matt,

Any chance you can add a test case?

Cheers,
-Quentin

Hmm, in that case, why do we need that check?

I just wonder how we could end up in such situation if we use the dedicated APIs.

qcolombet accepted this revision.Apr 29 2015, 4:30 PM
qcolombet added a reviewer: qcolombet.

I see :).
Looks like the RemoveOperand/addOperand gymnastic may bit someone else.

LGTM.

Q.

lib/CodeGen/MachineVerifier.cpp
336

Maybe add a comment saying that we should make sure to use RemoveOperand/addOperand or ChangeTo APIs.

This revision is now accepted and ready to land.Apr 29 2015, 4:30 PM
arsenm closed this revision.Apr 30 2015, 12:39 PM

r236249