]> granicus.if.org Git - llvm/commit
[LFTR] Fix post-inc pointer IV with truncated exit count (PR41998)
authorNikita Popov <nikita.ppv@gmail.com>
Sat, 29 Jun 2019 09:24:12 +0000 (09:24 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Sat, 29 Jun 2019 09:24:12 +0000 (09:24 +0000)
commitd6d7595593965b44ac64890f9dfbe4b216f2b1c2
tree95a4e65966b2c6ed2da0434abddf0e5fd372c9fc
parent45adfa50b3fddb97d7fc512cec80e48c551f3280
[LFTR] Fix post-inc pointer IV with truncated exit count (PR41998)

Fixes https://bugs.llvm.org/show_bug.cgi?id=41998. Usually when we
have a truncated exit count we'll truncate the IV when comparing
against the limit, in which case exit count overflow in post-inc
form doesn't matter. However, for pointer IVs we don't do that, so
we have to be careful about incrementing the IV in the wide type.

I'm fixing this by removing the IVCount variable (which was
ExitCount or ExitCount+1) and replacing it with a UsePostInc flag,
and then moving the actual limit adjustment to the individual cases
(which are: pointer IV where we add to the wide type, integer IV
where we add to the narrow type, and constant integer IV where we
add to the wide type).

Differential Revision: https://reviews.llvm.org/D63686

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364709 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/IndVarSimplify.cpp
test/Transforms/IndVarSimplify/2011-11-01-lftrptr.ll
test/Transforms/IndVarSimplify/lftr-pr41998.ll