[llvm] fa9301f - [KnownBits] avgCompute - don't create on-the-fly Carry. NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 13 02:17:37 PDT 2024
Author: Simon Pilgrim
Date: 2024-06-13T10:17:15+01:00
New Revision: fa9301f35b41396bdf829cfd633fa2f983798723
URL: https://github.com/llvm/llvm-project/commit/fa9301f35b41396bdf829cfd633fa2f983798723
DIFF: https://github.com/llvm/llvm-project/commit/fa9301f35b41396bdf829cfd633fa2f983798723.diff
LOG: [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.
Added:
Modified:
llvm/lib/Support/KnownBits.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Support/KnownBits.cpp b/llvm/lib/Support/KnownBits.cpp
index e3ad1468874cd..8e31e0ced2d73 100644
--- a/llvm/lib/Support/KnownBits.cpp
+++ b/llvm/lib/Support/KnownBits.cpp
@@ -768,8 +768,8 @@ static KnownBits avgCompute(KnownBits LHS, KnownBits RHS, bool IsCeil,
unsigned BitWidth = LHS.getBitWidth();
LHS = IsSigned ? LHS.sext(BitWidth + 1) : LHS.zext(BitWidth + 1);
RHS = IsSigned ? RHS.sext(BitWidth + 1) : RHS.zext(BitWidth + 1);
- KnownBits Carry = KnownBits::makeConstant(APInt(1, IsCeil ? 1 : 0));
- LHS = KnownBits::computeForAddCarry(LHS, RHS, Carry);
+ LHS =
+ computeForAddCarry(LHS, RHS, /*CarryZero*/ !IsCeil, /*CarryOne*/ IsCeil);
LHS = LHS.extractBits(BitWidth, 1);
return LHS;
}
More information about the llvm-commits
mailing list