aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clang/lib/CodeGen/CGOpenMPRuntime.cpp3
-rw-r--r--llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h2
-rw-r--r--llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp14
-rw-r--r--mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp16
4 files changed, 21 insertions, 14 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 24e186a..0136f69 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -1550,7 +1550,8 @@ static llvm::TargetRegionEntryInfo getEntryInfoFromPresumedLoc(
return std::pair<std::string, uint64_t>(PLoc.getFilename(), PLoc.getLine());
};
- return OMPBuilder.getTargetEntryUniqueInfo(FileInfoCallBack, ParentName);
+ return OMPBuilder.getTargetEntryUniqueInfo(FileInfoCallBack,
+ *CGM.getFileSystem(), ParentName);
}
ConstantAddress CGOpenMPRuntime::getAddrOfDeclareTargetVar(const VarDecl *VD) {
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
index fbab7f3..0a11617 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
@@ -1406,7 +1406,7 @@ public:
/// any.
LLVM_ABI static TargetRegionEntryInfo
getTargetEntryUniqueInfo(FileIdentifierInfoCallbackTy CallBack,
- StringRef ParentName = "");
+ vfs::FileSystem &VFS, StringRef ParentName = "");
/// Enum class for the RedctionGen CallBack type to be used.
enum class ReductionGenCBKind { Clang, MLIR };
diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
index 94c5153..5980ee3 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -10313,17 +10313,19 @@ void OffloadEntriesInfoManager::getTargetRegionEntryFnName(
TargetRegionEntryInfo
OpenMPIRBuilder::getTargetEntryUniqueInfo(FileIdentifierInfoCallbackTy CallBack,
+ vfs::FileSystem &VFS,
StringRef ParentName) {
sys::fs::UniqueID ID(0xdeadf17e, 0);
auto FileIDInfo = CallBack();
uint64_t FileID = 0;
- std::error_code EC = sys::fs::getUniqueID(std::get<0>(FileIDInfo), ID);
- // If the inode ID could not be determined, create a hash value
- // the current file name and use that as an ID.
- if (EC)
+ if (ErrorOr<vfs::Status> Status = VFS.status(std::get<0>(FileIDInfo))) {
+ ID = Status->getUniqueID();
+ FileID = Status->getUniqueID().getFile();
+ } else {
+ // If the inode ID could not be determined, create a hash value
+ // the current file name and use that as an ID.
FileID = hash_value(std::get<0>(FileIDInfo));
- else
- FileID = ID.getFile();
+ }
return TargetRegionEntryInfo(ParentName, ID.getDevice(), FileID,
std::get<1>(FileIDInfo));
diff --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
index bb1f3d0..53209a4 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
@@ -3616,8 +3616,10 @@ getDeclareTargetRefPtrSuffix(LLVM::GlobalOp globalOp,
llvm::StringRef(loc.getFilename()), loc.getLine());
};
+ auto vfs = llvm::vfs::getRealFileSystem();
os << llvm::format(
- "_%x", ompBuilder.getTargetEntryUniqueInfo(fileInfoCallBack).FileID);
+ "_%x",
+ ompBuilder.getTargetEntryUniqueInfo(fileInfoCallBack, *vfs).FileID);
}
os << "_decl_tgt_ref_ptr";
@@ -5915,10 +5917,12 @@ convertDeclareTargetAttr(Operation *op, mlir::omp::DeclareTargetAttr attribute,
lineNo);
};
+ auto vfs = llvm::vfs::getRealFileSystem();
+
ompBuilder->registerTargetGlobalVariable(
captureClause, deviceClause, isDeclaration, isExternallyVisible,
- ompBuilder->getTargetEntryUniqueInfo(fileInfoCallBack), mangledName,
- generatedRefs, /*OpenMPSimd*/ false, targetTriple,
+ ompBuilder->getTargetEntryUniqueInfo(fileInfoCallBack, *vfs),
+ mangledName, generatedRefs, /*OpenMPSimd*/ false, targetTriple,
/*GlobalInitializer*/ nullptr, /*VariableLinkage*/ nullptr,
gVal->getType(), gVal);
@@ -5928,9 +5932,9 @@ convertDeclareTargetAttr(Operation *op, mlir::omp::DeclareTargetAttr attribute,
ompBuilder->Config.hasRequiresUnifiedSharedMemory())) {
ompBuilder->getAddrOfDeclareTargetVar(
captureClause, deviceClause, isDeclaration, isExternallyVisible,
- ompBuilder->getTargetEntryUniqueInfo(fileInfoCallBack), mangledName,
- generatedRefs, /*OpenMPSimd*/ false, targetTriple, gVal->getType(),
- /*GlobalInitializer*/ nullptr,
+ ompBuilder->getTargetEntryUniqueInfo(fileInfoCallBack, *vfs),
+ mangledName, generatedRefs, /*OpenMPSimd*/ false, targetTriple,
+ gVal->getType(), /*GlobalInitializer*/ nullptr,
/*VariableLinkage*/ nullptr);
}
}