Drop assert that a call with struct return goes to a function with sret
authorJoerg Sonnenberger <joerg@bec.de>
Wed, 21 Oct 2015 20:05:01 +0000 (20:05 +0000)
committerJoerg Sonnenberger <joerg@bec.de>
Wed, 21 Oct 2015 20:05:01 +0000 (20:05 +0000)
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
test/CodeGen/SPARC/missing-sret.ll [new file with mode: 0644]

index 73730990125fab6d7facdb5ae57ecc052be00f72..d07d48669ccb0a74bf4fad886c57f0c9373baba3 100644 (file)
@@ -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<PointerType>(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 (file)
index 0000000..683d840
--- /dev/null
@@ -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)