]> granicus.if.org Git - re2c/commitdiff
Moved loop-invariant code out of loop.
authorUlya Trofimovich <skvadrik@gmail.com>
Tue, 17 May 2016 17:55:03 +0000 (18:55 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Tue, 17 May 2016 17:55:03 +0000 (18:55 +0100)
re2c/src/ir/dfa/tag_deduplication.cc

index bca0d22eff4e81f9be787098b18108d6511eef00..c82ac598d21f63ffe080c3f28143f5ab6a350f0a 100644 (file)
@@ -56,15 +56,15 @@ static void calc_live(const dfa_t &dfa, size_t fallback, size_t *live)
        for (bool loop = true; loop;) {
                loop = false;
                for (size_t i = 0; i < nstates; ++i) {
+                       const size_t l = live[i];
                        dfa_state_t *s = dfa.states[i];
                        for (size_t c = 0; c < dfa.nchars; ++c) {
                                const size_t j = s->arcs[c];
                                if (j != dfa_t::NIL) {
-                                       const size_t old = live[i];
                                        dfa.tagpool.orl_with_mask(&live[i], live[j], s->tags[c]);
-                                       loop |= old != live[i];
                                }
                        }
+                       loop |= live[i] != l;
                }
        }
 }