Add method for replacing instructions to LibCallSimplifier

In some cases the library call simplifier may need to replace instructions
other than the library call being simplified.  In those cases it may be
necessary for clients of the simplifier to override how the replacements
are actually done.  As such, a new overrideable method for replacing
instructions was added to LibCallSimplifier.

A new subclass of LibCallSimplifier is also defined which overrides
the instruction replacement method.  This is because the instruction
combiner defines its own replacement method which updates the worklist
when instructions are replaced.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167681 91177308-0d34-0410-b5e6-96231b3b80d8
instcombine: Migrate strstr optimizations

This patch migrates the strstr optimizations from the simplify-libcalls
pass into the instcombine library call simplifier.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167682 91177308-0d34-0410-b5e6-96231b3b80d8
instcombine: Migrate memcmp optimizations

This patch migrates the memcmp optimizations from the simplify-libcalls
pass into the instcombine library call simplifier.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167683 91177308-0d34-0410-b5e6-96231b3b80d8
Fix a comment typo and add comments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167684 91177308-0d34-0410-b5e6-96231b3b80d8
Use the isTruncFree and isZExtFree API to figure out of these operations are free. Thanks Andy!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167685 91177308-0d34-0410-b5e6-96231b3b80d8
instcombine: Migrate memcpy optimizations

This patch migrates the memcpy optimizations from the simplify-libcalls
pass into the instcombine library call simplifier.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167686 91177308-0d34-0410-b5e6-96231b3b80d8
instcombine: Migrate memmove optimizations

This patch migrates the memmove optimizations from the simplify-libcalls
pass into the instcombine library call simplifier.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167687 91177308-0d34-0410-b5e6-96231b3b80d8
Update the vectorizer docs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167688 91177308-0d34-0410-b5e6-96231b3b80d8
instcombine: Migrate memset optimizations

This patch migrates the memset optimizations from the simplify-libcalls
pass into the instcombine library call simplifier.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167689 91177308-0d34-0410-b5e6-96231b3b80d8
Remove hard-coded constant in Transforms/InstCombine/memcmp-1.ll

Transforms/InstCombine/memcmp-1.ll has a test case that looks like:

  @foo = constant [4 x i8] c"foo\00"
  @hel = constant [4 x i8] c"hel\00"

  ...

  %mem1 = getelementptr [4 x i8]* @hel, i32 0, i32 0
  %mem2 = getelementptr [4 x i8]* @foo, i32 0, i32 0
  %ret = call i32 @memcmp(i8* %mem1, i8* %mem2, i32 3)
  ret i32 %ret
  ; CHECK: ret i32 2

The folded return value (2 above) is computed using the system memcmp
that the compiler is linked with.  This can return different values on
different systems.  The test was originally written on an OS X 10.7.5
x86-64 box and passed.  However, it failed on one of the x86-64 FreeBSD
buildbots because the system memcpy on that machine returned a different
value (1 instead of 2).

I fixed the test by checking the folding constants with regexes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167691 91177308-0d34-0410-b5e6-96231b3b80d8
Move some helper methods to being static functions in the implementation file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167696 91177308-0d34-0410-b5e6-96231b3b80d8
Delete a stale comment.  No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167698 91177308-0d34-0410-b5e6-96231b3b80d8
[NVPTX] Add more precise PTX/SM target attributes

Each SM and PTX version is modeled as a subtarget feature/CPU. Additionally,
PTX 3.1 is added as the default PTX version to be out-of-the-box compatible
with CUDA 5.0.

Available CPUs for this target:

  sm_10 - Select the sm_10 processor.
  sm_11 - Select the sm_11 processor.
  sm_12 - Select the sm_12 processor.
  sm_13 - Select the sm_13 processor.
  sm_20 - Select the sm_20 processor.
  sm_21 - Select the sm_21 processor.
  sm_30 - Select the sm_30 processor.
  sm_35 - Select the sm_35 processor.

Available features for this target:

  ptx30 - Use PTX version 3.0.
  ptx31 - Use PTX version 3.1.
  sm_10 - Target SM 1.0.
  sm_11 - Target SM 1.1.
  sm_12 - Target SM 1.2.
  sm_13 - Target SM 1.3.
  sm_20 - Target SM 2.0.
  sm_21 - Target SM 2.1.
  sm_30 - Target SM 3.0.
  sm_35 - Target SM 3.5.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167699 91177308-0d34-0410-b5e6-96231b3b80d8
Add --enable-werror and --enable-cxx11 to projects/sample/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167716 91177308-0d34-0410-b5e6-96231b3b80d8
Fix PR14314

- Fix operand order for atomic sub, where the minuend is the value
  loaded from memory and the subtrahend is the parameter specified.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167718 91177308-0d34-0410-b5e6-96231b3b80d8
Remove unused field.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167719 91177308-0d34-0410-b5e6-96231b3b80d8
add unit test for waymarking algorithm (Use::getUser)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167720 91177308-0d34-0410-b5e6-96231b3b80d8
[ASan] Add llvm-symbolizer from to tools/
This is the second and last (2/2) part of a change that moves llvm-symbolizer to llvm/tools/, which will allow to build it
with both cmake and configure+make.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167723 91177308-0d34-0410-b5e6-96231b3b80d8
do not play preprocessor tricks with 'private', use public interfaces instead; this appeases the VC++ buildbots

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167724 91177308-0d34-0410-b5e6-96231b3b80d8
[ASan]: Add minimalistic support for turning off initialization-order checking for globals of specified types. Tests for this behavior will go to ASan test suite in compiler-rt.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167725 91177308-0d34-0410-b5e6-96231b3b80d8