[ValueTracking] Improve pointer offset computation for cases of same base
authorRong Xu <xur@google.com>
Thu, 10 Oct 2019 21:30:43 +0000 (21:30 +0000)
committerRong Xu <xur@google.com>
Thu, 10 Oct 2019 21:30:43 +0000 (21:30 +0000)
commit686fa4bbfbce034484fee8616d9ec7c29ed96410
treefc74f31061b9df30f4b6ec5cfc362aaca083c8e8
parent8bd42769816ad339bf64ae5ef72078739ed488a9
[ValueTracking] Improve pointer offset computation for cases of same base

This patch improves the handling of pointer offset in GEP expressions where
one argument is the base pointer. isPointerOffset() is being used by memcpyopt
where current code synthesizes consecutive 32 bytes stores to one store and
two memset intrinsic calls. With this patch, we convert the stores to one
memset intrinsic.

Differential Revision: https://reviews.llvm.org/D67989

llvm-svn: 374454
llvm/lib/Analysis/ValueTracking.cpp
llvm/test/Transforms/MemCpyOpt/store-to-memset.ll [new file with mode: 0644]