summaryrefslogtreecommitdiff
path: root/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
diff options
context:
space:
mode:
authorMingming Liu <mingmingl@google.com>2025-09-10 15:25:31 -0700
committerGitHub <noreply@github.com>2025-09-10 15:25:31 -0700
commit1417dafa1db9cb1b2b09438aa9f53ea5ab6e36e2 (patch)
tree57f4b1f313c8cf74eed8819870f39c36ea263c68 /llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
parent898b813bc8a6d0276bf0f4769f5f2f64b34e632d (diff)
parentb8cefcb601ddaa18482555c4ff363c01a270c2fe (diff)
Merge branch 'main' into users/mingmingl-llvm/samplefdo-profile-formatusers/mingmingl-llvm/samplefdo-profile-format
Diffstat (limited to 'llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp')
-rw-r--r--llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp28
1 files changed, 2 insertions, 26 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp b/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
index d0cba30a442b..857cb91a977f 100644
--- a/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
+++ b/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
@@ -291,21 +291,7 @@ static MachineOperand *findSingleRegUse(const MachineOperand *Reg,
if (!Reg->isReg() || !Reg->isDef())
return nullptr;
- MachineOperand *ResMO = nullptr;
- for (MachineOperand &UseMO : MRI->use_nodbg_operands(Reg->getReg())) {
- // If there exist use of subreg of Reg then return nullptr
- if (!isSameReg(UseMO, *Reg))
- return nullptr;
-
- // Check that there is only one instruction that uses Reg
- if (!ResMO) {
- ResMO = &UseMO;
- } else if (ResMO->getParent() != UseMO.getParent()) {
- return nullptr;
- }
- }
-
- return ResMO;
+ return MRI->getOneNonDBGUse(Reg->getReg());
}
static MachineOperand *findSingleRegDef(const MachineOperand *Reg,
@@ -313,17 +299,7 @@ static MachineOperand *findSingleRegDef(const MachineOperand *Reg,
if (!Reg->isReg())
return nullptr;
- MachineInstr *DefInstr = MRI->getUniqueVRegDef(Reg->getReg());
- if (!DefInstr)
- return nullptr;
-
- for (auto &DefMO : DefInstr->defs()) {
- if (DefMO.isReg() && DefMO.getReg() == Reg->getReg())
- return &DefMO;
- }
-
- // Ignore implicit defs.
- return nullptr;
+ return MRI->getOneDef(Reg->getReg());
}
/// Combine an SDWA instruction's existing SDWA selection \p Sel with