This is an archive of the discontinued LLVM Phabricator instance.

[AsmWriter] Construct SlotTracker with the function
ClosedPublic

Authored by kazu on Oct 16 2020, 10:42 AM.

Details

Summary

This patch teaches BasicBlock::print to construct an instance of
SlotTracker with the containing function.

Without this patch, we dump:

  • IR Dump After LoopInstSimplifyPass ***

; Preheader:

br label %1

; Loop:
<badref>: ; preds = %1, %0

br label %1

Note "<badref>" above. This happens because BasicBlock::print calls:

SlotTracker SlotTable(this->getModule());

Note that this constructor does not add the contents of functions to
the slot table. That is, basic blocks are left unnumbered.

This patch fixes the problem by switching to:

SlotTracker SlotTable(this->getParent());

which does add the contents of the Module and the function,
this->getParent(), to the slot table.

Diff Detail

Event Timeline

kazu created this revision.Oct 16 2020, 10:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 16 2020, 10:42 AM
kazu requested review of this revision.Oct 16 2020, 10:42 AM
apilipenko accepted this revision.Oct 20 2020, 1:07 PM
This revision is now accepted and ready to land.Oct 20 2020, 1:07 PM
This revision was landed with ongoing or failed builds.Oct 20 2020, 3:02 PM
This revision was automatically updated to reflect the committed changes.