[llvm] [MacroFusion] Add [[maybe_unused]] to suppress some warings (PR #185833)

via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 11 01:47:02 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-tablegen

Author: Pengcheng Wang (wangpc-pp)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/185833.diff


1 Files Affected:

- (modified) llvm/utils/TableGen/MacroFusionPredicatorEmitter.cpp (+2-2) 


``````````diff
diff --git a/llvm/utils/TableGen/MacroFusionPredicatorEmitter.cpp b/llvm/utils/TableGen/MacroFusionPredicatorEmitter.cpp
index 742a73cf4b025..0ff0098407c65 100644
--- a/llvm/utils/TableGen/MacroFusionPredicatorEmitter.cpp
+++ b/llvm/utils/TableGen/MacroFusionPredicatorEmitter.cpp
@@ -180,7 +180,7 @@ void MacroFusionPredicatorEmitter::emitFirstPredicate(const Record *Predicate,
     OS.indent(2) << "}\n";
   } else if (Predicate->isSubClassOf("FusionPredicateWithMCInstPredicate")) {
     OS.indent(2) << "{\n";
-    OS.indent(4) << "const MachineInstr *MI = FirstMI;\n";
+    OS.indent(4) << "[[maybe_unused]] const MachineInstr *MI = FirstMI;\n";
     OS.indent(4) << "if (";
     PE.setNegatePredicate(true);
     PE.getIndent() = 3;
@@ -201,7 +201,7 @@ void MacroFusionPredicatorEmitter::emitSecondPredicate(const Record *Predicate,
                                                        raw_ostream &OS) {
   if (Predicate->isSubClassOf("FusionPredicateWithMCInstPredicate")) {
     OS.indent(2) << "{\n";
-    OS.indent(4) << "const MachineInstr *MI = &SecondMI;\n";
+    OS.indent(4) << "[[maybe_unused]] const MachineInstr *MI = &SecondMI;\n";
     OS.indent(4) << "if (";
     PE.setNegatePredicate(true);
     PE.getIndent() = 3;

``````````

</details>


https://github.com/llvm/llvm-project/pull/185833


More information about the llvm-commits mailing list