[all-commits] [llvm/llvm-project] 630d55: [AsmPrinter] Always emit global equivalents if the...

dianqk via All-commits all-commits at lists.llvm.org
Wed Jun 25 03:39:57 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 630d55cce45f8b409367914ef372047c8c43c511
      https://github.com/llvm/llvm-project/commit/630d55cce45f8b409367914ef372047c8c43c511
  Author: dianqk <dianqk at dianqk.net>
  Date:   2025-06-25 (Wed, 25 Jun 2025)

  Changed paths:
    M llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    A llvm/test/MC/X86/gotpcrel-non-globals.ll

  Log Message:
  -----------
  [AsmPrinter] Always emit global equivalents if there is non-global uses (#145648)

A case found from https://github.com/rust-lang/rust/issues/142752:
https://llvm.godbolt.org/z/T7ce9saWh.

We should emit `@bar_0` for the following code:

```llvm
target triple = "x86_64-unknown-linux-gnu"

@rel_0 = private unnamed_addr constant [1 x i32] [
  i32 trunc (i64 sub (i64 ptrtoint (ptr @bar_0 to i64), i64 ptrtoint (ptr @rel_0 to i64)) to i32)]
@bar_0 = internal unnamed_addr constant ptr @foo_0, align 8
@foo_0 = external global ptr, align 8

define void @foo(ptr %arg0) {
  store ptr @bar_0, ptr %arg0, align 8
  ret void
}
```



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