[llvm-branch-commits] [llvm-branch] r245457 - Merging r244448:
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Aug 19 09:43:16 PDT 2015
Author: hans
Date: Wed Aug 19 11:43:16 2015
New Revision: 245457
URL: http://llvm.org/viewvc/llvm-project?rev=245457&view=rev
Log:
Merging r244448:
------------------------------------------------------------------------
r244448 | fcormack | 2015-08-10 07:48:47 -0700 (Mon, 10 Aug 2015) | 12 lines
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
------------------------------------------------------------------------
Added:
llvm/branches/release_37/test/Transforms/Scalarizer/cache-bug.ll
- copied unchanged from r244448, llvm/trunk/test/Transforms/Scalarizer/cache-bug.ll
Modified:
llvm/branches/release_37/ (props changed)
llvm/branches/release_37/lib/Transforms/Scalar/Scalarizer.cpp
Propchange: llvm/branches/release_37/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Aug 19 11:43:16 2015
@@ -1,3 +1,3 @@
/llvm/branches/Apple/Pertwee:110850,110961
/llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,242236,242239,242281,242288,242296,242331,242341,242410,242412,242433-242434,242442,242543,242673,242680,242706,242721-242722,242733-242735,242742,242869,242919,242993,243001,243057,243116,243263,243294,243361,243469,243485,243500,243519,243531,243589,243609,243636,243638-243640,243745,243891,243898,243927,243932,243934,243984,243986,243999,244058,244123,244232,244332,244418,244554,244644,244659,244676,244789,244889,245064,245105,245119,245256,245355
+/llvm/trunk:155241,242236,242239,242281,242288,242296,242331,242341,242410,242412,242433-242434,242442,242543,242673,242680,242706,242721-242722,242733-242735,242742,242869,242919,242993,243001,243057,243116,243263,243294,243361,243469,243485,243500,243519,243531,243589,243609,243636,243638-243640,243745,243891,243898,243927,243932,243934,243984,243986,243999,244058,244123,244232,244332,244418,244448,244554,244644,244659,244676,244789,244889,245064,245105,245119,245256,245355
Modified: llvm/branches/release_37/lib/Transforms/Scalar/Scalarizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_37/lib/Transforms/Scalar/Scalarizer.cpp?rev=245457&r1=245456&r2=245457&view=diff
==============================================================================
--- llvm/branches/release_37/lib/Transforms/Scalar/Scalarizer.cpp (original)
+++ llvm/branches/release_37/lib/Transforms/Scalar/Scalarizer.cpp Wed Aug 19 11:43:16 2015
@@ -227,10 +227,16 @@ Value *Scatterer::operator[](unsigned I)
if (!Idx)
break;
unsigned J = Idx->getZExtValue();
- CV[J] = Insert->getOperand(1);
V = Insert->getOperand(0);
- if (I == J)
+ if (I == J) {
+ CV[J] = Insert->getOperand(1);
return CV[J];
+ } else if (!CV[J]) {
+ // Only cache the first entry we find for each index we're not actively
+ // searching for. This prevents us from going too far up the chain and
+ // caching incorrect entries.
+ CV[J] = Insert->getOperand(1);
+ }
}
CV[I] = Builder.CreateExtractElement(V, Builder.getInt32(I),
V->getName() + ".i" + Twine(I));
More information about the llvm-branch-commits
mailing list