[PATCH] D122416: [llvm][NFC] Prefer using variadic isa<> over non-variadic isa<>s

Hirochika Matsumoto via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 24 10:47:51 PDT 2022


hkmatsumoto updated this revision to Diff 417988.
hkmatsumoto added a comment.

Don't refactor VPlan.cpp as it is not the case


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122416/new/

https://reviews.llvm.org/D122416

Files:
  llvm/lib/Analysis/Lint.cpp
  llvm/lib/CodeGen/TypePromotion.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/Transforms/IPO/Attributor.cpp
  llvm/lib/Transforms/IPO/HotColdSplitting.cpp
  llvm/lib/Transforms/Vectorize/VPlan.cpp


Index: llvm/lib/Transforms/Vectorize/VPlan.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -981,7 +981,7 @@
   for (VPRecipeBase &R : Header->phis()) {
     // Skip phi-like recipes that generate their backedege values themselves.
     // TODO: Model their backedge values explicitly.
-    if (isa<VPWidenIntOrFpInductionRecipe>(&R) || isa<VPWidenPHIRecipe>(&R))
+    if (isa<VPWidenIntOrFpInductionRecipe, VPWidenPHIRecipe>(&R))
       continue;
 
     auto *PhiR = cast<VPHeaderPHIRecipe>(&R);
@@ -989,9 +989,9 @@
     // only a single part is generated, which provides the last part from the
     // previous iteration. For non-ordered reductions all UF parts are
     // generated.
-    bool SinglePartNeeded = isa<VPCanonicalIVPHIRecipe>(PhiR) ||
-                            isa<VPFirstOrderRecurrencePHIRecipe>(PhiR) ||
-                            cast<VPReductionPHIRecipe>(PhiR)->isOrdered();
+    bool SinglePartNeeded =
+        isa<VPCanonicalIVPHIRecipe, VPFirstOrderRecurrencePHIRecipe>(PhiR) ||
+        cast<VPReductionPHIRecipe>(PhiR)->isOrdered();
     unsigned LastPartForNewPhi = SinglePartNeeded ? 1 : State->UF;
 
     for (unsigned Part = 0; Part < LastPartForNewPhi; ++Part) {
Index: llvm/lib/Transforms/IPO/HotColdSplitting.cpp
===================================================================
--- llvm/lib/Transforms/IPO/HotColdSplitting.cpp
+++ llvm/lib/Transforms/IPO/HotColdSplitting.cpp
@@ -141,7 +141,7 @@
   if (BB.hasAddressTaken() || BB.isEHPad())
     return false;
   auto Term = BB.getTerminator();
-  return !isa<InvokeInst>(Term) && !isa<ResumeInst>(Term);
+  return !isa<InvokeInst, ResumeInst>(Term);
 }
 
 /// Mark \p F cold. Based on this assumption, also optimize it for minimum size.
Index: llvm/lib/Transforms/IPO/Attributor.cpp
===================================================================
--- llvm/lib/Transforms/IPO/Attributor.cpp
+++ llvm/lib/Transforms/IPO/Attributor.cpp
@@ -364,7 +364,7 @@
       return false;
     }
     // TODO: Use assumed noalias return.
-    if (!isa<AllocaInst>(Obj) && !isa<GlobalVariable>(Obj) &&
+    if (!isa<AllocaInst, GlobalVariable>(Obj) &&
         !(IsLoad ? isAllocationFn(Obj, TLI) : isNoAliasCall(Obj))) {
       LLVM_DEBUG(dbgs() << "Underlying object is not supported yet: " << *Obj
                         << "\n";);
Index: llvm/lib/IR/AsmWriter.cpp
===================================================================
--- llvm/lib/IR/AsmWriter.cpp
+++ llvm/lib/IR/AsmWriter.cpp
@@ -116,7 +116,7 @@
   if (const Constant *C = dyn_cast<Constant>(V))
     if (C->getNumOperands() && !isa<GlobalValue>(C))
       for (const Value *Op : C->operands())
-        if (!isa<BasicBlock>(Op) && !isa<GlobalValue>(Op))
+        if (!isa<BasicBlock, GlobalValue>(Op))
           orderValue(Op, OM);
 
   // Note: we cannot cache this lookup above, since inserting into the map
Index: llvm/lib/CodeGen/TypePromotion.cpp
===================================================================
--- llvm/lib/CodeGen/TypePromotion.cpp
+++ llvm/lib/CodeGen/TypePromotion.cpp
@@ -493,7 +493,7 @@
     }
 
     // Mutate the result type, unless this is an icmp or switch.
-    if (!isa<ICmpInst>(I) && !isa<SwitchInst>(I)) {
+    if (!isa<ICmpInst, SwitchInst>(I)) {
       I->mutateType(ExtTy);
       Promoted.insert(I);
     }
Index: llvm/lib/Analysis/Lint.cpp
===================================================================
--- llvm/lib/Analysis/Lint.cpp
+++ llvm/lib/Analysis/Lint.cpp
@@ -407,8 +407,7 @@
     if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(UnderlyingObject))
       Assert(!GV->isConstant(), "Undefined behavior: Write to read-only memory",
              &I);
-    Assert(!isa<Function>(UnderlyingObject) &&
-               !isa<BlockAddress>(UnderlyingObject),
+    Assert((!isa<Function, BlockAddress>(UnderlyingObject)),
            "Undefined behavior: Write to text section", &I);
   }
   if (Flags & MemRef::Read) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122416.417988.patch
Type: text/x-patch
Size: 4050 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220324/cd039587/attachment.bin>


More information about the llvm-commits mailing list