[clang] [llvm] [profcheck][coro] Adding Branch weights PGO in Coroutines Passes (PR #184466)

Jin Huang via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 19 18:20:07 PDT 2026


================
@@ -183,6 +183,10 @@ void Lowerer::lowerCoroNoop(IntrinsicInst *II) {
         FnTy, GlobalValue::LinkageTypes::InternalLinkage,
         M.getDataLayout().getProgramAddressSpace(), "__NoopCoro_ResumeDestroy",
         &M);
+
+    // Because this function is a noop, we can set its entry count to 1.
+    NoopFn->setEntryCount(1);
----------------
jinhuang1102 wrote:

Ah, thanks for comment. 

I think setting the entry count here has no impact on code optimization. It is going to fix the `Transforms/Coroutines/coro-noop.ll`. Because `__NoopCoro_ResumeDestroy ` is a dummy function containing only a `ret void` with no control flow or computation to optimize.

It is for formalness. Because `__NoopCoro_ResumeDestroy ` is generated during `coro-cleanup`, it starts with no entry count metadata, causing the Profile Verifier to fail the build.

Btw - I think setting the entry count back to `0` is better way to a dummy function. Do you agree?

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


More information about the llvm-commits mailing list