Skip to content

ObjCARC: Drop pointer bitcast handling #134274

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 8, 2025

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Apr 3, 2025

There is more in the file to drop, but this looks like the easier
part.

@arsenm arsenm added the objective-c label Apr 3, 2025 — with Graphite App
@arsenm arsenm marked this pull request as ready for review April 3, 2025 16:53
@llvmbot
Copy link
Member

llvmbot commented Apr 3, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Matt Arsenault (arsenm)

Changes

There is more in the file to drop, but this looks like the easier
part.


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

1 Files Affected:

  • (modified) llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp (-19)
diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp
index 311d3b1cfc0a0..e11748b2c9dbb 100644
--- a/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp
+++ b/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp
@@ -660,7 +660,6 @@ bool ObjCARCContract::run(Function &F, AAResults *A, DominatorTree *D) {
     };
 
     Value *Arg = cast<CallInst>(Inst)->getArgOperand(0);
-    Value *OrigArg = Arg;
 
     // TODO: Change this to a do-while.
     for (;;) {
@@ -687,24 +686,6 @@ bool ObjCARCContract::run(Function &F, AAResults *A, DominatorTree *D) {
         break;
       }
     }
-
-    // Replace bitcast users of Arg that are dominated by Inst.
-    SmallVector<BitCastInst *, 2> BitCastUsers;
-
-    // Add all bitcast users of the function argument first.
-    for (User *U : OrigArg->users())
-      if (auto *BC = dyn_cast<BitCastInst>(U))
-        BitCastUsers.push_back(BC);
-
-    // Replace the bitcasts with the call return. Iterate until list is empty.
-    while (!BitCastUsers.empty()) {
-      auto *BC = BitCastUsers.pop_back_val();
-      for (User *U : BC->users())
-        if (auto *B = dyn_cast<BitCastInst>(U))
-          BitCastUsers.push_back(B);
-
-      ReplaceArgUses(BC);
-    }
   }
 
   // If this function has no escaping allocas or suspicious vararg usage,

There is more in the file to drop, but this looks like the easier
part.
Copy link
Contributor

@fhahn fhahn left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

Copy link
Contributor Author

arsenm commented Apr 8, 2025

Merge activity

  • Apr 7, 8:21 PM EDT: A user started a stack merge that includes this pull request via Graphite.
  • Apr 7, 8:23 PM EDT: A user merged this pull request with Graphite.

@arsenm arsenm merged commit 1f35961 into main Apr 8, 2025
11 checks passed
@arsenm arsenm deleted the users/arsenm/objc-arc-drop-pointer-bitcast-handling branch April 8, 2025 00:23
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