radeon/llvm: fix live-in handling for inputs
authorVadim Girlin <vadimgirlin@gmail.com>
Mon, 7 May 2012 13:38:01 +0000 (17:38 +0400)
committerVadim Girlin <vadimgirlin@gmail.com>
Mon, 7 May 2012 21:18:22 +0000 (01:18 +0400)
Set the input registers as live-in for entry basic block.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
src/gallium/drivers/radeon/AMDGPUUtil.cpp
src/gallium/drivers/radeon/R600LowerShaderInstructions.cpp

index 6fb01b687f3c16873d2e0873420e4f6fbc9d753c..663a77f264530ba97a83a70d8030858d32bcce41 100644 (file)
@@ -118,6 +118,7 @@ void AMDGPU::utilAddLiveIn(MachineFunction * MF, MachineRegisterInfo & MRI,
 {
     if (!MRI.isLiveIn(physReg)) {
       MRI.addLiveIn(physReg, virtReg);
+      MF->front().addLiveIn(physReg);
       BuildMI(MF->front(), MF->front().begin(), DebugLoc(),
                            TII->get(TargetOpcode::COPY), virtReg)
             .addReg(physReg);
index 394ee7006ce6b22562c7ab40bcb2476e3d53e556..742b50fb3940e881d133ea670a5bb05af42c9b50 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "AMDGPU.h"
 #include "AMDGPULowerShaderInstructions.h"
+#include "AMDGPUUtil.h"
 #include "AMDIL.h"
 #include "AMDILInstrInfo.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
@@ -117,8 +118,7 @@ void R600LowerShaderInstructionsPass::lowerLOAD_INPUT(MachineInstr &MI)
   unsigned newRegister = inputClass->getRegister(inputIndex);
   unsigned dstReg = dst.getReg();
 
-  preloadRegister(MI.getParent()->getParent(), TM.getInstrInfo(), newRegister,
-                  dstReg);
+  AMDGPU::utilAddLiveIn(MI.getParent()->getParent(), *MRI, TM.getInstrInfo(), newRegister, dstReg);
 }
 
 bool R600LowerShaderInstructionsPass::lowerSTORE_OUTPUT(MachineInstr &MI,