This is an archive of the discontinued LLVM Phabricator instance.

[SystemZ] Make sure that SystemZAddressingMode::dump() does not crash.
ClosedPublic

Authored by jonpa on Oct 16 2018, 10:08 AM.

Details

Summary

I tried to compile a file with '-mllvm -debug', which caused a crash. This time this was during isel, where the common code did not properly handle a call to printIRSlotNumber without a Function pointer set. This occurred because SystemZAddressingMode::dump() was calling SDNode::dump() without passing the DAG pointer.

This patch:

  1. It seems reasonable that the common code does not crash, and this patch at least prints a question mark instead of calling printIRSlotNumber() when the Function pointer is not set.
  2. Since the DAG is available, SystemZAddressingMode::dump() should pass it.

My problem would disappear even without (1) since (2) avoids it. This also means there is no test case for (1). Adding reviewer for (1) also.

Diff Detail

Event Timeline

jonpa created this revision.Oct 16 2018, 10:08 AM
jonpa edited the summary of this revision. (Show Details)

The SystemZ parts LGTM.

thegameg added inline comments.Oct 23 2018, 7:00 AM
lib/CodeGen/MachineOperand.cpp
464

Can we make this:

int Slot = MST.getCurrentFunction() ? MST.getLocalSlot(&V) : -1;
MachineOperand::printIRSlotNumber(OS, Slot);

?

That way, printIRSlotNumber will print <badref> instead of ?.

jonpa accepted this revision.Oct 25 2018, 5:08 PM
jonpa marked an inline comment as done.

Thanks for review. SystemZ changes committed as r345347.

lib/CodeGen/MachineOperand.cpp
464

Yes, I checked that we get this output. Committed this separately as r345342

This revision is now accepted and ready to land.Oct 25 2018, 5:08 PM
jonpa closed this revision.Oct 25 2018, 5:08 PM
jonpa marked an inline comment as done.