AMDGPU: Move copy handling under switch like other instructions
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 21 Sep 2015 16:27:22 +0000 (16:27 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 21 Sep 2015 16:27:22 +0000 (16:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248172 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AMDGPU/SIFixSGPRCopies.cpp

index 1cf520d360e49534ce203ea7db45dcbdf27469d3..55899b729c33ab58222320a8e4ee2a750e656504 100644 (file)
@@ -214,13 +214,18 @@ bool SIFixSGPRCopies::runOnMachineFunction(MachineFunction &MF) {
     for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end();
                                                       I != E; ++I) {
       MachineInstr &MI = *I;
-      if (MI.getOpcode() == AMDGPU::COPY && isVGPRToSGPRCopy(MI, TRI, MRI)) {
-        DEBUG(dbgs() << "Fixing VGPR -> SGPR copy: " << MI);
-        TII->moveToVALU(MI);
-      }
 
       switch (MI.getOpcode()) {
-      default: continue;
+      default:
+        continue;
+      case AMDGPU::COPY: {
+        if (isVGPRToSGPRCopy(MI, TRI, MRI)) {
+          DEBUG(dbgs() << "Fixing VGPR -> SGPR copy: " << MI);
+          TII->moveToVALU(MI);
+        }
+
+        break;
+      }
       case AMDGPU::PHI: {
         DEBUG(dbgs() << "Fixing PHI: " << MI);