[llvm] [NFC] Simplify checks using isDebugOrPseudoInstr API (PR #145127)

Lei Wang via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 20 18:04:30 PDT 2025


https://github.com/wlei-llvm created https://github.com/llvm/llvm-project/pull/145127

Merge the two checks using the existing API, NFC.

>From c43b50ad97ddf4ccc398df9fe5e0ac4161f457f0 Mon Sep 17 00:00:00 2001
From: wlei <wlei at fb.com>
Date: Fri, 20 Jun 2025 14:54:44 -0700
Subject: [PATCH] [NFC] Simplify checks using isDebugOrPseudoInstr API

---
 llvm/lib/CodeGen/MachineSink.cpp      | 2 +-
 llvm/lib/CodeGen/RegisterPressure.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp
index 8411d5c4b09c8..e9544727af9e4 100644
--- a/llvm/lib/CodeGen/MachineSink.cpp
+++ b/llvm/lib/CodeGen/MachineSink.cpp
@@ -1208,7 +1208,7 @@ MachineSinking::getBBRegisterPressure(const MachineBasicBlock &MBB,
                                          MIE = MBB.instr_begin();
        MII != MIE; --MII) {
     const MachineInstr &MI = *std::prev(MII);
-    if (MI.isDebugInstr() || MI.isPseudoProbe())
+    if (MI.isDebugOrPseudoInstr())
       continue;
     RegisterOperands RegOpers;
     RegOpers.collect(MI, *TRI, *MRI, false, false);
diff --git a/llvm/lib/CodeGen/RegisterPressure.cpp b/llvm/lib/CodeGen/RegisterPressure.cpp
index ca51b670b46cc..bcfa270b1e7c8 100644
--- a/llvm/lib/CodeGen/RegisterPressure.cpp
+++ b/llvm/lib/CodeGen/RegisterPressure.cpp
@@ -858,7 +858,7 @@ void RegPressureTracker::recedeSkipDebugValues() {
 
 void RegPressureTracker::recede(SmallVectorImpl<VRegMaskOrUnit> *LiveUses) {
   recedeSkipDebugValues();
-  if (CurrPos->isDebugInstr() || CurrPos->isPseudoProbe()) {
+  if (CurrPos->isDebugOrPseudoInstr()) {
     // It's possible to only have debug_value and pseudo probe instructions and
     // hit the start of the block.
     assert(CurrPos == MBB->begin());



More information about the llvm-commits mailing list