[DAG] visitFREEZE - generalize freeze(op()) -> op(freeze()) to any number of operands
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 10 Aug 2022 12:12:04 +0000 (13:12 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 10 Aug 2022 12:12:46 +0000 (13:12 +0100)
commit8623da5f748bc36fc78fa148fd34332d386533ea
tree7e3ea61bb2d5ffcb0344b5875d3c7210010f616c
parent1f02ad71310b9e86d183abdedc75ca99ff1106f5
[DAG] visitFREEZE - generalize freeze(op()) -> op(freeze()) to any number of operands

canCreateUndefOrPoison currently only handles unary ops, but we intend to change that soon - this more closely matches the pushFreezeToPreventPoisonFromPropagating behaviour where the freeze is pushed up to a single operand value, as long as all others are guaranteed not to be poison/undef.

However, pushFreezeToPreventPoisonFromPropagating would freeze all uses of the value - whilst this variant requires the frozen value to be only used in the op - we can look at generalize multiple uses later if the need arises.
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp