aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/Dialect/Transform/LoopExtension/LoopExtensionOps.cpp
blob: 95870e8ef87beb929fcd45b5060cef925de8baf9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//===- 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/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) {
  hoistLoopInvariantSubsets(rewriter, loopLikeOp);
  return DiagnosedSilenceableFailure::success();
}

void transform::HoistLoopInvariantSubsetsOp::getEffects(
    SmallVectorImpl<MemoryEffects::EffectInstance> &effects) {
  transform::onlyReadsHandle(getTargetMutable(), effects);
  transform::modifiesPayload(effects);
}