Generally, if a cast has alignment information, that information is
useful and we don't want to loose it.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6472>
if (!parent)
return false;
+ if (cast->cast.align_mul > 0)
+ return false;
+
if (!glsl_type_is_struct(parent->type))
return false;
if (!is_trivial_deref_cast(cast))
return progress;
+ /* If this deref still contains useful alignment information, we don't want
+ * to delete it.
+ */
+ if (cast->cast.align_mul > 0)
+ return progress;
+
bool trivial_array_cast = is_trivial_array_deref_cast(cast);
assert(cast->dest.is_ssa);