[SCEV] Don't invalidate past dependency-breaking instructions
authorNikita Popov <npopov@redhat.com>
Thu, 27 Apr 2023 07:36:35 +0000 (09:36 +0200)
committerNikita Popov <npopov@redhat.com>
Fri, 28 Apr 2023 12:42:08 +0000 (14:42 +0200)
commit3ddd1ffb721dd0ac3faa4a53c76b6904e862b7ab
treee1787b7b012b62a467994bef070c0d11b770748e
parent0659000ff79decc1173aac140d4b0325fe696c57
[SCEV] Don't invalidate past dependency-breaking instructions

When invalidating a value, we walk all users of that value and
invalidate them as well. This can be very expensive for large use
graphs.

However, we only need to invalidate a user U of instruction I if
SCEV(U) can depend on SCEV(I). This is not the case if U is an
instruction that always produces a SCEVUnknown, such as a load.
If the load pointer operand is invalidated, there is no need to
invalidate the load result, which is completely unrelated from a
SCEV perspective.

Differential Revision: https://reviews.llvm.org/D149323
llvm/lib/Analysis/ScalarEvolution.cpp