summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2012-04-16 17:24:31 +0000
committerDuncan Sands <baldrick@free.fr>2012-04-16 17:24:31 +0000
commit10e675d4824710426ab894336cfb659742c94d08 (patch)
tree933a61b2bc5ea2101169d630f48aa95cdd94b36f /lib
parent7ac715fd3118362f14574c312b044d22e3afeee9 (diff)
Generate fpmath metadata when -ffast-math. Note that no optimizations are hooked
up to this yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154835 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/CodeGenFunction.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index 9cbba06654..f4b483b515 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -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();
}