[clang] [CIR] Add lowering for the cir.vtable.address_point operation (PR #153243)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 13 16:10:15 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());
----------------
andykaylor wrote:
I'm not sure what else this would be if it isn't a `cir::GlobalOp` or `LLVM::GlobalOp`. Maybe the else should call `op.emitError()`?
https://github.com/llvm/llvm-project/pull/153243
More information about the cfe-commits
mailing list