AssumeBundleQueries.cpp - don't dereference a dyn_cast<> result. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 6 Jun 2021 14:05:32 +0000 (15:05 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 6 Jun 2021 14:25:03 +0000 (15:25 +0100)
Use cast<> instead which will assert that the cast is correct and not just return null - the match() should have already failed if the cast isn't valid anyhow.

Fixes static analysis warning.

llvm/lib/Analysis/AssumeBundleQueries.cpp

index 11f3e03..519d27a 100644 (file)
@@ -130,10 +130,10 @@ bool llvm::isAssumeWithEmptyBundle(AssumeInst &Assume) {
 }
 
 static CallInst::BundleOpInfo *getBundleFromUse(const Use *U) {
-  auto *Intr = dyn_cast<IntrinsicInst>(U->getUser());
   if (!match(U->getUser(),
              m_Intrinsic<Intrinsic::assume>(m_Unless(m_Specific(U->get())))))
     return nullptr;
+  auto *Intr = cast<IntrinsicInst>(U->getUser());
   return &Intr->getBundleOpInfoForOperand(U->getOperandNo());
 }