summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-05-31 19:04:47 +0000
committerNikita Popov <nikita.ppv@gmail.com>2019-05-31 19:04:47 +0000
commitccb63e0bfe169a9adadccc01ec0c9f2bdb0f6e86 (patch)
tree8db6b7eab1abd459d64531b9f62f9b8c2ad1883e /llvm/lib
parent51e0de6954a993f4647d16a243494139043dc105 (diff)
downloadbcm5719-llvm-ccb63e0bfe169a9adadccc01ec0c9f2bdb0f6e86.tar.gz
bcm5719-llvm-ccb63e0bfe169a9adadccc01ec0c9f2bdb0f6e86.zip
Revert "[CVP] Simplify non-overflowing saturating add/sub"
This reverts commit 1e692d1777ae34dcb93524b5798651a29defae09. Causes assertion failure in builtins-wasm.c clang test. llvm-svn: 362254
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp25
1 files changed, 1 insertions, 24 deletions
diff --git a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
index 1715838a07e..eab49b5f8b3 100644
--- a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
+++ b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
@@ -63,8 +63,6 @@ STATISTIC(NumUDivs, "Number of udivs whose width was decreased");
STATISTIC(NumAShrs, "Number of ashr converted to lshr");
STATISTIC(NumSRems, "Number of srem converted to urem");
STATISTIC(NumOverflows, "Number of overflow checks removed");
-STATISTIC(NumSaturating,
- "Number of saturating arithmetics converted to normal arithmetics");
static cl::opt<bool> DontAddNoWrapFlags("cvp-dont-add-nowrap-flags", cl::init(true));
@@ -415,7 +413,7 @@ static void processOverflowIntrinsic(WithOverflowInst *WO) {
IRBuilder<> B(WO);
Value *NewOp = B.CreateBinOp(
WO->getBinaryOp(), WO->getLHS(), WO->getRHS(), WO->getName());
- // Constant-folding could have happened.
+ // Constant-holing could have happened.
if (auto *Inst = dyn_cast<Instruction>(NewOp)) {
if (WO->isSigned())
Inst->setHasNoSignedWrap();
@@ -430,20 +428,6 @@ static void processOverflowIntrinsic(WithOverflowInst *WO) {
++NumOverflows;
}
-static void processSaturatingInst(SaturatingInst *SI) {
- BinaryOperator *BinOp = BinaryOperator::Create(
- SI->getBinaryOp(), SI->getLHS(), SI->getRHS(), SI->getName(), SI);
- BinOp->setDebugLoc(SI->getDebugLoc());
- if (SI->isSigned())
- BinOp->setHasNoSignedWrap();
- else
- BinOp->setHasNoUnsignedWrap();
-
- SI->replaceAllUsesWith(BinOp);
- SI->eraseFromParent();
- ++NumSaturating;
-}
-
/// Infer nonnull attributes for the arguments at the specified callsite.
static bool processCallSite(CallSite CS, LazyValueInfo *LVI) {
SmallVector<unsigned, 4> ArgNos;
@@ -456,13 +440,6 @@ static bool processCallSite(CallSite CS, LazyValueInfo *LVI) {
}
}
- if (auto *SI = dyn_cast<SaturatingInst>(CS.getInstruction())) {
- if (willNotOverflow(SI, LVI)) {
- processSaturatingInst(SI);
- return true;
- }
- }
-
// Deopt bundle operands are intended to capture state with minimal
// perturbance of the code otherwise. If we can find a constant value for
// any such operand and remove a use of the original value, that's
OpenPOWER on IntegriCloud