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

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 19 11:03:53 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,
----------------
goldsteinn wrote:

Its intentional so we can still have the const-only version. the perf cost of doing recursive CR call in the assume loop for example would be significant.

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


More information about the llvm-commits mailing list