// Is the first "VariableLiveRange" or the previous one has been closed so its "m_EndEmitLocation" is valid
noway_assert(m_VariableLiveRanges->empty() || m_VariableLiveRanges->back().m_EndEmitLocation.Valid());
- if (!m_VariableLiveRanges->empty() && m_VariableLiveRanges->back().m_EndEmitLocation.IsPreviousIns(emit) &&
+ if (!m_VariableLiveRanges->empty() && m_VariableLiveRanges->back().m_EndEmitLocation.IsPreviousInsNum(emit) &&
siVarLoc::Equals(&varLocation, &(m_VariableLiveRanges->back().m_VarLocation)))
{
- // The variable is being born at the exactly same place just one assembly instructtion.
- // We assume it never died.
+ // The variable is being born just after the instruction at which it died.
+ // In this case, i.e. an update of the variable's value, we coalesce the live ranges.
m_VariableLiveRanges->back().m_EndEmitLocation.Init();
}
else
}
//------------------------------------------------------------------------
-// IsPreviousIns: Returns true if the emitter is on the next instruction
-// of the same group than this emitLocation.
+// IsPreviousInsNum: Returns true if the emitter is on the next instruction
+// of the same group as this emitLocation.
//
// Arguments:
// emit - an emitter* instance
//
-bool emitLocation::IsPreviousIns(const emitter* emit) const
+bool emitLocation::IsPreviousInsNum(const emitter* emit) const
{
assert(Valid());
- bool sameGroup = ig == emit->emitCurIG;
- bool sameInsNum = emitGetInsNumFromCodePos(codePos) == emitGetInsNumFromCodePos(emit->emitCurOffset()) - 1;
- return sameGroup && sameInsNum;
+ bool isSameGroup = (ig == emit->emitCurIG);
+ bool isSameInsNum = (emitGetInsNumFromCodePos(codePos) == emitGetInsNumFromCodePos(emit->emitCurOffset()) - 1);
+ return isSameGroup && isSameInsNum;
}
#ifdef DEBUG
UNATIVE_OFFSET GetFuncletPrologOffset(emitter* emit) const;
- bool emitLocation::IsPreviousIns(const emitter* emit) const;
+ bool emitLocation::IsPreviousInsNum(const emitter* emit) const;
#ifdef DEBUG
void Print() const;