[PATCH] D41322: [InstCombine] Missed optimization in math expression: squashing sqrt functions
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 21 04:30:14 PST 2017
spatel accepted this revision.
spatel added a comment.
LGTM
================
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);
----------------
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.
https://reviews.llvm.org/D41322
More information about the llvm-commits
mailing list