[Bug tree-optimization/35607] [4.4 Regression] IVOPTs produces invalid gimple

2008-03-16 Thread rguenth at gcc dot gnu dot org


--- Comment #1 from rguenth at gcc dot gnu dot org  2008-03-16 11:45 ---
force_gimple_operand doesn't gimplify

  __fini_array_start[(unsigned int) D.1189_5]

because is_gimple_min_invariant returns true for it.

And the verification failure is just an artifact of that.  I have a patch.


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
   |dot org |org
 Status|UNCONFIRMED |ASSIGNED
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2008-03-16 11:45:46
   date||


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



[Bug tree-optimization/35607] [4.4 Regression] IVOPTs produces invalid gimple

2008-03-16 Thread rguenth at gcc dot gnu dot org


--- Comment #2 from rguenth at gcc dot gnu dot org  2008-03-16 11:47 ---
Hm, no.  This address isn't invariant at all.


-- 


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



[Bug tree-optimization/35607] [4.4 Regression] IVOPTs produces invalid gimple

2008-03-16 Thread rguenth at gcc dot gnu dot org


--- Comment #3 from rguenth at gcc dot gnu dot org  2008-03-16 12:20 ---
This invariantness of (unsigned int) D.1189_5 in

  __fini_array_end.0_2 = (int) __fini_array_end;
  __fini_array_start.1_3 = (int) __fini_array_start;
  D.1188_4 = __fini_array_end.0_2 - __fini_array_start.1_3;
  D.1189_5 = D.1188_4 /[ex] 4;
  i_6 = (unsigned int) D.1189_5;

which is then substituted into the array reference __fini_array_start[i_25]
and turned into an address induction variable is there since gimplification.

Because gimplification preserves the invariantness of what originally was

unsigned int i = (unsigned int) (((int) __fini_array_end - (int)
__fini_array_start) /[ex] 4);

that is, gimplification does _not_ re-set TREE_INVARIANT on anything that
had it set before.  Which is, err, bogus - sort of.


-- 


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



[Bug tree-optimization/35607] [4.4 Regression] IVOPTs produces invalid gimple

2008-03-16 Thread rguenth at gcc dot gnu dot org


--- Comment #4 from rguenth at gcc dot gnu dot org  2008-03-16 12:23 ---
The concrete problem with allowing foo[(int)z_4] in a PHI node argument is
that we cannot cope with immediate uses in PHI nodes and thus DCE z_4 and
end up with a reference to a deleted SSA_NAME during expansion (yeah, we
don't go out-of-SSA for it either).  So this is a non-option.


-- 


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



[Bug tree-optimization/35607] [4.4 Regression] IVOPTs produces invalid gimple

2008-03-16 Thread rguenth at gcc dot gnu dot org


--- Comment #5 from rguenth at gcc dot gnu dot org  2008-03-16 12:32 ---
One solution is to, in expand_simple_operations, expand all TREE_INVARIANT
operations so we end up with

  # ivtmp.16_1 = PHI ivtmp.16_11(5), __fini_array_start[(unsigned int)
(((int) __fini_array_end - (int) __fini_array_start) /[ex] 4)](3)

instead which we can let pass verification without fatal effects.

The other solution is to kill TREE_INVARIANT from everything but constants
and invariant addresses during gimplification.

Anyone with other options?


-- 


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



[Bug tree-optimization/35607] [4.4 Regression] IVOPTs produces invalid gimple

2008-03-16 Thread rguenth at gcc dot gnu dot org


--- Comment #6 from rguenth at gcc dot gnu dot org  2008-03-16 15:45 ---
Subject: Bug 35607

Author: rguenth
Date: Sun Mar 16 15:45:09 2008
New Revision: 133273

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=133273
Log:
2008-03-16  Richard Guenther  [EMAIL PROTECTED]

PR middle-end/35607
* tree-ssa-loop-niter.c (expand_simple_operations): Do not
expand TREE_INVARIANT operations that are not gimple invariant.

* gcc.c-torture/compile/pr35607.c: New testcase.
* gcc.dg/tree-ssa/loop-19.c: Use -O2 to avoid vectorization.

Added:
trunk/gcc/testsuite/gcc.c-torture/compile/pr35607.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/tree-ssa/loop-19.c
trunk/gcc/tree-ssa-loop-niter.c


-- 


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



[Bug tree-optimization/35607] [4.4 Regression] IVOPTs produces invalid gimple

2008-03-16 Thread rguenth at gcc dot gnu dot org


--- Comment #7 from rguenth at gcc dot gnu dot org  2008-03-16 15:55 ---
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED
   Target Milestone|--- |4.4.0


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