Skip to content

Commit

Permalink
[IR] add set function for FMF 'contract'
Browse files Browse the repository at this point in the history
This was missed when the flag was added with D31164.
  • Loading branch information
rotateright committed May 27, 2020
1 parent 0865d41 commit 2ee4ec6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions llvm/include/llvm/IR/Instruction.h
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions llvm/lib/IR/Instruction.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit 2ee4ec6

Please sign in to comment.