[llvm] [GlobalISel] Fixes unused variable error in testMOPredicate_MO (PR #143364)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 9 03:36:16 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-globalisel
Author: None (jyli0116)
<details>
<summary>Changes</summary>
Solves unused variable error in generated Global ISel code due to changes from #<!-- -->140935
---
Full diff: https://github.com/llvm/llvm-project/pull/143364.diff
2 Files Affected:
- (modified) llvm/test/TableGen/GlobalISelEmitter/GlobalISelEmitter.td (+1)
- (modified) llvm/utils/TableGen/GlobalISelEmitter.cpp (+2-1)
``````````diff
diff --git a/llvm/test/TableGen/GlobalISelEmitter/GlobalISelEmitter.td b/llvm/test/TableGen/GlobalISelEmitter/GlobalISelEmitter.td
index 53d29225e774e..23e22b8b84183 100644
--- a/llvm/test/TableGen/GlobalISelEmitter/GlobalISelEmitter.td
+++ b/llvm/test/TableGen/GlobalISelEmitter/GlobalISelEmitter.td
@@ -167,6 +167,7 @@ def HasC : Predicate<"Subtarget->hasC()"> { let RecomputePerFunction = 1; }
// CHECK-NEXT: const auto &Operands = State.RecordedOperands;
// CHECK-NEXT: Register Reg = MO.getReg();
// CHECK-NEXT: (void)Operands;
+// CHECK-NEXT: (void)Reg;
// CHECK-NEXT: switch (PredicateID) {
// CHECK-NEXT: case GICXXPred_MO_Predicate_leaf: {
// CHECK-NEXT: return true;
diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp
index 5b61d6e3f6561..28b1a837bbd94 100644
--- a/llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -2314,7 +2314,8 @@ void GlobalISelEmitter::emitLeafPredicateFns(raw_ostream &OS) {
OS,
" const auto &Operands = State.RecordedOperands;\n"
" Register Reg = MO.getReg();\n"
- " (void)Operands;",
+ " (void)Operands;\n"
+ " (void)Reg;",
ArrayRef<const Record *>(MatchedRecords), &getPatFragPredicateEnumName,
[](const Record *R) {
return R->getValueAsString("GISelLeafPredicateCode");
``````````
</details>
https://github.com/llvm/llvm-project/pull/143364
More information about the llvm-commits
mailing list