[Mlir-commits] [mlir] TableGen multi-result support in source patterns (PR #159656)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Sep 18 18:12:59 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- mlir/include/mlir/TableGen/Pattern.h mlir/lib/TableGen/Pattern.cpp mlir/tools/mlir-tblgen/RewriterGen.cpp
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/lib/TableGen/Pattern.cpp b/mlir/lib/TableGen/Pattern.cpp
index 38725050c..b0dd0451e 100644
--- a/mlir/lib/TableGen/Pattern.cpp
+++ b/mlir/lib/TableGen/Pattern.cpp
@@ -528,7 +528,8 @@ bool SymbolInfoMap::bindOpArgument(DagNode node, StringRef symbol,
bool SymbolInfoMap::bindOpResult(StringRef symbol, const Operator &op) {
int index = -1;
StringRef name = getValuePackName(symbol, &index);
- auto inserted = symbolInfoMap.emplace(name.str(), SymbolInfo::getResult(&op, index));
+ auto inserted =
+ symbolInfoMap.emplace(name.str(), SymbolInfo::getResult(&op, index));
return symbolInfoMap.count(inserted->first) == 1;
}
diff --git a/mlir/tools/mlir-tblgen/RewriterGen.cpp b/mlir/tools/mlir-tblgen/RewriterGen.cpp
index 312f5174b..ab49a60bd 100644
--- a/mlir/tools/mlir-tblgen/RewriterGen.cpp
+++ b/mlir/tools/mlir-tblgen/RewriterGen.cpp
@@ -621,9 +621,9 @@ void PatternEmitter::emitOpMatch(DagNode tree, StringRef opName, int depth) {
os << formatv("{0} = {1};\n", name, castedName);
if (index != -1) {
- emitMatchCheck(opName,
- formatv("(resultNumber{0} == 1)", depth),
- formatv("\"{0} does not come from result number {1} type\"", castedName, index));
+ emitMatchCheck(opName, formatv("(resultNumber{0} == 1)", depth),
+ formatv("\"{0} does not come from result number {1} type\"",
+ castedName, index));
}
for (int i = 0, opArgIdx = 0, e = tree.getNumArgs(), nextOperand = 0; i != e;
@@ -669,9 +669,10 @@ void PatternEmitter::emitOpMatch(DagNode tree, StringRef opName, int depth) {
"auto *{0} = "
"(*{1}.getODSOperands({2}).begin()).getDefiningOp();\n",
argName, castedName, nextOperand);
- os.indent() << formatv(
+ os.indent() << formatv(
"[[maybe_unused]] auto resultNumber{0} = "
- "::llvm::dyn_cast<::mlir::OpResult>((*{1}.getODSOperands({2}).begin())).getResultNumber();\n",
+ "::llvm::dyn_cast<::mlir::OpResult>((*{1}.getODSOperands({2}).begin()"
+ ")).getResultNumber();\n",
depth + 1, castedName, nextOperand);
// Null check of operand's definingOp
emitMatchCheck(
``````````
</details>
https://github.com/llvm/llvm-project/pull/159656
More information about the Mlir-commits
mailing list