[SCEV] Support rewriting ZExt expressions with loop guard info.
authorFlorian Hahn <flo@fhahn.com>
Tue, 16 Nov 2021 11:16:07 +0000 (11:16 +0000)
committerFlorian Hahn <flo@fhahn.com>
Tue, 16 Nov 2021 11:16:07 +0000 (11:16 +0000)
commitb7aec4f08e5e231cda3366af961e227e18c5587b
treeb988a4546516cd35af3c3f700566a28327ad0980
parentf526c600c043d9e83a359e79d617077d947c1dc3
[SCEV] Support rewriting ZExt expressions with loop guard info.

So far, applying loop guard information has been restricted to
SCEVUnknown. In a few cases, like PR40961 and PR52464, this leads to
SCEV failing to determine tight upper bounds for the backedge taken
count.

This patch adjusts SCEVLoopGuardRewriter and applyLoopGuards to support
re-writing ZExt expressions.

This is a first step towards fixing  PR40961 and PR52464.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D113577
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info-rewrite-expressions.ll