[llvm] [ValueTracking] Expand cmpExcludesZero to optionally work with non-constant RHS (PR #69364)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 19 05:33:21 PDT 2023


================
@@ -552,7 +552,9 @@ bool llvm::isValidAssumeForContext(const Instruction *Inv,
 // example Pred=EQ, RHS=isKnownNonZero. cmpExcludesZero is called in loops
 // so the extra compile time may not be worth it, but possibly a second API
 // should be created for use outside of loops.
-static bool cmpExcludesZero(CmpInst::Predicate Pred, const Value *RHS) {
+static bool cmpExcludesZero(CmpInst::Predicate Pred, Value *RHS,
+                            const SimplifyQuery *Q = nullptr,
----------------
dtcxzyw wrote:

```suggestion
                            const SimplifyQuery &Q,
```
It is strange to me.  I have checked all callers of `cmpExcludeZero` and found that `SimplifyQuery` is always available.




https://github.com/llvm/llvm-project/pull/69364


More information about the llvm-commits mailing list