[IndVars] Eliminate redundant type cast between integer and float
authorzhongyunde <zhongyunde@huawei.com>
Fri, 8 Jul 2022 09:03:17 +0000 (17:03 +0800)
committerzhongyunde <zhongyunde@huawei.com>
Fri, 8 Jul 2022 09:07:20 +0000 (17:07 +0800)
commit716e1b856aa38ef1d988af73413e7e4aadad2ffa
tree418f0c07984eda26f4f8f92c0e82422deeed6697
parent7b9a3b9d6d98184d3e20c03fceefaac6dc0c3580
[IndVars] Eliminate redundant type cast between integer and float

Recompute the range: match for fptosi of sitofp, and then query the range of the input to the sitofp
according the comment on D129140.

Fixes https://github.com/llvm/llvm-project/issues/55505.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D129191
llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
llvm/test/Transforms/IndVarSimplify/floating-point-iv.ll
llvm/test/Transforms/IndVarSimplify/floating-point-small-iv.ll [new file with mode: 0644]