diff options
| author | Kevin P. Neal <kevin.neal@sas.com> | 2020-11-06 10:44:13 -0500 |
|---|---|---|
| committer | Kevin P. Neal <kevin.neal@sas.com> | 2020-11-06 11:56:12 -0500 |
| commit | 2069403cdf35da826937dc40453930c60d52487f (patch) | |
| tree | 5db44b28be3e7e87bea3bc86e827f0f1c5577d13 /clang/lib/CodeGen/CGExprComplex.cpp | |
| parent | d0b8810fe4ece12213936605b336777ed5fd06cc (diff) | |
[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
Diffstat (limited to 'clang/lib/CodeGen/CGExprComplex.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGExprComplex.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
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<AtomicType>()) LHSTy = AT->getValueType(); + CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, E); BinOpInfo OpInfo; // Load the RHS and LHS operands. |
