[llvm] [CodeGen] Preserve branch weights from PGO profile during instruction selection at -O0 (PR #161620)

Amara Emerson via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 2 09:39:00 PDT 2025


aemerson wrote:

> > ...but why?
> 
> @aemerson This is useful in some situations such as for analyzing profile quality and calculating performance proxy. It is already enabled in LLVM IR (see #113985 and also motivation in the PR message). Also, this functionality #124334 will not work correctly in O0 without this PR.

That doesn't sound like a good justification for adding more passes to a configuration that's sensitive to compile time changes. Now I get that some passes may be effectively free if the information isn't requested, but for AArch64 this adds:
```
; CHECK-NEXT:       Dominator Tree Construction
; CHECK-NEXT:       Natural Loop Information
; CHECK-NEXT:       Post-Dominator Tree Construction
; CHECK-NEXT:       Branch Probability Analysis
```
... to the pipeline. Do these analyses not affect compile time? 

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


More information about the llvm-commits mailing list