From 75153adeda1a60317a835a1453bcef491d104ff8 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 28 Jan 2023 08:49:02 -0800 Subject: [PATCH] [RISCV] Use std::clamp (NFC) --- llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index f7c3152..4223ab9 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 -- 2.7.4