Subzero: Fix a couple of debugging tools. 1. Regalloc dump output was displaying status updates for the wrong variable in some cases. 2. getPhysicalRegister() creates a variable for referring to a specific physical register for low-level purposes, such as the stack pointer, or the frame pointer, or a pushed/popped callee-save register. We change its behavior so that all such physical registers do not have their liveness tracked/validated, not just the stack pointer. For #2, the original behavior was causing a liveness validation failure if a function had a single basic block and used callee-save registers, and the -asm-verbose flag was used. This is because -asm-verbose runs a final liveness pass after the prolog/epilog are generated, and the initial callee-save register pushes would make it look like single-basic-block variables are live coming into a basic block, which is a hallmark of a liveness problem. BUG= none R=jpp@chromium.org Review URL: https://codereview.chromium.org/1353923004 .
diff --git a/src/IceTargetLoweringARM32.cpp b/src/IceTargetLoweringARM32.cpp index 0fe62e4..682048a 100644 --- a/src/IceTargetLoweringARM32.cpp +++ b/src/IceTargetLoweringARM32.cpp
@@ -389,12 +389,12 @@ Reg = Func->makeVariable(Ty); Reg->setRegNum(RegNum); PhysicalRegisters[Ty][RegNum] = Reg; - // Specially mark SP and LR as an "argument" so that it is considered live - // upon function entry. - if (RegNum == RegARM32::Reg_sp || RegNum == RegARM32::Reg_lr) { - Func->addImplicitArg(Reg); - Reg->setIgnoreLiveness(); - } + // Specially mark a named physical register as an "argument" so that it is + // considered live upon function entry. Otherwise it's possible to get + // liveness validation errors for saving callee-save registers. + Func->addImplicitArg(Reg); + // Don't bother tracking the live range of a named physical register. + Reg->setIgnoreLiveness(); } return Reg; }