[llvm] [PHIElimination] Reuse existing COPY in predecessor basic block (PR #131837)

Guy David via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 30 05:43:19 PDT 2025


guy-david wrote:

> > The insertion point of COPY isn't always optimal and could eventually lead to a worse block layout, see the regression test in the first commit.
> > This change affects many architectures but the amount of total instructions in the test cases seems too be slightly lower.
> 
> The COPY you reuse is dead (right?) so why is reusing it any better than inserting a new one and allowing the dead one to be DCEd? (Or, why wasn't the dead COPY already DCEd before we got to this point?)

That's an edge case for the problem I was trying to solve, for which I added a regression test in https://github.com/llvm/llvm-project/pull/146320. In the original issue there were no dead instructions.

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


More information about the llvm-commits mailing list