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
This commit is contained in:
River Riddle 2019-02-06 15:21:02 -08:00 committed by jpienaar
parent fd2d7c857b
commit 99fee0b181
1 changed files with 2 additions and 2 deletions

View File

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