Skip to content

Commit fefb949

Browse files
committed
Refactor KB
1 parent d289921 commit fefb949

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2516,8 +2516,7 @@ bool VectorCombine::shrinkType(llvm::Instruction &I) {
25162516
// Check that the expression overall uses at most the same number of bits as
25172517
// ZExted
25182518
KnownBits KB = computeKnownBits(&I, *DL);
2519-
unsigned IBW = KB.getBitWidth() - KB.Zero.countLeadingOnes();
2520-
if (IBW > BW)
2519+
if (KB.countMaxActiveBits() > BW)
25212520
return false;
25222521

25232522
// Calculate costs of leaving current IR as it is and moving ZExt operation
@@ -2546,8 +2545,7 @@ bool VectorCombine::shrinkType(llvm::Instruction &I) {
25462545

25472546
// Check if we can propagate ZExt through its other users
25482547
KB = computeKnownBits(UI, *DL);
2549-
unsigned UBW = KB.getBitWidth() - KB.countMinLeadingZeros();
2550-
if (UBW > BW)
2548+
if (KB.countMaxActiveBits() > BW)
25512549
return false;
25522550

25532551
CurrentCost += TTI.getArithmeticInstrCost(UI->getOpcode(), BigTy, CostKind);

0 commit comments

Comments
 (0)