This is an archive of the discontinued LLVM Phabricator instance.

Improve code generation for thread_local variables:
ClosedPublic

Authored by rsmith on Sep 10 2019, 7:02 PM.

Details

Summary
  • Don't bother using a thread wrapper when the variable is known to have constant initialization.
  • Emit the thread wrapper as discardable-if-unused in TUs that don't contain a definition of the thread_local variable.
  • Don't emit the thread wrapper at all if the thread_local variable is unused and discardable; it will be emitted by all TUs that need it.

Diff Detail

Event Timeline

rsmith created this revision.Sep 10 2019, 7:02 PM
Herald added a project: Restricted Project. · View Herald Transcript
This revision is now accepted and ready to land.Sep 11 2019, 12:03 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 12 2019, 1:01 PM

This commit appears to be the root cause of a run-time crash related to the interaction of global initializers and the wrapper functions to access thread_local variables -- reported as PR48030.

Ping. Just wondering if there are any new insights on the issue reported in PR48030.

Ping. Just wondering if there are any new insights on the issue reported in PR48030.

I confirm that https://bugs.llvm.org/show_bug.cgi?id=48030 still fails. 😅

@rsmith, can you fix or revert?

@rsmith, can you fix or revert?

Sorry for the long delay here. Looking now.