Skip to content

[RelLookupTableConverter] Drop unnamed_addr to avoid generating GOTPCREL relocations #142304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 1, 2025

Conversation

dianqk
Copy link
Member

@dianqk dianqk commented Jun 1, 2025

Follow #72584 (comment), the patch will drop the unnamed_addr attribute when generating relative lookup tables. I'm not very confident about this patch, but it does resolve rust-lang/rust#140686, rust-lang/rust#141306 and rust-lang/rust#141737.

But I don't think this will result in worse problems.

LLVM provides that the calculation of such a constant initializer will not overflow at link time under the medium code model if x is an unnamed_addr function. However, it does not provide this guarantee for a constant initializer folded into a function body. This intrinsic can be used to avoid the possibility of overflows when loading from such a constant. (‘llvm.load.relative’ Intrinsic)

This is my concern. I'm not sure how unnamed_addr provides this guarantee, and I haven't found any test cases.

@dianqk dianqk requested review from nikic and MaskRay June 1, 2025 09:06
@llvmbot
Copy link
Member

llvmbot commented Jun 1, 2025

@llvm/pr-subscribers-llvm-transforms

Author: dianqk (dianqk)

Changes

Follow #72584 (comment), the patch will drop the unnamed_addr attribute when generating relative lookup tables. I'm not very confident about this patch, but it does resolve rust-lang/rust#140686, rust-lang/rust#141306 and rust-lang/rust#141737.

But I don't think this will result in worse problems.

> LLVM provides that the calculation of such a constant initializer will not overflow at link time under the medium code model if x is an unnamed_addr function. However, it does not provide this guarantee for a constant initializer folded into a function body. This intrinsic can be used to avoid the possibility of overflows when loading from such a constant. (‘llvm.load.relative’ Intrinsic)

This is my concern. I'm not sure how unnamed_addr provides this guarantee, and I haven't found any test cases.


Full diff: https://github.com/llvm/llvm-project/pull/142304.diff

2 Files Affected:

  • (modified) llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp (+5)
  • (added) llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll (+88)
diff --git a/llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp b/llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp
index 2700b4307308c..8bad67044bea4 100644
--- a/llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp
+++ b/llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp
@@ -110,6 +110,11 @@ static GlobalVariable *createRelLookupTable(Function &Func,
 
   for (Use &Operand : LookupTableArr->operands()) {
     Constant *Element = cast<Constant>(Operand);
+    // Drop unnamed_addr to avoid matching pattern in
+    // `handleIndirectSymViaGOTPCRel`, which creates GOTPCREL relocations not
+    // supported by the GNU linker and LLD versions below 18 on aarch64.
+    if (auto *GlobalElement = dyn_cast<GlobalValue>(Element))
+      GlobalElement->setUnnamedAddr(GlobalValue::UnnamedAddr::None);
     Type *IntPtrTy = M.getDataLayout().getIntPtrType(M.getContext());
     Constant *Base = llvm::ConstantExpr::getPtrToInt(RelLookupTable, IntPtrTy);
     Constant *Target = llvm::ConstantExpr::getPtrToInt(Element, IntPtrTy);
diff --git a/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll b/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll
new file mode 100644
index 0000000000000..748d7522c1097
--- /dev/null
+++ b/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll
@@ -0,0 +1,88 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 5
+; RUN: opt < %s -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64 -S | FileCheck -check-prefix=x86_64 %s
+; RUN: opt < %s -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=aarch64 -S | FileCheck -check-prefix=aarch64 %s
+
+@a0 = private unnamed_addr constant i32 0
+@a1 = private unnamed_addr constant i32 1
+@a2 = private unnamed_addr constant i32 2
+@load_relative_1.table = private unnamed_addr constant [3 x ptr] [ptr @a0, ptr @a1, ptr @a2]
+
+@x0 = internal unnamed_addr constant i64 0
+@x1 = internal unnamed_addr constant i64 1
+@x2 = internal unnamed_addr constant i64 2
+@x3 = internal unnamed_addr constant i64 3
+@y0 = internal unnamed_addr constant ptr @x3
+@y1 = internal unnamed_addr constant ptr @x2
+@y2 = internal unnamed_addr constant ptr @x1
+@y3 = internal unnamed_addr constant ptr @x0
+@load_relative_2.table = private unnamed_addr constant [4 x ptr] [ptr @y3, ptr @y2, ptr @y1, ptr @y0]
+
+;.
+; x86_64: @a0 = private constant i32 0
+; x86_64: @a1 = private constant i32 1
+; x86_64: @a2 = private constant i32 2
+; x86_64: @load_relative_1.table.rel = private unnamed_addr constant [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @a0 to i64), i64 ptrtoint (ptr @load_relative_1.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @a1 to i64), i64 ptrtoint (ptr @load_relative_1.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @a2 to i64), i64 ptrtoint (ptr @load_relative_1.table.rel to i64)) to i32)], align 4
+; x86_64: @x0 = internal unnamed_addr constant i64 0
+; x86_64: @x1 = internal unnamed_addr constant i64 1
+; x86_64: @x2 = internal unnamed_addr constant i64 2
+; x86_64: @x3 = internal unnamed_addr constant i64 3
+; x86_64: @y0 = internal constant ptr @x3
+; x86_64: @y1 = internal constant ptr @x2
+; x86_64: @y2 = internal constant ptr @x1
+; x86_64: @y3 = internal constant ptr @x0
+; x86_64: @load_relative_2.table.rel = private unnamed_addr constant [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @y3 to i64), i64 ptrtoint (ptr @load_relative_2.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @y2 to i64), i64 ptrtoint (ptr @load_relative_2.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @y1 to i64), i64 ptrtoint (ptr @load_relative_2.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @y0 to i64), i64 ptrtoint (ptr @load_relative_2.table.rel to i64)) to i32)], align 4
+;.
+; aarch64: @a0 = private constant i32 0
+; aarch64: @a1 = private constant i32 1
+; aarch64: @a2 = private constant i32 2
+; aarch64: @load_relative_1.table.rel = private unnamed_addr constant [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @a0 to i64), i64 ptrtoint (ptr @load_relative_1.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @a1 to i64), i64 ptrtoint (ptr @load_relative_1.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @a2 to i64), i64 ptrtoint (ptr @load_relative_1.table.rel to i64)) to i32)], align 4
+; aarch64: @x0 = internal unnamed_addr constant i64 0
+; aarch64: @x1 = internal unnamed_addr constant i64 1
+; aarch64: @x2 = internal unnamed_addr constant i64 2
+; aarch64: @x3 = internal unnamed_addr constant i64 3
+; aarch64: @y0 = internal constant ptr @x3
+; aarch64: @y1 = internal constant ptr @x2
+; aarch64: @y2 = internal constant ptr @x1
+; aarch64: @y3 = internal constant ptr @x0
+; aarch64: @load_relative_2.table.rel = private unnamed_addr constant [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @y3 to i64), i64 ptrtoint (ptr @load_relative_2.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @y2 to i64), i64 ptrtoint (ptr @load_relative_2.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @y1 to i64), i64 ptrtoint (ptr @load_relative_2.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @y0 to i64), i64 ptrtoint (ptr @load_relative_2.table.rel to i64)) to i32)], align 4
+;.
+define ptr @load_relative_1(i64 %offset) {
+; x86_64-LABEL: define ptr @load_relative_1(
+; x86_64-SAME: i64 [[OFFSET:%.*]]) {
+; x86_64-NEXT:    [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
+; x86_64-NEXT:    [[RELTABLE_INTRINSIC:%.*]] = call ptr @llvm.load.relative.i64(ptr @load_relative_1.table.rel, i64 [[RELTABLE_SHIFT]])
+; x86_64-NEXT:    ret ptr [[RELTABLE_INTRINSIC]]
+;
+; aarch64-LABEL: define ptr @load_relative_1(
+; aarch64-SAME: i64 [[OFFSET:%.*]]) {
+; aarch64-NEXT:    [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
+; aarch64-NEXT:    [[RELTABLE_INTRINSIC:%.*]] = call ptr @llvm.load.relative.i64(ptr @load_relative_1.table.rel, i64 [[RELTABLE_SHIFT]])
+; aarch64-NEXT:    ret ptr [[RELTABLE_INTRINSIC]]
+;
+  %gep = getelementptr inbounds [3 x ptr], ptr @load_relative_1.table, i64 0, i64 %offset
+  %load = load ptr, ptr %gep
+  ret ptr %load
+}
+
+define ptr @load_relative_2(i64 %offset) {
+; x86_64-LABEL: define ptr @load_relative_2(
+; x86_64-SAME: i64 [[OFFSET:%.*]]) {
+; x86_64-NEXT:    [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
+; x86_64-NEXT:    [[RELTABLE_INTRINSIC:%.*]] = call ptr @llvm.load.relative.i64(ptr @load_relative_2.table.rel, i64 [[RELTABLE_SHIFT]])
+; x86_64-NEXT:    ret ptr [[RELTABLE_INTRINSIC]]
+;
+; aarch64-LABEL: define ptr @load_relative_2(
+; aarch64-SAME: i64 [[OFFSET:%.*]]) {
+; aarch64-NEXT:    [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
+; aarch64-NEXT:    [[RELTABLE_INTRINSIC:%.*]] = call ptr @llvm.load.relative.i64(ptr @load_relative_2.table.rel, i64 [[RELTABLE_SHIFT]])
+; aarch64-NEXT:    ret ptr [[RELTABLE_INTRINSIC]]
+;
+  %gep = getelementptr inbounds [4 x ptr], ptr @load_relative_2.table, i64 0, i64 %offset
+  %load = load ptr, ptr %gep
+  ret ptr %load
+}
+;.
+; x86_64: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
+;.
+; aarch64: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
+;.

@dianqk dianqk changed the title [RelLookupTableConverter] Drop unnamed_addr to avoid creating GOTPCREL relocations [RelLookupTableConverter] Drop unnamed_addr to avoid generating GOTPCREL relocations Jun 1, 2025
@@ -110,6 +110,11 @@ static GlobalVariable *createRelLookupTable(Function &Func,

for (Use &Operand : LookupTableArr->operands()) {
Constant *Element = cast<Constant>(Operand);
// Drop unnamed_addr to avoid matching pattern in
// `handleIndirectSymViaGOTPCRel`, which generates GOTPCREL relocations not
// supported by the GNU linker and LLD versions below 18 on aarch64.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we are working around problems with specific linkers on specific platforms, we should add triple checks like you originally had, for aarch64 and for x86-darwin (and list which linker versions are affected, so this can be removed in the future).

Does BFD not support GOTPCREL on aarch64 even in the newest version?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does BFD not support GOTPCREL on aarch64 even in the newest version?

Probably nobody noticed this.

 /nix/...-binutils-aarch64-unknown-linux-gnu-2.44/bin/ld: /path/1.rcgu.o: unrecognized relocation type 0x13b in section `.rodata..Lswitch.table.bad.rel'
          /nix/...-binutils-aarch64-unknown-linux-gnu-2.44/bin/ld: is this version of the linker - (GNU Binutils) 2.44 - out of date ?
          /nix/...-binutils-aarch64-unknown-linux-gnu-2.44/bin/ld: final link failed: bad value
          collect2: error: ld returned 1 exit status

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh. It would be good to file a bug for that...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh. It would be good to file a bug for that...

I'm still in the process of creating an account. :\ (https://sourceware.org/bugzilla/createaccount.cgi)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dianqk dianqk merged commit aa09dbb into llvm:main Jun 1, 2025
11 checks passed
@dianqk dianqk deleted the rel-got branch June 1, 2025 14:18
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 1, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-sie-ubuntu-fast running on sie-linux-worker while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/144/builds/26573

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Transforms/RelLookupTableConverter/unnamed_addr.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/opt < /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S | /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/FileCheck -check-prefix=x86_64-apple-darwin /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll # RUN: at line 2
+ /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/FileCheck -check-prefix=x86_64-apple-darwin /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll
+ /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/opt -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/opt < /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=aarch64 -S | /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/FileCheck -check-prefix=aarch64 /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll # RUN: at line 3
+ /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/FileCheck -check-prefix=aarch64 /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll
+ /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/opt -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=aarch64 -S
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/opt: warning: failed to infer data layout: unable to get target for 'aarch64', see --version and --triple.
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/opt: WARNING: failed to create target machine for 'aarch64': unable to get target for 'aarch64', see --version and --triple.
�[1m/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:36:12: �[0m�[0;1;31merror: �[0m�[1maarch64: expected string not found in input
�[0m; aarch64: @a0 = private constant i32 0
�[0;1;32m           ^
�[0m�[1m<stdin>:1:1: �[0m�[0;1;30mnote: �[0m�[1mscanning from here
�[0m; ModuleID = '<stdin>'
�[0;1;32m^
�[0m�[1m<stdin>:5:22: �[0m�[0;1;30mnote: �[0m�[1mpossible intended match here
�[0m@a0 = private unnamed_addr constant i32 0
�[0;1;32m                     ^
�[0m�[1m/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:73:17: �[0m�[0;1;31merror: �[0m�[1maarch64-NEXT: expected string not found in input
�[0m; aarch64-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
�[0;1;32m                ^
�[0m�[1m<stdin>:19:43: �[0m�[0;1;30mnote: �[0m�[1mscanning from here
�[0mdefine ptr @load_relative_1(i64 %offset) {
�[0;1;32m                                          ^
�[0m�[1m<stdin>:19:43: �[0m�[0;1;30mnote: �[0m�[1mwith "OFFSET" equal to "%offset"
�[0mdefine ptr @load_relative_1(i64 %offset) {
�[0;1;32m                                          ^
�[0m�[1m<stdin>:20:59: �[0m�[0;1;30mnote: �[0m�[1mpossible intended match here
�[0m %gep = getelementptr inbounds [3 x ptr], ptr @load_relative_1.table, i64 0, i64 %offset
�[0;1;32m                                                          ^
�[0m�[1m/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:97:17: �[0m�[0;1;31merror: �[0m�[1maarch64-NEXT: expected string not found in input
�[0m; aarch64-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
�[0;1;32m                ^
�[0m�[1m<stdin>:25:43: �[0m�[0;1;30mnote: �[0m�[1mscanning from here
�[0mdefine ptr @load_relative_2(i64 %offset) {
�[0;1;32m                                          ^
�[0m�[1m<stdin>:25:43: �[0m�[0;1;30mnote: �[0m�[1mwith "OFFSET" equal to "%offset"
�[0mdefine ptr @load_relative_2(i64 %offset) {
�[0;1;32m                                          ^
�[0m�[1m<stdin>:26:59: �[0m�[0;1;30mnote: �[0m�[1mpossible intended match here
�[0m %gep = getelementptr inbounds [4 x ptr], ptr @load_relative_2.table, i64 0, i64 %offset
�[0;1;32m                                                          ^
�[0m
Input file: <stdin>
Check file: /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 1, 2025

LLVM Buildbot has detected a new failure on builder arc-builder running on arc-worker while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/3/builds/16826

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Transforms/RelLookupTableConverter/unnamed_addr.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/buildbot/worker/arc-folder/build/bin/opt < /buildbot/worker/arc-folder/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S | /buildbot/worker/arc-folder/build/bin/FileCheck -check-prefix=x86_64-apple-darwin /buildbot/worker/arc-folder/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll # RUN: at line 2
+ /buildbot/worker/arc-folder/build/bin/opt -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S
+ /buildbot/worker/arc-folder/build/bin/FileCheck -check-prefix=x86_64-apple-darwin /buildbot/worker/arc-folder/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll
/buildbot/worker/arc-folder/build/bin/opt < /buildbot/worker/arc-folder/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=aarch64 -S | /buildbot/worker/arc-folder/build/bin/FileCheck -check-prefix=aarch64 /buildbot/worker/arc-folder/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll # RUN: at line 3
+ /buildbot/worker/arc-folder/build/bin/opt -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=aarch64 -S
/buildbot/worker/arc-folder/build/bin/opt: warning: failed to infer data layout: unable to get target for 'aarch64', see --version and --triple.
/buildbot/worker/arc-folder/build/bin/opt: WARNING: failed to create target machine for 'aarch64': unable to get target for 'aarch64', see --version and --triple.
+ /buildbot/worker/arc-folder/build/bin/FileCheck -check-prefix=aarch64 /buildbot/worker/arc-folder/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll
/buildbot/worker/arc-folder/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:36:12: error: aarch64: expected string not found in input
; aarch64: @a0 = private constant i32 0
           ^
<stdin>:1:1: note: scanning from here
; ModuleID = '<stdin>'
^
<stdin>:5:22: note: possible intended match here
@a0 = private unnamed_addr constant i32 0
                     ^
/buildbot/worker/arc-folder/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:73:17: error: aarch64-NEXT: expected string not found in input
; aarch64-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
                ^
<stdin>:19:43: note: scanning from here
define ptr @load_relative_1(i64 %offset) {
                                          ^
<stdin>:19:43: note: with "OFFSET" equal to "%offset"
define ptr @load_relative_1(i64 %offset) {
                                          ^
<stdin>:20:59: note: possible intended match here
 %gep = getelementptr inbounds [3 x ptr], ptr @load_relative_1.table, i64 0, i64 %offset
                                                          ^
/buildbot/worker/arc-folder/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:97:17: error: aarch64-NEXT: expected string not found in input
; aarch64-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
                ^
<stdin>:25:43: note: scanning from here
define ptr @load_relative_2(i64 %offset) {
                                          ^
<stdin>:25:43: note: with "OFFSET" equal to "%offset"
define ptr @load_relative_2(i64 %offset) {
                                          ^
<stdin>:26:59: note: possible intended match here
 %gep = getelementptr inbounds [4 x ptr], ptr @load_relative_2.table, i64 0, i64 %offset
                                                          ^

Input file: <stdin>
Check file: /buildbot/worker/arc-folder/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 1, 2025

LLVM Buildbot has detected a new failure on builder clang-m68k-linux-cross running on suse-gary-m68k-cross while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/27/builds/10902

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: Transforms/RelLookupTableConverter/unnamed_addr.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/opt < /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S | /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/FileCheck -check-prefix=x86_64-apple-darwin /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll # RUN: at line 2
+ /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/opt -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S
+ /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/FileCheck -check-prefix=x86_64-apple-darwin /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/opt < /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=aarch64 -S | /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/FileCheck -check-prefix=aarch64 /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll # RUN: at line 3
+ /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/opt -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=aarch64 -S
+ /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/FileCheck -check-prefix=aarch64 /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/opt: warning: failed to infer data layout: unable to get target for 'aarch64', see --version and --triple.
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/opt: WARNING: failed to create target machine for 'aarch64': unable to get target for 'aarch64', see --version and --triple.
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:36:12: error: aarch64: expected string not found in input
; aarch64: @a0 = private constant i32 0
           ^
<stdin>:1:1: note: scanning from here
; ModuleID = '<stdin>'
^
<stdin>:5:22: note: possible intended match here
@a0 = private unnamed_addr constant i32 0
                     ^
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:73:17: error: aarch64-NEXT: expected string not found in input
; aarch64-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
                ^
<stdin>:19:43: note: scanning from here
define ptr @load_relative_1(i64 %offset) {
                                          ^
<stdin>:19:43: note: with "OFFSET" equal to "%offset"
define ptr @load_relative_1(i64 %offset) {
                                          ^
<stdin>:20:59: note: possible intended match here
 %gep = getelementptr inbounds [3 x ptr], ptr @load_relative_1.table, i64 0, i64 %offset
                                                          ^
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:97:17: error: aarch64-NEXT: expected string not found in input
; aarch64-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
                ^
<stdin>:25:43: note: scanning from here
define ptr @load_relative_2(i64 %offset) {
                                          ^
<stdin>:25:43: note: with "OFFSET" equal to "%offset"
define ptr @load_relative_2(i64 %offset) {
                                          ^
<stdin>:26:59: note: possible intended match here
 %gep = getelementptr inbounds [4 x ptr], ptr @load_relative_2.table, i64 0, i64 %offset
                                                          ^

Input file: <stdin>
Check file: /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 1, 2025

LLVM Buildbot has detected a new failure on builder openmp-offload-amdgpu-runtime-2 running on rocm-worker-hw-02 while building llvm at step 8 "Add check check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/10/builds/6454

Here is the relevant piece of the build log for the reference
Step 8 (Add check check-llvm) failure: test (failure)
******************** TEST 'LLVM :: Transforms/RelLookupTableConverter/unnamed_addr.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/opt < /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S | /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/FileCheck -check-prefix=x86_64-apple-darwin /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll # RUN: at line 2
+ /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/opt -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S
+ /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/FileCheck -check-prefix=x86_64-apple-darwin /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/opt < /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=aarch64 -S | /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/FileCheck -check-prefix=aarch64 /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll # RUN: at line 3
+ /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/opt -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=aarch64 -S
+ /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/FileCheck -check-prefix=aarch64 /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/opt: warning: failed to infer data layout: unable to get target for 'aarch64', see --version and --triple.
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/opt: WARNING: failed to create target machine for 'aarch64': unable to get target for 'aarch64', see --version and --triple.
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:36:12: error: aarch64: expected string not found in input
; aarch64: @a0 = private constant i32 0
           ^
<stdin>:1:1: note: scanning from here
; ModuleID = '<stdin>'
^
<stdin>:5:22: note: possible intended match here
@a0 = private unnamed_addr constant i32 0
                     ^
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:73:17: error: aarch64-NEXT: expected string not found in input
; aarch64-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
                ^
<stdin>:19:43: note: scanning from here
define ptr @load_relative_1(i64 %offset) {
                                          ^
<stdin>:19:43: note: with "OFFSET" equal to "%offset"
define ptr @load_relative_1(i64 %offset) {
                                          ^
<stdin>:20:59: note: possible intended match here
 %gep = getelementptr inbounds [3 x ptr], ptr @load_relative_1.table, i64 0, i64 %offset
                                                          ^
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:97:17: error: aarch64-NEXT: expected string not found in input
; aarch64-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
                ^
<stdin>:25:43: note: scanning from here
define ptr @load_relative_2(i64 %offset) {
                                          ^
<stdin>:25:43: note: with "OFFSET" equal to "%offset"
define ptr @load_relative_2(i64 %offset) {
                                          ^
<stdin>:26:59: note: possible intended match here
 %gep = getelementptr inbounds [4 x ptr], ptr @load_relative_2.table, i64 0, i64 %offset
                                                          ^

Input file: <stdin>
Check file: /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 1, 2025

LLVM Buildbot has detected a new failure on builder clang-aarch64-quick running on linaro-clang-aarch64-quick while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/65/builds/17506

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: Transforms/RelLookupTableConverter/unnamed_addr.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/opt < /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S | /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/FileCheck -check-prefix=x86_64-apple-darwin /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll # RUN: at line 2
+ /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/opt -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S
+ /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/FileCheck -check-prefix=x86_64-apple-darwin /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll
/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/opt: warning: failed to infer data layout: unable to get target for 'x86_64-apple-darwin', see --version and --triple.
/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/opt: WARNING: failed to create target machine for 'x86_64-apple-darwin': unable to get target for 'x86_64-apple-darwin', see --version and --triple.
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:22:24: error: x86_64-apple-darwin: expected string not found in input
; x86_64-apple-darwin: @a0 = private constant i32 0
                       ^
<stdin>:1:1: note: scanning from here
; ModuleID = '<stdin>'
^
<stdin>:5:22: note: possible intended match here
@a0 = private unnamed_addr constant i32 0
                     ^
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:67:29: error: x86_64-apple-darwin-NEXT: expected string not found in input
; x86_64-apple-darwin-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
                            ^
<stdin>:19:43: note: scanning from here
define ptr @load_relative_1(i64 %offset) {
                                          ^
<stdin>:19:43: note: with "OFFSET" equal to "%offset"
define ptr @load_relative_1(i64 %offset) {
                                          ^
<stdin>:20:59: note: possible intended match here
 %gep = getelementptr inbounds [3 x ptr], ptr @load_relative_1.table, i64 0, i64 %offset
                                                          ^
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:91:29: error: x86_64-apple-darwin-NEXT: expected string not found in input
; x86_64-apple-darwin-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
                            ^
<stdin>:25:43: note: scanning from here
define ptr @load_relative_2(i64 %offset) {
                                          ^
<stdin>:25:43: note: with "OFFSET" equal to "%offset"
define ptr @load_relative_2(i64 %offset) {
                                          ^
<stdin>:26:59: note: possible intended match here
 %gep = getelementptr inbounds [4 x ptr], ptr @load_relative_2.table, i64 0, i64 %offset
                                                          ^

Input file: <stdin>
Check file: /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll

-dump-input=help explains the following input dump.

Input was:
...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need REQUIRES: x86-registered-target and REQUIRES: aarch64-registered-target.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, added: de7f2fb

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 1, 2025

LLVM Buildbot has detected a new failure on builder openmp-offload-sles-build-only running on rocm-worker-hw-04-sles while building llvm at step 9 "Add check check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/140/builds/24193

Here is the relevant piece of the build log for the reference
Step 9 (Add check check-llvm) failure: test (failure)
******************** TEST 'LLVM :: Transforms/RelLookupTableConverter/unnamed_addr.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/opt < /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S | /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck -check-prefix=x86_64-apple-darwin /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll # RUN: at line 2
+ /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/opt -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S
+ /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck -check-prefix=x86_64-apple-darwin /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/opt < /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=aarch64 -S | /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck -check-prefix=aarch64 /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll # RUN: at line 3
+ /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/opt -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=aarch64 -S
+ /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck -check-prefix=aarch64 /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/opt: warning: failed to infer data layout: unable to get target for 'aarch64', see --version and --triple.
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/opt: WARNING: failed to create target machine for 'aarch64': unable to get target for 'aarch64', see --version and --triple.
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:36:12: error: aarch64: expected string not found in input
; aarch64: @a0 = private constant i32 0
           ^
<stdin>:1:1: note: scanning from here
; ModuleID = '<stdin>'
^
<stdin>:5:22: note: possible intended match here
@a0 = private unnamed_addr constant i32 0
                     ^
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:73:17: error: aarch64-NEXT: expected string not found in input
; aarch64-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
                ^
<stdin>:19:43: note: scanning from here
define ptr @load_relative_1(i64 %offset) {
                                          ^
<stdin>:19:43: note: with "OFFSET" equal to "%offset"
define ptr @load_relative_1(i64 %offset) {
                                          ^
<stdin>:20:59: note: possible intended match here
 %gep = getelementptr inbounds [3 x ptr], ptr @load_relative_1.table, i64 0, i64 %offset
                                                          ^
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:97:17: error: aarch64-NEXT: expected string not found in input
; aarch64-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
                ^
<stdin>:25:43: note: scanning from here
define ptr @load_relative_2(i64 %offset) {
                                          ^
<stdin>:25:43: note: with "OFFSET" equal to "%offset"
define ptr @load_relative_2(i64 %offset) {
                                          ^
<stdin>:26:59: note: possible intended match here
 %gep = getelementptr inbounds [4 x ptr], ptr @load_relative_2.table, i64 0, i64 %offset
                                                          ^

Input file: <stdin>
Check file: /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 1, 2025

LLVM Buildbot has detected a new failure on builder clang-cmake-x86_64-avx512-linux running on avx512-intel64 while building llvm at step 7 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/133/builds/17092

Here is the relevant piece of the build log for the reference
Step 7 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: Transforms/RelLookupTableConverter/unnamed_addr.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/opt < /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S | /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/FileCheck -check-prefix=x86_64-apple-darwin /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll # RUN: at line 2
+ /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/opt -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S
+ /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/FileCheck -check-prefix=x86_64-apple-darwin /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/opt < /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=aarch64 -S | /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/FileCheck -check-prefix=aarch64 /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll # RUN: at line 3
+ /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/opt -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=aarch64 -S
+ /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/FileCheck -check-prefix=aarch64 /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/opt: warning: failed to infer data layout: unable to get target for 'aarch64', see --version and --triple.
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/stage1/bin/opt: WARNING: failed to create target machine for 'aarch64': unable to get target for 'aarch64', see --version and --triple.
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:36:12: error: aarch64: expected string not found in input
; aarch64: @a0 = private constant i32 0
           ^
<stdin>:1:1: note: scanning from here
; ModuleID = '<stdin>'
^
<stdin>:5:22: note: possible intended match here
@a0 = private unnamed_addr constant i32 0
                     ^
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:73:17: error: aarch64-NEXT: expected string not found in input
; aarch64-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
                ^
<stdin>:19:43: note: scanning from here
define ptr @load_relative_1(i64 %offset) {
                                          ^
<stdin>:19:43: note: with "OFFSET" equal to "%offset"
define ptr @load_relative_1(i64 %offset) {
                                          ^
<stdin>:20:59: note: possible intended match here
 %gep = getelementptr inbounds [3 x ptr], ptr @load_relative_1.table, i64 0, i64 %offset
                                                          ^
/localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:97:17: error: aarch64-NEXT: expected string not found in input
; aarch64-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
                ^
<stdin>:25:43: note: scanning from here
define ptr @load_relative_2(i64 %offset) {
                                          ^
<stdin>:25:43: note: with "OFFSET" equal to "%offset"
define ptr @load_relative_2(i64 %offset) {
                                          ^
<stdin>:26:59: note: possible intended match here
 %gep = getelementptr inbounds [4 x ptr], ptr @load_relative_2.table, i64 0, i64 %offset
                                                          ^

Input file: <stdin>
Check file: /localdisk2/buildbot/llvm-worker/clang-cmake-x86_64-avx512-linux/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 1, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-sie-win running on sie-win-worker while building llvm at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/46/builds/17728

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Transforms/RelLookupTableConverter/unnamed_addr.ll' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
z:\b\llvm-clang-x86_64-sie-win\build\bin\opt.exe < Z:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\Transforms\RelLookupTableConverter\unnamed_addr.ll -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S | z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe -check-prefix=x86_64-apple-darwin Z:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\Transforms\RelLookupTableConverter\unnamed_addr.ll
# executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\opt.exe' -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S
# note: command had no output on stdout or stderr
# executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe' -check-prefix=x86_64-apple-darwin 'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\Transforms\RelLookupTableConverter\unnamed_addr.ll'
# note: command had no output on stdout or stderr
# RUN: at line 3
z:\b\llvm-clang-x86_64-sie-win\build\bin\opt.exe < Z:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\Transforms\RelLookupTableConverter\unnamed_addr.ll -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=aarch64 -S | z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe -check-prefix=aarch64 Z:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\Transforms\RelLookupTableConverter\unnamed_addr.ll
# executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\opt.exe' -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=aarch64 -S
# .---command stderr------------
# | z:\b\llvm-clang-x86_64-sie-win\build\bin\opt.exe: warning: failed to infer data layout: unable to get target for 'aarch64', see --version and --triple.
# | z:\b\llvm-clang-x86_64-sie-win\build\bin\opt.exe: WARNING: failed to create target machine for 'aarch64': unable to get target for 'aarch64', see --version and --triple.
# `-----------------------------
# executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe' -check-prefix=aarch64 'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\Transforms\RelLookupTableConverter\unnamed_addr.ll'
# .---command stderr------------
# | �[1mZ:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\Transforms\RelLookupTableConverter\unnamed_addr.ll:36:12: �[0m�[0;1;31merror: �[0m�[1maarch64: expected string not found in input
�[0m# | �[1m�[0m; aarch64: @a0 = private constant i32 0
# | �[0;1;32m           ^
�[0m# | �[0;1;32m�[0m�[1m<stdin>:1:1: �[0m�[0;1;30mnote: �[0m�[1mscanning from here
�[0m# | �[1m�[0m; ModuleID = '<stdin>'
# | �[0;1;32m^
�[0m# | �[0;1;32m�[0m�[1m<stdin>:5:22: �[0m�[0;1;30mnote: �[0m�[1mpossible intended match here
�[0m# | �[1m�[0m@a0 = private unnamed_addr constant i32 0
# | �[0;1;32m                     ^
�[0m# | �[0;1;32m�[0m�[1mZ:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\Transforms\RelLookupTableConverter\unnamed_addr.ll:73:17: �[0m�[0;1;31merror: �[0m�[1maarch64-NEXT: expected string not found in input
�[0m# | �[1m�[0m; aarch64-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
# | �[0;1;32m                ^
�[0m# | �[0;1;32m�[0m�[1m<stdin>:19:43: �[0m�[0;1;30mnote: �[0m�[1mscanning from here
�[0m# | �[1m�[0mdefine ptr @load_relative_1(i64 %offset) {
# | �[0;1;32m                                          ^
�[0m# | �[0;1;32m�[0m�[1m<stdin>:19:43: �[0m�[0;1;30mnote: �[0m�[1mwith "OFFSET" equal to "%offset"
�[0m# | �[1m�[0mdefine ptr @load_relative_1(i64 %offset) {
# | �[0;1;32m                                          ^
�[0m# | �[0;1;32m�[0m�[1m<stdin>:20:59: �[0m�[0;1;30mnote: �[0m�[1mpossible intended match here
�[0m# | �[1m�[0m %gep = getelementptr inbounds [3 x ptr], ptr @load_relative_1.table, i64 0, i64 %offset
# | �[0;1;32m                                                          ^
�[0m# | �[0;1;32m�[0m�[1mZ:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\Transforms\RelLookupTableConverter\unnamed_addr.ll:97:17: �[0m�[0;1;31merror: �[0m�[1maarch64-NEXT: expected string not found in input
�[0m# | �[1m�[0m; aarch64-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
# | �[0;1;32m                ^
�[0m# | �[0;1;32m�[0m�[1m<stdin>:25:43: �[0m�[0;1;30mnote: �[0m�[1mscanning from here
�[0m# | �[1m�[0mdefine ptr @load_relative_2(i64 %offset) {
# | �[0;1;32m                                          ^
�[0m# | �[0;1;32m�[0m�[1m<stdin>:25:43: �[0m�[0;1;30mnote: �[0m�[1mwith "OFFSET" equal to "%offset"
�[0m# | �[1m�[0mdefine ptr @load_relative_2(i64 %offset) {
# | �[0;1;32m                                          ^
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 1, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-aarch64-darwin running on doug-worker-4 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/20928

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Transforms/RelLookupTableConverter/unnamed_addr.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/opt < /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S | /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck -check-prefix=x86_64-apple-darwin /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll # RUN: at line 2
+ /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/opt -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S
+ /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck -check-prefix=x86_64-apple-darwin /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll
/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/opt: warning: failed to infer data layout: unable to get target for 'x86_64-apple-darwin', see --version and --triple.
/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/opt: WARNING: failed to create target machine for 'x86_64-apple-darwin': unable to get target for 'x86_64-apple-darwin', see --version and --triple.
�[1m/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:22:24: �[0m�[0;1;31merror: �[0m�[1mx86_64-apple-darwin: expected string not found in input
�[0m; x86_64-apple-darwin: @a0 = private constant i32 0
�[0;1;32m                       ^
�[0m�[1m<stdin>:1:1: �[0m�[0;1;30mnote: �[0m�[1mscanning from here
�[0m; ModuleID = '<stdin>'
�[0;1;32m^
�[0m�[1m<stdin>:5:22: �[0m�[0;1;30mnote: �[0m�[1mpossible intended match here
�[0m@a0 = private unnamed_addr constant i32 0
�[0;1;32m                     ^
�[0m�[1m/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:67:29: �[0m�[0;1;31merror: �[0m�[1mx86_64-apple-darwin-NEXT: expected string not found in input
�[0m; x86_64-apple-darwin-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
�[0;1;32m                            ^
�[0m�[1m<stdin>:19:43: �[0m�[0;1;30mnote: �[0m�[1mscanning from here
�[0mdefine ptr @load_relative_1(i64 %offset) {
�[0;1;32m                                          ^
�[0m�[1m<stdin>:19:43: �[0m�[0;1;30mnote: �[0m�[1mwith "OFFSET" equal to "%offset"
�[0mdefine ptr @load_relative_1(i64 %offset) {
�[0;1;32m                                          ^
�[0m�[1m<stdin>:20:59: �[0m�[0;1;30mnote: �[0m�[1mpossible intended match here
�[0m %gep = getelementptr inbounds [3 x ptr], ptr @load_relative_1.table, i64 0, i64 %offset
�[0;1;32m                                                          ^
�[0m�[1m/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:91:29: �[0m�[0;1;31merror: �[0m�[1mx86_64-apple-darwin-NEXT: expected string not found in input
�[0m; x86_64-apple-darwin-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
�[0;1;32m                            ^
�[0m�[1m<stdin>:25:43: �[0m�[0;1;30mnote: �[0m�[1mscanning from here
�[0mdefine ptr @load_relative_2(i64 %offset) {
�[0;1;32m                                          ^
�[0m�[1m<stdin>:25:43: �[0m�[0;1;30mnote: �[0m�[1mwith "OFFSET" equal to "%offset"
�[0mdefine ptr @load_relative_2(i64 %offset) {
�[0;1;32m                                          ^
�[0m�[1m<stdin>:26:59: �[0m�[0;1;30mnote: �[0m�[1mpossible intended match here
�[0m %gep = getelementptr inbounds [4 x ptr], ptr @load_relative_2.table, i64 0, i64 %offset
�[0;1;32m                                                          ^
�[0m
Input file: <stdin>
Check file: /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll

-dump-input=help explains the following input dump.

Input was:
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 1, 2025

LLVM Buildbot has detected a new failure on builder clang-armv8-quick running on linaro-clang-armv8-quick while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/154/builds/16878

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: Transforms/RelLookupTableConverter/unnamed_addr.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/opt < /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S | /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/FileCheck -check-prefix=x86_64-apple-darwin /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll # RUN: at line 2
+ /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/opt -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S
+ /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/FileCheck -check-prefix=x86_64-apple-darwin /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll
/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/opt: warning: failed to infer data layout: unable to get target for 'x86_64-apple-darwin', see --version and --triple.
/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/opt: WARNING: failed to create target machine for 'x86_64-apple-darwin': unable to get target for 'x86_64-apple-darwin', see --version and --triple.
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:22:24: error: x86_64-apple-darwin: expected string not found in input
; x86_64-apple-darwin: @a0 = private constant i32 0
                       ^
<stdin>:1:1: note: scanning from here
; ModuleID = '<stdin>'
^
<stdin>:5:22: note: possible intended match here
@a0 = private unnamed_addr constant i32 0
                     ^
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:67:29: error: x86_64-apple-darwin-NEXT: expected string not found in input
; x86_64-apple-darwin-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
                            ^
<stdin>:19:43: note: scanning from here
define ptr @load_relative_1(i64 %offset) {
                                          ^
<stdin>:19:43: note: with "OFFSET" equal to "%offset"
define ptr @load_relative_1(i64 %offset) {
                                          ^
<stdin>:20:59: note: possible intended match here
 %gep = getelementptr inbounds [3 x ptr], ptr @load_relative_1.table, i64 0, i64 %offset
                                                          ^
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:91:29: error: x86_64-apple-darwin-NEXT: expected string not found in input
; x86_64-apple-darwin-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
                            ^
<stdin>:25:43: note: scanning from here
define ptr @load_relative_2(i64 %offset) {
                                          ^
<stdin>:25:43: note: with "OFFSET" equal to "%offset"
define ptr @load_relative_2(i64 %offset) {
                                          ^
<stdin>:26:59: note: possible intended match here
 %gep = getelementptr inbounds [4 x ptr], ptr @load_relative_2.table, i64 0, i64 %offset
                                                          ^

Input file: <stdin>
Check file: /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll

-dump-input=help explains the following input dump.

Input was:
...

dianqk added a commit to dianqk/llvm-project that referenced this pull request Jun 1, 2025
…REL relocations (llvm#142304)

Follow
llvm#72584 (comment),
the patch will drop the `unnamed_addr` attribute when generating
relative lookup tables. I'm not very confident about this patch, but it
does resolve rust-lang/rust#140686,
rust-lang/rust#141306 and
rust-lang/rust#141737.

But I don't think this will result in worse problems.

> LLVM provides that the calculation of such a constant initializer will
not overflow at link time under the medium code model if x is an
unnamed_addr function. However, it does not provide this guarantee for a
constant initializer folded into a function body. This intrinsic can be
used to avoid the possibility of overflows when loading from such a
constant. ([‘llvm.load.relative’
Intrinsic](https://llvm.org/docs/LangRef.html#id2592))

This is my concern. I'm not sure how unnamed_addr provides this
guarantee, and I haven't found any test cases.

(cherry picked from commit aa09dbb)
@dianqk
Copy link
Member Author

dianqk commented Jun 1, 2025

Backport PR: #142311.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 1, 2025

LLVM Buildbot has detected a new failure on builder llvm-nvptx-nvidia-ubuntu running on as-builder-7 while building llvm at step 6 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/180/builds/18582

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: Transforms/RelLookupTableConverter/unnamed_addr.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/bin/opt < /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S | /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/bin/FileCheck -check-prefix=x86_64-apple-darwin /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll # RUN: at line 2
+ /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/bin/opt -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S
+ /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/bin/FileCheck -check-prefix=x86_64-apple-darwin /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll
/home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/bin/opt < /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=aarch64 -S | /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/bin/FileCheck -check-prefix=aarch64 /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll # RUN: at line 3
+ /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/bin/opt -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=aarch64 -S
+ /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/bin/FileCheck -check-prefix=aarch64 /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll
/home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/bin/opt: warning: failed to infer data layout: unable to get target for 'aarch64', see --version and --triple.
/home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/bin/opt: WARNING: failed to create target machine for 'aarch64': unable to get target for 'aarch64', see --version and --triple.
/home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:36:12: error: aarch64: expected string not found in input
; aarch64: @a0 = private constant i32 0
           ^
<stdin>:1:1: note: scanning from here
; ModuleID = '<stdin>'
^
<stdin>:5:22: note: possible intended match here
@a0 = private unnamed_addr constant i32 0
                     ^
/home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:73:17: error: aarch64-NEXT: expected string not found in input
; aarch64-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
                ^
<stdin>:19:43: note: scanning from here
define ptr @load_relative_1(i64 %offset) {
                                          ^
<stdin>:19:43: note: with "OFFSET" equal to "%offset"
define ptr @load_relative_1(i64 %offset) {
                                          ^
<stdin>:20:59: note: possible intended match here
 %gep = getelementptr inbounds [3 x ptr], ptr @load_relative_1.table, i64 0, i64 %offset
                                                          ^
/home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:97:17: error: aarch64-NEXT: expected string not found in input
; aarch64-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
                ^
<stdin>:25:43: note: scanning from here
define ptr @load_relative_2(i64 %offset) {
                                          ^
<stdin>:25:43: note: with "OFFSET" equal to "%offset"
define ptr @load_relative_2(i64 %offset) {
                                          ^
<stdin>:26:59: note: possible intended match here
 %gep = getelementptr inbounds [4 x ptr], ptr @load_relative_2.table, i64 0, i64 %offset
                                                          ^

Input file: <stdin>
Check file: /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 1, 2025

LLVM Buildbot has detected a new failure on builder llvm-nvptx64-nvidia-ubuntu running on as-builder-7 while building llvm at step 6 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/160/builds/18439

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: Transforms/RelLookupTableConverter/unnamed_addr.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/bin/opt < /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S | /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/bin/FileCheck -check-prefix=x86_64-apple-darwin /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll # RUN: at line 2
+ /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/bin/opt -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=x86_64-apple-darwin -S
+ /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/bin/FileCheck -check-prefix=x86_64-apple-darwin /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll
/home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/bin/opt < /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=aarch64 -S | /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/bin/FileCheck -check-prefix=aarch64 /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll # RUN: at line 3
+ /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/bin/opt -passes=rel-lookup-table-converter -relocation-model=pic -mtriple=aarch64 -S
+ /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/bin/FileCheck -check-prefix=aarch64 /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll
/home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/bin/opt: warning: failed to infer data layout: unable to get target for 'aarch64', see --version and --triple.
/home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/bin/opt: WARNING: failed to create target machine for 'aarch64': unable to get target for 'aarch64', see --version and --triple.
/home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:36:12: error: aarch64: expected string not found in input
; aarch64: @a0 = private constant i32 0
           ^
<stdin>:1:1: note: scanning from here
; ModuleID = '<stdin>'
^
<stdin>:5:22: note: possible intended match here
@a0 = private unnamed_addr constant i32 0
                     ^
/home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:73:17: error: aarch64-NEXT: expected string not found in input
; aarch64-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
                ^
<stdin>:19:43: note: scanning from here
define ptr @load_relative_1(i64 %offset) {
                                          ^
<stdin>:19:43: note: with "OFFSET" equal to "%offset"
define ptr @load_relative_1(i64 %offset) {
                                          ^
<stdin>:20:59: note: possible intended match here
 %gep = getelementptr inbounds [3 x ptr], ptr @load_relative_1.table, i64 0, i64 %offset
                                                          ^
/home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll:97:17: error: aarch64-NEXT: expected string not found in input
; aarch64-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2
                ^
<stdin>:25:43: note: scanning from here
define ptr @load_relative_2(i64 %offset) {
                                          ^
<stdin>:25:43: note: with "OFFSET" equal to "%offset"
define ptr @load_relative_2(i64 %offset) {
                                          ^
<stdin>:26:59: note: possible intended match here
 %gep = getelementptr inbounds [4 x ptr], ptr @load_relative_2.table, i64 0, i64 %offset
                                                          ^

Input file: <stdin>
Check file: /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll

...

@PiJoules
Copy link
Contributor

PiJoules commented Jun 2, 2025

Rather than removing unnamed_addr, would it have been better to set SupportIndirectSymViaGOTPCRel in appropriately subclassed TargetLoweringObjectFile constructors?

@dianqk
Copy link
Member Author

dianqk commented Jun 2, 2025

Rather than removing unnamed_addr, would it have been better to set SupportIndirectSymViaGOTPCRel in appropriately subclassed TargetLoweringObjectFile constructors?

Does this sound like it will prevent the generation of all GOTPCRELs? This PR is to prevent "accidental" (we doesn't explicitly submit it) GOTPCREL generation.

@PiJoules
Copy link
Contributor

PiJoules commented Jun 2, 2025

Does this sound like it will prevent the generation of all GOTPCRELs? This PR is to prevent "accidental" (we doesn't explicitly submit it) GOTPCREL generation.

Oh yeah you're right. Disregard my last comment

swift-ci pushed a commit to swiftlang/llvm-project that referenced this pull request Jun 3, 2025
…REL relocations (llvm#142304)

Follow
llvm#72584 (comment),
the patch will drop the `unnamed_addr` attribute when generating
relative lookup tables. I'm not very confident about this patch, but it
does resolve rust-lang/rust#140686,
rust-lang/rust#141306 and
rust-lang/rust#141737.

But I don't think this will result in worse problems.

> LLVM provides that the calculation of such a constant initializer will
not overflow at link time under the medium code model if x is an
unnamed_addr function. However, it does not provide this guarantee for a
constant initializer folded into a function body. This intrinsic can be
used to avoid the possibility of overflows when loading from such a
constant. ([‘llvm.load.relative’
Intrinsic](https://llvm.org/docs/LangRef.html#id2592))

This is my concern. I'm not sure how unnamed_addr provides this
guarantee, and I haven't found any test cases.

(cherry picked from commit aa09dbb)
DhruvSrivastavaX pushed a commit to DhruvSrivastavaX/lldb-for-aix that referenced this pull request Jun 12, 2025
…REL relocations (llvm#142304)

Follow
llvm#72584 (comment),
the patch will drop the `unnamed_addr` attribute when generating
relative lookup tables. I'm not very confident about this patch, but it
does resolve rust-lang/rust#140686,
rust-lang/rust#141306 and
rust-lang/rust#141737.

But I don't think this will result in worse problems.

> LLVM provides that the calculation of such a constant initializer will
not overflow at link time under the medium code model if x is an
unnamed_addr function. However, it does not provide this guarantee for a
constant initializer folded into a function body. This intrinsic can be
used to avoid the possibility of overflows when loading from such a
constant. ([‘llvm.load.relative’
Intrinsic](https://llvm.org/docs/LangRef.html#id2592))

This is my concern. I'm not sure how unnamed_addr provides this
guarantee, and I haven't found any test cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

release builds using rustc 1.86.0 on macOS Ventura (intel) SDK exhibit incorrect behaviour
5 participants