[llvm-branch-commits] CodeGenPrepare, X86: Support sinking phi nodes. (PR #141716)

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


https://github.com/pcc created https://github.com/llvm/llvm-project/pull/141716

isProfitableToSinkOperands() may now return a phi node. If it does,
check that all incoming values are identical and if so, replace the phi
use with a clone of the incoming value. Use this mechanism to sink phi
node operands of shifts whose incoming values are identical casts of
a constant.

This could be improved a bit by changing the isProfitableToSinkOperands()
API so that we don't need to call hasIdenticalValue() again in the caller
but hopefully the case of a PHI operand to a shift is rare enough that
it doesn't matter that we need to do it multiple times.





More information about the llvm-branch-commits mailing list