From 4229f12a22a28d17ab49a3478928852fd212fc2a Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Sat, 8 Feb 2020 08:55:51 +0000 Subject: [PATCH] [TargetLowering] Remove isDesirableToCombineBuildVectorToShuffleTruncate target hook. NFC. This hasn't been used for years, its original implementation, D35700, had bugs that caused the reversion of most of the code, and since then x86 shuffle lowering/combining has handled most cases and can deal with the rest as well. --- llvm/include/llvm/CodeGen/TargetLowering.h | 14 -------------- llvm/lib/Target/X86/X86ISelLowering.cpp | 21 --------------------- llvm/lib/Target/X86/X86ISelLowering.h | 13 ------------- 3 files changed, 48 deletions(-) diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h index 1a0b878..e61c646 100644 --- a/llvm/include/llvm/CodeGen/TargetLowering.h +++ b/llvm/include/llvm/CodeGen/TargetLowering.h @@ -3428,20 +3428,6 @@ public: return true; } - // Return true if it is profitable to combine a BUILD_VECTOR with a stride-pattern - // to a shuffle and a truncate. - // Example of such a combine: - // v4i32 build_vector((extract_elt V, 1), - // (extract_elt V, 3), - // (extract_elt V, 5), - // (extract_elt V, 7)) - // --> - // v4i32 truncate (bitcast (shuffle<1,u,3,u,5,u,7,u> V, u) to v4i64) - virtual bool isDesirableToCombineBuildVectorToShuffleTruncate( - ArrayRef ShuffleMask, EVT SrcVT, EVT TruncVT) const { - return false; - } - /// Return true if the target has native support for the specified value type /// and it is 'desirable' to use the type for the given node type. e.g. On x86 /// i16 is legal, but undesirable since i16 instruction encodings are longer diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 469a21c..dce76b6 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -46538,27 +46538,6 @@ bool X86TargetLowering::IsDesirableToPromoteOp(SDValue Op, EVT &PVT) const { return true; } -bool X86TargetLowering:: - isDesirableToCombineBuildVectorToShuffleTruncate( - ArrayRef ShuffleMask, EVT SrcVT, EVT TruncVT) const { - - assert(SrcVT.getVectorNumElements() == ShuffleMask.size() && - "Element count mismatch"); - assert( - Subtarget.getTargetLowering()->isShuffleMaskLegal(ShuffleMask, SrcVT) && - "Shuffle Mask expected to be legal"); - - // For 32-bit elements VPERMD is better than shuffle+truncate. - // TODO: After we improve lowerBuildVector, add execption for VPERMW. - if (SrcVT.getScalarSizeInBits() == 32 || !Subtarget.hasAVX2()) - return false; - - if (is128BitLaneCrossingShuffleMask(SrcVT.getSimpleVT(), ShuffleMask)) - return false; - - return true; -} - //===----------------------------------------------------------------------===// // X86 Inline Assembly Support //===----------------------------------------------------------------------===// diff --git a/llvm/lib/Target/X86/X86ISelLowering.h b/llvm/lib/Target/X86/X86ISelLowering.h index e77df79..6336b3f 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.h +++ b/llvm/lib/Target/X86/X86ISelLowering.h @@ -789,19 +789,6 @@ namespace llvm { SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override; - // Return true if it is profitable to combine a BUILD_VECTOR with a - // stride-pattern to a shuffle and a truncate. - // Example of such a combine: - // v4i32 build_vector((extract_elt V, 1), - // (extract_elt V, 3), - // (extract_elt V, 5), - // (extract_elt V, 7)) - // --> - // v4i32 truncate (bitcast (shuffle<1,u,3,u,4,u,5,u,6,u,7,u> V, u) to - // v4i64) - bool isDesirableToCombineBuildVectorToShuffleTruncate( - ArrayRef ShuffleMask, EVT SrcVT, EVT TruncVT) const override; - /// Return true if the target has native support for /// the specified value type and it is 'desirable' to use the type for the /// given node type. e.g. On x86 i16 is legal, but undesirable since i16 -- 2.7.4