From ab3b56e2dc50fbd988fb1eaf47d2f1a8a70e8083 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Tue, 6 Dec 2016 03:01:08 +0000 Subject: [PATCH] [LVI] Hide the last markX function on LVILatticeVal This completes a small series of patches to hide the stateful updates of LVILatticeVal from the consuming code. The only remaining stateful API is mergeIn. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288765 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/LazyValueInfo.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/Analysis/LazyValueInfo.cpp b/lib/Analysis/LazyValueInfo.cpp index 856238bda2e..5ea0e7ce9fb 100644 --- a/lib/Analysis/LazyValueInfo.cpp +++ b/lib/Analysis/LazyValueInfo.cpp @@ -140,6 +140,7 @@ public: return Range; } +private: /// Return true if this is a change in status. bool markOverdefined() { if (isOverdefined()) @@ -148,7 +149,6 @@ public: return true; } -private: /// Return true if this is a change in status. bool markConstant(Constant *V) { assert(V && "Marking constant with NULL"); @@ -872,7 +872,7 @@ bool LazyValueInfoImpl::solveBlockValueNonLocal(LVILatticeVal &BBLV, PointerType *PTy = cast(Val->getType()); Result = LVILatticeVal::getNot(ConstantPointerNull::get(PTy)); } else { - Result.markOverdefined(); + Result = LVILatticeVal::getOverdefined(); } BBLV = Result; return true; @@ -996,28 +996,28 @@ bool LazyValueInfoImpl::solveBlockValueSelect(LVILatticeVal &BBLV, if (!hasBlockValue(SI->getTrueValue(), BB)) { if (pushBlockValue(std::make_pair(BB, SI->getTrueValue()))) return false; - BBLV.markOverdefined(); + BBLV = LVILatticeVal::getOverdefined(); return true; } LVILatticeVal TrueVal = getBlockValue(SI->getTrueValue(), BB); // If we hit overdefined, don't ask more queries. We want to avoid poisoning // extra slots in the table if we can. if (TrueVal.isOverdefined()) { - BBLV.markOverdefined(); + BBLV = LVILatticeVal::getOverdefined(); return true; } if (!hasBlockValue(SI->getFalseValue(), BB)) { if (pushBlockValue(std::make_pair(BB, SI->getFalseValue()))) return false; - BBLV.markOverdefined(); + BBLV = LVILatticeVal::getOverdefined(); return true; } LVILatticeVal FalseVal = getBlockValue(SI->getFalseValue(), BB); // If we hit overdefined, don't ask more queries. We want to avoid poisoning // extra slots in the table if we can. if (FalseVal.isOverdefined()) { - BBLV.markOverdefined(); + BBLV = LVILatticeVal::getOverdefined(); return true; } @@ -1116,7 +1116,7 @@ bool LazyValueInfoImpl::solveBlockValueCast(LVILatticeVal &BBLV, if (!BBI->getOperand(0)->getType()->isSized()) { // Without knowing how wide the input is, we can't analyze it in any useful // way. - BBLV.markOverdefined(); + BBLV = LVILatticeVal::getOverdefined(); return true; } @@ -1133,7 +1133,7 @@ bool LazyValueInfoImpl::solveBlockValueCast(LVILatticeVal &BBLV, // Unhandled instructions are overdefined. DEBUG(dbgs() << " compute BB '" << BB->getName() << "' - overdefined (unknown cast).\n"); - BBLV.markOverdefined(); + BBLV = LVILatticeVal::getOverdefined(); return true; } @@ -1192,7 +1192,7 @@ bool LazyValueInfoImpl::solveBlockValueBinaryOp(LVILatticeVal &BBLV, // Unhandled instructions are overdefined. DEBUG(dbgs() << " compute BB '" << BB->getName() << "' - overdefined (unknown binary operator).\n"); - BBLV.markOverdefined(); + BBLV = LVILatticeVal::getOverdefined(); return true; }; @@ -1404,7 +1404,7 @@ bool LazyValueInfoImpl::getEdgeValue(Value *Val, BasicBlock *BBFrom, if (!getEdgeValueLocal(Val, BBFrom, BBTo, LocalResult)) // If we couldn't constrain the value on the edge, LocalResult doesn't // provide any information. - LocalResult.markOverdefined(); + LocalResult = LVILatticeVal::getOverdefined(); if (hasSingleValue(LocalResult)) { // Can't get any more precise here