Skip to content

Commit 3e6084e

Browse files
committed
[AMDGPU][SIPreEmitPeephole] Fix mustRetainExeczBranch
1 parent e4b173f commit 3e6084e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

llvm/lib/Target/AMDGPU/SIPreEmitPeephole.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,10 @@ bool SIPreEmitPeephole::mustRetainExeczBranch(
362362
if (MI.isConditionalBranch())
363363
return true;
364364

365+
if (MI.isUnconditionalBranch() &&
366+
TII->getBranchDestBlock(MI) != MBB.getNextNode())
367+
return true;
368+
365369
if (MI.isMetaInstruction())
366370
continue;
367371

llvm/test/CodeGen/AMDGPU/remove-not-short-exec-branch-on-unconditional-jump.mir

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ body: |
2424
; CHECK-NEXT: S_BRANCH %bb.2
2525
; CHECK-NEXT: {{ $}}
2626
; CHECK-NEXT: bb.2:
27-
; CHECK-NEXT: successors: %bb.3(0x40000000)
27+
; CHECK-NEXT: successors: %bb.4(0x40000000), %bb.3(0x40000000)
2828
; CHECK-NEXT: liveins: $vgpr1, $sgpr0_sgpr1, $sgpr2_sgpr3, $sgpr4_sgpr5
2929
; CHECK-NEXT: {{ $}}
3030
; CHECK-NEXT: $exec = S_OR_B64 $exec, killed renamable $sgpr4_sgpr5, implicit-def $scc
31+
; CHECK-NEXT: S_CBRANCH_EXECZ %bb.4, implicit $exec
3132
; CHECK-NEXT: {{ $}}
3233
; CHECK-NEXT: bb.3:
3334
; CHECK-NEXT: successors: %bb.1(0x80000000)

0 commit comments

Comments
 (0)