[all-commits] [llvm/llvm-project] 0e34b6: [LCSSA] Compute SCEV of LCSSA phi if original inst...
Nikita Popov via All-commits
all-commits at lists.llvm.org
Mon Jun 26 05:43:48 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0e34b6a504a61d845209e58be70eaf829e59a922
https://github.com/llvm/llvm-project/commit/0e34b6a504a61d845209e58be70eaf829e59a922
Author: Nikita Popov <npopov at redhat.com>
Date: 2023-06-26 (Mon, 26 Jun 2023)
Changed paths:
M llvm/include/llvm/Analysis/ScalarEvolution.h
M llvm/lib/Transforms/Utils/LCSSA.cpp
M llvm/test/Transforms/IndVarSimplify/lcssa-preservation.ll
Log Message:
-----------
[LCSSA] Compute SCEV of LCSSA phi if original instruction had SCEV
The backstory is that the LCSSA invalidation we perform here is not
really necessary from a SCEV perspective. However, other code may
rely on the fact that invalidating only LCSSA phi nodes is sufficient
for transforms like loop peeling
(see https://reviews.llvm.org/D149331#4398582 for more details).
However, performing invalidation during LCSSA construction also
means that SCEV expansion (which may need to construct LCSSA) can
invalidate SCEV, which is somewhat unexpected and code may not be
prepared to deal with it (see the added test case, reported at
https://reviews.llvm.org/D149435#4428219).
Instead of invalidating SCEV, ensure that the LCSSA phi node also
has cached SCEV if the original instruction did. This means that
later invalidation of LCSSA phi nodes will work as expected. This
should avoid both the above issues and be more efficient.
Differential Revision: https://reviews.llvm.org/D153145
More information about the All-commits
mailing list