[PATCH] D60579: [AArch64][GlobalISel] Enable copy elision in the pre-legalizer combine and fix a crash

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 12 17:32:00 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL358318: [AArch64][GlobalISel] Enable copy elision in the pre-legalizer combine and fix… (authored by aemerson, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D60579?vs=194746&id=194988#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60579/new/

https://reviews.llvm.org/D60579

Files:
  llvm/trunk/lib/CodeGen/GlobalISel/GISelChangeObserver.cpp
  llvm/trunk/lib/Target/AArch64/AArch64PreLegalizerCombiner.cpp
  llvm/trunk/test/CodeGen/AArch64/GlobalISel/observer-change-crash.mir


Index: llvm/trunk/lib/Target/AArch64/AArch64PreLegalizerCombiner.cpp
===================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64PreLegalizerCombiner.cpp
+++ llvm/trunk/lib/Target/AArch64/AArch64PreLegalizerCombiner.cpp
@@ -43,6 +43,8 @@
   switch (MI.getOpcode()) {
   default:
     return false;
+  case TargetOpcode::COPY:
+    return Helper.tryCombineCopy(MI);
   case TargetOpcode::G_LOAD:
   case TargetOpcode::G_SEXTLOAD:
   case TargetOpcode::G_ZEXTLOAD:
Index: llvm/trunk/lib/CodeGen/GlobalISel/GISelChangeObserver.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/GISelChangeObserver.cpp
+++ llvm/trunk/lib/CodeGen/GlobalISel/GISelChangeObserver.cpp
@@ -26,6 +26,7 @@
 void GISelChangeObserver::finishedChangingAllUsesOfReg() {
   for (auto *ChangedMI : ChangingAllUsesOfReg)
     changedInstr(*ChangedMI);
+  ChangingAllUsesOfReg.clear();
 }
 
 RAIIDelegateInstaller::RAIIDelegateInstaller(MachineFunction &MF,
Index: llvm/trunk/test/CodeGen/AArch64/GlobalISel/observer-change-crash.mir
===================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/observer-change-crash.mir
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/observer-change-crash.mir
@@ -0,0 +1,32 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
+# RUN: llc -mtriple aarch64 -run-pass=aarch64-prelegalizer-combiner %s -o - | FileCheck %s
+--- |
+  target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
+  target triple = "arm64-apple-ios5.0.0"
+
+  define void @test() {
+    ret void
+  }
+
+...
+---
+name:            test
+alignment:       2
+tracksRegLiveness: true
+registers:
+  - { id: 0, class: _ }
+  - { id: 1, class: _ }
+  - { id: 2, class: _ }
+frameInfo:
+  maxCallFrameSize: 0
+body:             |
+  bb.0:
+    ; CHECK-LABEL: name: test
+    ; CHECK: [[DEF:%[0-9]+]]:_(p0) = G_IMPLICIT_DEF
+    ; CHECK: $x0 = COPY [[DEF]](p0)
+    %0:_(p0) = G_IMPLICIT_DEF
+    %1:_(p0) = COPY %0(p0)
+    %2:_(p0) = COPY %1(p0)
+    $x0 = COPY %2(p0)
+
+...


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60579.194988.patch
Type: text/x-patch
Size: 2133 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190413/e3e50b59/attachment.bin>


More information about the llvm-commits mailing list