Bug 26429

Summary: Call clobbering is not context sensitive
Product: gcc Reporter: Richard Biener <rguenth>
Component: tree-optimizationAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: normal CC: dberlin, gcc-bugs, rguenth
Priority: P3 Keywords: alias, compile-time-hog, memory-hog, missed-optimization
Version: 4.2.0   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: 4.0.2 4.1.0 4.2.0 Last reconfirmed:

Description Richard Biener 2006-02-22 21:08:05 UTC
For

typedef struct {
  int i;
  int j;
  int k;
} Foo;

void bar(Foo*);
void foo(void)
{
  {
    Foo a;
    bar(&a);
  }
  {
    Foo b;
    bar(&b);
  }
}

we have in the alias1 dump:

foo ()
{
  struct Foo b;
  struct Foo a;

<bb 2>:
  #   a_3 = V_MAY_DEF <a_1>;
  #   b_4 = V_MAY_DEF <b_2>;
  bar (&a);
  #   a_5 = V_MAY_DEF <a_3>;
  #   b_6 = V_MAY_DEF <b_4>;
  bar (&b);
  return;

}

The testcase is actually modeled after what the fortran frontend produces
for I/O operations, it adds one instance of Foo per I/O call, and the clobbers
keep building up.  Now consider having SFTs for the _huge_ fortran st_parm
structure...
Comment 1 Daniel Berlin 2006-02-22 22:21:15 UTC
Actually, the problem you are describing is that call clobbering is not per call (IE context-sensitive), so that it believes something clobbered somewhere means it is clobbered everywhere.
Comment 2 Richard Biener 2006-02-22 22:28:04 UTC
Ah, and that is even correct.  Because the objects escape here, so we cannot do better (without IP escape analysis).
Comment 3 Andrew Pinski 2006-02-22 23:04:17 UTC
Then this is a dup of bug 23384.

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