[llvm] [ValueTracking] Handle `trunc nuw` in `computeKnownBitsFromICmpCond` (PR #125414)
Andreas Jonson via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 2 07:15:03 PST 2025
================
@@ -776,7 +776,10 @@ static void computeKnownBitsFromICmpCond(const Value *V, ICmpInst *Cmp,
if (match(LHS, m_Trunc(m_Specific(V)))) {
KnownBits DstKnown(LHS->getType()->getScalarSizeInBits());
computeKnownBitsFromCmp(LHS, Pred, LHS, RHS, DstKnown, SQ);
- Known = Known.unionWith(DstKnown.anyext(Known.getBitWidth()));
+ if (match(LHS, m_NUWTrunc(m_Value())))
----------------
andjo403 wrote:
as it is known that LHS is trunc is it better to do `cast<TruncInst>(LHS)->hasNoUnsignedWrap()` ?
https://github.com/llvm/llvm-project/pull/125414
More information about the llvm-commits
mailing list