From b1fd7849361f16b9059ddd6956c0f3f2eca784b3 Mon Sep 17 00:00:00 2001 From: Diana Picus Date: Wed, 26 Jul 2017 09:25:15 +0000 Subject: [PATCH] [ARM] GlobalISel: Mark G_GLOBAL_VALUE as legal llvm-svn: 309090 --- llvm/lib/Target/ARM/ARMLegalizerInfo.cpp | 1 + llvm/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir | 26 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/llvm/lib/Target/ARM/ARMLegalizerInfo.cpp b/llvm/lib/Target/ARM/ARMLegalizerInfo.cpp index 1c17c07..2302e7e 100644 --- a/llvm/lib/Target/ARM/ARMLegalizerInfo.cpp +++ b/llvm/lib/Target/ARM/ARMLegalizerInfo.cpp @@ -43,6 +43,7 @@ ARMLegalizerInfo::ARMLegalizerInfo(const ARMSubtarget &ST) { const LLT s32 = LLT::scalar(32); const LLT s64 = LLT::scalar(64); + setAction({G_GLOBAL_VALUE, p0}, Legal); setAction({G_FRAME_INDEX, p0}, Legal); for (unsigned Op : {G_LOAD, G_STORE}) { diff --git a/llvm/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir b/llvm/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir index 616f29d..1fb7c79 100644 --- a/llvm/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir +++ b/llvm/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir @@ -47,6 +47,9 @@ define void @test_fadd_s32() #0 { ret void } define void @test_fadd_s64() #0 { ret void } + @a_global = global i32 42 + define void @test_global_variable() { ret void } + attributes #0 = { "target-features"="+vfp2" } ... --- @@ -948,3 +951,26 @@ body: | BX_RET 14, _, implicit %d0 ... +--- +name: test_global_variable +# CHECK-LABEL: name: test_global_variable +legalized: false +# CHECK: legalized: true +regBankSelected: false +selected: false +tracksRegLiveness: true +registers: + - { id: 0, class: _ } + - { id: 1, class: _ } +body: | + bb.0: + liveins: %r0 + + %0(s32) = COPY %r0 + %1(p0) = G_GLOBAL_VALUE @a_global + ; G_GLOBAL_VALUE is legal, so we should find it unchanged in the output + ; CHECK: {{%[0-9]+}}(p0) = G_GLOBAL_VALUE @a_global + %r0 = COPY %1(p0) + BX_RET 14, _, implicit %r0 + +... -- 2.7.4