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

via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 18 12:13:25 PDT 2025


Author: Matt Arsenault
Date: 2025-04-18T21:13:21+02:00
New Revision: 430b0c44341f913552a7badf1860acc4a84033ca

URL: https://github.com/llvm/llvm-project/commit/430b0c44341f913552a7badf1860acc4a84033ca
DIFF: https://github.com/llvm/llvm-project/commit/430b0c44341f913552a7badf1860acc4a84033ca.diff

LOG: CodeGenPrepare: Check use_empty instead of getNumUses == 0 (#136334)

Added: 
    

Modified: 
    llvm/lib/CodeGen/CodeGenPrepare.cpp

Removed: 
    


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