From e906f2a370e3db25d717a41c5a5b3e0d9d2aee86 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 30 May 2019 21:03:10 +0000 Subject: [PATCH] [CVP] Generalize willNotOverflow(); NFC Change argument from WithOverflowInst to BinaryOpIntrinsic, so this function can also be used for saturating math intrinsics. llvm-svn: 362152 --- llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp index 4e4715b..eab49b5 100644 --- a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp +++ b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp @@ -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); } -- 2.7.4