[llvm] [GlobalISel] Fixes unused variable error in testMOPredicate_MO (PR #143364)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 9 03:35:41 PDT 2025
https://github.com/jyli0116 created https://github.com/llvm/llvm-project/pull/143364
Solves unused variable error in generated Global ISel code due to changes from #140935
>From 8cb653896fcccb4035c8909c1da80245e04e19d3 Mon Sep 17 00:00:00 2001
From: Yu Li <yu.li at arm.com>
Date: Mon, 9 Jun 2025 10:30:19 +0000
Subject: [PATCH] [GlobalISel] Fixes unused variable error in
testMOPredicate_MO
---
llvm/test/TableGen/GlobalISelEmitter/GlobalISelEmitter.td | 1 +
llvm/utils/TableGen/GlobalISelEmitter.cpp | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
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");
More information about the llvm-commits
mailing list