[llvm] [mlir] [mlir][transform] LISH: Add transform op (PR #70630)

Oleksandr Alex Zinenko via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 2 05:26:24 PDT 2023


================
@@ -0,0 +1,36 @@
+//===- LoopExtensionOps.cpp - Loop extension for the Transform dialect ----===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "mlir/Dialect/Transform/LoopExtension/LoopExtensionOps.h"
+
+#include "mlir/IR/OpImplementation.h"
+#include "mlir/IR/PatternMatch.h"
+#include "mlir/Transforms/LoopInvariantCodeMotionUtils.h"
+
+using namespace mlir;
+
+#define GET_OP_CLASSES
+#include "mlir/Dialect/Transform/LoopExtension/LoopExtensionOps.cpp.inc"
+
+//===----------------------------------------------------------------------===//
+// HoistLoopInvariantSubsetsOp
+//===----------------------------------------------------------------------===//
+
+DiagnosedSilenceableFailure transform::HoistLoopInvariantSubsetsOp::applyToOne(
+    transform::TransformRewriter &rewriter, LoopLikeOpInterface loopLikeOp,
+    transform::ApplyToEachResultList &results,
+    transform::TransformState &state) {
+  (void)hoistLoopInvariantSubsets(rewriter, loopLikeOp);
----------------
ftynse wrote:

Nit: this returns `LoopLikeOpInterface`, which is not marked `nodiscard` AFAIU. We can just drop result on the floor without casting to `(void)`, which looks like intentionally ignoring some error state.

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


More information about the llvm-commits mailing list