[tree-profiling-branch PATCH] IPA constant propagation

Andrew Pinski pinskia@physics.uc.edu
Thu Aug 12 09:02:00 GMT 2004

On Aug 12, 2004, at 12:59 AM, Andrew Pinski wrote:

> On Aug 12, 2004, at 12:29 AM, Razya Ladelsky wrote:
>> Hello,
>> Comments are welcome.
>> Thanks,
>> Razya
>> Changelog Entry:
>> 2004-08-12   Razya Ladelsky  <razya@il.ibm.com>
>>         * ipa_prop.c: New File: IPA constant propagation.
>>         * ipa_prop.h: New File: Same.
>>         * Makefile.in (ipa_prop.c, ipa_prop.h): Add new files.
>>         * common.opt (fipa-cp, fipa-no-cloning): New flags for IPA
>> constant
>>                 propagation.
>>         * cgraphunit.c (cgraph_optimize, record_call_1): Support for 
>> IPA
>> constant propagation.
> One suggestion (and will be a requirement when you submit this to the 
> mainline) is to add
> comments in front of each function saying what the function does 
> including static inline
> ones.
> Another (someone might also say something about this too) would be I 
> hate places where
> there are extraneous casts (i.e. ((struct ipa_edge *)cs->aux), maybe 
> using an access macro
> will help there).

Sorry for cutting off like that, I hit the wrong button.

I see you are mixing GC allocated memory with heap allocated memory, 
make sure that if
you mix them that you mark the non-GC ones as skip, I think you did 
this but I was not
for sure.  Also it looks like you are allocating ipcp_methodlist with 
GC but not marked
it with the GTY markers.

For ipcp_int, you should not be using tree_int_cst_lowhi at all but if 
you do, make sure
that you support the full double HOST_WIDE_INT as some targets (on 
32bit hosts) like x86,
HOST_WIDE_INT is only 32bit so you will not get 64bit support at all.  
Likewise for 128bit
int support (TI mode in GCC terms for 64bit targets).

Also do not use convert, instead use fold_convert, this should be 
documented somewhere
but it is not.

Also there is no way that build_int_2 is going to give you back a non 
null value.

        node->aux = xcalloc (1, sizeof (struct ipa_node));
        ((struct ipa_node *)node->aux)->ipcp_cval = NULL;
        ((struct ipa_node *)node->aux)->ipcp_arg_num =0;
        ((struct ipa_node *)node->aux)-> ipcp_param_tree = NULL;
        ((struct ipa_node *)node->aux)->ipcp_mod = NULL;

You called xcalloc which already zeroed the struct and now you are 
rezeroing it.
There are a couple of places where this happens.

Why don't we want propagate when there is ASM_EXPR?  This seems like a 
perfect place
where we want to do this.


More information about the Gcc-patches mailing list