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()) + report_fatal_error( + "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; Index: test/CodeGen/X86/win64-nosse-error.ll =================================================================== --- /dev/null +++ test/CodeGen/X86/win64-nosse-error.ll @@ -0,0 +1,17 @@ +; RUN: not 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: LLVM ERROR: 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"} + +