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

daisytuner / sdfglib / 15656007340

14 Jun 2025 08:51PM UTC coverage: 13.234% (-49.9%) from 63.144%
15656007340

Pull #76

github

web-flow
Merge 9586c8161 into 413c53212
Pull Request #76: New Loop Dependency Analysis

361 of 465 new or added lines in 7 files covered. (77.63%)

6215 existing lines in 110 files now uncovered.

1612 of 12181 relevant lines covered (13.23%)

13.64 hits per line

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

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

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

5
namespace sdfg {
6
namespace passes {
7

UNCOV
8
DeadDataElimination::DeadDataElimination() : Pass(){};
×
9

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

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

UNCOV
16
    auto& sdfg = builder.subject();
×
UNCOV
17
    auto& users = analysis_manager.get<analysis::Users>();
×
UNCOV
18
    auto& happens_before = analysis_manager.get<analysis::HappensBeforeAnalysis>();
×
19

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

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

39
        // Writes without reads
UNCOV
40
        auto raws = happens_before.reads_after_writes(name);
×
UNCOV
41
        for (auto set : raws) {
×
UNCOV
42
            if (set.second.size() > 0) {
×
UNCOV
43
                continue;
×
44
            }
45

UNCOV
46
            auto write = set.first;
×
UNCOV
47
            if (auto transition =
×
UNCOV
48
                    dynamic_cast<structured_control_flow::Transition*>(write->element())) {
×
UNCOV
49
                transition->assignments().erase(symbolic::symbol(name));
×
UNCOV
50
            } else if (auto access_node = dynamic_cast<data_flow::AccessNode*>(write->element())) {
×
UNCOV
51
                auto graph = write->parent();
×
UNCOV
52
                auto& tasklet = static_cast<const data_flow::Tasklet&>(
×
UNCOV
53
                    (*graph->in_edges(*access_node).begin()).src());
×
UNCOV
54
                if (tasklet.is_conditional()) {
×
55
                    continue;
×
56
                }
UNCOV
57
                auto& block = dynamic_cast<structured_control_flow::Block&>(*graph->get_parent());
×
UNCOV
58
                builder.clear_node(block, *access_node);
×
UNCOV
59
            }
×
UNCOV
60
            applied = true;
×
UNCOV
61
        }
×
UNCOV
62
    }
×
63

UNCOV
64
    for (auto& name : dead) {
×
UNCOV
65
        builder.remove_container(name);
×
66
    }
67

UNCOV
68
    return applied;
×
UNCOV
69
};
×
70

71
}  // namespace passes
72
}  // 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