[llvm] [SimplifyCFG] Avoid increasing too many phi entries when removing empty blocks (PR #104887)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 17:59:06 PDT 2024


Chengjunp wrote:

Hi @nikic, @dtcxzyw, @XChy, I have updated the heuristic so that it will look at the increase of the number phi entries to determine whether removing a block or not.
But this change has one issue that if there are many empty blocks in the IR and removing any of them will not increase the number of phi entries greatly but removing all of them will have a large increase in the total phi entries. For this case, currently heuristic will remove all of them. 
Therefore, I'm wondering whether we should have something like a global map in the simplifycfg to track how many new phi entries we have already introduced to each block and stop further removing the blocks if the total new phi entries in one block reach a threshold (for example, 1000). 

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


More information about the llvm-commits mailing list