From faee855b1e886dacc999e1dccf7f8e2c750f33c6 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 7 Jun 2020 13:50:53 -0400 Subject: opt: Make sure facts_when_impure sees *all* impure literals --- opt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'opt.c') diff --git a/opt.c b/opt.c index 8bc990e..820f421 100644 --- a/opt.c +++ b/opt.c @@ -803,6 +803,10 @@ static struct expr *optimize_expr_recursive(struct opt_state *state, struct expr state->facts_when_true = state->facts; state->facts_when_false = state->facts; + if (!expr->rhs && !expr->pure) { + facts_union(state->facts_when_impure, state->facts_when_impure, &state->facts); + } + if (expr->eval == eval_access) { infer_access_facts(state, expr); } else if (expr->eval == eval_acl) { @@ -847,8 +851,6 @@ static struct expr *optimize_expr_recursive(struct opt_state *state, struct expr expr = optimize_or_expr_recursive(state, expr); } else if (expr->eval == eval_comma) { expr = optimize_comma_expr_recursive(state, expr); - } else if (!expr->pure) { - facts_union(state->facts_when_impure, state->facts_when_impure, &state->facts); } if (!expr) { -- cgit v1.2.3