[PATCH] D65898: [InstCombine] x /c fabs(x) -> copysign(1.0, x)

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 9 08:52:58 PDT 2019


xbolva00 marked an inline comment as done.
xbolva00 added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:1246
+  if (I.hasNoNaNs() && I.hasNoInfs() &&
+      match(Op0, m_Intrinsic<Intrinsic::fabs>(m_Specific(Op1)))) {
+    Value *V = Builder.CreateBinaryIntrinsic(
----------------
spatel wrote:
> xbolva00 wrote:
> > I tried
> > 
> >  match(&I, m_FDiv(m_Value(X), m_Intrinsic<Intrinsic::fabs>(m_Specific(X)))) and it failed to match.. uh.
> > 
> > (this blocked me to possibly introduce m_c_FDiv)
> You need to use m_Deferred() for that case when matching commutatively (cc @lebedev.ri ).
> But I don't think it's worth adding a commutative matcher for fdiv since it isn't a commutative operation. Not too many cases like this where it can be used?
Thanks!

(and agree)


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

https://reviews.llvm.org/D65898





More information about the llvm-commits mailing list