mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-25 13:11:00 +00:00
Revert "[qfcc] Don't fold constants for algebra"
This reverts commit e87e01e4f2
.
In the end, this wasn't necessary, and it causes problems in itself.
This commit is contained in:
parent
6b38fdca35
commit
34fe4efc9d
1 changed files with 7 additions and 1 deletions
|
@ -133,7 +133,7 @@ neg_expr (const expr_t *e)
|
|||
neg = new_unary_expr ('-', e);
|
||||
}
|
||||
neg->expr.type = type;
|
||||
return edag_add_expr (neg);
|
||||
return edag_add_expr (fold_constants (neg));
|
||||
}
|
||||
|
||||
const expr_t *
|
||||
|
@ -585,6 +585,7 @@ sum_expr_low (const type_t *type, int op, const expr_t *a, const expr_t *b)
|
|||
}
|
||||
|
||||
auto sum = typed_binary_expr (type, op, a, b);
|
||||
sum = fold_constants (sum);
|
||||
sum = edag_add_expr (sum);
|
||||
return sum;
|
||||
}
|
||||
|
@ -820,6 +821,7 @@ distribute_product (const type_t *type, const expr_t *a, const expr_t *b,
|
|||
for (auto j = b_adds; *j; j++) {
|
||||
auto p = product (type, *i, *j);
|
||||
if (p) {
|
||||
p = fold_constants (p);
|
||||
p = edag_add_expr (p);
|
||||
a = sum_expr (type, a, p);
|
||||
}
|
||||
|
@ -829,6 +831,7 @@ distribute_product (const type_t *type, const expr_t *a, const expr_t *b,
|
|||
for (auto j = b_subs; *j; j++) {
|
||||
auto p = product (type, *i, *j);
|
||||
if (p) {
|
||||
p = fold_constants (p);
|
||||
p = edag_add_expr (p);
|
||||
a = sum_expr (type, a, p);
|
||||
}
|
||||
|
@ -838,6 +841,7 @@ distribute_product (const type_t *type, const expr_t *a, const expr_t *b,
|
|||
for (auto j = b_subs; *j; j++) {
|
||||
auto p = product (type, *i, *j);
|
||||
if (p) {
|
||||
p = fold_constants (p);
|
||||
p = edag_add_expr (p);
|
||||
b = sum_expr (type, b, p);
|
||||
}
|
||||
|
@ -847,6 +851,7 @@ distribute_product (const type_t *type, const expr_t *a, const expr_t *b,
|
|||
for (auto j = b_adds; *j; j++) {
|
||||
auto p = product (type, *i, *j);
|
||||
if (p) {
|
||||
p = fold_constants (p);
|
||||
p = edag_add_expr (p);
|
||||
b = sum_expr (type, b, p);
|
||||
}
|
||||
|
@ -878,6 +883,7 @@ static const expr_t *
|
|||
apply_scale (const type_t *type, const expr_t *expr, const expr_t *prod)
|
||||
{
|
||||
if (expr && prod) {
|
||||
expr = fold_constants (expr);
|
||||
expr = edag_add_expr (expr);
|
||||
expr = scale_expr (type, expr, prod);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue