[llvm] [ValueTracking] Handle not cond to assume. (PR #127140)
Andreas Jonson via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 15 03:20:02 PST 2025
================
@@ -441,16 +441,28 @@ void llvm::computeKnownBitsFromRangeMetadata(const MDNode &Ranges,
}
static bool isEphemeralValueOf(const Instruction *I, const Value *E) {
- SmallVector<const Value *, 16> WorkSet(1, I);
- SmallPtrSet<const Value *, 32> Visited;
- SmallPtrSet<const Value *, 16> EphValues;
// The instruction defining an assumption's condition itself is always
// considered ephemeral to that assumption (even if it has other
// non-ephemeral users). See r246696's test case for an example.
if (is_contained(I->operands(), E))
return true;
+ SmallPtrSet<const Value *, 32> Visited{I};
+ SmallPtrSet<const Value *, 16> EphValues{I};
+
+ Value *X;
+ if (match(I, m_Intrinsic<Intrinsic::assume>(m_Not(m_Value(X))))) {
----------------
andjo403 wrote:
the `!IsAssume &&` for the trunc check is only to avoid to add the same value twice to the `AssumptionCache` as it is added by the https://github.com/llvm/llvm-project/blob/70b95ca6dbee7036dcfa5995ff804471fd7e8c2a/llvm/lib/Analysis/ValueTracking.cpp#L10229-L10232
via https://github.com/llvm/llvm-project/blob/70b95ca6dbee7036dcfa5995ff804471fd7e8c2a/llvm/lib/Analysis/ValueTracking.cpp#L10261-L10262
This was the only way that I was able to think of how to solve.
https://github.com/llvm/llvm-project/pull/127140
More information about the llvm-commits
mailing list