This picks up the patch from https://reviews.llvm.org/D23470 and updates it to address the review feedback provided there.
This is a very simple patch that just hooks up memcpyopt's existing logic for optimizing memcpys, which already uses memdep, to memdep's existing logic for doing non-local queries. This notably allows it to eliminate many more llvm.memcpy calls in common Rust code, often by 20-30%.
Would it be better to call this getNonLocalPointerDependencyFrom, in line with getPointerDependencyFrom?