nv50/ir/ra: don't coalesce contraint-moves
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sat, 7 Jan 2012 20:00:51 +0000 (21:00 +0100)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Mon, 9 Jan 2012 23:39:12 +0000 (00:39 +0100)
This could lead to incorrect code when fixed regs are involved.

Surprisingly, the increased freedom actually leads to lower
register usage in some cases. Still want to find a better way
to treat constraints though ...

src/gallium/drivers/nv50/codegen/nv50_ir_ra.cpp

index ff6d9666a1903d619a72b43f26c7d3618d02fc30..f08026cf844a29550ae5d350113f9d3b694bd5f2 100644 (file)
@@ -513,6 +513,10 @@ RegAlloc::coalesceValues(unsigned int mask)
       case OP_MOV:
          if (!(mask & JOIN_MASK_MOV))
             break;
+         i = insn->getDef(0)->uses ? insn->getDef(0)->uses->getInsn() : NULL;
+         // if this is a contraint-move there will only be a single use
+         if (i && i->op == OP_CONSTRAINT)
+            break;
          i = insn->getSrc(0)->getUniqueInsn();
          if (i && !i->constrainedDefs())
             insn->getDef(0)->coalesce(insn->getSrc(0), false);