This is an archive of the discontinued LLVM Phabricator instance.

[LowerSwitch] Delete all new dead blocks accurately
AbandonedPublic

Authored by Nuullll on Nov 2 2021, 10:32 PM.

Details

Summary

https://llvm.org/pr52383

LowerSwitch should be responsible for removing all newly introduced dead blocks.
The original implementation only deleted the unreachable default block itself, leaving
its dominatee-successors (if any) unreachable.

This patch uses DominatorTree so that we know the accurate set of blocks that need to
be removed.

Diff Detail

Event Timeline

Nuullll created this revision.Nov 2 2021, 10:32 PM
Nuullll requested review of this revision.Nov 2 2021, 10:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 2 2021, 10:32 PM
Nuullll updated this revision to Diff 384340.Nov 2 2021, 10:34 PM

Preserve analysis for new pass manager.

Nuullll updated this revision to Diff 384343.Nov 2 2021, 10:48 PM

Fix AMDGPU llc-pipeline test

If the newly added blocks are dead, they should be deleted by later DCE passes in one shot, am I right?
I think it is good to eliminate dead blocks if we could make it cheaply. But if we need to calculate reachable definitions by DT in a loop, it looks a little bit expensive.
I mean this patch may cause the compile time increases but wouldn't change the code generated finally.

joerg added a subscriber: joerg.Nov 4 2021, 10:52 AM

I fully agree that constructing DT can be expensive especially if it is potentially done multiple times. I don't mind using it when available, but the gain seems limited for forcing it.

aeubanks requested changes to this revision.Nov 8 2021, 10:11 AM

+1 to what the others have said

This revision now requires changes to proceed.Nov 8 2021, 10:11 AM
Nuullll abandoned this revision.Nov 8 2021, 5:21 PM

Thanks all for leaving the comments. I agree with you.