Heed ABIArgInfo::getInReg() for return values.

The 'inreg' attribute can also be applied to function return values in
LLVM IR. The SPARC v9 backend is using the flag when returning structs
containing 32-bit floats.

llvm-svn: 183290
This commit is contained in:
Jakob Stoklund Olesen
2013-06-05 03:00:09 +00:00
parent 811d259bb1
commit a3661146ea
2 changed files with 5 additions and 3 deletions

View File

@@ -1054,8 +1054,11 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
RetAttrs.addAttribute(llvm::Attribute::SExt);
else if (RetTy->hasUnsignedIntegerRepresentation())
RetAttrs.addAttribute(llvm::Attribute::ZExt);
break;
// FALL THROUGH
case ABIArgInfo::Direct:
if (RetAI.getInReg())
RetAttrs.addAttribute(llvm::Attribute::InReg);
break;
case ABIArgInfo::Ignore:
break;

View File

@@ -73,8 +73,7 @@ struct mixed {
float b;
};
// CHECK: @f_mixed(i32 inreg %x.coerce0, float inreg %x.coerce1)
// FIXME: The return value should also be 'inreg'.
// CHECK: define inreg %struct.mixed @f_mixed(i32 inreg %x.coerce0, float inreg %x.coerce1)
struct mixed f_mixed(struct mixed x) {
x.a += 1;
return x;