[llvm] [DirectX] Disable all libcalls for DXIL in TargetLibraryInfo.cpp (PR #138991)
via llvm-commits
llvm-commits at lists.llvm.org
Wed May 7 16:37:41 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-analysis
Author: Deric C. (Icohedron)
<details>
<summary>Changes</summary>
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.
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/138991.diff
1 Files Affected:
- (modified) llvm/lib/Analysis/TargetLibraryInfo.cpp (+5)
``````````diff
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()) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/138991
More information about the llvm-commits
mailing list