[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:22 PST 2026
================
@@ -100,4 +100,18 @@ mlir::Type convertTypeForLoadStore(const mlir::TypeConverter &converter,
mlir::Attribute getBitIntStorageAttr(mlir::ConversionPatternRewriter &rewriter,
cir::IntAttr attr,
const mlir::DataLayout &dataLayout);
+
+// Transient attribute holding a symbol's CIR type before lowering. Lookups
+// mid-conversion can find the already-lowered LLVM symbol instead of the
+// CIR op. Its type may have been adjusted during lowering (split rows,
+// flexible array), so readers that need the unadjusted CIR view use this
+// stash. The pass strips it at the end, so it never reaches the output.
+inline constexpr const char *kPreConversionSymType =
----------------
xlauko wrote:
Instead of storing the type on the LLVM op and stripping it on exit, could we build a symbol → CIR type map before conversion and pass it to the patterns like `symbolTables`? That's order-independent by construction and needs no strip step.
https://github.com/llvm/llvm-project/pull/238698
More information about the cfe-commits
mailing list