[llvm] [NFC][LLVM][IR] Adopt vadiadic `isa<>` (PR #137001)

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 23 16:53:45 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-ir

Author: Rahul Joshi (jurahul)

<details>
<summary>Changes</summary>

- Adopt variadic `isa<>` in all files except Verifier.cpp

---

Patch is 30.49 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/137001.diff


24 Files Affected:

- (modified) llvm/include/llvm/IR/DebugProgramInstruction.h (+1-2) 
- (modified) llvm/include/llvm/IR/InstVisitor.h (+1-1) 
- (modified) llvm/include/llvm/IR/Instructions.h (+4-8) 
- (modified) llvm/include/llvm/IR/IntrinsicInst.h (+2-2) 
- (modified) llvm/include/llvm/IR/Operator.h (+1-1) 
- (modified) llvm/include/llvm/IR/User.h (+1-3) 
- (modified) llvm/include/llvm/IR/Value.h (+2-3) 
- (modified) llvm/lib/IR/AsmWriter.cpp (+9-10) 
- (modified) llvm/lib/IR/BasicBlock.cpp (+4-5) 
- (modified) llvm/lib/IR/ConstantFold.cpp (+2-2) 
- (modified) llvm/lib/IR/Constants.cpp (+11-11) 
- (modified) llvm/lib/IR/Core.cpp (+2-2) 
- (modified) llvm/lib/IR/DebugInfoMetadata.cpp (+11-18) 
- (modified) llvm/lib/IR/DiagnosticInfo.cpp (+1-1) 
- (modified) llvm/lib/IR/Dominators.cpp (+3-3) 
- (modified) llvm/lib/IR/Globals.cpp (+1-1) 
- (modified) llvm/lib/IR/Instruction.cpp (+1-1) 
- (modified) llvm/lib/IR/Instructions.cpp (+3-3) 
- (modified) llvm/lib/IR/MemoryModelRelaxationAnnotations.cpp (+3-2) 
- (modified) llvm/lib/IR/Metadata.cpp (+5-6) 
- (modified) llvm/lib/IR/ReplaceConstant.cpp (+2-2) 
- (modified) llvm/lib/IR/SafepointIRVerifier.cpp (+1-1) 
- (modified) llvm/lib/IR/TypeFinder.cpp (+1-1) 
- (modified) llvm/lib/IR/User.cpp (+1) 


``````````diff
diff --git a/llvm/include/llvm/IR/DebugProgramInstruction.h b/llvm/include/llvm/IR/DebugProgramInstruction.h
index 37db7894d173d..e62c18a138acd 100644
--- a/llvm/include/llvm/IR/DebugProgramInstruction.h
+++ b/llvm/include/llvm/IR/DebugProgramInstruction.h
@@ -467,8 +467,7 @@ class DbgVariableRecord : public DbgRecord, protected DebugValueUser {
   /// replaceVariableLocationOp and addVariableLocationOps should be used where
   /// possible to avoid creating invalid state.
   void setRawLocation(Metadata *NewLocation) {
-    assert((isa<ValueAsMetadata>(NewLocation) || isa<DIArgList>(NewLocation) ||
-            isa<MDNode>(NewLocation)) &&
+    assert((isa<ValueAsMetadata, DIArgList, MDNode>(NewLocation)) &&
            "Location for a DbgVariableRecord must be either ValueAsMetadata or "
            "DIArgList");
     resetDebugValue(0, NewLocation);
diff --git a/llvm/include/llvm/IR/InstVisitor.h b/llvm/include/llvm/IR/InstVisitor.h
index 5fc6fbfd0f28e..84300a1a02000 100644
--- a/llvm/include/llvm/IR/InstVisitor.h
+++ b/llvm/include/llvm/IR/InstVisitor.h
@@ -268,7 +268,7 @@ class InstVisitor {
   // The next level delegation for `CallBase` is slightly more complex in order
   // to support visiting cases where the call is also a terminator.
   RetTy visitCallBase(CallBase &I) {
-    if (isa<InvokeInst>(I) || isa<CallBrInst>(I))
+    if (isa<InvokeInst, CallBrInst>(I))
       return static_cast<SubClass *>(this)->visitTerminator(I);
 
     DELEGATE(Instruction);
diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index 95f0ef875fc07..af5dfd72bbc40 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -5023,8 +5023,7 @@ inline Value *getPointerOperand(Value *V) {
 
 /// A helper function that returns the alignment of load or store instruction.
 inline Align getLoadStoreAlignment(const Value *I) {
-  assert((isa<LoadInst>(I) || isa<StoreInst>(I)) &&
-         "Expected Load or Store instruction");
+  assert((isa<LoadInst, StoreInst>(I)) && "Expected Load or Store instruction");
   if (auto *LI = dyn_cast<LoadInst>(I))
     return LI->getAlign();
   return cast<StoreInst>(I)->getAlign();
@@ -5032,8 +5031,7 @@ inline Align getLoadStoreAlignment(const Value *I) {
 
 /// A helper function that set the alignment of load or store instruction.
 inline void setLoadStoreAlignment(Value *I, Align NewAlign) {
-  assert((isa<LoadInst>(I) || isa<StoreInst>(I)) &&
-         "Expected Load or Store instruction");
+  assert((isa<LoadInst, StoreInst>(I)) && "Expected Load or Store instruction");
   if (auto *LI = dyn_cast<LoadInst>(I))
     LI->setAlignment(NewAlign);
   else
@@ -5043,8 +5041,7 @@ inline void setLoadStoreAlignment(Value *I, Align NewAlign) {
 /// A helper function that returns the address space of the pointer operand of
 /// load or store instruction.
 inline unsigned getLoadStoreAddressSpace(const Value *I) {
-  assert((isa<LoadInst>(I) || isa<StoreInst>(I)) &&
-         "Expected Load or Store instruction");
+  assert((isa<LoadInst, StoreInst>(I)) && "Expected Load or Store instruction");
   if (auto *LI = dyn_cast<LoadInst>(I))
     return LI->getPointerAddressSpace();
   return cast<StoreInst>(I)->getPointerAddressSpace();
@@ -5052,8 +5049,7 @@ inline unsigned getLoadStoreAddressSpace(const Value *I) {
 
 /// A helper function that returns the type of a load or store instruction.
 inline Type *getLoadStoreType(const Value *I) {
-  assert((isa<LoadInst>(I) || isa<StoreInst>(I)) &&
-         "Expected Load or Store instruction");
+  assert((isa<LoadInst, StoreInst>(I)) && "Expected Load or Store instruction");
   if (auto *LI = dyn_cast<LoadInst>(I))
     return LI->getType();
   return cast<StoreInst>(I)->getValueOperand()->getType();
diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h
index 93750d6e3845e..cabb5fd297143 100644
--- a/llvm/include/llvm/IR/IntrinsicInst.h
+++ b/llvm/include/llvm/IR/IntrinsicInst.h
@@ -249,7 +249,7 @@ class RawLocationWrapper {
       : RawLocation(RawLocation) {
     // Allow ValueAsMetadata, empty MDTuple, DIArgList.
     assert(RawLocation && "unexpected null RawLocation");
-    assert(isa<ValueAsMetadata>(RawLocation) || isa<DIArgList>(RawLocation) ||
+    assert((isa<ValueAsMetadata, DIArgList>(RawLocation)) ||
            (isa<MDNode>(RawLocation) &&
             !cast<MDNode>(RawLocation)->getNumOperands()));
   }
@@ -1791,7 +1791,7 @@ class GCProjectionInst : public IntrinsicInst {
   bool isTiedToInvoke() const {
     const Value *Token = getArgOperand(0);
 
-    return isa<LandingPadInst>(Token) || isa<InvokeInst>(Token);
+    return isa<LandingPadInst, InvokeInst>(Token);
   }
 
   /// The statepoint with which this gc.relocate is associated.
diff --git a/llvm/include/llvm/IR/Operator.h b/llvm/include/llvm/IR/Operator.h
index 4d77860be994e..e15c4bfabfbfa 100644
--- a/llvm/include/llvm/IR/Operator.h
+++ b/llvm/include/llvm/IR/Operator.h
@@ -58,7 +58,7 @@ class Operator : public User {
   static bool classof(const Instruction *) { return true; }
   static bool classof(const ConstantExpr *) { return true; }
   static bool classof(const Value *V) {
-    return isa<Instruction>(V) || isa<ConstantExpr>(V);
+    return isa<Instruction, ConstantExpr>(V);
   }
 
   /// Return true if this operator has flags which may cause this operator
diff --git a/llvm/include/llvm/IR/User.h b/llvm/include/llvm/IR/User.h
index 39e1314bd8130..53a6a6d3c3bb2 100644
--- a/llvm/include/llvm/IR/User.h
+++ b/llvm/include/llvm/IR/User.h
@@ -354,9 +354,7 @@ class User : public Value {
   bool replaceUsesOfWith(Value *From, Value *To);
 
   // Methods for support type inquiry through isa, cast, and dyn_cast:
-  static bool classof(const Value *V) {
-    return isa<Instruction>(V) || isa<Constant>(V);
-  }
+  static bool classof(const Value *V) { return isa<Instruction, Constant>(V); }
 };
 
 // Either Use objects, or a Use pointer can be prepended to User.
diff --git a/llvm/include/llvm/IR/Value.h b/llvm/include/llvm/IR/Value.h
index cfed12e2f5f8d..944dd044dcde8 100644
--- a/llvm/include/llvm/IR/Value.h
+++ b/llvm/include/llvm/IR/Value.h
@@ -1046,14 +1046,13 @@ template <> struct isa_impl<GlobalIFunc, Value> {
 
 template <> struct isa_impl<GlobalValue, Value> {
   static inline bool doit(const Value &Val) {
-    return isa<GlobalObject>(Val) || isa<GlobalAlias>(Val);
+    return isa<GlobalObject, GlobalAlias>(Val);
   }
 };
 
 template <> struct isa_impl<GlobalObject, Value> {
   static inline bool doit(const Value &Val) {
-    return isa<GlobalVariable>(Val) || isa<Function>(Val) ||
-           isa<GlobalIFunc>(Val);
+    return isa<GlobalVariable, Function, GlobalIFunc>(Val);
   }
 };
 
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index ac8aa0d35ea30..7d7b419878898 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -141,7 +141,7 @@ static OrderMap orderModule(const Module *M) {
   OrderMap OM;
 
   auto orderConstantValue = [&OM](const Value *V) {
-    if (isa<Constant>(V) || isa<InlineAsm>(V))
+    if (isa<Constant, InlineAsm>(V))
       orderValue(V, OM);
   };
 
@@ -1625,7 +1625,7 @@ static void WriteConstantInternal(raw_ostream &Out, const Constant *CV,
     return;
   }
 
-  if (isa<ConstantAggregateZero>(CV) || isa<ConstantTargetNone>(CV)) {
+  if (isa<ConstantAggregateZero, ConstantTargetNone>(CV)) {
     Out << "zeroinitializer";
     return;
   }
@@ -1741,7 +1741,7 @@ static void WriteConstantInternal(raw_ostream &Out, const Constant *CV,
     return;
   }
 
-  if (isa<ConstantVector>(CV) || isa<ConstantDataVector>(CV)) {
+  if (isa<ConstantVector, ConstantDataVector>(CV)) {
     auto *CVVTy = cast<FixedVectorType>(CV->getType());
     Type *ETy = CVVTy->getElementType();
 
@@ -1751,7 +1751,7 @@ static void WriteConstantInternal(raw_ostream &Out, const Constant *CV,
     // TODO: Remove this block when the UseConstant{Int,FP}ForFixedLengthSplat
     // options are removed.
     if (auto *SplatVal = CV->getSplatValue()) {
-      if (isa<ConstantInt>(SplatVal) || isa<ConstantFP>(SplatVal)) {
+      if (isa<ConstantInt, ConstantFP>(SplatVal)) {
         Out << "splat (";
         WriterCtx.TypePrinter->print(ETy, Out);
         Out << ' ';
@@ -1803,7 +1803,7 @@ static void WriteConstantInternal(raw_ostream &Out, const Constant *CV,
     // options are removed.
     if (CE->getOpcode() == Instruction::ShuffleVector) {
       if (auto *SplatVal = CE->getSplatValue()) {
-        if (isa<ConstantInt>(SplatVal) || isa<ConstantFP>(SplatVal)) {
+        if (isa<ConstantInt, ConstantFP>(SplatVal)) {
           Out << "splat (";
           WriterCtx.TypePrinter->print(SplatVal->getType(), Out);
           Out << ' ';
@@ -4760,9 +4760,8 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
 
     // Select, Store, ShuffleVector, CmpXchg and AtomicRMW always print all
     // types.
-    if (isa<SelectInst>(I) || isa<StoreInst>(I) || isa<ShuffleVectorInst>(I) ||
-        isa<ReturnInst>(I) || isa<AtomicCmpXchgInst>(I) ||
-        isa<AtomicRMWInst>(I)) {
+    if (isa<SelectInst, StoreInst, ShuffleVectorInst, ReturnInst,
+            AtomicCmpXchgInst, AtomicRMWInst>(I)) {
       PrintAllTypes = true;
     } else {
       for (unsigned i = 1, E = I.getNumOperands(); i != E; ++i) {
@@ -5194,7 +5193,7 @@ void Value::print(raw_ostream &ROS, bool IsForDebug) const {
   bool ShouldInitializeAllMetadata = false;
   if (auto *I = dyn_cast<Instruction>(this))
     ShouldInitializeAllMetadata = isReferencingMDNode(*I);
-  else if (isa<Function>(this) || isa<MetadataAsValue>(this))
+  else if (isa<Function, MetadataAsValue>(this))
     ShouldInitializeAllMetadata = true;
 
   ModuleSlotTracker MST(getModuleFromVal(this), ShouldInitializeAllMetadata);
@@ -5240,7 +5239,7 @@ void Value::print(raw_ostream &ROS, ModuleSlotTracker &MST,
     OS << ' ';
     AsmWriterContext WriterCtx(&TypePrinter, MST.getMachine());
     WriteConstantInternal(OS, C, WriterCtx);
-  } else if (isa<InlineAsm>(this) || isa<Argument>(this)) {
+  } else if (isa<InlineAsm, Argument>(this)) {
     this->printAsOperand(OS, /* PrintType */ true, MST);
   } else {
     llvm_unreachable("Unknown value to print out!");
diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp
index c632b1b2dc2ab..e4660058a05e4 100644
--- a/llvm/lib/IR/BasicBlock.cpp
+++ b/llvm/lib/IR/BasicBlock.cpp
@@ -362,7 +362,7 @@ const Instruction *BasicBlock::getFirstMayFaultInst() const {
   if (InstList.empty())
     return nullptr;
   for (const Instruction &I : *this)
-    if (isa<LoadInst>(I) || isa<StoreInst>(I) || isa<CallBase>(I))
+    if (isa<LoadInst, StoreInst, CallBase>(I))
       return &I;
   return nullptr;
 }
@@ -400,7 +400,7 @@ BasicBlock::const_iterator BasicBlock::getFirstNonPHIIt() const {
 BasicBlock::const_iterator
 BasicBlock::getFirstNonPHIOrDbg(bool SkipPseudoOp) const {
   for (const Instruction &I : *this) {
-    if (isa<PHINode>(I) || isa<DbgInfoIntrinsic>(I))
+    if (isa<PHINode, DbgInfoIntrinsic>(I))
       continue;
 
     if (SkipPseudoOp && isa<PseudoProbeInst>(I))
@@ -418,7 +418,7 @@ BasicBlock::getFirstNonPHIOrDbg(bool SkipPseudoOp) const {
 BasicBlock::const_iterator
 BasicBlock::getFirstNonPHIOrDbgOrLifetime(bool SkipPseudoOp) const {
   for (const Instruction &I : *this) {
-    if (isa<PHINode>(I) || isa<DbgInfoIntrinsic>(I))
+    if (isa<PHINode, DbgInfoIntrinsic>(I))
       continue;
 
     if (I.isLifetimeStartOrEnd())
@@ -461,8 +461,7 @@ BasicBlock::const_iterator BasicBlock::getFirstNonPHIOrDbgOrAlloca() const {
   if (isEntryBlock()) {
     const_iterator End = end();
     while (InsertPt != End &&
-           (isa<AllocaInst>(*InsertPt) || isa<DbgInfoIntrinsic>(*InsertPt) ||
-            isa<PseudoProbeInst>(*InsertPt))) {
+           isa<AllocaInst, DbgInfoIntrinsic, PseudoProbeInst>(*InsertPt)) {
       if (const AllocaInst *AI = dyn_cast<AllocaInst>(&*InsertPt)) {
         if (!AI->isStaticAlloca())
           break;
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 7e5fda229b858..1afc908c8ff14 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -321,8 +321,8 @@ Constant *llvm::ConstantFoldSelectInstruction(Constant *Cond,
     if (isa<ConstantExpr>(C))
       return false;
 
-    if (isa<ConstantInt>(C) || isa<GlobalVariable>(C) || isa<ConstantFP>(C) ||
-        isa<ConstantPointerNull>(C) || isa<Function>(C))
+    if (isa<ConstantInt, GlobalVariable, ConstantFP, ConstantPointerNull,
+            Function>(C))
       return true;
 
     if (C->getType()->isVectorTy())
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index fb659450bfeeb..2bc6c8cd276db 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -100,8 +100,8 @@ bool Constant::isNullValue() const {
 
   // constant zero is zero for aggregates, cpnull is null for pointers, none for
   // tokens.
-  return isa<ConstantAggregateZero>(this) || isa<ConstantPointerNull>(this) ||
-         isa<ConstantTokenNone>(this) || isa<ConstantTargetNone>(this);
+  return isa<ConstantAggregateZero, ConstantPointerNull, ConstantTokenNone,
+             ConstantTargetNone>(this);
 }
 
 bool Constant::isAllOnesValue() const {
@@ -358,7 +358,7 @@ bool Constant::containsUndefElement() const {
 }
 
 bool Constant::containsConstantExpression() const {
-  if (isa<ConstantInt>(this) || isa<ConstantFP>(this))
+  if (isa<ConstantInt, ConstantFP>(this))
     return false;
 
   if (auto *VTy = dyn_cast<FixedVectorType>(getType())) {
@@ -845,7 +845,7 @@ bool Constant::isManifestConstant() const {
     return false;
   if (isa<ConstantData>(this))
     return true;
-  if (isa<ConstantAggregate>(this) || isa<ConstantExpr>(this)) {
+  if (isa<ConstantAggregate, ConstantExpr>(this)) {
     for (const Value *Op : operand_values())
       if (!cast<Constant>(Op)->isManifestConstant())
         return false;
@@ -1142,13 +1142,13 @@ Constant *ConstantAggregateZero::getStructElement(unsigned Elt) const {
 }
 
 Constant *ConstantAggregateZero::getElementValue(Constant *C) const {
-  if (isa<ArrayType>(getType()) || isa<VectorType>(getType()))
+  if (isa<ArrayType, VectorType>(getType()))
     return getSequentialElement();
   return getStructElement(cast<ConstantInt>(C)->getZExtValue());
 }
 
 Constant *ConstantAggregateZero::getElementValue(unsigned Idx) const {
-  if (isa<ArrayType>(getType()) || isa<VectorType>(getType()))
+  if (isa<ArrayType, VectorType>(getType()))
     return getSequentialElement();
   return getStructElement(Idx);
 }
@@ -1177,13 +1177,13 @@ UndefValue *UndefValue::getStructElement(unsigned Elt) const {
 }
 
 UndefValue *UndefValue::getElementValue(Constant *C) const {
-  if (isa<ArrayType>(getType()) || isa<VectorType>(getType()))
+  if (isa<ArrayType, VectorType>(getType()))
     return getSequentialElement();
   return getStructElement(cast<ConstantInt>(C)->getZExtValue());
 }
 
 UndefValue *UndefValue::getElementValue(unsigned Idx) const {
-  if (isa<ArrayType>(getType()) || isa<VectorType>(getType()))
+  if (isa<ArrayType, VectorType>(getType()))
     return getSequentialElement();
   return getStructElement(Idx);
 }
@@ -1212,13 +1212,13 @@ PoisonValue *PoisonValue::getStructElement(unsigned Elt) const {
 }
 
 PoisonValue *PoisonValue::getElementValue(Constant *C) const {
-  if (isa<ArrayType>(getType()) || isa<VectorType>(getType()))
+  if (isa<ArrayType, VectorType>(getType()))
     return getSequentialElement();
   return getStructElement(cast<ConstantInt>(C)->getZExtValue());
 }
 
 PoisonValue *PoisonValue::getElementValue(unsigned Idx) const {
-  if (isa<ArrayType>(getType()) || isa<VectorType>(getType()))
+  if (isa<ArrayType, VectorType>(getType()))
     return getSequentialElement();
   return getStructElement(Idx);
 }
@@ -1485,7 +1485,7 @@ Constant *ConstantVector::getSplat(ElementCount EC, Constant *V) {
 
     // If this splat is compatible with ConstantDataVector, use it instead of
     // ConstantVector.
-    if ((isa<ConstantFP>(V) || isa<ConstantInt>(V)) &&
+    if ((isa<ConstantFP, ConstantInt>(V)) &&
         ConstantDataSequential::isElementTypeCompatible(V->getType()))
       return ConstantDataVector::getSplat(EC.getKnownMinValue(), V);
 
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index f4b03e8cb8aa3..4e62b96d13776 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -1091,8 +1091,8 @@ LLVMValueRef LLVMGetMetadata(LLVMValueRef Inst, unsigned KindID) {
 // This undoes this canonicalization, reconstructing the MDNode.
 static MDNode *extractMDNode(MetadataAsValue *MAV) {
   Metadata *MD = MAV->getMetadata();
-  assert((isa<MDNode>(MD) || isa<ConstantAsMetadata>(MD)) &&
-      "Expected a metadata node or a canonicalized constant");
+  assert((isa<MDNode, ConstantAsMetadata>(MD)) &&
+         "Expected a metadata node or a canonicalized constant");
 
   if (MDNode *N = dyn_cast<MDNode>(MD))
     return N;
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index 4f1b9e836120e..959db9c295df6 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -476,8 +476,7 @@ DIScope *DIScope::getScope() const {
   if (auto *M = dyn_cast<DIModule>(this))
     return M->getScope();
 
-  assert((isa<DIFile>(this) || isa<DICompileUnit>(this)) &&
-         "Unhandled type of scope.");
+  assert((isa<DIFile, DICompileUnit>(this)) && "Unhandled type of scope.");
   return nullptr;
 }
 
@@ -492,8 +491,7 @@ StringRef DIScope::getName() const {
     return CB->getName();
   if (auto *M = dyn_cast<DIModule>(this))
     return M->getName();
-  assert((isa<DILexicalBlockBase>(this) || isa<DIFile>(this) ||
-          isa<DICompileUnit>(this)) &&
+  assert((isa<DILexicalBlockBase, DIFile, DICompileUnit>(this)) &&
          "Unhandled type of scope.");
   return "";
 }
@@ -599,8 +597,7 @@ DISubrange::BoundType DISubrange::getCount() const {
   if (!CB)
     return BoundType();
 
-  assert((isa<ConstantAsMetadata>(CB) || isa<DIVariable>(CB) ||
-          isa<DIExpression>(CB)) &&
+  assert((isa<ConstantAsMetadata, DIVariable, DIExpression>(CB)) &&
          "Count must be signed constant or DIVariable or DIExpression");
 
   if (auto *MD = dyn_cast<ConstantAsMetadata>(CB))
@@ -620,8 +617,7 @@ DISubrange::BoundType DISubrange::getLowerBound() const {
   if (!LB)
     return BoundType();
 
-  assert((isa<ConstantAsMetadata>(LB) || isa<DIVariable>(LB) ||
-          isa<DIExpression>(LB)) &&
+  assert((isa<ConstantAsMetadata, DIVariable, DIExpression>(LB)) &&
          "LowerBound must be signed constant or DIVariable or DIExpression");
 
   if (auto *MD = dyn_cast<ConstantAsMetadata>(LB))
@@ -641,8 +637,7 @@ DISubrange::BoundType DISubrange::getUpperBound() const {
   if (!UB)
     return BoundType();
 
-  assert((isa<ConstantAsMetadata>(UB) || isa<DIVariable>(UB) ||
-          isa<DIExpression>(UB)) &&
+  assert((isa<ConstantAsMetadata, DIVariable, DIExpression>(UB)) &&
          "UpperBound must be signed constant or DIVariable or DIExpression");
 
   if (auto *MD = dyn_cast<ConstantAsMetadata>(UB))
@@ -662,8 +657,7 @@ DISubrange::BoundType DISubrange::getStride() const {
   if (!ST)
     return BoundType();
 
-  assert((isa<ConstantAsMetadata>(ST) || isa<DIVariable>(ST) ||
-          isa<DIExpression>(ST)) &&
+  assert((isa<ConstantAsMetadata, DIVariable, DIExpression>(ST)) &&
          "Stride must be signed constant or DIVariable or DIExpression");
 
   if (auto *MD = dyn_cast<ConstantAsMetadata>(ST))
@@ -697,7 +691,7 @@ DIGenericSubrange::BoundType DIGenericSubrange::getCount() const {
   if (!CB)
     return BoundType();
 
-  assert((isa<DIVariable>(CB) || isa<DIExpression>(CB)) &&
+  assert((isa<DIVariable, DIExpression>(CB)) &&
          "Count must be signed constant or DIVariable or DIExpression");
 
   if (auto *MD = dyn_cast<DIVariable>(CB))
@@ -714,7 +708,7 @@ DIGenericSubrange::BoundType DIGenericSubrange::getLowerBound() const {
   if (!LB)
     return BoundType();
 
-  assert((isa<DIVariable>(LB) || isa<DIExpression>(LB)) &&
+  assert((isa<DIVariable, DIExpression>(LB)) &&
          "LowerBound must be signed constant or DIVariable or DIExpression");
 
   if (auto *MD = dyn_cast<DIVariable>(LB))
@@ -731,7 +725,7 @@ DIGenericSubrange::BoundType DIGenericSubrange::getUpperBound() const {
   if (!UB)
     return BoundType();
 
-  assert((isa<DIVariable>(UB) || isa<DIExpression>(UB)) &&
+  assert((isa...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/137001


More information about the llvm-commits mailing list