================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to