[SelectionDAG] Use std::clamp (NFC)
authorKazu Hirata <kazu@google.com>
Mon, 24 Oct 2022 07:23:51 +0000 (00:23 -0700)
committerKazu Hirata <kazu@google.com>
Mon, 24 Oct 2022 07:23:51 +0000 (00:23 -0700)
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index 8967dab250db1fb92023179f385ac7299c9c02e2..8fa4c85d5f3ad272a64d35db97f644d699f319a8 100644 (file)
@@ -4299,7 +4299,7 @@ unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, const APInt &DemandedElts,
 
     // If the sign portion ends in our element the subtraction gives correct
     // result. Otherwise it gives either negative or > bitwidth result
-    return std::max(std::min(KnownSign - rIndex * BitWidth, BitWidth), 0);
+    return std::clamp(KnownSign - rIndex * BitWidth, 0, BitWidth);
   }
   case ISD::INSERT_VECTOR_ELT: {
     // If we know the element index, split the demand between the