Apply patterns repeatly if the function is modified
authorFeng Liu <fengliuai@google.com>
Mon, 22 Apr 2019 23:06:09 +0000 (16:06 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Wed, 24 Apr 2019 05:02:16 +0000 (22:02 -0700)
commit5c757087c741b5f1299a23f5dc3f1bcb7d46f8fa
treeeba3355e519898e92f3c18cde39753bd17f4f47b
parent10bcc34a685f42c229c64158ceb7f20fa094d46c
Apply patterns repeatly if the function is modified

    During the pattern rewrite, if the function is changed, i.e. ops created,
    deleted or swapped, the pattern rewriter needs to re-scan the function entirely
    and apply the patterns again, so the patterns whose root ops have been popped
    out from the working list nor an immediate users of the changed ops can be
    reconsidered.

    A command line flag is added to set the max number of iterations rescanning the
    function for pattern match. If the rewrite doesn' converge after this number,
    this compiling will continue and the result can be sub-optimal.

    One unit test is updated because this change fixed the missing optimization opportunities.

--

PiperOrigin-RevId: 244754190
mlir/include/mlir/IR/PatternMatch.h
mlir/lib/IR/PatternMatch.cpp
mlir/lib/Quantization/Transforms/ConvertSimQuant.cpp
mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
mlir/test/Transforms/Vectorize/lower_vector_transfers.mlir