[PATCH] D13274: [WinEH] Clone funclets with multiple parents

Joseph Tremoulet via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 12:05:34 PDT 2015


JosephTremoulet added a comment.

In http://reviews.llvm.org/D13274#260936, @rnk wrote:

> Are we sure we need to handle this case with cloning? The intention of the design was that the rules around `catchendpad` and `cleanupendpad` would make it impossible for the optimizer to form invokes that don't unwind through the associated end pad.
>
> For `cleanupendpad`, it directly consumes a token for the associated `cleanuppad`, so we can mark any invokes in a `cleanuppad` that don't transitively unwind to the `cleanupendpad` as unreachable.
>
> For `catchendpad`, the rules about how `catchpad`s are allowed to unwind should allow us to create a many-to-one association from `catchpad` to `cleanupendpad` and apply the same transformation to unreachable.


We can do both the things you mention, and we do them in `removeImplausibleTerminators`.  This cloning is about handling cases where what should be separate funclets branch to common code (like maybe they branch to a shared `call void @abort() ; unreachable`).  If the common code itself has an invoke to another funclet (like maybe we started with the previous but then `@abort` got inlined), we can't tell which of the original two it is supposed to be a sub-funclet of, and so we clone it.


Repository:
  rL LLVM

http://reviews.llvm.org/D13274





More information about the llvm-commits mailing list