[llvm] r277446 - [GlobalISel] Don't legalize non-generic instructions.
Ahmed Bougacha via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 2 04:41:10 PDT 2016
Author: ab
Date: Tue Aug 2 06:41:09 2016
New Revision: 277446
URL: http://llvm.org/viewvc/llvm-project?rev=277446&view=rev
Log:
[GlobalISel] Don't legalize non-generic instructions.
They don't have types and should be legal.
Added:
llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-ignore-non-generic.mir
Modified:
llvm/trunk/lib/CodeGen/GlobalISel/MachineLegalizePass.cpp
Modified: llvm/trunk/lib/CodeGen/GlobalISel/MachineLegalizePass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/MachineLegalizePass.cpp?rev=277446&r1=277445&r2=277446&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/MachineLegalizePass.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/MachineLegalizePass.cpp Tue Aug 2 06:41:09 2016
@@ -54,6 +54,12 @@ bool MachineLegalizePass::runOnMachineFu
// 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
Added: llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-ignore-non-generic.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-ignore-non-generic.mir?rev=277446&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-ignore-non-generic.mir (added)
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-ignore-non-generic.mir Tue Aug 2 06:41:09 2016
@@ -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
+...
More information about the llvm-commits
mailing list