[llvm] r306352 - ScheduleDAGInstrs: Fix fixupKills() adding too many kill flags.
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 26 17:58:48 PDT 2017
Author: matze
Date: Mon Jun 26 17:58:48 2017
New Revision: 306352
URL: http://llvm.org/viewvc/llvm-project?rev=306352&view=rev
Log:
ScheduleDAGInstrs: Fix fixupKills() adding too many kill flags.
Remove invalid shortcut in fixupKills(): A register needs to be marked
live even when we are not adding a kill flag. This is because a
partially live register must not get a kill flags, but it still needs to
be fully marked live when walking backwards.
Added:
llvm/trunk/test/CodeGen/AMDGPU/misched-killflags.mir
Modified:
llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp
Modified: llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp?rev=306352&r1=306351&r2=306352&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp (original)
+++ llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp Mon Jun 26 17:58:48 2017
@@ -1089,7 +1089,7 @@ static void toggleKills(const MachineReg
// Things that are available after the instruction are killed by it.
bool IsKill = LiveRegs.available(MRI, Reg);
MO.setIsKill(IsKill);
- if (IsKill && addToLiveRegs)
+ if (addToLiveRegs)
LiveRegs.addReg(Reg);
}
}
Added: llvm/trunk/test/CodeGen/AMDGPU/misched-killflags.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/misched-killflags.mir?rev=306352&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/misched-killflags.mir (added)
+++ llvm/trunk/test/CodeGen/AMDGPU/misched-killflags.mir Mon Jun 26 17:58:48 2017
@@ -0,0 +1,45 @@
+# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=fiji -verify-machineinstrs -run-pass=post-RA-sched -o - %s | FileCheck %s
+# Make sure ScheduleDAGInstrs::fixupKills does not produce invalid kill flags.
+---
+name: func0
+tracksRegLiveness: true
+body: |
+ bb.0:
+ liveins: %sgpr7, %sgpr0_sgpr1_sgpr2_sgpr3
+
+ %sgpr33 = S_MOV_B32 %sgpr7
+ %sgpr32 = S_MOV_B32 %sgpr33
+ %sgpr10 = S_MOV_B32 5
+ %sgpr9 = S_MOV_B32 4
+ %sgpr8 = S_MOV_B32 3
+ BUNDLE implicit-def %sgpr6_sgpr7, implicit-def %sgpr6, implicit-def %sgpr7, implicit-def %scc {
+ %sgpr6_sgpr7 = S_GETPC_B64
+ %sgpr6 = S_ADD_U32 internal %sgpr6, 0, implicit-def %scc
+ %sgpr7 = S_ADDC_U32 internal %sgpr7,0, implicit-def %scc, implicit internal %scc
+ }
+ %sgpr4 = S_MOV_B32 %sgpr33
+ %vgpr0 = V_MOV_B32_e32 %sgpr8, implicit %exec, implicit-def %vgpr0_vgpr1_vgpr2_vgpr3, implicit %sgpr8_sgpr9_sgpr10_sgpr11
+ %vgpr1 = V_MOV_B32_e32 %sgpr9, implicit %exec, implicit %sgpr8_sgpr9_sgpr10_sgpr11
+ %vgpr2 = V_MOV_B32_e32 %sgpr10, implicit %exec, implicit %sgpr8_sgpr9_sgpr10_sgpr11
+ %vgpr3 = V_MOV_B32_e32 %sgpr11, implicit %exec, implicit %sgpr8_sgpr9_sgpr10_sgpr11, implicit %exec
+ S_NOP 0, implicit killed %sgpr6_sgpr7, implicit %sgpr0_sgpr1_sgpr2_sgpr3, implicit %sgpr4, implicit killed %vgpr0_vgpr1_vgpr2_vgpr3
+ S_ENDPGM
+...
+# CHECK-LABEL: name: func0
+# CHECK: %sgpr10 = S_MOV_B32 5
+# CHECK: %sgpr9 = S_MOV_B32 4
+# CHECK: %sgpr8 = S_MOV_B32 3
+# CHECK: %sgpr33 = S_MOV_B32 killed %sgpr7
+# CHECK: %vgpr0 = V_MOV_B32_e32 %sgpr8, implicit %exec, implicit-def %vgpr0_vgpr1_vgpr2_vgpr3, implicit %sgpr8_sgpr9_sgpr10_sgpr11
+# CHECK: BUNDLE implicit-def %sgpr6_sgpr7, implicit-def %sgpr6, implicit-def %sgpr7, implicit-def %scc {
+# CHECK: %sgpr6_sgpr7 = S_GETPC_B64
+# CHECK: %sgpr6 = S_ADD_U32 internal %sgpr6, 0, implicit-def %scc
+# CHECK: %sgpr7 = S_ADDC_U32 internal %sgpr7, 0, implicit-def %scc, implicit internal %scc
+# CHECK: }
+# CHECK: %sgpr4 = S_MOV_B32 %sgpr33
+# CHECK: %vgpr1 = V_MOV_B32_e32 %sgpr9, implicit %exec, implicit %sgpr8_sgpr9_sgpr10_sgpr11
+# CHECK: %vgpr2 = V_MOV_B32_e32 %sgpr10, implicit %exec, implicit %sgpr8_sgpr9_sgpr10_sgpr11
+# CHECK: %vgpr3 = V_MOV_B32_e32 killed %sgpr11, implicit %exec, implicit %sgpr8_sgpr9_sgpr10_sgpr11, implicit %exec
+# CHECK: %sgpr32 = S_MOV_B32 killed %sgpr33
+# CHECK: S_NOP 0, implicit killed %sgpr6_sgpr7, implicit %sgpr0_sgpr1_sgpr2_sgpr3, implicit %sgpr4, implicit killed %vgpr0_vgpr1_vgpr2_vgpr3
+# CHECK: S_ENDPGM
More information about the llvm-commits
mailing list