[llvm] [BOLT] Speed up dataflow analysis with RPO (PR #183704)

Haibo Jiang via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 4 18:14:00 PST 2026


Jianghibo wrote:

> That is a solid improvement. Thanks @Jianghibo! 🚀
> 
> I think we can refactor a bit further the extra handling. We can create a single `SmallVector` of BBs and populate it with RPO or PO, then continue with that common vector. If sizes don’t match (ie 1+ component), we can keep the traversal and amend it with any missing blocks. This would requires a extra set thought. What do you think?
> 
> Pseudocode:
> 
> ```
> if FWD: Order <- RPO
> else:     Order <- PO
> 
> if Order.size != Func.BBs.size:
>   Set <- addAll(Order)
>   foreach BB in Func:
>     if BB not in Set: Order.amend(BB)
> 
> foreach BB in Order:
>   if (FWD): foreach inst in BB
>   else:     foreach inst in reverse(BB)
> ```

@paschalis-mpeis Great, I cleaned up the code.

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


More information about the llvm-commits mailing list