[llvm] CodeGenPrepare: Check use_empty instead of getNumUses == 0 (PR #136334)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 18 10:59:56 PDT 2025


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

None

>From 53793890e0ed732669bca10505d90267270a88a6 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Fri, 18 Apr 2025 18:32:35 +0200
Subject: [PATCH] CodeGenPrepare: Check use_empty instead of getNumUses == 0

---
 llvm/lib/CodeGen/CodeGenPrepare.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 0cc9fb88b4293..12a668507fe65 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -4194,7 +4194,7 @@ class AddressingModeCombiner {
   /// `CommonValue` may be a placeholder inserted by us.
   /// If the placeholder is not used, we should remove this dead instruction.
   void eraseCommonValueIfDead() {
-    if (CommonValue && CommonValue->getNumUses() == 0)
+    if (CommonValue && CommonValue->use_empty())
       if (Instruction *CommonInst = dyn_cast<Instruction>(CommonValue))
         CommonInst->eraseFromParent();
   }



More information about the llvm-commits mailing list