Commit b3bfcbcb by Jim Stichnoth

Subzero: Expand the liveness consistency check.

Liveness analysis includes a consistency check on each node, to verify that variables referenced in only one block do not appear to be live coming into a block (and are therefore live across multiple blocks). This check was disabled in the entry block because there might be function arguments that are referenced only in the entry block but are still live coming in. It seems that this entry-block exclusion has been largely unnecessary for some time. This is because input arguments and other special variables are now pre-marked as multi-block. The exclusion masks problems in some single-block lit tests, so it's best if it can be removed. This CL removes the exclusion, and fixes some minor issues uncovered in the MIPS and ARM target lowering. A key issue is that when implementing a new target lowering and using --skip-unimplemented to make progress with existing tests, it may be necessary to add FakeDef instructions to avoid liveness inconsistency errors. Note that when this patch is applied to 448c16f0, it correctly identifies the liveness consistency error (as shown by a "make check-lit" failure) that was fixed in 59f2d925. BUG= none R=jpp@chromium.org Review URL: https://codereview.chromium.org/1265093002.
parent 453660ff
......@@ -614,10 +614,7 @@ bool CfgNode::liveness(Liveness *Liveness) {
// validation is not.)
LivenessBV LiveOrig = Live;
Live.resize(Liveness->getNumGlobalVars());
// Non-global arguments in the entry node are allowed to be live on
// entry.
bool IsEntry = (Func->getEntryNode() == this);
if (!(IsEntry || Live == LiveOrig)) {
if (Live != LiveOrig) {
if (BuildDefs::dump()) {
// This is a fatal liveness consistency error. Print some
// diagnostics and abort.
......
......@@ -1994,6 +1994,8 @@ void TargetARM32::lowerCast(const InstCast *Inst) {
}
case InstCast::Fptosi:
UnimplementedError(Func->getContext()->getFlags());
// Add a fake def to keep liveness consistent in the meantime.
Context.insert(InstFakeDef::create(Func, Dest));
break;
case InstCast::Fptoui:
UnimplementedError(Func->getContext()->getFlags());
......
......@@ -246,7 +246,7 @@ Variable *TargetMIPS32::getPhysicalRegister(SizeT RegNum, Type Ty) {
PhysicalRegisters[Ty][RegNum] = Reg;
// Specially mark SP as an "argument" so that it is considered
// live upon function entry.
if (RegNum == RegMIPS32::Reg_SP) {
if (RegNum == RegMIPS32::Reg_SP || RegNum == RegMIPS32::Reg_RA) {
Func->addImplicitArg(Reg);
Reg->setIgnoreLiveness();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment