[llvm] [SDAG][X86] Support shrinking target-independent nodes (PR #206721)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 30 06:49:06 PDT 2026


================
@@ -4384,6 +4384,18 @@ class LLVM_ABI TargetLowering : public TargetLoweringBase {
     return true;
   }
 
+  /// If only low elements of a vector are demanded, shrink the operation to the
+  /// returned size in bits by converting
+  /// (op x) to insert_subvector (op (extract_subvector x)).
+  ///
+  /// The returned size must be a multiple of the element size, greater than or
+  /// equal to the demanded part of the vector and less than the original
+  /// vector size. Return 0 to disable shrinking.
+  virtual unsigned
+  getPreferredShrunkVectorSize(SDValue Op, const APInt &DemandedElts) const {
----------------
RKSimon wrote:

getPreferredShrunkVectorSizeInBits to avoid ambiguity?

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


More information about the llvm-commits mailing list