Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7cdbf1e

Browse files
committed
Make use of APInt::countLeadingOnes. NFC.
1 parent 62fdb1f commit 7cdbf1e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -4048,13 +4048,10 @@ unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, const APInt &DemandedElts,
40484048
return FirstAnswer;
40494049
}
40504050

4051-
// Okay, we know that the sign bit in Mask is set. Use CLZ to determine
4051+
// Okay, we know that the sign bit in Mask is set. Use CLO to determine
40524052
// the number of identical bits in the top of the input value.
4053-
Mask = ~Mask;
40544053
Mask <<= Mask.getBitWidth()-VTBits;
4055-
// Return # leading zeros. We use 'min' here in case Val was zero before
4056-
// shifting. We don't want to return '64' as for an i32 "0".
4057-
return std::max(FirstAnswer, std::min(VTBits, Mask.countLeadingZeros()));
4054+
return std::max(FirstAnswer, Mask.countLeadingOnes());
40584055
}
40594056

40604057
bool SelectionDAG::isBaseWithConstantOffset(SDValue Op) const {

0 commit comments

Comments
 (0)