forked from OSchip/llvm-project
SparseSolver: Rename getOrInitValueState to getValueState, matching what SCCP calls it
llvm-svn: 314744
This commit is contained in:
parent
f6d65dff55
commit
67fbb351e3
|
@ -141,18 +141,18 @@ public:
|
||||||
|
|
||||||
/// getLatticeState - Return the LatticeVal object that corresponds to the
|
/// getLatticeState - Return the LatticeVal object that corresponds to the
|
||||||
/// value. If an value is not in the map, it is returned as untracked,
|
/// value. If an value is not in the map, it is returned as untracked,
|
||||||
/// unlike the getOrInitValueState method.
|
/// unlike the getValueState method.
|
||||||
LatticeVal getLatticeState(Value *V) const {
|
LatticeVal getLatticeState(Value *V) const {
|
||||||
auto I = ValueState.find(V);
|
auto I = ValueState.find(V);
|
||||||
return I != ValueState.end() ? I->second : LatticeFunc->getUntrackedVal();
|
return I != ValueState.end() ? I->second : LatticeFunc->getUntrackedVal();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getOrInitValueState - Return the LatticeVal object that corresponds to the
|
/// getValueState - Return the LatticeVal object that corresponds to the
|
||||||
/// value, initializing the value's state if it hasn't been entered into the
|
/// value, initializing the value's state if it hasn't been entered into the
|
||||||
/// map yet. This function is necessary because not all values should start
|
/// map yet. This function is necessary because not all values should start
|
||||||
/// out in the underdefined state... Arguments should be overdefined, and
|
/// out in the underdefined state... Arguments should be overdefined, and
|
||||||
/// constants should be marked as constants.
|
/// constants should be marked as constants.
|
||||||
LatticeVal getOrInitValueState(Value *V);
|
LatticeVal getValueState(Value *V);
|
||||||
|
|
||||||
/// isEdgeFeasible - Return true if the control flow edge from the 'From'
|
/// isEdgeFeasible - Return true if the control flow edge from the 'From'
|
||||||
/// basic block to the 'To' basic block is currently feasible. If
|
/// basic block to the 'To' basic block is currently feasible. If
|
||||||
|
|
|
@ -57,13 +57,13 @@ void AbstractLatticeFunction<LatticeVal>::PrintValue(LatticeVal V,
|
||||||
// SparseSolver Implementation
|
// SparseSolver Implementation
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// getOrInitValueState - Return the LatticeVal object that corresponds to the
|
/// getValueState - Return the LatticeVal object that corresponds to the
|
||||||
/// value, initializing the value's state if it hasn't been entered into the
|
/// value, initializing the value's state if it hasn't been entered into the
|
||||||
/// map yet. This function is necessary because not all values should start
|
/// map yet. This function is necessary because not all values should start
|
||||||
/// out in the underdefined state... Arguments should be overdefined, and
|
/// out in the underdefined state... Arguments should be overdefined, and
|
||||||
/// constants should be marked as constants.
|
/// constants should be marked as constants.
|
||||||
template <class LatticeVal>
|
template <class LatticeVal>
|
||||||
LatticeVal SparseSolver<LatticeVal>::getOrInitValueState(Value *V) {
|
LatticeVal SparseSolver<LatticeVal>::getValueState(Value *V) {
|
||||||
auto I = ValueState.find(V);
|
auto I = ValueState.find(V);
|
||||||
if (I != ValueState.end()) return I->second; // Common case, in the map
|
if (I != ValueState.end()) return I->second; // Common case, in the map
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ void SparseSolver<LatticeVal>::getFeasibleSuccessors(
|
||||||
|
|
||||||
LatticeVal BCValue;
|
LatticeVal BCValue;
|
||||||
if (AggressiveUndef)
|
if (AggressiveUndef)
|
||||||
BCValue = getOrInitValueState(BI->getCondition());
|
BCValue = getValueState(BI->getCondition());
|
||||||
else
|
else
|
||||||
BCValue = getLatticeState(BI->getCondition());
|
BCValue = getLatticeState(BI->getCondition());
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ void SparseSolver<LatticeVal>::getFeasibleSuccessors(
|
||||||
SwitchInst &SI = cast<SwitchInst>(TI);
|
SwitchInst &SI = cast<SwitchInst>(TI);
|
||||||
LatticeVal SCValue;
|
LatticeVal SCValue;
|
||||||
if (AggressiveUndef)
|
if (AggressiveUndef)
|
||||||
SCValue = getOrInitValueState(SI.getCondition());
|
SCValue = getValueState(SI.getCondition());
|
||||||
else
|
else
|
||||||
SCValue = getLatticeState(SI.getCondition());
|
SCValue = getLatticeState(SI.getCondition());
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ void SparseSolver<LatticeVal>::visitPHINode(PHINode &PN) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LatticeVal PNIV = getOrInitValueState(&PN);
|
LatticeVal PNIV = getValueState(&PN);
|
||||||
LatticeVal Overdefined = LatticeFunc->getOverdefinedVal();
|
LatticeVal Overdefined = LatticeFunc->getOverdefinedVal();
|
||||||
|
|
||||||
// If this value is already overdefined (common) just return.
|
// If this value is already overdefined (common) just return.
|
||||||
|
@ -278,7 +278,7 @@ void SparseSolver<LatticeVal>::visitPHINode(PHINode &PN) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Merge in this value.
|
// Merge in this value.
|
||||||
LatticeVal OpVal = getOrInitValueState(PN.getIncomingValue(i));
|
LatticeVal OpVal = getValueState(PN.getIncomingValue(i));
|
||||||
if (OpVal != PNIV)
|
if (OpVal != PNIV)
|
||||||
PNIV = LatticeFunc->MergeValues(PNIV, OpVal);
|
PNIV = LatticeFunc->MergeValues(PNIV, OpVal);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue