Skip to content

AArch64: Use use_empty instead of getNumUses == 0 #136356

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.

Copy link
Contributor Author

arsenm commented Apr 18, 2025

@arsenm arsenm marked this pull request as ready for review April 18, 2025 19:24
@llvmbot
Copy link
Member

llvmbot commented Apr 18, 2025

@llvm/pr-subscribers-backend-aarch64

Author: Matt Arsenault (arsenm)

Changes

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

1 Files Affected:

  • (modified) llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp (+4-4)
diff --git a/llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp b/llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp
index 9cb790b99f1de..da9d8d0f8e290 100644
--- a/llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp
+++ b/llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp
@@ -328,9 +328,9 @@ bool SVEIntrinsicOpts::optimizePredicateStore(Instruction *I) {
   Builder.CreateStore(BitCast->getOperand(0), Store->getPointerOperand());
 
   Store->eraseFromParent();
-  if (IntrI->getNumUses() == 0)
+  if (IntrI->use_empty())
     IntrI->eraseFromParent();
-  if (BitCast->getNumUses() == 0)
+  if (BitCast->use_empty())
     BitCast->eraseFromParent();
 
   return true;
@@ -386,9 +386,9 @@ bool SVEIntrinsicOpts::optimizePredicateLoad(Instruction *I) {
 
   BitCast->replaceAllUsesWith(LoadPred);
   BitCast->eraseFromParent();
-  if (IntrI->getNumUses() == 0)
+  if (IntrI->use_empty())
     IntrI->eraseFromParent();
-  if (Load->getNumUses() == 0)
+  if (Load->use_empty())
     Load->eraseFromParent();
 
   return true;

Copy link
Contributor Author

arsenm commented Apr 18, 2025

Merge activity

  • Apr 18, 5:19 PM EDT: A user started a stack merge that includes this pull request via Graphite.
  • Apr 18, 5:30 PM EDT: Graphite rebased this pull request as part of a merge.
  • Apr 18, 5:33 PM EDT: Graphite rebased this pull request as part of a merge.
  • Apr 18, 5:35 PM EDT: A user merged this pull request with Graphite.

@arsenm arsenm force-pushed the users/arsenm/arm/avoid-using-getNumUses branch from 91c34f4 to fe3ec00 Compare April 18, 2025 21:26
Base automatically changed from users/arsenm/arm/avoid-using-getNumUses to main April 18, 2025 21:29
@arsenm arsenm force-pushed the users/arsenm/aarch64/use-empty-avoid-getNumUses branch from 0e3d957 to 035e3d7 Compare April 18, 2025 21:30
@arsenm arsenm force-pushed the users/arsenm/aarch64/use-empty-avoid-getNumUses branch from 035e3d7 to 50b9104 Compare April 18, 2025 21:32
@arsenm arsenm merged commit 0baa0b3 into main Apr 18, 2025
6 of 10 checks passed
@arsenm arsenm deleted the users/arsenm/aarch64/use-empty-avoid-getNumUses branch April 18, 2025 21:35
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
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.

3 participants