[llvm] 7cdbf1e - Make use of APInt::countLeadingOnes. NFC.
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 23 02:08:32 PDT 2020
Author: Jay Foad
Date: 2020-03-23T09:08:20Z
New Revision: 7cdbf1ed4b94259a3aad2a7575e928fa61b0e57e
URL: https://github.com/llvm/llvm-project/commit/7cdbf1ed4b94259a3aad2a7575e928fa61b0e57e
DIFF: https://github.com/llvm/llvm-project/commit/7cdbf1ed4b94259a3aad2a7575e928fa61b0e57e.diff
LOG: Make use of APInt::countLeadingOnes. NFC.
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 5b673486af15..58311069c09a 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -4048,13 +4048,10 @@ unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, const APInt &DemandedElts,
return FirstAnswer;
}
- // Okay, we know that the sign bit in Mask is set. Use CLZ to determine
+ // Okay, we know that the sign bit in Mask is set. Use CLO to determine
// the number of identical bits in the top of the input value.
- Mask = ~Mask;
Mask <<= Mask.getBitWidth()-VTBits;
- // Return # leading zeros. We use 'min' here in case Val was zero before
- // shifting. We don't want to return '64' as for an i32 "0".
- return std::max(FirstAnswer, std::min(VTBits, Mask.countLeadingZeros()));
+ return std::max(FirstAnswer, Mask.countLeadingOnes());
}
bool SelectionDAG::isBaseWithConstantOffset(SDValue Op) const {
More information about the llvm-commits
mailing list