[llvm] [ValueTracking] Augment isImpliedByDomCondition by data-relation (PR #187224)
Kunqiu Chen via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 27 06:54:17 PDT 2026
Camsyn wrote:
Maybe `simplifyCmpInst` is a more precise but expensive replacement of `isTruePredicate`.
As `simplifyCmpInst` calls `isImpliedByDomCondition` internally, such a replacement might cause heavy recursion.
If `simplifyCmpInst` has already considered both the dom condition and the data relation. Maybe we should provide a new wrapper function `isTrueOrFalse` as follows, and replace some calls from `isImpliedByDomCondition` to`isTrueOrFalse`:
```cpp
std::optional<bool> llvm::isTrueOrFalse(CmpPredicate Pred, const Value *LHS,
const Value *RHS,
const Instruction *ContextI,
const DataLayout &DL) {
if (auto *C = dyn_cast_or_null<ConstantInt>(simplifyCmpInst(
Pred, LHS, RHS, {DL, ContextI}))) {
return C.isOne();
}
return std::nullopt;
}
```
https://github.com/llvm/llvm-project/pull/187224
More information about the llvm-commits
mailing list