[clang] [CIR] Skip call-conv lowering on Windows x86_64 (PR #223583)
Adam Smith via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 14 19:25:27 PDT 2026
https://github.com/adams381 created https://github.com/llvm/llvm-project/pull/223583
The x86-64 classifier implements SysV. We do not support Windows yet.
Assisted-by: Cursor / claude-opus-5
>From 00d93b6bfd02dc53b598cfb67ceb39f055f6ba6e Mon Sep 17 00:00:00 2001
From: Adam Smith <adams at nvidia.com>
Date: Mon, 14 Sep 2026 19:19:15 -0700
Subject: [PATCH] [CIR] Skip call-conv lowering on Windows x86_64
The x86-64 classifier implements SysV. We do not support Windows yet.
Assisted-by: Cursor / claude-opus-5
---
clang/lib/CIR/Lowering/CIRPasses.cpp | 3 ++-
.../CodeGen/call-conv-lowering-win64-skipped.c | 18 ++++++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
create mode 100644 clang/test/CIR/CodeGen/call-conv-lowering-win64-skipped.c
diff --git a/clang/lib/CIR/Lowering/CIRPasses.cpp b/clang/lib/CIR/Lowering/CIRPasses.cpp
index 64d82dd4e7301..d164d55f512cc 100644
--- a/clang/lib/CIR/Lowering/CIRPasses.cpp
+++ b/clang/lib/CIR/Lowering/CIRPasses.cpp
@@ -24,7 +24,8 @@ namespace cir {
/// Map a target triple to the ABI target that drives CallConvLowering.
/// Returns None for targets whose calling convention is not yet implemented.
static CallConvTarget getCallConvTarget(const llvm::Triple &triple) {
- if (triple.getArch() == llvm::Triple::x86_64)
+ // Windows is not supported. UEFI shares its convention.
+ if (triple.getArch() == llvm::Triple::x86_64 && !triple.isOSWindowsOrUEFI())
return CallConvTarget::X86_64;
return CallConvTarget::None;
}
diff --git a/clang/test/CIR/CodeGen/call-conv-lowering-win64-skipped.c b/clang/test/CIR/CodeGen/call-conv-lowering-win64-skipped.c
new file mode 100644
index 0000000000000..f72bba7e31f3a
--- /dev/null
+++ b/clang/test/CIR/CodeGen/call-conv-lowering-win64-skipped.c
@@ -0,0 +1,18 @@
+// RUN: not %clang_cc1 -triple x86_64-pc-windows-gnu -Wno-unused-value -fclangir -emit-llvm %s -o - | FileCheck %s --check-prefix=WIN64
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-llvm %s -o - | FileCheck %s --check-prefix=SYSV
+
+struct S16 {
+ long long a;
+ long long b;
+};
+
+void take16(struct S16 s);
+
+void give16(void) {
+ struct S16 s = {1, 2};
+ take16(s);
+}
+
+// Windows is not supported, so its signature is left as CIRGen emitted it.
+// WIN64: declare void @take16(%struct.S16)
+// SYSV: declare void @take16(i64, i64)
More information about the cfe-commits
mailing list