Skip to content

Commit 8a5b6b3

Browse files
[flang] Use SmallPtrSet directly instead of SmallSet (NFC) (#154471)
I'm trying to remove the redirection in SmallSet.h: template <typename PointeeType, unsigned N> class SmallSet<PointeeType*, N> : public SmallPtrSet<PointeeType*, N> {}; to make it clear that we are using SmallPtrSet. There are only handful places that rely on this redirection. This patch replaces SmallSet to SmallPtrSet where the element type is a pointer.
1 parent db0ecea commit 8a5b6b3

File tree

7 files changed

+12
-11
lines changed

7 files changed

+12
-11
lines changed

flang/include/flang/Lower/Support/Utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void privatizeSymbol(
101101
lower::AbstractConverter &converter, fir::FirOpBuilder &firOpBuilder,
102102
lower::SymMap &symTable,
103103
llvm::SetVector<const semantics::Symbol *> &allPrivatizedSymbols,
104-
llvm::SmallSet<const semantics::Symbol *, 16> &mightHaveReadHostSym,
104+
llvm::SmallPtrSet<const semantics::Symbol *, 16> &mightHaveReadHostSym,
105105
const semantics::Symbol *symToPrivatize, OperandsStructType *clauseOps);
106106

107107
} // end namespace Fortran::lower

flang/lib/Lower/Bridge.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2066,7 +2066,8 @@ class FirConverter : public Fortran::lower::AbstractConverter {
20662066
// complete.
20672067
bool useDelayedPriv = enableDelayedPrivatization && doConcurrentLoopOp;
20682068
llvm::SetVector<const Fortran::semantics::Symbol *> allPrivatizedSymbols;
2069-
llvm::SmallSet<const Fortran::semantics::Symbol *, 16> mightHaveReadHostSym;
2069+
llvm::SmallPtrSet<const Fortran::semantics::Symbol *, 16>
2070+
mightHaveReadHostSym;
20702071

20712072
for (const Fortran::semantics::Symbol *symToPrivatize : info.localSymList) {
20722073
if (useDelayedPriv) {

flang/lib/Lower/OpenMP/DataSharingProcessor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class DataSharingProcessor {
107107
lower::pft::Evaluation &eval;
108108
bool shouldCollectPreDeterminedSymbols;
109109
bool useDelayedPrivatization;
110-
llvm::SmallSet<const semantics::Symbol *, 16> mightHaveReadHostSym;
110+
llvm::SmallPtrSet<const semantics::Symbol *, 16> mightHaveReadHostSym;
111111
lower::SymMap &symTable;
112112
bool isTargetPrivatization;
113113
OMPConstructSymbolVisitor visitor;

flang/lib/Lower/PFTBuilder.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,11 +1742,11 @@ struct SymbolDependenceAnalysis {
17421742
layeredVarList[i].end());
17431743
}
17441744

1745-
llvm::SmallSet<const semantics::Symbol *, 32> seen;
1745+
llvm::SmallPtrSet<const semantics::Symbol *, 32> seen;
17461746
std::vector<Fortran::lower::pft::VariableList> layeredVarList;
1747-
llvm::SmallSet<const semantics::Symbol *, 32> aliasSyms;
1747+
llvm::SmallPtrSet<const semantics::Symbol *, 32> aliasSyms;
17481748
/// Set of scopes that have been analyzed for aliases.
1749-
llvm::SmallSet<const semantics::Scope *, 4> analyzedScopes;
1749+
llvm::SmallPtrSet<const semantics::Scope *, 4> analyzedScopes;
17501750
std::vector<Fortran::lower::pft::Variable::AggregateStore> stores;
17511751
};
17521752
} // namespace

flang/lib/Lower/Support/Utils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ void privatizeSymbol(
654654
lower::AbstractConverter &converter, fir::FirOpBuilder &firOpBuilder,
655655
lower::SymMap &symTable,
656656
llvm::SetVector<const semantics::Symbol *> &allPrivatizedSymbols,
657-
llvm::SmallSet<const semantics::Symbol *, 16> &mightHaveReadHostSym,
657+
llvm::SmallPtrSet<const semantics::Symbol *, 16> &mightHaveReadHostSym,
658658
const semantics::Symbol *symToPrivatize, OperandsStructType *clauseOps) {
659659
constexpr bool isDoConcurrent =
660660
std::is_same_v<OpType, fir::LocalitySpecifierOp>;
@@ -846,7 +846,7 @@ privatizeSymbol<mlir::omp::PrivateClauseOp, mlir::omp::PrivateClauseOps>(
846846
lower::AbstractConverter &converter, fir::FirOpBuilder &firOpBuilder,
847847
lower::SymMap &symTable,
848848
llvm::SetVector<const semantics::Symbol *> &allPrivatizedSymbols,
849-
llvm::SmallSet<const semantics::Symbol *, 16> &mightHaveReadHostSym,
849+
llvm::SmallPtrSet<const semantics::Symbol *, 16> &mightHaveReadHostSym,
850850
const semantics::Symbol *symToPrivatize,
851851
mlir::omp::PrivateClauseOps *clauseOps);
852852

@@ -855,7 +855,7 @@ privatizeSymbol<fir::LocalitySpecifierOp, fir::LocalitySpecifierOperands>(
855855
lower::AbstractConverter &converter, fir::FirOpBuilder &firOpBuilder,
856856
lower::SymMap &symTable,
857857
llvm::SetVector<const semantics::Symbol *> &allPrivatizedSymbols,
858-
llvm::SmallSet<const semantics::Symbol *, 16> &mightHaveReadHostSym,
858+
llvm::SmallPtrSet<const semantics::Symbol *, 16> &mightHaveReadHostSym,
859859
const semantics::Symbol *symToPrivatize,
860860
fir::LocalitySpecifierOperands *clauseOps);
861861

flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ struct MaskedArrayExpr {
9696
/// hlfir.elemental_addr that form the elemental tree producing
9797
/// the expression value. hlfir.elemental that produce values
9898
/// used inside transformational operations are not part of this set.
99-
llvm::SmallSet<mlir::Operation *, 4> elementalParts{};
99+
llvm::SmallPtrSet<mlir::Operation *, 4> elementalParts{};
100100
/// Was generateNoneElementalPart called?
101101
bool noneElementalPartWasGenerated = false;
102102
/// Is this expression the mask expression of the outer where statement?

flang/lib/Optimizer/HLFIR/Transforms/ScheduleOrderedAssignments.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class Scheduler {
137137
// Schedule being built.
138138
hlfir::Schedule schedule;
139139
/// Leaf regions that have been saved so far.
140-
llvm::SmallSet<mlir::Region *, 16> savedRegions;
140+
llvm::SmallPtrSet<mlir::Region *, 16> savedRegions;
141141
/// Is schedule.back() a schedule that is only saving region with read
142142
/// effects?
143143
bool currentRunIsReadOnly = false;

0 commit comments

Comments
 (0)