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

daisytuner / sdfglib / 20606101998

30 Dec 2025 09:15PM UTC coverage: 39.289% (+0.002%) from 39.287%
20606101998

push

github

web-flow
Merge pull request #418 from daisytuner/formatting

formatting

14705 of 48717 branches covered (30.18%)

Branch coverage included in aggregate %.

2 of 19 new or added lines in 7 files covered. (10.53%)

1 existing line in 1 file now uncovered.

12576 of 20719 relevant lines covered (60.7%)

86.36 hits per line

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

0.0
/src/passes/structured_control_flow/common_assignment_elimination.cpp
1
#include "sdfg/passes/structured_control_flow/common_assignment_elimination.h"
2

3
#include "sdfg/structured_control_flow/structured_loop.h"
4

5
namespace sdfg {
6
namespace passes {
7

8
CommonAssignmentElimination::CommonAssignmentElimination()
×
9
    : Pass() {
×
10

11
      };
×
12

13
std::string CommonAssignmentElimination::name() { return "CommonAssignmentElimination"; };
×
14

15
bool CommonAssignmentElimination::
NEW
16
    run_pass(builder::StructuredSDFGBuilder& builder, analysis::AnalysisManager& analysis_manager) {
×
UNCOV
17
    bool applied = false;
×
18

19
    // Traverse structured SDFG
20
    std::list<structured_control_flow::ControlFlowNode*> queue = {&builder.subject().root()};
×
21
    while (!queue.empty()) {
×
22
        auto current = queue.front();
×
23
        queue.pop_front();
×
24

25
        // Add children to queue
26
        if (auto sequence_stmt = dynamic_cast<structured_control_flow::Sequence*>(current)) {
×
27
            for (size_t i = 0; i < sequence_stmt->size(); i++) {
×
28
                auto child = sequence_stmt->at(i);
×
NEW
29
                if (auto if_else_stmt = dynamic_cast<structured_control_flow::IfElse*>(&child.first)) {
×
30
                    if (if_else_stmt->size() < 2) {
×
31
                        continue;
×
32
                    }
33
                    auto& first_branch = if_else_stmt->at(0).first;
×
34
                    if (first_branch.size() == 0) {
×
35
                        continue;
×
36
                    }
37
                    auto& last_transition = first_branch.at(first_branch.size() - 1).second;
×
38
                    if (last_transition.assignments().size() == 0) {
×
39
                        continue;
×
40
                    }
41

42
                    // Check waw dependencies
43
                    for (auto& entry : last_transition.assignments()) {
×
44
                        auto& first_assign = entry.first;
×
45
                        auto& first_assignment = entry.second;
×
NEW
46
                        if (child.second.assignments().find(first_assign) != child.second.assignments().end()) {
×
47
                            continue;
×
48
                        }
49

50
                        // Check if all branches end with same assignment
51
                        bool all_branches_same = true;
×
52
                        for (size_t j = 1; j < if_else_stmt->size(); j++) {
×
53
                            auto& branch = if_else_stmt->at(j).first;
×
54
                            if (branch.size() == 0) {
×
55
                                all_branches_same = false;
×
56
                                break;
×
57
                            }
58

59
                            auto& transition = branch.at(branch.size() - 1).second;
×
NEW
60
                            if (transition.assignments().find(first_assign) == transition.assignments().end()) {
×
61
                                all_branches_same = false;
×
62
                                break;
×
63
                            }
NEW
64
                            if (!symbolic::eq(first_assignment, transition.assignments().at(first_assign))) {
×
65
                                all_branches_same = false;
×
66
                                break;
×
67
                            }
68
                        }
×
69

70
                        if (!all_branches_same) {
×
71
                            continue;
×
72
                        }
73

74
                        child.second.assignments().insert({first_assign, first_assignment});
×
75
                        applied = true;
×
76
                    }
77
                }
×
78
            }
×
79

80
            for (size_t i = 0; i < sequence_stmt->size(); i++) {
×
81
                queue.push_back(&sequence_stmt->at(i).first);
×
82
            }
×
83
        } else if (auto if_else_stmt = dynamic_cast<structured_control_flow::IfElse*>(current)) {
×
84
            for (size_t i = 0; i < if_else_stmt->size(); i++) {
×
85
                queue.push_back(&if_else_stmt->at(i).first);
×
86
            }
×
87
        } else if (auto loop_stmt = dynamic_cast<structured_control_flow::While*>(current)) {
×
88
            queue.push_back(&loop_stmt->root());
×
NEW
89
        } else if (auto sloop_stmt = dynamic_cast<structured_control_flow::StructuredLoop*>(current)) {
×
90
            queue.push_back(&sloop_stmt->root());
×
91
        }
×
92
    }
93

94
    return applied;
×
95
};
×
96

97
} // namespace passes
98
} // namespace sdfg
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