[llvm] 7a4e56a - [RISCV] Add an early out to lowerVECTOR_SHUFFLEAsVSlidedown. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 18 21:35:51 PDT 2022


Author: Craig Topper
Date: 2022-10-18T21:35:15-07:00
New Revision: 7a4e56acac4fa398880411282f6280d61533204b

URL: https://github.com/llvm/llvm-project/commit/7a4e56acac4fa398880411282f6280d61533204b
DIFF: https://github.com/llvm/llvm-project/commit/7a4e56acac4fa398880411282f6280d61533204b.diff

LOG: [RISCV] Add an early out to lowerVECTOR_SHUFFLEAsVSlidedown. NFC

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.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index d134f56eb927b..5cf4505f1c733 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -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.


        


More information about the llvm-commits mailing list