Skip to content

[ADT] Deprecate DenseMap::getOrInsertDefault #107040

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions clang/lib/Sema/SemaHLSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1123,13 +1123,11 @@ class DiagnoseHLSLAvailability

// Helper methods for dealing with shader stage bitmap
void AddToScannedFunctions(const FunctionDecl *FD) {
unsigned &ScannedStages = ScannedDecls.getOrInsertDefault(FD);
unsigned &ScannedStages = ScannedDecls[FD];
ScannedStages |= CurrentShaderStageBit;
}

unsigned GetScannedStages(const FunctionDecl *FD) {
return ScannedDecls.getOrInsertDefault(FD);
}
unsigned GetScannedStages(const FunctionDecl *FD) { return ScannedDecls[FD]; }

bool WasAlreadyScannedInCurrentStage(const FunctionDecl *FD) {
return WasAlreadyScannedInCurrentStage(GetScannedStages(FD));
Expand Down
4 changes: 2 additions & 2 deletions flang/lib/Optimizer/Transforms/AddAliasTags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ void PassState::processFunctionScopes(mlir::func::FuncOp func) {
if (scopeNames.contains(func))
return;

auto &scopeMap = scopeNames.getOrInsertDefault(func);
auto &scopeOps = sortedScopeOperations.getOrInsertDefault(func);
auto &scopeMap = scopeNames[func];
auto &scopeOps = sortedScopeOperations[func];
func.walk([&](fir::DummyScopeOp op) { scopeOps.push_back(op); });
llvm::stable_sort(scopeOps, [&](const fir::DummyScopeOp &op1,
const fir::DummyScopeOp &op2) {
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/ADT/DenseMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,15 @@ class DenseMapBase : public DebugEpochBase {
/// Returns the value associated to the key in the map if it exists. If it
/// does not exist, emplace a default value for the key and returns a
/// reference to the newly created value.
LLVM_DEPRECATED("Use operator[] instead", "[Key]")
ValueT &getOrInsertDefault(KeyT &&Key) {
return try_emplace(Key).first->second;
}

/// Returns the value associated to the key in the map if it exists. If it
/// does not exist, emplace a default value for the key and returns a
/// reference to the newly created value.
LLVM_DEPRECATED("Use operator[] instead", "[Key]")
ValueT &getOrInsertDefault(const KeyT &Key) {
return try_emplace(Key).first->second;
}
Expand Down
4 changes: 2 additions & 2 deletions mlir/lib/Transforms/SROA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ computeDestructuringInfo(DestructurableMemorySlot &slot,

auto scheduleAsBlockingUse = [&](OpOperand &use) {
SmallPtrSetImpl<OpOperand *> &blockingUses =
info.userToBlockingUses.getOrInsertDefault(use.getOwner());
info.userToBlockingUses[use.getOwner()];
blockingUses.insert(&use);
};

Expand Down Expand Up @@ -122,7 +122,7 @@ computeDestructuringInfo(DestructurableMemorySlot &slot,
assert(llvm::is_contained(user->getResults(), blockingUse->get()));

SmallPtrSetImpl<OpOperand *> &newUserBlockingUseSet =
info.userToBlockingUses.getOrInsertDefault(blockingUse->getOwner());
info.userToBlockingUses[blockingUse->getOwner()];
newUserBlockingUseSet.insert(blockingUse);
}
}
Expand Down
Loading