aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorMelanie Blower <melanie.blower@intel.com>2021-07-29 12:02:20 -0400
committerMelanie Blower <melanie.blower@intel.com>2021-07-29 12:02:37 -0400
commitbc5b5ea037dbadd281c59248ae9d2742b51c69ed (patch)
tree95b5bd94fcca7e04296a39be17960b72ca64408d /clang/lib/Sema/SemaExpr.cpp
parent4acc2f29a278ff2a0a4d683dd6d706cc2f7123fd (diff)
downloadllvm-bc5b5ea037dbadd281c59248ae9d2742b51c69ed.zip
llvm-bc5b5ea037dbadd281c59248ae9d2742b51c69ed.tar.gz
llvm-bc5b5ea037dbadd281c59248ae9d2742b51c69ed.tar.bz2
[clang][patch][FPEnv] Make initialization of C++ globals strictfp aware
@kpn pointed out that the global variable initialization functions didn't have the "strictfp" metadata set correctly, and @rjmccall said that there was buggy code in SetFPModel and StartFunction, this patch is to solve those problems. When Sema creates a FunctionDecl, it sets the FunctionDeclBits.UsesFPIntrin to "true" if the lexical FP settings (i.e. a combination of command line options and #pragma float_control settings) correspond to ConstrainedFP mode. That bit is used when CodeGen starts codegen for a llvm function, and it translates into the "strictfp" function attribute. See bugs.llvm.org/show_bug.cgi?id=44571 Reviewed By: Aaron Ballman Differential Revision: https://reviews.llvm.org/D102343
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index ee997908..5ce5d12 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -6280,14 +6280,12 @@ static FunctionDecl *rewriteBuiltinFunctionDecl(Sema *Sema, ASTContext &Context,
QualType OverloadTy = Context.getFunctionType(FT->getReturnType(),
OverloadParams, EPI);
DeclContext *Parent = FDecl->getParent();
- FunctionDecl *OverloadDecl = FunctionDecl::Create(Context, Parent,
- FDecl->getLocation(),
- FDecl->getLocation(),
- FDecl->getIdentifier(),
- OverloadTy,
- /*TInfo=*/nullptr,
- SC_Extern, false,
- /*hasPrototype=*/true);
+ FunctionDecl *OverloadDecl = FunctionDecl::Create(
+ Context, Parent, FDecl->getLocation(), FDecl->getLocation(),
+ FDecl->getIdentifier(), OverloadTy,
+ /*TInfo=*/nullptr, SC_Extern, Sema->getCurFPFeatures().isFPConstrained(),
+ false,
+ /*hasPrototype=*/true);
SmallVector<ParmVarDecl*, 16> Params;
FT = cast<FunctionProtoType>(OverloadTy);
for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i) {
@@ -19529,7 +19527,8 @@ ExprResult RebuildUnknownAnyExpr::resolveDecl(Expr *E, ValueDecl *VD) {
FunctionDecl *NewFD = FunctionDecl::Create(
S.Context, FD->getDeclContext(), Loc, Loc,
FD->getNameInfo().getName(), DestType, FD->getTypeSourceInfo(),
- SC_None, false /*isInlineSpecified*/, FD->hasPrototype(),
+ SC_None, S.getCurFPFeatures().isFPConstrained(),
+ false /*isInlineSpecified*/, FD->hasPrototype(),
/*ConstexprKind*/ ConstexprSpecKind::Unspecified);
if (FD->getQualifier())