-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[AMDGPU] Fix undefined scc register in successor block of SI_KILL terminators #134718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b98e163
[AMDGPU] Fix undefined $scc in successor blocks of SI_KILL terminators
mssefat 2f04569
[AMDGPU] Fix undefined $scc in successor blocks of SI_KILL terminators
mssefat b058b0e
[AMDGPU] Fix undefined scc register in successor block of SI_KILL ter…
mssefat 2b8d661
Update llvm/lib/Target/AMDGPU/SIISelLowering.cpp
mssefat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 | ||
# RUN: llc -mtriple=amdgcn -run-pass finalize-isel -mtriple=amdgcn -mcpu=gfx1010 -verify-machineinstrs %s -o - | FileCheck %s | ||
--- | ||
name: phi_use_def_before_kill | ||
tracksRegLiveness: true | ||
body: | | ||
; CHECK-LABEL: name: phi_use_def_before_kill | ||
; CHECK: bb.0: | ||
; CHECK-NEXT: successors: %bb.3(0x80000000) | ||
; CHECK-NEXT: liveins: $sgpr0, $sgpr1 | ||
; CHECK-NEXT: {{ $}} | ||
; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr_32 = COPY $sgpr1 | ||
; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr_32 = COPY $sgpr0 | ||
; CHECK-NEXT: [[S_MOV_B32_:%[0-9]+]]:sgpr_32 = S_MOV_B32 1065353216 | ||
; CHECK-NEXT: [[V_ADD_F32_e64_:%[0-9]+]]:vgpr_32 = nofpexcept V_ADD_F32_e64 0, [[COPY1]], 0, killed [[S_MOV_B32_]], 0, 0, implicit $mode, implicit $exec | ||
; CHECK-NEXT: [[S_MOV_B32_1:%[0-9]+]]:sgpr_32 = S_MOV_B32 0 | ||
; CHECK-NEXT: [[V_CMP_GT_F32_e64_:%[0-9]+]]:sreg_32_xm0_xexec = nofpexcept V_CMP_GT_F32_e64 0, [[V_ADD_F32_e64_]], 0, [[S_MOV_B32_1]], 0, implicit $mode, implicit $exec | ||
; CHECK-NEXT: [[S_MOV_B32_2:%[0-9]+]]:sgpr_32 = S_MOV_B32 -1082130432 | ||
; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY killed [[S_MOV_B32_2]] | ||
; CHECK-NEXT: [[V_CNDMASK_B32_e64_:%[0-9]+]]:vgpr_32 = V_CNDMASK_B32_e64 0, [[S_MOV_B32_1]], 0, [[COPY2]], killed [[V_CMP_GT_F32_e64_]], implicit $exec | ||
; CHECK-NEXT: [[COPY3:%[0-9]+]]:sgpr_32 = COPY [[V_CNDMASK_B32_e64_]] | ||
; CHECK-NEXT: [[S_MOV_B32_3:%[0-9]+]]:sreg_32 = S_MOV_B32 0 | ||
; CHECK-NEXT: S_CMP_LG_U32 [[COPY]], killed [[S_MOV_B32_3]], implicit-def $scc | ||
; CHECK-NEXT: SI_KILL_F32_COND_IMM_TERMINATOR [[V_ADD_F32_e64_]], 0, 2, implicit-def $vcc_lo, implicit $exec | ||
; CHECK-NEXT: {{ $}} | ||
; CHECK-NEXT: bb.3: | ||
; CHECK-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000) | ||
; CHECK-NEXT: liveins: $vcc_lo, $scc | ||
; CHECK-NEXT: {{ $}} | ||
; CHECK-NEXT: S_CBRANCH_SCC1 %bb.1, implicit $scc | ||
; CHECK-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc_lo | ||
; CHECK-NEXT: S_BRANCH %bb.2 | ||
; CHECK-NEXT: {{ $}} | ||
; CHECK-NEXT: bb.1: | ||
; CHECK-NEXT: [[S_MOV_B32_4:%[0-9]+]]:sgpr_32 = S_MOV_B32 0 | ||
; CHECK-NEXT: [[V_CMP_EQ_F32_e64_:%[0-9]+]]:sreg_32 = nofpexcept V_CMP_EQ_F32_e64 0, [[COPY]], 0, killed [[S_MOV_B32_4]], 0, implicit $mode, implicit $exec | ||
; CHECK-NEXT: S_ENDPGM 0 | ||
; CHECK-NEXT: {{ $}} | ||
; CHECK-NEXT: bb.2: | ||
; CHECK-NEXT: [[S_MOV_B32_5:%[0-9]+]]:sgpr_32 = S_MOV_B32 0 | ||
; CHECK-NEXT: [[V_CMP_EQ_F32_e64_1:%[0-9]+]]:sreg_32 = nofpexcept V_CMP_EQ_F32_e64 0, [[COPY]], 0, killed [[S_MOV_B32_5]], 0, implicit $mode, implicit $exec | ||
; CHECK-NEXT: S_ENDPGM 0 | ||
|
||
bb.0: | ||
liveins: $sgpr0, $sgpr1 | ||
%3:sgpr_32 = COPY $sgpr1 | ||
%2:sgpr_32 = COPY $sgpr0 | ||
%5:sgpr_32 = S_MOV_B32 1065353216 | ||
%6:vgpr_32 = nofpexcept V_ADD_F32_e64 0, %2:sgpr_32, 0, killed %5:sgpr_32, 0, 0, implicit $mode, implicit $exec | ||
%7:sgpr_32 = S_MOV_B32 0 | ||
%8:sreg_32_xm0_xexec = nofpexcept V_CMP_GT_F32_e64 0, %6:vgpr_32, 0, %7:sgpr_32, 0, implicit $mode, implicit $exec | ||
%9:sgpr_32 = S_MOV_B32 -1082130432 | ||
%11:vgpr_32 = COPY killed %9:sgpr_32 | ||
%10:vgpr_32 = V_CNDMASK_B32_e64 0, %7:sgpr_32, 0, %11:vgpr_32, killed %8:sreg_32_xm0_xexec, implicit $exec | ||
%0:sgpr_32 = COPY %10:vgpr_32 | ||
%12:sreg_32 = S_MOV_B32 0 | ||
S_CMP_LG_U32 %3:sgpr_32, killed %12:sreg_32, implicit-def $scc | ||
SI_KILL_F32_COND_IMM_PSEUDO %6:vgpr_32, 0, 2, implicit-def $vcc, implicit $exec | ||
S_CBRANCH_SCC1 %bb.1, implicit $scc | ||
S_CBRANCH_VCCNZ %bb.2, implicit $vcc | ||
S_BRANCH %bb.2 | ||
|
||
bb.1: | ||
%13:sgpr_32 = S_MOV_B32 0 | ||
%14:sreg_32 = nofpexcept V_CMP_EQ_F32_e64 0, %3:sgpr_32, 0, killed %13:sgpr_32, 0, implicit $mode, implicit $exec | ||
S_ENDPGM 0 | ||
|
||
bb.2: | ||
%15:sgpr_32 = S_MOV_B32 0 | ||
%16:sreg_32 = nofpexcept V_CMP_EQ_F32_e64 0, %3:sgpr_32, 0, killed %15:sgpr_32, 0, implicit $mode, implicit $exec | ||
S_ENDPGM 0 | ||
|
||
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you really need this reordering? I'd expect this to be called after the custom insertions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need this reordering. Without this reordering, llvm::addLiveIns() invoked from MachineBasicBlock::splitAt() triggers an assertion failure due to the check for reservedRegsFrozen() when reserved registers are not yet finalized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This API is bad. We probably should split these into separate steps, but given no tests apparently rely on this order I guess this is fine for now