[llvm] r275677 - Disable this-return argument forwarding on ARM/AArch64

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 16 00:07:30 PDT 2016


Author: hfinkel
Date: Sat Jul 16 02:07:29 2016
New Revision: 275677

URL: http://llvm.org/viewvc/llvm-project?rev=275677&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp
    llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
    llvm/trunk/test/CodeGen/AArch64/arm64-this-return.ll
    llvm/trunk/test/CodeGen/ARM/returned-ext.ll
    llvm/trunk/test/CodeGen/ARM/this-return.ll

Modified: llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp?rev=275677&r1=275676&r2=275677&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp Sat Jul 16 02:07:29 2016
@@ -53,6 +53,13 @@ cl::opt<bool> EnableAArch64ELFLocalDynam
     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::LowerCall
 
     // 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);

Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=275677&r1=275676&r2=275677&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Sat Jul 16 02:07:29 2016
@@ -65,6 +65,13 @@ ARMInterworking("arm-interworking", cl::
   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::LowerCallResu
 
     // 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);

Modified: llvm/trunk/test/CodeGen/AArch64/arm64-this-return.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/arm64-this-return.ll?rev=275677&r1=275676&r2=275677&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/arm64-this-return.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/arm64-this-return.ll Sat Jul 16 02:07:29 2016
@@ -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 }

Modified: llvm/trunk/test/CodeGen/ARM/returned-ext.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/returned-ext.ll?rev=275677&r1=275676&r2=275677&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/returned-ext.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/returned-ext.ll Sat Jul 16 02:07:29 2016
@@ -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)

Modified: llvm/trunk/test/CodeGen/ARM/this-return.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/this-return.ll?rev=275677&r1=275676&r2=275677&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/this-return.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/this-return.ll Sat Jul 16 02:07:29 2016
@@ -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 }




More information about the llvm-commits mailing list