[RISCV] Add an early out to lowerVECTOR_SHUFFLEAsVSlidedown. NFC
authorCraig Topper <craig.topper@sifive.com>
Wed, 19 Oct 2022 04:11:42 +0000 (21:11 -0700)
committerCraig Topper <craig.topper@sifive.com>
Wed, 19 Oct 2022 04:35:15 +0000 (21:35 -0700)
If Mask[0] is 0, then we're never going to match a slidedown. If
we get through the for loop, then it's an identity mask which should
have already been optimized out. Otherwise it's some non-contiguous
mask that will fail out of the lop. Might as well not bother entering
the loop.

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

index d134f56..5cf4505 100644 (file)
@@ -2903,8 +2903,9 @@ static SDValue lowerVECTOR_SHUFFLEAsVSlidedown(const SDLoc &DL, MVT VT,
       VT.getVectorNumElements() != V2.getConstantOperandVal(1))
     return SDValue();
 
-  // Do not handle -1 here. -1 can be handled by isElementRotate.
-  if (Mask[0] == -1)
+  // First index must be known and non-zero. It will be used as the slidedown
+  // amount.
+  if (Mask[0] <= 0)
     return SDValue();
 
   // Mask is also continuous.