[llvm] 2ee4ec6 - [IR] add set function for FMF 'contract'
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Wed May 27 06:15:01 PDT 2020
Author: Sanjay Patel
Date: 2020-05-27T09:14:51-04:00
New Revision: 2ee4ec6b6f6d0571288db69b824f6773717d2cf7
URL: https://github.com/llvm/llvm-project/commit/2ee4ec6b6f6d0571288db69b824f6773717d2cf7
DIFF: https://github.com/llvm/llvm-project/commit/2ee4ec6b6f6d0571288db69b824f6773717d2cf7.diff
LOG: [IR] add set function for FMF 'contract'
This was missed when the flag was added with D31164.
Added:
Modified:
llvm/include/llvm/IR/Instruction.h
llvm/lib/IR/Instruction.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/Instruction.h b/llvm/include/llvm/IR/Instruction.h
index b15ececc677c..4722d509f370 100644
--- a/llvm/include/llvm/IR/Instruction.h
+++ b/llvm/include/llvm/IR/Instruction.h
@@ -396,6 +396,11 @@ class Instruction : public User,
/// this flag.
void setHasAllowReciprocal(bool B);
+ /// Set or clear the allow-contract flag on this instruction, which must be
+ /// an operator which supports this flag. See LangRef.html for the meaning of
+ /// this flag.
+ void setHasAllowContract(bool B);
+
/// Set or clear the approximate-math-functions flag on this instruction,
/// which must be an operator which supports this flag. See LangRef.html for
/// the meaning of this flag.
diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp
index 645f7c0944d5..23e8332f7d09 100644
--- a/llvm/lib/IR/Instruction.cpp
+++ b/llvm/lib/IR/Instruction.cpp
@@ -198,6 +198,11 @@ void Instruction::setHasAllowReciprocal(bool B) {
cast<FPMathOperator>(this)->setHasAllowReciprocal(B);
}
+void Instruction::setHasAllowContract(bool B) {
+ assert(isa<FPMathOperator>(this) && "setting fast-math flag on invalid op");
+ cast<FPMathOperator>(this)->setHasAllowContract(B);
+}
+
void Instruction::setHasApproxFunc(bool B) {
assert(isa<FPMathOperator>(this) && "setting fast-math flag on invalid op");
cast<FPMathOperator>(this)->setHasApproxFunc(B);
More information about the llvm-commits
mailing list