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)
commit779046e433004f8b21e672ea7585aa6cb98a3f8d
treecc47d14ba056aa6786cae57f5351daba697dbe4f
parent229544960811680d4f87ab1f9a70d06b04220e0f
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244448 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/Scalarizer.cpp
test/Transforms/Scalarizer/cache-bug.ll [new file with mode: 0644]