Revert "Don't bother creating an alias for a def of the same type."

This reverts commit 2904c619c1.

In order to support swizzle operations, I need to be able to alias defs
to larger types (eg, float to vec4), but alias_def rightly won't allow
this. However, as the plan is to do this in the final steps before
emitting the instruction, I plan on creating an alias to a float then
adjusting the type in the alias, but to do so without extra shenanigans,
I need alias_def to allow aliases to the same type. As a fringe benefit,
it makes the code agree with the comment in def.h :P
This commit is contained in:
Bill Currie 2022-04-30 21:58:41 +09:00
parent b87a768c43
commit 3c20dd515e

View file

@ -180,8 +180,6 @@ alias_def (def_t *def, type_t *type, int offset)
internal_error (0, "aliasing a def to a larger type");
if (offset < 0 || offset + type_size (type) > type_size (def->type))
internal_error (0, "invalid alias offset");
if (type == def->type)
return def;
for (alias = def->alias_defs; alias; alias = alias->next) {
if (alias->type == type && alias->offset == offset)
return alias;