[LoopFlatten] Widen the IV
authorSjoerd Meijer <sjoerd.meijer@arm.com>
Mon, 9 Nov 2020 17:32:25 +0000 (17:32 +0000)
committerSjoerd Meijer <sjoerd.meijer@arm.com>
Mon, 16 Nov 2020 10:20:13 +0000 (10:20 +0000)
commit9aa773381bd546f205f33e4d91dcfa89526ec0e2
tree5e86fe3d880e49c3f9eb62a0dc54d6a7ad41187d
parent48b43c9d4f038a85cb08601922cb362c169d57e3
[LoopFlatten] Widen the IV

Widen the IV to the widest available and legal integer type, which makes this
transformations always safe so that we can skip overflow checks.

Motivation is to let this pass trigger on 64-bit targets too, and this is the
last patch in a serie to achieve this: D90402 moves pass LoopFlatten to just
before IndVarSimplify so that IVs are not already widened, D90421 factors out
widening from IndVarSimplify into Utils/SimplifyIndVar so that we can also use
it in LoopFlatten.

Differential Revision: https://reviews.llvm.org/D90640
llvm/lib/Transforms/Scalar/LoopFlatten.cpp
llvm/test/Transforms/LoopFlatten/loop-flatten-negative.ll
llvm/test/Transforms/LoopFlatten/widen-iv.ll [new file with mode: 0644]