source: icGREP/icgrep-devel/icgrep/pablo/ps_assign.cpp @ 4578

Last change on this file since 4578 was 4433, checked in by nmedfort, 5 years ago

Possible fix for segfault issue. CC seems to be generating the same charclass multiple times.

File size: 843 bytes
Line 
1#include <pablo/ps_assign.h>
2#include <pablo/ps_if.h>
3#include <pablo/pe_next.h>
4
5namespace pablo {
6
7bool Assign::superfluous() const {
8    if (LLVM_UNLIKELY(isOutputAssignment())) {
9        // If this Assign is an assignment to an output variable, it cannot be superfluous.
10        return false;
11    }
12    for (const PabloAST * inst : users()) {       
13        if (isa<Next>(inst)) {
14            // If this Assign has a Next node, it cannot be superfluous.
15            return false;
16        }
17        if (isa<If>(inst)) {
18            // If this Assign is a defined variable of an If node, it cannot be superfluous.
19            const auto & dv = cast<If>(inst)->getDefined();
20            if (LLVM_UNLIKELY(std::find(dv.begin(), dv.end(), this) != dv.end())) {
21                return false;
22            }
23        }
24    }
25    return true;
26}
27
28}
29
Note: See TracBrowser for help on using the repository browser.