================ @@ -1417,12 +1441,21 @@ void ConversionPatternRewriterImpl::notifyOpReplaced(Operation *op, } // Remap result to replacement value. - if (newValue) - mapping.map(result, newValue); + if (!repl.empty()) { + if (repl.size() == 1) { + // Single replacement value: replace directly. + mapping.map(result, repl.front()); + } else { + // Multiple replacement values: insert N:1 materialization. + insertNTo1Materialization(OpBuilder::InsertPoint::after(repl, &domInfo), + result.getLoc(), + /*replacements=*/repl, /*outputValue=*/result, + currentTypeConverter); + } + } ---------------- zero9178 wrote:
```suggestion if (repl.empty()) continue; if (repl.size() == 1) { // Single replacement value: replace directly. mapping.map(result, repl.front()); } else { // Multiple replacement values: insert N:1 materialization. insertNTo1Materialization(OpBuilder::InsertPoint::after(repl, &domInfo), result.getLoc(), /*replacements=*/repl, /*outputValue=*/result, currentTypeConverter); } ``` https://github.com/llvm/llvm-project/pull/115816 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits