[llvm] Default stack alignment of X86 Hurd to 16 bytes (PR #158454)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 13 21:19:35 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-x86
Author: Brad Smith (brad0)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/158454.diff
2 Files Affected:
- (modified) llvm/lib/Target/X86/X86Subtarget.cpp (+3-2)
- (modified) llvm/test/CodeGen/X86/stack-align2.ll (+5)
``````````diff
diff --git a/llvm/lib/Target/X86/X86Subtarget.cpp b/llvm/lib/Target/X86/X86Subtarget.cpp
index fd5f34b60efb8..3ab765b35be44 100644
--- a/llvm/lib/Target/X86/X86Subtarget.cpp
+++ b/llvm/lib/Target/X86/X86Subtarget.cpp
@@ -284,12 +284,13 @@ void X86Subtarget::initSubtargetFeatures(StringRef CPU, StringRef TuneCPU,
reportFatalUsageError("64-bit code requested on a subtarget that doesn't "
"support it!");
- // Stack alignment is 16 bytes on Darwin, Linux, kFreeBSD, and for all
+ // Stack alignment is 16 bytes on Darwin, Linux, kFreeBSD, Hurd and for all
// 64-bit targets. On Solaris (32-bit), stack alignment is 4 bytes
// following the i386 psABI, while on Illumos it is always 16 bytes.
if (StackAlignOverride)
stackAlignment = *StackAlignOverride;
- else if (isTargetDarwin() || isTargetLinux() || isTargetKFreeBSD() || Is64Bit)
+ else if (isTargetDarwin() || isTargetLinux() || isTargetKFreeBSD() ||
+ isOSHurd() || Is64Bit)
stackAlignment = Align(16);
// Consume the vector width attribute or apply any target specific limit.
diff --git a/llvm/test/CodeGen/X86/stack-align2.ll b/llvm/test/CodeGen/X86/stack-align2.ll
index 095a9090ed08f..de1f9f4bcad46 100644
--- a/llvm/test/CodeGen/X86/stack-align2.ll
+++ b/llvm/test/CodeGen/X86/stack-align2.ll
@@ -1,10 +1,12 @@
; RUN: llc < %s -mcpu=generic -mtriple=i386-linux | FileCheck %s -check-prefix=LINUX-I386
; RUN: llc < %s -mcpu=generic -mtriple=i386-kfreebsd | FileCheck %s -check-prefix=KFREEBSD-I386
+; RUN: llc < %s -mcpu=generic -mtriple=i386-gnu | FileCheck %s -check-prefix=HURD-I386
; RUN: llc < %s -mcpu=generic -mtriple=i386-netbsd | FileCheck %s -check-prefix=NETBSD-I386
; RUN: llc < %s -mcpu=generic -mtriple=i686-apple-darwin8 | FileCheck %s -check-prefix=DARWIN-I386
; RUN: llc < %s -mcpu=generic -mtriple=i386-pc-solaris2.11 | FileCheck %s -check-prefix=SOLARIS-I386
; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux | FileCheck %s -check-prefix=LINUX-X86_64
; RUN: llc < %s -mcpu=generic -mtriple=x86_64-kfreebsd | FileCheck %s -check-prefix=KFREEBSD-X86_64
+; RUN: llc < %s -mcpu=generic -mtriple=x86_64-gnu | FileCheck %s -check-prefix=HURD-X86_64
; RUN: llc < %s -mcpu=generic -mtriple=x86_64-netbsd | FileCheck %s -check-prefix=NETBSD-X86_64
; RUN: llc < %s -mcpu=generic -mtriple=x86_64-apple-darwin8 | FileCheck %s -check-prefix=DARWIN-X86_64
; RUN: llc < %s -mcpu=generic -mtriple=x86_64-pc-solaris2.11 | FileCheck %s -check-prefix=SOLARIS-X86_64
@@ -17,6 +19,7 @@ entry:
; LINUX-I386: subl $12, %esp
; KFREEBSD-I386: subl $12, %esp
; DARWIN-I386: subl $12, %esp
+; HURD-I386: subl $12, %esp
; NETBSD-I386-NOT: subl {{.*}}, %esp
; SOLARIS-I386-NOT: subl {{.*}}, %esp
@@ -30,6 +33,8 @@ entry:
; SOLARIS-X86_64-NOT: subq {{.*}}, %rsp
; KFREEBSD-X86_64: pushq %{{.*}}
; KFREEBSD-X86_64-NOT: subq {{.*}}, %rsp
+; HURD-X86_64: pushq %{{.*}}
+; HURD-X86_64-NOT: subq {{.*}}, %rsp
}
declare void @test2()
``````````
</details>
https://github.com/llvm/llvm-project/pull/158454
More information about the llvm-commits
mailing list