[clang] [CIR] Upstream initial function call support (PR #134673)

Sirui Mu via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 8 08:23:58 PDT 2025


================
@@ -281,3 +281,33 @@ bool CIRGenTypes::isZeroInitializable(clang::QualType t) {
 
   return true;
 }
+
+const CIRGenFunctionInfo &CIRGenTypes::arrangeCIRFunctionInfo() {
+  // Lookup or create unique function info.
+  llvm::FoldingSetNodeID id;
+  CIRGenFunctionInfo::Profile(id);
+
+  void *insertPos = nullptr;
+  CIRGenFunctionInfo *fi = functionInfos.FindNodeOrInsertPos(id, insertPos);
+  if (fi)
+    return *fi;
----------------
Lancern wrote:

A folding set is basically a separate chaining hash table, and the addresses of its elements are stable once the element is inserted. Besides, in the classic codegen, we never erase elements from `functionInfos`. Thus the returned reference is valid throughout CIRGen.

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


More information about the cfe-commits mailing list