[llvm] Hexagon: Use use_instructions in checkHVXUses32/checkHVXUses16 (PR #220003)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 31 08:24:38 PDT 2026
https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/220003
The loops only inspect the using instruction, so iterate instructions
directly instead of operands and their parents.
Co-authored-by: Claude (Claude-Opus-4.8)
>From 7622da68f3a711c036c79808e068e8c5e9d43c2f Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Mon, 31 Aug 2026 17:23:12 +0200
Subject: [PATCH] Hexagon: Use use_instructions in
checkHVXUses32/checkHVXUses16
The loops only inspect the using instruction, so iterate instructions
directly instead of operands and their parents.
Co-authored-by: Claude (Claude-Opus-4.8)
---
llvm/lib/Target/Hexagon/HexagonXQFloatGenerator.cpp | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/llvm/lib/Target/Hexagon/HexagonXQFloatGenerator.cpp b/llvm/lib/Target/Hexagon/HexagonXQFloatGenerator.cpp
index 68b5d9f9f948d..cc7de1112073a 100644
--- a/llvm/lib/Target/Hexagon/HexagonXQFloatGenerator.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonXQFloatGenerator.cpp
@@ -366,9 +366,8 @@ bool VectorConvertRemove::checkHVXUses32(MachineInstr *MI,
MachineInstr *UseMI) {
Register convReg = MI->getOperand(0).getReg();
// Iterate over all uses of the Def we are analyzing
- for (auto &MO : make_range(MRI->use_begin(convReg), MRI->use_end())) {
- MachineInstr *UMI = MO.getParent();
- if (UMI == UseMI)
+ for (MachineInstr &UMI : MRI->use_instructions(convReg)) {
+ if (&UMI == UseMI)
continue;
// Since the convert cannot be deleted, we set the operand as NOT kill
MI->getOperand(1).setIsKill(false);
@@ -383,9 +382,8 @@ bool VectorConvertRemove::checkHVXUses16(MachineInstr *MI,
MachineInstr *UseMI) {
Register convReg = MI->getOperand(0).getReg();
// Iterate over all uses of the Def we are analyzing
- for (auto &MO : make_range(MRI->use_begin(convReg), MRI->use_end())) {
- MachineInstr *UMI = MO.getParent();
- if (UMI == UseMI)
+ for (MachineInstr &UMI : MRI->use_instructions(convReg)) {
+ if (&UMI == UseMI)
continue;
// Since the convert cannot be deleted, we set the operand as NOT kill
MI->getOperand(1).setIsKill(false);
More information about the llvm-commits
mailing list