[OpaquePtr][ValueTracking] Check GEP source element type in isPointerOffset()
authorArthur Eubanks <aeubanks@google.com>
Sun, 13 Feb 2022 01:37:20 +0000 (17:37 -0800)
committerArthur Eubanks <aeubanks@google.com>
Sun, 13 Feb 2022 18:35:38 +0000 (10:35 -0800)
commita9029a33ffe5cd458b51b18f7faf5d1c844f4bb4
tree551d1331ed0a8a15fab9a6494b440f41d24963ec
parentd5f7ae7bfe3f3cb5dbc6ec4e8f3c88de41d72cd7
[OpaquePtr][ValueTracking] Check GEP source element type in isPointerOffset()

Fixes a MemCpyOpt miscompile with opaque pointers.
This function can be further cleaned up, but let's just fix the miscompile first.

Reviewed By: #opaque-pointers, nikic

Differential Revision: https://reviews.llvm.org/D119652
llvm/lib/Analysis/ValueTracking.cpp
llvm/test/Transforms/MemCpyOpt/opaque-ptr.ll