Skip to content

Commit f3703f3

Browse files
authored
[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 e9330fd commit f3703f3

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
@@ -167,7 +167,7 @@ bool CompressInstEmitter::validateRegister(const Record *Reg,
167167
assert(RegClass->isSubClassOf("RegisterClass") &&
168168
"RegClass record should be a RegisterClass");
169169
const CodeGenRegisterClass &RC = Target.getRegisterClass(RegClass);
170-
const CodeGenRegister *R = Target.getRegisterByName(Reg->getName().lower());
170+
const CodeGenRegister *R = Target.getRegBank().getReg(Reg);
171171
assert(R != nullptr && "Register not defined!!");
172172
return RC.contains(R);
173173
}

0 commit comments

Comments
 (0)