[llvm] r359540 - [ARM GlobalISel] Be more careful about bailing out

Diana Picus via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 02:05:25 PDT 2019


Author: rovka
Date: Tue Apr 30 02:05:25 2019
New Revision: 359540

URL: http://llvm.org/viewvc/llvm-project?rev=359540&view=rev
Log:
[ARM GlobalISel] Be more careful about bailing out

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.

Modified:
    llvm/trunk/lib/Target/ARM/ARMCallLowering.cpp
    llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-unsupported.ll

Modified: llvm/trunk/lib/Target/ARM/ARMCallLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCallLowering.cpp?rev=359540&r1=359539&r2=359540&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMCallLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMCallLowering.cpp Tue Apr 30 02:05:25 2019
@@ -55,7 +55,7 @@ ARMCallLowering::ARMCallLowering(const A
 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 DataLa
     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);

Modified: llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-unsupported.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-unsupported.ll?rev=359540&r1=359539&r2=359540&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-unsupported.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-unsupported.ll Tue Apr 30 02:05:25 2019
@@ -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(
   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




More information about the llvm-commits mailing list