Skip to content

Commit 6638303

Browse files
committed
[LoopFlatten] checkOverflow - use cast<> instead of dyn_cast<> to avoid dereference of nullptr.
Fix static analysis warning by using cast<> instead of dyn_cast<> as both isa<> and isGuaranteedToExecuteForEveryIteration expect a non-null Instruction pointer.
1 parent eddd5be commit 6638303

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Transforms/Scalar/LoopFlatten.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ static OverflowResult checkOverflow(FlattenInfo &FI, DominatorTree *DT,
535535
for (Value *U : V->users()) {
536536
if (auto *GEP = dyn_cast<GetElementPtrInst>(U)) {
537537
for (Value *GEPUser : U->users()) {
538-
Instruction *GEPUserInst = dyn_cast<Instruction>(GEPUser);
538+
auto *GEPUserInst = cast<Instruction>(GEPUser);
539539
if (!isa<LoadInst>(GEPUserInst) &&
540540
!(isa<StoreInst>(GEPUserInst) &&
541541
GEP == GEPUserInst->getOperand(1)))

0 commit comments

Comments
 (0)