This is an archive of the discontinued LLVM Phabricator instance.

[Utils] Extract EliminateUnreachableBlocks (NFC)
ClosedPublic

Authored by modocache on Mar 6 2019, 6:51 PM.

Details

Summary

Extract the functionality of eliminating unreachable basic blocks
within a function, previously encapsulated within the
-unreachableblockelim pass, and make it available as a function within
BlockUtils.h. No functional change intended other than making the logic
reusable.

Exposing this logic makes it easier to implement
https://reviews.llvm.org/D59068, which fixes coroutines bug
https://bugs.llvm.org/show_bug.cgi?id=40979.

Diff Detail

Repository
rL LLVM

Event Timeline

modocache created this revision.Mar 6 2019, 6:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2019, 6:51 PM

Friendly ping! I thought this might be easier to review if I split it up from https://reviews.llvm.org/D59068, which fixes a bug in coroutines and has already been accepted. This diff is an NFC but is necessary to land the bug fix.

davide requested changes to this revision.Mar 8 2019, 9:36 AM
davide added inline comments.
lib/Transforms/Utils/BasicBlockUtils.cpp
113–114 ↗(On Diff #189639)

Do you need KeepOneInputPHIs ?

This revision now requires changes to proceed.Mar 8 2019, 9:36 AM
modocache updated this revision to Diff 190080.Mar 11 2019, 6:53 AM

Oops! Thanks for pointing that out @davide -- I had meant to pass them through to the DeleteDeadBlocks but forgot. Should be good now!

modocache marked an inline comment as done.Mar 11 2019, 6:53 AM
davide accepted this revision.Mar 11 2019, 9:24 AM

LGTM.

This revision is now accepted and ready to land.Mar 11 2019, 9:24 AM
This revision was automatically updated to reflect the committed changes.