[llvm] [CodeGenPrepare] Cache known-live PHIs when deleting dead PHI chains (PR #207191)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 2 21:00:24 PDT 2026


Jolyon0202 wrote:

> > CodeGenPrepare enables the cache only for huge functions. Other callers keep
> > the default nullptr behavior.
> 
> Why?

Thanks for review. In the CodeGenPrepare pass, we traverse all basic blocks and invoke DeleteDeadPHIs for each block. This process performs an in-depth scan of cross-BB PHI dependency chains. In this pass, we first determine whether a function is a huge function; if so, we pass a nullptr KnownNonDeadPHIsPtr to enable this optimization. Other Caller don’t seem to carry such high complexity(loop header or bbchanged), but they also have this risk. For this reason, I added a local localKnownNonDeadPHIs variable inside DeleteDeadPHIs to optimize this workflow as well. What do you think? @nikic 



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


More information about the llvm-commits mailing list