From 1e5787ef86dd68d1e332eee116d1bc92c17aae44 Mon Sep 17 00:00:00 2001 From: Zdenek Dvorak Date: Thu, 31 Aug 2006 21:33:56 +0200 Subject: [PATCH] re PR tree-optimization/28839 (ICE in tree-vectorizer.c with -O2 -ftree-vectorize -funswitch-loops) 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. From-SVN: r116605 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr28839.c | 18 ++++++++++++++++++ gcc/tree-into-ssa.c | 7 +++++++ 4 files changed, 36 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr28839.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7a6c3e167b9b..949adec73676 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2006-08-31 Zdenek Dvorak + + PR tree-optimization/28839 + * tree-into-ssa.c (prune_unused_phi_nodes): Take into account kills in + blocks in that phi arguments appear. + 2006-08-31 Roger Sayle PR other/22313 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2e6cec9e1b4c..1a3ecb598edc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-08-31 Zdenek Dvorak + + PR tree-optimization/28839 + * gcc.dg/pr28839.c: New test. + 2006-08-31 Andreas Krebbel PR target/24367 diff --git a/gcc/testsuite/gcc.dg/pr28839.c b/gcc/testsuite/gcc.dg/pr28839.c new file mode 100644 index 000000000000..56a42a37b6e3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr28839.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -msse2 -ftree-vectorize -funswitch-loops" } */ + +static int ready[10]; +void abort (void); +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 (); +} diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index 38f338a058b2..14a50b62c62b 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -977,6 +977,13 @@ prune_unused_phi_nodes (bitmap phis, bitmap kills, bitmap uses) if (bitmap_bit_p (uses, u)) continue; + /* In case there is a kill directly in the use block, do not record + the use (this is also necessary for correctness, as we assume that + uses dominated by a def directly in their block have been filtered + out before). */ + if (bitmap_bit_p (kills, u)) + continue; + bitmap_set_bit (uses, u); VEC_safe_push (int, heap, worklist, u); }