Skip to content

Commit 85aebdb

Browse files
committed
[CIR] Fix lowering after 2929a29
- After 2929a29, `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`.
1 parent b405d46 commit 85aebdb

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,8 +1355,7 @@ mlir::LogicalResult CIRToLLVMConstantOpLowering::matchAndRewrite(
13551355
} else {
13561356
const mlir::Value initVal =
13571357
lowerCirAttrAsValue(op, op.getValue(), rewriter, typeConverter);
1358-
rewriter.replaceAllUsesWith(op, initVal);
1359-
rewriter.eraseOp(op);
1358+
rewriter.replaceOp(op, initVal);
13601359
return mlir::success();
13611360
}
13621361
} else if (const auto recordAttr =
@@ -2653,8 +2652,7 @@ mlir::LogicalResult CIRToLLVMVTableGetVPtrOpLowering::matchAndRewrite(
26532652
// pointer to the vptr type. Since the LLVM dialect uses opaque pointers
26542653
// we can just replace uses of this operation with the original pointer.
26552654
mlir::Value srcVal = adaptor.getSrc();
2656-
rewriter.replaceAllUsesWith(op, srcVal);
2657-
rewriter.eraseOp(op);
2655+
rewriter.replaceOp(op, srcVal);
26582656
return mlir::success();
26592657
}
26602658

0 commit comments

Comments
 (0)