[PATCH] D127149: [LoopFlatten] Fix crash if the inner loop trip count comes from a sext instruction.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 6 13:56:38 PDT 2022


craig.topper created this revision.
craig.topper added a reviewer: SjoerdMeijer.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added a project: LLVM.

If we look through a truncate in matchLinearIVUser, it's possible
we find a sext/zext instruction that didn't come from widening.
This will fail the MatchedItCount->getType() == InnerInductionPHI->getType()
assertion.

Fix this by checking that we did not look through a truncate already.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127149

Files:
  llvm/lib/Transforms/Scalar/LoopFlatten.cpp
  llvm/test/Transforms/LoopFlatten/widen-iv.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127149.434600.patch
Type: text/x-patch
Size: 4945 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220606/dabc844d/attachment.bin>


More information about the llvm-commits mailing list