[LoopFlatten] Fix assertion failure in checkOverflow
authorRosie Sumpter <rosie.sumpter@arm.com>
Mon, 9 Aug 2021 11:51:17 +0000 (12:51 +0100)
committerRosie Sumpter <rosie.sumpter@arm.com>
Fri, 13 Aug 2021 09:07:49 +0000 (10:07 +0100)
commit46abd1fbe88fe1f4b0e6cb2b87f3e7d148bbadf7
tree40316f7a00dc1013878c4fb64944b565a59ce76c
parentc064ba34c7d867c1180279fe3dca8817d835cb28
[LoopFlatten] Fix assertion failure in checkOverflow

There is an assertion failure in computeOverflowForUnsignedMul
(used in checkOverflow) due to the inner and outer trip counts
having different types. This occurs when the IV has been widened,
but the loop components are not successfully rediscovered.
This is fixed by some refactoring of the code in findLoopComponents
which identifies the trip count of the loop.
llvm/lib/Transforms/Scalar/LoopFlatten.cpp
llvm/test/Transforms/LoopFlatten/widen-iv.ll