Skip to content

Commit 5279c20

Browse files
committed
Sink MRI def
1 parent fe8a37e commit 5279c20

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,15 @@ bool SIInstrInfo::resultDependsOnExec(const MachineInstr &MI) const {
151151
// Ignore comparisons which are only used masked with exec.
152152
// This allows some hoisting/sinking of VALU comparisons.
153153
if (MI.isCompare()) {
154-
const MachineRegisterInfo &MRI = MI.getParent()->getParent()->getRegInfo();
155154
const MachineOperand *Dst = getNamedOperand(MI, AMDGPU::OpName::sdst);
156155
if (!Dst)
157156
return true;
158157

159158
Register DstReg = Dst->getReg();
160159
if (!DstReg.isVirtual())
161160
return true;
161+
162+
const MachineRegisterInfo &MRI = MI.getParent()->getParent()->getRegInfo();
162163
for (MachineInstr &Use : MRI.use_nodbg_instructions(DstReg)) {
163164
switch (Use.getOpcode()) {
164165
case AMDGPU::S_AND_SAVEEXEC_B32:

0 commit comments

Comments
 (0)