fix for AST optimization altering top-level body statement

This commit is contained in:
Vern Paxson 2021-05-30 17:37:44 -07:00
parent 22af54dda2
commit 143d306883
3 changed files with 17 additions and 5 deletions

View file

@ -57,14 +57,18 @@ public:
// True if we've computed use-defs for the given statement.
bool HasUsage(const Stmt* s) const
{ return use_defs_map.find(s) != use_defs_map.end(); }
bool HasUsage(const StmtPtr& s) const
{ return HasUsage(s.get()); }
// Returns the use-defs for the given statement.
UDs GetUsage(const Stmt* s) const { return FindUsage(s); }
UDs GetUsage(const StmtPtr& s) const { return FindUsage(s.get()); }
// Removes assignments corresponding to unused temporaries.
// In the process, reports on locals that are assigned
// but never used.
void RemoveUnused();
// but never used. Returns the body, which may have been
// changed if the original first statement has been pruned.
StmtPtr RemoveUnused();
void Dump();