[PATCH] D37616: [X86] PR34149 Suboptimal codegen for fast minnum and maxnum.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 10 07:23:23 PDT 2017


spatel added a comment.

In https://reviews.llvm.org/D37616#865798, @jbhateja wrote:

> In https://reviews.llvm.org/D37616#865418, @spatel wrote:
>
> > I might be missing some context here. If we have fast/nnan on these calls, then can't we simplify this in IR to fmp+select and not have to deal with this in the backend? The intrinsics only exist to make sure that NaN behavior in IR meets the higher level standards, so if we have nnan, then we don't need the intrinsic?
>
>
> Intrinsic function defer code geneation/expansion to backend this give backend control over geneating efficient code as per specific target.


It's incorrect that intrinsics are passed unaltered to the backend for expansion/optimization. See the optimizations for both generic and target-specific intrinsics in InstCombiner::visitCallInst().

Again, I may be missing some context - who created this IR? Creating a 'call fast llvm.maxnum()' just doesn't make sense to me, so if we can fix that in IR, we should do that. The intrinsic inhibits the large number of potential optimizations for fcmp+select that we have in IR. No target should benefit from having extra NaN semantics requirements provided by the intrinsic that are then overridden by FMF.

Please split the FlagsAcquirer diff into a separate patch.


https://reviews.llvm.org/D37616





More information about the llvm-commits mailing list