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

daisytuner / docc / 22151769687

18 Feb 2026 06:09PM UTC coverage: 64.742%. First build
22151769687

push

github

web-flow
Merge pull request #526 from daisytuner/native-ndarray

Python - Native Tensor Support: Update operations to use tensor type

2783 of 4104 new or added lines in 42 files covered. (67.81%)

23724 of 36644 relevant lines covered (64.74%)

368.06 hits per line

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

75.38
/sdfg/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
#include "sdfg/data_flow/library_nodes/stdlib/malloc.h"
5

6
namespace sdfg {
7
namespace passes {
8

9
DeadDataElimination::DeadDataElimination() : Pass(), permissive_(false) {};
38✔
10

11
DeadDataElimination::DeadDataElimination(bool permissive) : Pass(), permissive_(permissive) {};
1✔
12

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

15
bool DeadDataElimination::run_pass(builder::StructuredSDFGBuilder& builder, analysis::AnalysisManager& analysis_manager) {
74✔
16
    bool applied = false;
74✔
17

18
    auto& sdfg = builder.subject();
74✔
19
    auto& users = analysis_manager.get<analysis::Users>();
74✔
20
    auto& data_dependency_analysis = analysis_manager.get<analysis::DataDependencyAnalysis>();
74✔
21

22
    // Eliminate dead code, i.e., never read
23
    std::unordered_set<std::string> dead;
74✔
24
    for (auto& name : sdfg.containers()) {
679✔
25
        if (!sdfg.is_transient(name)) {
679✔
26
            continue;
350✔
27
        }
350✔
28
        if (users.num_views(name) > 0 || users.num_moves(name) > 0) {
329✔
29
            continue;
×
30
        }
×
31
        if (users.num_reads(name) == 0 && users.num_writes(name) == 0) {
329✔
32
            dead.insert(name);
5✔
33
            applied = true;
5✔
34
            continue;
5✔
35
        }
5✔
36

37
        // Writes without reads
38
        bool all_definitions_removed = (users.num_reads(name) == 0);
324✔
39
        auto raws = data_dependency_analysis.definitions(name);
324✔
40
        for (auto set : raws) {
588✔
41
            if (set.second.size() > 0) {
588✔
42
                all_definitions_removed = false;
580✔
43
                continue;
580✔
44
            }
580✔
45
            if (data_dependency_analysis.is_undefined_user(*set.first)) {
8✔
46
                continue;
×
47
            }
×
48

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

56
                auto& src = (*graph.in_edges(*access_node).begin()).src();
1✔
57
                if (auto tasklet = dynamic_cast<data_flow::Tasklet*>(&src)) {
1✔
58
                    auto& block = dynamic_cast<structured_control_flow::Block&>(*graph.get_parent());
1✔
59
                    builder.clear_node(block, *tasklet);
1✔
60
                    applied = true;
1✔
61
                } else if (auto library_node = dynamic_cast<data_flow::LibraryNode*>(&src)) {
1✔
NEW
62
                    if (!library_node->side_effect() ||
×
NEW
63
                        (permissive_ && library_node->code() == stdlib::LibraryNodeType_Malloc)) {
×
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
        }
8✔
75

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

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

85
    return applied;
74✔
86
};
74✔
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