[PATCH] D140558: AMDGPU: Fix broken and permissive handling of printf format strings

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 22 08:56:51 PST 2022


arsenm created this revision.
arsenm added reviewers: sameerds, AMDGPU, rampitec, vikramRH, yaxunl.
Herald added subscribers: kosarev, foad, kerbowa, hiraditya, tpr, dstuttard, jvesely, kzhuravl.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

This was completely broken with opaque pointers because it was
specifically looking for a constant expression with the global
variable as the first operand. Strip casts like normal, and properly
validate all of the restrictions rather than silently ignoring any
unhandled cases. Also be stricter that we aren't calling into some
unresolved or non-constant format string.

      

Also converts the test to opaque pointers and generated tests. There's
more broken initializer handling for strings inside the format string
processing too, but there's just no test coverage for this at all.


https://reviews.llvm.org/D140558

Files:
  llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
  llvm/test/CodeGen/AMDGPU/opencl-printf-unsupported.ll
  llvm/test/CodeGen/AMDGPU/opencl-printf.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140558.484855.patch
Type: text/x-patch
Size: 19856 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221222/7c62d776/attachment.bin>


More information about the llvm-commits mailing list