[qfcc] Reduce some alias chaining

Aliasing an alias expression to the same type as the original aliased
expression is a no-op, so drop the alias entirely in order to simplify
code generation.
This commit is contained in:
Bill Currie 2022-01-28 15:29:40 +09:00
parent ec9fa3fee8
commit d28507eacf

View file

@ -1309,6 +1309,12 @@ new_alias_expr (type_t *type, expr_t *expr)
}
expr = expr->e.alias.expr;
}
// this can happen when constant folding an offset pointer results in
// a noop due to the offset being 0 and thus casting back to the original
// type
if (type == get_type (expr)) {
return expr;
}
expr_t *alias = new_expr ();
alias->type = ex_alias;