[llvm-dev] InstCombineCasts and fastmath flags

Karumuri, Srividya via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 2 13:01:31 PDT 2018


Hi,
In llvm InstCombine pass, it is transforming FDiv(32bit for example)+FPTrunc into FPTruncLHS+FPTruncRHS+FDiv(16bit)
This is in InstCombineCasts.cpp, InstCombiner::visitFPTrunc function.
During this transformation, it is also copying over the Fastmath flags (that includes allowReciprocal flag) to FDiv(16bit).
There are some value ranges for denominator which might not overflow when reciprocal is done on a 32 bit, but might overflow on a 16bit. In which case allowReciprocal set on a 32 bit FDiv before transformation need not be applicable to 16bit FDiv after transformation.
Shouldn't this llvm transformation not set allowReciprocal flag on FDiv(16) when such transformation is done?

Thanks,
Srividya

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181002/e960d41f/attachment-0001.html>


More information about the llvm-dev mailing list