[IR] add set function for FMF 'contract'
authorSanjay Patel <spatel@rotateright.com>
Wed, 27 May 2020 12:29:09 +0000 (08:29 -0400)
committerSanjay Patel <spatel@rotateright.com>
Wed, 27 May 2020 13:14:51 +0000 (09:14 -0400)
This was missed when the flag was added with D31164.

llvm/include/llvm/IR/Instruction.h
llvm/lib/IR/Instruction.cpp

index b15ecec..4722d50 100644 (file)
@@ -396,6 +396,11 @@ public:
   /// 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.
index 645f7c0..23e8332 100644 (file)
@@ -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);