From: Diana Picus Date: Tue, 7 May 2019 10:11:57 +0000 (+0000) Subject: [ARM GlobalISel] Widen G_GEP index operand X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9c871b447c2dc9fc5f19ffaf891a29b880707dd8;p=llvm [ARM GlobalISel] Widen G_GEP index operand git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360127 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/ARM/ARMLegalizerInfo.cpp b/lib/Target/ARM/ARMLegalizerInfo.cpp index 71971197afe..f118cdf0307 100644 --- a/lib/Target/ARM/ARMLegalizerInfo.cpp +++ b/lib/Target/ARM/ARMLegalizerInfo.cpp @@ -146,7 +146,9 @@ ARMLegalizerInfo::ARMLegalizerInfo(const ARMSubtarget &ST) { .legalFor({s32, p0}) .minScalar(0, s32); - getActionDefinitionsBuilder(G_GEP).legalFor({{p0, s32}}); + getActionDefinitionsBuilder(G_GEP) + .legalFor({{p0, s32}}) + .minScalar(1, s32); getActionDefinitionsBuilder(G_BRCOND).legalFor({s1}); diff --git a/test/CodeGen/ARM/GlobalISel/arm-legalize-load-store.mir b/test/CodeGen/ARM/GlobalISel/arm-legalize-load-store.mir index 8ab1f8767b4..fd3e20c40c0 100644 --- a/test/CodeGen/ARM/GlobalISel/arm-legalize-load-store.mir +++ b/test/CodeGen/ARM/GlobalISel/arm-legalize-load-store.mir @@ -7,7 +7,8 @@ define void @test_load_store_64_vfp() #0 { ret void } define void @test_load_store_64_novfp() #1 { ret void } - define void @test_gep() { ret void } + define void @test_gep_s32() { ret void } + define void @test_gep_s16() { ret void } attributes #0 = { "target-features"="+vfp2" } attributes #1 = { "target-features"="-vfp2" } @@ -165,8 +166,8 @@ body: | BX_RET 14, $noreg ... --- -name: test_gep -# CHECK-LABEL: name: test_gep +name: test_gep_s32 +# CHECK-LABEL: name: test_gep_s32 legalized: false # CHECK: legalized: true regBankSelected: false @@ -189,3 +190,30 @@ body: | $r0 = COPY %2(p0) BX_RET 14, $noreg, implicit $r0 ... +--- +name: test_gep_s16 +# CHECK-LABEL: name: test_gep_s16 +legalized: false +# CHECK: legalized: true +regBankSelected: false +selected: false +tracksRegLiveness: true +registers: + - { id: 0, class: _ } + - { id: 1, class: _ } + - { id: 2, class: _ } +body: | + bb.0: + liveins: $r0 + + %0(p0) = COPY $r0 + %1(s16) = G_LOAD %0(p0) :: (load 2) + + ; CHECK-NOT: G_GEP {{%[0-9]+}}, {{%[0-9]+}}(s16) + ; CHECK: {{%[0-9]+}}:_(p0) = G_GEP {{%[0-9]+}}, {{%[0-9]+}}(s32) + ; CHECK-NOT: G_GEP {{%[0-9]+}}, {{%[0-9]+}}(s16) + %2(p0) = G_GEP %0, %1(s16) + + $r0 = COPY %2(p0) + BX_RET 14, $noreg, implicit $r0 +...