Author: Michael Liao Date: 2025-09-08T10:24:27-04:00 New Revision: 85aebdb4b32e27de665dc05358bf376d17f57189
URL: https://github.com/llvm/llvm-project/commit/85aebdb4b32e27de665dc05358bf376d17f57189 DIFF: https://github.com/llvm/llvm-project/commit/85aebdb4b32e27de665dc05358bf376d17f57189.diff LOG: [CIR] Fix lowering after 2929a2978cc3bdb0ff12a0e5d0a9236ff221f668 - After 2929a2978cc3bdb0ff12a0e5d0a9236ff221f668, `ConversionPatternRewriter::replaceAllUsesWith` behavior is changed from the previous immediate mode into a delayed fashion. The legacy operation of `replaceAllUsesWith` followed by `eraseOp` is no longer working, replace that sequence with `replaceOp`. Added: Modified: clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp Removed: ################################################################################ diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp index ee9f58c829ca9..cb05d6f9c3f79 100644 --- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp +++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp @@ -1355,8 +1355,7 @@ mlir::LogicalResult CIRToLLVMConstantOpLowering::matchAndRewrite( } else { const mlir::Value initVal = lowerCirAttrAsValue(op, op.getValue(), rewriter, typeConverter); - rewriter.replaceAllUsesWith(op, initVal); - rewriter.eraseOp(op); + rewriter.replaceOp(op, initVal); return mlir::success(); } } else if (const auto recordAttr = @@ -2653,8 +2652,7 @@ mlir::LogicalResult CIRToLLVMVTableGetVPtrOpLowering::matchAndRewrite( // pointer to the vptr type. Since the LLVM dialect uses opaque pointers // we can just replace uses of this operation with the original pointer. mlir::Value srcVal = adaptor.getSrc(); - rewriter.replaceAllUsesWith(op, srcVal); - rewriter.eraseOp(op); + rewriter.replaceOp(op, srcVal); return mlir::success(); } _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
