[PATCH] D156579: InstCombine: Fold fneg (ldexp x, n) -> ldexp (fneg x), n

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 09:11:26 PDT 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:2529
+        Builder.CreateFNegFMF(X, &FMFSource), Y, &FMFSource));
+  }
+
----------------
style: No branches around single expression if


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:2534
+        Builder.CreateFNegFMF(X, &FMFSource), Y, &FMFSource));
+  }
+
----------------
ibid


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:2542
 
-  if (match(FNegOp, m_FDiv(m_Value(X), m_Value(Y))))
-    return BinaryOperator::CreateFDivFMF(Builder.CreateFNegFMF(X, &FMFSource),
-                                         Y, &FMFSource);
+      IRBuilder<>::FastMathFlagGuard FMFGuard(Builder);
+      Builder.setFastMathFlags(FMF);
----------------
IRBuilder is unused?


================
Comment at: llvm/test/Transforms/InstCombine/fneg.ll:989
+  ret float %neg
+}
+
----------------
goldstein.w.n wrote:
> Can you precommit the tests?
This was erroneously marked done?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156579/new/

https://reviews.llvm.org/D156579



More information about the llvm-commits mailing list