[llvm] 22f2915 - Hexagon: Use use_instructions in checkHVXUses32/checkHVXUses16 (#220003)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 09:07:31 PDT 2026


Author: Matt Arsenault
Date: 2026-08-31T16:07:24Z
New Revision: 22f291511563ae7428c804aa8a9a05de14419c14

URL: https://github.com/llvm/llvm-project/commit/22f291511563ae7428c804aa8a9a05de14419c14
DIFF: https://github.com/llvm/llvm-project/commit/22f291511563ae7428c804aa8a9a05de14419c14.diff

LOG: Hexagon: Use use_instructions in checkHVXUses32/checkHVXUses16 (#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)

Added: 
    

Modified: 
    llvm/lib/Target/Hexagon/HexagonXQFloatGenerator.cpp

Removed: 
    


################################################################################
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