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

daisytuner / sdfglib / 20770413849

06 Jan 2026 10:50PM UTC coverage: 62.168% (+21.4%) from 40.764%
20770413849

push

github

web-flow
Merge pull request #433 from daisytuner/clang-coverage

updates clang coverage flags

14988 of 24109 relevant lines covered (62.17%)

88.57 hits per line

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

74.24
/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() {};
11✔
9

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

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

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

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

29
        if (users.num_views(name) > 0 || users.num_moves(name) > 0) {
15✔
30
            continue;
×
31
        }
×
32
        if (users.num_reads(name) == 0 && users.num_writes(name) == 0) {
15✔
33
            dead.insert(name);
1✔
34
            applied = true;
1✔
35
            continue;
1✔
36
        }
1✔
37

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

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

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

76
        if (all_definitions_removed) {
14✔
77
            dead.insert(name);
2✔
78
        }
2✔
79
    }
14✔
80

81
    for (auto& name : dead) {
18✔
82
        builder.remove_container(name);
3✔
83
    }
3✔
84

85
    return applied;
18✔
86
};
18✔
87

88
} // namespace passes
89
} // 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