[PATCH] D62158: [InstCombine] canonicalize minnum/maxnum with 'nan' to fcmp+select
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 20 13:07:52 PDT 2019
spatel created this revision.
spatel added reviewers: arsenm, efriedma, lebedev.ri.
Herald added subscribers: hiraditya, nhaehnle, wdng, jvesely, mcrosier.
Herald added a project: LLVM.
This is an atypical proposal because we are converting 1 instruction (intrinsic) into 2 instructions, but this allows better analysis via ValueTracking's matchSelectPattern().
Also, see this discussion for a larger potential optimization that would be made easier to match if we canonicalize to fcmp+select:
https://bugs.llvm.org/show_bug.cgi?id=37403#c6
There's a related codegen problem here:
https://bugs.llvm.org/show_bug.cgi?id=34149
We've already solved that for x86 at least, but this IR transform should help more generally.
Finally, I don't know of any current downside to converting this to fcmp+select, but it's another case where we should have FMF on the select:
D61917 <https://reviews.llvm.org/D61917>
https://reviews.llvm.org/D62158
Files:
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll
llvm/test/Transforms/InstCombine/maxnum.ll
llvm/test/Transforms/InstCombine/minnum.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62158.200346.patch
Type: text/x-patch
Size: 6104 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190520/1f476bc3/attachment.bin>
More information about the llvm-commits
mailing list