[llvm] [InstCombine] Fold `fcmp pred sqrt(X), 0.0 -> fcmp pred2 X, 0.0` (PR #101626)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 2 00:50:04 PDT 2024


================
@@ -7980,6 +7980,63 @@ static Instruction *foldFabsWithFcmpZero(FCmpInst &I, InstCombinerImpl &IC) {
   }
 }
 
+/// Optimize sqrt(X) compared with zero.
+static Instruction *foldSqrtWithFcmpZero(FCmpInst &I, InstCombinerImpl &IC) {
+  Value *X;
+  if (!match(I.getOperand(0), m_Sqrt(m_Value(X))))
+    return nullptr;
+
+  if (!match(I.getOperand(1), m_PosZeroFP()))
----------------
goldsteinn wrote:

Most: https://alive2.llvm.org/ce/z/nwWqUB

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


More information about the llvm-commits mailing list