diff options
author | Alex Coplan <alex.coplan@arm.com> | 2023-12-21 10:52:44 +0000 |
---|---|---|
committer | Alex Coplan <alex.coplan@arm.com> | 2023-12-21 10:52:44 +0000 |
commit | aca1f9d7cab3dc1a374a7dc0ec6f7a8d02d2869a (patch) | |
tree | 2468c7ac077d6434a8ab716d93b2d822e4e4ad43 /gcc | |
parent | 41a5f67db3cd625d2f3cfba6a87d3530a3291f33 (diff) | |
download | gcc-aca1f9d7cab3dc1a374a7dc0ec6f7a8d02d2869a.zip gcc-aca1f9d7cab3dc1a374a7dc0ec6f7a8d02d2869a.tar.gz gcc-aca1f9d7cab3dc1a374a7dc0ec6f7a8d02d2869a.tar.bz2 |
aarch64: Prevent moving throwing accesses in ldp/stp pass [PR113093]
As the PR shows, there was nothing to prevent the ldp/stp pass from
trying to move throwing insns, which lead to an RTL verification
failure.
This patch fixes that.
gcc/ChangeLog:
PR target/113093
* config/aarch64/aarch64-ldp-fusion.cc (latest_hazard_before):
If the insn is throwing, record the previous insn as a hazard to
prevent moving it from the end of the BB.
gcc/testsuite/ChangeLog:
PR target/113093
* gcc.dg/pr113093.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/aarch64/aarch64-ldp-fusion.cc | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr113093.c | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/config/aarch64/aarch64-ldp-fusion.cc b/gcc/config/aarch64/aarch64-ldp-fusion.cc index 0e2c299..59db70e 100644 --- a/gcc/config/aarch64/aarch64-ldp-fusion.cc +++ b/gcc/config/aarch64/aarch64-ldp-fusion.cc @@ -618,6 +618,13 @@ latest_hazard_before (insn_info *insn, rtx *ignore, { insn_info *result = nullptr; + // If the insn can throw then it is at the end of a BB and we can't + // move it, model this by recording a hazard in the previous insn + // which will prevent moving the insn up. + if (cfun->can_throw_non_call_exceptions + && find_reg_note (insn->rtl (), REG_EH_REGION, NULL_RTX)) + return insn->prev_nondebug_insn (); + // Return true if we registered the hazard. auto hazard = [&](insn_info *h) -> bool { diff --git a/gcc/testsuite/gcc.dg/pr113093.c b/gcc/testsuite/gcc.dg/pr113093.c new file mode 100644 index 0000000..af2a334 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr113093.c @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-options "-Os -fharden-control-flow-redundancy -fnon-call-exceptions" } */ +_Complex long *c; +void init() { *c = 1.0; } |