-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[DirectX] Disable all libcalls for DXIL in TargetLibraryInfo.cpp #138991
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-llvm-analysis Author: Deric C. (Icohedron) ChangesFixes #138787 To the best of my knowledge, DXIL does not (and should not) support any of the libcalls in Locally, the codegen tests for Clang HLSL and the DirectX backend appear to pass without any issues. Full diff: https://github.com/llvm/llvm-project/pull/138991.diff 1 Files Affected:
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index 3945dd4a8b55d..1934fb4e1fa26 100644
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -205,6 +205,11 @@ static void initializeLibCalls(TargetLibraryInfoImpl &TLI, const Triple &T,
return;
}
+ if (T.isDXIL()) {
+ TLI.disableAllFunctions();
+ return;
+ }
+
// memset_pattern{4,8,16} is only available on iOS 3.0 and Mac OS X 10.5 and
// later. All versions of watchOS support it.
if (T.isMacOSX()) {
|
Co-authored-by: Justin Bogner <[email protected]>
007a1ae
to
27d707d
Compare
This is correct we do not support libcalls
We should not enable any libcalls if something breaks thats probably a bug. If say we some how ended up in
This seems to be more a side effect of how a few optimizations have been written than a defintitive stop all memcpys for example
llvm-project/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp Lines 633 to 639 in eebb50a
All that said we should still do this change, because we don't want libcalls but I want to emphasize that I don't think this solves the memcpy problem in an intentional way. |
Fixes #138787
To the best of my knowledge, DXIL does not (and should not) support any of the libcalls in
TargetLibraryInfo.def
.Math libcalls are not used in HLSL and also do not have lowerings to DXIL. (The current implementation of math functions are done via intrinsics.)
If there is a mistake with disabling all libcalls, then the libcalls we need can be re-enabled in a follow-up PR.
Locally, the codegen tests for Clang HLSL and the DirectX backend appear to pass without any issues.
The offload test suite's clang-d3d12 tests are also passing locally (Unsupported: 31 (62.00%), Passed: 19 (38.00%))
The change this PR introduces also eliminates the problematic memcpy intrinsics operating with a non-constant length argument and addrspace(3) ptrs showing up when compiling DML shaders. The number of DML shaders compiling successfully is greater with this PR than without.