It is possible to be in a situation where more than one funclet token is
a valid SSA value. If we see a terminator which exits a funclet which
doesn't use the funclet's token, replace it with unreachable.
Details
Diff Detail
Event Timeline
LGTM with one nit.
lib/CodeGen/WinEHPrepare.cpp | ||
---|---|---|
3242–3243 | I think this is subtle enough to merit a comment (along the lines of "We can't demote a token but it's safe to skip these since cloning will remove mismatched uses"). |
Spoke too soon, sorry.
test/CodeGen/WinEH/wineh-demotion.ll | ||
---|---|---|
325 | Is this input valid? I don't think the def of %cp0 dominates the use here (path where first invoke returns normally, second invoke raises exception reaches here via cleanup2 without passing through the def at cleanup1). |
test/CodeGen/WinEH/wineh-demotion.ll | ||
---|---|---|
325 | Oh, I misread it; that 2nd invoke is unreachable and cleanup2 is only reachable from this cleanupret, which is dominated by cleanup1. Sorry for the noise, objection rescinded. |
I think this is subtle enough to merit a comment (along the lines of "We can't demote a token but it's safe to skip these since cloning will remove mismatched uses").