[llvm] [ValueTracking] Handle not cond to assume. (PR #127140)
Andreas Jonson via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 16 02:26:22 PST 2025
andjo403 wrote:
> I'm suggesting to do that not just for direct assume arguments, but for all instructions. I assume this will have some kind of negative fallout, but I'd like to understand what it is.
As I understand it isEphemeralValueOf will effectively always return true in that case as it is only called when the value E is before the assume and all instructions that builds up the condition to the assume will be ephemeral.
maybe an other way to make isEphemeralValueOf is to use `findValuesAffectedByCondition` function to make the ephemeral check like this:
```
SmallVector<const Value *, 8> Affected;
auto InsertAffected = [&Affected](Value *V) { Affected.push_back(V); };
findValuesAffectedByCondition(Assume->getArgOperand(0), /*IsAssume=*/true,
InsertAffected);
return is_contained(Affected, E) &&
llvm::all_of(E->users(),
[&](const User *U) { return is_contained(Affected, U); });
```
avoids the need for special handling of not
https://github.com/llvm/llvm-project/pull/127140
More information about the llvm-commits
mailing list