[PATCH] D41322: [InstCombine] Missed optimization in math expression: squashing sqrt functions

Dmitry Venikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 22 09:50:02 PST 2017


Quolyk added a comment.

@davide please accept the revision, if ok. I'll commit.



================
Comment at: lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:737
+    if (match(Op0, m_Intrinsic<Intrinsic::sqrt>(m_Value(Opnd0))) &&
+        match(Op1, m_Intrinsic<Intrinsic::sqrt>(m_Value(Opnd1)))) {
+      BuilderTy::FastMathFlagGuard Guard(Builder);
----------------
spatel wrote:
> Just a few small bits here:
> 1. You don’t have to initialize to nullptr; the captured variables aren’t touched if the match fails.
> 2. There is a matcher for m_OneUse (though it may not save any space here).
> 3. I prefer to keep the names in the code comments and the actual code variables the same, so Opnd0 would just be ‘A’ etc.
1. I know, Xcode showed warning at that line, so I decided to make it that way.
2. That is useful, didn't know that.
3. I'll take into account, thank you.


https://reviews.llvm.org/D41322





More information about the llvm-commits mailing list