From: Ahmed Bougacha Date: Tue, 2 Aug 2016 11:41:09 +0000 (+0000) Subject: [GlobalISel] Don't legalize non-generic instructions. X-Git-Tag: android-x86-7.1-r4~29311 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=a124aa18257e06d9c97434c9140c7694d1cff2ad;p=android-x86%2Fexternal-llvm.git [GlobalISel] Don't legalize non-generic instructions. They don't have types and should be legal. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277446 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/GlobalISel/MachineLegalizePass.cpp b/lib/CodeGen/GlobalISel/MachineLegalizePass.cpp index 0b8264f613d..bf5025201ba 100644 --- a/lib/CodeGen/GlobalISel/MachineLegalizePass.cpp +++ b/lib/CodeGen/GlobalISel/MachineLegalizePass.cpp @@ -54,6 +54,12 @@ bool MachineLegalizePass::runOnMachineFunction(MachineFunction &MF) { // Get the next Instruction before we try to legalize, because there's a // good chance MI will be deleted. NextMI = std::next(MI); + + // Only legalize pre-isel generic instructions: others don't have types + // and are assumed to be legal. + if (!isPreISelGenericOpcode(MI->getOpcode())) + continue; + auto Res = Helper.legalizeInstr(*MI, Legalizer); // Error out if we couldn't legalize this instruction. We may want to fall diff --git a/test/CodeGen/AArch64/GlobalISel/legalize-ignore-non-generic.mir b/test/CodeGen/AArch64/GlobalISel/legalize-ignore-non-generic.mir new file mode 100644 index 00000000000..d9ff51bc19b --- /dev/null +++ b/test/CodeGen/AArch64/GlobalISel/legalize-ignore-non-generic.mir @@ -0,0 +1,36 @@ +# RUN: llc -O0 -run-pass=legalize-mir -global-isel %s -o - | FileCheck %s +# REQUIRES: global-isel + +--- | + target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" + target triple = "aarch64--" + define void @test_copy() { ret void } + define void @test_targetspecific() { ret void } +... + +--- +name: test_copy +isSSA: true +registers: + - { id: 0, class: _ } +body: | + bb.0: + liveins: %x0 + ; CHECK-LABEL: name: test_copy + ; CHECK: %0(64) = COPY %x0 + ; CHECK-NEXT: %x0 = COPY %0 + + %0(64) = COPY %x0 + %x0 = COPY %0 +... + +--- +name: test_targetspecific +isSSA: true +body: | + bb.0: + ; CHECK-LABEL: name: test_targetspecific + ; CHECK: RET_ReallyLR + + RET_ReallyLR +...