From f1ad08798bdd96e7287169631bd03cac5ade43e7 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Wed, 21 Oct 2015 20:05:01 +0000 Subject: [PATCH] Drop assert that a call with struct return goes to a function with sret attribute. Clang incorrectly misses it on __muldc3 and friends and the type system doesn't include it properly either. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250938 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Sparc/SparcISelLowering.cpp | 4 ++-- test/CodeGen/SPARC/missing-sret.ll | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 test/CodeGen/SPARC/missing-sret.ll diff --git a/lib/Target/Sparc/SparcISelLowering.cpp b/lib/Target/Sparc/SparcISelLowering.cpp index 73730990125..d07d48669cc 100644 --- a/lib/Target/Sparc/SparcISelLowering.cpp +++ b/lib/Target/Sparc/SparcISelLowering.cpp @@ -1040,8 +1040,8 @@ SparcTargetLowering::getSRetArgSize(SelectionDAG &DAG, SDValue Callee) const if (!CalleeFn) return 0; - assert(CalleeFn->hasStructRetAttr() && - "Callee does not have the StructRet attribute."); + // It would be nice to check for the sret attribute on CalleeFn here, + // but since it is not part of the function type, any check will misfire. PointerType *Ty = cast(CalleeFn->arg_begin()->getType()); Type *ElementTy = Ty->getElementType(); diff --git a/test/CodeGen/SPARC/missing-sret.ll b/test/CodeGen/SPARC/missing-sret.ll new file mode 100644 index 00000000000..683d840bd25 --- /dev/null +++ b/test/CodeGen/SPARC/missing-sret.ll @@ -0,0 +1,9 @@ +; RUN: llc -march=sparc -filetype=obj < %s > /dev/null 2> %t2 + +define void @mul_double_cc({ double, double }* noalias sret %agg.result, double %a, double %b, double %c, double %d) { +entry: + call void @__muldc3({ double, double }* sret %agg.result, double %a, double %b, double %c, double %d) + ret void +} + +declare void @__muldc3({ double, double }*, double, double, double, double) -- 2.34.1