Skip to content

Commit ba6c8d4

Browse files
committed
[AMDGPU] Combine DPP mov even if old reg def is in different BB
Given a DPP mov like this: %2:vgpr_32 = V_MOV_B32_e32 0, implicit $exec ... %3:vgpr_32 = V_MOV_B32_dpp %2, %1, 1, 1, 1, 0, implicit $exec this patch just removes a check that %2 (the "old reg") was defined in the same BB as the DPP mov instruction. GCNDPPCombine requires that the MIR is in SSA form so I don't understand why the BB matters. This lets the optimization work in more real world cases when the definition of %2 gets hoisted out of a loop. Differential Revision: https://reviews.llvm.org/D124182
1 parent 6f095ba commit ba6c8d4

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

llvm/lib/Target/AMDGPU/GCNDPPCombine.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -452,12 +452,6 @@ bool GCNDPPCombine::combineDPPMov(MachineInstr &MovMI) const {
452452
return false;
453453
}
454454

455-
if (OldOpndValue->getParent()->getParent() != MovMI.getParent()) {
456-
LLVM_DEBUG(dbgs() <<
457-
" failed: old reg def and mov should be in the same BB\n");
458-
return false;
459-
}
460-
461455
if (OldOpndValue->getImm() == 0) {
462456
if (MaskAllLanes) {
463457
assert(!BoundCtrlZero); // by check [1]

llvm/test/CodeGen/AMDGPU/dpp_combine.mir

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,8 @@ body: |
434434
SI_END_CF %8, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
435435
...
436436

437-
# old reg def is in diff BB - cannot combine
438437
# GCN-LABEL: name: old_in_diff_bb
439-
# GCN: %3:vgpr_32 = V_MOV_B32_dpp %2, %1, 1, 1, 1, 0, implicit $exec
438+
# GCN: %4:vgpr_32 = V_ADD_U32_dpp %0, %1, %0, 1, 1, 1, 0, implicit $exec
440439

441440
name: old_in_diff_bb
442441
tracksRegLiveness: true

0 commit comments

Comments
 (0)