https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78185

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
So for RTL the same issue exists - the always_reached computation is wrong.

I suppose the easiest would be to simply not try moving trapping invariants in
RTL invariant motion, it looks hardly useful after GIMPLE was here...

diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
index 551103f..deb5be6 100644
--- a/gcc/loop-invariant.c
+++ b/gcc/loop-invariant.c
@@ -1076,7 +1076,7 @@ pre_check_invariant_p (bool simple, rtx dest)
    unless the program ends due to a function call.  */

 static void
-find_invariant_insn (rtx_insn *insn, bool always_reached, bool
always_executed)
+find_invariant_insn (rtx_insn *insn, bool, bool always_executed)
 {
   df_ref ref;
   struct def *def;
@@ -1108,8 +1108,8 @@ find_invariant_insn (rtx_insn *insn, bool always_reached,
bool always_executed)
   if (can_throw_internal (insn))
     return;

-  /* We cannot make trapping insn executed, unless it was executed before.  */
-  if (may_trap_or_fault_p (PATTERN (insn)) && !always_reached)
+  /* We cannot make trapping insn executed.  */
+  if (may_trap_or_fault_p (PATTERN (insn)))
     return;

   depends_on = BITMAP_ALLOC (NULL);


dead code removal possible here (always_reached computation, eventually
always_executed as well).

Now have to devise a testcase... (raise a timeout signal, verify it is
catched?)

Reply via email to