[SCEV] Enable verification in LoopPM
authorNikita Popov <npopov@redhat.com>
Fri, 25 Feb 2022 10:30:01 +0000 (11:30 +0100)
committerNikita Popov <npopov@redhat.com>
Mon, 7 Mar 2022 08:46:20 +0000 (09:46 +0100)
commitd1e880acaa6f096618fa09d18daf17b9300558fc
tree9818a467729da3154f6441ea9e3e7a38249d87d2
parentef193a7a7c865254dfa726a07711423d2b5c69f7
[SCEV] Enable verification in LoopPM

Currently, we hardly ever actually run SCEV verification, even in
tests with -verify-scev. This is because the NewPM LPM does not
verify SCEV. The reason for this is that SCEV verification can
actually change the result of subsequent SCEV queries, which means
that you see different transformations depending on whether
verification is enabled or not.

To allow verification in the LPM, this limits verification to
BECounts that have actually been cached. It will not calculate
new BECounts.

BackedgeTakenInfo::getExact() is still not entirely readonly,
it still calls getUMinFromMismatchedTypes(). But I hope that this
is not problematic in the same way. (This could be avoided by
performing the umin in the other SCEV instance, but this would
require duplicating some of the code.)

Differential Revision: https://reviews.llvm.org/D120551
llvm/include/llvm/Analysis/ScalarEvolution.h
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/lib/Transforms/Scalar/LoopPassManager.cpp
llvm/test/Transforms/IndVarSimplify/X86/deterministic-scev-verify.ll
llvm/test/Transforms/IndVarSimplify/X86/pr35406.ll