[llvm] 75153ad - [RISCV] Use std::clamp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 28 08:49:09 PST 2023


Author: Kazu Hirata
Date: 2023-01-28T08:49:02-08:00
New Revision: 75153adeda1a60317a835a1453bcef491d104ff8

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

LOG: [RISCV] Use std::clamp (NFC)

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 f7c31520b065..4223ab98de84 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -2412,8 +2412,7 @@ static SDValue lowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG,
     // according to the size of the final vector - use i8 chunks rather than
     // XLenVT if we're producing a v8i1. This results in more consistent
     // codegen across RV32 and RV64.
-    unsigned NumViaIntegerBits =
-        std::min(std::max(NumElts, 8u), Subtarget.getXLen());
+    unsigned NumViaIntegerBits = std::clamp(NumElts, 8u, Subtarget.getXLen());
     NumViaIntegerBits = std::min(NumViaIntegerBits, Subtarget.getELEN());
     if (ISD::isBuildVectorOfConstantSDNodes(Op.getNode())) {
       // If we have to use more than one INSERT_VECTOR_ELT then this


        


More information about the llvm-commits mailing list