When eliminating a pair of
llvm.objc.autoreleaseReturnValue
followed by
llvm.objc.retainAutoreleasedReturnValue
we need to make sure that the instructions in between are safe to ignore.
Other than bitcasts and useless GEPs, it's also safe to ignore lifetime markers for both static allocas (lifetime.start/lifetime.end) and dynamic allocas (stacksave/stackrestore).
These get added by the inliner as part of the return sequence and can prevent the transformation from happening in practice.
isSafeBetweenRVCalls also checks IsNoopInstruction.