[llvm] c8f2ee7 - Fix a warning in #98362 [-Wunused-but-set-variable]

NAKAMURA Takumi via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 13 04:57:29 PDT 2024


Author: NAKAMURA Takumi
Date: 2024-07-13T20:57:09+09:00
New Revision: c8f2ee77d290e6a14a7a83c9dc5837302771cedc

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

LOG: Fix a warning in #98362 [-Wunused-but-set-variable]

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/Attributor.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 915490c922847..910c0aeacc42e 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -2554,10 +2554,9 @@ ChangeStatus Attributor::cleanupIR() {
 
   for (const auto &V : ToBeDeletedInsts) {
     if (Instruction *I = dyn_cast_or_null<Instruction>(V)) {
-      if (auto *CB = dyn_cast<CallBase>(I)) {
-        assert((isa<IntrinsicInst>(CB) || isRunOn(*I->getFunction())) &&
-               "Cannot delete an instruction outside the current SCC!");
-      }
+      assert((!isa<CallBase>(I) || isa<IntrinsicInst>(I) ||
+              isRunOn(*I->getFunction())) &&
+             "Cannot delete an instruction outside the current SCC!");
       I->dropDroppableUses();
       CGModifiedFunctions.insert(I->getFunction());
       if (!I->getType()->isVoidTy())


        


More information about the llvm-commits mailing list