[MLIR] Handle in-place folding properly in greedy pattern rewrite driver
authorUday Bondhugula <uday@polymagelabs.com>
Sun, 5 Apr 2020 04:35:52 +0000 (10:05 +0530)
committerUday Bondhugula <uday@polymagelabs.com>
Sat, 11 Apr 2020 14:27:29 +0000 (19:57 +0530)
commitcbcb12fd44dfdb51bbf4489d213d96f17be3091f
tree117df41697aa7be94b5f1d1b4cb2e27f5d690fae
parent1318ddbc14c28eee63df9cfe3ed92dca82557935
[MLIR] Handle in-place folding properly in greedy pattern rewrite driver

OperatioFolder::tryToFold performs both true folding and in a few
instances in-place updates through op rewrites. In the latter case, we
should still be applying the supplied pattern rewrites in the same
iteration; however this wasn't the case since tryToFold returned
success() for both true folding and in-place updates, and the patterns
for the in-place updated ops were being applied only in the next
iteration of the driver's outer loop. This fix would make it converge
faster.

Differential Revision: https://reviews.llvm.org/D77485
mlir/include/mlir/Transforms/FoldUtils.h
mlir/lib/Transforms/Utils/FoldUtils.cpp
mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp