Early-RA was considering throwing instructions as being dead and removing
them even if -fno-delete-dead-exceptions was in use. This fixes that oversight.
Built and tested for aarch64-linux-gnu.
PR target/116927
gcc/ChangeLog:
* config/aarch64/aarch64-early-ra.cc (early_ra::is_dead_insn): Insns
that throw are not dead with -fno-delete-dead-exceptions.
gcc/testsuite/ChangeLog:
* g++.dg/torture/pr116927-1.C: New test.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
if (side_effects_p (set))
return false;
+ /* If we can't delete dead exceptions and the insn throws,
+ then the instruction is not dead. */
+ if (!cfun->can_delete_dead_exceptions
+ && !insn_nothrow_p (insn))
+ return false;
+
return true;
}
--- /dev/null
+// { dg-do compile }
+// { dg-additional-options "-fnon-call-exceptions -fno-delete-dead-exceptions" }
+
+// PR target/116927
+// aarch64's Early ra was removing possiblely trapping
+// floating point insn
+
+void
+foo (float f)
+{
+ try {
+ f ++;
+ }catch(...)
+ {}
+}