[llvm] [InstCombine] Fold xored one-complemented operand comparisons (PR #69882)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 22 08:24:17 PDT 2023


================
@@ -6929,6 +6929,23 @@ static Instruction *foldReductionIdiom(ICmpInst &I,
   return nullptr;
 }
 
+// Gets the inverse of the predicate, but not the full predicate,
+// it doesn't change the equality, e.g SLE <-> SGE, SLT <-> SGT,
+// ULE <-> UGE, ULT <-> UGT
+static ICmpInst::Predicate ConvertPred(ICmpInst::Predicate Pred) {
----------------
dtcxzyw wrote:

Please use `ICmpInst::getSwappedPredicate`.

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


More information about the llvm-commits mailing list