[llvm] c24b35b - [TailDuplicator] Pre-commit test case for a subreg composition bug

Bjorn Pettersson via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 6 10:23:18 PST 2023


Author: Bjorn Pettersson
Date: 2023-02-06T19:21:22+01:00
New Revision: c24b35b8f71b636cf88ac082c580e7f6a9cc6e59

URL: https://github.com/llvm/llvm-project/commit/c24b35b8f71b636cf88ac082c580e7f6a9cc6e59
DIFF: https://github.com/llvm/llvm-project/commit/c24b35b8f71b636cf88ac082c580e7f6a9cc6e59.diff

LOG: [TailDuplicator] Pre-commit test case for a subreg composition bug

Differential Revision: https://reviews.llvm.org/D140495

Added: 
    llvm/test/CodeGen/AArch64/taildup-subreg-compose.mir

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/AArch64/taildup-subreg-compose.mir b/llvm/test/CodeGen/AArch64/taildup-subreg-compose.mir
new file mode 100644
index 000000000000..19f7bd3dec78
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/taildup-subreg-compose.mir
@@ -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
+...
+


        


More information about the llvm-commits mailing list