diff options
author | Michael Ilseman <milseman@apple.com> | 2013-12-05 00:32:09 +0000 |
---|---|---|
committer | Michael Ilseman <milseman@apple.com> | 2013-12-05 00:32:09 +0000 |
commit | faf4d59137e85f917f868e784c8d83ccc29c4b7f (patch) | |
tree | 30f83caa4941d2a4a17ed7203c0e832c01a2d662 /include | |
parent | e4b236cf59af0ed1e9cd7e9b1f1f195c5459ebc4 (diff) | |
download | llvm-faf4d59137e85f917f868e784c8d83ccc29c4b7f.tar.gz llvm-faf4d59137e85f917f868e784c8d83ccc29c4b7f.tar.bz2 llvm-faf4d59137e85f917f868e784c8d83ccc29c4b7f.tar.xz |
Use present fast-math flags when applicable in CreateBinOp
We were previously not adding fast-math flags through CreateBinOp()
when it happened to be making a floating point binary operator. This
patch updates it to do so similarly to directly calling CreateF*().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196438 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/IR/IRBuilder.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/llvm/IR/IRBuilder.h b/include/llvm/IR/IRBuilder.h index 56e818417a..c9c11be89d 100644 --- a/include/llvm/IR/IRBuilder.h +++ b/include/llvm/IR/IRBuilder.h @@ -832,11 +832,15 @@ public: } Value *CreateBinOp(Instruction::BinaryOps Opc, - Value *LHS, Value *RHS, const Twine &Name = "") { + Value *LHS, Value *RHS, const Twine &Name = "", + MDNode *FPMathTag = 0) { if (Constant *LC = dyn_cast<Constant>(LHS)) if (Constant *RC = dyn_cast<Constant>(RHS)) return Insert(Folder.CreateBinOp(Opc, LC, RC), Name); - return Insert(BinaryOperator::Create(Opc, LHS, RHS), Name); + llvm::Instruction *BinOp = BinaryOperator::Create(Opc, LHS, RHS); + if (isa<FPMathOperator>(BinOp)) + BinOp = AddFPMathAttributes(BinOp, FPMathTag, FMF); + return Insert(BinOp, Name); } Value *CreateNeg(Value *V, const Twine &Name = "", |