[llvm] e88b6ed - [LLE] std::inserter doesn't work with SmallSet, so don't use it.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 20 06:47:56 PDT 2020
Author: Benjamin Kramer
Date: 2020-07-20T15:47:42+02:00
New Revision: e88b6ed7486865424a8d49543c523838dcb01875
URL: https://github.com/llvm/llvm-project/commit/e88b6ed7486865424a8d49543c523838dcb01875
DIFF: https://github.com/llvm/llvm-project/commit/e88b6ed7486865424a8d49543c523838dcb01875.diff
LOG: [LLE] std::inserter doesn't work with SmallSet, so don't use it.
Added:
Modified:
llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp b/llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
index 4412b3079461..3b7069564041 100644
--- a/llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
@@ -308,8 +308,8 @@ class LoadEliminationForLoop {
/// We need a check if one is a pointer for a candidate load and the other is
/// a pointer for a possibly intervening store.
bool needsChecking(unsigned PtrIdx1, unsigned PtrIdx2,
- const SmallPtrSet<Value *, 4> &PtrsWrittenOnFwdingPath,
- const std::set<Value *> &CandLoadPtrs) {
+ const SmallPtrSetImpl<Value *> &PtrsWrittenOnFwdingPath,
+ const SmallPtrSetImpl<Value *> &CandLoadPtrs) {
Value *Ptr1 =
LAI.getRuntimePointerChecking()->getPointerInfo(PtrIdx1).PointerValue;
Value *Ptr2 =
@@ -384,11 +384,9 @@ class LoadEliminationForLoop {
findPointersWrittenOnForwardingPath(Candidates);
// Collect the pointers of the candidate loads.
- // FIXME: SmallPtrSet does not work with std::inserter.
- std::set<Value *> CandLoadPtrs;
- transform(Candidates,
- std::inserter(CandLoadPtrs, CandLoadPtrs.begin()),
- std::mem_fn(&StoreToLoadForwardingCandidate::getLoadPtr));
+ SmallPtrSet<Value *, 4> CandLoadPtrs;
+ for (const auto &Candidate : Candidates)
+ CandLoadPtrs.insert(Candidate.getLoadPtr());
const auto &AllChecks = LAI.getRuntimePointerChecking()->getChecks();
SmallVector<RuntimePointerCheck, 4> Checks;
More information about the llvm-commits
mailing list