[llvm] d464a9d - [Analysis] Replace assert(isa)/dyn_cast with cast. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 16 03:53:39 PDT 2021


Author: Simon Pilgrim
Date: 2021-10-16T11:40:19+01:00
New Revision: d464a9d476a2620293ff19cf743b8537b94c4a42

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

LOG: [Analysis] Replace assert(isa)/dyn_cast with cast. NFC.

cast<> will perform the assertion for us.

Removes a static analysis null dereference warning.

Added: 
    

Modified: 
    llvm/lib/Analysis/LoopCacheAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/LoopCacheAnalysis.cpp b/llvm/lib/Analysis/LoopCacheAnalysis.cpp
index 75bb8b02286c..b765ad0f8329 100644
--- a/llvm/lib/Analysis/LoopCacheAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopCacheAnalysis.cpp
@@ -426,9 +426,7 @@ bool IndexedReference::isConsecutive(const Loop &L, unsigned CLS) const {
 
 const SCEV *IndexedReference::getLastCoefficient() const {
   const SCEV *LastSubscript = getLastSubscript();
-  assert(isa<SCEVAddRecExpr>(LastSubscript) &&
-         "Expecting a SCEV add recurrence expression");
-  const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(LastSubscript);
+  auto *AR = cast<SCEVAddRecExpr>(LastSubscript);
   return AR->getStepRecurrence(SE);
 }
 


        


More information about the llvm-commits mailing list