[llvm] [CodeGen] Restore MachineBlockPlacement block ordering (PR #99351)

William Junda Huang via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 14:52:46 PDT 2024


huangjd wrote:

> This can also give an end result that has worse performance.

The Function class just keeps basic blocks in a linked list without a specific order because any transform pass can add new blocks, so the order is not linked to hotness or other performance factors. buildChain() already tries to find a best successor block in BlockFilter first by calling selectBestSuccessor(), which disregards block order in the Function, so I don't see how getFirstUnplacedBlock() doing so would affect performance, especially it is the final fallback for unusual CFG. 

Collecting BlockFilterSet from the entire function will cause the complexity to increase back to O(#loops in function * #blocks) 


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


More information about the llvm-commits mailing list