[clang] [CIR] Keep CIR global types visible across lowering replacements (PR #238698)
Henrich Lauko via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 4 01:07:23 PST 2026
================
@@ -3531,10 +3568,17 @@ mlir::LogicalResult CIRToLLVMGlobalOpLowering::matchAndRewrite(
if (std::optional<mlir::Attribute> bulkInit = lowerConstArrayAttr(
constArr, symbolTables, typeConverter, modOp)) {
mlir::SymbolRefAttr comdatAttr = getComdatAttr(op, rewriter);
- rewriter.replaceOpWithNewOp<mlir::LLVM::GlobalOp>(
+ // The driver does not invalidate the cached symbol table, so
+ // maintain it explicitly: drop the old entry before replacement
+ // and register the new op after.
+ symbolTables.getSymbolTable(modOp).remove(op);
----------------
xlauko wrote:
The remove / replace / setAttr / insert sequence is repeated here, at 3600 and at 3633. Could it go into a helper?
https://github.com/llvm/llvm-project/pull/238698
More information about the cfe-commits
mailing list