https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82803
Alexander Monakov <amonakov at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amonakov at gcc dot gnu.org --- Comment #5 from Alexander Monakov <amonakov at gcc dot gnu.org> --- The main reason is __tls_get_addr emitted as a normal call on RTL (for each GIMPLE access to the variable), but unless I'm missing something RTL doesn't have a notion of pure/const calls, so RTL loop invariant motion and CSE cannot clean up the redundant calls. On i386, ___tls_get_addr is modeled as an unspec instead, which is successfully moved out of the loop during RTL invariant motion.