This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] Printing a null Value.
ClosedPublic

Authored by sfuniak on Dec 20 2021, 10:11 PM.

Details

Summary

This diff adds support to printing a Value when it is null. We encounter this situation when debugging the PDL bytcode execution (where a null Value is perfectly valid). Currently, the AsmPrinter crashes (with an assert in a cast) when it encounters such Value.

We follow the same format used in other printed entities (e.g., null attribute).

Diff Detail

Event Timeline

sfuniak created this revision.Dec 20 2021, 10:11 PM
sfuniak requested review of this revision.Dec 20 2021, 10:11 PM
mehdi_amini accepted this revision.Dec 21 2021, 9:58 AM

In SSANameState we have:

if (!value) {
  stream << "<<NULL>>";
  return;
}

Can you update it there to also print NULL VALUE to keeps the same message everywhere?

This revision is now accepted and ready to land.Dec 21 2021, 9:58 AM
bondhugula accepted this revision.Dec 21 2021, 10:02 AM
bondhugula added a subscriber: bondhugula.

Useful improvement - thanks!

sfuniak updated this revision to Diff 395775.Dec 21 2021, 5:16 PM

Fix printing of null value in SSANameState::printValueID.

bondhugula accepted this revision.Dec 21 2021, 5:47 PM
rriddle added inline comments.Dec 21 2021, 11:05 PM
mlir/lib/IR/AsmPrinter.cpp
2829

I would check against impl directly. !*this looks dangerously close to !this

sfuniak updated this revision to Diff 395804.Dec 22 2021, 12:30 AM

Check against impl directly

sfuniak marked an inline comment as done.Dec 22 2021, 12:31 AM
sfuniak updated this revision to Diff 397172.Jan 3 2022, 6:24 PM

Rebased.

This revision was automatically updated to reflect the committed changes.