[llvm] [TableGen] Look up registers directly in the CodeGenRegBank in CompressInstEmitter, rather than indirecting via the name. (PR #161853)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 3 07:34:22 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-tablegen
Author: Owen Anderson (resistor)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/161853.diff
1 Files Affected:
- (modified) llvm/utils/TableGen/CompressInstEmitter.cpp (+1-1)
``````````diff
diff --git a/llvm/utils/TableGen/CompressInstEmitter.cpp b/llvm/utils/TableGen/CompressInstEmitter.cpp
index ccf83859924bc..d8c5ca7c1e1a3 100644
--- a/llvm/utils/TableGen/CompressInstEmitter.cpp
+++ b/llvm/utils/TableGen/CompressInstEmitter.cpp
@@ -167,7 +167,7 @@ bool CompressInstEmitter::validateRegister(const Record *Reg,
assert(RegClass->isSubClassOf("RegisterClass") &&
"RegClass record should be a RegisterClass");
const CodeGenRegisterClass &RC = Target.getRegisterClass(RegClass);
- const CodeGenRegister *R = Target.getRegisterByName(Reg->getName().lower());
+ const CodeGenRegister *R = Target.getRegBank().getReg(Reg);
assert(R != nullptr && "Register not defined!!");
return RC.contains(R);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/161853
More information about the llvm-commits
mailing list