[SLP][X86]Fix the cost of reused gathers/buildvectors and floats insert.
authorAlexey Bataev <a.bataev@outlook.com>
Wed, 19 Apr 2023 20:04:12 +0000 (13:04 -0700)
committerAlexey Bataev <a.bataev@outlook.com>
Thu, 20 Apr 2023 16:34:46 +0000 (09:34 -0700)
commit0e1312fbe07c0c14b0317ef62163326b086e0e58
tree7cfcb297635b6e1021e7cfd268e7d5ad61043ede
parent5cf37d8bd5c05ef84fba6d6fd9d4ac8b9905c7cb
[SLP][X86]Fix the cost of reused gathers/buildvectors and floats insert.

There are 2 problems in the cost estimation for buildvector/gather.
1. If the buildvector/gather node is the same as another one node, need
   to estimate the cost of this node as 0.
2. The cost of inserting float point register to non-poison vector is
   not 0, it should not be considered free.

Differential Revision: https://reviews.llvm.org/D148801
llvm/lib/Target/X86/X86TargetTransformInfo.cpp
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Analysis/CostModel/X86/vector-insert-value.ll
llvm/test/Transforms/SLPVectorizer/X86/buildvector-float-and-extract-lane1.ll
llvm/test/Transforms/VectorCombine/X86/extract-fneg-insert.ll