Chromium Code Reviews| Index: src/IceLiveness.cpp |
| diff --git a/src/IceLiveness.cpp b/src/IceLiveness.cpp |
| index a1de893644c2814059079e3f856a04c6426b8389..18ef47841a063ae9f6ad8bbd4b5e0b3cffbce8e4 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,21 @@ void Liveness::initInternal(NodeList::const_iterator FirstNode, |
| LiveIndex += NumGlobals; |
| } |
| VarToLiveMap[VarIndex] = LiveIndex; |
| + if (Var->getIgnoreLiveness() || |
| + (!IsFullInit && !Var->hasReg() && !Var->getWeight().isInf())) |
|
jvoung (off chromium)
2015/08/06 21:39:14
I wasn't sure if the extra conditions here:
(!IsFu
Jim Stichnoth
2015/08/06 22:38:50
Yikes, thanks! This change basically reverted tha
|
| + 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 +116,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() { |