This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Remove unreachable EH pads
ClosedPublic

Authored by aheejin on Jan 4 2021, 3:49 PM.

Details

Summary

This removes unreachable EH pads in LateEHPrepare. This is not for
optimization but for preparation for CFGStackify. In CFGStackify, we
determine where to place try marker by computing the nearest common
dominator of all predecessors of an EH pad, but when an EH pad does not
have a predecessor, it becomes tricky. We can insert an empty dummy BB
before the EH pad and place the try there, but removing unreachable EH
pads is simpler.

This moves an existing exception label test from eh-label.mir to
exception.mir and adds a new test there.

This also adds some comments to existing methods.

Diff Detail

Event Timeline

aheejin created this revision.Jan 4 2021, 3:49 PM
aheejin requested review of this revision.Jan 4 2021, 3:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 4 2021, 3:49 PM
tlively accepted this revision.Jan 5 2021, 12:15 PM
tlively added inline comments.
llvm/test/CodeGen/WebAssembly/exception.mir
62

Can you add a ; CHECK for one of the other BB labels to demonstrate that this removed BB is different from other BBs?

This revision is now accepted and ready to land.Jan 5 2021, 12:15 PM
dschuff accepted this revision.Jan 6 2021, 5:22 PM
dschuff added inline comments.
llvm/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp
98

This could be SmallPtrSet, I guess it's smaller?

This revision was automatically updated to reflect the committed changes.
aheejin marked 2 inline comments as done.
aheejin added inline comments.Jan 9 2021, 3:43 AM
llvm/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp
98

Done. Also changed one more usage of SmallSet in this pass to SmallPtrSet.