[llvm] c95361e - [RISCV][GISel] Remove legalIf from G_ZEXT, G_SEXT, G_ANYEXT.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 14 15:02:17 PDT 2023


Author: Craig Topper
Date: 2023-08-14T14:56:30-07:00
New Revision: c95361e01e1533acb2545c299377a59ace9e6551

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

LOG: [RISCV][GISel] Remove legalIf from G_ZEXT, G_SEXT, G_ANYEXT.

I think after making G_SEXT_INREG legal this isn't needed. At the
very least its not tested anymore.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D157678

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
index 78fd8247c06526..fc51a731ba2126 100644
--- a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
+++ b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
@@ -44,29 +44,8 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST) {
       .clampScalar(1, XLenLLT, XLenLLT)
       .clampScalar(0, XLenLLT, XLenLLT);
 
-  // Extensions
-  auto ExtLegalFunc = [=](const LegalityQuery &Query) {
-    unsigned DstSize = Query.Types[0].getSizeInBits();
-
-    // Make sure that we have something that will fit in a register, and
-    // make sure it's a power of 2.
-    if (DstSize < 8 || DstSize > XLen || !isPowerOf2_32(DstSize))
-      return false;
-
-    const LLT SrcTy = Query.Types[1];
-
-    // Make sure we fit in a register otherwise. Don't bother checking that
-    // the source type is below 2 * XLen bits. We shouldn't be allowing anything
-    // through which is wider than the destination in the first place.
-    unsigned SrcSize = SrcTy.getSizeInBits();
-    if (SrcSize < 8 || !isPowerOf2_32(SrcSize))
-      return false;
-
-    return true;
-  };
   getActionDefinitionsBuilder({G_ZEXT, G_SEXT, G_ANYEXT})
-      .legalIf(ExtLegalFunc)
-      .clampScalar(0, XLenLLT, XLenLLT);
+      .maxScalar(0, XLenLLT);
 
   getActionDefinitionsBuilder(G_SEXT_INREG)
       .legalFor({XLenLLT})


        


More information about the llvm-commits mailing list