[Bug gcov-profile/113765] [14 Regression] ICE: autofdo: val-profiler-threads-1.c compilation, error: probability of edge from entry block not initialized

2024-03-26 Thread erozen at microsoft dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113765

--- Comment #7 from Eugene Rozenfeld  ---
I'll prepare a patch this week.

[Bug gcov-profile/113765] [14 Regression] ICE: autofdo: val-profiler-threads-1.c compilation, error: probability of edge from entry block not initialized

2024-03-15 Thread erozen at microsoft dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113765

--- Comment #4 from Eugene Rozenfeld  ---
auto-profile currently doesn't guarantee that it will set probabilities on all
edges because of zero basic block counts. Normally those edges just have
probabilities set by the preceding profile_estimate pass but under -O0
profile_estimate pass doesn't run. I think the correct fix is not to set
full_profile to true in auto-profile.cc. Under -O1 and higher it's already set
in profile_estimate and under -O0 auto_profile doesn't guarantee a full profile
so shouldn't set the flag.

[Bug ipa/108000] Assert during ipa-cp with AutoFDO

2022-12-09 Thread erozen at microsoft dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108000

Eugene Rozenfeld  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Eugene Rozenfeld  ---
Fixed by https://gcc.gnu.org/g:7410032a772a9e77b620b091c2b551b68113a179 .

[Bug ipa/108000] Assert during ipa-cp with AutoFDO

2022-12-07 Thread erozen at microsoft dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108000

--- Comment #3 from Eugene Rozenfeld  ---
Repro steps:

gcc -O2 -g -o ./pr108000 ./pr108000.c

perf record -e cpu/event=0xC4,umask=0x20/puk -b -m8 -o perf.data ./pr108000

create_gcov --binary ./pr108000 --profile=./perf.data -gcov_version=2
--gcov=./pr108000.gcda

gcc ./pr108000.c -O2 -fauto-profile=./pr108000.gcda -O2 -o ./pr108000.afdo

[Bug ipa/108000] Assert during ipa-cp with AutoFDO

2022-12-06 Thread erozen at microsoft dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108000

--- Comment #2 from Eugene Rozenfeld  ---
I actually have a fix for this, just wanted to file a simple test case. I
initially ran into this failure while reviving autoprofiledbootstrap build. The
failure happens while using the profile and the bug is an incorrect count
comparison. 

Here is the patch:
https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606935.html

I will add this test to the patch before submitting it.

[Bug ipa/108000] New: Assert during ipa-cp with AutoFDO

2022-12-06 Thread erozen at microsoft dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108000

Bug ID: 108000
   Summary: Assert during ipa-cp with AutoFDO
   Product: gcc
   Version: 13.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: erozen at microsoft dot com
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

The test case below fails with

during IPA pass: cp
/home/erozen/gcc4/gcc/testsuite/gcc.dg/tree-prof/pr1.c:93:1: internal
compiler error: in good_cloning_opportunity_p, at ipa-cp.cc:3545
0x1d7ee83 good_cloning_opportunity_p
/home/erozen/gcc4_objdir/../gcc4/gcc/ipa-cp.cc:3545
0x1d7fa66 estimate_local_effects
/home/erozen/gcc4_objdir/../gcc4/gcc/ipa-cp.cc:3752
0x1d8098d propagate_constants_topo
/home/erozen/gcc4_objdir/../gcc4/gcc/ipa-cp.cc:4080
0x1d80fa5 ipcp_propagate_stage
/home/erozen/gcc4_objdir/../gcc4/gcc/ipa-cp.cc:4267
0x1d86fc5 ipcp_driver
/home/erozen/gcc4_objdir/../gcc4/gcc/ipa-cp.cc:6574
0x1d87192 execute
/home/erozen/gcc4_objdir/../gcc4/gcc/ipa-cp.cc:6651

#include 

volatile int flag;
const int array_size = 10;
int* array;
int iterations = 1000;

#define BAR(num) \
int __attribute__((noinline)) \
bar##num (int i, int j) \
{ \
  if (i == 0) \
return 2*num - 1; \
  else \
return 2*num; \
}

BAR(1)
BAR(2)
BAR(3)
BAR(4)
BAR(5)
BAR(6)
BAR(7)
BAR(8)
BAR(9)
BAR(10)
BAR(11)
BAR(12)
BAR(13)
BAR(14)
BAR(15)
BAR(16)
BAR(17)
BAR(18)
BAR(19)

int __attribute__((noinline))
foo ()
{
  switch (flag)
  {
case 1:
return bar1 (0, 0);
case 2:
return bar2 (0, 0);
case 3:
return bar3 (0, 0);
case 4:
return bar4 (0, 0);
case 5:
return bar5 (0, 0);
case 6:
return bar6 (0, 0);
case 7:
return bar7 (0, 0);
case 8:
return bar8 (0, 0);
case 9:
return bar9 (0, 0);
case 10:
return bar10 (0, 0);
case 11:
return bar11 (0, 0);
case 12:
return bar12 (0, 0);
case 13:
return bar13 (0, 0);
case 14:
return bar14 (0, 0);
case 15:
return bar15 (0, 0);
case 16:
return bar16 (0, 0);
case 17:
return bar17 (0, 0);
case 18:
return bar18 (0, 0);
default:
return bar19(0, 0);
  }
}

int
main ()
{
  flag = 0;
  array = calloc(array_size, sizeof(int));
  for (int i = 0, j = 0; i < iterations; ++i, j = (j + 1) % 10)
array[j] = foo ();
}

[Bug c/107197] valgrind error in function same_line_p during build

2022-10-11 Thread erozen at microsoft dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107197

--- Comment #9 from Eugene Rozenfeld  ---
107193 was fixed by
https://gcc.gnu.org/g:80f414e6d73f9f1683f93d83ce63a6a482e54bee

[Bug debug/107193] [13 regression] bootstrap error caused by r13-3172-gf30e9fd33e56a5

2022-10-10 Thread erozen at microsoft dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107193

--- Comment #8 from Eugene Rozenfeld  ---
Created attachment 53690
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53690=edit
Proposed patch

[Bug debug/107193] [13 regression] bootstrap error caused by r13-3172-gf30e9fd33e56a5

2022-10-10 Thread erozen at microsoft dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107193

--- Comment #7 from Eugene Rozenfeld  ---
No, locus won't be changed by the loop. But the purpose of the loop is to
change statement locations (by adding discriminators) in this line:

  gimple_set_location (stmt, dloc);

I think the code would more clear if this line
  location_t locus = last ? gimple_location (last) : UNKNOWN_LOCATION;
were moved to after the loop.

I'll include that change in the patch.

[Bug debug/107193] [13 regression] bootstrap error caused by r13-3172-gf30e9fd33e56a5

2022-10-10 Thread erozen at microsoft dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107193

--- Comment #4 from Eugene Rozenfeld  ---
Yes, that's the problem. Sorry about that, will send a patch with the fix
shortly.

[Bug debug/107169] [13 Regression] -fcompare-debug failure at -O and above since r13-2921-gf1adf45b17f7f1ed

2022-10-06 Thread erozen at microsoft dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107169

--- Comment #2 from Eugene Rozenfeld  ---
When -gstatement-frontiers is on, the IR coming from the front end may be
different with and without debug information turned on. That may cause e.g.,
different discriminator values and -fcompare-debug failures.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100733.

In  https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=f1adf45b17f7f1ed I added
-gno-statement-frontiers to gcc/testsuite/c-c++-common/ubsan/pr85213.c
b/gcc/testsuite/c-c++-common/ubsan/pr85213.c to work around this problem for
that test.

[Bug tree-optimization/96674] Failure to optimize combination of comparisons to dec+compare

2021-01-14 Thread erozen at microsoft dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96674

--- Comment #9 from Eugene Rozenfeld  ---
I used XXX_MIN for consistency with comments on other patterns. If TYPE_MIN is
preferable, the change should be made in all of those comments as well.

[Bug tree-optimization/97223] Failure to optimize comparison of char arithmetic to single comparison

2021-01-14 Thread erozen at microsoft dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97223

--- Comment #4 from Eugene Rozenfeld  ---
The commit that fixed this:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=32ee472864ada44ef05b2a3b087b8ce413bee282

[Bug tree-optimization/96674] Failure to optimize combination of comparisons to dec+compare

2021-01-14 Thread erozen at microsoft dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96674

--- Comment #7 from Eugene Rozenfeld  ---
Thank you for the feedback, Gabriel and Jakub. I re-worked the patch based on
your suggestions. I attached the new patch and also sent it to gcc-patches.

[Bug tree-optimization/96674] Failure to optimize combination of comparisons to dec+compare

2021-01-14 Thread erozen at microsoft dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96674

Eugene Rozenfeld  changed:

   What|Removed |Added

  Attachment #49940|0   |1
is obsolete||

--- Comment #6 from Eugene Rozenfeld  ---
Created attachment 49969
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49969=edit
Optimize combination of comparisons to dec+compare

[Bug tree-optimization/96674] Failure to optimize combination of comparisons to dec+compare

2021-01-12 Thread erozen at microsoft dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96674

--- Comment #3 from Eugene Rozenfeld  ---
Both are used but it looks like __attribute__((noinline)) is used more
frequently.
Under gcc/testsuite there are 1537 instances of __attribute__((noipa)) and 3794
instances of __attribute__((noinline)).

[Bug tree-optimization/96674] Failure to optimize combination of comparisons to dec+compare

2021-01-11 Thread erozen at microsoft dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96674

Eugene Rozenfeld  changed:

   What|Removed |Added

 CC||erozen at microsoft dot com

--- Comment #1 from Eugene Rozenfeld  ---
Created attachment 49940
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49940=edit
[PATCH] Optimize combination of comparisons to dec+compare

The patch has been approved by Richard Biener.

[Bug middle-end/86698] Misleading dump-file contents

2020-11-24 Thread erozen at microsoft dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86698

Eugene Rozenfeld  changed:

   What|Removed |Added

 CC||erozen at microsoft dot com

--- Comment #2 from Eugene Rozenfeld  ---
Currently (as of commit 5700973f4a30762b4fc21687bb5f7843e55da2e4) the dump
looks like this for this function:

;; Function int f(int, int) (null)
;; enabled by -tree-original


{
  int x;

int x;
  <;
  return  = x;
}

This is different from before but there is a duplicate declaration of x, the
semicolon before the colon could be removed, and Unknown tree annotation is not
helpful.

[Bug tree-optimization/97223] Failure to optimize comparison of char arithmetic to single comparison

2020-11-06 Thread erozen at microsoft dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97223

--- Comment #3 from Eugene Rozenfeld  ---
The proposed patch was committed to the trunk by Jeff Law.

[Bug tree-optimization/96701] Failure to optimize self right-shift to 0

2020-10-30 Thread erozen at microsoft dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96701

Eugene Rozenfeld  changed:

   What|Removed |Added

 CC||erozen at microsoft dot com

--- Comment #2 from Eugene Rozenfeld  ---
Created attachment 49476
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49476=edit
Proposed patch.

The patch was approved by Richard Biener:
https://gcc.gnu.org/pipermail/gcc-patches/2020-October/557586.html

[Bug tree-optimization/97223] Failure to optimize comparison of char arithmetic to single comparison

2020-10-30 Thread erozen at microsoft dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97223

Eugene Rozenfeld  changed:

   What|Removed |Added

 CC||erozen at microsoft dot com

--- Comment #2 from Eugene Rozenfeld  ---
Created attachment 49475
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49475=edit
Proposed patch.

The patch was approved by Richard Beiner:
https://gcc.gnu.org/pipermail/gcc-patches/2020-October/557584.html