Message ID | 56A34936.1040004@mentor.com |
---|---|
State | New |
Headers | show |
On January 23, 2016 10:34:46 AM GMT+01:00, Tom de Vries <Tom_deVries@mentor.com> wrote: >Hi, > >this patches fixes a 5/6 regression PR69426. > >When compiling the test-case in the patch, the verify_ssa todo check >fails after removing a clobber in eliminate_local_variables_stmt. > >The problem is that the clobber is removed, but the uses of the >corresponding vdef are not changed, and the virtual symbol is not >marked >for renaming. > >[ The same happens in 4.9, but because omp_expand_local is called >before >verify_ssa, the ICE does not happen. In 5.0 and later, we use a >separate >expand_omp_ssa pass. ] > >This patch fixes the problem by replacing the uses of the vdef of the >clobber by the vuse of the clobber. > >The patch uses replace_uses_by, but unlink_vdef_stmt also works, I'm >not >sure which one to use. Unlink_stmt_vdef please. OK with that change. Richard. >Bootstrapped and reg-tested on x86_64. > >OK for trunk, gcc-5-branch? > >Thanks, >- Tom
Fix clobber removal in parloops 2016-01-23 Tom de Vries <tom@codesourcery.com> PR tree-optimization/69426 * tree-parloops.c (eliminate_local_variables_stmt): Handle vdef of removed clobber. * gcc.dg/autopar/pr69426.c: New test. --- gcc/testsuite/gcc.dg/autopar/pr69426.c | 19 +++++++++++++++++++ gcc/tree-parloops.c | 1 + 2 files changed, 20 insertions(+) diff --git a/gcc/testsuite/gcc.dg/autopar/pr69426.c b/gcc/testsuite/gcc.dg/autopar/pr69426.c new file mode 100644 index 0000000..e91421c --- /dev/null +++ b/gcc/testsuite/gcc.dg/autopar/pr69426.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-parallelize-loops=2" } */ + +int iq; + +void +mr(void) +{ + unsigned int i8; + + for (i8 = 0; i8 != 1; i8 += 3) { + void *f0[] = { f0 }; + int hv; + + for (; hv < 1; ++hv) + iq = 0; + } + ++iq; +} diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index 7749d34..f9db43b 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -725,6 +725,7 @@ eliminate_local_variables_stmt (edge entry, gimple_stmt_iterator *gsi, } else if (gimple_clobber_p (stmt)) { + replace_uses_by (gimple_vdef (stmt), gimple_vuse (stmt)); stmt = gimple_build_nop (); gsi_replace (gsi, stmt, false); dta.changed = true;