[llvm] [LTT] Set the naked attribute (PR #170380)
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 2 14:41:54 PST 2025
https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/170380
>From 035151b1bbad8f07e345ed9bffd6fbf10bb66853 Mon Sep 17 00:00:00 2001
From: Mircea Trofin <mtrofin at google.com>
Date: Tue, 2 Dec 2025 08:08:59 -0800
Subject: [PATCH] [LTT] Set the naked attribute
---
llvm/lib/Transforms/IPO/LowerTypeTests.cpp | 4 +++-
llvm/test/Transforms/LowerTypeTests/function.ll | 11 +++++------
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
index fa35eef2c00f5..ef2481970070c 100644
--- a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
+++ b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
@@ -1702,10 +1702,12 @@ void LowerTypeTestsModule::buildBitSetsFromFunctionsNative(
GlobalValue::PrivateLinkage,
M.getDataLayout().getProgramAddressSpace(),
".cfi.jumptable", &M);
+ JumpTableFn->addFnAttr(Attribute::Naked);
+
ArrayType *JumpTableEntryType = ArrayType::get(Int8Ty, EntrySize);
ArrayType *JumpTableType =
ArrayType::get(JumpTableEntryType, Functions.size());
- auto JumpTable = ConstantExpr::getPointerCast(
+ auto *JumpTable = ConstantExpr::getPointerCast(
JumpTableFn, PointerType::getUnqual(M.getContext()));
lowerTypeTestCalls(TypeIds, JumpTable, GlobalLayout);
diff --git a/llvm/test/Transforms/LowerTypeTests/function.ll b/llvm/test/Transforms/LowerTypeTests/function.ll
index ab3cfb6acccf8..fa7c7bbcdabd3 100644
--- a/llvm/test/Transforms/LowerTypeTests/function.ll
+++ b/llvm/test/Transforms/LowerTypeTests/function.ll
@@ -1,7 +1,7 @@
-; RUN: opt -S -passes=lowertypetests -mtriple=i686-unknown-linux-gnu %s | FileCheck --check-prefixes=X86,X86-LINUX,NATIVE,JT8 %s
-; RUN: opt -S -passes=lowertypetests -mtriple=x86_64-unknown-linux-gnu %s | FileCheck --check-prefixes=X86,X86-LINUX,NATIVE,JT8 %s
-; RUN: opt -S -passes=lowertypetests -mtriple=i686-pc-win32 %s | FileCheck --check-prefixes=X86,X86-WIN32,NATIVE,JT8 %s
-; RUN: opt -S -passes=lowertypetests -mtriple=x86_64-pc-win32 %s | FileCheck --check-prefixes=X86,X86-WIN32,NATIVE,JT8 %s
+; RUN: opt -S -passes=lowertypetests -mtriple=i686-unknown-linux-gnu %s | FileCheck --check-prefixes=X86,NATIVE,JT8 %s
+; RUN: opt -S -passes=lowertypetests -mtriple=x86_64-unknown-linux-gnu %s | FileCheck --check-prefixes=X86,NATIVE,JT8 %s
+; RUN: opt -S -passes=lowertypetests -mtriple=i686-pc-win32 %s | FileCheck --check-prefixes=X86,NATIVE,JT8 %s
+; RUN: opt -S -passes=lowertypetests -mtriple=x86_64-pc-win32 %s | FileCheck --check-prefixes=X86,NATIVE,JT8 %s
; RUN: opt -S -passes=lowertypetests -mtriple=riscv32-unknown-linux-gnu %s | FileCheck --check-prefixes=RISCV,NATIVE,JT8 %s
; RUN: opt -S -passes=lowertypetests -mtriple=riscv64-unknown-linux-gnu %s | FileCheck --check-prefixes=RISCV,NATIVE,JT8 %s
; RUN: opt -S -passes=lowertypetests -mtriple=wasm32-unknown-unknown %s | FileCheck --check-prefix=WASM32 %s
@@ -114,8 +114,7 @@ define i1 @foo(ptr %p) {
; NATIVE-SAME: "s"(ptr @g.cfi)
-; X86-LINUX: attributes #[[ATTR]] = { naked nocf_check noinline }
-; X86-WIN32: attributes #[[ATTR]] = { nocf_check noinline }
+; X86: attributes #[[ATTR]] = { naked nocf_check noinline }
; ARM: attributes #[[ATTR]] = { naked noinline
; THUMB: attributes #[[ATTR]] = { naked noinline "target-cpu"="cortex-a8" "target-features"="+thumb-mode" }
; THUMBV6M: attributes #[[ATTR]] = { naked noinline "target-features"="+thumb-mode" }
More information about the llvm-commits
mailing list