ObjCARC: Drop pointer bitcast handling (#134274)

There is more in the file to drop, but this looks like the easier
part.
This commit is contained in:
Matt Arsenault 2025-04-08 07:23:00 +07:00 committed by GitHub
parent d7354e337a
commit 1f359610b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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,