From: Rafael Espindola Date: Sun, 27 Nov 2011 18:35:39 +0000 (+0000) Subject: Add inreg attributes to reference arguments. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2871020b2d30b8a642c02280be849a7924426222;p=clang Add inreg attributes to reference arguments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145189 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index 7ff16dd951..4f2210f10e 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -831,7 +831,8 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI, // FALL THROUGH case ABIArgInfo::Direct: if (RegParm > 0 && - (ParamType->isIntegerType() || ParamType->isPointerType())) { + (ParamType->isIntegerType() || ParamType->isPointerType() || + ParamType->isReferenceType())) { RegParm -= (Context.getTypeSize(ParamType) + PointerWidth - 1) / PointerWidth; if (RegParm >= 0) diff --git a/test/CodeGenCXX/regparm.cpp b/test/CodeGenCXX/regparm.cpp new file mode 100644 index 0000000000..f0ebd2be41 --- /dev/null +++ b/test/CodeGenCXX/regparm.cpp @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s + + +// CHECK: _Z3fooRi(i32* inreg +void __attribute__ ((regparm (1))) foo(int &a) { +}