Disable this-return argument forwarding on ARM/AArch64

r275042 reverted function-attribute inference for the 'returned' attribute
because the feature triggered self-hosting failures on ARM and AArch64. James
Molloy determined that the this-return argument forwarding feature, which
directly ties the returned input argument to the returned value, was the cause.
It seems likely that this forwarding code contains, or triggers, a subtle bug.
Disabling for now until we can track that down.

llvm-svn: 275677
This commit is contained in:
Hal Finkel 2016-07-16 07:07:29 +00:00
parent a711cc7951
commit 04b5330ccd
5 changed files with 21 additions and 7 deletions

View File

@ -53,6 +53,13 @@ cl::opt<bool> EnableAArch64ELFLocalDynamicTLSGeneration(
cl::desc("Allow AArch64 Local Dynamic TLS code generation"),
cl::init(false));
// Disabled for causing self-hosting failures once returned-attribute inference
// was enabled.
static cl::opt<bool>
EnableThisRetForwarding("aarch64-this-return-forwarding", cl::Hidden,
cl::desc("Directly forward this return"),
cl::init(false));
/// Value type used for condition codes.
static const MVT MVT_CC = MVT::i32;
@ -2728,7 +2735,7 @@ SDValue AArch64TargetLowering::LowerCallResult(
// Pass 'this' value directly from the argument to return value, to avoid
// reg unit interference
if (i == 0 && isThisReturn) {
if (i == 0 && isThisReturn && EnableThisRetForwarding) {
assert(!VA.needsCustom() && VA.getLocVT() == MVT::i64 &&
"unexpected return calling convention register assignment");
InVals.push_back(ThisVal);

View File

@ -65,6 +65,13 @@ ARMInterworking("arm-interworking", cl::Hidden,
cl::desc("Enable / disable ARM interworking (for debugging only)"),
cl::init(true));
// Disabled for causing self-hosting failures once returned-attribute inference
// was enabled.
static cl::opt<bool>
EnableThisRetForwarding("arm-this-return-forwarding", cl::Hidden,
cl::desc("Directly forward this return"),
cl::init(false));
namespace {
class ARMCCState : public CCState {
public:
@ -1466,7 +1473,7 @@ SDValue ARMTargetLowering::LowerCallResult(
// Pass 'this' value directly from the argument to return value, to avoid
// reg unit interference
if (i == 0 && isThisReturn) {
if (i == 0 && isThisReturn && EnableThisRetForwarding) {
assert(!VA.needsCustom() && VA.getLocVT() == MVT::i32 &&
"unexpected return calling convention register assignment");
InVals.push_back(ThisVal);

View File

@ -1,4 +1,4 @@
; RUN: llc < %s -march=arm64 | FileCheck %s
; RUN: llc < %s -march=arm64 -aarch64-this-return-forwarding | FileCheck %s
%struct.A = type { i8 }
%struct.B = type { i32 }

View File

@ -1,5 +1,5 @@
; RUN: llc < %s -mtriple=armv6-linux-gnueabi | FileCheck %s -check-prefix=CHECKELF
; RUN: llc < %s -mtriple=thumbv7-apple-ios5.0 | FileCheck %s -check-prefix=CHECKT2D
; RUN: llc < %s -mtriple=armv6-linux-gnueabi -arm-this-return-forwarding | FileCheck %s -check-prefix=CHECKELF
; RUN: llc < %s -mtriple=thumbv7-apple-ios5.0 -arm-this-return-forwarding | FileCheck %s -check-prefix=CHECKT2D
declare i16 @identity16(i16 returned %x)
declare i32 @identity32(i32 returned %x)

View File

@ -1,5 +1,5 @@
; RUN: llc < %s -mtriple=armv6-linux-gnueabi | FileCheck %s -check-prefix=CHECKELF
; RUN: llc < %s -mtriple=thumbv7-apple-ios5.0 | FileCheck %s -check-prefix=CHECKT2D
; RUN: llc < %s -mtriple=armv6-linux-gnueabi -arm-this-return-forwarding | FileCheck %s -check-prefix=CHECKELF
; RUN: llc < %s -mtriple=thumbv7-apple-ios5.0 -arm-this-return-forwarding | FileCheck %s -check-prefix=CHECKT2D
%struct.A = type { i8 }
%struct.B = type { i32 }