[PATCH] D121951: [AMDGPU] Only warn when mixing printf and hostcall

Scott Linder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 17 14:16:12 PDT 2022


scott.linder added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp:567
 
-  if (auto HostcallFunction = M.getFunction("__ockl_hostcall_internal")) {
+  if (auto *HostcallFunction = M.getFunction("__ockl_hostcall_internal")) {
     for (auto &U : HostcallFunction->uses()) {
----------------
I will land this separately, as it is unrelated and NFC


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp:570
       if (auto *CI = dyn_cast<CallInst>(U.getUser())) {
-        M.getContext().emitError(
-            CI, "Cannot use both printf and hostcall in the same module");
+        M.getContext().diagnose(DiagnosticInfoInlineAsm(
+            *CI, "Cannot use both printf and hostcall in the same module",
----------------
I'm also not certain this is the the best option to classify the diagnostic, but it is what was used for the error so I just left it as-is. Suggestions welcome!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121951/new/

https://reviews.llvm.org/D121951



More information about the cfe-commits mailing list