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

--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Richard Henderson from comment #3)
> (In reply to Uroš Bizjak from comment #2)
> > (I also wonder why we have to break the loop for naked USEs and CLOBBERs. We
> > should just skip the problematic insn and continue - as proposed in the
> > above patch).
> 
> Because it's not breaking out of the loop, it's breaking
> out of the switch, case INSN.
> 
> I don't think we should special-case TRAP_IF, but rather
> special-case BARRIER.  Suppose some -O0 test case involving
> __builtin_unreachable, which expands to no code at all.
> 
> Otherwise, I think the close_shadow_notrapb change is good.

Thanks for the comment (and the eye opener ;) ). Following is the patch I'm
going to regtest:

--cut here--
Index: alpha.c
===================================================================
--- alpha.c     (revision 211941)
+++ alpha.c     (working copy)
@@ -8717,6 +8781,11 @@
                        }
                      break;

+                   case BARRIER:
+                     /* __builtin_unreachable can expand to no code at all,
+                        leaving (barrier) RTXes in the instruction stream.  */
+                     goto close_shadow_notrapb;
+
                    case JUMP_INSN:
                    case CALL_INSN:
                    case CODE_LABEL:
@@ -8732,6 +8801,7 @@
                  n = emit_insn_before (gen_trapb (), i);
                  PUT_MODE (n, TImode);
                  PUT_MODE (i, TImode);
+               close_shadow_notrapb:
                  trap_pending = 0;
                  shadow.used.i = 0;
                  shadow.used.fp = 0;
--cut here--

Reply via email to