[llvm] [CodeGen] Skip pseudo instructions in AggressiveAntiDepBreaker (PR #222271)

Pengcheng Wang via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 01:58:52 PDT 2026


https://github.com/wangpc-pp updated https://github.com/llvm/llvm-project/pull/222271

>From 7d2a7771098fa6d174e355a0c2237ab0075ee137 Mon Sep 17 00:00:00 2001
From: Pengcheng Wang <wangpengcheng.pp at bytedance.com>
Date: Wed, 9 Sep 2026 16:46:47 +0800
Subject: [PATCH] [CodeGen] Skip pseudo instructions in
 AggressiveAntiDepBreaker

Pseudo instructions do not have SUnits in the post-RA scheduling DAG.
Skipping only debug instructions can therefore dereference a null SUnit.

Ignore pseudo instructions and add a PSEUDO_PROBE regression.

Assisted-by: TRAE CLI (GPT-5.6)
Co-authored-by: TRAE CLI <traecli at bytedance.com>
---
 llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp  | 2 +-
 llvm/test/CodeGen/Hexagon/anti-dep-partial.mir | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp b/llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp
index 6be353bb8da63..a425864921416 100644
--- a/llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp
+++ b/llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp
@@ -790,7 +790,7 @@ unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
        I != E; --Count) {
     MachineInstr &MI = *--I;
 
-    if (MI.isDebugInstr())
+    if (MI.isDebugOrPseudoInstr())
       continue;
 
     LLVM_DEBUG(dbgs() << "Anti: ");
diff --git a/llvm/test/CodeGen/Hexagon/anti-dep-partial.mir b/llvm/test/CodeGen/Hexagon/anti-dep-partial.mir
index b7a3f8051f698..b8f987818441c 100644
--- a/llvm/test/CodeGen/Hexagon/anti-dep-partial.mir
+++ b/llvm/test/CodeGen/Hexagon/anti-dep-partial.mir
@@ -1,4 +1,5 @@
 # RUN: llc -mtriple=hexagon -post-RA-scheduler -run-pass post-RA-sched %s -o - | FileCheck %s
+# RUN: llc -mtriple=hexagon -post-RA-scheduler -passes=post-RA-sched %s -o - | FileCheck %s
 
 --- |
   declare void @check(i64, i32, i32, i64)
@@ -15,6 +16,8 @@ body: |
     successors:
     liveins: $r0, $r1, $d1, $d2, $r16, $r17, $r19, $r22, $r23
         $r2 = A2_add $r23, killed $r17
+        ; PSEUDO_PROBE has no SUnit and must be ignored by the breaker.
+        PSEUDO_PROBE 1, 1, 0, 0
         $r6 = M2_mpyi $r16, $r16
         $r22 = M2_accii $r22, killed $r2, 2
         $r7 = A2_tfrsi 12345678
@@ -27,6 +30,7 @@ body: |
         ; The anti-dependency on r23 between the first A2_add and the
         ; S2_asr_i_r was causing d11 to be renamed, while r22 remained
         ; unchanged. Check that the renaming of d11 does not happen.
+        ; CHECK: PSEUDO_PROBE 1, 1, 0, 0
         ; CHECK: d11
         $d0 = A2_tfrp killed $d11
         J2_call @check, implicit-def $d0, implicit-def $d1, implicit-def $d2, implicit $d0, implicit $d1, implicit $d2



More information about the llvm-commits mailing list