[llvm] [RegisterCoalescer] Fix LiveRange::overlaps assert on empty interval (PR #194771)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 29 02:09:24 PDT 2026
================
@@ -0,0 +1,39 @@
+# RUN: llc -mtriple=x86_64-unknown-linux-gnu -run-pass=register-coalescer -o - %s | FileCheck %s
+
+# This test demonstrates a bug in RegisterCoalescer where LiveRange::overlaps()
+# is called on a register with an empty live interval, leading to a crash.
+# Overlapping check must be symmetric.
+#
+# The pattern needed to reproduce the crash:
+# 1. Copy A: %dst = COPY %src, where %dst is terminal (no other copy affinity)
+# 2. Copy B: %src = COPY %undef_reg, redefining %src from an undefined register
+# 3. %undef_reg has no definition (empty live interval)
+# 4. %undef_reg is non-terminal (appears in at least two copies)
+#
+
+# CHECK-LABEL: name: empty_interval_overlaps_crash
----------------
arsenm wrote:
Use update_mir_test_checks
https://github.com/llvm/llvm-project/pull/194771
More information about the llvm-commits
mailing list