This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/21767] if-convert leaves invalid REG_EQUAL notes


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]