r600g/llvm: Fix handling of MASK_WRITE instructions
authorTom Stellard <thomas.stellard@amd.com>
Mon, 30 Apr 2012 20:11:27 +0000 (16:11 -0400)
committerTom Stellard <thomas.stellard@amd.com>
Mon, 30 Apr 2012 20:43:34 +0000 (16:43 -0400)
We can't delete MASK_WRITE instructions from the program, because this
will cause instructions being masked by MASK_WRITE to be marked dead and
then deleted in the dce pass.

src/gallium/drivers/radeon/AMDGPUUtil.cpp
src/gallium/drivers/radeon/R600LowerInstructions.cpp

index a504543..6fb01b6 100644 (file)
@@ -34,6 +34,7 @@ bool llvm::isPlaceHolderOpcode(unsigned opcode)
   case AMDIL::RETURN:
   case AMDIL::LOAD_INPUT:
   case AMDIL::LAST:
+  case AMDIL::MASK_WRITE:
   case AMDIL::RESERVE_REG:
     return true;
   }
index fb5431d..8395d22 100644 (file)
@@ -311,7 +311,8 @@ bool R600LowerInstructionsPass::runOnMachineFunction(MachineFunction &MF)
         MachineInstr * defInstr = MRI->getVRegDef(maskedRegister);
         MachineOperand * def = defInstr->findRegisterDefOperand(maskedRegister);
         def->addTargetFlag(MO_FLAG_MASK);
-        break;
+        /* Continue so the instruction is not erased */
+        continue;
       }
 
       case AMDIL::NEGATE_i32: