Skip to content

[TableGen] Fix calculation of Lanemask for RCs with artificial subregs. #114392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions llvm/test/TableGen/ArtificialSubregs.td
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ def TestTarget : Target;
// CHECK: SuperClasses:
//
// CHECK: RegisterClass DRegs:
// CHECK: LaneMask: 0000000000000004
// CHECK: LaneMask: 0000000000000044
// CHECK: HasDisjunctSubRegs: 1
// CHECK: CoveredBySubRegs: 1
// CHECK: Regs: D0 D1 D2
// CHECK: SubClasses: DRegs
// CHECK: SuperClasses:
//
// CHECK: RegisterClass QRegs:
// CHECK: LaneMask: 0000000000000044
// CHECK: LaneMask: 0000000000000045
// CHECK: HasDisjunctSubRegs: 1
// CHECK: CoveredBySubRegs: 1
// CHECK: Regs: Q0 Q1 Q2
Expand Down
10 changes: 4 additions & 6 deletions llvm/utils/TableGen/Common/CodeGenRegisters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2300,10 +2300,8 @@ void CodeGenRegBank::inferSubClassWithSubReg(CodeGenRegisterClass *RC) {
if (R->Artificial)
continue;
const CodeGenRegister::SubRegMap &SRM = R->getSubRegs();
for (auto I : SRM) {
if (!I.first->Artificial)
SRSets[I.first].push_back(R);
}
for (auto I : SRM)
SRSets[I.first].push_back(R);
}

for (auto I : SRSets)
Expand All @@ -2312,8 +2310,6 @@ void CodeGenRegBank::inferSubClassWithSubReg(CodeGenRegisterClass *RC) {
// Find matching classes for all SRSets entries. Iterate in SubRegIndex
// numerical order to visit synthetic indices last.
for (const auto &SubIdx : SubRegIndices) {
if (SubIdx.Artificial)
continue;
SubReg2SetMap::const_iterator I = SRSets.find(&SubIdx);
// Unsupported SubRegIndex. Skip it.
if (I == SRSets.end())
Expand All @@ -2323,6 +2319,8 @@ void CodeGenRegBank::inferSubClassWithSubReg(CodeGenRegisterClass *RC) {
RC->setSubClassWithSubReg(&SubIdx, RC);
continue;
}
if (SubIdx.Artificial)
continue;
// This is a real subset. See if we have a matching class.
CodeGenRegisterClass *SubRC = getOrCreateSubClass(
RC, &I->second, RC->getName() + "_with_" + I->first->getName());
Expand Down
Loading