From 27d707d8229831b7d923091817fcfe830b80b593 Mon Sep 17 00:00:00 2001 From: Icohedron Date: Wed, 7 May 2025 23:17:42 +0000 Subject: [PATCH 1/2] Disable all libcalls for DXIL Co-authored-by: Justin Bogner --- llvm/lib/Analysis/TargetLibraryInfo.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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()) { From 24a41c9644c312919fbb193c09e90d92a41fd55a Mon Sep 17 00:00:00 2001 From: Icohedron Date: Mon, 12 May 2025 17:09:39 +0000 Subject: [PATCH 2/2] Add a comment describing why libcalls are disabled for DXIL --- llvm/lib/Analysis/TargetLibraryInfo.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp index 1934fb4e1fa26..c8b568354965d 100644 --- a/llvm/lib/Analysis/TargetLibraryInfo.cpp +++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp @@ -205,6 +205,9 @@ static void initializeLibCalls(TargetLibraryInfoImpl &TLI, const Triple &T, return; } + // DXIL does not support libcalls, and disabling them here prevents a number + // of passes from introducing libcalls into DXIL which would otherwise + // complicate lowering/legalization if (T.isDXIL()) { TLI.disableAllFunctions(); return;