[PATCH] D14071: [FPEnv Core 06/14] Do not fold constants on reading in IR asm/bitcode

Sergey Dmitrouk via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 26 09:26:46 PDT 2015


sdmitrouk added a comment.

In http://reviews.llvm.org/D14071#275229, @majnemer wrote:

> Why are we making this assumption?  It seems strange to assume that all constant expressions infer KeepExceptions and KeepRounding.


Constant expressions do not have fast-math flags, the sole purpose of setting them here is to prevent any kind of folding. As there is no way to specify flags, assuming FPEnv access should work for all cases.

I don't think anything should be folded in any reader or writer. Without this patch `<input> != write(read(<input>))` for constant expressions, which is a problem in case of preserving side-effects, but is also an odd behaviour in general.

In http://reviews.llvm.org/D14071#275229, @majnemer wrote:

> Also, shouldn't we be folding these to SNaN if KeepExceptions is true?


If you're talking about examples in test, then probably not, they return infinity or a number, SNaN is not equivalent to those values.


Repository:
  rL LLVM

http://reviews.llvm.org/D14071





More information about the llvm-commits mailing list