[TailDuplicator] Pre-commit test case for a subreg composition bug
authorBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Wed, 21 Dec 2022 20:23:57 +0000 (21:23 +0100)
committerBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Mon, 6 Feb 2023 18:21:22 +0000 (19:21 +0100)
Differential Revision: https://reviews.llvm.org/D140495

llvm/test/CodeGen/AArch64/taildup-subreg-compose.mir [new file with mode: 0644]

diff --git a/llvm/test/CodeGen/AArch64/taildup-subreg-compose.mir b/llvm/test/CodeGen/AArch64/taildup-subreg-compose.mir
new file mode 100644 (file)
index 0000000..19f7bd3
--- /dev/null
@@ -0,0 +1,68 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
+# RUN: llc -mtriple=aarch64 -o - -run-pass=early-tailduplication -verify-machineinstrs %s | FileCheck %s
+
+# Reproducer for a problem found with an out-of-tree target. This being
+# an attempt to re-create that for an in-tree target.
+#
+# When tail duplicator is duplicating the $s1 assignment into
+# bb.0 it need to resolve both the subreg access in the PHI
+# and the subreg access in the COPY.
+#
+# So what we expect is to find some thing like
+#   $s1 = COPY %0.dsub_then_ssub
+# with two levels of subreg accesses (possibly composed into one subreg index).
+
+
+---
+name:            foo2
+tracksRegLiveness: true
+body:             |
+  ; CHECK-LABEL: name: foo2
+  ; CHECK: bb.0.entry:
+  ; CHECK-NEXT:   successors: %bb.4(0x80000000)
+  ; CHECK-NEXT:   liveins: $q1
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   [[COPY:%[0-9]+]]:fpr128 = COPY $q1
+  ; CHECK-NEXT:   $s1 = COPY [[COPY]].dsub
+  ; CHECK-NEXT:   [[COPY1:%[0-9]+]]:fpr64 = COPY [[COPY]].dsub
+  ; CHECK-NEXT:   B %bb.4
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT: bb.1:
+  ; CHECK-NEXT:   successors: %bb.4(0x80000000)
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   [[DEF:%[0-9]+]]:fpr128 = IMPLICIT_DEF
+  ; CHECK-NEXT:   $s1 = COPY [[DEF]].dsub
+  ; CHECK-NEXT:   [[COPY2:%[0-9]+]]:fpr64 = COPY [[DEF]].dsub
+  ; CHECK-NEXT:   B %bb.4
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT: bb.3:
+  ; CHECK-NEXT:   successors: %bb.3(0x80000000)
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   B %bb.3
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT: bb.4:
+  ; CHECK-NEXT:   successors: %bb.4(0x80000000)
+  ; CHECK-NEXT: {{  $}}
+  ; CHECK-NEXT:   B %bb.4
+  bb.0.entry:
+    liveins: $q1
+
+    %0:fpr128 = COPY $q1
+    B %bb.2
+
+  bb.1:
+    %1:fpr128 = IMPLICIT_DEF
+    B %bb.2
+
+  bb.2:
+    %2:fpr64 = PHI %0.dsub, %bb.0, %1.dsub, %bb.1
+    $s1 = COPY %2.ssub
+    B %bb.4
+
+  bb.3:
+    B %bb.3
+
+  bb.4:
+    B %bb.4
+...
+