[llvm] [CodeGen][RegCoalescer] Preserve valid lanes when keeping IMPLICIT_DEF (PR #215272)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 1 04:20:23 PDT 2026


================
@@ -0,0 +1,36 @@
+# RUN: llc -mtriple=aarch64 -verify-coalescing -run-pass=register-coalescer -verify-machineinstrs -o - %s | FileCheck %s
+
+# A subregister definition without the undef flag is a read-modify-write,
+# including when it is defined by IMPLICIT_DEF. When the IMPLICIT_DEF cannot be
+# erased, retain the lanes carrying values from the preceding definition.
+# Otherwise the coalescer can miss the interference between %src and %dst and
+# turn the first two copies below into a destructive in-place permutation.
+
+# CHECK-LABEL: name: preserve_valid_lanes
+# CHECK:       [[SRC:%[a-z0-9]+]]:qqqq = COPY $q0_q1_q2_q3
+# CHECK-NEXT:  [[SRC]].qsub3:qqqq = IMPLICIT_DEF
+# CHECK-NOT:   [[SRC]].qsub0:qqqq = COPY [[SRC]].qsub1
+# CHECK-NOT:   [[SRC]].qsub1:qqqq = COPY [[SRC]].qsub0
----------------
arsenm wrote:

Use update_mir_test_checks, avoid -NOT checks 

https://github.com/llvm/llvm-project/pull/215272


More information about the llvm-commits mailing list