}
// X + undef -> undef
- if (isa<UndefValue>(Op1))
+ if (match(Op1, m_Undef()))
return Op1;
// X + 0 -> X
// X - undef -> undef
// undef - X -> undef
- if (isa<UndefValue>(Op0) || isa<UndefValue>(Op1))
+ if (match(Op0, m_Undef()) || match(Op1, m_Undef()))
return UndefValue::get(Op0->getType());
// X - 0 -> X
}
// X * undef -> 0
- if (isa<UndefValue>(Op1))
+ if (match(Op1, m_Undef()))
return Constant::getNullValue(Op0->getType());
// X * 0 -> 0
bool isSigned = Opcode == Instruction::SDiv;
// X / undef -> undef
- if (isa<UndefValue>(Op1))
+ if (match(Op1, m_Undef()))
return Op1;
// undef / X -> 0
- if (isa<UndefValue>(Op0))
+ if (match(Op0, m_Undef()))
return Constant::getNullValue(Op0->getType());
// 0 / X -> 0, we don't need to preserve faults!
return ::SimplifyUDivInst(Op0, Op1, TD, DT, RecursionLimit);
}
-static Value *SimplifyFDivInst(Value *Op0, Value *Op1, const TargetData *TD,
- const DominatorTree *DT, unsigned MaxRecurse) {
+static Value *SimplifyFDivInst(Value *Op0, Value *Op1, const TargetData *,
+ const DominatorTree *, unsigned) {
// undef / X -> undef (the undef could be a snan).
- if (isa<UndefValue>(Op0))
+ if (match(Op0, m_Undef()))
return Op0;
// X / undef -> undef
- if (isa<UndefValue>(Op1))
+ if (match(Op1, m_Undef()))
return Op1;
return 0;
return Op0;
// X shift by undef -> undef because it may shift by the bitwidth.
- if (isa<UndefValue>(Op1))
+ if (match(Op1, m_Undef()))
return Op1;
// Shifting by the bitwidth or more is undefined.
return V;
// undef << X -> 0
- if (isa<UndefValue>(Op0))
+ if (match(Op0, m_Undef()))
return Constant::getNullValue(Op0->getType());
return 0;
return V;
// undef >>l X -> 0
- if (isa<UndefValue>(Op0))
+ if (match(Op0, m_Undef()))
return Constant::getNullValue(Op0->getType());
return 0;
return Op0;
// undef >>a X -> all ones
- if (isa<UndefValue>(Op0))
+ if (match(Op0, m_Undef()))
return Constant::getAllOnesValue(Op0->getType());
return 0;
}
// X & undef -> 0
- if (isa<UndefValue>(Op1))
+ if (match(Op1, m_Undef()))
return Constant::getNullValue(Op0->getType());
// X & X = X
}
// X | undef -> -1
- if (isa<UndefValue>(Op1))
+ if (match(Op1, m_Undef()))
return Constant::getAllOnesValue(Op0->getType());
// X | X = X
}
// A ^ undef -> undef
- if (isa<UndefValue>(Op1))
+ if (match(Op1, m_Undef()))
return Op1;
// A ^ 0 = A