Prevent the scalarizer from caching incorrect entries
authorFraser Cormack <fraser@codeplay.com>
Mon, 10 Aug 2015 14:48:47 +0000 (14:48 +0000)
committerFraser Cormack <fraser@codeplay.com>
Mon, 10 Aug 2015 14:48:47 +0000 (14:48 +0000)
commite29ab2bfabd12d06214a4a516ea9a2d44b5f1a0b
tree634d99fc10b32962a3e3a1916b64ecd7101074e8
parent94515abfd743a965cff9799979fcb72364f863b7
Prevent the scalarizer from caching incorrect entries

The scalarizer can cache incorrect entries when walking up a chain of
insertelement instructions. This occurs when it encounters more than one
instruction that it is not actively searching for, as it unconditionally caches
every element it finds. The fix is to only cache the first element that it
isn't searching for so we don't overwrite correct entries.

Reviewers: hfinkel

Differential Revision: http://reviews.llvm.org/D11559

llvm-svn: 244448
llvm/lib/Transforms/Scalar/Scalarizer.cpp
llvm/test/Transforms/Scalarizer/cache-bug.ll [new file with mode: 0644]