I'd argue that in the bad function, because the src and dst pointers are both getelementptr'd from the same pointer, the conditions of LLVM's memcpy are satisfied (the pointers don't alias OR src == dst), hence LLVM should in theory be able to emit a memcpy here. Recognizing this...