[llvm-branch-commits] X86: Add X86TTIImpl::isProfitableToSinkOperands hook for immediate operands. (PR #141326)

Peter Collingbourne via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue May 27 21:55:49 PDT 2025


pcc wrote:

> This PR doesn't entirely fix the problem. Another case that I'm seeing (and which is more effectively prevented by the previous approach) is where GVN PRE moves the zext behind a phi, and after subsequent optimization passes it turns into a phi pointing to other phis which ultimately point to identical (in the `isIdenticalTo` sense) zext instructions. We could address this in CGP by trying harder to undo what GVN did: we can check that all instructions directly/indirectly referenced by a phi are identical and then replace the usages of the phi with a clone of one of the instructions.

Done in  #141716

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


More information about the llvm-branch-commits mailing list