> Out of curiosity, how would you envision fast-math flags
> interacting with constant expressions?
They could prevent constant-folding when it leads to loosing
floating-point exceptions at runtime.
> Off the top of my head, I can’t think of any flags that would be
> relevant if the expression can just be constant-folded away at
> full precision anyways.
I'm adding them. It worked fine with function attributes, but replacing
attributes with instruction flags revealed this inconvenience. At the
end it doesn't seem to be an issue as front-end can just emit normal
instructions rather than constant expression when FPEnv access is
enabled.
--
Sergey
On Tue, Dec 02, 2014 at 02:46:32PM -0800, Michael Ilseman
wrote:> Out of curiosity, how would you envision fast-math flags interacting with
constant expressions? Off the top of my head, I can’t think of any flags that
would be relevant if the expression can just be constant-folded away at full
precision anyways.
>
> > On Nov 28, 2014, at 4:56 AM, Sergey Dmitrouk <sdmitrouk at
accesssoftek.com> wrote:
> >
> > Doesn't look like a bug, more like a limitation of constant
expressions
> > as llvm::BinaryConstantExpr doesn't have FastMastFlags.
> >
> > --
> > Sergey
> >
> > On Thu, Nov 27, 2014 at 03:39:20PM +0200, Sergey Dmitrouk wrote:
> >> Hi,
> >>
> >> I'm wondering why lib/AsmParser/LLParser handles fast-math
flags in the
> >> following IR:
> >>
> >> ...
> >> %val = fmul nnan double 1.0, 1.0
> >> ...
> >>
> >> but doesn't allow any flags if "fmul" is inside
"phi":
> >>
> >> ...
> >> %val = phi double [ fmul (double 1.0, double 1.0), %cond.true
],
> >> [ fmul (double 1.0, double 1.0), %cond.false
]
> >> ...
> >>
> >> LLParser::ParseValID(...) could call EatFastMathFlagsIfPresent()
to
> >> handle fast-math flags, but it doesn't. Is this intended or a
bug?
> >>
> >> Regards,
> >> Sergey