nir/builder: Cast array indices in build_deref_follower
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 5 Mar 2019 22:06:31 +0000 (16:06 -0600)
committerJason Ekstrand <jason@jlekstrand.net>
Thu, 7 Mar 2019 21:20:30 +0000 (21:20 +0000)
commitfcf2a0122e9ccf3be8d1fa3bd18b8dedbebd6acf
treead538efd0df4ddbced08289be8fc71dc4e981bcc
parentcd4c1458baba595aaff25ca1099c60a57d31772b
nir/builder: Cast array indices in build_deref_follower

There's no guarantee when build_deref_follower is called that the two
derefs have the same bit size destination.  Insert a cast on the array
index in case we have differing bit sizes.  While we're here, insert
some asserts in build_deref_array and build_deref_ptr_as_array.  The
validator will catch violations here but they're easier to debug if we
catch them while building.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/compiler/nir/nir_builder.h