[CVP] Generalize willNotOverflow(); NFC

Change argument from WithOverflowInst to BinaryOpIntrinsic, so this
function can also be used for saturating math intrinsics.

llvm-svn: 362152
This commit is contained in:
Nikita Popov 2019-05-30 21:03:10 +00:00
parent a100042b27
commit e906f2a370
1 changed files with 5 additions and 5 deletions

View File

@ -398,14 +398,14 @@ static bool processSwitch(SwitchInst *SI, LazyValueInfo *LVI,
return Changed;
}
// See if we can prove that the given overflow intrinsic will not overflow.
static bool willNotOverflow(WithOverflowInst *WO, LazyValueInfo *LVI) {
// See if we can prove that the given binary op intrinsic will not overflow.
static bool willNotOverflow(BinaryOpIntrinsic *BO, LazyValueInfo *LVI) {
ConstantRange LRange = LVI->getConstantRange(
WO->getLHS(), WO->getParent(), WO);
BO->getLHS(), BO->getParent(), BO);
ConstantRange RRange = LVI->getConstantRange(
WO->getRHS(), WO->getParent(), WO);
BO->getRHS(), BO->getParent(), BO);
ConstantRange NWRegion = ConstantRange::makeGuaranteedNoWrapRegion(
WO->getBinaryOp(), RRange, WO->getNoWrapKind());
BO->getBinaryOp(), RRange, BO->getNoWrapKind());
return NWRegion.contains(LRange);
}