[llvm] [AMDGPU] Skip debug uses in SIPeepholeSDWA (PR #160092)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 22 05:58:16 PDT 2025
https://github.com/jayfoad created https://github.com/llvm/llvm-project/pull/160092
None
>From 0e1228e0405ccce2bebcc85e865ad163191a8c08 Mon Sep 17 00:00:00 2001
From: Jay Foad <jay.foad at amd.com>
Date: Mon, 22 Sep 2025 13:50:17 +0100
Subject: [PATCH] [AMDGPU] Skip debug uses in SIPeepholeSDWA
---
llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp | 3 ++-
llvm/test/CodeGen/AMDGPU/v_add_u64_pseudo_sdwa.ll | 6 ++----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp b/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
index 857cb91a977f3..afe76e1ca74f2 100644
--- a/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
+++ b/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
@@ -1029,7 +1029,8 @@ void SIPeepholeSDWA::pseudoOpConvertToVOP2(MachineInstr &MI,
MachineOperand *CarryOut = TII->getNamedOperand(MISucc, AMDGPU::OpName::sdst);
if (!CarryOut)
return;
- if (!MRI->hasOneUse(CarryIn->getReg()) || !MRI->use_empty(CarryOut->getReg()))
+ if (!MRI->hasOneNonDBGUse(CarryIn->getReg()) ||
+ !MRI->use_nodbg_empty(CarryOut->getReg()))
return;
// Make sure VCC or its subregs are dead before MI.
MachineBasicBlock &MBB = *MI.getParent();
diff --git a/llvm/test/CodeGen/AMDGPU/v_add_u64_pseudo_sdwa.ll b/llvm/test/CodeGen/AMDGPU/v_add_u64_pseudo_sdwa.ll
index f95bc0b2f1cb6..d56f1f321371d 100644
--- a/llvm/test/CodeGen/AMDGPU/v_add_u64_pseudo_sdwa.ll
+++ b/llvm/test/CodeGen/AMDGPU/v_add_u64_pseudo_sdwa.ll
@@ -1,5 +1,7 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=amdgcn -mcpu=gfx900 < %s | FileCheck -check-prefixes=GFX9 %s
+; RUN: llc -mtriple=amdgcn -mcpu=gfx900 < %s -debugify-and-strip-all-safe | FileCheck -check-prefixes=GFX9 %s
+
define amdgpu_kernel void @sdwa_test() local_unnamed_addr #0 {
; GFX9-LABEL: sdwa_test:
; GFX9: ; %bb.0: ; %bb
@@ -21,7 +23,6 @@ bb:
ret void
}
-
define amdgpu_kernel void @test_add_co_sdwa(ptr addrspace(1) %arg, ptr addrspace(1) %arg1) #0 {
; GFX9-LABEL: test_add_co_sdwa:
; GFX9: ; %bb.0: ; %bb
@@ -48,6 +49,3 @@ bb:
store i64 %tmp9, ptr addrspace(1) %tmp7, align 8
ret void
}
-
-
-declare i32 @llvm.amdgcn.workitem.id.x()
More information about the llvm-commits
mailing list