[llvm] [ValueTracking] Handle assume( trunc x to i1) (PR #118406)
Andreas Jonson via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 9 10:09:34 PST 2025
================
@@ -868,10 +873,9 @@ void llvm::computeKnownBitsFromContext(const Value *V, KnownBits &Known,
Value *Arg = I->getArgOperand(0);
- if (Arg == V && isValidAssumeForContext(I, Q.CxtI, Q.DT)) {
- assert(BitWidth == 1 && "assume operand is not i1?");
- (void)BitWidth;
- Known.setAllOnes();
+ if (match(Arg, m_TruncOrSelf(m_Specific(V))) &&
+ isValidAssumeForContext(I, Q.CxtI, Q.DT)) {
+ Known.One.setBit(0);
----------------
andjo403 wrote:
maybe better to call `computeKnownBitsFromCond` instead after https://github.com/llvm/llvm-project/pull/126414 so it is handled in one place
https://github.com/llvm/llvm-project/pull/118406
More information about the llvm-commits
mailing list