[llvm] ObjCARCContract: Use stripPointerCastsAndAliases (PR #134275)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 11 00:47:33 PDT 2025


arsenm wrote:

> Is this supposed to be a NFC patch?

Yes. This is code that's plainly reinventing a common helper function 

> 
> With the changes in this patch, the pass no longer rewrites the argument to the second call to `use_pointer` in the following IR:
> 
> ```
> define void @test0(ptr %x) {
>   %y = getelementptr inbounds ptr, ptr %x, i32 0
>   %v0 = call ptr @llvm.objc.retain(ptr %y) nounwind
>   call void @use_pointer(ptr %x)
>   call void @use_pointer(ptr %y)
>   ret void
> }
> ```

Missing test coverage. I'm assuming this loop is not properly tested. Can you push this to fix the gaps?  


> 
> This is a contrived example and maybe it's okay if we know that clang/llvm never generates IR like this in practice. But I'd like to understand what assumptions you are making about the IR that's fed to this pass.

My only assumption is the lit test suite is adequate to cover all of the functionality exercised in the code

https://github.com/llvm/llvm-project/pull/134275


More information about the llvm-commits mailing list