| Index: src/IceLiveness.cpp
|
| diff --git a/src/IceLiveness.cpp b/src/IceLiveness.cpp
|
| index a1de893644c2814059079e3f856a04c6426b8389..35e12b7b20e26de689a1be5929ce3619a4a8b9b0 100644
|
| --- a/src/IceLiveness.cpp
|
| +++ b/src/IceLiveness.cpp
|
| @@ -71,8 +71,12 @@ void Liveness::initInternal(NodeList::const_iterator FirstNode,
|
| if (IsFullInit)
|
| LiveToVarMap.assign(NumGlobals, nullptr);
|
|
|
| - // Sort each variable into the appropriate LiveToVarMap. Also set
|
| - // VarToLiveMap.
|
| + // Initialize the bitmask of which variables to track.
|
| + RangeMask.resize(NumVars);
|
| + RangeMask.set(0, NumVars); // Track all variables by default.
|
| +
|
| + // Sort each variable into the appropriate LiveToVarMap. Set VarToLiveMap.
|
| + // Set RangeMask correctly for each variable.
|
| TmpNumGlobals = 0;
|
| for (auto I = FirstVar, E = Func->getVariables().end(); I != E; ++I) {
|
| Variable *Var = *I;
|
| @@ -88,9 +92,20 @@ void Liveness::initInternal(NodeList::const_iterator FirstNode,
|
| LiveIndex += NumGlobals;
|
| }
|
| VarToLiveMap[VarIndex] = LiveIndex;
|
| + if (Var->getIgnoreLiveness())
|
| + RangeMask[VarIndex] = false;
|
| }
|
| assert(TmpNumGlobals == (IsFullInit ? NumGlobals : 0));
|
|
|
| + // Fix up RangeMask for variables before FirstVar.
|
| + for (auto I = Func->getVariables().begin(); I != FirstVar; ++I) {
|
| + Variable *Var = *I;
|
| + SizeT VarIndex = Var->getIndex();
|
| + if (Var->getIgnoreLiveness() ||
|
| + (!IsFullInit && !Var->hasReg() && !Var->getWeight().isInf()))
|
| + RangeMask[VarIndex] = false;
|
| + }
|
| +
|
| // Process each node.
|
| for (auto I = FirstNode, E = Func->getNodes().end(); I != E; ++I) {
|
| LivenessNode &Node = Nodes[(*I)->getIndex()];
|
| @@ -100,17 +115,6 @@ void Liveness::initInternal(NodeList::const_iterator FirstNode,
|
| // LiveBegin and LiveEnd are reinitialized before each pass over
|
| // the block.
|
| }
|
| -
|
| - // Initialize the bitmask of which variables to track.
|
| - RangeMask.resize(NumVars);
|
| - RangeMask.set(0, NumVars);
|
| - if (!IsFullInit) {
|
| - // Reset initial variables that are not pre-colored or infinite-weight.
|
| - for (auto I = Func->getVariables().begin(); I != FirstVar; ++I) {
|
| - Variable *Var = *I;
|
| - RangeMask[Var->getIndex()] = (Var->hasReg() || Var->getWeight().isInf());
|
| - }
|
| - }
|
| }
|
|
|
| void Liveness::init() {
|
|
|