[PATCH] D127146: [LoopFlatten] Check for null result after dyn_cast.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 6 17:12:40 PDT 2022


craig.topper updated this revision to Diff 434645.
craig.topper added a comment.

Use cast instead of dyn_cast


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127146

Files:
  llvm/lib/Transforms/Scalar/LoopFlatten.cpp


Index: llvm/lib/Transforms/Scalar/LoopFlatten.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopFlatten.cpp
+++ llvm/lib/Transforms/Scalar/LoopFlatten.cpp
@@ -411,7 +411,7 @@
   // pre-header and one from the latch. The incoming latch value is the
   // increment variable.
   Increment =
-      dyn_cast<BinaryOperator>(InductionPHI->getIncomingValueForBlock(Latch));
+      cast<BinaryOperator>(InductionPHI->getIncomingValueForBlock(Latch));
   if (Increment->hasNUsesOrMore(3)) {
     LLVM_DEBUG(dbgs() << "Could not find valid increment\n");
     return false;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127146.434645.patch
Type: text/x-patch
Size: 623 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220607/988cd362/attachment.bin>


More information about the llvm-commits mailing list