[llvm] aa845d7 - [SCEV] Remove conversion to SCEVUnionPredicate in ExitNotTakenInfo [NFC]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 9 12:10:31 PST 2022
Author: Philip Reames
Date: 2022-02-09T12:10:23-08:00
New Revision: aa845d7a245d85c441d0bd44fc7b6c3be8f3de8d
URL: https://github.com/llvm/llvm-project/commit/aa845d7a245d85c441d0bd44fc7b6c3be8f3de8d
DIFF: https://github.com/llvm/llvm-project/commit/aa845d7a245d85c441d0bd44fc7b6c3be8f3de8d.diff
LOG: [SCEV] Remove conversion to SCEVUnionPredicate in ExitNotTakenInfo [NFC]
This removes one of the places where we mutate an existing union predicate.
Added:
Modified:
llvm/include/llvm/Analysis/ScalarEvolution.h
llvm/lib/Analysis/ScalarEvolution.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/ScalarEvolution.h b/llvm/include/llvm/Analysis/ScalarEvolution.h
index 7c1c7e32f563..07eb7678bc8c 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolution.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolution.h
@@ -1372,17 +1372,17 @@ class ScalarEvolution {
PoisoningVH<BasicBlock> ExitingBlock;
const SCEV *ExactNotTaken;
const SCEV *MaxNotTaken;
- std::unique_ptr<SCEVUnionPredicate> Predicate;
+ SmallPtrSet<const SCEVPredicate *, 4> Predicates;
explicit ExitNotTakenInfo(PoisoningVH<BasicBlock> ExitingBlock,
const SCEV *ExactNotTaken,
const SCEV *MaxNotTaken,
- std::unique_ptr<SCEVUnionPredicate> Predicate)
+ const SmallPtrSet<const SCEVPredicate *, 4> &Predicates)
: ExitingBlock(ExitingBlock), ExactNotTaken(ExactNotTaken),
- MaxNotTaken(ExactNotTaken), Predicate(std::move(Predicate)) {}
+ MaxNotTaken(ExactNotTaken), Predicates(Predicates) {}
bool hasAlwaysTruePredicate() const {
- return !Predicate || Predicate->isAlwaysTrue();
+ return Predicates.empty();
}
};
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 620f3bf61af3..1b270de4ed01 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -7966,8 +7966,9 @@ ScalarEvolution::BackedgeTakenInfo::getExact(const Loop *L, ScalarEvolution *SE,
Ops.push_back(BECount);
- if (Preds && !ENT.hasAlwaysTruePredicate())
- Preds->add(ENT.Predicate.get());
+ if (Preds)
+ for (auto *P : ENT.Predicates)
+ Preds->add(P);
assert((Preds || ENT.hasAlwaysTruePredicate()) &&
"Predicate should be always true!");
@@ -8082,16 +8083,8 @@ ScalarEvolution::BackedgeTakenInfo::BackedgeTakenInfo(
[&](const EdgeExitInfo &EEI) {
BasicBlock *ExitBB = EEI.first;
const ExitLimit &EL = EEI.second;
- if (EL.Predicates.empty())
- return ExitNotTakenInfo(ExitBB, EL.ExactNotTaken, EL.MaxNotTaken,
- nullptr);
-
- std::unique_ptr<SCEVUnionPredicate> Predicate(new SCEVUnionPredicate);
- for (auto *Pred : EL.Predicates)
- Predicate->add(Pred);
-
return ExitNotTakenInfo(ExitBB, EL.ExactNotTaken, EL.MaxNotTaken,
- std::move(Predicate));
+ EL.Predicates);
});
assert((isa<SCEVCouldNotCompute>(ConstantMax) ||
isa<SCEVConstant>(ConstantMax)) &&
More information about the llvm-commits
mailing list