[PATCH] D69272: Enable '#pragma STDC FENV_ACCESS' in frontend

Melanie Blower via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 11 10:12:42 PDT 2020


mibintc added a comment.

Hello, I rebased this and made a few changes here, https://reviews.llvm.org/D87528 ; I added a question about floating point constant folding in that review, I'm going to duplicate it here,

My question is about constant folding. I am working on a task to ensure that clang is doing floating point constant folding correctly. I thought the constant folding was in AST/ExprConstant.cpp and indeed constant folding does occur there. But sometimes, if the floating point semantics are set to 'strict', even tho' folding has occurred successfully in ExprConstant.cpp, when i look at emit-llvm, there is arithmetic emitted for the floating point expression;  For example if you use the command line option -ffp-exception-behavior=strict and you compile this function, it will emit the add instruction; but without the option you will see the folded expression.  Either way, if you put a breakpoint inside ExprConstant.cpp the calculation of the floating sum does occur.  The function is float myAdd(void) { return 1.0 + 2.0; }

So where is the decision made that backs out the fold?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69272/new/

https://reviews.llvm.org/D69272



More information about the cfe-commits mailing list