[mlir] OperationFolder: fix crash in creation of single-result-ops with in-place folds
When the folding is performed in place, the `::fold` function does not populate its `results` argument to indicate that. (In the folding hook for single-result operations, the result of the original operation is expected to be returned, but it is then ignored by the wrapper.) `OperationFolder::create` would erronously rely on the _operation_ having zero results instead of on the _folding_ producing zero new results to populate the list of results with those of the original operation. This would lead to a crash for single-result ops with in-place folds where the first result is accessed uncondtionally because the list of results was not properly populated. Use the list of values produced by the folding instead. Differential Revision: https://reviews.llvm.org/D79497
Loading
Please register or sign in to comment