[IndVars] Add check of loop invariant for indirect use
authorzhongyunde <zhongyunde@huawei.com>
Sat, 3 Jun 2023 14:28:55 +0000 (22:28 +0800)
committerzhongyunde <zhongyunde@huawei.com>
Sat, 3 Jun 2023 14:29:09 +0000 (22:29 +0800)
commit34d380e1f63a7e2cdb9ab1e6498f727fcd710a14
treec181fd54fd66155654d8733c530374ee7cd30d16
parent287f201f9db866a10b4c4f9f6fe65c9d68525983
[IndVars] Add check of loop invariant for indirect use

We usually only check direct use instruction of IV, while the
bitcast of 'ptrtoint ptr to i64' doesn't affect the result, so go
a step further.
Fix https://github.com/llvm/llvm-project/issues/59633.

Reviewed By: markoshorro
Differential Revision: https://reviews.llvm.org/D151877
llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
llvm/test/Transforms/IndVarSimplify/pr59633.ll [new file with mode: 0644]