This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/50663] New: conditional propagation missed in cprop.c pass
- From: "amker.cheng at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 08 Oct 2011 10:22:42 +0000
- Subject: [Bug rtl-optimization/50663] New: conditional propagation missed in cprop.c pass
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50663
Bug #: 50663
Summary: conditional propagation missed in cprop.c pass
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: amker.cheng@gmail.com
For following test case:
extern int g;
int main(int a, int b)
{
if (a == 1)
{
b = a;
}
g = b;
return 0;
}
piece of dump file for cprop1 pass is like:
(insn 8 4 9 2 (set (reg:CC 24 cc)
(compare:CC (reg/v:SI 135 [ a ])
(const_int 1 [0x1]))) test.c:4 200 {*arm_cmpsi_insn}
(nil))
(jump_insn 9 8 10 2 (set (pc)
(if_then_else (ne (reg:CC 24 cc)
(const_int 0 [0]))
(label_ref 11)
(pc))) test.c:4 212 {*arm_cond_branch}
(expr_list:REG_DEAD (reg:CC 24 cc)
(expr_list:REG_BR_PROB (const_int 6218 [0x184a])
(nil)))
-> 11)
(note 10 9 5 3 [bb 3] NOTE_INSN_BASIC_BLOCK)
(insn 5 10 11 3 (set (reg/v:SI 136 [ b ])
(reg/v:SI 135 [ a ])) test.c:4 696 {*thumb2_movsi_insn}
(expr_list:REG_DEAD (reg/v:SI 135 [ a ])
(expr_list:REG_EQUAL (const_int 1 [0x1])
(nil))))
The r135 in insn_5 should handled by conditional propagation, like:
(note 10 9 5 3 [bb 3] NOTE_INSN_BASIC_BLOCK)
(insn 5 10 11 3 (set (reg/v:SI 136 [ b ])
(const_int 1 [0x1])) test.c:4 709 {*thumb2_movsi_insn}
(expr_list:REG_DEAD (reg/v:SI 135 [ a ])
(expr_list:REG_EQUAL (const_int 1 [0x1])
(nil))))
Seems cprop misses the conditional propagation for the branch basic block.
FYI, I compiled the test case with command:
./arm-none-eabi-gcc -march=armv7-m -mthumb -O2 -S test.c -o test.S -da
The gcc is comfigured for arm-none-eabi and it's on trunk.