[clang] [CIR] Add lowering for the cir.vtable.address_point operation (PR #153243)
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 13 14:50:17 PDT 2025
================
@@ -2391,6 +2396,45 @@ mlir::LogicalResult CIRToLLVMTrapOpLowering::matchAndRewrite(
return mlir::success();
}
+static mlir::Value
+getValueForVTableSymbol(mlir::Operation *op,
+ mlir::ConversionPatternRewriter &rewriter,
+ const mlir::TypeConverter *converter,
+ mlir::FlatSymbolRefAttr nameAttr, mlir::Type &eltType) {
+ auto module = op->getParentOfType<mlir::ModuleOp>();
+ mlir::Operation *symbol = mlir::SymbolTable::lookupSymbolIn(module, nameAttr);
+ if (auto llvmSymbol = mlir::dyn_cast<mlir::LLVM::GlobalOp>(symbol))
+ eltType = llvmSymbol.getType();
+ else if (auto cirSymbol = mlir::dyn_cast<cir::GlobalOp>(symbol))
+ eltType = converter->convertType(cirSymbol.getSymType());
----------------
bcardosolopes wrote:
Looks like we are relying on this function clients to check if `eltType` is filled in (same in incubator), should we just do it here as a final `else`?
https://github.com/llvm/llvm-project/pull/153243
More information about the cfe-commits
mailing list