When canonicalizing only erase the operation after calling the 'fold' hook if replace...
authorRiver Riddle <riverriddle@google.com>
Wed, 6 Feb 2019 23:21:02 +0000 (15:21 -0800)
committerjpienaar <jpienaar@google.com>
Fri, 29 Mar 2019 23:19:17 +0000 (16:19 -0700)
PiperOrigin-RevId: 232757964

mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp

index 45c57e2f307084dacba71404d57425f8509c7da1..c2adf84edd3ffa1b07573b1b0369216bcbe139ca 100644 (file)
@@ -267,9 +267,9 @@ void GreedyPatternRewriteDriver::simplifyFunction() {
             addToWorklist(operand.getOwner());
           res->replaceAllUsesWith(resultValues[i]);
         }
-      }
 
-      op->erase();
+        op->erase();
+      }
       continue;
     }