From 4f2449575fb2c469b08348cb1165bfaa9053ded6 Mon Sep 17 00:00:00 2001 From: Diana Picus Date: Tue, 30 Apr 2019 09:05:25 +0000 Subject: [PATCH] [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359540 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMCallLowering.cpp | 4 ++-- test/CodeGen/ARM/GlobalISel/arm-unsupported.ll | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/Target/ARM/ARMCallLowering.cpp b/lib/Target/ARM/ARMCallLowering.cpp index b70d55f73ba..5229064032a 100644 --- a/lib/Target/ARM/ARMCallLowering.cpp +++ b/lib/Target/ARM/ARMCallLowering.cpp @@ -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); diff --git a/test/CodeGen/ARM/GlobalISel/arm-unsupported.ll b/test/CodeGen/ARM/GlobalISel/arm-unsupported.ll index 8a23b5d29dd..045491097bb 100644 --- a/test/CodeGen/ARM/GlobalISel/arm-unsupported.ll +++ b/test/CodeGen/ARM/GlobalISel/arm-unsupported.ll @@ -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 -- 2.11.0