@@ -9659,9 +9659,9 @@ bool CGOpenMPRuntime::emitTargetFunctions(GlobalDecl GD) {
9659
9659
}
9660
9660
9661
9661
const ValueDecl *VD = cast<ValueDecl>(GD.getDecl());
9662
- StringRef Name = CGM.getMangledName(GD);
9663
9662
// Try to detect target regions in the function.
9664
9663
if (const auto *FD = dyn_cast<FunctionDecl>(VD)) {
9664
+ StringRef Name = CGM.getMangledName(GD);
9665
9665
scanForTargetRegionsFunctions(FD->getBody(), Name);
9666
9666
Optional<OMPDeclareTargetDeclAttr::DevTypeTy> DevTy =
9667
9667
OMPDeclareTargetDeclAttr::getDeviceType(FD);
@@ -9672,7 +9672,7 @@ bool CGOpenMPRuntime::emitTargetFunctions(GlobalDecl GD) {
9672
9672
9673
9673
// Do not to emit function if it is not marked as declare target.
9674
9674
return !OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(VD) &&
9675
- AlreadyEmittedTargetFunctions .count(Name ) == 0;
9675
+ AlreadyEmittedTargetDecls .count(VD ) == 0;
9676
9676
}
9677
9677
9678
9678
bool CGOpenMPRuntime::emitTargetGlobalVariable(GlobalDecl GD) {
@@ -9903,20 +9903,20 @@ bool CGOpenMPRuntime::markAsGlobalTarget(GlobalDecl GD) {
9903
9903
if (!CGM.getLangOpts().OpenMPIsDevice || !ShouldMarkAsGlobal)
9904
9904
return true;
9905
9905
9906
- StringRef Name = CGM.getMangledName(GD);
9907
9906
const auto *D = cast<FunctionDecl>(GD.getDecl());
9908
9907
// Do not to emit function if it is marked as declare target as it was already
9909
9908
// emitted.
9910
9909
if (OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(D)) {
9911
- if (D->hasBody() && AlreadyEmittedTargetFunctions.count(Name) == 0) {
9912
- if (auto *F = dyn_cast_or_null<llvm::Function>(CGM.GetGlobalValue(Name)))
9910
+ if (D->hasBody() && AlreadyEmittedTargetDecls.count(D) == 0) {
9911
+ if (auto *F = dyn_cast_or_null<llvm::Function>(
9912
+ CGM.GetGlobalValue(CGM.getMangledName(GD))))
9913
9913
return !F->isDeclaration();
9914
9914
return false;
9915
9915
}
9916
9916
return true;
9917
9917
}
9918
9918
9919
- return !AlreadyEmittedTargetFunctions .insert(Name ).second;
9919
+ return !AlreadyEmittedTargetDecls .insert(D ).second;
9920
9920
}
9921
9921
9922
9922
llvm::Function *CGOpenMPRuntime::emitRequiresDirectiveRegFun() {
0 commit comments