public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/90259] ICE: verify_flow_info failed (error: missing REG_EH_REGION note at the end of bb 4)
       [not found] <bug-90259-4@http.gcc.gnu.org/bugzilla/>
@ 2022-10-19  4:02 ` asolokha at gmx dot com
  2022-10-27  6:30 ` linkw at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: asolokha at gmx dot com @ 2022-10-19  4:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Arseny Solokha <asolokha at gmx dot com> ---
I cannot reproduce it anymore w/ gcc 13.0.0 20221016 snapshot
(g:6366e3e8847af98d4728d55951534769d034d02a).

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/90259] ICE: verify_flow_info failed (error: missing REG_EH_REGION note at the end of bb 4)
       [not found] <bug-90259-4@http.gcc.gnu.org/bugzilla/>
  2022-10-19  4:02 ` [Bug rtl-optimization/90259] ICE: verify_flow_info failed (error: missing REG_EH_REGION note at the end of bb 4) asolokha at gmx dot com
@ 2022-10-27  6:30 ` linkw at gcc dot gnu.org
  2022-10-27  7:44 ` asolokha at gmx dot com
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-10-27  6:30 UTC (permalink / raw)
  To: gcc-bugs

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

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-10-27
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1
                 CC|                            |linkw at gcc dot gnu.org

--- Comment #2 from Kewen Lin <linkw at gcc dot gnu.org> ---
I'm going to do bisection to see which commit makes this pass, but it's weird
that even with the mentioned snapshot r270485, I still can't reproduce this.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/90259] ICE: verify_flow_info failed (error: missing REG_EH_REGION note at the end of bb 4)
       [not found] <bug-90259-4@http.gcc.gnu.org/bugzilla/>
  2022-10-19  4:02 ` [Bug rtl-optimization/90259] ICE: verify_flow_info failed (error: missing REG_EH_REGION note at the end of bb 4) asolokha at gmx dot com
  2022-10-27  6:30 ` linkw at gcc dot gnu.org
@ 2022-10-27  7:44 ` asolokha at gmx dot com
  2022-10-27 14:43 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: asolokha at gmx dot com @ 2022-10-27  7:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Arseny Solokha <asolokha at gmx dot com> ---
Aha! I've just managed to reproduce it even w/ the current gcc 13 snapshot by
adding -fstack-protector-all to the list of command line arguments:

% powerpc-e300c3-linux-gnu-g++-13 -m32 -O1 -ffloat-store -fgcse
-fnon-call-exceptions -fno-forward-propagate -fno-omit-frame-pointer -c
svj3x11t.cc -fstack-protector-all
svj3x11t.cc: In static member function 'static ar p<ar(j ...), i>::as(const
int&, j ...) [with ar = void; i = q::r; j = {o}]':
svj3x11t.cc:30:65: error: missing REG_EH_REGION note at the end of bb 6
   30 |   static ar as(const int &p1, j...) { (*ao<i>::ap(p1))(j()...); }
      |                                                                 ^
during RTL pass: cprop_hardreg
svj3x11t.cc:30:65: internal compiler error: verify_flow_info failed
0xc77f7e verify_flow_info()
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20221023/work/gcc-13-20221023/gcc/cfghooks.cc:284
0x10731e3 execute_function_todo
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20221023/work/gcc-13-20221023/gcc/passes.cc:2103
0x10736fe execute_todo
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20221023/work/gcc-13-20221023/gcc/passes.cc:2145

% powerpc-e300c3-linux-gnu-g++-13 -v
Using built-in specs.
COLLECT_GCC=powerpc-e300c3-linux-gnu-g++-13
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/powerpc-e300c3-linux-gnu/13/lto-wrapper
Target: powerpc-e300c3-linux-gnu
Configured with:
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20221023/work/gcc-13-20221023/configure
--host=x86_64-pc-linux-gnu --target=powerpc-e300c3-linux-gnu
--build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/powerpc-e300c3-linux-gnu/gcc-bin/13
--includedir=/usr/lib/gcc/powerpc-e300c3-linux-gnu/13/include
--datadir=/usr/share/gcc-data/powerpc-e300c3-linux-gnu/13
--mandir=/usr/share/gcc-data/powerpc-e300c3-linux-gnu/13/man
--infodir=/usr/share/gcc-data/powerpc-e300c3-linux-gnu/13/info
--with-gxx-include-dir=/usr/lib/gcc/powerpc-e300c3-linux-gnu/13/include/g++-v13
--with-python-dir=/share/gcc-data/powerpc-e300c3-linux-gnu/13/python
--enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --disable-nls
--disable-libunwind-exceptions --enable-checking=yes
--with-gcc-major-version-only --disable-esp --enable-libstdcxx-time
--disable-libstdcxx-pch --enable-poison-system-directories
--with-sysroot=/usr/powerpc-e300c3-linux-gnu --disable-bootstrap
--enable-__cxa_atexit --enable-clocale=gnu --disable-multilib
--disable-fixed-point --enable-targets=all --enable-libgomp --disable-libssp
--disable-libada --disable-cet --disable-systemtap
--enable-valgrind-annotations --disable-vtable-verify --disable-libvtv
--without-zstd --enable-lto --with-isl --disable-isl-version-check
--disable-libsanitizer --enable-default-ssp
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20221023 (experimental) (GCC)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/90259] ICE: verify_flow_info failed (error: missing REG_EH_REGION note at the end of bb 4)
       [not found] <bug-90259-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2022-10-27  7:44 ` asolokha at gmx dot com
@ 2022-10-27 14:43 ` pinskia at gcc dot gnu.org
  2022-11-01  7:19 ` linkw at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-27 14:43 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/90259] ICE: verify_flow_info failed (error: missing REG_EH_REGION note at the end of bb 4)
       [not found] <bug-90259-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2022-10-27 14:43 ` pinskia at gcc dot gnu.org
@ 2022-11-01  7:19 ` linkw at gcc dot gnu.org
  2022-11-01  7:56 ` asolokha at gmx dot com
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-11-01  7:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Kewen Lin <linkw at gcc dot gnu.org> ---
(In reply to Arseny Solokha from comment #3)
> Aha! I've just managed to reproduce it even w/ the current gcc 13 snapshot
> by adding -fstack-protector-all to the list of command line arguments:
> 
> % powerpc-e300c3-linux-gnu-g++-13 -m32 -O1 -ffloat-store -fgcse
> -fnon-call-exceptions -fno-forward-propagate -fno-omit-frame-pointer -c
> svj3x11t.cc -fstack-protector-all
> svj3x11t.cc: In static member function 'static ar p<ar(j ...), i>::as(const
> int&, j ...) [with ar = void; i = q::r; j = {o}]':
> svj3x11t.cc:30:65: error: missing REG_EH_REGION note at the end of bb 6
>    30 |   static ar as(const int &p1, j...) { (*ao<i>::ap(p1))(j()...); }
>       |                                                                 ^

It's weird that I still can't reproduce this with the extra option
-fstack-protector-all, I double checked your provided configuration command,
although the host and build are different, the others are the same as mine.
Could you provide one dump file for -mdebug=target?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/90259] ICE: verify_flow_info failed (error: missing REG_EH_REGION note at the end of bb 4)
       [not found] <bug-90259-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2022-11-01  7:19 ` linkw at gcc dot gnu.org
@ 2022-11-01  7:56 ` asolokha at gmx dot com
  2022-11-01  8:16 ` linkw at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: asolokha at gmx dot com @ 2022-11-01  7:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Arseny Solokha <asolokha at gmx dot com> ---
Created attachment 53808
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53808&action=edit
-mdebug=target dump

(In reply to Kewen Lin from comment #4)
> Could you provide one dump file for -mdebug=target?

I've attached the full dump.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/90259] ICE: verify_flow_info failed (error: missing REG_EH_REGION note at the end of bb 4)
       [not found] <bug-90259-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2022-11-01  7:56 ` asolokha at gmx dot com
@ 2022-11-01  8:16 ` linkw at gcc dot gnu.org
  2022-11-02  9:24 ` linkw at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-11-01  8:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Kewen Lin <linkw at gcc dot gnu.org> ---
(In reply to Arseny Solokha from comment #5)
> Created attachment 53808 [details]
> -mdebug=target dump
> 
> (In reply to Kewen Lin from comment #4)
> > Could you provide one dump file for -mdebug=target?
> 
> I've attached the full dump.

Thanks! Confirmed, it needs one more option -mlong-double-128 on my side for
reproducing this.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/90259] ICE: verify_flow_info failed (error: missing REG_EH_REGION note at the end of bb 4)
       [not found] <bug-90259-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2022-11-01  8:16 ` linkw at gcc dot gnu.org
@ 2022-11-02  9:24 ` linkw at gcc dot gnu.org
  2022-11-16  2:26 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-11-02  9:24 UTC (permalink / raw)
  To: gcc-bugs

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

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |linkw at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #7 from Kewen Lin <linkw at gcc dot gnu.org> ---
The function copyprop_hardreg_forward_1 of pass cprop_hardreg has the code:

      /* Detect obviously dead sets (via REG_UNUSED notes) and remove them.  */
      if (set
          && !RTX_FRAME_RELATED_P (insn)
          && NONJUMP_INSN_P (insn)
          && !may_trap_p (set)
          && find_reg_note (insn, REG_UNUSED, SET_DEST (set))
          && !side_effects_p (SET_SRC (set))
          && !side_effects_p (SET_DEST (set)))
        {
          bool last = insn == BB_END (bb);
          delete_insn (insn);
          if (last)
            break;
          continue;
        }

it removes the insn 109

(insn 109 117 79 6 (set (reg:DF 33 1 [orig:134+8 ] [134])
        (mem:DF (plus:SI (reg/f:SI 31 31)
                (const_int 40 [0x28])) [11  S8 A64])) "pr90259_test.cc":5:53
584 {*movdf_hardfloat32}
     (expr_list:REG_UNUSED (reg:DF 33 1 [orig:134+8 ] [134])
        (expr_list:REG_EH_REGION (const_int 2 [0x2])
            (nil))))

as DF 33 is unused and it meets the above conditions. The case can pass if we
purge dead edges after this removal, such as the below diff. But I need more
investigation to see if we can purge these kinds of dead edges when they are
created (it should make more senses).

=======

diff --git a/gcc/regcprop.cc b/gcc/regcprop.cc
index ce9d32a4fb7..afcfc0bf252 100644
--- a/gcc/regcprop.cc
+++ b/gcc/regcprop.cc
@@ -36,6 +36,7 @@
 #include "cfgrtl.h"
 #include "target.h"
 #include "function-abi.h"
+#include "cfgcleanup.h"

 /* The following code does forward propagation of hard register copies.
    The object is to eliminate as many dependencies as possible, so that
@@ -74,6 +75,7 @@ struct value_data
   struct value_data_entry e[FIRST_PSEUDO_REGISTER];
   unsigned int max_value_regs;
   unsigned int n_debug_insn_changes;
+  bool need_purge_dead_edge;
 };

 static object_allocator<queued_debug_insn_change>
queued_debug_insn_change_pool
@@ -818,7 +820,11 @@ copyprop_hardreg_forward_1 (basic_block bb, struct
value_data *vd)
          bool last = insn == BB_END (bb);
          delete_insn (insn);
          if (last)
-           break;
+           {
+             if (find_reg_note (insn, REG_EH_REGION, NULL_RTX))
+               vd->need_purge_dead_edge = true;
+             break;
+           }
          continue;
        }

@@ -1405,6 +1411,7 @@ pass_cprop_hardreg::execute (function *fun)

   FOR_EACH_BB_FN (bb, fun)
     {
+      all_vd[bb->index].need_purge_dead_edge = false;
       if (cprop_hardreg_bb (bb, all_vd, visited))
        curr->safe_push (bb->index);
       if (all_vd[bb->index].n_debug_insn_changes)
@@ -1444,6 +1451,10 @@ pass_cprop_hardreg::execute (function *fun)
       std::swap (curr, next);
     }

+  FOR_EACH_BB_FN (bb, fun)
+    if (all_vd[bb->index].need_purge_dead_edge)
+      purge_dead_edges (bb);
+
   free (all_vd);
   return 0;
 }

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/90259] ICE: verify_flow_info failed (error: missing REG_EH_REGION note at the end of bb 4)
       [not found] <bug-90259-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2022-11-02  9:24 ` linkw at gcc dot gnu.org
@ 2022-11-16  2:26 ` cvs-commit at gcc dot gnu.org
  2022-11-17  2:28 ` linkw at gcc dot gnu.org
  2023-05-14 22:44 ` pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-16  2:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Kewen Lin <linkw@gcc.gnu.org>:

https://gcc.gnu.org/g:63e1b2e767a3f4695373c2406ff719c0a60c1858

commit r13-4079-g63e1b2e767a3f4695373c2406ff719c0a60c1858
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Tue Nov 15 20:26:07 2022 -0600

    rtl: Try to remove EH edges after {pro,epi}logue generation [PR90259]

    After prologue and epilogue generation, the judgement on whether
    one memory access onto stack frame may trap or not could change,
    since we get more exact stack information by now.

    As PR90259 shows, some memory access becomes impossible to trap
    any more after prologue and epilogue generation, it can make
    subsequent optimization be able to remove it if safe, but it
    results in unexpected control flow status due to REG_EH_REGION
    note missing.

    This patch proposes to try to remove EH edges with function
    purge_all_dead_edges after prologue and epilogue generation,
    it simplifies CFG as early as we can and don't need any fixup
    in downstream passes.

    CFG simplification result with PR90259's case as example:

    *before*

       18: %1:TF=call [`__gcc_qdiv'] argc:0
          REG_EH_REGION 0x2
       77: NOTE_INSN_BASIC_BLOCK 3
       19: NOTE_INSN_DELETED
       20: NOTE_INSN_DELETED
      110: [%31:SI+0x20]=%1:DF
          REG_EH_REGION 0x2
      116: NOTE_INSN_BASIC_BLOCK 4
      111: [%31:SI+0x28]=%2:DF
          REG_EH_REGION 0x2
       22: NOTE_INSN_BASIC_BLOCK 5
      108: %0:DF=[%31:SI+0x20]
          REG_EH_REGION 0x2
      117: NOTE_INSN_BASIC_BLOCK 6
      109: %1:DF=[%31:SI+0x28]
          REG_EH_REGION 0x2
       79: NOTE_INSN_BASIC_BLOCK 7
       26: [%31:SI+0x18]=%0:DF
      104: pc=L69
      105: barrier

    *after*

       18: %1:TF=call [`__gcc_qdiv'] argc:0
          REG_EH_REGION 0x2
       77: NOTE_INSN_BASIC_BLOCK 3
       19: NOTE_INSN_DELETED
       20: NOTE_INSN_DELETED
      110: [%31:SI+0x20]=%1:DF
      111: [%31:SI+0x28]=%2:DF
      108: %0:DF=[%31:SI+0x20]
      109: %1:DF=[%31:SI+0x28]
       26: [%31:SI+0x18]=%0:DF
      104: pc=L69
      105: barrier

            PR rtl-optimization/90259

    gcc/ChangeLog:

            * function.cc (rest_of_handle_thread_prologue_and_epilogue): Add
            parameter fun, and call function purge_all_dead_edges.
            (pass_thread_prologue_and_epilogue::execute): Name unamed parameter
            as fun, and use it for rest_of_handle_thread_prologue_and_epilogue.

    gcc/testsuite/ChangeLog:

            * g++.target/powerpc/pr90259.C: New.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/90259] ICE: verify_flow_info failed (error: missing REG_EH_REGION note at the end of bb 4)
       [not found] <bug-90259-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2022-11-16  2:26 ` cvs-commit at gcc dot gnu.org
@ 2022-11-17  2:28 ` linkw at gcc dot gnu.org
  2023-05-14 22:44 ` pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 11+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-11-17  2:28 UTC (permalink / raw)
  To: gcc-bugs

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

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|powerpc-e300c3-linux-gnu    |powerpc*-linux-gnu
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |13.0

--- Comment #9 from Kewen Lin <linkw at gcc dot gnu.org> ---
Should be fixed on trunk, we don't want to backport this as Richi's comment in
https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606441.html.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/90259] ICE: verify_flow_info failed (error: missing REG_EH_REGION note at the end of bb 4)
       [not found] <bug-90259-4@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2022-11-17  2:28 ` linkw at gcc dot gnu.org
@ 2023-05-14 22:44 ` pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-14 22:44 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zsojka at seznam dot cz

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 105686 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-05-14 22:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-90259-4@http.gcc.gnu.org/bugzilla/>
2022-10-19  4:02 ` [Bug rtl-optimization/90259] ICE: verify_flow_info failed (error: missing REG_EH_REGION note at the end of bb 4) asolokha at gmx dot com
2022-10-27  6:30 ` linkw at gcc dot gnu.org
2022-10-27  7:44 ` asolokha at gmx dot com
2022-10-27 14:43 ` pinskia at gcc dot gnu.org
2022-11-01  7:19 ` linkw at gcc dot gnu.org
2022-11-01  7:56 ` asolokha at gmx dot com
2022-11-01  8:16 ` linkw at gcc dot gnu.org
2022-11-02  9:24 ` linkw at gcc dot gnu.org
2022-11-16  2:26 ` cvs-commit at gcc dot gnu.org
2022-11-17  2:28 ` linkw at gcc dot gnu.org
2023-05-14 22:44 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).