[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 <mail@justinbogner.com>
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index 3945dd4..c8b5683 100644
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -205,6 +205,14 @@
     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;
+  }
+
   // 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()) {