rjmccall wrote: > > Hmm. Is there some sort of optimization in IRGen that we need to suppress > > here, or is it something in LLVM code gen? Presumably normal LLVM > > optimization passes all just skip `optnone` functions. > > The issue #62098 demonstrates such case.
Okay. So if I understand correctly, this substitution of libcalls is a frontend optimization, and the bug is arguing that it ought to be suppressed by `optnone`. > Anyway, It is not good to have bogus attributes in AST. I think it's a fair question whether this is a bogus attribute. `optnone` is a very strange attribute; it's a directive to the compiler with no clear semantics. There are "optimizations" that I don't think we expect `optnone` to suppress — we wouldn't want `optnone` to turn off NRVO in C++, for example. `optnone` seems to be about getting a straightforward, literal translation of the code. If the frontend can do a transformation during IR emission, though, it's generally a highly reliable transformation and can basically be thought of as part of the semantics. >From the bug, it sounds more like the user wants some way to disable fast-math >for a specific function, and apparently we don't have one. That seems like a >reasonable feature request. Because we don't have that feature, they're >flailing around trying essentially every pragma and attribute that we *do* >have and arguing that at least one of them ought to have that impact, but it's >not at all clear to me that they should. And presumably they don't actually >want to disable all optimization of their function anyway; they just want to >turn off fast math. > > Mostly I'm wondering how far we're expected to go with `optnone`. > > It impedes implementation of pragma FENV_ROUND. The pragma requires setting > FP options inside CompoundStmt and it interacts with the fictious attributes. > This is the reason of this patch. That doesn't make sense as a reason for this patch; `#pragma FENV_ROUND` can obviously occur in non-`optnone` functions. https://github.com/llvm/llvm-project/pull/85605 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits