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

daisytuner / sdfglib / 15044057891

15 May 2025 11:42AM UTC coverage: 59.37% (+1.8%) from 57.525%
15044057891

push

github

web-flow
Merge pull request #14 from daisytuner/sanitizers

enables sanitizer on unit tests

63 of 67 new or added lines in 47 files covered. (94.03%)

570 existing lines in 62 files now uncovered.

7356 of 12390 relevant lines covered (59.37%)

505.93 hits per line

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

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

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

6
using namespace sdfg;
7

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