[llvm] SimplifyIndVar: Use use_empty instead of hasNUses(0) (PR #137346)

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


https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/137346

None

>From 1b796fa2c1fa80a0cf7e3da9c9c00c0d0124dfc1 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Fri, 25 Apr 2025 15:58:18 +0200
Subject: [PATCH] SimplifyIndVar: Use use_empty instead of hasNUses(0)

---
 llvm/lib/Transforms/Utils/SimplifyIndVar.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
index 03dbf9513d140..e6ee2e06cafab 100644
--- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
@@ -2085,7 +2085,7 @@ PHINode *WidenIV::createWideIV(SCEVExpander &Rewriter) {
     // if the cast node is an inserted instruction without any user, we should
     // remove it to make sure the pass don't touch the function as we can not
     // wide the phi.
-    if (ExpandInst->hasNUses(0) &&
+    if (ExpandInst->use_empty() &&
         Rewriter.isInsertedInstruction(cast<Instruction>(ExpandInst)))
       DeadInsts.emplace_back(ExpandInst);
     return nullptr;



More information about the llvm-commits mailing list