-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[clang] Use the VFS to get the OpenMP entry info #160935
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-clang-codegen Author: Jan Svoboda (jansvoboda11) ChangesThis PR uses the VFS to get the OpenMP entry info 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/160935.diff 1 Files Affected:
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 0136f69172aa5..75bde3f72c4c2 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -1542,10 +1542,8 @@ static llvm::TargetRegionEntryInfo getEntryInfoFromPresumedLoc(
SourceManager &SM = CGM.getContext().getSourceManager();
PresumedLoc PLoc = SM.getPresumedLoc(BeginLoc);
- llvm::sys::fs::UniqueID ID;
- if (llvm::sys::fs::getUniqueID(PLoc.getFilename(), ID)) {
+ if (CGM.getFileSystem()->exists(PLoc.getFilename()))
PLoc = SM.getPresumedLoc(BeginLoc, /*UseLineDirectives=*/false);
- }
return std::pair<std::string, uint64_t>(PLoc.getFilename(), PLoc.getLine());
};
|
@llvm/pr-subscribers-clang Author: Jan Svoboda (jansvoboda11) ChangesThis PR uses the VFS to get the OpenMP entry info 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/160935.diff 1 Files Affected:
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 0136f69172aa5..75bde3f72c4c2 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -1542,10 +1542,8 @@ static llvm::TargetRegionEntryInfo getEntryInfoFromPresumedLoc(
SourceManager &SM = CGM.getContext().getSourceManager();
PresumedLoc PLoc = SM.getPresumedLoc(BeginLoc);
- llvm::sys::fs::UniqueID ID;
- if (llvm::sys::fs::getUniqueID(PLoc.getFilename(), ID)) {
+ if (CGM.getFileSystem()->exists(PLoc.getFilename()))
PLoc = SM.getPresumedLoc(BeginLoc, /*UseLineDirectives=*/false);
- }
return std::pair<std::string, uint64_t>(PLoc.getFilename(), PLoc.getLine());
};
|
This reverts commit 220ad03.
@jansvoboda11 this change breaks -save-temps builds.
Build without -save-temps and make llvm print out list of target regions it identified: Excerpt from resulting diagnostic shows that there are multiple entry points: Build with -save-temps and make llvm print out list of target regions it identified: Excerpt from resulting diagnostic shows that there are no kernels AMDGPU HSA Metadata amdhsa.kernels: []
Please fix? Debugging showed me that this line When not using -save-temps, the preprocessed <src_file>.i does not exist in the build folder and the source file remains the same. For some reason, this has an effect on clang's ability to identify target regions when building for the host, which seems fragile at best. |
Thanks for bringing this to my attention, @carlobertolli. I'm happy to take a look, but I'm unable to reproduce on macOS. Could you please create a self-contained LIT test independent of the host platform? |
here we go: |
In response to request here #160935 by @jansvoboda11
My guess as to why this stopped working is because the function in OMPIRBuilder.cpp is referring to the source_file.c instead of the preprocessed source_file.i, and when we scan for target regions, we cannot find a match. |
…#161472) In response to request here llvm/llvm-project#160935 by @jansvoboda11
The PR #160935 incorrectly replaced `llvm::sys::fs::getUniqueID()` with `llvm::vfs::FileSystem::exists()` in a condition. That's incorrect, since the first function returns `std::error_code` that evaluates to `true` when there is an error (file doesn't exist), while the new code does the opposite. This PR fixes that issue by inverting the conditional. Co-authored-by: ronlieb <[email protected]>
This PR uses the VFS to get the OpenMP entry info instead of going straight to the real file system. This matches the behavior of other input files of the compiler.
The PR llvm#160935 incorrectly replaced `llvm::sys::fs::getUniqueID()` with `llvm::vfs::FileSystem::exists()` in a condition. That's incorrect, since the first function returns `std::error_code` that evaluates to `true` when there is an error (file doesn't exist), while the new code does the opposite. This PR fixes that issue by inverting the conditional. Co-authored-by: ronlieb <[email protected]>
This PR uses the VFS to get the OpenMP entry info instead of going straight to the real file system. This matches the behavior of other input files of the compiler.
In response to request here llvm#160935 by @jansvoboda11
The PR llvm#160935 incorrectly replaced `llvm::sys::fs::getUniqueID()` with `llvm::vfs::FileSystem::exists()` in a condition. That's incorrect, since the first function returns `std::error_code` that evaluates to `true` when there is an error (file doesn't exist), while the new code does the opposite. This PR fixes that issue by inverting the conditional. Co-authored-by: ronlieb <[email protected]>
This PR uses the VFS to get the OpenMP entry info instead of going straight to the real file system. This matches the behavior of other input files of the compiler.
The PR llvm#160935 incorrectly replaced `llvm::sys::fs::getUniqueID()` with `llvm::vfs::FileSystem::exists()` in a condition. That's incorrect, since the first function returns `std::error_code` that evaluates to `true` when there is an error (file doesn't exist), while the new code does the opposite. This PR fixes that issue by inverting the conditional. Co-authored-by: ronlieb <[email protected]>
This PR uses the VFS to get the OpenMP entry info instead of going straight to the real file system. This matches the behavior of other input files of the compiler.