summaryrefslogtreecommitdiff
path: root/llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
AgeCommit message (Collapse)Author
2025-11-14[AMDGPU] Make use of getFunction and getMF. NFC. (#167872)Jay Foad
2025-07-15[AMDGPU] Support 'F' and 'A' conversion specifiers with ocl printf (#148784)Vikram Hegde
Runtime support in progress downstream..
2025-05-28Warn on misuse of DiagnosticInfo classes that hold Twines (#137397)Justin Bogner
This annotates the `Twine` passed to the constructors of the various DiagnosticInfo subclasses with `[[clang::lifetimebound]]`, which causes us to warn when we would try to print the twine after it had already been destructed. We also update `DiagnosticInfoUnsupported` to hold a `const Twine &` like all of the other DiagnosticInfo classes, since this warning allows us to clean up all of the places where it was being used incorrectly.
2025-04-07[NFC][LLVM][AMDGPU] Cleanup pass initialization for AMDGPU (#134410)Rahul Joshi
- Remove calls to pass initialization from pass constructors. - https://github.com/llvm/llvm-project/issues/111767
2025-01-21[IR] Replace of PointerType::get(Type) with opaque version (NFC) (#123617)Mats Jun Larsen
In accordance with https://github.com/llvm/llvm-project/issues/123569 In order to keep the patch at reasonable size, this PR only covers for the llvm subproject, unittests excluded.
2024-10-03[AMDGPU] Qualify auto. NFC. (#110878)Jay Foad
Generated automatically with: $ clang-tidy -fix -checks=-*,llvm-qualified-auto $(find lib/Target/AMDGPU/ -type f)
2024-07-26Reapply "[OpenMP][libc] Remove special handling for OpenMP printf (#98940)"Joseph Huber
This reverts commit fea5914c926e2f013a8b5e27eaa74c7047fb2c71.
2024-07-26Revert "[OpenMP][libc] Remove special handling for OpenMP printf (#98940)"Joseph Huber
This reverts commit 069e8bcd82c4420239f95c7e6a09e1f756317cfc. Summary: Some tests failing, revert this for now.
2024-07-26[OpenMP][libc] Remove special handling for OpenMP printf (#98940)Joseph Huber
Summary: Currently there are several layers to handle `printf`. Since we now have varargs and an implementation of `printf` this can be heavily simplified. 1. The frontend renames `printf` into `omp_vprintf` and gives it an argument buffer. Removing 1. triggered some code in the AMDGPU backend menat for HIP / OpenCL, so I hadded an exception to it. 2. Forward this to CUDA vprintf or ignore it. We no longer need special handling for it since we have varargs. So now we just forward this to CUDA vprintf if we have libc, otherwise just leave `printf` as an external function and expect that `libc` will be linked in.
2024-07-16[AMDGPU] clang-tidy: replace macro with enum. NFC.Jay Foad
2024-07-16[AMDGPU] clang-tidy: define trivial constructors with = default. NFC.Jay Foad
2024-06-29[IRBuilder] Don't include Module.h (NFC) (#97159)Nikita Popov
This used to be necessary to fetch the DataLayout, but isn't anymore.
2024-03-19[NFC][RemoveDIs] Use iterators for insertion at various call-sites (#84736)Jeremy Morse
These are the last remaining "trivial" changes to passes that use Instruction pointers for insertion. All of this should be NFC, it's just changing the spelling of how we identify a position. In one or two locations, I'm also switching uses of getNextNode etc to using std::next with iterators. This too should be NFC. --------- Merged by: Stephen Tozer <stephen.tozer@sony.com>
2023-11-15Replace usage of StringRef::find_last_of with a string literal of size one ↵serge-sans-paille
by the equivalent char literal
2023-08-22[AMDGPU] Respect `nobuiltin` when converting `printf`Joseph Huber
The AMDGPU backend uses a pass to transform calls to the `printf` function to a built-in verision for either HIP or OpenCL. Currently this does not respect `-fno-builtin` and is always emitted. This allows the user to turn off this functionality as is standard for these types of built-in transformations. The motivation behind this change is to allow the `libc` project to provide a linkable version of the `printf` function in the future. Reviewed By: sameerds Differential Revision: https://reviews.llvm.org/D158477
2023-07-07AMDGPU: Remove attempt at simplifying the format string in printf loweringMatt Arsenault
This avoids computing the dominator tree by removing the simplifyInstruction use. This was applying simplification with some kind of questionable load-store forwarding and looking for the global. This had to have been an ancient hack copied from previous backends. In the OpenCL case, this is always emitted as required the direct global reference anyway.
2023-06-25[llvm] Add missing StringExtras.h includesElliot Goodrich
In preparation for removing the `#include "llvm/ADT/StringExtras.h"` from the header to source file of `llvm/Support/Error.h`, first add in all the missing includes that were previously included transitively through this header.
2023-02-07[NFC][TargetParser] Remove llvm/ADT/Triple.hArchibald Elliott
I also ran `git clang-format` to get the headers in the right order for the new location, which has changed the order of other headers in two files.
2023-01-28AMDGPU: Don't insert pointer bitcasts for printf loweringMatt Arsenault
Cleanup leftover typed pointer handling.
2023-01-13AMDGPU: Use getConstantStringInfo for printf format stringsMatt Arsenault
Tolerated printf format strings that are indexed globals and fixes asserting on non-null terminated strings.
2023-01-13AMDGPU: Fix format string indexes for existing llvm.printf.fmtsMatt Arsenault
The index stored to the buffer is just an index into this named metadata. It would more robust to produce a private constant table, and use a constant expression to index into it.
2023-01-13AMDGPU: Don't expand printf users if printf is definedMatt Arsenault
2023-01-10[AMDGPU] Fix big endian bots after 7c327c2Nemanja Ivanovic
The pass that this test case is testing has host-endianness dependencies. This fixes the pertinent one causing failures on BE bots.
2023-01-10AMDGPU: Don't assert on printf of halfMatt Arsenault
The comment says fields should be 4-byte aligned, so just pass through after conversion to integer. The conformance test lacks any testing of half.
2023-01-10AMDGPU: Fix opaque pointer and other bugs in printf of constant stringsMatt Arsenault
Strip pointer casts to get to the global. Fixes not respecting indexed constant strings. Tolerate non-null terminated and empty strings.
2023-01-10AMDGPU: Don't insert ptrtoint for printf loweringMatt Arsenault
2023-01-10AMDGPU: Stop trying to specially handle vector stores in printf loweringMatt Arsenault
This was broken for 1 element vectors and trying to create invalid casts. We can directly store any type just fine, so don't bother with this buggy conversion logic.
2023-01-09AMDGPU: Use DataExtractor for printf string extractionMatt Arsenault
Attempt 2 to fix big endian bot failures.
2023-01-06AMDGPU: Use getTypeAllocSizeMatt Arsenault
2023-01-06AMDGPU: Try to fix 32-bit build botMatt Arsenault
2023-01-06AMDGPU: Use BinaryByteStream in printf expansionMatt Arsenault
Attempt to fix test failures on big endian bots. This pass definitely needs more test coverage.
2023-01-05AMDGPU: Fix broken opaque pointer handling in printf passMatt Arsenault
This was directly considering the pointee type, and also applying special semantics to constant address space.
2023-01-05AMDGPU: Fix broken and permissive handling of printf format stringsMatt Arsenault
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.
2023-01-03Revert "[libomptarget][plugin-nextgen] fix for [TypePromotion] NewPM support."Ron Lieberman
This reverts commit 135f6a1ee8b20bb392ebad2fa5aef78e3a30ddb4.
2023-01-03[libomptarget][plugin-nextgen] fix for [TypePromotion] NewPM support.Ron Lieberman
2022-12-22AMDGPU: Use early continue to reduce indentationMatt Arsenault
2022-08-28[Target] Qualify auto in range-based for loops (NFC)Kazu Hirata
2022-06-09[NFC] format InstructionSimplify & lowerCaseFunctionNamesSimon Moll
Clang-format InstructionSimplify and convert all "FunctionName"s to "functionName". This patch does touch a lot of files but gets done with the cleanup of InstructionSimplify in one commit. This is the alternative to the less invasive clang-format only patch: D126783 Reviewed By: spatel, rengolin Differential Revision: https://reviews.llvm.org/D126889
2022-04-05[AMDGPU][OpenCL] Remove "printf and hostcall" diagnosticScott Linder
The diagnostic is unreliable, and triggers even for dead uses of hostcall that may exist when linking the device-libs at lower optimization levels. Eliminate the diagnostic, and directly document the limitation for OpenCL before code object V5. Make some NFC changes to clarify the related code in the MetadataStreamer. Add a clang test to tie OCL sources containing printf to the backend IR tests for this situation. Reviewed By: sameerds, arsenm, yaxunl Differential Revision: https://reviews.llvm.org/D121951
2022-02-04Reduce dependencies on llvm/BinaryFormat/Dwarf.hserge-sans-paille
This header is very large (3M Lines once expended) and was included in location where dwarf-specific information were not needed. More specifically, this commit suppresses the dependencies on llvm/BinaryFormat/Dwarf.h in two headers: llvm/IR/IRBuilder.h and llvm/IR/DebugInfoMetadata.h. As these headers (esp. the former) are widely used, this has a decent impact on number of preprocessed lines generated during compilation of LLVM, as showcased below. This is achieved by moving some definitions back to the .cpp file, no performance impact implied[0]. As a consequence of that patch, downstream user may need to manually some extra files: llvm/IR/IRBuilder.h no longer includes llvm/BinaryFormat/Dwarf.h llvm/IR/DebugInfoMetadata.h no longer includes llvm/BinaryFormat/Dwarf.h In some situations, codes maybe relying on the fact that llvm/BinaryFormat/Dwarf.h was including llvm/ADT/Triple.h, this hidden dependency now needs to be explicit. $ clang++ -E -Iinclude -I../llvm/include ../llvm/lib/Transforms/Scalar/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l after: 10978519 before: 11245451 Related Discourse thread: https://llvm.discourse.group/t/include-what-you-use-include-cleanup [0] https://llvm-compile-time-tracker.com/compare.php?from=fa7145dfbf94cb93b1c3e610582c495cb806569b&to=995d3e326ee1d9489145e20762c65465a9caeab4&stat=instructions Differential Revision: https://reviews.llvm.org/D118781
2021-12-28[llvm] Use nullptr instead of 0 (NFC)Kazu Hirata
Identified with modernize-use-nullptr.
2021-12-02[llvm] Use range-based for loops (NFC)Kazu Hirata
2021-10-02[Target] Migrate from getNumArgOperands to arg_size (NFC)Kazu Hirata
Note that getNumArgOperands is considered a legacy name. See llvm/include/llvm/IR/InstrTypes.h for details.
2021-09-20[AMDGPU][NFC] Correct typos in lib/Target/AMDGPU/AMDGPU*.cpp files. Test ↵Jacob Lambert
commit for new contributor.
2021-08-30[llvm] Remove redundant calls to str() and c_str() (NFC)Kazu Hirata
Identified with readability-redundant-string-cstr.
2021-07-08[AMDGPU] Simplify GEP construction (NFC)Nikita Popov
Noticed while making a related change. This code was doing something really peculiar: Creating an APInt by parsing a string. And then creating a SmallVector with one element to create the GEP. Instead create the APInt from integers and directly pass the single index to GetElementPtrInst::Create().
2021-07-08[AMDGPU] Pass explicit GEP type in printf transform (NFC)Nikita Popov
This code is working on an i8*. Avoid nullptr element type in preparation for removing support.
2021-01-28AMDGPUPrintfRuntimeBinding - don't dereference a dyn_cast<> pointer. NFCI.Simon Pilgrim
We dereference the dyn_cast<> in all paths - use cast<> to silence the clang static analyzer warning.
2021-01-26[AMDGPU] Fix null-dereference static analysis warnings. NFCI.Simon Pilgrim
Avoid repeated calls to isZeroValue() and check for a null pointer before dereferencing a dyn_cast<>.
2021-01-07[NFC][AMDGPU] Reduce include files dependency.dfukalov
Reviewed By: rampitec Differential Revision: https://reviews.llvm.org/D93813