[Bug tree-optimization/17217] not removing removal of nested structs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=17217 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed|2005-01-25 03:37:17 |2021-09-03 Ever confirmed|0 |1 --- Comment #8 from Andrew Pinski --- So where is a better testcase (which is not depedent on how gimplifier works): int h(int *a); int f(int i, int j) { int t = i; int t1 = j; int g() { int t11 = t1; int t2 = h(); return t2 + t11; } int t3 = g(); return t3 + t1; } CUT --- On the gimple level we get: _3 = __builtin_dwarf_cfa (0); FRAME.1.FRAME_BASE.PARENT = _3; FRAME.1.t = i_5(D); FRAME.1.t1 = j_7(D); t2_11 = h (); _12 = j_7(D) + t2_11; _9 = FRAME.1.t1; _10 = _9 + _12; We should know that FRAME.1 is special in that h can only escape t field of FRAME.1 and not the other fields of FRAME.1 too.
[Bug tree-optimization/17217] not removing removal of nested structs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=17217 Andrew Pinski changed: What|Removed |Added Status|WAITING |UNCONFIRMED Ever confirmed|1 |0 --- Comment #7 from Andrew Pinski --- (In reply to Steven Bosscher from comment #6) > What code is expected in this really old bug? Trunk x86-64 today: > __attribute__((noinline)) g1 is not to be noinline for the nested testcase. The un-nested testcase is actually should not be optimized. The nested function testcase shows the issue. For the original testcase: int h(int *a); int f(int i, int j) { int t = i; int t1 = j; int g() { return h() + t1; } return g() + t1; } We should optimize this to the same as: int h(int *a); int f(int i, int j) { return h() + 2 * j; }
[Bug tree-optimization/17217] not removing removal of nested structs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=17217 Steven Bosscher changed: What|Removed |Added Status|REOPENED|WAITING --- Comment #6 from Steven Bosscher --- What code is expected in this really old bug? Trunk x86-64 today: int h(int *a); struct G { int t; int t1; }; static int g1(struct G*); int f1(int i, int j) { struct G nestedf1={i,j}; return g1()+nestedf1.t1; } __attribute__((noinline)) static int g1(struct G *nestedf1) { return h(>t)+ nestedf1->t1; } g1(G*): pushq %rbx movq%rdi, %rbx callh(int*) addl4(%rbx), %eax popq%rbx ret f1(int, int): subq$24, %rsp movl%edi, 8(%rsp) leaq8(%rsp), %rdi movl%esi, 12(%rsp) callg1(G*) addl12(%rsp), %eax addq$24, %rsp ret
[Bug tree-optimization/17217] not removing removal of nested structs
--- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-16 17:37 --- Fixed in 4.1.0 and above by Daniel's aliasing improvements. -- What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED Target Milestone|--- |4.1.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17217