[PATCH] D142472: [TableGen] Speed up computeUberSets. NFC.
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 24 07:06:03 PST 2023
foad created this revision.
Herald added a subscriber: StephenFan.
Herald added a project: All.
foad requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D142472
Files:
llvm/utils/TableGen/CodeGenRegisters.cpp
Index: llvm/utils/TableGen/CodeGenRegisters.cpp
===================================================================
--- llvm/utils/TableGen/CodeGenRegisters.cpp
+++ llvm/utils/TableGen/CodeGenRegisters.cpp
@@ -1659,8 +1659,8 @@
"register enum value mismatch");
// For simplicitly make the SetID the same as EnumValue.
- IntEqClasses UberSetIDs(Registers.size()+1);
- std::set<unsigned> AllocatableRegs;
+ IntEqClasses UberSetIDs(Registers.size() + 1);
+ BitVector AllocatableRegs(Registers.size() + 1);
for (auto &RegClass : RegBank.getRegClasses()) {
if (!RegClass.Allocatable)
continue;
@@ -1672,16 +1672,16 @@
unsigned USetID = UberSetIDs.findLeader((*Regs.begin())->EnumValue);
assert(USetID && "register number 0 is invalid");
- AllocatableRegs.insert((*Regs.begin())->EnumValue);
+ AllocatableRegs.set((*Regs.begin())->EnumValue);
for (const CodeGenRegister *CGR : llvm::drop_begin(Regs)) {
- AllocatableRegs.insert(CGR->EnumValue);
+ AllocatableRegs.set(CGR->EnumValue);
UberSetIDs.join(USetID, CGR->EnumValue);
}
}
// Combine non-allocatable regs.
for (const auto &Reg : Registers) {
unsigned RegNum = Reg.EnumValue;
- if (AllocatableRegs.count(RegNum))
+ if (AllocatableRegs.test(RegNum))
continue;
UberSetIDs.join(0, RegNum);
@@ -1704,7 +1704,6 @@
UberRegSet *USet = &UberSets[USetID];
USet->Regs.push_back(&Reg);
- sortAndUniqueRegisters(USet->Regs);
RegSets[i++] = USet;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142472.491769.patch
Type: text/x-patch
Size: 1524 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230124/10c793d4/attachment.bin>
More information about the llvm-commits
mailing list