Generate fpmath metadata when -ffast-math. Note that no optimizations are hooked
up to this yet. llvm-svn: 154835
This commit is contained in:
parent
dfc9ab2c16
commit
8030b810de
|
@ -22,8 +22,9 @@
|
|||
#include "clang/AST/DeclCXX.h"
|
||||
#include "clang/AST/StmtCXX.h"
|
||||
#include "clang/Frontend/CodeGenOptions.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/Intrinsics.h"
|
||||
#include "llvm/Support/MDBuilder.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
using namespace clang;
|
||||
using namespace CodeGen;
|
||||
|
||||
|
@ -41,6 +42,10 @@ CodeGenFunction::CodeGenFunction(CodeGenModule &cgm)
|
|||
TerminateHandler(0), TrapBB(0) {
|
||||
|
||||
CatchUndefined = getContext().getLangOpts().CatchUndefined;
|
||||
if (getContext().getLangOpts().FastMath) {
|
||||
llvm::MDBuilder MDHelper(Builder.getContext());
|
||||
Builder.SetDefaultFPMathTag(MDHelper.createFastFPMath());
|
||||
}
|
||||
CGM.getCXXABI().getMangleContext().startNewFunction();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
// RUN: %clang_cc1 %s -ffast-math -emit-llvm -o - | FileCheck %s
|
||||
|
||||
double add(double x, double y) {
|
||||
// CHECK: @add
|
||||
return x + y;
|
||||
// CHECK: fadd double %{{.}}, %{{.}}, !fpmath !0
|
||||
}
|
||||
// CHECK: !0 = metadata !{metadata !"fast"}
|
Loading…
Reference in New Issue