17 Commits

Author SHA1 Message Date
Matt Arsenault
68d4656722 AMDGPU: Don't insert pointer bitcasts for printf lowering
Cleanup leftover typed pointer handling.
2023-01-28 21:49:10 -04:00
Matt Arsenault
0d87732a1f AMDGPU: Use getConstantStringInfo for printf format strings
Tolerated printf format strings that are indexed globals and fixes
asserting on non-null terminated strings.
2023-01-13 14:11:37 -05:00
Matt Arsenault
689207e7ed AMDGPU: Some printf call edge case tests
Check printf printing printf, and printf passed to a function.
2023-01-13 12:32:04 -05:00
Matt Arsenault
4682039db0 AMDGPU: Don't assert on printf of half
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-10 14:13:23 -05:00
Matt Arsenault
fdda800ba3 AMDGPU: Fix opaque pointer and other bugs in printf of constant strings
Strip pointer casts to get to the global. Fixes not respecting indexed
constant strings. Tolerate non-null terminated and empty strings.
2023-01-10 13:39:44 -05:00
Matt Arsenault
d8534e4e98 AMDGPU: Don't insert ptrtoint for printf lowering 2023-01-10 13:07:01 -05:00
Matt Arsenault
777b905bae AMDGPU: Stop trying to specially handle vector stores in printf lowering
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-10 13:07:01 -05:00
Matt Arsenault
b7587ca837 AMDGPU: Add more opencl printf tests 2023-01-06 21:23:14 -05:00
Matt Arsenault
8723836358 AMDGPU: Add additional printf string tests
Test various inputs passed to %s.
2023-01-06 17:22:13 -05:00
Matt Arsenault
7c327c2fbb AMDGPU: Fix broken opaque pointer handling in printf pass
This was directly considering the pointee type, and also applying
special semantics to constant address space.
2023-01-05 13:48:32 -05:00
Matt Arsenault
7b922fc0c3 AMDGPU: Fix broken and permissive handling of printf format strings
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-05 09:18:00 -05:00
Matt Arsenault
5da812461a AMDGPU: Update constant address spaces used in printf test
This was never updated for the address space number shuffle.
2022-12-22 12:38:59 -05:00
Roman Lebedev
d4c4bd6b20
[NFC] Port codegen AMDGPU tests that invoke opt to -passes= syntax 2022-12-09 01:04:46 +03:00
Roman Lebedev
b1a9584818
[opt] Disincentivize new tests from using old pass syntax
Over the past day or so, i've took a large swing at our tests,
and reduced the number of tests that were still using the old syntax
from ~1800 to just 200.

Left to handle: (as it is seen in this patch)
* Transforms/LSR
* Transforms/CGP
* Transforms/TypePromotion
* Transforms/HardwareLoops
* Analysis/*
* some misc.

I think this is the right point to start actively refusing
to honor the old syntax, except for the old tests,
to prevent the old syntax from creeping back in.

Thus, let's add temporary default-off flag,
and if it is not passed refuse to accept old syntax.
The tests that still need porting are annotated with this flag.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D139647
2022-12-08 23:54:03 +03:00
Matt Arsenault
c1710e7779 AMDGPU: Use modern address spaces in some tests
This was way out of date, still using 4 for generic and 0 for private.
2022-11-28 10:05:06 -05:00
Arthur Eubanks
fd323a897c [NewPM][AMDGPU] Port amdgpu-printf-runtime-binding
And add to AMDGPU opt pipeline.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D94026
2021-01-04 12:25:50 -08:00
Stanislav Mekhanoshin
4c9c98f36b [AMDGPU] Printf runtime binding pass
This pass is a port of the according pass from the HSAIL compiler.
It parses printf calls and setup runtime printf buffer.
After that it copies printf arguments to the buffer and fills in
module metadata for runtime.

Differential Revision: https://reviews.llvm.org/D24035

llvm-svn: 368592
2019-08-12 17:12:29 +00:00