summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/Instruction.cpp7
-rw-r--r--llvm/lib/IR/Instructions.cpp2
2 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp
index 86421c4ae9f..50b1f04d41e 100644
--- a/llvm/lib/IR/Instruction.cpp
+++ b/llvm/lib/IR/Instruction.cpp
@@ -143,6 +143,11 @@ void Instruction::setFastMathFlags(FastMathFlags FMF) {
cast<FPMathOperator>(this)->setFastMathFlags(FMF);
}
+void Instruction::copyFastMathFlags(FastMathFlags FMF) {
+ assert(isa<FPMathOperator>(this) && "copying fast-math flag on invalid op");
+ cast<FPMathOperator>(this)->copyFastMathFlags(FMF);
+}
+
/// Determine whether the unsafe-algebra flag is set.
bool Instruction::hasUnsafeAlgebra() const {
assert(isa<FPMathOperator>(this) && "getting fast-math flag on invalid op");
@@ -183,7 +188,7 @@ FastMathFlags Instruction::getFastMathFlags() const {
/// Copy I's fast-math flags
void Instruction::copyFastMathFlags(const Instruction *I) {
- setFastMathFlags(I->getFastMathFlags());
+ copyFastMathFlags(I->getFastMathFlags());
}
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index 16993f1bba5..b113d51d416 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -2043,7 +2043,7 @@ void BinaryOperator::copyFlags(const Value *V) {
// Copy the fast-math flags.
if (auto *FP = dyn_cast<FPMathOperator>(V))
- setFastMathFlags(FP->getFastMathFlags());
+ copyFastMathFlags(FP->getFastMathFlags());
}
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud