[PATCH] D106580: [LoopFlatten] Use SCEV and Loop APIs to identify increment and trip count

Rosie Sumpter via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 23 05:24:29 PDT 2021


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


================
Comment at: llvm/lib/Transforms/Scalar/LoopFlatten.cpp:125
 
+  assert(InductionPHI->getNumIncomingValues() == 2);
+  
----------------
SjoerdMeijer wrote:
> I am not sure if an induction phi can have > 2 incoming values. If it can then the assert needs to be a return, and a test case is missing for this.
> 
> But if `getNumIncomingValues() == 2` is guaranteed by `getInductionVariable()`, then this is fine. Can you double check by looking at `getInductionVariable()`?
This assert was actually already there, I just moved it up to be where the induction phi is identified. But I agree, since the loop is in simplified form it will only have 2 incoming values so I'll remove this assert.


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

https://reviews.llvm.org/D106580



More information about the llvm-commits mailing list