llvm-6502/lib
Chandler Carruth b3dca3f50e Revert the business end of r164636 and try again. I'll come in again. ;]
This should really, really fix PR13916. For real this time. The
underlying bug is... a bit more subtle than I had imagined.

The setup is a code pattern that leads to an @llvm.memcpy call with two
equal pointers to an alloca in the source and dest. Now, not any pattern
will do. The alloca needs to be formed just so, and both pointers should
be wrapped in different bitcasts etc. When this precise pattern hits,
a funny sequence of events transpires. First, we correctly detect the
potential for overlap, and correctly optimize the memcpy. The first
time. However, we do simplify the set of users of the alloca, and that
causes us to run the alloca back through the SROA pass in case there are
knock-on simplifications. At this point, a curious thing has happened.
If we happen to have an i8 alloca, we have direct i8 pointer values. So
we don't bother creating a cast, we rewrite the arguments to the memcpy
to dircetly refer to the alloca.

Now, in an unrelated area of the pass, we have clever logic which
ensures that when visiting each User of a particular pointer derived
from an alloca, we only visit that User once, and directly inspect all
of its operands which refer to that particular pointer value. However,
the mechanism used to detect memcpy's with the potential to overlap
relied upon getting visited once per *Use*, not once per *User*. This is
always true *unless* the same exact value is both source and dest. It
turns out that almost nothing actually produces that pattern though.

We can hand craft test cases that more directly test this behavior of
course, and those are included. Also, note that there is a significant
missed optimization here -- we prove in many cases that there is
a non-volatile memcpy call with identical source and dest addresses. We
shouldn't prevent splitting the alloca in that case, and in fact we
should just remove such memcpy calls eagerly. I'll address that in
a subsequent commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164669 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-26 07:41:40 +00:00
..
Analysis Change the way the lint sanity checking pass detects misaligned memory accesses. 2012-09-25 10:00:49 +00:00
Archive Mark checkSignature const, and in turn stop casting away const from 2012-09-05 22:09:23 +00:00
AsmParser Encapsulate the "construct*AlignmentFromInt" functions. 2012-09-21 16:07:28 +00:00
Bitcode Move remaining methods inside the Attributes class. Merge the 'Attribute' namespaces. 2012-09-25 20:57:48 +00:00
CodeGen Rename virtual table anchors from Anchor() to anchor() for consistency with the rest of the tree. 2012-09-26 06:36:36 +00:00
DebugInfo Mark unimplemented copy constructors and copy assignment operators as LLVM_DELETED_FUNCTION. 2012-09-18 02:01:41 +00:00
ExecutionEngine Mark unimplemented copy constructors and copy assignment operators as LLVM_DELETED_FUNCTION. 2012-09-18 02:01:41 +00:00
Linker
MC Rename virtual table anchors from Anchor() to anchor() for consistency with the rest of the tree. 2012-09-26 06:36:36 +00:00
Object
Support Fix a -Wparentheses warning in the mingw build 2012-09-25 05:24:16 +00:00
TableGen De-nest if's and fix mix-up 2012-09-19 02:14:59 +00:00
Target Remove hasNoAVX method. Can just invert hasAVX instead. 2012-09-26 06:29:37 +00:00
Transforms Revert the business end of r164636 and try again. I'll come in again. ;] 2012-09-26 07:41:40 +00:00
VMCore Replace calls to getSizeInBits with getExtendedSizeInBits since its already known its an extended type. 2012-09-26 07:11:42 +00:00
CMakeLists.txt
LLVMBuild.txt
Makefile