[IR] Add a Instruction::dropPoisonGeneratingFlags helper
Summary: The helper will be used in a later change. This change itself is NFC since the only user of this new function is its unit test. Reviewers: majnemer, efriedma Reviewed By: efriedma Subscribers: efriedma, mcrosier, llvm-commits Differential Revision: https://reviews.llvm.org/D30184 llvm-svn: 296035
This commit is contained in:
@@ -122,6 +122,29 @@ bool Instruction::hasNoSignedWrap() const {
|
||||
return cast<OverflowingBinaryOperator>(this)->hasNoSignedWrap();
|
||||
}
|
||||
|
||||
void Instruction::dropPoisonGeneratingFlags() {
|
||||
switch (getOpcode()) {
|
||||
case Instruction::Add:
|
||||
case Instruction::Sub:
|
||||
case Instruction::Mul:
|
||||
case Instruction::Shl:
|
||||
cast<OverflowingBinaryOperator>(this)->setHasNoUnsignedWrap(false);
|
||||
cast<OverflowingBinaryOperator>(this)->setHasNoSignedWrap(false);
|
||||
break;
|
||||
|
||||
case Instruction::UDiv:
|
||||
case Instruction::SDiv:
|
||||
case Instruction::AShr:
|
||||
case Instruction::LShr:
|
||||
cast<PossiblyExactOperator>(this)->setIsExact(false);
|
||||
break;
|
||||
|
||||
case Instruction::GetElementPtr:
|
||||
cast<GetElementPtrInst>(this)->setIsInBounds(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool Instruction::isExact() const {
|
||||
return cast<PossiblyExactOperator>(this)->isExact();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user