[win/asan] GetInstructionSize: Make `83 EC XX` a generic entry. (#119537)
[llvm-project.git] / mlir / test / lib / Dialect / SCF / TestUpliftWhileToFor.cpp
blob468bc0ca78489f5eaad021fce5af99dff64aadab
1 //===- TestUpliftWhileToFor.cpp - while to for loop uplifting test pass ---===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Pass to test transforms SCF.WhileOp's into SCF.ForOp's.
11 //===----------------------------------------------------------------------===//
13 #include "mlir/Dialect/SCF/Transforms/Patterns.h"
14 #include "mlir/IR/PatternMatch.h"
15 #include "mlir/Pass/Pass.h"
16 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
18 using namespace mlir;
20 namespace {
22 struct TestSCFUpliftWhileToFor
23 : public PassWrapper<TestSCFUpliftWhileToFor, OperationPass<void>> {
24 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestSCFUpliftWhileToFor)
26 StringRef getArgument() const final { return "test-scf-uplift-while-to-for"; }
28 StringRef getDescription() const final {
29 return "test scf while to for uplifting";
32 void runOnOperation() override {
33 Operation *op = getOperation();
34 MLIRContext *ctx = op->getContext();
35 RewritePatternSet patterns(ctx);
36 scf::populateUpliftWhileToForPatterns(patterns);
37 if (failed(applyPatternsAndFoldGreedily(op, std::move(patterns))))
38 signalPassFailure();
42 } // namespace
44 namespace mlir {
45 namespace test {
46 void registerTestSCFUpliftWhileToFor() {
47 PassRegistration<TestSCFUpliftWhileToFor>();
49 } // namespace test
50 } // namespace mlir