[llvm] [OpenMPOpt] Bound indirect-call specialization instead of paying for all of it (PR #219323)

Robert Imschweiler via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 05:09:58 PDT 2026


================
@@ -5830,6 +5911,20 @@ AAFoldRuntimeCall &AAFoldRuntimeCall::createForPosition(const IRPosition &IRP,
   return *AA;
 }
 
+/// Bound the if-cascade AAIndirectCallInfo builds for an indirect call. Device
+/// code routes many parallel regions through a single runtime dispatcher, so a
+/// call site there can see every outlined region in the module; specializing
+/// all of them costs more in code size and compile time than the direct calls
+/// are worth.
+static constexpr unsigned MaxIndirectCallSpecializations = 3;
+
+static bool shouldSpecializeIndirectCallee(Attributor &,
+                                           const AbstractAttribute &,
+                                           CallBase &, Function &,
+                                           unsigned NumAssumedCallees) {
+  return NumAssumedCallees <= MaxIndirectCallSpecializations;
----------------
ro-i wrote:

thanks for researching and elaborating!

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


More information about the llvm-commits mailing list