GlobalISel: handle 1-element aggregates during ABI lowering.
authorTim Northover <tnorthover@apple.com>
Mon, 5 Dec 2016 21:25:33 +0000 (21:25 +0000)
committerTim Northover <tnorthover@apple.com>
Mon, 5 Dec 2016 21:25:33 +0000 (21:25 +0000)
llvm-svn: 288706

llvm/lib/Target/AArch64/AArch64CallLowering.cpp
llvm/test/CodeGen/AArch64/GlobalISel/arm64-callingconv.ll

index 3d92942..d9dd658 100644 (file)
@@ -168,8 +168,10 @@ void AArch64CallLowering::splitToValueTypes(const ArgInfo &OrigArg,
   ComputeValueVTs(TLI, DL, OrigArg.Ty, SplitVTs, &Offsets, 0);
 
   if (SplitVTs.size() == 1) {
-    // No splitting to do, just forward the input directly.
-    SplitArgs.push_back(OrigArg);
+    // No splitting to do, but we want to replace the original type (e.g. [1 x
+    // double] -> double).
+    SplitArgs.emplace_back(OrigArg.Reg, SplitVTs[0].getTypeForEVT(Ctx),
+                           OrigArg.Flags);
     return;
   }
 
index e2e91af..95b2ea2 100644 (file)
@@ -49,3 +49,10 @@ define i8* @args_ptrs(i8* %x0, i16* %x1, <2 x i8>* %x2, {i8, i16, i32}* %x3,
                       [3 x float]* %x4, double* %x5, i8* %x6, i8* %x7) {
   ret i8* %x0
 }
+
+; CHECK-LABEL: name: args_arr
+; CHECK: %[[ARG0:[0-9]+]](s64) = COPY %d0
+; CHECK: %d0 = COPY %[[ARG0]]
+define [1 x double] @args_arr([1 x double] %d0) {
+  ret [1 x double] %d0
+}