summaryrefslogtreecommitdiffstats
path: root/opt.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2020-06-07 13:50:53 -0400
committerTavian Barnes <tavianator@tavianator.com>2020-06-07 13:50:53 -0400
commitfaee855b1e886dacc999e1dccf7f8e2c750f33c6 (patch)
tree39a45954661114f6bc19227663a490d99c7ddb48 /opt.c
parenta1c8bda52a9c07d32127762ee0c865660a0268ab (diff)
downloadbfs-faee855b1e886dacc999e1dccf7f8e2c750f33c6.tar.xz
opt: Make sure facts_when_impure sees *all* impure literals
Diffstat (limited to 'opt.c')
-rw-r--r--opt.c6
1 files changed, 4 insertions, 2 deletions
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) {