On Wed, Feb 21, 2024 at 10:03:17AM +0000, Richard Sandiford wrote:
> In this PR, the SME mode-switching code needs to insert a stack-probe
> loop for an alloca.  This patch allows the target to do that.
> 
> There are two parts to it: allowing loops for insertions in blocks,
> and allowing them for insertions on edges.  The former can be handled
> entirely within mode-switching itself, by recording which blocks have
> had new branches inserted.  The latter requires an extension to
> commit_one_edge_insertion.
> 
> I think the extension to commit_one_edge_insertion makes logical sense,
> since it already explicitly allows internal loops during RTL expansion.
> The single-block find_sub_basic_blocks is a relatively recent addition,
> so wouldn't have been available when the code was originally written.
> 
> The patch also has a small and obvious fix to make the aarch64 emit
> hook cope with labels.
> 
> I've added specific -fstack-clash-protection versions of all
> aarch64-sme.exp tests that previously failed because of this bug.
> I've also added -fno-stack-clash-protection to the original versions
> of these tests if they contain scans that assume no protection.
> 
> Tested on aarch64-linux-gnu.  OK to install?
> 
> Richard
> 
> 
> gcc/
>       PR target/113220
>       * cfgrtl.cc (commit_one_edge_insertion): Handle sequences that
>       contain jumps even if called after initial RTL expansion.
>       * mode-switching.cc: Include cfgbuild.h.
>       (optimize_mode_switching): Allow the sequence returned by the
>       emit hook to contain internal jumps.  Record which blocks
>       contain such jumps and split the blocks at the end.
>       * config/aarch64/aarch64.cc (aarch64_mode_emit): Check for
>       non-debug insns when scanning the sequence.

LGTM.

        Jakub

Reply via email to