<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/138787>138787</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[DirectX] Disable libcalls that we don't support
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:DirectX
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
bogner
</td>
</tr>
</table>
<pre>
We should disable libcalls such as memcpy and memset that we don't support in DXIL rather than try to chase down the long tail of legalizing them. Something like this does this will prevent LLVM optimizations from generating new libcalls:
```diff
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index e2fd2aa13cce..ff9b8ff45258 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()) {
```
This may be sufficient and just need testing, but when implementing we should take a look at the set of libcalls and make sure that disabling all of them is the right choice.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycVMtu47gS_Rp6U7BAU_JDCy_sGAYCOMgiwb3ZDSiqJFWHIgWyZI_76weU7U7PNGbRAxAQSdWDVXXO0TFS6xC3YrkXy8NMj9z5sK186zDMKl9ft_9HiJ0fbQ01RV1ZBEuV0dZGiKPpQEfosTfDFbSr0zYiA3ea4YJQeyfUmiGOw-ADAzk4fDyfIGjuMCQzBxyuwB5Mp2NyuDjgDsF61wJrsuAbsNhqS98pXXXYZ_Dme-QunS19InBHEWqP8ba7kLUwBDyjYzid_vcCfmDq6btm8i5CE3wPLToMmlMMh5cfRYl8J-S0VvK2amo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