[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, 14 Mar 2024 19:01:08 +0000 (20:01 +0100)
commitb546576867a7d9f4c6abc2a43e34296f52242ccd
tree3325df5196873d63d66abd9ecd03598ed50906e8
parentd1518c7b1c38a6b8c1cc45b885fd8cd29f4bd603
[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