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

            Bug ID: 120065
           Summary: [14/15/16 Regression] profile info corrupted by dom2
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

For the following testcase on the trunk, the profile info gets corrupted by
dom2 (reproduced on both x86_64 and aarch64):

$ cat small.c
float *a;
int j;
void foo(int n, float f) {
  while (n > 0 && a)
    ;
  for (j = 0; j < n; ++j)
    a[j] = f;
}
$ ./xgcc -B . -c small.c -O2 -S -o /dev/null
-fdump-tree-thread1-blocks-details=- | grep -B 1 "Invalid sum"
$ ./xgcc -B . -c small.c -O2 -S -o /dev/null -fdump-tree-dom2-blocks-details=-
| grep -B 1 "Invalid sum"
;;   basic block 4, loop depth 1, count 958878295 (estimated locally, freq
8.3480), maybe hot
;;   Invalid sum of incoming counts 1011616600 (estimated locally, freq
8.8071), should be 958878295 (estimated locally, freq 8.3480)
--
;;   basic block 5, loop depth 0, count 102228543 (estimated locally, freq
0.8900), maybe hot
;;   Invalid sum of incoming counts 3069425 (estimated locally, freq 0.0267),
should be 102228543 (estimated locally, freq 0.8900)
--
;;   basic block 8, loop depth 0, count 12634988 (estimated locally, freq
0.1100), maybe hot
;;   Invalid sum of incoming counts 59055800 (estimated locally, freq 0.5141),
should be 12634988 (estimated locally, freq 0.1100)

It seems to have started in the GCC 14 timeframe.

Reply via email to