public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/21767] New: if-convert leaves invalid REG_EQUAL notes
@ 2005-05-26 14:40 amylaar at gcc dot gnu dot org
  2005-05-26 14:46 ` [Bug rtl-optimization/21767] " amylaar at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2005-05-26 14:40 UTC (permalink / raw)
  To: gcc-bugs

if-convert sometimes moves instructions from after to before a conditional
jump.  Some REG_EQUAL are no longer true after this transformation, yet
they are not removed.

-- 
           Summary: if-convert leaves invalid REG_EQUAL notes
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: amylaar at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
OtherBugsDependingO 20070
             nThis:


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/21767] if-convert leaves invalid REG_EQUAL notes
  2005-05-26 14:40 [Bug rtl-optimization/21767] New: if-convert leaves invalid REG_EQUAL notes amylaar at gcc dot gnu dot org
@ 2005-05-26 14:46 ` amylaar at gcc dot gnu dot org
  2005-06-01 11:39 ` cvs-commit at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2005-05-26 14:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From amylaar at gcc dot gnu dot org  2005-05-26 14:44 -------
Created an attachment (id=8971)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8971&action=view)
Testcase for sh-elf -O2

When you compile this testcase with -O2 -da for sh-elf, you'll see in the
ce2 dump:

(insn 12 7 13 0 (set (reg:SI 161)
	(const_int 1234567 [0x12d687])) 171 {movsi_i} (nil)
    (nil))

(insn 13 12 17 0 (set (reg:SI 147 t)
	(eq:SI (reg/v:SI 160 [ i ])
	    (reg:SI 161))) 1 {cmpeqsi_t} (insn_list:REG_DEP_TRUE 6
(insn_list:RE
G_DEP_TRUE 12 (nil)))
    (expr_list:REG_DEAD (reg:SI 161)
	(expr_list:REG_EQUAL (eq:SI (reg/v:SI 160 [ i ])
		(const_int 1234567 [0x12d687]))
	    (nil))))

(insn 17 13 14 0 (set (reg:SI 158 [ D.1149 ])
	(reg/v:SI 160 [ i ])) 171 {movsi_i} (nil)
    (expr_list:REG_EQUAL (const_int 1234567 [0x12d687])
	(nil)))

(jump_insn 14 17 20 0 (set (pc)
	(if_then_else (ne (reg:SI 147 t)
		(const_int 0 [0x0]))
	    (label_ref:SI 34)
	    (pc))) 207 {branch_true} (insn_list:REG_DEP_TRUE 13 (nil))
    (expr_list:REG_DEAD (reg:SI 147 t)
	(expr_list:REG_BR_PROB (const_int 1675 [0x68b])
	    (nil))))

The REG_EUQAL note on insn 17 has become invalid when this insn was moved
in front of insn 14.  The equality only holds when this branch is taken.

With the patch for PR20070, this invalid transformation is already done in
ce1, which is followed by cse2.  cse2 will use the REG_EQUAL notes to conclude
that insn 14 is always taken.

-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/21767] if-convert leaves invalid REG_EQUAL notes
  2005-05-26 14:40 [Bug rtl-optimization/21767] New: if-convert leaves invalid REG_EQUAL notes amylaar at gcc dot gnu dot org
  2005-05-26 14:46 ` [Bug rtl-optimization/21767] " amylaar at gcc dot gnu dot org
@ 2005-06-01 11:39 ` cvs-commit at gcc dot gnu dot org
  2005-06-01 11:45 ` amylaar at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-06-01 11:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-06-01 11:39 -------
Subject: Bug 21767

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	amylaar@gcc.gnu.org	2005-06-01 11:38:54

Modified files:
	gcc            : ChangeLog rtl.h reload1.c ifcvt.c 

Log message:
	PR rtl-optimization/21767
	* rtl.h (function_invariant_p): Re-add declaration.
	* reload1.c (function_invariant_p): No longer static.
	* ifcvt.c (dead_or_predicable): Remove REG_EQUAL notes that
	might have become invalid.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8980&r2=2.8981
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/rtl.h.diff?cvsroot=gcc&r1=1.550&r2=1.551
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/reload1.c.diff?cvsroot=gcc&r1=1.471&r2=1.472
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ifcvt.c.diff?cvsroot=gcc&r1=1.189&r2=1.190



-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/21767] if-convert leaves invalid REG_EQUAL notes
  2005-05-26 14:40 [Bug rtl-optimization/21767] New: if-convert leaves invalid REG_EQUAL notes amylaar at gcc dot gnu dot org
  2005-05-26 14:46 ` [Bug rtl-optimization/21767] " amylaar at gcc dot gnu dot org
  2005-06-01 11:39 ` cvs-commit at gcc dot gnu dot org
@ 2005-06-01 11:45 ` amylaar at gcc dot gnu dot org
  2005-06-01 12:00 ` amylaar at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2005-06-01 11:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From amylaar at gcc dot gnu dot org  2005-06-01 11:45 -------
Fixed on mainline with patch just checked in.
Now we have to decide if we want this fix (without the reload1.c / rtl.h
hunks) in 3.4.

-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/21767] if-convert leaves invalid REG_EQUAL notes
  2005-05-26 14:40 [Bug rtl-optimization/21767] New: if-convert leaves invalid REG_EQUAL notes amylaar at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-06-01 11:45 ` amylaar at gcc dot gnu dot org
@ 2005-06-01 12:00 ` amylaar at gcc dot gnu dot org
  2005-06-01 18:10 ` giovannibajo at libero dot it
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2005-06-01 12:00 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|20070                       |
              nThis|                            |


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/21767] if-convert leaves invalid REG_EQUAL notes
  2005-05-26 14:40 [Bug rtl-optimization/21767] New: if-convert leaves invalid REG_EQUAL notes amylaar at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-06-01 12:00 ` amylaar at gcc dot gnu dot org
@ 2005-06-01 18:10 ` giovannibajo at libero dot it
  2005-06-01 18:38 ` amylaar at gcc dot gnu dot org
  2005-06-01 18:53 ` amylaar at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: giovannibajo at libero dot it @ 2005-06-01 18:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2005-06-01 18:10 -------
Well, 3.4 is open for regression fixes only. Did the testcase ever work before 
3.4 in any previous GCC version?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |amylaar at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/21767] if-convert leaves invalid REG_EQUAL notes
  2005-05-26 14:40 [Bug rtl-optimization/21767] New: if-convert leaves invalid REG_EQUAL notes amylaar at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-06-01 18:10 ` giovannibajo at libero dot it
@ 2005-06-01 18:38 ` amylaar at gcc dot gnu dot org
  2005-06-01 18:53 ` amylaar at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2005-06-01 18:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From amylaar at gcc dot gnu dot org  2005-06-01 18:38 -------
(In reply to comment #4)
> Well, 3.4 is open for regression fixes only. Did the testcase ever work before 
> 3.4 in any previous GCC version?

Of course.  if-conversion is a relatively new pass:

2000-04-30  Richard Henderson  <rth@cygnus.com>

        * ifcvt.c: New file.


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/21767] if-convert leaves invalid REG_EQUAL notes
  2005-05-26 14:40 [Bug rtl-optimization/21767] New: if-convert leaves invalid REG_EQUAL notes amylaar at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2005-06-01 18:38 ` amylaar at gcc dot gnu dot org
@ 2005-06-01 18:53 ` amylaar at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2005-06-01 18:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From amylaar at gcc dot gnu dot org  2005-06-01 18:53 -------
(In reply to comment #4)
> Well, 3.4 is open for regression fixes only. Did the testcase ever work before 
> 3.4 in any previous GCC version?

P.S.: There used to be an euivalent optimization in jump.c, but that one
explicitly acknowledged the problem with REG_EQUAL notes possibly confusing
cse, and didn't do the transformation if a non-trivial REG_EQUAL note was
present.  For details, do:
cvs -z 9 dif -puw -r1.119 -r1.120 jump.c|less
and search for:
x = a; goto l



-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-06-01 18:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-26 14:40 [Bug rtl-optimization/21767] New: if-convert leaves invalid REG_EQUAL notes amylaar at gcc dot gnu dot org
2005-05-26 14:46 ` [Bug rtl-optimization/21767] " amylaar at gcc dot gnu dot org
2005-06-01 11:39 ` cvs-commit at gcc dot gnu dot org
2005-06-01 11:45 ` amylaar at gcc dot gnu dot org
2005-06-01 12:00 ` amylaar at gcc dot gnu dot org
2005-06-01 18:10 ` giovannibajo at libero dot it
2005-06-01 18:38 ` amylaar at gcc dot gnu dot org
2005-06-01 18:53 ` amylaar at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).