[PATCH] D42512: [X86] When using Win64 ABI, exit with error if SSE is disabled for varargs

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 26 08:08:07 PST 2018


aemerson updated this revision to Diff 135907.
aemerson removed a reviewer: RKSimon.
aemerson added a comment.

Changed to use errorUnsupported() so we get some diagnostics first.

@rnk I'm not exactly sure which calling convention code you're talking about. In any case, is this change reasonable?


Repository:
  rL LLVM

https://reviews.llvm.org/D42512

Files:
  lib/Target/X86/X86ISelLowering.cpp
  test/CodeGen/X86/win64-nosse-error.ll


Index: test/CodeGen/X86/win64-nosse-error.ll
===================================================================
--- /dev/null
+++ test/CodeGen/X86/win64-nosse-error.ll
@@ -0,0 +1,17 @@
+; RUN: not --crash llc %s -mattr="-sse" 2>&1 | FileCheck %s
+
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-macho"
+
+; Function Attrs: noimplicitfloat noinline noredzone nounwind optnone
+define void @crash() #0 {
+  call void (i32*, ...) @func(i32* null, double undef)
+  ret void
+}
+; CHECK: in function crash void (): Win64 ABI varargs functions require SSE to be enabled
+; Function Attrs: noimplicitfloat noredzone
+declare void @func(i32*, ...)
+
+attributes #0 = { "target-cpu"="x86-64" "target-features"="-sse"}
+
+
Index: lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- lib/Target/X86/X86ISelLowering.cpp
+++ lib/Target/X86/X86ISelLowering.cpp
@@ -3560,6 +3560,9 @@
     } else if (VA.isRegLoc()) {
       RegsToPass.push_back(std::make_pair(VA.getLocReg(), Arg));
       if (isVarArg && IsWin64) {
+        if (!Subtarget.hasSSE1())
+          errorUnsupported(
+              DAG, dl, "Win64 ABI varargs functions require SSE to be enabled");
         // Win64 ABI requires argument XMM reg to be copied to the corresponding
         // shadow reg if callee is a varargs function.
         unsigned ShadowReg = 0;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42512.135907.patch
Type: text/x-patch
Size: 1424 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180226/fe0be566/attachment.bin>


More information about the llvm-commits mailing list