[Bug rtl-optimization/43360] [4.3/4.4/4.5 Regression] wrong loop invariant hoisting

2010-03-18 Thread hjl at gcc dot gnu dot org


--- Comment #15 from hjl at gcc dot gnu dot org  2010-03-18 13:11 ---
Subject: Bug 43360

Author: hjl
Date: Thu Mar 18 13:10:49 2010
New Revision: 157539

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=157539
Log:
Remove the REG_EQUAL note if we don't know its invariant status.

gcc/

2010-03-18  Steven Bosscher  ste...@gcc.gnu.org
Eric Botcazou  ebotca...@adacore.com

PR rtl-optimization/43360
* loop-invariant.c (move_invariant_reg): Remove the REG_EQUAL
note if we don't know its invariant status.

gcc/testsuite/

2010-03-18  H.J. Lu  hongjiu...@intel.com

PR rtl-optimization/43360
* gcc.dg/torture/pr43360.c: New.

Added:
trunk/gcc/testsuite/gcc.dg/torture/pr43360.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/loop-invariant.c
trunk/gcc/testsuite/ChangeLog


-- 


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



[Bug rtl-optimization/43360] [4.3/4.4/4.5 Regression] wrong loop invariant hoisting

2010-03-18 Thread hjl at gcc dot gnu dot org


--- Comment #16 from hjl at gcc dot gnu dot org  2010-03-18 13:13 ---
Subject: Bug 43360

Author: hjl
Date: Thu Mar 18 13:13:42 2010
New Revision: 157540

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=157540
Log:
Remove the REG_EQUAL note if we don't know its invariant status.

gcc/

2010-03-18  H.J. Lu  hongjiu...@intel.com

Backport from mainline:
2010-03-18  Steven Bosscher  ste...@gcc.gnu.org
Eric Botcazou  ebotca...@adacore.com

PR rtl-optimization/43360
* loop-invariant.c (move_invariant_reg): Remove the REG_EQUAL
note if we don't know its invariant status.

gcc/testsuite/

2010-03-18  H.J. Lu  hongjiu...@intel.com

Backport from mainline:
2010-03-18  H.J. Lu  hongjiu...@intel.com

PR rtl-optimization/43360
* gcc.dg/torture/pr43360.c: New.

Added:
branches/gcc-4_3-branch/gcc/testsuite/gcc.dg/torture/pr43360.c
  - copied unchanged from r157539,
trunk/gcc/testsuite/gcc.dg/torture/pr43360.c
Modified:
branches/gcc-4_3-branch/gcc/ChangeLog
branches/gcc-4_3-branch/gcc/loop-invariant.c
branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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



[Bug rtl-optimization/43360] [4.3/4.4/4.5 Regression] wrong loop invariant hoisting

2010-03-18 Thread hjl at gcc dot gnu dot org


--- Comment #17 from hjl at gcc dot gnu dot org  2010-03-18 13:15 ---
Subject: Bug 43360

Author: hjl
Date: Thu Mar 18 13:15:21 2010
New Revision: 157541

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=157541
Log:
Remove the REG_EQUAL note if we don't know its invariant status.

gcc/

2010-03-18  H.J. Lu  hongjiu...@intel.com

Backport from mainline:
2010-03-18  Steven Bosscher  ste...@gcc.gnu.org
Eric Botcazou  ebotca...@adacore.com

PR rtl-optimization/43360
* loop-invariant.c (move_invariant_reg): Remove the REG_EQUAL
note if we don't know its invariant status.

gcc/testsuite/

2010-03-18  H.J. Lu  hongjiu...@intel.com

Backport from mainline:
2010-03-18  H.J. Lu  hongjiu...@intel.com

PR rtl-optimization/43360
* gcc.dg/torture/pr43360.c: New.

Added:
branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/torture/pr43360.c
  - copied unchanged from r157540,
trunk/gcc/testsuite/gcc.dg/torture/pr43360.c
Modified:
branches/gcc-4_4-branch/gcc/ChangeLog
branches/gcc-4_4-branch/gcc/loop-invariant.c
branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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



[Bug rtl-optimization/43360] [4.3/4.4/4.5 Regression] wrong loop invariant hoisting

2010-03-18 Thread hjl dot tools at gmail dot com


--- Comment #18 from hjl dot tools at gmail dot com  2010-03-18 13:16 
---
Fixed.


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
  Known to fail|4.3.4 4.4.3 4.5.0   |4.3.4 4.4.3
  Known to work|4.2.1   |4.2.1 4.3.5 4.4.4 4.5.0
 Resolution||FIXED


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



[Bug rtl-optimization/43360] [4.3/4.4/4.5 Regression] wrong loop invariant hoisting

2010-03-18 Thread steven at gcc dot gnu dot org


--- Comment #19 from steven at gcc dot gnu dot org  2010-03-18 13:20 ---
For the record: bootstrapped+tested on amd64-linux and ia64-linux.


-- 


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



[Bug rtl-optimization/43360] [4.3/4.4/4.5 Regression] wrong loop invariant hoisting

2010-03-17 Thread bonzini at gnu dot org


--- Comment #10 from bonzini at gnu dot org  2010-03-17 06:41 ---
REG_EQUAL notes are not there to guarantee correctness.  Relying on them to
avoid misoptimization is always wrong and just hides the bug.

It is a regression from 4.2.


-- 

bonzini at gnu dot org changed:

   What|Removed |Added

  Known to work||4.2.1
Summary|[4.3/4.4/4.5 Regression]|[4.3/4.4/4.5 Regression]
   |possible wrong code bug |wrong loop invariant
   ||hoisting


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



[Bug rtl-optimization/43360] [4.3/4.4/4.5 Regression] wrong loop invariant hoisting

2010-03-17 Thread steven at gcc dot gnu dot org


--- Comment #11 from steven at gcc dot gnu dot org  2010-03-17 08:23 ---
So why not just something like the following:

 Note that uses in REG_EQUAL notes are taken into account in
 the computation of invariants.  Hence it is safe to retain the
 note even if the note contains register references.  */
-  if (! inv-always_executed
-  (note = find_reg_note (inv-insn, REG_EQUAL, NULL_RTX)))
+  note = find_reg_note (inv-insn, REG_EQUAL, NULL_RTX);
+  if (note
+   (! inv-always_executed
+  || ! check_maybe_invariant (XEXP (note, 0)))
remove_note (inv-insn, note);
 }
   else


In other words, nuke the note if it is not always executed or if the note value
is not invariant?


-- 


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



[Bug rtl-optimization/43360] [4.3/4.4/4.5 Regression] wrong loop invariant hoisting

2010-03-17 Thread jakub at gcc dot gnu dot org


--- Comment #12 from jakub at gcc dot gnu dot org  2010-03-17 08:30 ---
If it is ok to call check_maybe_invariant in this spot, then I think that's the
right fix.


-- 


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



[Bug rtl-optimization/43360] [4.3/4.4/4.5 Regression] wrong loop invariant hoisting

2010-03-17 Thread steven at gcc dot gnu dot org


--- Comment #13 from steven at gcc dot gnu dot org  2010-03-17 08:33 ---
Mine.


-- 

steven at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |steven at gcc dot gnu dot
   |dot org |org
 Status|NEW |ASSIGNED
   Last reconfirmed|2010-03-14 15:32:49 |2010-03-17 08:33:51
   date||


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



[Bug rtl-optimization/43360] [4.3/4.4/4.5 Regression] wrong loop invariant hoisting

2010-03-17 Thread ebotcazou at gcc dot gnu dot org


--- Comment #14 from ebotcazou at gcc dot gnu dot org  2010-03-17 08:59 
---
I just posted the same fix. :-)  Yes, it is OK for all branches.


-- 


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