mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-16 17:01:53 +00:00
[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:
parent
ec9fa3fee8
commit
d28507eacf
1 changed files with 6 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue