[PATCH] D94494: canCreateUndefOrPoison: dyn_cast -> dyn_cast_or_null

Markus Lavin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 12 06:56:13 PST 2021


markus added a comment.

F15010211: bbi-51646.ll <https://reviews.llvm.org/F15010211>

The issue was found with attached input bbi-51646.ll If necessary it could be added as a regression test but then the question is where (i.e. should it piggyback on some other file).



================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4740
       bool Safe = llvm::all_of(ShiftAmounts, [](Constant *C) {
-        auto *CI = dyn_cast<ConstantInt>(C);
+        auto *CI = dyn_cast_or_null<ConstantInt>(C);
         return CI && CI->getValue().ult(C->getType()->getIntegerBitWidth());
----------------
Constant::getAggregateElement() at line 4733 may return nullptr.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94494/new/

https://reviews.llvm.org/D94494



More information about the llvm-commits mailing list