[llvm] 15430ba - [DAGCombiner] Use APInt::isPower2() instead of popcount() == 1. NFC (#182600)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 21 09:00:19 PST 2026
Author: Craig Topper
Date: 2026-02-21T09:00:15-08:00
New Revision: 15430ba094bedceb919d5e000adf15977d702983
URL: https://github.com/llvm/llvm-project/commit/15430ba094bedceb919d5e000adf15977d702983
DIFF: https://github.com/llvm/llvm-project/commit/15430ba094bedceb919d5e000adf15977d702983.diff
LOG: [DAGCombiner] Use APInt::isPower2() instead of popcount() == 1. NFC (#182600)
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 723f838da1246..2bbb373323dfa 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -29913,7 +29913,7 @@ SDValue DAGCombiner::SimplifySelectCC(const SDLoc &DL, SDValue N0, SDValue N1,
N0->getValueType(0) == VT && isNullConstant(N1) && isNullConstant(N2)) {
SDValue AndLHS = N0->getOperand(0);
auto *ConstAndRHS = dyn_cast<ConstantSDNode>(N0->getOperand(1));
- if (ConstAndRHS && ConstAndRHS->getAPIntValue().popcount() == 1) {
+ if (ConstAndRHS && ConstAndRHS->getAPIntValue().isPowerOf2()) {
// Shift the tested bit over the sign bit.
const APInt &AndMask = ConstAndRHS->getAPIntValue();
if (TLI.shouldFoldSelectWithSingleBitTest(VT, AndMask)) {
More information about the llvm-commits
mailing list