[PATCH] D23172: IfConversion: Add implicit uses for live subregisters

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 9 09:22:32 PDT 2016


kparzysz retitled this revision from "Treat aliased registers as live in if-conversion" to "IfConversion: Add implicit uses for live subregisters".
kparzysz updated the summary for this revision.
kparzysz updated this revision to Diff 70850.
kparzysz added a comment.

Changed the approach from making super-register live, to adding implicit uses of sub-registers.


Repository:
  rL LLVM

https://reviews.llvm.org/D23172

Files:
  lib/CodeGen/IfConversion.cpp
  test/CodeGen/Hexagon/ifcvt-live-subreg.mir

Index: test/CodeGen/Hexagon/ifcvt-live-subreg.mir
===================================================================
--- /dev/null
+++ test/CodeGen/Hexagon/ifcvt-live-subreg.mir
@@ -0,0 +1,40 @@
+# RUN: llc -march=hexagon -run-pass if-converter -o - %s | FileCheck %s
+# CHECK: %d8 = L2_ploadrdf_io %p0, %r29, 0, implicit %r17
+
+--- |
+  define void @foo() {
+    ret void
+  }
+...
+
+
+---
+name:            foo
+alignment:       4
+tracksRegLiveness: true
+liveins:
+  - { reg: '%r0' }
+  - { reg: '%r1' }
+  - { reg: '%p0' }
+  - { reg: '%d8' }
+body:             |
+  bb.0:
+    successors: %bb.1, %bb.2
+    liveins: %r0, %r1, %p0, %d8
+    %d8 = A2_combinew killed %r0, killed %r1
+    J2_jumpf killed %p0, %bb.2, implicit-def %pc
+
+  bb.1:
+    liveins: %d0, %r17
+    %r0 = A2_tfrsi 0
+    %r1 = A2_tfrsi 0
+    A2_nop ; non-predicable
+    J2_jumpr killed %r31, implicit-def dead %pc, implicit killed %d0
+
+  bb.2:
+    ; Predicate this block.
+    %d8 = L2_loadrd_io %r29, 0
+    J2_jumpr killed %r31, implicit-def dead %pc, implicit killed %d8
+
+...
+
Index: lib/CodeGen/IfConversion.cpp
===================================================================
--- lib/CodeGen/IfConversion.cpp
+++ lib/CodeGen/IfConversion.cpp
@@ -1453,6 +1453,11 @@
     }
     if (LiveBeforeMI.count(Reg))
       MIB.addReg(Reg, RegState::Implicit);
+    else {
+      for (MCSubRegIterator S(Reg, TRI); S.isValid(); ++S)
+        if (LiveBeforeMI.count(*S))
+          MIB.addReg(*S, RegState::Implicit);
+    }
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23172.70850.patch
Type: text/x-patch
Size: 1520 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160909/1549bad7/attachment.bin>


More information about the llvm-commits mailing list