[Bug middle-end/83019] New: Compiler dumps predictions with -nan%
ubizjak at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Nov 16 14:28:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83019
Bug ID: 83019
Summary: Compiler dumps predictions with -nan%
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: ubizjak at gmail dot com
Target Milestone: ---
Recent patch caused some dumps to dump -nam%.
One example is gcc.dg/graphite/interchange-12.c, which generates:
./cc1 -O2 -ffast-math -floop-nest-optimize -fdump-tree-graphite-all
interchange-12.c
interchange-12.c.150t.graphite:
...
Predictions for bb 29
first match heuristics: 99.0% exec 0 (estimated locally) hit 0 (estimated
locally) (-nan%)
combined heuristics: 99.0% exec 0 (estimated locally) hit 0 (estimated
locally) (-nan%)
loop iterations heuristics of edge 29->28: 1.0% exec 0 (estimated locally)
hit 0 (estimated locally) (-nan%)
Predictions for bb 30
1 edges in bb 30 predicted to even probabilities
Predictions for bb 28
first match heuristics: 99.0% exec 0 (estimated locally) hit 0 (estimated
locally) (-nan%)
combined heuristics: 99.0% exec 0 (estimated locally) hit 0 (estimated
locally) (-nan%)
loop iterations heuristics of edge 28->22: 1.0% exec 0 (estimated locally)
hit 0 (estimated locally) (-nan%)
...
The above dump was generated with x86_64-linux-gnu host. This is problematic
with hosts (e.g. alpha) that require -mieee when dealing with NaNs, resulting
in several ICEs [1].
The cause is the division 0/0 in:
Program received signal SIGFPE, Arithmetic exception.
0x00000001207a4ee4 in dump_prediction (file=0x121665bf0, predictor=<optimized
out>, probability=<optimized out>, bb=0x2000099df48, reason=<optimized o
ut>,
ep_edge=<optimized out>) at
/space/homedirs/uros/gcc-svn/trunk/gcc/predict.c:750
750 fprintf (file, " (%.1f%%)", e->count ().to_gcov_type() *
100.0
(gdb) bt
#0 0x00000001207a4ee4 in dump_prediction (file=0x121665bf0,
predictor=<optimized out>, probability=<optimized out>, bb=0x2000099df48,
reason=<optimized out>, ep_edge=<optimized out>) at
/space/homedirs/uros/gcc-svn/trunk/gcc/predict.c:750
#1 0x00000001207af424 in combine_predictions_for_bb (bb=0x2000099df48,
dry_run=<optimized out>) at /space/homedirs/uros/gcc-svn/trunk/gcc/predict.c:1
270
#2 0x00000001207b23d0 in tree_estimate_probability (dry_run=<optimized out>)
at /space/homedirs/uros/gcc-svn/trunk/gcc/predict.c:2819
#3 0x0000000120f6bf24 in graphite_transform_loops () at
/space/homedirs/uros/gcc-svn/trunk/gcc/graphite.c:425
#4 0x0000000120f6d374 in graphite_transforms (fun=0x12120fc31) at
/space/homedirs/uros/gcc-svn/trunk/gcc/graphite.c:447
#5 (anonymous namespace)::pass_graphite_transforms::execute (this=0x121665bf0,
fun=0x12120fc31) at /space/homedirs/uros/gcc-svn/trunk/gcc/graphite.c:
524
#6 0x000000012078b038 in execute_one_pass (pass=0x1214fe7c0) at
/space/homedirs/uros/gcc-svn/trunk/gcc/passes.c:2497
#7 0x000000012078bc08 in execute_pass_list_1 (pass=0x1214fe7c0) at
/space/homedirs/uros/gcc-svn/trunk/gcc/passes.c:2586
#8 0x000000012078bc24 in execute_pass_list_1 (pass=0x1214fe760) at
/space/homedirs/uros/gcc-svn/trunk/gcc/passes.c:2587
#9 0x000000012078bc24 in execute_pass_list_1 (pass=0x1214fe400) at
/space/homedirs/uros/gcc-svn/trunk/gcc/passes.c:2587
#10 0x000000012078bc24 in execute_pass_list_1 (pass=0x1214fd070) at
/space/homedirs/uros/gcc-svn/trunk/gcc/passes.c:2587
#11 0x000000012078bca4 in execute_pass_list (fn=<optimized out>,
pass=0x12120fc31) at /space/homedirs/uros/gcc-svn/trunk/gcc/passes.c:2597
#12 0x0000000120363804 in cgraph_node::expand (this=0x200009c8000) at
/space/homedirs/uros/gcc-svn/trunk/gcc/cgraphunit.c:2139
#13 0x00000001203652a0 in expand_all_functions () at
/space/homedirs/uros/gcc-svn/trunk/gcc/cgraphunit.c:2275
#14 symbol_table::compile (this=<optimized out>) at
/space/homedirs/uros/gcc-svn/trunk/gcc/cgraphunit.c:2623
#15 0x000000012036874c in compile (this=0x200008a4000) at
/space/homedirs/uros/gcc-svn/trunk/gcc/cgraphunit.c:2682
#16 symbol_table::finalize_compilation_unit (this=0x200008a4000) at
/space/homedirs/uros/gcc-svn/trunk/gcc/cgraphunit.c:2716
#17 0x00000001208a695c in compile_file () at
/space/homedirs/uros/gcc-svn/trunk/gcc/toplev.c:480
#18 0x000000012013ae90 in do_compile () at
/space/homedirs/uros/gcc-svn/trunk/gcc/toplev.c:2060
#19 toplev::main (this=0x11fdff040, argc=<optimized out>, argv=<optimized out>)
at /space/homedirs/uros/gcc-svn/trunk/gcc/toplev.c:2195
#20 0x000000012013cf60 in main (argc=<optimized out>, argv=0x11fdff168) at
/space/homedirs/uros/gcc-svn/trunk/gcc/main.c:39
(gdb) list
745 bb->count.dump (file);
746 if (e)
747 {
748 fprintf (file, " hit ");
749 e->count ().dump (file);
750 fprintf (file, " (%.1f%%)", e->count ().to_gcov_type() *
100.0
751 / bb->count.to_gcov_type ());
752 }
753 }
754
[1] https://gcc.gnu.org/ml/gcc-testresults/2017-11/msg01330.html
More information about the Gcc-bugs
mailing list