Skip to content

Commit 72157fe

Browse files
committed
IndVarSimplify - silence static analyzer dyn_cast<> null dereference warning. NFCI.
The static analyzer is warning about a potential null dereference, but we should be able to use cast<> directly and if not assert will fire for us. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375426 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 4548d29 commit 72157fe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/Transforms/Scalar/IndVarSimplify.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2268,8 +2268,8 @@ static PHINode *FindLoopCounter(Loop *L, BasicBlock *ExitingBB,
22682268
if (BECount->getType()->isPointerTy() && !Phi->getType()->isPointerTy())
22692269
continue;
22702270

2271-
const auto *AR = dyn_cast<SCEVAddRecExpr>(SE->getSCEV(Phi));
2272-
2271+
const auto *AR = cast<SCEVAddRecExpr>(SE->getSCEV(Phi));
2272+
22732273
// AR may be a pointer type, while BECount is an integer type.
22742274
// AR may be wider than BECount. With eq/ne tests overflow is immaterial.
22752275
// AR may not be a narrower type, or we may never exit.

0 commit comments

Comments
 (0)