[llvm] r362152 - [CVP] Generalize willNotOverflow(); NFC

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu May 30 14:03:10 PDT 2019

Author: nikic
Date: Thu May 30 14:03:10 2019
New Revision: 362152

URL: http://llvm.org/viewvc/llvm-project?rev=362152&view=rev
[CVP] Generalize willNotOverflow(); NFC

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


Modified: llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp?rev=362152&r1=362151&r2=362152&view=diff
--- llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp Thu May 30 14:03:10 2019
@@ -398,14 +398,14 @@ static bool processSwitch(SwitchInst *SI
   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);

More information about the llvm-commits mailing list