[PATCH] D53774: [InstCombine] Combine nested min/max intrinsics with constants

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 29 16:14:02 PDT 2018


spatel added a comment.

1. Please add the tests to trunk as a preliminary commit.
2. Add tests with 0.0 and -0.0 constants, so we are sure that edge case is handled correctly.
3. Sprinkle around some fast-math-flags, so we know those are propagated correctly.
4. Make at least 1 test use vector splat constants, so we know that type works.

Side note: do you know if the reassociate pass handles these? I imagine we're going to miss the optimization in instcombine if the constants are separated in a longer chain of min/max ops.



================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:2067
+    const APFloat *C1, *C2;
+    if (auto *M0 = dyn_cast<IntrinsicInst>(Arg0)) {
+      if (M0->getIntrinsicID() == IID && match(Arg1, m_APFloat(C1)) &&
----------------
Just call this "M" to match the code comment.


https://reviews.llvm.org/D53774





More information about the llvm-commits mailing list