[llvm] [Coroutines] Conditional elide coroutines based on hot/cold information (PR #162276)

Adrian Vogelsgesang via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 9 06:45:18 PDT 2025


================
@@ -145,6 +153,30 @@ PreservedAnalyses CoroAnnotationElidePass::run(LazyCallGraph::SCC &C,
       bool IsCallerPresplitCoroutine = Caller->isPresplitCoroutine();
       bool HasAttr = CB->hasFnAttr(llvm::Attribute::CoroElideSafe);
       if (IsCallerPresplitCoroutine && HasAttr) {
+        static BranchProbability MinBranchProbability(
----------------
vogelsgesang wrote:

I removed the `static` and kept it as a local variable.

I don't think we can make this a global variable, as we would run into initialization order issues between `CoroElideBranchRatio`, `MinBlockCounterExecution` (which are already global static variables today) and the new global `MinBranchProbability`

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


More information about the llvm-commits mailing list