Take the following C++ code: class StringMap { const char empty_str[8]; public: StringMap() : empty_str() {} };
StringMap f() { StringMap a; return a; } For 3.3.2, we produced (at -O3): __Z1fv: LFB6: li r4,0 stw r4,0(r3) stw r4,4(r3) blr on the mainline we get: __Z1fv: LFB5: mflr r0 LCFI0: bcl 20,31,"L00000000001$pb" "L00000000001$pb": stw r31,-4(r1) LCFI1: mflr r31 stw r0,8(r1) LCFI2: addis r2,r31,ha16(__ZZN9StringMapC1EvE3C.0-"L00000000001$pb") la r9,lo16(__ZZN9StringMapC1EvE3C.0-"L00000000001$pb")(r2) lwz r10,4(r9) lwz r9,0(r9) stw r10,4(r3) lwz r0,8(r1) lwz r31,-4(r1) mtlr r0 stw r9,0(r3) blr -- Summary: [4.0 Regression] MOVE_RATIO should be tweaked Product: gcc Version: 4.0.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P2 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pinskia at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org GCC target triplet: powerpc-darwin http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19046