This patch fixes roms autofdo regression I introduced yesterday. What happens
is that loop vectorization is disabled, because we get loop header count 0.
I.e.
loop_header: <count 0>
if (i < n)
goto exit;
loop_body: <count large>
... vectorizable computation ...
The reason is that "if (i < 0)" statement actually has 0 profile in AFDO
feedback. This seems common and I believe it is an issue with debug info in
loop vecotrizer. Because loop is vectorized during train run, the conditoinal
is replaced by vectorized loop conditional but the statement remains in the
loop epilogue which is not executed at runtime.
This is something we can fix and introduce debug statement in the vectorized loop
body so user can breakpoint on it. I will try to produce testcase for that.
However this patch fixes bug where I intended to only trust 0 counts from AFDO if they
are also 0 in static profile and reversed the conditinal.
autoprofile-bootstrapped/regtested x86_64-linux, comitted.
* auto-profile.cc (afdo_set_bb_count): Dump also 0 count stmts.
(afdo_annotate_cfg): Fix conditional for block having non-zero static
profile.
{
if (info.count > max_count)
max_count = info.count;
- if (dump_file && info.count)
+ if (dump_file)
{
fprintf (dump_file, " count %" PRIu64 " in stmt: ",
(int64_t)info.count);
afdo samples, but if even static profile agrees with 0,
consider it final so propagation works better. */
for (basic_block bb : zero_bbs)
- if (bb->count.nonzero_p ())
+ if (!bb->count.nonzero_p ())
{
update_count_by_afdo_count (&bb->count, 0);
set_bb_annotated (bb, &annotated_bb);