[all-commits] [llvm/llvm-project] ed181e: [HIP][AMDGPU] expand printf when compiling HIP to ...

Sameer Sahasrabuddhe via All-commits all-commits at lists.llvm.org
Thu Jan 16 01:55:33 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: ed181efa175d3e0acc134e6cd161914e64c7195e
      https://github.com/llvm/llvm-project/commit/ed181efa175d3e0acc134e6cd161914e64c7195e
  Author: Sameer Sahasrabuddhe <sameer.sahasrabuddhe at amd.com>
  Date:   2020-01-16 (Thu, 16 Jan 2020)

  Changed paths:
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/lib/CodeGen/CGGPUBuiltin.cpp
    M clang/lib/CodeGen/CodeGenFunction.h
    M clang/lib/Driver/ToolChains/HIP.cpp
    A clang/test/CodeGenHIP/printf-aggregate.cpp
    A clang/test/CodeGenHIP/printf.cpp
    A clang/test/Driver/hip-printf.hip
    A llvm/include/llvm/Transforms/Utils/AMDGPUEmitPrintf.h
    A llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp
    M llvm/lib/Transforms/Utils/CMakeLists.txt

  Log Message:
  -----------
  [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: https://reviews.llvm.org/D71365




More information about the All-commits mailing list