OSDN Git Service

[ARM GlobalISel] Bail out for byval
authorDiana Picus <diana.picus@linaro.org>
Thu, 30 Nov 2017 12:23:44 +0000 (12:23 +0000)
committerDiana Picus <diana.picus@linaro.org>
Thu, 30 Nov 2017 12:23:44 +0000 (12:23 +0000)
Fallback if we have a byval parameter or argument since we don't support
them yet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319428 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMCallLowering.cpp
test/CodeGen/ARM/GlobalISel/arm-unsupported.ll

index 1c2df39..7338ac8 100644 (file)
@@ -434,9 +434,12 @@ bool ARMCallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder,
   auto &MBB = MIRBuilder.getMBB();
   auto DL = MF.getDataLayout();
 
-  for (auto &Arg : F.args())
+  for (auto &Arg : F.args()) {
     if (!isSupportedType(DL, TLI, Arg.getType()))
       return false;
+    if (Arg.hasByValOrInAllocaAttr())
+      return false;
+  }
 
   CCAssignFn *AssignFn =
       TLI.CCAssignFnForCall(F.getCallingConv(), F.isVarArg());
@@ -529,6 +532,9 @@ bool ARMCallLowering::lowerCall(MachineIRBuilder &MIRBuilder,
     if (!Arg.IsFixed)
       return false;
 
+    if (Arg.Flags.isByVal())
+      return false;
+
     SmallVector<unsigned, 8> Regs;
     splitToValueTypes(Arg, ArgInfos, MF, [&](unsigned Reg, uint64_t Offset) {
       Regs.push_back(Reg);
index bdba535..f9d41d9 100644 (file)
@@ -113,4 +113,19 @@ define i32 @test_thread_local_global() {
   ret i32 %v
 }
 
+%byval.class = type { i32 }
+
+define void @test_byval_arg(%byval.class* byval %x) {
+; CHECK: remark: {{.*}} unable to lower arguments: void (%byval.class*)*
+; CHECK-LABEL: warning: Instruction selection used fallback path for test_byval
+  ret void
+}
+
+define void @test_byval_param(%byval.class* %x) {
+; CHECK: remark: {{.*}} unable to translate instruction: call
+; CHECK-LABEL: warning: Instruction selection used fallback path for test_byval_param
+  call void @test_byval_arg(%byval.class* byval %x)
+  ret void
+}
+
 attributes #0 = { "target-features"="+thumb-mode" }