Bug 28839 - [4.2 Regression] ICE in tree-vectorizer.c with -O2 -ftree-vectorize -funswitch-loops
Summary: [4.2 Regression] ICE in tree-vectorizer.c with -O2 -ftree-vectorize -funswitc...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.2.0
Assignee: Zdenek Dvorak
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: ice-on-valid-code, patch
Depends on:
Blocks:
 
Reported: 2006-08-24 22:55 UTC by Bernhard Reutner-Fischer
Modified: 2006-09-01 04:02 UTC (History)
6 users (show)

See Also:
Host: x86_64-linux-gnu
Target: x86_64-linux-gnu, i?86-*-*
Build: x86_64-linux-gnu
Known to work: 4.1.1 4.1.2
Known to fail: 4.2.0
Last reconfirmed: 2006-08-30 13:19:20


Attachments
preprocessed from a testcase of plain gettext-0.15 (11.30 KB, application/octet-stream)
2006-08-24 22:59 UTC, Bernhard Reutner-Fischer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bernhard Reutner-Fischer 2006-08-24 22:55:37 UTC
/root/src/buildroot/build_x86_64/staging_dir/libexec/gcc/x86_64-linux-uclibc/4.2.0/cc1 -fpreprocessed gettext_test-lock.i -quiet -dumpbase gettext_test-lock.i -mtune=generic -auxbase gettext_test-lock -O2 -version -ftree-vectorize -funswitch-loops -fvariable-expansion-in-unroller -o /tmp/ccflUJcQ.s
GNU C version 4.2.0 20060824 (experimental) (x86_64-linux-uclibc)
        compiled by GNU C version 4.1.2 20060613 (prerelease) (Debian 4.1.1-5).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 3bea3173e03ea3601524f7ad8491537d
test-lock.c: In function 'test_once':
test-lock.c:566: internal compiler error: in slpeel_update_phi_nodes_for_guard1, at tree-vectorizer.c:595
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.


Full backtrace with original args:

(gdb) b slpeel_update_phi_nodes_for_guard1
Breakpoint 1 at 0x4fa9c0: file /root/src/buildroot/toolchain_build_x86_64/gcc-4.2.0/gcc/tree-vectorizer.c, line 508.
(gdb) set args -fpreprocessed gettext_test-lock.i -quiet -dumpbase gettext_test-lock.i -mtune=nocona -march=nocona -msse -msse2 -msse3 -mfpmath=sse -auxbase gettext_test-lock -O2 -version -fPIC -ftree-loop-optimize -ftree-vectorize -ftree-vect-loop-version -funroll-loops -freorder-blocks -freorder-blocks-and-partition -fprefetch-loop-arrays -funswitch-loops -fbranch-target-load-optimize -ftree-loop-linear -ftree-loop-im -ftree-loop-ivcanon -fgcse-after-reload -fvariable-expansion-in-unroller -fivopts -o /tmp/ccInilaw.s
(gdb) run
Starting program: /root/src/buildroot/build_x86_64/staging_dir/libexec/gcc/x86_64-linux-uclibc/4.2.0/cc1 -fpreprocessed gettext_test-lock.i -quiet -dumpbase gettext_test-lock.i -mtune=nocona -march=nocona -msse -msse2 -msse3 -mfpmath=sse -auxbase gettext_test-lock -O2 -version -fPIC -ftree-loop-optimize -ftree-vectorize -ftree-vect-loop-version -funroll-loops -freorder-blocks -freorder-blocks-and-partition -fprefetch-loop-arrays -funswitch-loops -fbranch-target-load-optimize -ftree-loop-linear -ftree-loop-im -ftree-loop-ivcanon -fgcse-after-reload -fvariable-expansion-in-unroller -fivopts -o /tmp/ccInilaw.s
GNU C version 4.2.0 20060824 (experimental) (x86_64-linux-uclibc)
        compiled by GNU C version 4.1.2 20060613 (prerelease) (Debian 4.1.1-5).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 3bea3173e03ea3601524f7ad8491537d

Breakpoint 1, slpeel_update_phi_nodes_for_guard1 (guard_edge=0x2b5d60da1800, 
    loop=0xcc8b50, is_new_loop=0 '\0', new_exit_bb=0x7fffffd46a08, 
    defs=0x7fffffd46a10)
    at /root/src/buildroot/toolchain_build_x86_64/gcc-4.2.0/gcc/tree-vectorizer.c:508
508     {
(gdb) bt
#0  slpeel_update_phi_nodes_for_guard1 (guard_edge=0x2b5d60da1800, 
    loop=0xcc8b50, is_new_loop=0 '\0', new_exit_bb=0x7fffffd46a08, 
    defs=0x7fffffd46a10)
    at /root/src/buildroot/toolchain_build_x86_64/gcc-4.2.0/gcc/tree-vectorizer.c:508
#1  0x00000000004fbd8b in slpeel_tree_peel_loop_to_edge (
    loop=<value optimized out>, loops=<value optimized out>, 
    e=<value optimized out>, first_niters=0x2b5d60dac900, 
    niters=0x2b5d60b26e70, update_first_loop_count=0 '\0')
    at /root/src/buildroot/toolchain_build_x86_64/gcc-4.2.0/gcc/tree-vectorizer.c:1168
#2  0x0000000000501e17 in vect_do_peeling_for_loop_bound (loop_vinfo=0xcb6ef0, 
    ratio=0x7fffffd46bc8, loops=0xcbdae0)
    at /root/src/buildroot/toolchain_build_x86_64/gcc-4.2.0/gcc/tree-vect-transform.c:2609
#3  0x00000000005068f5 in vect_transform_loop (loop_vinfo=0xcb6ef0, 
    loops=0xcbdae0)
    at /root/src/buildroot/toolchain_build_x86_64/gcc-4.2.0/gcc/tree-vect-transform.c:3060
#4  0x00000000004f9336 in vectorize_loops (loops=0xcbdae0)
    at /root/src/buildroot/toolchain_build_x86_64/gcc-4.2.0/gcc/tree-vectorizer.c:2066
#5  0x00000000004ee310 in tree_vectorize ()
    at /root/src/buildroot/toolchain_build_x86_64/gcc-4.2.0/gcc/tree-ssa-loop.c:193
#6  0x00000000007c6c6c in execute_one_pass (pass=0xb8e600)
    at /root/src/buildroot/toolchain_build_x86_64/gcc-4.2.0/gcc/passes.c:864
#7  0x00000000007c6ddc in execute_pass_list (pass=0xb8e600)
    at /root/src/buildroot/toolchain_build_x86_64/gcc-4.2.0/gcc/passes.c:911
#8  0x00000000007c6dee in execute_pass_list (pass=0xb8e480)
    at /root/src/buildroot/toolchain_build_x86_64/gcc-4.2.0/gcc/passes.c:912
#9  0x00000000007c6dee in execute_pass_list (pass=0xb8dac0)
    at /root/src/buildroot/toolchain_build_x86_64/gcc-4.2.0/gcc/passes.c:912
#10 0x000000000048e89e in tree_rest_of_compilation (fndecl=0x2b5d60b3e9a0)
    at /root/src/buildroot/toolchain_build_x86_64/gcc-4.2.0/gcc/tree-optimize.c:417
#11 0x000000000040c665 in c_expand_body (fndecl=0x2b5d60da1800)
    at /root/src/buildroot/toolchain_build_x86_64/gcc-4.2.0/gcc/c-decl.c:6757
#12 0x000000000081d5f6 in cgraph_expand_function (node=0x2b5d60b760c0)
    at /root/src/buildroot/toolchain_build_x86_64/gcc-4.2.0/gcc/cgraphunit.c:1230
#13 0x000000000082010d in cgraph_optimize ()
    at /root/src/buildroot/toolchain_build_x86_64/gcc-4.2.0/gcc/cgraphunit.c:1295
#14 0x0000000000416a8b in c_write_global_declarations ()
    at /root/src/buildroot/toolchain_build_x86_64/gcc-4.2.0/gcc/c-decl.c:7872
#15 0x000000000079864f in toplev_main (argc=<value optimized out>, 
    argv=<value optimized out>)
    at /root/src/buildroot/toolchain_build_x86_64/gcc-4.2.0/gcc/toplev.c:1012
#16 0x00002b5d606784ca in __libc_start_main () from /lib/libc.so.6
#17 0x000000000040250a in _start () at ../sysdeps/x86_64/elf/start.S:113
(gdb) c
Continuing.
test-lock.c: In function 'test_once':
test-lock.c:566: internal compiler error: in slpeel_update_phi_nodes_for_guard1, at tree-vectorizer.c:595
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

Program exited with code 04.
Comment 1 Bernhard Reutner-Fischer 2006-08-24 22:59:07 UTC
Created attachment 12132 [details]
preprocessed from a testcase of plain gettext-0.15
Comment 2 Andrew Pinski 2006-08-25 05:16:01 UTC
Testcase:
static int ready[10];
void test_once (int t,int t1)
{
  int i, repeat;
  for (i = 0; i < 10; i++)
    {
      ready[i] = 0;
      if (t1)
        if (b())
          abort ();
    }
  if (t)
    abort ();
}
Comment 3 Andrew Pinski 2006-08-25 05:17:05 UTC
Confirmed, a regression from 4.1.2.
Comment 4 Richard Biener 2006-08-26 18:06:25 UTC
Also fails on i686 with -O2 -msse2 -mfpmath=sse -ftree-vectorize -funswitch-loops
and is a bug in unswitching which creates

<bb 2>:
  if (t1_7 != 0) goto <L17>; else goto <L18>;

<L18>:;

  # ready_20 = PHI <ready_4(3), ready_12(5)>;
  # i_1 = PHI <0(3), i_17(5)>;
  # ready_2 = PHI <ready_4(3), ready_12(5)>;
<L15>:;
  #   ready_12 = V_MAY_DEF <ready_2>;
  ready[i_1] = 0;

note ready_20 and ready_2 which are both life on entry to block L15 which
is invalid for virtual operands.  Updating of the SSA form is broken here.
Slightly smaller testcase:

tatic int ready[10];
void test_once (int t1)
{
  int i;
  for (i = 0; i < 10; i++)
    {
      ready[i] = 0;
      if (t1)
        if (f())
          return;
    }
  abort ();
}
Comment 5 Andrew Pinski 2006-08-26 20:48:44 UTC
(In reply to comment #4)
> Also fails on i686 with -O2 -msse2 -mfpmath=sse -ftree-vectorize
> -funswitch-loops
> and is a bug in unswitching which creates

Seems like we should have something in verrifying part of tree-ssa to catch this case.
Comment 6 Martin Michlmayr 2006-08-30 11:10:26 UTC
This bug happens *a lot* compiling the Debian archie with -ftree-vectorize -O3.
Additional testcases available on request.
Comment 7 Zdenek Dvorak 2006-08-31 18:16:10 UTC
Patch: http://gcc.gnu.org/ml/gcc-patches/2006-08/msg01171.html
Comment 8 Zdenek Dvorak 2006-08-31 19:34:05 UTC
Subject: Bug 28839

Author: rakdver
Date: Thu Aug 31 19:33:56 2006
New Revision: 116605

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116605
Log:
	PR tree-optimization/28839
	* tree-into-ssa.c (prune_unused_phi_nodes): Take into account kills in
	blocks in that phi arguments appear.

	* gcc.dg/pr28839.c: New test.


Added:
    trunk/gcc/testsuite/gcc.dg/pr28839.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-into-ssa.c

Comment 9 Andrew Pinski 2006-09-01 04:02:13 UTC
Fixed.