From 2069403cdf35da826937dc40453930c60d52487f Mon Sep 17 00:00:00 2001 From: "Kevin P. Neal" Date: Fri, 6 Nov 2020 10:44:13 -0500 Subject: [FPEnv] Use strictfp metadata in casting nodes The strictfp metadata was added to the casting AST nodes in D85960, but we aren't using that metadata yet. This patch adds that support. In order to avoid lots of ad-hoc passing around of the strictfp bits I updated the IRBuilder when moving from a function that has the Expr* to a function that lacks it. I believe we should switch to this pattern to keep the strictfp support from being overly invasive. For the purpose of testing that we're picking up the right metadata, I also made my tests use a pragma to make the AST's strictfp metadata not match the global strictfp metadata. This exposes issues that we need to deal with in subsequent patches, and I believe this is the right method for most all of our clang strictfp tests. Differential Revision: https://reviews.llvm.org/D88913 --- clang/lib/CodeGen/CGExprComplex.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'clang/lib/CodeGen/CGExprComplex.cpp') diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp index 5b2a0bb4700c..6b6b901e0376 100644 --- a/clang/lib/CodeGen/CGExprComplex.cpp +++ b/clang/lib/CodeGen/CGExprComplex.cpp @@ -536,17 +536,21 @@ ComplexPairTy ComplexExprEmitter::EmitCast(CastKind CK, Expr *Op, llvm_unreachable("invalid cast kind for complex value"); case CK_FloatingRealToComplex: - case CK_IntegralRealToComplex: + case CK_IntegralRealToComplex: { + CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, Op); return EmitScalarToComplexCast(CGF.EmitScalarExpr(Op), Op->getType(), DestTy, Op->getExprLoc()); + } case CK_FloatingComplexCast: case CK_FloatingComplexToIntegralComplex: case CK_IntegralComplexCast: - case CK_IntegralComplexToFloatingComplex: + case CK_IntegralComplexToFloatingComplex: { + CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, Op); return EmitComplexToComplexCast(Visit(Op), Op->getType(), DestTy, Op->getExprLoc()); } + } llvm_unreachable("unknown cast resulting in complex value"); } @@ -900,6 +904,7 @@ EmitCompoundAssignLValue(const CompoundAssignOperator *E, if (const AtomicType *AT = LHSTy->getAs()) LHSTy = AT->getValueType(); + CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, E); BinOpInfo OpInfo; // Load the RHS and LHS operands. -- cgit v1.2.3