[all-commits] [llvm/llvm-project] faf9f1: [SCEV] Don't walk uses of phis without SCEV expres...
Nikita Popov via All-commits
all-commits at lists.llvm.org
Tue Apr 13 11:28:43 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: faf9f11589ce892b31d271917cf840f8ca903221
https://github.com/llvm/llvm-project/commit/faf9f11589ce892b31d271917cf840f8ca903221
Author: Nikita Popov <nikita.ppv at gmail.com>
Date: 2021-04-13 (Tue, 13 Apr 2021)
Changed paths:
M llvm/include/llvm/Analysis/ScalarEvolution.h
M llvm/lib/Analysis/ScalarEvolution.cpp
Log Message:
-----------
[SCEV] Don't walk uses of phis without SCEV expression when forgetting
I've run into some cases where a large fraction of compile-time is
spent invalidating SCEV. One of the causes is forgetLoop(), which
walks all values that are def-use reachable from the loop header
phis. When invalidating a topmost loop, that might be close to all
values in a function. Additionally, it's fairly common for there to
not actually be anything to invalidate, but we'll still be performing
this walk again and again.
My first thought was that we don't need to continue walking the uses
if the current value doesn't have a SCEV expression. However, this
isn't quite right, because SCEV construction can skip over values
(e.g. for a chain of adds, we might only create a SCEV expression
for the final value).
What this patch does instead is to only walk the (full) def-use chain
of loop phis that have a SCEV expression. If there's no expression
for a phi, then we also don't have any dependent expressions to
invalidate.
Differential Revision: https://reviews.llvm.org/D100264
More information about the All-commits
mailing list