[llvm] [test][LowerTypeTests] Re-generate jump table tests with --check-globals (PR #192734)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 13:53:33 PDT 2026


https://github.com/vitalybuka created https://github.com/llvm/llvm-project/pull/192734

Debug information will be updated in the text one, so we want to track the difference.


>From 2208b2ab3d0577260e49c58b13603a388485f651 Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Fri, 17 Apr 2026 13:53:16 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.7
---
 .../LowerTypeTests/aarch64-jumptable.ll       | 28 +++++--
 .../LowerTypeTests/x86-jumptable.ll           | 83 +++++++++++++++++--
 2 files changed, 94 insertions(+), 17 deletions(-)

diff --git a/llvm/test/Transforms/LowerTypeTests/aarch64-jumptable.ll b/llvm/test/Transforms/LowerTypeTests/aarch64-jumptable.ll
index 8a90174bb3ff1..b6dc739ce1e0c 100644
--- a/llvm/test/Transforms/LowerTypeTests/aarch64-jumptable.ll
+++ b/llvm/test/Transforms/LowerTypeTests/aarch64-jumptable.ll
@@ -1,4 +1,4 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes --include-generated-funcs --version 2
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes --check-globals --include-generated-funcs
 ; RUN: opt -S -passes=lowertypetests -mtriple=aarch64-unknown-linux-gnu %s | FileCheck --check-prefixes=AARCH64 %s
 
 ; Test for the jump table generation with branch protection on AArch64
@@ -30,17 +30,22 @@ define i1 @foo(ptr %p) {
 !1 = !{i32 4, !"branch-target-enforcement", i32 1}
 
 
-; AARCH64-LABEL: define hidden void @f.cfi() !type !1 {
+;.
+; AARCH64: @[[GLOB0:[0-9]+]] = private unnamed_addr constant [2 x ptr] [ptr @f, ptr @g], align 16
+; AARCH64: @[[GLOB1:[0-9]+]] = private constant [0 x i8] zeroinitializer
+; AARCH64: @f = alias [8 x i8], ptr @.cfi.jumptable
+; AARCH64: @g = internal alias [8 x i8], getelementptr inbounds ([2 x [8 x i8]], ptr @.cfi.jumptable, i64 0, i64 1)
+;.
+; AARCH64-LABEL: @f.cfi(
 ; AARCH64-NEXT:    ret void
 ;
 ;
-; AARCH64-LABEL: define internal void @g.cfi() !type !1 {
+; AARCH64-LABEL: @g.cfi(
 ; AARCH64-NEXT:    ret void
 ;
 ;
-; AARCH64-LABEL: define i1 @foo
-; AARCH64-SAME: (ptr [[P:%.*]]) {
-; AARCH64-NEXT:    [[TMP1:%.*]] = ptrtoint ptr [[P]] to i64
+; AARCH64-LABEL: @foo(
+; AARCH64-NEXT:    [[TMP1:%.*]] = ptrtoint ptr [[P:%.*]] to i64
 ; AARCH64-NEXT:    [[TMP2:%.*]] = sub i64 ptrtoint (ptr getelementptr (i8, ptr @.cfi.jumptable, i64 8) to i64), [[TMP1]]
 ; AARCH64-NEXT:    [[TMP3:%.*]] = call i64 @llvm.fshr.i64(i64 [[TMP2]], i64 [[TMP2]], i64 3)
 ; AARCH64-NEXT:    [[TMP4:%.*]] = icmp ule i64 [[TMP3]], 1
@@ -48,10 +53,17 @@ define i1 @foo(ptr %p) {
 ;
 ;
 ; AARCH64: Function Attrs: naked noinline
-; AARCH64-LABEL: define private void @.cfi.jumptable
-; AARCH64-SAME: () #[[ATTR1:[0-9]+]] align 8 {
+; AARCH64-LABEL: @.cfi.jumptable(
 ; AARCH64-NEXT:  entry:
 ; AARCH64-NEXT:    call void asm sideeffect "bti c\0Ab $0\0A", "s"(ptr @f.cfi)
 ; AARCH64-NEXT:    call void asm sideeffect "bti c\0Ab $0\0A", "s"(ptr @g.cfi)
 ; AARCH64-NEXT:    unreachable
 ;
+;.
+; AARCH64: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
+; AARCH64: attributes #[[ATTR1:[0-9]+]] = { naked noinline }
+; AARCH64: attributes #[[ATTR2:[0-9]+]] = { nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none) }
+;.
+; AARCH64: [[META0:![0-9]+]] = !{i32 4, !"branch-target-enforcement", i32 1}
+; AARCH64: [[META1:![0-9]+]] = !{i32 0, !"typeid1"}
+;.
diff --git a/llvm/test/Transforms/LowerTypeTests/x86-jumptable.ll b/llvm/test/Transforms/LowerTypeTests/x86-jumptable.ll
index 76acf9469785d..74c3e2e108a5e 100644
--- a/llvm/test/Transforms/LowerTypeTests/x86-jumptable.ll
+++ b/llvm/test/Transforms/LowerTypeTests/x86-jumptable.ll
@@ -1,6 +1,7 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals --include-generated-funcs
 ;; Test jump table generation with Indirect Branch Tracking on x86.
-; RUN: opt -S -passes=lowertypetests -mtriple=i686 %s | FileCheck --check-prefixes=X86,X86_32 %s
-; RUN: opt -S -passes=lowertypetests -mtriple=x86_64 %s | FileCheck --check-prefixes=X86,X86_64 %s
+; RUN: opt -S -passes=lowertypetests -mtriple=i686 %s | FileCheck --check-prefixes=X86_32 %s
+; RUN: opt -S -passes=lowertypetests -mtriple=x86_64 %s | FileCheck --check-prefixes=X86_64 %s
 
 @0 = private unnamed_addr constant [2 x ptr] [ptr @f, ptr @g], align 16
 
@@ -23,11 +24,75 @@ define i1 @foo(ptr %p) {
 !0 = !{i32 0, !"typeid1"}
 !1 = !{i32 8, !"cf-protection-branch", i32 1}
 
-; X86:         define private void @.cfi.jumptable() #[[#ATTR:]] align 16 {
-; X86-NEXT:    entry:
-; X86_32-NEXT:   call void asm sideeffect "endbr32\0Ajmp ${0:c}@plt\0A.balign 16, 0xcc\0A", "s"(ptr @f.cfi)
-; X86_32-NEXT:   call void asm sideeffect "endbr32\0Ajmp ${0:c}@plt\0A.balign 16, 0xcc\0A", "s"(ptr @g.cfi)
-; X86_64-NEXT:   call void asm sideeffect "endbr64\0Ajmp ${0:c}@plt\0A.balign 16, 0xcc\0A", "s"(ptr @f.cfi)
-; X86_64-NEXT:   call void asm sideeffect "endbr64\0Ajmp ${0:c}@plt\0A.balign 16, 0xcc\0A", "s"(ptr @g.cfi)
 
-; X86_64: attributes #[[#ATTR]] = { naked nocf_check noinline }
+;.
+; X86_32: @[[GLOB0:[0-9]+]] = private unnamed_addr constant [2 x ptr] [ptr @f, ptr @g], align 16
+; X86_32: @[[GLOB1:[0-9]+]] = private constant [0 x i8] zeroinitializer
+; X86_32: @f = alias [16 x i8], ptr @.cfi.jumptable
+; X86_32: @g = internal alias [16 x i8], getelementptr inbounds ([2 x [16 x i8]], ptr @.cfi.jumptable, i32 0, i32 1)
+;.
+; X86_64: @[[GLOB0:[0-9]+]] = private unnamed_addr constant [2 x ptr] [ptr @f, ptr @g], align 16
+; X86_64: @[[GLOB1:[0-9]+]] = private constant [0 x i8] zeroinitializer
+; X86_64: @f = alias [16 x i8], ptr @.cfi.jumptable
+; X86_64: @g = internal alias [16 x i8], getelementptr inbounds ([2 x [16 x i8]], ptr @.cfi.jumptable, i64 0, i64 1)
+;.
+; X86_32-LABEL: @f.cfi(
+; X86_32-NEXT:    ret void
+;
+;
+; X86_32-LABEL: @g.cfi(
+; X86_32-NEXT:    ret void
+;
+;
+; X86_32-LABEL: @foo(
+; X86_32-NEXT:    [[TMP1:%.*]] = ptrtoint ptr [[P:%.*]] to i32
+; X86_32-NEXT:    [[TMP2:%.*]] = sub i32 ptrtoint (ptr getelementptr (i8, ptr @.cfi.jumptable, i32 16) to i32), [[TMP1]]
+; X86_32-NEXT:    [[TMP3:%.*]] = call i32 @llvm.fshr.i32(i32 [[TMP2]], i32 [[TMP2]], i32 4)
+; X86_32-NEXT:    [[TMP4:%.*]] = icmp ule i32 [[TMP3]], 1
+; X86_32-NEXT:    ret i1 [[TMP4]]
+;
+;
+; X86_32-LABEL: @.cfi.jumptable(
+; X86_32-NEXT:  entry:
+; X86_32-NEXT:    call void asm sideeffect "endbr32\0Ajmp ${0:c}@plt\0A.balign 16, 0xcc\0A", "s"(ptr @f.cfi)
+; X86_32-NEXT:    call void asm sideeffect "endbr32\0Ajmp ${0:c}@plt\0A.balign 16, 0xcc\0A", "s"(ptr @g.cfi)
+; X86_32-NEXT:    unreachable
+;
+;
+; X86_64-LABEL: @f.cfi(
+; X86_64-NEXT:    ret void
+;
+;
+; X86_64-LABEL: @g.cfi(
+; X86_64-NEXT:    ret void
+;
+;
+; X86_64-LABEL: @foo(
+; X86_64-NEXT:    [[TMP1:%.*]] = ptrtoint ptr [[P:%.*]] to i64
+; X86_64-NEXT:    [[TMP2:%.*]] = sub i64 ptrtoint (ptr getelementptr (i8, ptr @.cfi.jumptable, i64 16) to i64), [[TMP1]]
+; X86_64-NEXT:    [[TMP3:%.*]] = call i64 @llvm.fshr.i64(i64 [[TMP2]], i64 [[TMP2]], i64 4)
+; X86_64-NEXT:    [[TMP4:%.*]] = icmp ule i64 [[TMP3]], 1
+; X86_64-NEXT:    ret i1 [[TMP4]]
+;
+;
+; X86_64-LABEL: @.cfi.jumptable(
+; X86_64-NEXT:  entry:
+; X86_64-NEXT:    call void asm sideeffect "endbr64\0Ajmp ${0:c}@plt\0A.balign 16, 0xcc\0A", "s"(ptr @f.cfi)
+; X86_64-NEXT:    call void asm sideeffect "endbr64\0Ajmp ${0:c}@plt\0A.balign 16, 0xcc\0A", "s"(ptr @g.cfi)
+; X86_64-NEXT:    unreachable
+;
+;.
+; X86_32: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
+; X86_32: attributes #[[ATTR1:[0-9]+]] = { naked nocf_check noinline }
+; X86_32: attributes #[[ATTR2:[0-9]+]] = { nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none) }
+;.
+; X86_64: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
+; X86_64: attributes #[[ATTR1:[0-9]+]] = { naked nocf_check noinline }
+; X86_64: attributes #[[ATTR2:[0-9]+]] = { nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none) }
+;.
+; X86_32: [[META0:![0-9]+]] = !{i32 8, !"cf-protection-branch", i32 1}
+; X86_32: [[META1:![0-9]+]] = !{i32 0, !"typeid1"}
+;.
+; X86_64: [[META0:![0-9]+]] = !{i32 8, !"cf-protection-branch", i32 1}
+; X86_64: [[META1:![0-9]+]] = !{i32 0, !"typeid1"}
+;.



More information about the llvm-commits mailing list