Commit 45a8383f authored by Jason Ekstrand's avatar Jason Ekstrand Committed by Erik Faye-Lund
Browse files

nir/opt_deref: Don't remove casts with alignment information



Generally, if a cast has alignment information, that information is
useful and we don't want to loose it.
Reviewed-by: Jesse Natalie's avatarJesse Natalie <jenatali@microsoft.com>
Reviewed-by: Boris Brezillon's avatarBoris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Karol Herbst's avatarKarol Herbst <kherbst@redhat.com>
Part-of: <mesa/mesa!6472>
parent 780fafae
......@@ -910,6 +910,9 @@ opt_replace_struct_wrapper_cast(nir_builder *b, nir_deref_instr *cast)
if (!parent)
return false;
if (cast->cast.align_mul > 0)
return false;
if (!glsl_type_is_struct(parent->type))
return false;
......@@ -940,6 +943,12 @@ opt_deref_cast(nir_builder *b, nir_deref_instr *cast)
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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment