[PATCH] D114263: [SCEV] Simplify forgetSymbolicName() (NFCI)
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 27 07:51:59 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf492a414bad7: [SCEV] Simplify forgetSymbolicName() (NFCI) (authored by nikic).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114263/new/
https://reviews.llvm.org/D114263
Files:
llvm/include/llvm/Analysis/ScalarEvolution.h
llvm/lib/Analysis/ScalarEvolution.cpp
Index: llvm/lib/Analysis/ScalarEvolution.cpp
===================================================================
--- llvm/lib/Analysis/ScalarEvolution.cpp
+++ llvm/lib/Analysis/ScalarEvolution.cpp
@@ -4442,42 +4442,6 @@
}
}
-void ScalarEvolution::forgetSymbolicName(Instruction *PN, const SCEV *SymName) {
- SmallVector<Instruction *, 16> Worklist;
- SmallPtrSet<Instruction *, 8> Visited;
- SmallVector<const SCEV *, 8> ToForget;
- Visited.insert(PN);
- Worklist.push_back(PN);
- while (!Worklist.empty()) {
- Instruction *I = Worklist.pop_back_val();
-
- auto It = ValueExprMap.find_as(static_cast<Value *>(I));
- if (It != ValueExprMap.end()) {
- const SCEV *Old = It->second;
-
- // Short-circuit the def-use traversal if the symbolic name
- // ceases to appear in expressions.
- if (Old != SymName && !hasOperand(Old, SymName))
- continue;
-
- // SCEVUnknown for a PHI either means that it has an unrecognized
- // structure, it's a PHI that's in the progress of being computed
- // by createNodeForPHI, or it's a single-value PHI. In the first case,
- // additional loop trip count information isn't going to change anything.
- // In the second case, createNodeForPHI will perform the necessary
- // updates on its own when it gets to that point. In the third, we do
- // want to forget the SCEVUnknown.
- if (!isa<PHINode>(I) || !isa<SCEVUnknown>(Old) || Old == SymName) {
- eraseValueFromMap(It->first);
- ToForget.push_back(Old);
- }
- }
-
- PushDefUseChildren(I, Worklist, Visited);
- }
- forgetMemoizedResults(ToForget);
-}
-
namespace {
/// Takes SCEV S and Loop L. For each AddRec sub-expression, use its start
@@ -5469,7 +5433,7 @@
// Okay, for the entire analysis of this edge we assumed the PHI
// to be symbolic. We now need to go back and purge all of the
// entries for the scalars that use the symbolic expression.
- forgetSymbolicName(PN, SymbolicName);
+ forgetMemoizedResults(SymbolicName);
insertValueToMap(PN, PHISCEV);
// We can add Flags to the post-inc expression only if we
@@ -5501,7 +5465,7 @@
// Okay, for the entire analysis of this edge we assumed the PHI
// to be symbolic. We now need to go back and purge all of the
// entries for the scalars that use the symbolic expression.
- forgetSymbolicName(PN, SymbolicName);
+ forgetMemoizedResults(SymbolicName);
insertValueToMap(PN, Shifted);
return Shifted;
}
Index: llvm/include/llvm/Analysis/ScalarEvolution.h
===================================================================
--- llvm/include/llvm/Analysis/ScalarEvolution.h
+++ llvm/include/llvm/Analysis/ScalarEvolution.h
@@ -1616,11 +1616,6 @@
/// SCEV+Loop pair.
const SCEV *computeSCEVAtScope(const SCEV *S, const Loop *L);
- /// This looks up computed SCEV values for all instructions that depend on
- /// the given instruction and removes them from the ValueExprMap map if they
- /// reference SymName. This is used during PHI resolution.
- void forgetSymbolicName(Instruction *I, const SCEV *SymName);
-
/// Return the BackedgeTakenInfo for the given loop, lazily computing new
/// values if the loop hasn't been analyzed yet. The returned result is
/// guaranteed not to be predicated.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114263.390161.patch
Type: text/x-patch
Size: 3400 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211127/375e7e6a/attachment.bin>
More information about the llvm-commits
mailing list