[PATCH] D107806: [LoopFlatten] Fix assertion failure

Rosie Sumpter via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 12 02:40:58 PDT 2021


RosieSumpter marked an inline comment as done.
RosieSumpter added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopFlatten.cpp:179
+  const SCEV *SCEVRHS = SE->getSCEV(RHS);
+  if (SCEVRHS != SCEVTripCount) {
+    ConstantInt *ConstantRHS = dyn_cast<ConstantInt>(RHS);
----------------
SjoerdMeijer wrote:
> This has become quite complicated logic. I am wondering if we can handle the simple case first to reduce indentation and improve readability:
> 
>   if (SCEVRHS == SCEVTripCount)
>     return setLoopComponents(RHS, Increment);
> 
> where `setLoopComponents` is a new helper that includes the code at lines 229 - 233 and sets `TripCount`.
> 
> 
> 
> 
I've added a helper - hopefully it's what you had in mind, but I'm happy to change it if not


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

https://reviews.llvm.org/D107806



More information about the llvm-commits mailing list