forked from OSchip/llvm-project
Add a hasPoisonGeneratingFlags proxy wrapper to Instruction [NFC]
This just cuts down on casts to Operator.
This commit is contained in:
parent
7f287390d7
commit
ed6b69a38f
|
@ -387,6 +387,10 @@ public:
|
|||
/// Determine whether the no signed wrap flag is set.
|
||||
bool hasNoSignedWrap() const;
|
||||
|
||||
/// Return true if this operator has flags which may cause this instruction
|
||||
/// to evaluate to poison despite having non-poison inputs.
|
||||
bool hasPoisonGeneratingFlags() const;
|
||||
|
||||
/// Drops flags that may cause this instruction to evaluate to poison despite
|
||||
/// having non-poison inputs.
|
||||
void dropPoisonGeneratingFlags();
|
||||
|
|
|
@ -141,6 +141,10 @@ bool Instruction::hasNoSignedWrap() const {
|
|||
return cast<OverflowingBinaryOperator>(this)->hasNoSignedWrap();
|
||||
}
|
||||
|
||||
bool Instruction::hasPoisonGeneratingFlags() const {
|
||||
return cast<Operator>(this)->hasPoisonGeneratingFlags();
|
||||
}
|
||||
|
||||
void Instruction::dropPoisonGeneratingFlags() {
|
||||
switch (getOpcode()) {
|
||||
case Instruction::Add:
|
||||
|
@ -164,8 +168,7 @@ void Instruction::dropPoisonGeneratingFlags() {
|
|||
}
|
||||
// TODO: FastMathFlags!
|
||||
|
||||
assert(!cast<Operator>(this)->hasPoisonGeneratingFlags() &&
|
||||
"must be kept in sync");
|
||||
assert(!hasPoisonGeneratingFlags() && "must be kept in sync");
|
||||
}
|
||||
|
||||
void Instruction::dropUndefImplyingAttrsAndUnknownMetadata(
|
||||
|
|
Loading…
Reference in New Issue