diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -4737,7 +4737,7 @@ ShiftAmounts.push_back(C); bool Safe = llvm::all_of(ShiftAmounts, [](Constant *C) { - auto *CI = dyn_cast(C); + auto *CI = dyn_cast_or_null(C); return CI && CI->getValue().ult(C->getType()->getIntegerBitWidth()); }); return !Safe;