[llvm] [InstCombine] Fold fcmp ogt (x - y), 0 into fcmp ogt x, y #85245 (PR #85506)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 11 03:23:00 PDT 2024


================
@@ -7867,6 +7867,51 @@ static Instruction *foldFCmpFNegCommonOp(FCmpInst &I) {
   return new FCmpInst(Pred, Op0, Zero, "", &I);
 }
 
+static Instruction *foldFCmpFSubIntoFCmp(FCmpInst &I, Instruction *LHSI,
+                                         Constant *RHSC, InstCombinerImpl &CI) {
+  const CmpInst::Predicate Pred = I.getPredicate();
+  Value *X, *Y;
----------------
jayfoad wrote:

Nit: could just initialize X and Y to LHSI->getOperand() here and use them below. The call to match(LHSI, ...) below is mostly pointless since we already know that LHSI is an fsub.

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


More information about the llvm-commits mailing list