[clang] [CIR] Generalize the special member attribute into func_info and add a callee resolver (PR #207261)

Rithik Sharma via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 7 17:25:03 PDT 2026


================
@@ -1051,6 +1051,27 @@ unsigned cir::CallOp::getNumArgOperands() {
   return this->getOperation()->getNumOperands();
 }
 
+static cir::FuncOp resolveCalleeImpl(mlir::Operation *op,
+                                     mlir::SymbolTableCollection *symbolTable) {
+  auto callee = op->getAttrOfType<mlir::FlatSymbolRefAttr>(
+      CIRDialect::getCalleeAttrName());
+  if (!callee)
+    return {};
+
+  if (symbolTable)
+    return symbolTable->lookupNearestSymbolFrom<cir::FuncOp>(op, callee);
+  return mlir::SymbolTable::lookupNearestSymbolFrom<cir::FuncOp>(op, callee);
+}
+
+cir::FuncOp cir::CallOp::resolveCallee() {
+  return resolveCalleeImpl(*this, /*symbolTable=*/nullptr);
----------------
SharmaRithik wrote:

Removed the form. `resolveCalleeInTable` is the only way in now, and it takes a reference, so every caller goes through the cache.

https://github.com/llvm/llvm-project/pull/207261


More information about the cfe-commits mailing list