Skip to content

Commit 1f87ff7

Browse files
committed
[TableGen] Look up registers directly in the CodeGenRegBank in CompressInstEmitter, rather than indirecting via the name. (#161853)
The previous code was subtly incorrect, as it indexed the RegistersByName map using the tblgen Def name of the register, rather than the AsmName with which the table was initialized. But all of this indirection via the name was unnecessary.
1 parent 254fdfd commit 1f87ff7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/utils/TableGen/CompressInstEmitter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ bool CompressInstEmitter::validateRegister(const Record *Reg,
161161
assert(RegClass->isSubClassOf("RegisterClass") &&
162162
"RegClass record should be a RegisterClass");
163163
const CodeGenRegisterClass &RC = Target.getRegisterClass(RegClass);
164-
const CodeGenRegister *R = Target.getRegisterByName(Reg->getName().lower());
164+
const CodeGenRegister *R = Target.getRegBank().getReg(Reg);
165165
assert(R != nullptr && "Register not defined!!");
166166
return RC.contains(R);
167167
}

0 commit comments

Comments
 (0)