Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions llvm/lib/CodeGen/MachineCSE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,10 @@ static bool isCallerPreservedOrConstPhysReg(MCRegister Reg,
(MRI.reservedRegsFrozen() && MRI.isConstantPhysReg(Reg));
}

/// hasLivePhysRegDefUses - Return true if the specified instruction read/write
/// physical registers (except for dead defs of physical registers). It also
/// returns the physical register def by reference if it's the only one and the
/// instruction does not uses a physical register.
/// hasLivePhysRegDefUses - Return true if the specified instruction
/// reads/writes physical registers (except for dead defs of physical
/// registers). It also returns the physical register def by reference if it's
/// the only one and the instruction does not use a physical register.
bool MachineCSEImpl::hasLivePhysRegDefUses(const MachineInstr *MI,
const MachineBasicBlock *MBB,
SmallSet<MCRegister, 8> &PhysRefs,
Expand Down
3 changes: 3 additions & 0 deletions llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ static bool resultDependsOnExec(const MachineInstr &MI) {
// Ignore comparisons which are only used masked with exec.
// This allows some hoisting/sinking of VALU comparisons.
if (MI.isCompare()) {
if (SIInstrInfo::isVOPC(MI))
return false;

const MachineRegisterInfo &MRI = MI.getParent()->getParent()->getRegInfo();
Register DstReg = MI.getOperand(0).getReg();
if (!DstReg.isVirtual())
Expand Down
23 changes: 23 additions & 0 deletions llvm/test/CodeGen/AMDGPU/si-instr-info-vopc-no-exec.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
# RUN: llc -mtriple=amdgcn -mcpu=gfx1010 -run-pass=machine-cse %s -o - | FileCheck %s

---
name: vopc_comparisons_do_not_depend_on_exec
tracksRegLiveness: true
body: |
bb.0:
; CHECK-LABEL: name: vopc_comparisons_do_not_depend_on_exec
; CHECK: [[DEF:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF
; CHECK-NEXT: V_CMP_EQ_U32_e32 1, killed undef [[DEF]], implicit-def $vcc_lo, implicit $exec
; CHECK-NEXT: [[V_CNDMASK_B32_e32_:%[0-9]+]]:vgpr_32 = V_CNDMASK_B32_e32 16256, undef [[DEF]], implicit $vcc_lo, implicit $exec
; CHECK-NEXT: [[V_LSHLREV_B32_e64_:%[0-9]+]]:vgpr_32 = V_LSHLREV_B32_e64 16, undef [[V_CNDMASK_B32_e32_]], implicit $exec
; CHECK-NEXT: SI_RETURN
%0:vgpr_32 = IMPLICIT_DEF
V_CMP_EQ_U32_e32 1, killed undef %0, implicit-def $vcc, implicit $exec
%1:vgpr_32 = V_CNDMASK_B32_e32 16256, undef %0, implicit $vcc, implicit $exec
V_CMP_EQ_U32_e32 1, killed undef %0, implicit-def $vcc, implicit $exec
%2:vgpr_32 = V_CNDMASK_B32_e32 16256, undef %0, implicit $vcc, implicit $exec
%3:vgpr_32 = V_LSHLREV_B32_e64 16, killed undef %2, implicit $exec
%4:vgpr_32 = V_LSHLREV_B32_e64 16, killed undef %1, implicit $exec
SI_RETURN
...