• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

vla5924-practice / compiler-project / 14006486140

22 Mar 2025 07:29AM UTC coverage: 82.886%. Remained the same
14006486140

Pull #197

github

web-flow
Merge ef6256402 into a5e3ea566
Pull Request #197: Perform convergent transformation within CascadeTransform

125 of 138 new or added lines in 8 files covered. (90.58%)

4756 of 5738 relevant lines covered (82.89%)

269.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.5
/compiler/lib/backend/optree/optimizer/optimizer.cpp
1
#include "optimizer/optimizer.hpp"
2

3
#include "compiler/optree/operation.hpp"
4
#include "compiler/optree/program.hpp"
5
#include "compiler/utils/debug.hpp"
6
#include "compiler/utils/helpers.hpp"
7

8
#include "optimizer/opt_builder.hpp"
9
#include "optimizer/transform.hpp"
10

11
using namespace optree;
12
using namespace optree::optimizer;
13

14
using dbg = utils::DebugPrinter;
15

16
namespace {
17

18
void runTransform(const BaseTransform::Ptr &transform, const OptBuilder::Notifier &notifier, const Operation::Ptr &op) {
25✔
19
    bool canRun = transform->canRun(op);
25✔
20
    if (transform->recurse() || (!canRun && !transform->recurse())) {
25✔
NEW
21
        for (const auto &childOp : utils::advanceEarly(op->body)) {
×
NEW
22
            runTransform(transform, notifier, childOp);
×
23
        }
24
    }
25
    if (!canRun)
25✔
NEW
26
        return;
×
27
    OptBuilder builder(notifier);
25✔
28
    builder.setInsertPointBefore(op);
25✔
29
    COMPILER_DEBUG(dbg::get() << "Run " << transform->name() << " on " << op->dump() << "{\n");
25✔
30
    transform->run(op, builder);
25✔
31
    COMPILER_DEBUG(dbg::get() << "}\n\n");
25✔
32
}
25✔
33

34
} // namespace
35

36
Optimizer &Optimizer::add(const BaseTransform::Ptr &transform) {
25✔
37
    transforms.emplace_back(transform);
25✔
38
    return *this;
25✔
39
}
40

41
void Optimizer::process(const Operation::Ptr &op) const {
25✔
42
    OptBuilder::Notifier empty;
25✔
43
    for (const auto &transform : transforms)
50✔
44
        runTransform(transform, empty, op);
25✔
45
}
25✔
46

47
void Optimizer::process(Program &program) const {
25✔
48
    process(program.root);
25✔
49
}
25✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc