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

Paschalis Mpeis via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 4 05:49:49 PST 2026


https://github.com/paschalis-mpeis commented:

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 requires a extra set.

  
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)
```

What do you think?

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


More information about the llvm-commits mailing list