[llvm] ARM: Use use_empty instead of hasNUses(0) (PR #137337)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 25 08:29:05 PDT 2025


https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/137337

>From 8d410ef9510e4d9728108d1f0b9c5ec8da1e3b85 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Fri, 25 Apr 2025 15:56:46 +0200
Subject: [PATCH] ARM: Use use_empty instead of hasNUses(0)

---
 llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp b/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp
index b97ad5ad5e9ee..e998359bd3496 100644
--- a/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp
+++ b/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp
@@ -944,7 +944,7 @@ void MVEGatherScatterLowering::pushOutMulShl(unsigned Opcode, PHINode *&Phi,
 // Check whether all usages of this instruction are as offsets of
 // gathers/scatters or simple arithmetics only used by gathers/scatters
 static bool hasAllGatScatUsers(Instruction *I, const DataLayout &DL) {
-  if (I->hasNUses(0)) {
+  if (I->use_empty()) {
     return false;
   }
   bool Gatscat = true;
@@ -1099,11 +1099,11 @@ bool MVEGatherScatterLowering::optimiseOffsets(Value *Offsets, BasicBlock *BB,
 
   // The instruction has now been "absorbed" into the phi value
   Offs->replaceAllUsesWith(NewPhi);
-  if (Offs->hasNUses(0))
+  if (Offs->use_empty())
     Offs->eraseFromParent();
   // Clean up the old increment in case it's unused because we built a new
   // one
-  if (IncInstruction->hasNUses(0))
+  if (IncInstruction->use_empty())
     IncInstruction->eraseFromParent();
 
   return true;



More information about the llvm-commits mailing list