This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/42889] "-fcompare-debug failure (length)" with "-O1 -fgcse"
- From: "steven at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 Jan 2010 09:40:49 -0000
- Subject: [Bug tree-optimization/42889] "-fcompare-debug failure (length)" with "-O1 -fgcse"
- References: <bug-42889-14164@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from steven at gcc dot gnu dot org 2010-01-28 09:40 -------
combine fails to combine the following insns.
Before combine (.init_regs dump):
(insn 20 19 21 4 PR42889.c:7 (parallel [
(set (reg:SI 70)
(and:SI (reg/v:SI 64 [ c ])
(const_int 4 [0x4])))
(clobber (reg:CC 17 flags))
]) 375 {*andsi_1} (expr_list:REG_DEAD (reg/v:SI 64 [ c ])
(expr_list:REG_UNUSED (reg:CC 17 flags)
(nil))))
(insn 21 20 48 4 PR42889.c:7 (set (reg:CCZ 17 flags)
(compare:CCZ (reg:SI 70)
(const_int 0 [0x0]))) 2 {*cmpsi_ccno_1} (expr_list:REG_UNUSED
(reg:CCZ 17 flags)
(nil)))
After combine (.combine dump):
(note 20 19 21 4 NOTE_INSN_DELETED)
(insn 21 20 48 4 PR42889.c:7 (parallel [
(set (reg:CCZ 17 flags)
(compare:CCZ (and:SI (reg/v:SI 64 [ c ])
(const_int 4 [0x4]))
(const_int 0 [0x0])))
(set (reg:SI 70)
(and:SI (reg/v:SI 64 [ c ])
(const_int 4 [0x4])))
]) 384 {*andsi_2} (expr_list:REG_DEAD (reg/v:SI 64 [ c ])
(expr_list:REG_UNUSED (reg:CCZ 17 flags)
(nil))))
When compiled with -g that combine doesn't happen because the compare insn has
been changed somewhere before combine.
Before combine:
(insn 20 19 50 4 PR42889.c:7 (parallel [
(set (reg:SI 70)
(and:SI (reg/v:SI 64 [ c ])
(const_int 4 [0x4])))
(clobber (reg:CC 17 flags))
]) 375 {*andsi_1} (expr_list:REG_DEAD (reg/v:SI 64 [ c ])
(expr_list:REG_UNUSED (reg:CC 17 flags)
(nil))))
(insn 50 20 51 4 PR42889.c:7 (set (reg:CC 17 flags)
(compare:CC (reg:SI 70)
(const_int 1 [0x1]))) 6 {*cmpsi_1} (expr_list:REG_DEAD (reg:SI 70)
(nil)))
The difference starts in the cprop3 pass:
+ DCE: Deleting insn 21
+ deleting insn with uid = 21.
(expr_list:REG_UNUSED (reg:CC 17 flags)
(nil))))
-(insn# # # 4 PR42889.c:7 (set (reg:CCZ 17 flags)
- (compare:CCZ (reg:SI 70)
- (const_int 0 [0x0])))# {*cmpsi_ccno_1} (expr_list:REG_DEAD (reg:SI
70)
- (nil)))
-
(insn# # # 4 PR42889.c:7 (set (reg:CC 17 flags)
(compare:CC (reg:SI 70)
(const_int 1 [0x1])))# {*cmpsi_1} (nil))
Interestingly: with -g0 "df_analyze called" happens, but there is no DF output
and it almost looks as if DF simply doesn't run (and therefore also DCE does
not run).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42889