[clang] [llvm] [NVPTX] Fix for device function pointer having the same name as generated callprototype (PR #205639)

Daniel Donenfeld via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 9 14:49:57 PDT 2026


================
@@ -52,11 +54,16 @@ class NVPTXMachineFunctionInfo : public MachineFunctionInfo {
     return ImageHandleSymbols.contains(Symbol);
   }
 
-  void addCallPrototype(unsigned Id, const CallBase *CB) {
-    CallPrototypes.try_emplace(Id, CB);
+  void addCallPrototype(unsigned Id, const CallBase *CB, MachineFunction &MF) {
+    if (CallPrototypes.find(Id) == CallPrototypes.end()) {
+      MCSymbol *Symbol =
+          MF.getContext().createTempSymbol("prototype_" + Twine(Id),
+                                           /*AlwaysAddSuffix=*/false);
+      CallPrototypes.try_emplace(Id, CB, Symbol);
+    }
   }
----------------
daniel-donenfeld wrote:

I removed the usage of ID from the createTempSymbol call, but its still used to map between the callsite here and in the asm printer

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


More information about the cfe-commits mailing list