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

vla5924-practice / compiler-project / 13745921087

09 Mar 2025 07:01AM UTC coverage: 83.547% (-0.08%) from 83.626%
13745921087

Pull #197

github

web-flow
Merge 29b32ad6e into 6eafd4095
Pull Request #197: Perform convergent transformation within CascadeTransform

133 of 152 new or added lines in 7 files covered. (87.5%)

11 existing lines in 1 file now uncovered.

3326 of 3981 relevant lines covered (83.55%)

281.72 hits per line

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

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

34
} // namespace
35

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

41
void Optimizer::process(const Operation::Ptr &op) const {
21✔
42
    for (const auto &transform : transforms)
42✔
43
        runTransform(transform, op);
21✔
44
}
21✔
45

46
void Optimizer::process(Program &program) const {
21✔
47
    process(program.root);
21✔
48
}
21✔
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