This is an archive of the discontinued LLVM Phabricator instance.

llvm-reduce: Add reduction pass for MachineBasicBlocks
Needs ReviewPublic

Authored by arsenm on Jun 6 2022, 5:42 AM.

Details

Summary

Tries to follow the same basic strategy as the IR block reduction, but
producing plausibly valid MIR is a lot harder than the IR. We can't
replace block references with undef, so use a dummy empty block
inserted at the end of the function. We also have to figure out a
place to place IMPLICIT_DEFs and try to handle non-SSA liveness.

This doesn't completely handle everything necessary. It currently
doesn't really try to maintain physical register liveness, cleanup
gMIR control flow gMIR, or non-control flow block references.

This will also leave a lot of kept blocks as dead code if all blocks
between the entry and the kept block are deleted. It should probably
figure out some way to reconnect them to the CFG.

Diff Detail

Event Timeline

arsenm created this revision.Jun 6 2022, 5:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 6 2022, 5:42 AM
arsenm requested review of this revision.Jun 6 2022, 5:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 6 2022, 5:42 AM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm updated this revision to Diff 434613.Jun 6 2022, 2:24 PM

Fix failing to add implicit_def for values defined by the last instruction in a block

arsenm updated this revision to Diff 434889.Jun 7 2022, 10:51 AM

Fix assert when deleting predecessor of undef block