Skip to content

Commit 2de04c4

Browse files
authored
Merge branch 'main' into fix_macho_test
2 parents 9383d70 + e3a9ac5 commit 2de04c4

File tree

5 files changed

+9
-20
lines changed

5 files changed

+9
-20
lines changed

llvm/lib/Target/AMDGPU/SIFoldOperands.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,10 +1284,11 @@ void SIFoldOperandsImpl::foldOperand(
12841284
continue;
12851285

12861286
const int SrcIdx = MovOp == AMDGPU::V_MOV_B16_t16_e64 ? 2 : 1;
1287-
const TargetRegisterClass *MovSrcRC =
1288-
TRI->getRegClass(TII->getOpRegClassID(MovDesc.operands()[SrcIdx]));
12891287

1290-
if (MovSrcRC) {
1288+
int16_t RegClassID = TII->getOpRegClassID(MovDesc.operands()[SrcIdx]);
1289+
if (RegClassID != -1) {
1290+
const TargetRegisterClass *MovSrcRC = TRI->getRegClass(RegClassID);
1291+
12911292
if (UseSubReg)
12921293
MovSrcRC = TRI->getMatchingSuperRegClass(SrcRC, MovSrcRC, UseSubReg);
12931294

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6032,7 +6032,7 @@ const TargetRegisterClass *SIInstrInfo::getRegClass(const MCInstrDesc &TID,
60326032
return nullptr;
60336033
const MCOperandInfo &OpInfo = TID.operands()[OpNum];
60346034
int16_t RegClass = getOpRegClassID(OpInfo);
6035-
return RI.getRegClass(RegClass);
6035+
return RegClass < 0 ? nullptr : RI.getRegClass(RegClass);
60366036
}
60376037

60386038
const TargetRegisterClass *SIInstrInfo::getOpRegClass(const MachineInstr &MI,
@@ -6050,7 +6050,8 @@ const TargetRegisterClass *SIInstrInfo::getOpRegClass(const MachineInstr &MI,
60506050
return RI.getPhysRegBaseClass(Reg);
60516051
}
60526052

6053-
return RI.getRegClass(getOpRegClassID(Desc.operands()[OpNo]));
6053+
int16_t RegClass = getOpRegClassID(Desc.operands()[OpNo]);
6054+
return RegClass < 0 ? nullptr : RI.getRegClass(RegClass);
60546055
}
60556056

60566057
void SIInstrInfo::legalizeOpWithMove(MachineInstr &MI, unsigned OpIdx) const {

llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3908,17 +3908,6 @@ const TargetRegisterClass *SIRegisterInfo::getVGPR64Class() const {
39083908
: &AMDGPU::VReg_64RegClass;
39093909
}
39103910

3911-
// FIXME: This should be deleted
3912-
const TargetRegisterClass *
3913-
SIRegisterInfo::getRegClass(unsigned RCID) const {
3914-
switch ((int)RCID) {
3915-
case -1:
3916-
return nullptr;
3917-
default:
3918-
return AMDGPUGenRegisterInfo::getRegClass(RCID);
3919-
}
3920-
}
3921-
39223911
// Find reaching register definition
39233912
MachineInstr *SIRegisterInfo::findReachingDef(Register Reg, unsigned SubReg,
39243913
MachineInstr &Use,

llvm/lib/Target/AMDGPU/SIRegisterInfo.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,6 @@ class SIRegisterInfo final : public AMDGPUGenRegisterInfo {
391391

392392
MCRegister getExec() const;
393393

394-
const TargetRegisterClass *getRegClass(unsigned RCID) const;
395-
396394
// Find reaching register definition
397395
MachineInstr *findReachingDef(Register Reg, unsigned SubReg,
398396
MachineInstr &Use,

llvm/test/CodeGen/AMDGPU/limit-coalesce.mir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ body: |
1717
; CHECK-NEXT: undef [[COPY:%[0-9]+]].sub1:sgpr_64 = COPY $sgpr17
1818
; CHECK-NEXT: [[COPY:%[0-9]+]].sub0:sgpr_64 = COPY $sgpr16
1919
; CHECK-NEXT: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
20-
; CHECK-NEXT: INLINEASM &"; def $0", 0 /* attdialect */, 3407882 /* regdef:VReg_64 */, def %4
20+
; CHECK-NEXT: INLINEASM &"; def $0", 0 /* attdialect */, 2818058 /* regdef:VReg_64 */, def %4
2121
; CHECK-NEXT: undef [[COPY1:%[0-9]+]].sub0:vreg_128 = COPY %4.sub1
2222
; CHECK-NEXT: GLOBAL_STORE_DWORDX4_SADDR [[V_MOV_B32_e32_]], [[COPY1]], [[COPY]], 0, 0, implicit $exec :: (store (s128), addrspace 1)
2323
; CHECK-NEXT: SI_RETURN
@@ -26,7 +26,7 @@ body: |
2626
undef %2.sub0:sgpr_64 = COPY killed %1
2727
%2.sub1:sgpr_64 = COPY killed %0
2828
%3:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
29-
INLINEASM &"; def $0", 0 /* attdialect */, 3407882 /* regdef:VReg_64 */, def %4:vreg_64
29+
INLINEASM &"; def $0", 0 /* attdialect */, 2818058 /* regdef:VReg_64 */, def %4:vreg_64
3030
undef %5.sub0:vreg_128 = COPY killed %4.sub1
3131
GLOBAL_STORE_DWORDX4_SADDR killed %3, killed %5, killed %2, 0, 0, implicit $exec :: (store (s128), addrspace 1)
3232
SI_RETURN

0 commit comments

Comments
 (0)