forked from OSchip/llvm-project
[LVI] Simplify mergeIn code
Remove the unused return type, use early return, use assignment operator. llvm-svn: 288873
This commit is contained in:
parent
c9073fa806
commit
b47a719ac0
|
@ -207,43 +207,39 @@ public:
|
|||
|
||||
/// Merge the specified lattice value into this one, updating this
|
||||
/// one and returning true if anything changed.
|
||||
bool mergeIn(const LVILatticeVal &RHS, const DataLayout &DL) {
|
||||
if (RHS.isUndefined() || isOverdefined()) return false;
|
||||
if (RHS.isOverdefined()) return markOverdefined();
|
||||
void mergeIn(const LVILatticeVal &RHS, const DataLayout &DL) {
|
||||
if (RHS.isUndefined() || isOverdefined())
|
||||
return;
|
||||
if (RHS.isOverdefined()) {
|
||||
markOverdefined();
|
||||
return;
|
||||
}
|
||||
|
||||
if (isUndefined()) {
|
||||
Tag = RHS.Tag;
|
||||
Val = RHS.Val;
|
||||
Range = RHS.Range;
|
||||
return true;
|
||||
*this = RHS;
|
||||
return;
|
||||
}
|
||||
|
||||
if (isConstant()) {
|
||||
if (RHS.isConstant()) {
|
||||
if (Val == RHS.Val)
|
||||
return false;
|
||||
return markOverdefined();
|
||||
}
|
||||
return markOverdefined();
|
||||
if (RHS.isConstant() && Val == RHS.Val)
|
||||
return;
|
||||
markOverdefined();
|
||||
return;
|
||||
}
|
||||
|
||||
if (isNotConstant()) {
|
||||
if (RHS.isNotConstant()) {
|
||||
if (Val == RHS.Val)
|
||||
return false;
|
||||
return markOverdefined();
|
||||
}
|
||||
return markOverdefined();
|
||||
if (RHS.isNotConstant() && Val == RHS.Val)
|
||||
return;
|
||||
markOverdefined();
|
||||
return;
|
||||
}
|
||||
|
||||
assert(isConstantRange() && "New LVILattice type?");
|
||||
if (!RHS.isConstantRange())
|
||||
return markOverdefined();
|
||||
|
||||
ConstantRange NewR = Range.unionWith(RHS.getConstantRange());
|
||||
if (NewR.isFullSet())
|
||||
return markOverdefined();
|
||||
return markConstantRange(NewR);
|
||||
markOverdefined();
|
||||
else
|
||||
markConstantRange(NewR);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue