[DAG] Improve folding (sext_in_reg (*_extend_vector_inreg x)) -> (sext_vector_inreg x)
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 18 Mar 2021 15:34:39 +0000 (15:34 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 18 Mar 2021 15:34:53 +0000 (15:34 +0000)
commit1ba5c550d418e12a5bdbb884d2f7d94e0efc64ee
treea71a22a89858a2391bacf86e54f9301217dd5192
parent283799157e504597fc3034cc5fa02faa4e11fa58
[DAG] Improve folding (sext_in_reg (*_extend_vector_inreg x)) -> (sext_vector_inreg x)

Extend this to support ComputeNumSignBits of the (used) source vector elements so that we can handle more than just the case where we're sext_in_reg from the source element signbit.

Noticed while investigating the poor codegen in D98587.
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/vec_saddo.ll
llvm/test/CodeGen/X86/vec_smulo.ll
llvm/test/CodeGen/X86/vec_ssubo.ll
llvm/test/CodeGen/X86/vec_uaddo.ll
llvm/test/CodeGen/X86/vec_umulo.ll
llvm/test/CodeGen/X86/vec_usubo.ll
llvm/test/CodeGen/X86/vsplit-and.ll