Skip to content

Commit 6b7b289

Browse files
Icohedronbogner
andauthored
[DirectX] Disable all libcalls for DXIL in TargetLibraryInfo.cpp (#138991)
Fixes #138787 To the best of my knowledge, DXIL does not (and should not) support any of the libcalls in [`TargetLibraryInfo.def`](https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/Analysis/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. --------- Co-authored-by: Justin Bogner <[email protected]>
1 parent 96dfd1e commit 6b7b289

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

llvm/lib/Analysis/TargetLibraryInfo.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,14 @@ static void initializeLibCalls(TargetLibraryInfoImpl &TLI, const Triple &T,
205205
return;
206206
}
207207

208+
// DXIL does not support libcalls, and disabling them here prevents a number
209+
// of passes from introducing libcalls into DXIL which would otherwise
210+
// complicate lowering/legalization
211+
if (T.isDXIL()) {
212+
TLI.disableAllFunctions();
213+
return;
214+
}
215+
208216
// memset_pattern{4,8,16} is only available on iOS 3.0 and Mac OS X 10.5 and
209217
// later. All versions of watchOS support it.
210218
if (T.isMacOSX()) {

0 commit comments

Comments
 (0)