From: River Riddle Date: Wed, 6 Feb 2019 23:21:02 +0000 (-0800) Subject: When canonicalizing only erase the operation after calling the 'fold' hook if replace... X-Git-Tag: llvmorg-11-init~1466^2~2449 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=99fee0b181106a0213501800c6076aec95afa46c;p=platform%2Fupstream%2Fllvm.git When canonicalizing only erase the operation after calling the 'fold' hook if replacement results were supplied. This fixes a bug where the operation would always get erased, even if it was modified in place. PiperOrigin-RevId: 232757964 --- diff --git a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp index 45c57e2f3070..c2adf84edd3f 100644 --- a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp +++ b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp @@ -267,9 +267,9 @@ void GreedyPatternRewriteDriver::simplifyFunction() { addToWorklist(operand.getOwner()); res->replaceAllUsesWith(resultValues[i]); } - } - op->erase(); + op->erase(); + } continue; }