[llvm] [ValueTracking] Handle assume( trunc x to i1) (PR #118406)
Andreas Jonson via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 5 09:47:28 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:
but it is only for assumes that that function is called for value
https://github.com/llvm/llvm-project/blob/1c7625b350755a1e2873282c125ca91691a1a7d6/llvm/lib/Analysis/ValueTracking.cpp#L10193
https://github.com/llvm/llvm-project/pull/118406
More information about the llvm-commits
mailing list