Only ignore <undef> use operands, keep the <def,undef> ops.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Mon, 2 May 2011 20:06:28 +0000 (20:06 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Mon, 2 May 2011 20:06:28 +0000 (20:06 +0000)
Def operands may also have an <undef> flag, but that just means that a
sub-register redef doesn't actually read the super-register. For physical
registers, it has no meaning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130714 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/RegisterScavenging.cpp

index ebfe533838d5d2c71460bac340807b3f9a596855..e2c25aba02e09d5dec372affe256aae6e6b3c14d 100644 (file)
@@ -154,13 +154,16 @@ void RegScavenger::forward() {
   BitVector DeadRegs(NumPhysRegs);
   for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
     const MachineOperand &MO = MI->getOperand(i);
-    if (!MO.isReg() || MO.isUndef())
+    if (!MO.isReg())
       continue;
     unsigned Reg = MO.getReg();
     if (!Reg || isReserved(Reg))
       continue;
 
     if (MO.isUse()) {
+      // Ignore undef uses.
+      if (MO.isUndef())
+        continue;
       // Two-address operands implicitly kill.
       if (!isPred && (MO.isKill() || MI->isRegTiedToDefOperand(i)))
         addRegWithSubRegs(KillRegs, Reg);