-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[clang] Use the VFS to create the OpenMP region entry ID #160918
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
Conversation
@llvm/pr-subscribers-mlir-llvm @llvm/pr-subscribers-clang-codegen Author: Jan Svoboda (jansvoboda11) ChangesThis PR uses the VFS to create the OpenMP target entry instead of going straight to the real file system. This matches the behavior of other input files of the compiler. Full diff: https://github.com/llvm/llvm-project/pull/160918.diff 3 Files Affected:
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index c90e1a487daf9..9004296a7e453 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 f43ef932e965a..bfe1c8090acfe 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
@@ -1402,7 +1402,7 @@ class OpenMPIRBuilder {
/// 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 9b67465faab0b..8fc1a99e4bc4c 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -10312,17 +10312,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));
|
@llvm/pr-subscribers-flang-openmp Author: Jan Svoboda (jansvoboda11) ChangesThis PR uses the VFS to create the OpenMP target entry instead of going straight to the real file system. This matches the behavior of other input files of the compiler. Full diff: https://github.com/llvm/llvm-project/pull/160918.diff 3 Files Affected:
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index c90e1a487daf9..9004296a7e453 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 f43ef932e965a..bfe1c8090acfe 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
@@ -1402,7 +1402,7 @@ class OpenMPIRBuilder {
/// 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 9b67465faab0b..8fc1a99e4bc4c 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -10312,17 +10312,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));
|
This PR uses the VFS to create the OpenMP target entry instead of going straight to the real file system. This matches the behavior of other input files of the compiler.
This PR uses the VFS to create the OpenMP target entry instead of going straight to the real file system. This matches the behavior of other input files of the compiler.
This PR uses the VFS to create the OpenMP target entry instead of going straight to the real file system. This matches the behavior of other input files of the compiler.