http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56064
Bug #: 56064 Summary: Optimize VIEW_CONVERT_EXPR with FIXED_CST Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: g...@gcc.gnu.org Created attachment 29235 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29235 foo.c.165r.expand (RTL dump) In the followinf C code static __inline__ __attribute__((__always_inline__)) _Fract rbits (const __INT16_TYPE__ i) { _Fract f; __builtin_memcpy (&f, &i, sizeof (_Fract)); return f; } _Fract func (void) { return rbits (__INT16_C(0x1234)); } The memcpy could be optimized away. It is represented as VIEW_CONVERT_EXPR but FIXED_CST is not folded in fold-const.c. The attachment shows the memory moves of HQmode which is suboptimal. For more details, see http://gcc.gnu.org/ml/gcc/2013-01/msg00187.html