Reset operation when canceling root update transaction

Should reset the operation to original state when canceling the updates.

Reviewed By: rriddle, ftynse

Differential Revision: https://reviews.llvm.org/D110176
This commit is contained in:
Yi Zhang 2021-09-22 16:02:05 -04:00
parent cb793e1a36
commit b2b63d1b91
1 changed files with 1 additions and 0 deletions

View File

@ -1485,6 +1485,7 @@ void ConversionPatternRewriter::cancelRootUpdate(Operation *op) {
auto &rootUpdates = impl->rootUpdates;
auto it = llvm::find_if(llvm::reverse(rootUpdates), stateHasOp);
assert(it != rootUpdates.rend() && "no root update started on op");
(*it).resetOperation();
int updateIdx = std::prev(rootUpdates.rend()) - it;
rootUpdates.erase(rootUpdates.begin() + updateIdx);
}