This is an archive of the discontinued LLVM Phabricator instance.

llvm-reduce: Don't turn switches into returns
ClosedPublic

Authored by arsenm on Oct 19 2022, 1:31 PM.

Details

Summary

Re-use one of the existing successors as the new default.
This helps with a future patch to fix handling of unreachable
blocks.

Diff Detail

Event Timeline

arsenm created this revision.Oct 19 2022, 1:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 19 2022, 1:31 PM
arsenm requested review of this revision.Oct 19 2022, 1:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 19 2022, 1:31 PM
Herald added a subscriber: wdng. · View Herald Transcript
aeubanks added inline comments.Oct 21 2022, 4:28 PM
llvm/tools/llvm-reduce/deltas/ReduceBasicBlocks.cpp
98–104

do we have a test for this part?

114

if NewDefault was already a successor, doesn't its phis already have values from this block?

arsenm added inline comments.Oct 23 2022, 4:06 PM
llvm/tools/llvm-reduce/deltas/ReduceBasicBlocks.cpp
98–104

It gets hit, but not sure this is reflected in the direct output of any. Added another case

114

Yes that's where it's getting the value. Phis have to have an incoming operand for each instance

arsenm updated this revision to Diff 470019.Oct 23 2022, 4:06 PM
aeubanks accepted this revision.Oct 28 2022, 4:15 PM
aeubanks added inline comments.
llvm/tools/llvm-reduce/deltas/ReduceBasicBlocks.cpp
114

TIL you need redundant entries

This revision is now accepted and ready to land.Oct 28 2022, 4:15 PM