CGOpenMPRuntime::UntiedTaskLocalDeclsRAII::UntiedTaskLocalDeclsRAII(
CodeGenFunction &CGF,
- const llvm::DenseMap<CanonicalDeclPtr<const VarDecl>,
- std::pair<Address, Address>> &LocalVars)
+ const llvm::MapVector<CanonicalDeclPtr<const VarDecl>,
+ std::pair<Address, Address>> &LocalVars)
: CGM(CGF.CGM), NeedToPush(!LocalVars.empty()) {
if (!NeedToPush)
return;
public:
UntiedTaskLocalDeclsRAII(
CodeGenFunction &CGF,
- const llvm::DenseMap<CanonicalDeclPtr<const VarDecl>,
- std::pair<Address, Address>> &LocalVars);
+ const llvm::MapVector<CanonicalDeclPtr<const VarDecl>,
+ std::pair<Address, Address>> &LocalVars);
~UntiedTaskLocalDeclsRAII();
};
llvm::SmallVector<NontemporalDeclsSet, 4> NontemporalDeclsStack;
using UntiedLocalVarsAddressesMap =
- llvm::DenseMap<CanonicalDeclPtr<const VarDecl>,
- std::pair<Address, Address>>;
+ llvm::MapVector<CanonicalDeclPtr<const VarDecl>,
+ std::pair<Address, Address>>;
llvm::SmallVector<UntiedLocalVarsAddressesMap, 4> UntiedLocalVarsStack;
/// Stack for list of addresses of declarations in current context marked as
auto &&CodeGen = [&Data, &S, CS, &BodyGen, &LastprivateDstsOrigs,
CapturedRegion](CodeGenFunction &CGF,
PrePostActionTy &Action) {
- llvm::DenseMap<CanonicalDeclPtr<const VarDecl>, std::pair<Address, Address>>
+ llvm::MapVector<CanonicalDeclPtr<const VarDecl>,
+ std::pair<Address, Address>>
UntiedLocalVars;
// Set proper addresses for generated private copies.
OMPPrivateScope Scope(CGF);
Ty = CGF.getContext().getPointerType(Ty);
Address PrivatePtr = CGF.CreateMemTemp(
CGF.getContext().getPointerType(Ty), ".local.ptr.addr");
- UntiedLocalVars.try_emplace(VD, PrivatePtr, Address::invalid());
+ auto Result = UntiedLocalVars.insert(
+ std::make_pair(VD, std::make_pair(PrivatePtr, Address::invalid())));
+ // If key exists update in place.
+ if (Result.second == false)
+ *Result.first = std::make_pair(
+ VD, std::make_pair(PrivatePtr, Address::invalid()));
CallArgs.push_back(PrivatePtr.getPointer());
ParamTypes.push_back(PrivatePtr.getType());
}
if (isAllocatableDecl(Pair.first)) {
llvm::Value *Ptr = CGF.Builder.CreateLoad(Pair.second.first);
Address Replacement(Ptr, CGF.getPointerAlign());
- Pair.getSecond().first = Replacement;
+ Pair.second.first = Replacement;
Ptr = CGF.Builder.CreateLoad(Replacement);
Replacement = Address(Ptr, CGF.getContext().getDeclAlign(Pair.first));
- Pair.getSecond().second = Replacement;
+ Pair.second.second = Replacement;
} else {
llvm::Value *Ptr = CGF.Builder.CreateLoad(Pair.second.first);
Address Replacement(Ptr, CGF.getContext().getDeclAlign(Pair.first));
- Pair.getSecond().first = Replacement;
+ Pair.second.first = Replacement;
}
}
}