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

daisytuner / sdfglib / 20776975256

07 Jan 2026 09:35AM UTC coverage: 61.778% (-0.4%) from 62.168%
20776975256

Pull #436

github

web-flow
Merge 6d744fbf4 into 0c34ccd02
Pull Request #436: Add comprehensive tests and Doxygen documentation for SDFG transformations

14894 of 24109 relevant lines covered (61.78%)

88.74 hits per line

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

0.0
/src/transformations/utils.cpp
1
#include "sdfg/transformations/utils.h"
2

3
#include "sdfg/structured_control_flow/structured_loop.h"
4
#include "sdfg/symbolic/symbolic.h"
5
#include "symengine/logic.h"
6

7
using namespace sdfg;
8

9
symbolic::Integer sdfg::get_iteration_count(sdfg::structured_control_flow::StructuredLoop& loop) {
×
10
    auto condition = loop.condition();
×
11
    // TODO: extend me to support more complex loop conditions and update expressions
12
    if (SymEngine::is_a<SymEngine::And>(*condition)) {
×
13
        auto and_condition = SymEngine::rcp_static_cast<const SymEngine::And>(condition);
×
14
        auto container = and_condition->get_container();
×
15
        for (auto it = container.begin(); it != container.end(); ++it) {
×
16
            if (!SymEngine::is_a<SymEngine::StrictLessThan>(**it)) {
×
17
                return SymEngine::null;
×
18
            }
×
19
            auto stl = SymEngine::rcp_static_cast<const SymEngine::StrictLessThan>(*it);
×
20
            auto lhs = stl->get_args()[0];
×
21
            auto rhs = stl->get_args()[1];
×
22
            if (!symbolic::eq(lhs, loop.indvar())) {
×
23
                std::swap(lhs, rhs);
×
24
            }
×
25
            if (!symbolic::eq(lhs, loop.indvar())) {
×
26
                continue;
×
27
            }
×
28
            auto bound = rhs;
×
29
            auto range = symbolic::sub(bound, loop.init());
×
30
            if (SymEngine::is_a<SymEngine::Integer>(*range)) {
×
31
                return SymEngine::rcp_static_cast<const SymEngine::Integer>(range);
×
32
            }
×
33
        }
×
34
    } else if (SymEngine::is_a<SymEngine::StrictLessThan>(*condition)) {
×
35
        auto stl = SymEngine::rcp_static_cast<const SymEngine::StrictLessThan>(condition);
×
36
        auto lhs = stl->get_args()[0];
×
37
        auto rhs = stl->get_args()[1];
×
38
        if (!symbolic::eq(lhs, loop.indvar())) {
×
39
            std::swap(lhs, rhs);
×
40
        }
×
41
        if (!symbolic::eq(lhs, loop.indvar())) {
×
42
            return SymEngine::null;
×
43
        }
×
44
        auto bound = rhs;
×
45
        auto range = symbolic::sub(bound, loop.init());
×
46
        if (SymEngine::is_a<SymEngine::Integer>(*range)) {
×
47
            return SymEngine::rcp_static_cast<const SymEngine::Integer>(range);
×
48
        }
×
49
    }
×
50
    return SymEngine::null;
×
51
};
×
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