Re: missing conditional propagation in cprop.c pass

2011-10-10 Thread Amker.Cheng
Hi Jeff, Steven, I have filed a bug at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50663 Could somebody confirm it? I am studying this piece of codes and have spent some time on it, I'm working on a patch and hoping could help on this issue, Please help me review it later. Thanks. -- Best

Re: missing conditional propagation in cprop.c pass

2011-10-03 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/29/11 22:43, Amker.Cheng wrote: I believe, the optimization you may be referring to is value range propagation which does predication of values based on predicates of conditions. GCC definitely applies VRP at the tree stage, I am not sure

Re: missing conditional propagation in cprop.c pass

2011-10-03 Thread Steven Bosscher
Hi, Though conditional const information r684 - 0 is collected by find_implicit_sets, the conditional information is recorded as local information of bb 97, and it is not recorded in avout of bb 96, so not in avin of bb 97 either. To have the set in avout of bb 96 would be wrong because the

Re: missing conditional propagation in cprop.c pass

2011-09-29 Thread Amker.Cheng
On Tue, Sep 27, 2011 at 4:19 PM, Amker.Cheng amker.ch...@gmail.com wrote: Hi, I ran into a case and found conditional (const) propagation is mishandled in cprop pass. With following insn sequence after cprop1 pass: (note 878 877 880 96 [bb

Re: missing conditional propagation in cprop.c pass

2011-09-29 Thread Paulo J. Matos
Amker.Cheng amker.ch...@gmail.com writes: (insn 882 881 883 96 (set (reg:CC 24 cc) (compare:CC (reg:SI 684 [ default_num_contexts ]) (const_int 0 [0]))) core_main.c:265 211 {*arm_cmpsi_insn} (nil)) The insn49 should be propagated with conditional const from insn882

Re: missing conditional propagation in cprop.c pass

2011-09-29 Thread Amker.Cheng
Unless there's something arch specific related to arm, insn 882 is a compare, which won't change r684. Why do you think 0 should propagated to r291 if r684 is not zero? Thanks for replying. Sorry if I misunderstood anything below, and please correct me. insn 882 : cc - compare

RE: missing conditional propagation in cprop.c pass

2011-09-29 Thread Rahul Kharche
insn 882 : cc - compare (r684, 0) jump_insn 883 : if (cc != 0) goto insn 46 insn 49: r291 - r684 .. insn 46 cc contains the result of subtracting 0 from r684; control flow goes to insn_49 only if (cc == 0), which implies (r684 == 0). Then at insn_49 we have

Re: missing conditional propagation in cprop.c pass

2011-09-29 Thread Bernd Schmidt
On 09/29/11 16:43, Rahul Kharche wrote: insn 882 : cc - compare (r684, 0) jump_insn 883 : if (cc != 0) goto insn 46 insn 49: r291 - r684 .. insn 46 cc contains the result of subtracting 0 from r684; control flow goes to insn_49 only if (cc == 0), which implies

Re: missing conditional propagation in cprop.c pass

2011-09-29 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/29/11 09:26, Bernd Schmidt wrote: On 09/29/11 16:43, Rahul Kharche wrote: insn 882 : cc - compare (r684, 0) jump_insn 883 : if (cc != 0) goto insn 46 insn 49: r291 - r684 .. insn 46 cc contains the result of

Re: missing conditional propagation in cprop.c pass

2011-09-29 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/29/11 08:43, Rahul Kharche wrote: insn 882 : cc - compare (r684, 0) jump_insn 883 : if (cc != 0) goto insn 46 insn 49: r291 - r684 .. insn 46 cc contains the result of subtracting 0 from r684; control flow goes

Re: missing conditional propagation in cprop.c pass

2011-09-29 Thread Bernd Schmidt
On 09/29/11 17:36, Jeff Law wrote: On 09/29/11 09:26, Bernd Schmidt wrote: ISTR cse.c has some support for this. cprop.c -- see references to implicit_sets. cse too: record_jump_equiv. Bernd

RE: missing conditional propagation in cprop.c pass

2011-09-29 Thread Rahul Kharche
On 09/29/11 17:36, Jeff Law wrote: On 09/29/11 09:26, Bernd Schmidt wrote: ISTR cse.c has some support for this. cprop.c -- see references to implicit_sets. cse too: record_jump_equiv. Interesting. Are the two approaches subtly different or do they apply precisely the same predication?

Re: missing conditional propagation in cprop.c pass

2011-09-29 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/29/11 09:48, Rahul Kharche wrote: On 09/29/11 17:36, Jeff Law wrote: On 09/29/11 09:26, Bernd Schmidt wrote: ISTR cse.c has some support for this. cprop.c -- see references to implicit_sets. cse too: record_jump_equiv. Interesting. Are

Re: missing conditional propagation in cprop.c pass

2011-09-29 Thread Paulo J. Matos
Amker.Cheng amker.ch...@gmail.com writes: Thanks for replying. Sorry if I misunderstood anything below, and please correct me. insn 882 : cc - compare (r684, 0) jump_insn 883 : if (cc != 0) goto insn 46 insn 49: r291 - r684 .. insn 46 cc contains the result of

Re: missing conditional propagation in cprop.c pass

2011-09-29 Thread Amker.Cheng
Nobody mentioned this so I might be way off but cc doesn't get (minus (reg r684) (const_int 0)). It gets the `condition codes` modification as a consequence of the subtraction. Hi Paulo, According to section comparison operations in internal: The comparison operators may be used to compare

Re: missing conditional propagation in cprop.c pass

2011-09-29 Thread Amker.Cheng
I believe, the optimization you may be referring to is value range propagation which does predication of values based on predicates of conditions. GCC definitely applies VRP at the tree stage, I am not sure if there is an RTL pass to do the same. There are also RTL optimizers which perform