[Bug tree-optimization/111734] [14 Regression] wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre' since r14

2023-10-31 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111734

Richard Biener  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #8 from Richard Biener  ---
PR57, and indeed, confirmed fixed now.

*** This bug has been marked as a duplicate of bug 57 ***

[Bug tree-optimization/111734] [14 Regression] wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre' since r14

2023-10-30 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111734

Sam James  changed:

   What|Removed |Added

Summary|[14 Regression] wrong code  |[14 Regression] wrong code
   |with '-O3   |with '-O3
   |-fno-inline-functions-calle |-fno-inline-functions-calle
   |d-once  |d-once
   |-fno-inline-small-functions |-fno-inline-small-functions
   |-fno-omit-frame-pointer |-fno-omit-frame-pointer
   |-fno-toplevel-reorder   |-fno-toplevel-reorder
   |-fno-tree-fre'  |-fno-tree-fre' since
   ||r14-3226-gd073e2d75d9ed4

--- Comment #7 from Sam James  ---
d073e2d75d9ed492de9a8dc6970e5b69fae20e5a is the first bad commit
commit d073e2d75d9ed492de9a8dc6970e5b69fae20e5a
Author: Martin Jambor 
Date:   Tue Aug 15 17:26:13 2023 +0200

Feed results of IPA-CP into tree value numbering

i.e. r14-3226-gd073e2d75d9ed4.

[Bug tree-optimization/111734] [14 Regression] wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre'

2023-10-30 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111734

--- Comment #6 from Sam James  ---
-fharden-control-flow-redundancy suppresses it.

[Bug tree-optimization/111734] [14 Regression] wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre'

2023-10-30 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111734

--- Comment #5 from Sam James  ---
(In reply to Richard Biener from comment #4)
> [...]
> I think this is a duplicate of the modref / IPA-CP issue (failing to remember
> the PR number) which IIRC has a patch under review.

PR57 or maybe PR108007?

[Bug tree-optimization/111734] [14 Regression] wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre'

2023-10-17 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111734

Richard Biener  changed:

   What|Removed |Added

 CC||hubicka at gcc dot gnu.org,
   ||jamborm at gcc dot gnu.org,
   ||rguenth at gcc dot gnu.org
   Priority|P3  |P1

--- Comment #4 from Richard Biener  ---
-fno-ipa-modref fixes it.

Fails with -O3 -fno-inline -fno-toplevel-reorder -fno-tree-fre

--- a-t.c.146t.pre 2023-10-17 15:07:52.544953598 +0200
+++ a-t.c.146t.pre.bad 2023-10-17 15:07:45.788953643 +0200
@@ -25,7 +25,6 @@
   int _4;

[local count: 1073741824]:
-  i = &e;
   g.constprop (&i);
   i.2_3 = i;
   _4 = *i.2_3;

I think this is a duplicate of the modref / IPA-CP issue (failing to remember
the PR number) which IIRC has a patch under review.

[Bug tree-optimization/111734] [14 Regression] wrong code with '-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-omit-frame-pointer -fno-toplevel-reorder -fno-tree-fre'

2023-10-09 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111734

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
Summary|wrong code with '-O3|[14 Regression] wrong code
   |-fno-inline-functions-calle |with '-O3
   |d-once  |-fno-inline-functions-calle
   |-fno-inline-small-functions |d-once
   |-fno-omit-frame-pointer |-fno-inline-small-functions
   |-fno-toplevel-reorder   |-fno-omit-frame-pointer
   |-fno-tree-fre'  |-fno-toplevel-reorder
   ||-fno-tree-fre'
   Last reconfirmed||2023-10-10
  Component|c   |tree-optimization
   Target Milestone|--- |14.0
 Status|UNCONFIRMED |NEW

--- Comment #3 from Andrew Pinski  ---
PRE does:

Processing block 0: BB2
Value numbering stmt = *m_1(D) = &e;
RHS &e simplified to &e
No store match
Value numbering store *m_1(D) to &e
Setting value number of .MEM_3 to .MEM_

...

Starting insert iteration 1
Deleted redundant store *m_1(D) = &e;
Removing dead stmt *m_1(D) = &e;


Better reduced testcase:
```
struct a {};
struct {
  unsigned b;
  unsigned short c;
} d, f = {9, 1};
int e;
static void g(unsigned, __SIZE_TYPE__, int **m);
static void h() {
  int *i = &e;
  g(0, (__SIZE_TYPE__)i, &i);
  if (*i)
f = d;
}
void g(unsigned a, __SIZE_TYPE__ b, int **m) {
  *m = &e;
}
int main() {
  h();
  if (f.c != 1)
__builtin_abort();
}
```