[llvm-commits] [PATCH] [Fast-math] In relaxed FP mode, Instruction::isAssociative() returns true for fmul/fadd

Eli Friedman eli.friedman at gmail.com
Wed Nov 28 14:12:25 PST 2012


On Wed, Nov 28, 2012 at 1:52 PM, Shuxin Yang <shuxin.llvm at gmail.com> wrote:
> Hi,
>
>    The tiny patch attached to this mail is to let
> Instruction::isAssociative() return true for fmul/fadd
> if the compiler is using relaxed floating-point mode.
>
>     I thought this change could open a big can of worm. Turn out we are
> fortunate. I stress-tested
> the change by *ALWAYS* considering fmul/fadd as reassociative regardless
> which fp mode the
> compiler is using, and I tested regression test, SingleSrc, MultipleSrc.  I
> only saw one regression:
> test/Transforms/InstCombine/2006-10-26-VectorReassoc.ll, which is
> false-positive.
>
>    It seems that Instcombine is transparently doing a great job for FP
> operators
> if Instrunction::isAssociative() returns true.
>
> Thanks you for review.

Testcase?  Also, do we handle mixing associative operations and
non-associative operations correctly?

-Eli



More information about the llvm-commits mailing list