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

[MLIR][Flang][OpenMP] Remove unused global variables in offload target module #97

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

DominikAdamski
Copy link

No description provided.

@DominikAdamski DominikAdamski changed the title [WIP][MLIR][Flang][OpenMP] Remove unused global variables in offload target module [MLIR][Flang][OpenMP] Remove unused global variables in offload target module Jun 5, 2024
Copy link

@skatrak skatrak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Dominik, this looks good. It seems like it should work for deleting globals only used inside of host functions with no target regions, since these functions are the ones removed by the function filtering pass (hence removing all uses). However, if a global is used in the host part of a function containing a target region then this pass won't delete it, because that host function will remain. Have you thought about this case?

op->walk<WalkOrder::PreOrder>([&](fir::GlobalOp globalOp) {
bool symbolUnused = true;
SymbolTable::UseRange globalUses = *globalOp.getSymbolUses(op);
for (SymbolTable::SymbolUse use : globalUses) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think setting symbolUnused can be simplified by using llvm::any_of() instead of this loop.

@DominikAdamski DominikAdamski merged commit 87ec30c into ROCm:amd-trunk-dev Jun 21, 2024
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants