60 if (
MI->mayStore() ||
MI->isBranch() ||
MI->isCall() ||
MI->isReturn())
62 if (
MI->hasOrderedMemoryRef() ||
MI->hasUnmodeledSideEffects() ||
67 for (
auto &
Op :
MI->operands()) {
68 if (
Op.isReg() &&
MRI.isReserved(
Op.getReg()))
72 for (
unsigned R = 0, RN = DFG.getTRI().getNumRegs(); R != RN; ++R) {
73 if (BM[R/32] & (1u << (R%32)))
75 if (
MRI.isReserved(R))
84 SetQueue<NodeId> &WorkQ) {
90 if (!LiveNodes.count(
RA.Id))
91 WorkQ.push_back(
RA.Id);
96 SetQueue<NodeId> &WorkQ) {
99 if (!LiveNodes.count(UA.Id))
100 WorkQ.push_back(UA.Id);
103 LiveNodes.insert(
TA.Id);
107 SetQueue<NodeId> &WorkQ) {
109 if (!LiveNodes.count(
DA.Id))
110 WorkQ.push_back(
DA.Id);
117bool DeadCodeElimination::collect() {
128 SetQueue<NodeId> WorkQ;
131 scanInstr(IA, WorkQ);
133 while (!WorkQ.empty()) {
138 processDef(
RA, WorkQ);
144 dbgs() <<
"Live nodes:\n";
153 if (LiveNodes.count(DA.Id))
161 if (!LiveNodes.count(
RA.Id))
162 DeadNodes.insert(
RA.Id);
164 if (isLiveInstr(IA) || DFG.hasUntrackedRef(IA))
167 DeadInstrs.insert(IA.Id);
174 return !DeadNodes.empty();
188 for (
auto I : Nodes) {
210 uint16_t KindA =
A.Addr->getKind(), KindB =
B.Addr->getKind();
220 dbgs() <<
"Removing dead ref nodes:\n";
225 DFG.unlinkUse(
RA,
true);
226 else if (DFG.IsDef(
RA))
227 DFG.unlinkDef(
RA,
true);
233 BA.
Addr->removeMember(IA, DFG);
239 dbgs() <<
"erasing: " << *
MI;
240 MI->eraseFromParent();
unsigned const MachineRegisterInfo * MRI
static bool processUse(CallInst *CI, bool IsV5OrAbove)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
SI optimize exec mask operations pre RA
This file implements a set that has insertion order iteration characteristics.
This class represents an Operation in the Expression.
Implements a dense probed hash-table based set.
Representation of each machine instruction.
A vector that has set insertion semantics.
bool empty() const
Determine if the SetVector is empty or not.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
The instances of the Type class are immutable: once they are created, they are never changed.
std::pair< iterator, bool > insert(const ValueT &V)
bool erase(const ValueT &V)
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
void sort(IteratorTy Start, IteratorTy End)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.