[DAG] MergeInnerShuffle with BinOps - sometimes accept undef mask elements
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 1 Apr 2021 13:27:32 +0000 (14:27 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 1 Apr 2021 13:33:00 +0000 (14:33 +0100)
commit77d625f8d8aa08cd162d20af51c41776a5034705
tree3a4fdb0bca21017214d0c2083d53171cd3cb377c
parentdc14e89a1fab6a840c5d8bc3f2bd29f1d1b190be
[DAG] MergeInnerShuffle with BinOps - sometimes accept undef mask elements

If the inner shuffle already contains undef elements, then accept them in the merged shuffle as well.

This helps some X86 HADD/SUB patterns where slow targets were ending up with HADD/SUB because the (un)merged shuffles were stuck either side of the ADD/SUB - meaning we ended up with a total cost much higher than the "2*shuffle+add" that a slow target usually expands a HADD/SUB to.
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/haddsub-undef.ll
llvm/test/CodeGen/X86/phaddsub.ll
llvm/test/CodeGen/X86/x86-interleaved-access.ll