[PATCH] D111126: [AMDGPU] Only remove branches in SIInstrInfo::removeBranch
Carl Ritson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 5 02:15:29 PDT 2021
critson updated this revision to Diff 377122.
critson added a comment.
Rebase on top of pre-committed test.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111126/new/
https://reviews.llvm.org/D111126
Files:
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
llvm/test/CodeGen/AMDGPU/artificial-terminators.mir
Index: llvm/test/CodeGen/AMDGPU/artificial-terminators.mir
===================================================================
--- llvm/test/CodeGen/AMDGPU/artificial-terminators.mir
+++ llvm/test/CodeGen/AMDGPU/artificial-terminators.mir
@@ -38,6 +38,7 @@
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[V_CMP_LT_I32_e64_:%[0-9]+]]:sreg_32 = V_CMP_LT_I32_e64 [[V_ADD_U32_e64_3]], [[S_MOV_B32_1]], implicit $exec
; CHECK-NEXT: [[S_XOR_B32_:%[0-9]+]]:sreg_32 = S_XOR_B32 $exec_lo, [[V_CMP_LT_I32_e64_]], implicit-def $scc
+ ; CHECK-NEXT: $exec_lo = S_MOV_B32_term [[S_XOR_B32_]]
; CHECK-NEXT: S_CBRANCH_EXECNZ %bb.2, implicit $exec
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: bb.5:
Index: llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -2460,9 +2460,12 @@
unsigned RemovedSize = 0;
while (I != MBB.end()) {
MachineBasicBlock::iterator Next = std::next(I);
- RemovedSize += getInstSizeInBytes(*I);
- I->eraseFromParent();
- ++Count;
+ // Skip over artificial terminators when removing instructions.
+ if (I->isBranch() || I->isReturn()) {
+ RemovedSize += getInstSizeInBytes(*I);
+ I->eraseFromParent();
+ ++Count;
+ }
I = Next;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111126.377122.patch
Type: text/x-patch
Size: 1341 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211005/6dcbddce/attachment.bin>
More information about the llvm-commits
mailing list