[PATCH] D105525: [GISel] Add fpext/fptrunc combines
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 9 01:21:58 PDT 2021
foad added inline comments.
================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:2490
+ // floating point types, but will have altered precision when folded to
+ // float. We will only allow this fold for Unsafe and 8bit cases.
+ Register SrcInputReg = SrcMI->getOperand(1).getReg();
----------------
pnappa wrote:
> paquette wrote:
> > foad wrote:
> > > Is there a precedent for using "UnsafeFPMath" to enable this particular unsafe combine?
> > This looks really similar to the `isKnownExactCastIntToFP` case in `InstCombinerImpl::visitFPExt`.
> >
> > Taking a peek in `isKnownExactCastIntToFP` doesn't have any mention of unsafe math. I couldn't find anything in SelectionDAG either (but maybe I missed something?)
> >
> > (The checks in `isKnownExactCastIntToFP` seem to do a lot of work actually; I wonder if it would make sense to do something similar here? I guess that could be a follow-up patch.)
> Precedent, as in have we done something similar before, enabling a different combine depending on fastmath? Or as in, does this optimisation help in practice?
>
> Yes to both, I think, but the latter is fairly niche
Precedent as in, does the unsafe math flag enable this specific optimization anywhere else in the compiler, e.g. on IR or in SelectionDAG? I'm not sure it's a good idea to add new unsafe optimizations into the existing (pretty well established) unsafe math flag.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105525/new/
https://reviews.llvm.org/D105525
More information about the llvm-commits
mailing list