Skip to content

ARM: Avoid using getNumUses #136355

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
Merged

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-arm

Author: Matt Arsenault (arsenm)

Changes

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

1 Files Affected:

  • (modified) llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp (+3-3)
diff --git a/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp b/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp
index 7efd2989aa7fa..b97ad5ad5e9ee 100644
--- a/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp
+++ b/llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp
@@ -808,7 +808,7 @@ Instruction *MVEGatherScatterLowering::tryCreateIncrementingWBGatScat(
   // by a constant, thus we're looking for an add of a phi and a constant
   PHINode *Phi = dyn_cast<PHINode>(Offsets);
   if (Phi == nullptr || Phi->getNumIncomingValues() != 2 ||
-      Phi->getParent() != L->getHeader() || Phi->getNumUses() != 2)
+      Phi->getParent() != L->getHeader() || !Phi->hasNUses(2))
     // No phi means no IV to write back to; if there is a phi, we expect it
     // to have exactly two incoming values; the only phis we are interested in
     // will be loop IV's and have exactly two uses, one in their increment and
@@ -1051,10 +1051,10 @@ bool MVEGatherScatterLowering::optimiseOffsets(Value *Offsets, BasicBlock *BB,
   // If the phi is not used by anything else, we can just adapt it when
   // replacing the instruction; if it is, we'll have to duplicate it
   PHINode *NewPhi;
-  if (Phi->getNumUses() == 2) {
+  if (Phi->hasNUses(2)) {
     // No other users -> reuse existing phi (One user is the instruction
     // we're looking at, the other is the phi increment)
-    if (IncInstruction->getNumUses() != 1) {
+    if (!IncInstruction->hasOneUse()) {
       // If the incrementing instruction does have more users than
       // our phi, we need to copy it
       IncInstruction = BinaryOperator::Create(

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:27 PM EDT: Graphite rebased this pull request as part of a merge.
  • Apr 18, 5:29 PM EDT: A user merged this pull request with Graphite.

@arsenm arsenm force-pushed the users/arsenm/complex-deinterleaving/avoid-getNumUses branch 2 times, most recently from 87c5752 to c24373d Compare April 18, 2025 21:23
Base automatically changed from users/arsenm/complex-deinterleaving/avoid-getNumUses to main April 18, 2025 21:26
@arsenm arsenm force-pushed the users/arsenm/arm/avoid-using-getNumUses branch from 91c34f4 to fe3ec00 Compare April 18, 2025 21:26
@arsenm arsenm merged commit 540ea4d into main Apr 18, 2025
6 of 10 checks passed
@arsenm arsenm deleted the users/arsenm/arm/avoid-using-getNumUses branch April 18, 2025 21:29
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