This is the mail archive of the gcc-patches@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]

Re: Propagate BB predicates in ipa-inline-analysis


On Sat, Sep 3, 2011 at 6:41 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
>> Jan Hubicka wrote:
>>
>> > ? ? (edge_execution_predicate): Rewrite as...
>> > ? ? (set_cond_stmt_execution_predicate): ... this function; handle
>> > ? ? __builtin_constant_p.
>>
>> This causes ICEs when building recent Linux kernels with the
>> CONFIG_TRACE_BRANCH_PROFLING option. ?This reduced test case:
>>
>> static inline __attribute__((always_inline)) int f (unsigned int n, unsigned int size)
>> {
>> ?return (__builtin_constant_p (size != 0 && n > ~0 / size)
>> ? ? ? ? ?? !!(size != 0 && n > ~0 / size)
>> ? ? ? ? ?: ({ static unsigned int count[2] = { 0, 0 };
>> ? ? ? ? ? ? ? int r = !!(size != 0 && n > ~0 / size);
>> ? ? ? ? ? ? ? count[r]++;
>> ? ? ? ? ? ? ? r; }));
>> }
>>
>> int g (unsigned int size)
>> {
>> ?return f (size / 4096, 4);
>> }
>>
>> built with -O2 (on i386) on current mainline results in:
>>
>> /home/uweigand/test.i:15:1: internal compiler error: tree check: expected ssa_name, have integer_cst in set_cond_stmt_execution_predicate, at ipa-inline-analysis.c:1190
>
> the code dies on:
>
> ?D.2739_10 = __builtin_constant_p (0);
>
> it assumes that argument of __builtin_constant_p is always SSA_NAME. ?I am testing the obvious fix for that.
> However it is missed optimization to leave such unfolded statement. ?It happens at fwprop converting:

tree-ssa-forwprop.c I presume?  That one misses calling fold_stmt when
it propagates things.

> <bb 5>:
> ?iftmp.1_9 = 0;
>
> <bb 6>:
> ?# iftmp.1_2 = PHI <1(4), 0(5)>
> ?D.2739_10 = __builtin_constant_p (iftmp.1_2);

But I wonder how it manages to do something to the above ... (are you
sure it's forwprop?)

Richard.

> Honza
>>
>> Bye,
>> Ulrich
>>
>> --
>> ? Dr. Ulrich Weigand
>> ? GNU Toolchain for Linux on System z and Cell BE
>> ? Ulrich.Weigand@de.ibm.com
>


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