Skip to content

LowerGlobalDtors: Use use_empty instead of getNumUses == 0 #136337

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

Merged
merged 1 commit into from
Apr 18, 2025

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Apr 18, 2025

No description provided.

@arsenm arsenm marked this pull request as ready for review April 18, 2025 18:09
Copy link
Contributor Author

arsenm commented Apr 18, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@llvmbot
Copy link
Member

llvmbot commented Apr 18, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Matt Arsenault (arsenm)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/136337.diff

1 Files Affected:

  • (modified) llvm/lib/Transforms/Utils/LowerGlobalDtors.cpp (+1-1)
diff --git a/llvm/lib/Transforms/Utils/LowerGlobalDtors.cpp b/llvm/lib/Transforms/Utils/LowerGlobalDtors.cpp
index ff72ba073ad0e..df3a2a94b7ddb 100644
--- a/llvm/lib/Transforms/Utils/LowerGlobalDtors.cpp
+++ b/llvm/lib/Transforms/Utils/LowerGlobalDtors.cpp
@@ -146,7 +146,7 @@ static bool runImpl(Module &M) {
   // the program never exits) we can simply return early and clear out
   // @llvm.global_dtors.
   if (auto F = dyn_cast<Function>(AtExit.getCallee())) {
-    if (F && F->hasExactDefinition() && F->getArg(0)->getNumUses() == 0) {
+    if (F && F->hasExactDefinition() && F->getArg(0)->use_empty()) {
       GV->eraseFromParent();
       return true;
     }

Copy link
Contributor Author

arsenm commented Apr 18, 2025

Merge activity

  • Apr 18, 3:16 PM EDT: A user started a stack merge that includes this pull request via Graphite.
  • Apr 18, 3:18 PM EDT: A user merged this pull request with Graphite.

@arsenm arsenm merged commit 34f3466 into main Apr 18, 2025
15 checks passed
@arsenm arsenm deleted the users/arsenm/lower-global-dtors/use-use-empty branch April 18, 2025 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants