1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00

Revert "[SCEV] Don't walk uses of phis without SCEV expression when forgetting"

This reverts commit faf9f11589ce892b31d271917cf840f8ca903221.

Issues with this patch have been reported in
https://reviews.llvm.org/D100264#2689917 and
https://bugs.llvm.org/show_bug.cgi?id=49967.
This commit is contained in:
Nikita Popov 2021-04-15 09:43:52 +02:00
parent 69b0c6315b
commit 79b9e7549e
2 changed files with 8 additions and 17 deletions

View File

@ -2053,12 +2053,6 @@ private:
std::tuple<SCEV *, FoldingSetNodeID, void *> std::tuple<SCEV *, FoldingSetNodeID, void *>
findExistingSCEVInCache(SCEVTypes SCEVType, ArrayRef<const SCEV *> Ops); findExistingSCEVInCache(SCEVTypes SCEVType, ArrayRef<const SCEV *> Ops);
/// Push PHI nodes in the header of the given loop onto the given Worklist
/// if they have a cached SCEV expression. If no expression is cached, then
/// there also aren't any dependent expressions to invalidate.
void pushCachedLoopPHIs(const Loop *L,
SmallVectorImpl<Instruction *> &Worklist) const;
FoldingSet<SCEV> UniqueSCEVs; FoldingSet<SCEV> UniqueSCEVs;
FoldingSet<SCEVPredicate> UniquePreds; FoldingSet<SCEVPredicate> UniquePreds;
BumpPtrAllocator SCEVAllocator; BumpPtrAllocator SCEVAllocator;

View File

@ -7020,16 +7020,13 @@ bool ScalarEvolution::isBackedgeTakenCountMaxOrZero(const Loop *L) {
} }
/// Push PHI nodes in the header of the given loop onto the given Worklist. /// Push PHI nodes in the header of the given loop onto the given Worklist.
/// Only push PHIs for which a SCEV expression has been cached, otherwise there static void
/// cannot be any dependent expressions to invalidate. PushLoopPHIs(const Loop *L, SmallVectorImpl<Instruction *> &Worklist) {
void ScalarEvolution::pushCachedLoopPHIs(
const Loop *L, SmallVectorImpl<Instruction *> &Worklist) const {
BasicBlock *Header = L->getHeader(); BasicBlock *Header = L->getHeader();
for (PHINode &PN : Header->phis()) {
auto It = ValueExprMap.find_as(static_cast<Value *>(&PN)); // Push all Loop-header PHIs onto the Worklist stack.
if (It != ValueExprMap.end()) for (PHINode &PN : Header->phis())
Worklist.push_back(&PN); Worklist.push_back(&PN);
}
} }
const ScalarEvolution::BackedgeTakenInfo & const ScalarEvolution::BackedgeTakenInfo &
@ -7090,7 +7087,7 @@ ScalarEvolution::getBackedgeTakenInfo(const Loop *L) {
// it handles SCEVUnknown PHI nodes specially. // it handles SCEVUnknown PHI nodes specially.
if (Result.hasAnyInfo()) { if (Result.hasAnyInfo()) {
SmallVector<Instruction *, 16> Worklist; SmallVector<Instruction *, 16> Worklist;
pushCachedLoopPHIs(L, Worklist); PushLoopPHIs(L, Worklist);
SmallPtrSet<Instruction *, 8> Discovered; SmallPtrSet<Instruction *, 8> Discovered;
while (!Worklist.empty()) { while (!Worklist.empty()) {
@ -7213,7 +7210,7 @@ void ScalarEvolution::forgetLoop(const Loop *L) {
} }
// Drop information about expressions based on loop-header PHIs. // Drop information about expressions based on loop-header PHIs.
pushCachedLoopPHIs(CurrL, Worklist); PushLoopPHIs(CurrL, Worklist);
while (!Worklist.empty()) { while (!Worklist.empty()) {
Instruction *I = Worklist.pop_back_val(); Instruction *I = Worklist.pop_back_val();