Skip to content

Commit f7945c5

Browse files
committed
Code refactoring and test fixup.
1 parent 8efa509 commit f7945c5

File tree

3 files changed

+179
-110
lines changed

3 files changed

+179
-110
lines changed

llvm/include/llvm/CodeGen/MachineBasicBlock.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -846,9 +846,8 @@ class MachineBasicBlock
846846

847847
/// Return the first instruction in MBB after I that is not a PHI, label or
848848
/// debug. This is the correct point to insert copies at the beginning of a
849-
/// basic block. \p Reg is an optional argument passed during register
850-
/// allocator to have additional target specific checks for its spill/copy
851-
/// insertion.
849+
/// basic block. \p Reg is the register being defined for a spill/split during
850+
/// register allocation.
852851
iterator SkipPHIsLabelsAndDebug(iterator I, Register Reg = Register(),
853852
bool SkipPseudoOp = true);
854853

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8482,12 +8482,13 @@ bool SIInstrInfo::isBasicBlockPrologue(const MachineInstr &MI,
84828482
// needed by the prolog. However, the insertions for scalar registers can
84838483
// always be placed at the BB top as they are independent of the exec mask
84848484
// value.
8485-
uint16_t Opc = MI.getOpcode();
8486-
const MachineFunction *MF = MI.getParent()->getParent();
8487-
const MachineRegisterInfo &MRI = MF->getRegInfo();
8488-
bool IsNullOrVectorRegister =
8489-
!Reg || !RI.isSGPRClass(RI.getRegClassForReg(MRI, Reg));
8485+
bool IsNullOrVectorRegister = true;
8486+
if (Reg) {
8487+
const MachineRegisterInfo &MRI = MI.getParent()->getParent()->getRegInfo();
8488+
IsNullOrVectorRegister = !RI.isSGPRClass(RI.getRegClassForReg(MRI, Reg));
8489+
}
84908490

8491+
uint16_t Opc = MI.getOpcode();
84918492
// FIXME: Copies inserted in the block prolog for live-range split should also
84928493
// be included.
84938494
return IsNullOrVectorRegister &&

0 commit comments

Comments
 (0)