Skip to content

Commit e3cb462

Browse files
Fix for MCRegUnit
1 parent b4d452c commit e3cb462

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

llvm/lib/CodeGen/LiveRegMatrix.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,12 @@ bool LiveRegMatrix::isValid() const {
321321
// Now scan all LiveIntervalUnions in the matrix and verify each pointer
322322
unsigned NumDanglingPointers = 0;
323323
for (unsigned Unit = 0, NumUnits = Matrix.size(); Unit != NumUnits; ++Unit) {
324-
for (const LiveInterval *LI : Matrix[Unit]) {
324+
MCRegUnit RegUnit = static_cast<MCRegUnit>(Unit);
325+
for (const LiveInterval *LI : Matrix[RegUnit]) {
325326
if (!ValidIntervals.contains(LI)) {
326327
++NumDanglingPointers;
327328
dbgs() << "ERROR: LiveInterval pointer is not found in LiveIntervals:\n"
328-
<< " Register Unit: " << printRegUnit(Unit, TRI) << "\n"
329+
<< " Register Unit: " << printRegUnit(RegUnit, TRI) << "\n"
329330
<< " LiveInterval pointer: " << LI << "\n";
330331
}
331332
}

llvm/lib/Target/AMDGPU/AMDGPUHotBlockRegisterRenaming.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,8 @@ void AMDGPUHotBlockRegisterRenamingImpl::calculateValueDensity(
348348

349349
// Access LiveIntervalUnion for this PhysReg
350350
for (MCRegUnit Unit : TRI->regunits(PhysReg)) {
351-
LiveIntervalUnion &LIU = LRM->getLiveUnions()[Unit];
351+
LiveIntervalUnion &LIU =
352+
LRM->getLiveUnions()[static_cast<unsigned>(Unit)];
352353

353354
for (LiveIntervalUnion::SegmentIter SI = LIU.begin(); SI.valid(); ++SI) {
354355
SlotIndex SegStart = SI.start();
@@ -389,7 +390,8 @@ void AMDGPUHotBlockRegisterRenamingImpl::findFreeRegisters(
389390

390391
// Check all register units
391392
for (MCRegUnit Unit : TRI->regunits(PhysReg)) {
392-
LiveIntervalUnion &LIU = LRM->getLiveUnions()[Unit];
393+
LiveIntervalUnion &LIU =
394+
LRM->getLiveUnions()[static_cast<unsigned>(Unit)];
393395

394396
// Check if anything is live in this BB
395397
LiveIntervalUnion::SegmentIter SI = LIU.find(BBStart);
@@ -498,7 +500,7 @@ bool AMDGPUHotBlockRegisterRenamingImpl::tryMoveValue(
498500
const DenseMap<MCRegister, SmallVector<SlotIndex, 4>> &PhysRegDefs) {
499501
// Find a movable local value in DenseReg
500502
for (MCRegUnit Unit : TRI->regunits(DenseReg)) {
501-
LiveIntervalUnion &LIU = LRM->getLiveUnions()[Unit];
503+
LiveIntervalUnion &LIU = LRM->getLiveUnions()[static_cast<unsigned>(Unit)];
502504

503505
for (LiveIntervalUnion::SegmentIter SI = LIU.begin(); SI.valid(); ++SI) {
504506
Register VirtReg = SI.value()->reg();

0 commit comments

Comments
 (0)