public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/52255] New: ICE: verify_ssa failed, block does not dominate use
@ 2012-02-15  3:58 regehr at cs dot utah.edu
  2012-02-15  4:08 ` [Bug tree-optimization/52255] [4.7 Regression] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: regehr at cs dot utah.edu @ 2012-02-15  3:58 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52255

             Bug #: 52255
           Summary: ICE: verify_ssa failed, block does not dominate use
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: regehr@cs.utah.edu
                CC: chenyang@cs.utah.edu


[regehr@gamow 1]$ current-gcc -Ofast small.c

small.c: In function 'f':
small.c:3:6: error: definition in block 8 does not dominate use in block 9
for SSA_NAME: .MEM_22 in statement:
# .MEM_29 = VDEF <.MEM_22>
c[0] = c_I_lsm.9_32;
small.c:3:6: internal compiler error: verify_ssa failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

[regehr@gamow 1]$ cat small.c

int a, b, c[10], d[10] = { 0, 0 };

void f (void) {
  for (a = 1; a <= 4; a += 1)
    d[a] = d[1];
  for (; b; ++b)
    c[0] |= 1;
}

[regehr@gamow 1]$ current-gcc -v

Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/uusoc/exports/scratch/regehr/z/compiler-install/gcc-r184237-install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --with-libelf=/usr/local --enable-lto
--prefix=/home/regehr/z/compiler-install/gcc-r184237-install
--program-prefix=r184237- --enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 20120214 (experimental) (GCC)


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

* [Bug tree-optimization/52255] [4.7 Regression] ICE: verify_ssa failed, block does not dominate use
  2012-02-15  3:58 [Bug c/52255] New: ICE: verify_ssa failed, block does not dominate use regehr at cs dot utah.edu
@ 2012-02-15  4:08 ` pinskia at gcc dot gnu.org
  2012-02-15  6:50 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-02-15  4:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52255

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |4.6.0
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|                            |2012-02-15
          Component|c                           |tree-optimization
     Ever Confirmed|0                           |1
            Summary|ICE: verify_ssa failed,     |[4.7 Regression] ICE:
                   |block does not dominate use |verify_ssa failed, block
                   |                            |does not dominate use
   Target Milestone|---                         |4.7.0
      Known to fail|                            |4.7.0

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-02-15 04:07:56 UTC ---
vect is where the ICE is.


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

* [Bug tree-optimization/52255] [4.7 Regression] ICE: verify_ssa failed, block does not dominate use
  2012-02-15  3:58 [Bug c/52255] New: ICE: verify_ssa failed, block does not dominate use regehr at cs dot utah.edu
  2012-02-15  4:08 ` [Bug tree-optimization/52255] [4.7 Regression] " pinskia at gcc dot gnu.org
@ 2012-02-15  6:50 ` jakub at gcc dot gnu.org
  2012-02-15 11:47 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-02-15  6:50 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52255

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |jakub at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |jakub at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-02-15 06:49:37 UTC ---
Caused by http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=178728
I will have a look.


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

* [Bug tree-optimization/52255] [4.7 Regression] ICE: verify_ssa failed, block does not dominate use
  2012-02-15  3:58 [Bug c/52255] New: ICE: verify_ssa failed, block does not dominate use regehr at cs dot utah.edu
  2012-02-15  4:08 ` [Bug tree-optimization/52255] [4.7 Regression] " pinskia at gcc dot gnu.org
  2012-02-15  6:50 ` jakub at gcc dot gnu.org
@ 2012-02-15 11:47 ` jakub at gcc dot gnu.org
  2012-02-15 12:10 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-02-15 11:47 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52255

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-02-15 11:47:15 UTC ---
The problem is that lsm doesn't cleanup unnecessary VOP PHI after changing:
<bb 5>:
  # b.2_21 = PHI <b.3_10(10), b.2_19(8)>
  # .MEM_22 = PHI <.MEM_18(10), .MEM_16(8)>
  # prephitmp.8_6 = PHI <D.1721_8(10), pretmp.7_1(8)>
  D.1720_7 = prephitmp.8_6;
  D.1721_8 = D.1720_7 | 1;
  # .MEM_17 = VDEF <.MEM_22>
  c[0] = D.1721_8;
  b.3_10 = b.2_21 + 1;
  # .MEM_18 = VDEF <.MEM_17>
  b = b.3_10;
  if (b.3_10 != 0)
    goto <bb 10>;
  else
    goto <bb 9>;

<bb 10>:
  goto <bb 5>;


into:
  # VUSE <.MEM_17>
  pretmp.7_1 = c[0];
  # VUSE <.MEM_17>
  c_I_lsm.9_12 = c[0];
  # VUSE <.MEM_17>
  b_lsm.10_11 = b;

<bb 5>:
  # b.2_21 = PHI <b.3_10(10), b.2_19(8)>
  # .MEM_22 = PHI <.MEM_22(10), .MEM_17(8)>
  # prephitmp.8_6 = PHI <D.1721_8(10), pretmp.7_1(8)>
  D.1720_7 = prephitmp.8_6;
  D.1721_8 = D.1720_7 | 1;
  c_I_lsm.9_24 = D.1721_8;
  b.3_10 = b.2_21 + 1;
  b_lsm.10_28 = b.3_10;
  if (b.3_10 != 0)
    goto <bb 10>;
  else
    goto <bb 12>;

<bb 12>:
  # c_I_lsm.9_32 = PHI <c_I_lsm.9_24(5)>
  # b_lsm.10_33 = PHI <b_lsm.10_28(5)>
  # .MEM_29 = VDEF <.MEM_22>
  c[0] = c_I_lsm.9_32;
  # .MEM_30 = VDEF <.MEM_29>
  b = b_lsm.10_33;
  goto <bb 9>;

<bb 10>:
  goto <bb 5>;

and there is no dom/phicprop pass in between lim1 and vect that would clean
this mess up (with -O3 -fno-tree-vectorize first dom2 changes that
  # .MEM_22 = PHI <.MEM_22(10), .MEM_17(8)>
into
  # .MEM_22 = PHI <.MEM_17(10), .MEM_17(8)>
and then phicprop removes it, but e.g. with -O3 -fno-tree-vectorize
-fno-tree-dominator-opts it survives until *.optimized dump).  The vectorizer
then ignores virtual PHIs, assuming everything will be handled well by the data
ref analysis and adjustments to the stores in the loop.  Which works if the
loop has any stores, because then the stores will have their vdefs renamed, but
if the loop doesn't have any stores, we end up with the verification ICE here.

I think the vectorizer can't rely on these unnecessary virtual PHIs not being
present, so either it could give up on them, or at least for the simple cases
(like this when the virtual PHI on loop->header bb uses itself and some .MEM
from before the loop) could be handled by just propagating the .MEM from before
the loop into all the uses of this vdef.


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

* [Bug tree-optimization/52255] [4.7 Regression] ICE: verify_ssa failed, block does not dominate use
  2012-02-15  3:58 [Bug c/52255] New: ICE: verify_ssa failed, block does not dominate use regehr at cs dot utah.edu
                   ` (2 preceding siblings ...)
  2012-02-15 11:47 ` jakub at gcc dot gnu.org
@ 2012-02-15 12:10 ` rguenth at gcc dot gnu.org
  2012-02-15 18:24 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-02-15 12:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52255

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-15 12:08:38 UTC ---
It can also, when encountering a virtual PHI, simply rename all VOPs.  LIM
could also fixup those PHIs after performing store-motion.


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

* [Bug tree-optimization/52255] [4.7 Regression] ICE: verify_ssa failed, block does not dominate use
  2012-02-15  3:58 [Bug c/52255] New: ICE: verify_ssa failed, block does not dominate use regehr at cs dot utah.edu
                   ` (3 preceding siblings ...)
  2012-02-15 12:10 ` rguenth at gcc dot gnu.org
@ 2012-02-15 18:24 ` jakub at gcc dot gnu.org
  2012-02-15 19:36 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-02-15 18:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52255

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-checking

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-02-15 18:10:47 UTC ---
We actually do that, but only at the end of the vectorize_loops after all
vectorization:
mark_sym_for_renaming (gimple_vop (cfun));
+ TODO_update_ssa.
The problem is that this diagnostic is triggered sooner than that, when
gimple_duplicate_loop_to_header_edge calls
#ifdef ENABLE_CHECKING
  if (loops_state_satisfies_p (LOOP_CLOSED_SSA))
    verify_loop_closed_ssa (true);
#endif
during vect_loop_versioning, and the function that messes up the VOPs which
triggers the checking failure is slpeel_tree_peel_loop_to_edge.
If I change the above to (false), then it passes and generates correct IL.


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

* [Bug tree-optimization/52255] [4.7 Regression] ICE: verify_ssa failed, block does not dominate use
  2012-02-15  3:58 [Bug c/52255] New: ICE: verify_ssa failed, block does not dominate use regehr at cs dot utah.edu
                   ` (4 preceding siblings ...)
  2012-02-15 18:24 ` jakub at gcc dot gnu.org
@ 2012-02-15 19:36 ` jakub at gcc dot gnu.org
  2012-02-16 10:40 ` jakub at gcc dot gnu.org
  2012-02-16 10:57 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-02-15 19:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52255

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-02-15 19:20:55 UTC ---
Created attachment 26667
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26667
gcc47-pr52255.patch

Untested fix.


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

* [Bug tree-optimization/52255] [4.7 Regression] ICE: verify_ssa failed, block does not dominate use
  2012-02-15  3:58 [Bug c/52255] New: ICE: verify_ssa failed, block does not dominate use regehr at cs dot utah.edu
                   ` (5 preceding siblings ...)
  2012-02-15 19:36 ` jakub at gcc dot gnu.org
@ 2012-02-16 10:40 ` jakub at gcc dot gnu.org
  2012-02-16 10:57 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-02-16 10:40 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52255

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-02-16 10:20:33 UTC ---
Author: jakub
Date: Thu Feb 16 10:20:26 2012
New Revision: 184306

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184306
Log:
    PR tree-optimization/52255
    * tree-vect-loop-manip.c (slpeel_tree_peel_loop_to_edge): If
    loop->header has virtual PHI, but exit_e->dest doesn't, add
    virtual PHI to exit_e->dest and adjust all uses after the loop.

    * gcc.c-torture/compile/pr52255.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr52255.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-loop-manip.c


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

* [Bug tree-optimization/52255] [4.7 Regression] ICE: verify_ssa failed, block does not dominate use
  2012-02-15  3:58 [Bug c/52255] New: ICE: verify_ssa failed, block does not dominate use regehr at cs dot utah.edu
                   ` (6 preceding siblings ...)
  2012-02-16 10:40 ` jakub at gcc dot gnu.org
@ 2012-02-16 10:57 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-02-16 10:57 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52255

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-02-16 10:51:06 UTC ---
Fixed.


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

end of thread, other threads:[~2012-02-16 10:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-15  3:58 [Bug c/52255] New: ICE: verify_ssa failed, block does not dominate use regehr at cs dot utah.edu
2012-02-15  4:08 ` [Bug tree-optimization/52255] [4.7 Regression] " pinskia at gcc dot gnu.org
2012-02-15  6:50 ` jakub at gcc dot gnu.org
2012-02-15 11:47 ` jakub at gcc dot gnu.org
2012-02-15 12:10 ` rguenth at gcc dot gnu.org
2012-02-15 18:24 ` jakub at gcc dot gnu.org
2012-02-15 19:36 ` jakub at gcc dot gnu.org
2012-02-16 10:40 ` jakub at gcc dot gnu.org
2012-02-16 10:57 ` jakub 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).