[llvm] Fix dangling IPOAmendableCB function_ref. (PR #120698)

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 6 11:38:49 PST 2025


================
@@ -1352,9 +1352,10 @@ static bool runImpl(Module &M, AnalysisGetter &AG, TargetMachine &TM,
         return !AMDGPU::isEntryFunctionCC(Callee.getCallingConv()) &&
                (NumAssumedCallees <= IndirectCallSpecializationThreshold);
       };
-  AC.IPOAmendableCB = [](const Function &F) {
+  auto IPOAmendableCB = [](const Function &F) {
     return F.getCallingConv() == CallingConv::AMDGPU_KERNEL;
   };
+  AC.IPOAmendableCB = IPOAmendableCB;
----------------
jdoerfert wrote:

That's a good point.
Can you instead make the llvm::function_refs inh the config std::function?
The cost overhead should not be an issue and the ownership seems worth it.

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


More information about the llvm-commits mailing list