This is an archive of the discontinued LLVM Phabricator instance.

[EH] Create removeUnwindEdge utility
ClosedPublic

Authored by JosephTremoulet on Sep 24 2015, 6:04 PM.

Details

Summary

Factor the code that rewrites invokes to calls and rewrites WinEH
terminators to their "unwind to caller" equivalents into a helper in
Utils/Local, and use it in the three places I'm aware of that need to do
this.

Diff Detail

Event Timeline

JosephTremoulet retitled this revision from to [EH] Create removeUnwindEdge utility.
JosephTremoulet updated this object.
JosephTremoulet added a subscriber: llvm-commits.

Remove a stale comment and simplify the code that updates a removed cleanup's predecessors' outgoing edges. I looked at introducing EHTerminatorInst as suggested in the FIXME comment (D13184), but the complexity seemed unnecessary, especially since this case can be handled with replaceUsesOfWith.

rnk accepted this revision.Sep 26 2015, 9:30 AM
rnk edited edge metadata.

lgtm

Thanks for the refactor!

lib/Transforms/Utils/Local.cpp
1266

I think each if here can be something like:

NewTI = ...::Create(...);
OldPad = ...->getUnwindDest();

And then you can share the name taking and edge erasing code for all the non-call terminators.

This revision is now accepted and ready to land.Sep 26 2015, 9:30 AM
JosephTremoulet edited edge metadata.

Incorporate Reid's feedback