On 11/02/2017 08:06 PM, Jan Hubicka wrote:
Sorry, I must have used older diff file, because it is one of unfinished
chnages I made today.
I am attaching correct diff.
Thank you. This one works for me, however I see various errors for postgres PGO:
cd src/backend/replication/
marxin@marxinbox:~/Programming/postgres/src/backend/replication> gcc -Wall
-Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels
-Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv
-fexcess-precision=standard -O2 -fprofile-use -I. -I. -I../../../src/include
-D_GNU_SOURCE -c -o walsender.o walsender.c
In file included from walsender.c:56:0:
walsender.c: In function ‘XLogRead’:
../../../src/include/access/xlog_internal.h:188:26: error: corrupted value
profile: interval profile counter (0 out of 0) inconsistent with basic-block
count (7531)
(uint32) ((logSegNo) % XLogSegmentsPerXLogId(wal_segsz_bytes)))
~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
walsender.c:2367:4: note: in expansion of macro ‘XLogFilePath’
XLogFilePath(path, curFileTimeLine, sendSegNo, wal_segment_size);
^~~~~~~~~~~~
Problem is following:
Here we estimate count:
Old value = -1
New value = 7531
0x0000000000aecb52 in estimate_bb_frequencies (force=force@entry=false) at
../../gcc/predict.c:3590
3590 bb->count = count.guessed_local ();
(gdb) bt
#0 0x0000000000aecb52 in estimate_bb_frequencies (force=force@entry=false) at
../../gcc/predict.c:3590
#1 0x0000000000af05a4 in tree_estimate_probability
(dry_run=dry_run@entry=false) at ../../gcc/predict.c:2828
#2 0x0000000000af0b9c in (anonymous namespace)::pass_profile::execute
(this=<optimized out>, fun=0x7ffff5b9e790) at ../../gcc/predict.c:3722
#3 0x0000000000ad23f1 in execute_one_pass (pass=pass@entry=0x210faf0) at
../../gcc/passes.c:2497
#4 0x0000000000ad2cb1 in execute_pass_list_1 (pass=0x210faf0) at
../../gcc/passes.c:2586
#5 0x0000000000ad2cc3 in execute_pass_list_1 (pass=0x210f470) at
../../gcc/passes.c:2587
#6 0x0000000000ad2d05 in execute_pass_list (fn=<optimized out>, pass=<optimized
out>) at ../../gcc/passes.c:2597
#7 0x0000000000ad1631 in do_per_function_toporder (callback=callback@entry=0xad2cf0
<execute_pass_list(function*, opt_pass*)>, data=0x210f2f0) at
../../gcc/passes.c:1739
#8 0x0000000000ad3387 in execute_ipa_pass_list (pass=0x210f290) at
../../gcc/passes.c:2937
#9 0x000000000078fb42 in ipa_passes () at ../../gcc/cgraphunit.c:2423
#10 symbol_table::compile (this=this@entry=0x7ffff6817100) at
../../gcc/cgraphunit.c:2558
#11 0x00000000007923c7 in symbol_table::compile (this=0x7ffff6817100) at
../../gcc/cgraphunit.c:2719
#12 symbol_table::finalize_compilation_unit (this=0x7ffff6817100) at
../../gcc/cgraphunit.c:2716
#13 0x0000000000bb20d3 in compile_file () at ../../gcc/toplev.c:479
#14 0x00000000005d7fc5 in do_compile () at ../../gcc/toplev.c:2059
#15 toplev::main (this=this@entry=0x7fffffffd85e, argc=<optimized out>,
argc@entry=38, argv=<optimized out>, argv@entry=0x7fffffffd958) at
../../gcc/toplev.c:2194
#16 0x00000000005da46b in main (argc=38, argv=0x7fffffffd958) at
../../gcc/main.c:39
And later on we check it with real value of an interval counter:
Breakpoint 1, error_at (loc=2147497451, gmsgid=0x1605208 "corrupted value profile:
%s profile counter (%d out of %d) inconsistent with basic-block count (%d)") at
../../gcc/diagnostic.c:1354
1354 {
(gdb) bt
#0 error_at (loc=2147497451, gmsgid=0x1605208 "corrupted value profile: %s profile
counter (%d out of %d) inconsistent with basic-block count (%d)") at
../../gcc/diagnostic.c:1354
#1 0x0000000000eae5b9 in check_counter (stmt=0x7ffff58359f8, name=0x16052fc
"interval", count=0x7fffffffd5a8, all=0x7fffffffd5c0, bb_count_d=...) at
../../gcc/value-prof.c:607
#2 0x0000000000eafe95 in gimple_mod_subtract_transform (si=0x7fffffffd640) at
../../gcc/value-prof.c:1133
#3 0x0000000000eae709 in gimple_value_profile_transformations () at
../../gcc/value-prof.c:658
#4 0x0000000000ca712c in tree_profiling () at ../../gcc/tree-profile.c:687
#5 (anonymous namespace)::pass_ipa_tree_profile::execute (this=<optimized
out>) at ../../gcc/tree-profile.c:780
#6 0x0000000000ad23f1 in execute_one_pass (pass=pass@entry=0x2110350) at
../../gcc/passes.c:2497
#7 0x0000000000ad33f2 in execute_ipa_pass_list (pass=0x2110350) at
../../gcc/passes.c:2932
#8 0x000000000078fb42 in ipa_passes () at ../../gcc/cgraphunit.c:2423
#9 symbol_table::compile (this=this@entry=0x7ffff6817100) at
../../gcc/cgraphunit.c:2558
#10 0x00000000007923c7 in symbol_table::compile (this=0x7ffff6817100) at
../../gcc/cgraphunit.c:2719
#11 symbol_table::finalize_compilation_unit (this=0x7ffff6817100) at
../../gcc/cgraphunit.c:2716
#12 0x0000000000bb20d3 in compile_file () at ../../gcc/toplev.c:479
#13 0x00000000005d7fc5 in do_compile () at ../../gcc/toplev.c:2059
#14 toplev::main (this=this@entry=0x7fffffffd85e, argc=<optimized out>,
argc@entry=38, argv=<optimized out>, argv@entry=0x7fffffffd958) at
../../gcc/toplev.c:2194
#15 0x00000000005da46b in main (argc=38, argv=0x7fffffffd958) at
../../gcc/main.c:39
Can you please take a look? Or will you need a reproducer?
Thank you,
Martin