https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82578
Bug ID: 82578 Summary: Redundant instructions emitted starting with r204212 Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: krebbel at gcc dot gnu.org Target Milestone: --- Starting with r204212 (2013-10-30) a redundant thread pointer extract is emitted. static __thread int counter; void gs_handler(void) { counter++; } compiled with: -O2 -S 2xear with r204211: gs_handler: larl %r5,.L2 ear %r1,%a0 sllg %r1,%r1,32 ear %r1,%a1 lg %r2,.L3-.L2(%r5) l %r3,0(%r1,%r2) ahi %r3,1 st %r3,0(%r1,%r2) br %r14 4xear with r204212: gs_handler: larl %r5,.L2 ear %r2,%a0 sllg %r2,%r2,32 ear %r1,%a0 ear %r2,%a1 sllg %r1,%r1,32 lg %r3,.L3-.L2(%r5) ear %r1,%a1 l %r2,0(%r2,%r3) ahi %r2,1 st %r2,0(%r1,%r3) br %r14