Skip to content

Should generate llvm.threadlocal.address for TLS accesses #136044

@nikic

Description

@nikic

See https://llvm.org/docs/LangRef.html#llvm-threadlocal-address-intrinsic. Instead of directly accessing the global, the result of @llvm.threadlocal.address(ptr @g) should be accessed.

This is required for correctness when using LLVM coroutines (not relevant for Rust), but it should also improve codegen in some cases because it will allow CSE/LICM of the TLS address calculation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-thread-localsArea: Thread local storage (TLS)C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions