[llvm] 0410779 - [RISCV][GISel] Simplify some code. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 13 15:28:49 PST 2023


Author: Craig Topper
Date: 2023-11-13T15:27:41-08:00
New Revision: 04107797d9d07b9295821812298c09dd3a4613ac

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

LOG: [RISCV][GISel] Simplify some code. NFC

typeIs and LegalizeMutation::changeTo instead of implementing our own lambdas
that do the same thing.

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 45e0f3951b4b2d0..c6654873118f98f 100644
--- a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
+++ b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
@@ -181,11 +181,8 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST) {
         // Widen sXLen to sDoubleXLen so we can use a single libcall to get
         // the low bits for the mul result and high bits to do the overflow
         // check.
-        .widenScalarIf(
-            [=](const LegalityQuery &Query) { return Query.Types[0] == sXLen; },
-            [=](const LegalityQuery &Query) {
-              return std::make_pair(0, sDoubleXLen);
-            })
+        .widenScalarIf(typeIs(0, sXLen),
+                       LegalizeMutations::changeTo(0, sDoubleXLen))
         .lower();
   }
 


        


More information about the llvm-commits mailing list