[PATCH] D112680: [OpenMP] Lower printf to __llvm_omp_vprintf

Jon Chesterfield via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 27 18:01:14 PDT 2021


JonChesterfield added a comment.

Makes more sense with D112227 <https://reviews.llvm.org/D112227> landed, but probably worthwhile just for the old runtime as it removes the link failure from all the tests that use printf.



================
Comment at: clang/lib/CodeGen/CGGPUBuiltin.cpp:94
+std::pair<llvm::Value *, llvm::TypeSize>
+packArgsIntoNVPTXFormatBuffer(CodeGenFunction *CGF, const CallArgList &Args) {
 
----------------
This packArgsIntoNVPTXFormatBuffer helper could/should be factored out as a first patch to make the minimal change to EmitNVPTXDevicePrintfCallExpr clearer in the diff


================
Comment at: openmp/libomptarget/DeviceRTL/include/Debug.h:36
 
-#define PRINTF(fmt, ...) (void)printf(fmt, __VA_ARGS__);
+#define PRINTF(fmt, ...) (void)printf(fmt, ##__VA_ARGS__);
 #define PRINT(str) PRINTF("%s", str)
----------------
the ## could be rolled into some other change, it makes PRINTF("no args") work, at which point we probably don't need/want #define PRINT()


================
Comment at: openmp/libomptarget/DeviceRTL/include/Interface.h:351
+/// Printf
+int32_t __llvm_omp_vprintf(const char *Format, void *Arguments, uint32_t Size);
 }
----------------
Possibly not a good thing to have in the interface


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112680



More information about the cfe-commits mailing list