Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the number of memory allocations in def-use #4904

Merged
merged 16 commits into from
Sep 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Explicitly track lifetime of AllDefinitions
Signed-off-by: Anton Korobeynikov <anton@korobeynikov.info>
  • Loading branch information
asl committed Sep 10, 2024
commit 4d0f982d54019fe1b45f6cebf1128f528c0c7e61
9 changes: 4 additions & 5 deletions frontends/p4/simplifyDefUse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1539,14 +1539,13 @@ class RemoveUnused : public Transform {

// Run for each parser and control separately.
class ProcessDefUse : public PassManager {
AllDefinitions *definitions;
AllDefinitions definitions;
HasUses hasUses;

public:
ProcessDefUse(ReferenceMap *refMap, TypeMap *typeMap)
: definitions(new AllDefinitions(refMap, typeMap)) {
passes.push_back(new ComputeWriteSet(definitions));
passes.push_back(new FindUninitialized(definitions, &hasUses));
ProcessDefUse(ReferenceMap *refMap, TypeMap *typeMap) : definitions(refMap, typeMap) {
passes.push_back(new ComputeWriteSet(&definitions));
passes.push_back(new FindUninitialized(&definitions, &hasUses));
passes.push_back(new RemoveUnused(&hasUses, refMap, typeMap));
setName("ProcessDefUse");
}
Expand Down