[PATCH] D72841: [RFC] Add support for pragma float_control, to control precision and exception behavior at the source level

Melanie Blower via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 5 10:57:51 PST 2020


mibintc marked 2 inline comments as done.
mibintc added inline comments.


================
Comment at: clang/lib/CodeGen/CGExprScalar.cpp:4085
     // this should improve codegen just a little.
-    RHS = Visit(E->getRHS());
-    LHS = EmitCheckedLValue(E->getLHS(), CodeGenFunction::TCK_Store);
+    if (E->getType()->isFloatingType()) {
+      //  Preserve the old values, enable FPFeatures for these expressions
----------------
mibintc wrote:
> In the previous rendition of this patch, when the Builder.FMF settings were modified at Visit(BinaryExpression), the assign is seen as a binary expression and so the FPFeatures was passed into IRBuilder. I'm not confident this patch is in the right place, I'd really like to put FPFeatures onto the CallExpr node, because if you call a builtin intrinsic function, and the mode is set to float_control(except, on), the call node for the intrinsic doesn't have the FPFeature bits, so it isn't marked as expected. Before I make that change I want @rjmccall to take another look;  If FPFeatures was on CallExpr then I'd remove it here and modify IRBuilder.FMF when visiting CallExpr 
I got rid of the bogus code here and moved it into VisitCallExpr where it belongs. 


================
Comment at: clang/lib/CodeGen/CGExprScalar.cpp:611
 
+    //  Preserve the old values
+    llvm::IRBuilder<>::FastMathFlagGuard FMFG(Builder);
----------------
The call expr might be a call to an intrinsic, the floating point intrinsic calls need to be marked properly with information from FPFeatures


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72841





More information about the llvm-commits mailing list