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

daisytuner / sdfglib / 20147202960

11 Dec 2025 08:57PM UTC coverage: 40.181% (-0.09%) from 40.268%
20147202960

push

github

lukastruemper
removes timing outputs of passes

13596 of 43795 branches covered (31.04%)

Branch coverage included in aggregate %.

11609 of 18933 relevant lines covered (61.32%)

93.45 hits per line

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

58.38
/src/passes/dataflow/dead_data_elimination.cpp
1
#include "sdfg/passes/dataflow/dead_data_elimination.h"
2

3
#include "sdfg/analysis/data_dependency_analysis.h"
4

5
namespace sdfg {
6
namespace passes {
7

8
DeadDataElimination::DeadDataElimination() : Pass() {};
13✔
9

10
std::string DeadDataElimination::name() { return "DeadDataElimination"; };
×
11

12
bool DeadDataElimination::run_pass(builder::StructuredSDFGBuilder& builder, analysis::AnalysisManager& analysis_manager) {
20✔
13
    bool applied = false;
20✔
14

15
    auto& sdfg = builder.subject();
20✔
16
    auto& users = analysis_manager.get<analysis::Users>();
20✔
17
    auto& data_dependency_analysis = analysis_manager.get<analysis::DataDependencyAnalysis>();
20✔
18

19
    // Eliminate dead code, i.e., never read
20
    std::unordered_set<std::string> dead;
20✔
21
    for (auto& name : sdfg.containers()) {
47!
22
        if (!sdfg.is_transient(name)) {
27!
23
            continue;
10✔
24
        }
25
        if (!dynamic_cast<const types::Scalar*>(&sdfg.type(name))) {
17!
26
            continue;
×
27
        }
28

29
        if (!users.views(name).empty() || !users.moves(name).empty()) {
17!
30
            continue;
×
31
        }
32
        if (users.reads(name).empty() && users.writes(name).empty()) {
17!
33
            dead.insert(name);
3!
34
            applied = true;
3✔
35
            continue;
3✔
36
        }
37

38
        // Writes without reads
39
        auto raws = data_dependency_analysis.definitions(name);
14!
40
        for (auto set : raws) {
43!
41
            if (set.second.size() > 0) {
29✔
42
                continue;
22✔
43
            }
44
            if (data_dependency_analysis.is_undefined_user(*set.first)) {
7!
45
                continue;
×
46
            }
47

48
            auto write = set.first;
7✔
49
            if (auto transition = dynamic_cast<structured_control_flow::Transition*>(write->element())) {
7!
50
                transition->assignments().erase(symbolic::symbol(name));
6!
51
                applied = true;
6✔
52
            } else if (auto access_node = dynamic_cast<data_flow::AccessNode*>(write->element())) {
7!
53
                auto& graph = access_node->get_parent();
1!
54

55
                auto& src = (*graph.in_edges(*access_node).begin()).src();
1!
56
                if (auto tasklet = dynamic_cast<data_flow::Tasklet*>(&src)) {
1!
57
                    auto& block = dynamic_cast<structured_control_flow::Block&>(*graph.get_parent());
1!
58
                    builder.clear_node(block, *tasklet);
1!
59
                    applied = true;
1✔
60
                } else if (auto library_node = dynamic_cast<data_flow::LibraryNode*>(&src)) {
1!
61
                    if (!library_node->side_effect()) {
×
62
                        auto& block = dynamic_cast<structured_control_flow::Block&>(*graph.get_parent());
×
63
                        builder.clear_node(block, *library_node);
×
64
                        applied = true;
×
65
                    }
×
66
                }
×
67
            }
1✔
68
        }
29!
69
    }
14✔
70

71
    for (auto& name : dead) {
23✔
72
        builder.remove_container(name);
3!
73
    }
74

75
    return applied;
20✔
76
};
20✔
77

78
} // namespace passes
79
} // 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