[clang] [CIR] Fix LLVM lowering crashes after #155244 (PR #157471)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 8 07:22:37 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clangir
Author: Morris Hafner (mmha)
<details>
<summary>Changes</summary>
This patch replaces all uses of `replaceAllUseWith` with `replaceOp`. This fixes a number of regressions post #<!-- -->155244.
---
Full diff: https://github.com/llvm/llvm-project/pull/157471.diff
1 Files Affected:
- (modified) clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp (+2-4)
``````````diff
diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
index ee9f58c829ca9..f8dac2aa02a0c 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();
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/157471
More information about the cfe-commits
mailing list