[llvm-dev] Working on FP SCEV Analysis

Sanjoy Das via llvm-dev llvm-dev at lists.llvm.org
Mon May 16 17:31:20 PDT 2016


Hi Escha,

via llvm-dev wrote:
> One thought I’ve had about this in the past —
>
> SCEV is useful for proving two expressions are equivalent (in general,
> not just specifically for loop induction variables). This gets a little
> bit trickier with fast-math; for example, suppose two expressions are
> equivalent, but *only* with reassociativity allowed?

This isn't too different from "sext(a + b) == sext(a) + sext(b) only
if the addition is nsw".

However, it wasn't clear to me from the lang-ref what the fastmath
flags really mean.  What is the semantics of a program that computes
((a +fast b) +fast c) when ((a + b) + c) != (a + (b + c))?  Does it
have UB (in which case we can't hoist fastmath arithmetic) or is it
more like poison?  Depending on the answer, for fastmath we can
considering doing what we do today for nuw/nsw (which has its own set
of issues, but at least wouldn't require us to start from scratch).

-- Sanjoy


More information about the llvm-dev mailing list