[PATCH 66/79] [Backport to 15] [OpaquePointers] Adjust builtin variable tracking...
authorMateusz Chudyk <mateuszchudyk@gmail.com>
Mon, 3 Jul 2023 16:40:05 +0000 (18:40 +0200)
committerAndreas Beckmann <anbe@debian.org>
Thu, 8 Feb 2024 21:48:18 +0000 (22:48 +0100)
commitea11a1c741fe3311f35425c8ad628c47bb81b73b
tree705f29cebe149597d6c6fa5771207865028d7077
parentfe6f1fd21b37566e4b4223423c7275ed9b001db5
[PATCH 66/79] [Backport to 15] [OpaquePointers] Adjust builtin variable tracking to support i8 geps (#2061)

The existing logic for the replacement of builtin variables with calls to
functions relies on relatively brittle tracking that is broken when opaque
pointers is turned on, and will be even more thoroughly broken if/when typed
geps are replaced with i8 geps or ptradd. This patch replaces that logic with a
less brittle variant that is able to handle any sequence of bitcast, gep, or
addrspacecast instructions between the global variable and the ultimate load
instruction.

It still will error out if the variable is used in too insane of a fashion (say,
trying to load an i32 out of the i64, or a misaligned vector type).

Co-authored-by: Joshua Cranmer <joshua.cranmer@intel.com>
Gbp-Pq: Name 0066-Backport-to-15-OpaquePointers-Adjust-builtin-variabl.patch
lib/SPIRV/SPIRVInternal.h
lib/SPIRV/SPIRVUtil.cpp
test/builtin-vars-gep.ll
test/transcoding/builtin_vars_gep.ll