Bug 32691 - fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var> in when &cfv is in a different statement
Summary: fold *(float*)(&complex_float_var) into REALPART_EXPR<complex_float_var> in w...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.3.0
: P3 enhancement
Target Milestone: 4.7.0
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization, TREE
Depends on:
Blocks: spec
  Show dependency treegraph
 
Reported: 2007-07-09 09:26 UTC by Andrew Pinski
Modified: 2011-04-06 21:25 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-07-09 09:38:02


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2007-07-09 09:26:27 UTC
Testcase:
float
quantum_real(float _Complex a)
{
  float *p = (float *) &a;
  return p[0];
}
float
quantum_imag(float _Complex a)
{
  float *p = (float *) &a;
  return p[1];
}


------- CUT -----
Even though the above are optimized at the RTL level, it would be nice if we could get them optimized at the TREE level also.
We already optimize ((float *) &a)[0] and ((float *) &a)[1] via PR 26134.

This should help libquantum in SPEC 2k6 also.
Comment 1 Richard Biener 2007-07-09 09:38:02 UTC
Confirmed.
Comment 2 Andrew Pinski 2011-04-06 21:24:51 UTC
This was fixed by commit at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26134#c9 .