[PATCH, rfc] combine: Make code after a new trap unreachable (PR78432)
Segher Boessenkool
segher@kernel.crashing.org
Tue Nov 29 02:04:00 GMT 2016
On Mon, Nov 28, 2016 at 02:44:44PM -0700, Jeff Law wrote:
> On 11/23/2016 04:55 PM, Segher Boessenkool wrote:
> >Combine can turn a conditional trap into an unconditional trap. If it
> >does that it should make the code after it unreachable (an unconditional
> >trap should be the last insn in its bb, and that bb has no successors).
> >
> >This patch seems to work. It is hard to be sure, this is very hard to
> >trigger. Quite a few other passes look like they need something similar
> >as well, but I don't see anything else handling it yet either.
> >
> >How does this look? Any better ideas?
> It's probably a reasonable place to start as there's lots of
> similarities to converting a conditional branch to an unconditional.
> Like you I worry there may be other instances of this issue may be lurking.
>
> The possibility of having a conditional trap in the IL turn into an
> unconditional trap has always been there. As you note, it's somewhat
> difficult to trigger since the SSA optimizers ought to expose/optimize
> this long before we get to RTL.
I committed this with this changelog (and the PR # fixed):
2016-11-28 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/78342
* combine.c: Include "cfghooks.h".
(try_combine): If we create an unconditional trap, break the basic
block in two just after it, and remove the edge between; also, set
the *new_direct_jump_p flag so that cleanup_cfg is run.
More information about the Gcc-patches
mailing list