Skip to content

Commit fa9301f

Browse files
committed
[KnownBits] avgCompute - don't create on-the-fly Carry. NFC.
Use the internal computeForAddCarry directly since we know the exact values of the carry bit.
1 parent 935d377 commit fa9301f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Support/KnownBits.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,8 +768,8 @@ static KnownBits avgCompute(KnownBits LHS, KnownBits RHS, bool IsCeil,
768768
unsigned BitWidth = LHS.getBitWidth();
769769
LHS = IsSigned ? LHS.sext(BitWidth + 1) : LHS.zext(BitWidth + 1);
770770
RHS = IsSigned ? RHS.sext(BitWidth + 1) : RHS.zext(BitWidth + 1);
771-
KnownBits Carry = KnownBits::makeConstant(APInt(1, IsCeil ? 1 : 0));
772-
LHS = KnownBits::computeForAddCarry(LHS, RHS, Carry);
771+
LHS =
772+
computeForAddCarry(LHS, RHS, /*CarryZero*/ !IsCeil, /*CarryOne*/ IsCeil);
773773
LHS = LHS.extractBits(BitWidth, 1);
774774
return LHS;
775775
}

0 commit comments

Comments
 (0)