[llvm] [ValueTracking] Handle assume( trunc x to i1) (PR #118406)
Andreas Jonson via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 14 02:17:58 PST 2024
================
@@ -844,17 +847,14 @@ 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);
return;
}
- if (match(Arg, m_Not(m_Specific(V))) &&
+ if (match(Arg, m_Not(m_TruncOrSelf(m_Specific(V)))) &&
----------------
andjo403 wrote:
possible to also remove the not (trunc X to i1) pattern from this PR and that fixes the "ephemeral value" issue
https://github.com/llvm/llvm-project/pull/118406
More information about the llvm-commits
mailing list