[Bug tree-optimization/111715] Missed optimization in FRE because of weak TBAA
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111715 --- Comment #8 from Sam James --- (In reply to Richard Biener from comment #7) > (In reply to Sam James from comment #6) > > I started hitting the original warning Jakub hit with 13.2.1 20231007 but > > I've not tried to figure out which backported change caused it to appear. > > With what configuration? I was a bit wrong - not quite the same warning, filed PR111752 for it.
[Bug tree-optimization/111715] Missed optimization in FRE because of weak TBAA
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111715 --- Comment #7 from Richard Biener --- (In reply to Sam James from comment #6) > I started hitting the original warning Jakub hit with 13.2.1 20231007 but > I've not tried to figure out which backported change caused it to appear. With what configuration?
[Bug tree-optimization/111715] Missed optimization in FRE because of weak TBAA
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111715 --- Comment #6 from Sam James --- I started hitting the original warning Jakub hit with 13.2.1 20231007 but I've not tried to figure out which backported change caused it to appear.
[Bug tree-optimization/111715] Missed optimization in FRE because of weak TBAA
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111715 Richard Biener changed: What|Removed |Added Resolution|--- |FIXED Known to fail||13.2.1 Keywords||alias, missed-optimization Known to work||14.0 Target Milestone|--- |14.0 Status|ASSIGNED|RESOLVED --- Comment #5 from Richard Biener --- Fixed on trunk.
[Bug tree-optimization/111715] Missed optimization in FRE because of weak TBAA
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111715 --- Comment #4 from CVS Commits --- The master branch has been updated by Richard Biener : https://gcc.gnu.org/g:11b8cf1685bb40af5b86653e492e350983025957 commit r14-4510-g11b8cf1685bb40af5b86653e492e350983025957 Author: Richard Biener Date: Mon Oct 9 13:05:10 2023 +0200 tree-optimization/111715 - improve TBAA for access paths with pun The following improves basic TBAA for access paths formed by C++ abstraction where we are able to combine a path from an address-taking operation with a path based on that access using a pun to avoid memory access semantics on the address-taking part. The trick is to identify the point the semantic memory access path starts which allows us to use the alias set of the outermost access instead of only that of the base of this path. PR tree-optimization/111715 * alias.cc (reference_alias_ptr_type_1): When we have a type-punning ref at the base search for the access path part that's still semantically valid. * gcc.dg/tree-ssa/ssa-fre-102.c: New testcase.
[Bug tree-optimization/111715] Missed optimization in FRE because of weak TBAA
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111715 --- Comment #3 from Richard Biener --- Reduced testcase: struct B { struct { int len; } l; long n; }; struct A { struct B elts[8]; }; static void set_len (struct B *b, int len) { b->l.len = len; } static int get_len (struct B *b) { return b->l.len; } int foo (struct A *a, int i, long *q) { set_len (>elts[i], 1); *q = 2; return get_len (>elts[i]); } with the patch we end up doing the following in FRE1. I think the path based disambiguation is unaffected by assigning a different alias set. int foo (struct A * a, int i, long int * q) { int D.2787; - int _9; : MEM [(struct B *)a_3(D)].elts[i_4(D)].l.len = 1; *q_7(D) = 2; - _9 = MEM [(struct B *)a_3(D)].elts[i_4(D)].l.len; - return _9; + return 1;
[Bug tree-optimization/111715] Missed optimization in FRE because of weak TBAA
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111715 Richard Biener changed: What|Removed |Added Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Ever confirmed|0 |1 Last reconfirmed||2023-10-06 Status|UNCONFIRMED |ASSIGNED --- Comment #2 from Richard Biener --- Created attachment 56069 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56069=edit more aggressive TBAA, prototype patch This is a prototype patch to get_alias_set to recognize a proper tail of the access path on the object we have punned to. I'm not sure it will work out this way. For better understanding a smaller testcase is required.
[Bug tree-optimization/111715] Missed optimization in FRE because of weak TBAA
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111715 --- Comment #1 from Richard Biener --- Created attachment 56068 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56068=edit preprocessed source