1. [HIP][AMDGPU] expand printf when compiling HIP to AMDGPU (details)
Commit ed181efa175d3e0acc134e6cd161914e64c7195e by sameer.sahasrabuddhe
[HIP][AMDGPU] expand printf when compiling HIP to AMDGPU
Summary: This change implements the expansion in two parts:
- Add a utility function emitAMDGPUPrintfCall() in LLVM.
- Invoke the above function from Clang CodeGen, when processing a HIP
program for the AMDGPU target.
The printf expansion has undefined behaviour if the format string is not
a compile-time constant. As a sufficient condition, the HIP ToolChain
now emits -Werror=format-nonliteral.
Reviewed By: arsenm
Differential Revision:
The file was modifiedllvm/lib/Transforms/Utils/CMakeLists.txt (diff)
The file was addedclang/test/CodeGenHIP/printf-aggregate.cpp
The file was addedllvm/include/llvm/Transforms/Utils/AMDGPUEmitPrintf.h
The file was addedllvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp
The file was modifiedclang/lib/CodeGen/CGBuiltin.cpp (diff)
The file was modifiedclang/lib/CodeGen/CGGPUBuiltin.cpp (diff)
The file was modifiedclang/lib/CodeGen/CodeGenFunction.h (diff)
The file was modifiedclang/lib/Driver/ToolChains/HIP.cpp (diff)
The file was addedclang/test/Driver/hip-printf.hip
The file was addedclang/test/CodeGenHIP/printf.cpp