Skip to content

Commit b3a93e2

Browse files
committed
[CIR] Fix LLVM lowering crashes after #155244
This patch replaces all uses of replaceAllUseWith with replaceOp. This fixes a number of regressions post #155244.
1 parent be6f110 commit b3a93e2

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)