[all-commits] [llvm/llvm-project] afa23e: [X86] Insert CALLSEQ when lowering GlobalTLSAddres...

Fabian Ritter via All-commits all-commits at lists.llvm.org
Mon Nov 4 03:42:15 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: afa23ea03741193e36b05ddd508d38a90a18a8b8
      https://github.com/llvm/llvm-project/commit/afa23ea03741193e36b05ddd508d38a90a18a8b8
  Author: Fabian Ritter <fabian.ritter at amd.com>
  Date:   2024-11-04 (Mon, 04 Nov 2024)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/lib/Target/X86/X86ISelLowering.h
    M llvm/lib/Target/X86/X86InstrCompiler.td
    A llvm/test/CodeGen/X86/tls-function-argument.ll

  Log Message:
  -----------
  [X86] Insert CALLSEQ when lowering GlobalTLSAddress for ELF targets (#113706)

When lowering a TLS address for an ELF target, we introduce a call to
obtain the TLS base address. So far, we do not insert CALLSEQ_START/END
markers around this call when it is generated, but use a custom inserter
to insert them in a later phase. This is problematic, since the TLS
address call can land in a CALLSEQ for another call before it is
wrapped in its own CALLSEQ. That results in nested CALLSEQs, which are
illegal and cause errors when expensive checks are enabled, e.g., in
issues #45574 and #98042.

This patch instead wraps each TLS address call in a CALLSEQ when it is
generated so that instruction selection can avoid nested CALLSEQs. This
is an alternative to PR #106965, which instead changes the custom
inserter to avoid generating CALLSEQs when the TLS address call is
already in a CALLSEQ.

This patch also effectively reverts commit
[228978c](https://github.com/llvm/llvm-project/commit/228978c0dcfc9a9793f3dc8a69f42471192223bc),
which introduced the CustomInserter that so far added the CALLSEQ around
TLSAddrs.

Fixes #45574 and #98042.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list