[llvm] [CostModel][X86] SK_InsertSubvector - if the legalized base/subvector types match then the insert is now just a copy (PR #84048)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 5 10:15:47 PST 2024


================
@@ -1550,6 +1550,12 @@ InstructionCost X86TTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
   if (Kind == TTI::SK_InsertSubvector && LT.second.isVector()) {
     int NumElts = LT.second.getVectorNumElements();
     std::pair<InstructionCost, MVT> SubLT = getTypeLegalizationCost(SubTp);
+
+    // If we're inserting into the same legalized type then its not an
+    // insert anymore, its a copy.
+    if (LT.second == SubLT.second)
+      return TTI::TCC_Free;
----------------
RKSimon wrote:

But wouldn't the SubTp not match?

https://github.com/llvm/llvm-project/pull/84048


More information about the llvm-commits mailing list