aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2016-04-11 15:26:18 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2016-04-11 15:26:18 +0000
commitf9d88e650b89aebb0af85cd00639b55e740f2569 (patch)
tree1a12d4855f7021ade2d20b4e3c7080596edc7567 /llvm/lib/Analysis/ValueTracking.cpp
parente578e970cb979d000e6b1d734b406aa06d9313d4 (diff)
downloadllvm-f9d88e650b89aebb0af85cd00639b55e740f2569.zip
llvm-f9d88e650b89aebb0af85cd00639b55e740f2569.tar.gz
llvm-f9d88e650b89aebb0af85cd00639b55e740f2569.tar.bz2
This reverts commit r265913 and r265912
See PR27315 r265913: "[IndVars] Eliminate op.with.overflow when possible" r265912: "[SCEV] See through op.with.overflow intrinsics" llvm-svn: 265950
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp61
1 files changed, 0 insertions, 61 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 6df2294..6f8dc2c2 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -3253,67 +3253,6 @@ static OverflowResult computeOverflowForSignedAdd(
return OverflowResult::MayOverflow;
}
-bool llvm::isOverflowIntrinsicNoWrap(IntrinsicInst *II, DominatorTree &DT) {
-#ifndef NDEBUG
- auto IID = II->getIntrinsicID();
- assert((IID == Intrinsic::sadd_with_overflow ||
- IID == Intrinsic::uadd_with_overflow ||
- IID == Intrinsic::ssub_with_overflow ||
- IID == Intrinsic::usub_with_overflow ||
- IID == Intrinsic::smul_with_overflow ||
- IID == Intrinsic::umul_with_overflow) &&
- "Not an overflow intrinsic!");
-#endif
-
- SmallVector<BranchInst *, 2> GuardingBranches;
- SmallVector<ExtractValueInst *, 2> Results;
-
- for (User *U : II->users()) {
- if (auto *EVI = dyn_cast<ExtractValueInst>(U)) {
- assert(EVI->getNumIndices() == 1 && "Obvious from CI's type");
-
- if (EVI->getIndices()[0] == 0)
- Results.push_back(EVI);
- else {
- assert(EVI->getIndices()[0] == 1 && "Obvious from CI's type");
-
- for (auto *U : EVI->users())
- if (auto *B = dyn_cast<BranchInst>(U)) {
- assert(B->isConditional() && "How else is it using an i1?");
- GuardingBranches.push_back(B);
- }
- }
- } else {
- // We are using the aggregate directly in a way we don't want to analyze
- // here (storing it to a global, say).
- return false;
- }
- }
-
- auto AllUsesGuardedByBranch = [&](BranchInst *BI) {
- BasicBlockEdge NoWrapEdge(BI->getParent(), BI->getSuccessor(1));
- if (!NoWrapEdge.isSingleEdge())
- return false;
-
- // Check if all users of the add are provably no-wrap.
- for (auto *Result : Results) {
- // If the extractvalue itself is not executed on overflow, the we don't
- // need to check each use separately, since domination is transitive.
- if (DT.dominates(NoWrapEdge, Result->getParent()))
- continue;
-
- for (auto &RU : Result->uses())
- if (!DT.dominates(NoWrapEdge, RU))
- return false;
- }
-
- return true;
- };
-
- return any_of(GuardingBranches, AllUsesGuardedByBranch);
-}
-
-
OverflowResult llvm::computeOverflowForSignedAdd(AddOperator *Add,
const DataLayout &DL,
AssumptionCache *AC,