> 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:
<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);
Honza
>
> Bye,
> Ulrich
>
> --
> Dr. Ulrich Weigand
> GNU Toolchain for Linux on System z and Cell BE
> [email protected]