diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2019-02-04 22:29:31 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2019-02-04 22:29:31 -0500 |
commit | d53a1b6b572370e303e42e9238abc458d4c22b64 (patch) | |
tree | 009fd26e04a807810914bbcc1eeb0ca62d008d70 | |
parent | 3a52c0e1f55d5dd03a00740c191569b9309c0ad6 (diff) | |
download | bfs-d53a1b6b572370e303e42e9238abc458d4c22b64.tar.xz |
opt: Optimize -samefile together with -inum
-rw-r--r-- | opt.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -619,6 +619,13 @@ static void infer_icmp_facts(struct opt_state *state, const struct expr *expr, e } } +/** Infer data flow facts about a -samefile expression. */ +static void infer_samefile_facts(struct opt_state *state, const struct expr *expr) { + struct range *range_when_true = state->facts_when_true.ranges + INUM_RANGE; + constrain_min(range_when_true, expr->ino); + constrain_max(range_when_true, expr->ino); +} + /** Infer data flow facts about a -type expression. */ static void infer_type_facts(struct opt_state *state, const struct expr *expr) { state->facts_when_true.types &= expr->idata; @@ -643,6 +650,8 @@ static struct expr *optimize_expr_recursive(struct opt_state *state, struct expr infer_icmp_facts(state, expr, INUM_RANGE); } else if (expr->eval == eval_links) { infer_icmp_facts(state, expr, LINKS_RANGE); + } else if (expr->eval == eval_samefile) { + infer_samefile_facts(state, expr); } else if (expr->eval == eval_size) { infer_icmp_facts(state, expr, SIZE_RANGE); } else if (expr->eval == eval_type) { |