-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[LTT] mark the CFI jumptable naked on Windows #170371
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
[LTT] mark the CFI jumptable naked on Windows #170371
Conversation
|
@llvm/pr-subscribers-llvm-transforms Author: Mircea Trofin (mtrofin) ChangesWe were not marking the build/bin/opt -S -passes=lowertypetests -mtriple=i686-pc-win32 llvm/test/Transforms/LowerTypeTests/function.ll | build/bin/llc -O0Not seeing the spilled registers described in the bug anymore, no assertions are raised either. Full diff: https://github.com/llvm/llvm-project/pull/170371.diff 2 Files Affected:
diff --git a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
index fa35eef2c00f5..f7aeda95e41b3 100644
--- a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
+++ b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
@@ -1554,12 +1554,7 @@ void LowerTypeTestsModule::createJumpTable(
// Align the whole table by entry size.
F->setAlignment(Align(getJumpTableEntrySize(JumpTableArch)));
- // Skip prologue.
- // Disabled on win32 due to https://llvm.org/bugs/show_bug.cgi?id=28641#c3.
- // Luckily, this function does not get any prologue even without the
- // attribute.
- if (OS != Triple::Win32)
- F->addFnAttr(Attribute::Naked);
+ F->addFnAttr(Attribute::Naked);
if (JumpTableArch == Triple::arm)
F->addFnAttr("target-features", "-thumb-mode");
if (JumpTableArch == Triple::thumb) {
diff --git a/llvm/test/Transforms/LowerTypeTests/function.ll b/llvm/test/Transforms/LowerTypeTests/function.ll
index ab3cfb6acccf8..e654da656362f 100644
--- a/llvm/test/Transforms/LowerTypeTests/function.ll
+++ b/llvm/test/Transforms/LowerTypeTests/function.ll
@@ -115,7 +115,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-WIN32: 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" }
|
boomanaiden154
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Title needs to s/[LLT]/[LTT]
4dc36ce to
fe3a86e
Compare

We were not marking the
.cfi.jumptable functions asnaked on windows. The referenced bug (https://llvm.org/bugs/show_bug.cgi?id=28641#c3) appears to be fixed:build/bin/opt -S -passes=lowertypetests -mtriple=i686-pc-win32 llvm/test/Transforms/LowerTypeTests/function.ll | build/bin/llc -O0Not seeing the spilled registers described in the bug anymore.