]> granicus.if.org Git - llvm/commitdiff
[CVP] Generalize willNotOverflow(); NFC
authorNikita Popov <nikita.ppv@gmail.com>
Thu, 30 May 2019 21:03:10 +0000 (21:03 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Thu, 30 May 2019 21:03:10 +0000 (21:03 +0000)
Change argument from WithOverflowInst to BinaryOpIntrinsic, so this
function can also be used for saturating math intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362152 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/CorrelatedValuePropagation.cpp

index 4e4715be61aed76db1e5d79c69f60b80f367877c..eab49b5f8b37e91097f847e759c1819d99723f4b 100644 (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);
 }