[SCEVExpander] Only create trunc when needed.
authorFlorian Hahn <flo@fhahn.com>
Mon, 10 Jan 2022 11:31:26 +0000 (11:31 +0000)
committerFlorian Hahn <flo@fhahn.com>
Mon, 10 Jan 2022 11:31:27 +0000 (11:31 +0000)
commitaecad5828ee7c3cd6d7dea5ea9f552251e4362df
tree39885f5ab58aa842374c0fb7d81b9e74697ef99f
parent3a094d8b272c15aa329db92d85c6d483004b4f6e
[SCEVExpander] Only create trunc when needed.

9345ab3a4550 updated generateOverflowCheck to skip creating checks that
always evaluate to false. This in turn means that we only need to
create TruncTripCount if it is actually used.

Sink the TruncTripCount creating into ComputeEndCheck, so it is only
created when there's an actual check.
llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
llvm/test/Transforms/LoopDistribute/scev-inserted-runtime-check.ll
llvm/test/Transforms/LoopVectorize/runtime-check-small-clamped-bounds.ll
llvm/test/Transforms/LoopVersioning/wrapping-pointer-versioning.ll