]> granicus.if.org Git - llvm/commitdiff
[ARM GlobalISel] Be more careful about bailing out
authorDiana Picus <diana.picus@linaro.org>
Tue, 30 Apr 2019 09:05:25 +0000 (09:05 +0000)
committerDiana Picus <diana.picus@linaro.org>
Tue, 30 Apr 2019 09:05:25 +0000 (09:05 +0000)
Bail out on function arguments/returns with types aggregating an
unsupported type. This fixes cases where we would happily and
incorrectly lower functions taking e.g. [1 x i64] parameters, when we
don't even support plain i64 yet.

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

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

index b70d55f73ba9ec3bed0759d755f3ddd5c7e1e65c..5229064032a02811364e79d05a013018ee3309d7 100644 (file)
@@ -55,7 +55,7 @@ ARMCallLowering::ARMCallLowering(const ARMTargetLowering &TLI)
 static bool isSupportedType(const DataLayout &DL, const ARMTargetLowering &TLI,
                             Type *T) {
   if (T->isArrayTy())
-    return true;
+    return isSupportedType(DL, TLI, T->getArrayElementType());
 
   if (T->isStructTy()) {
     // For now we only allow homogeneous structs that we can manipulate with
@@ -64,7 +64,7 @@ static bool isSupportedType(const DataLayout &DL, const ARMTargetLowering &TLI,
     for (unsigned i = 1, e = StructT->getNumElements(); i != e; ++i)
       if (StructT->getElementType(i) != StructT->getElementType(0))
         return false;
-    return true;
+    return isSupportedType(DL, TLI, StructT->getElementType(0));
   }
 
   EVT VT = TLI.getValueType(DL, T, true);
index 8a23b5d29ddb831e98242b5fc4c6e603f9aa89c5..045491097bbc64a6192fb0b27a79d21d1cb82374 100644 (file)
@@ -28,6 +28,12 @@ define i64 @test_i64(i64 %a, i64 %b) {
   ret i64 %res
 }
 
+define void @test_i64_arr([1 x i64] %a) {
+; CHECK: remark: {{.*}} unable to lower arguments: void ([1 x i64])*
+; CHECK-LABEL: warning: Instruction selection used fallback path for test_i64_arr
+  ret void
+}
+
 define i128 @test_i128(i128 %a, i128 %b) {
 ; CHECK: remark: {{.*}} unable to lower arguments: i128 (i128, i128)*
 ; CHECK-LABEL: warning: Instruction selection used fallback path for test_i128
@@ -77,6 +83,14 @@ define %mixed.struct @test_mixed_struct(%mixed.struct %x) {
   ret %mixed.struct %x
 }
 
+%bad.element.type = type {i24, i24}
+
+define void @test_bad_element_struct(%bad.element.type %x) {
+; CHECK: remark: {{.*}} unable to lower arguments: void (%bad.element.type)*
+; CHECK-LABEL: warning: Instruction selection used fallback path for test_bad_element_struct
+  ret void
+}
+
 define void @test_vararg_definition(i32 %a, ...) {
 ; CHECK: remark: {{.*}} unable to lower arguments: void (i32, ...)*
 ; CHECK-LABEL: warning: Instruction selection used fallback path for test_vararg_definition