forked from OSchip/llvm-project
[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:
parent
a100042b27
commit
e906f2a370
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue