2013/5/20 Easwaran Raman <era...@google.com>: > The UID of a newly generated statement in build_and_add_sum is set to > that of an adjacent statement in the BB. This is a problem in one case > where the BB is empty. This fix sets the UID to be 1 if the BB is > empty. Bootstraps and no test regressions on x86_64 . OK for trunk? > > Thanks, > Easwaran > > ----------- > > 2013-05-19 Easwaran Raman <era...@google.com> > > PR tree-optimization/57322 > * (build_and_add_sum): If a BB is empty, set the UID of the statement > added to the BB to be 1. > > Index: gcc/tree-ssa-reassoc.c > =================================================================== > --- gcc/tree-ssa-reassoc.c (revision 199048) > +++ gcc/tree-ssa-reassoc.c (working copy) > @@ -1165,8 +1165,12 @@ build_and_add_sum (tree type, tree op1, tree op2, > if ((!op1def || gimple_nop_p (op1def)) > && (!op2def || gimple_nop_p (op2def))) > { > + gimple first_stmt; > + unsigned uid; > gsi = gsi_after_labels (single_succ (ENTRY_BLOCK_PTR)); > - gimple_set_uid (sum, gimple_uid (gsi_stmt (gsi))); > + first_stmt = gsi_stmt (gsi); > + uid = first_stmt ? gimple_uid (first_stmt) : 1; > + gimple_set_uid (sum, uid); > gsi_insert_before (&gsi, sum, GSI_NEW_STMT); > } > else if ((!op1def || gimple_nop_p (op1def))
How about having a new testcase? The followings are the ChangeLog and new testcase for your patch fix. (By the way, I notice there are three space characters after date "2013-05-17" in your previous ChangeLog patch. I think there should be only two space characters. So I modified it as well.) Index: gcc/testsuite/ChangeLog =================================================================== --- gcc/testsuite/ChangeLog (revision 199075) +++ gcc/testsuite/ChangeLog (working copy) @@ -1,5 +1,10 @@ -2013-05-17 Easwaran Raman <era...@google.com> +2013-05-20 Easwaran Raman <era...@google.com> + PR tree-optimization/57322 + * gcc.dg/pr57322.c: New test. + +2013-05-17 Easwaran Raman <era...@google.com> + * gcc.dg/tree-ssa/reassoc-28.c: New testcase. 2013-05-17 Marc Glisse <marc.gli...@inria.fr> Index: gcc/testsuite/gcc.dg/pr57322.c =================================================================== --- gcc/testsuite/gcc.dg/pr57322.c (revision 0) +++ gcc/testsuite/gcc.dg/pr57322.c (revision 0) @@ -0,0 +1,15 @@ +/* PR tree-optimization/57322 */ +/* { dg-do compile } */ +/* { dg-options "-w -O1" } */ +int a; + +void f (void) +{ + char b; + + for (;; a++) + { + char *p = &b, *q; + *q = b < 0 & !!*p; + } +} Best regards, jasonwucj