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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon May 13 03:05:16 PDT 2024


================
@@ -8037,6 +8037,45 @@ Instruction *InstCombinerImpl::visitFCmpInst(FCmpInst &I) {
       if (Instruction *NV = FoldOpIntoSelect(I, cast<SelectInst>(LHSI)))
         return NV;
       break;
+    case Instruction::FSub:
+      switch (Pred) {
+      default:
+        break;
+      case FCmpInst::FCMP_UGT:
+      case FCmpInst::FCMP_ULT:
+      case FCmpInst::FCMP_UNE:
+      case FCmpInst::FCMP_OEQ:
+      case FCmpInst::FCMP_OGE:
+      case FCmpInst::FCMP_OLE:
+        // Skip optimization: fsub x, y unless guaranteed !isinf(x) || 
----------------
arsenm wrote:

```suggestion
        // Skip optimization: fsub x, y unless guaranteed !isinf(x) ||
```

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


More information about the llvm-commits mailing list