oota-llvm.git
11 years agoRelax the restrictions on vector of pointer types, and vector getelementptr.
Duncan Sands [Tue, 13 Nov 2012 12:59:33 +0000 (12:59 +0000)]
Relax the restrictions on vector of pointer types, and vector getelementptr.
Previously in a vector of pointers, the pointer couldn't be any pointer type,
it had to be a pointer to an integer or floating point type.  This is a hassle
for dragonegg because the GCC vectorizer happily produces vectors of pointers
where the pointer is a pointer to a struct or whatever.  Vector getelementptr
was restricted to just one index, but now that vectors of pointers can have
any pointer type it is more natural to allow arbitrary vector getelementptrs.
There is however the issue of struct GEPs, where if each lane chose different
struct fields then from that point on each lane will be working down into
unrelated types.  This seems like too much pain for too little gain, so when
you have a vector struct index all the elements are required to be the same.

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

11 years agoDependenceAnalysis: Print all dependency pairs when dumping. Update all testcases.
Benjamin Kramer [Tue, 13 Nov 2012 12:12:02 +0000 (12:12 +0000)]
DependenceAnalysis: Print all dependency pairs when dumping. Update all testcases.

Part of a patch by Preston Briggs.

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

11 years agomisched: Allow subtargets to enable misched and dependent options.
Andrew Trick [Tue, 13 Nov 2012 08:47:29 +0000 (08:47 +0000)]
misched: Allow subtargets to enable misched and dependent options.

This allows me to begin enabling (or backing out) misched by default
for one subtarget at a time. To run misched we typically want to:
- Disable SelectionDAG scheduling (use the source order scheduler)
- Enable more aggressive coalescing (until we decide to always run the coalescer this way)
- Enable MachineScheduler pass itself.

Disabling PostRA sched may follow for some subtargets.

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

11 years agoAdded RegisterCoalescer support for joining global copies first.
Andrew Trick [Tue, 13 Nov 2012 08:47:25 +0000 (08:47 +0000)]
Added RegisterCoalescer support for joining global copies first.

This adds the -join-globalcopies option which can be enabled by
default once misched is also enabled.

Ideally, the register coalescer would be able to split local live
ranges in a way that produces copies that can be easily resolved by
the scheduler. Until then, this heuristic should be good enough to at
least allow the scheduler to run after coalescing.

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

11 years agoFigure out <size> argument of llvm.lifetime intrinsics at the moment they are created...
Alexey Samsonov [Tue, 13 Nov 2012 07:15:32 +0000 (07:15 +0000)]
Figure out <size> argument of llvm.lifetime intrinsics at the moment they are created (during function inlining)

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

11 years agoTest commit.
Jyotsna Verma [Tue, 13 Nov 2012 06:31:55 +0000 (06:31 +0000)]
Test commit.
Add a blank line.

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

11 years agoBBVectorize: Remove temporary assert used for debugging
Hal Finkel [Tue, 13 Nov 2012 05:54:54 +0000 (05:54 +0000)]
BBVectorize: Remove temporary assert used for debugging

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

11 years agoinstcombine: Migrate math library call simplifications
Meador Inge [Tue, 13 Nov 2012 04:16:17 +0000 (04:16 +0000)]
instcombine: Migrate math library call simplifications

This patch migrates the math library call simplifications from the
simplify-libcalls pass into the instcombine library call simplifier.

I have typically migrated just one simplifier at a time, but the math
simplifiers are interdependent because:

   1. CosOpt, PowOpt, and Exp2Opt all depend on UnaryDoubleFPOpt.
   2. CosOpt, PowOpt, Exp2Opt, and UnaryDoubleFPOpt all depend on
      the option -enable-double-float-shrink.

These two factors made migrating each of these simplifiers individually
more of a pain than it would be worth.  So, I migrated them all together.

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

11 years agoRemove virtual keyword for two routines that should never be overridden.
Evan Cheng [Tue, 13 Nov 2012 03:14:16 +0000 (03:14 +0000)]
Remove virtual keyword for two routines that should never be overridden.

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

11 years agoBBVectorize: Don't vectorize vector-manipulation chains
Hal Finkel [Tue, 13 Nov 2012 03:12:40 +0000 (03:12 +0000)]
BBVectorize: Don't vectorize vector-manipulation chains

Don't choose a vectorization plan containing only shuffles and
vector inserts/extracts. Due to inperfections in the cost model,
these can lead to infinite recusion.

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

11 years agoRevert r167759. Ben is right this isn't likely to help much.
Evan Cheng [Tue, 13 Nov 2012 02:56:38 +0000 (02:56 +0000)]
Revert r167759. Ben is right this isn't likely to help much.

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

11 years agomisched: Don't consider artificial edges weak edges.
Andrew Trick [Tue, 13 Nov 2012 02:35:06 +0000 (02:35 +0000)]
misched: Don't consider artificial edges weak edges.

For now be more conservative in case other out-of-tree schedulers rely
on the old behavior of artificial edges.

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

11 years agoUse the 'count' attribute instead of the 'upper_bound' attribute.
Bill Wendling [Tue, 13 Nov 2012 02:31:47 +0000 (02:31 +0000)]
Use the 'count' attribute instead of the 'upper_bound' attribute.

If we have a type 'int a[1]' and a type 'int b[0]', the generated DWARF is the
same for both of them because we use the 'upper_bound' attribute. Instead use
the 'count' attrbute, which gives the correct number of elements in the array.
<rdar://problem/12566646>

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

11 years agoCleanup the main RegisterCoalescer loop.
Andrew Trick [Tue, 13 Nov 2012 00:34:44 +0000 (00:34 +0000)]
Cleanup the main RegisterCoalescer loop.

Block priorities still apply outside loops.

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

11 years agorevert r167740
Shuxin Yang [Tue, 13 Nov 2012 00:08:49 +0000 (00:08 +0000)]
revert r167740

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

11 years agoCleanup -join-splitedges. Make the loop more obvious.
Andrew Trick [Mon, 12 Nov 2012 23:59:48 +0000 (23:59 +0000)]
Cleanup -join-splitedges. Make the loop more obvious.

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

11 years agoBBVectorize: Only some insert element operand pairs are free.
Hal Finkel [Mon, 12 Nov 2012 23:55:36 +0000 (23:55 +0000)]
BBVectorize: Only some insert element operand pairs are free.

This fixes another infinite recursion case when using target costs.
We can only replace insert element input chains that are pure (end
with inserting into an undef).

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

11 years agoUpdate link to external document
Jean-Daniel Dupas [Mon, 12 Nov 2012 23:43:34 +0000 (23:43 +0000)]
Update link to external document

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

11 years agoFix test case added in patch fixing PR14314
Michael Liao [Mon, 12 Nov 2012 22:33:18 +0000 (22:33 +0000)]
Fix test case added in patch fixing PR14314

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

11 years agoAdd an option to enable prototype "fission" capabilities and debug changes.
Eric Christopher [Mon, 12 Nov 2012 22:22:20 +0000 (22:22 +0000)]
Add an option to enable prototype "fission" capabilities and debug changes.

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

11 years agoUpdate test case for r167754/r167755.
Chad Rosier [Mon, 12 Nov 2012 21:51:08 +0000 (21:51 +0000)]
Update test case for r167754/r167755.

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

11 years agoCache size of PassVector to speed up getNumContainedPasses().
Evan Cheng [Mon, 12 Nov 2012 21:42:53 +0000 (21:42 +0000)]
Cache size of PassVector to speed up getNumContainedPasses().
getNumContainedPasses() used to compute the size of the vector on demand. It is
called repeated in loops (such as runOnFunction()) and it can be updated while
inside the loop.

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

11 years agoAdded a temporary option to avoid critical edges splitting.
Andrew Trick [Mon, 12 Nov 2012 21:42:40 +0000 (21:42 +0000)]
Added a temporary option to avoid critical edges splitting.

This teaches the register coalescer to be less prone to split critical
edges. I am currently benchmarking this with the new (post-coalescer)
scheduler. I plan to enable this by default and remove the option as
soon as misched is enabled.

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

11 years agoRewrite DIContext interface to take an object. Update all callers.
Eric Christopher [Mon, 12 Nov 2012 21:40:38 +0000 (21:40 +0000)]
Rewrite DIContext interface to take an object. Update all callers.

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

11 years agoRevert r167620; this can be implemented using an existing CL option.
Chad Rosier [Mon, 12 Nov 2012 21:32:44 +0000 (21:32 +0000)]
Revert r167620; this can be implemented using an existing CL option.

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

11 years agomisched: rename interfaceto avoid gcc warnings
Andrew Trick [Mon, 12 Nov 2012 21:28:10 +0000 (21:28 +0000)]
misched: rename interfaceto avoid gcc warnings

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

11 years agoBBVectorize: Use a more sophisticated check for input cost
Hal Finkel [Mon, 12 Nov 2012 21:21:02 +0000 (21:21 +0000)]
BBVectorize: Use a more sophisticated check for input cost

The old checking code, which assumed that input shuffles and insert-elements
could always be folded (and thus were free) is too simple.
This can only happen in special circumstances.
Using the simple check caused infinite recursion.

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

11 years agomisched: Target-independent support for MacroFusion.
Andrew Trick [Mon, 12 Nov 2012 19:52:20 +0000 (19:52 +0000)]
misched: Target-independent support for MacroFusion.

Uses the infrastructure from r167742 to support clustering instructure
that the target processor can "fuse". e.g. cmp+jmp.

Next step: target hook implementations with test cases, and enable.

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

11 years agoBBVectorize: Check the types of compare instructions
Hal Finkel [Mon, 12 Nov 2012 19:41:38 +0000 (19:41 +0000)]
BBVectorize: Check the types of compare instructions

The pass would previously assert when trying to compute the cost of
compare instructions with illegal vector types (like struct pointers).

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

11 years agomisched: Target-independent support for load/store clustering.
Andrew Trick [Mon, 12 Nov 2012 19:40:10 +0000 (19:40 +0000)]
misched: Target-independent support for load/store clustering.

This infrastructure is generally useful for any target that wants to
strongly prefer two instructions to be adjacent after scheduling.

A following checkin will add target-specific hooks with unit
tests. Then this feature will be enabled by default with misched.

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

11 years agoThis change is to fix rdar://12571717 which is about assertion in Reassociate pass.
Shuxin Yang [Mon, 12 Nov 2012 19:34:11 +0000 (19:34 +0000)]
This change is to fix rdar://12571717 which is about assertion in Reassociate pass.

The assertion is trigged when the Reassociater tries to transform expression
     ... + 2 * n * 3 + 2 * m + ...
  into:
     ... + 2 * (n*3 + m).

In the process of the transformation, a helper routine folds the constant 2*3 into 6,
confusing optimizer which is trying the to eliminate the common factor 2, and cannot
find 2 any more.

Review is pending. But I'd like commit first in order to help those who are waiting
for this fix.

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

11 years agomisched: Infrastructure for weak DAG edges.
Andrew Trick [Mon, 12 Nov 2012 19:28:57 +0000 (19:28 +0000)]
misched: Infrastructure for weak DAG edges.

This adds support for weak DAG edges to the general scheduling
infrastructure in preparation for MachineScheduler support for
heuristics based on weak edges.

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

11 years agoMake TOC order deterministic by using MapVector instead of DenseMap.
Ulrich Weigand [Mon, 12 Nov 2012 19:13:24 +0000 (19:13 +0000)]
Make TOC order deterministic by using MapVector instead of DenseMap.

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

11 years agofix a spelling mistake
Nadav Rotem [Mon, 12 Nov 2012 18:45:12 +0000 (18:45 +0000)]
fix a spelling mistake

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

11 years agoBBVectorize: Check the input types of shuffles for legality
Hal Finkel [Mon, 12 Nov 2012 14:50:59 +0000 (14:50 +0000)]
BBVectorize: Check the input types of shuffles for legality

This fixes a bug where shuffles were being fused such that the
resulting input types were not legal on the target. This would
occur only when both inputs and dependencies were also foldable
operations (such as other shuffles) and there were other connected
pairs in the same block.

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

11 years agoDon't use __cxa_demangle under MSVC (which doesn't have it)
Alexander Potapenko [Mon, 12 Nov 2012 14:49:58 +0000 (14:49 +0000)]
Don't use __cxa_demangle under MSVC (which doesn't have it)

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

11 years ago[ASan] fixup for r167725: Don't fetch name of StructType if it is literal
Alexey Samsonov [Mon, 12 Nov 2012 14:47:00 +0000 (14:47 +0000)]
[ASan] fixup for r167725: Don't fetch name of StructType if it is literal

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

11 years agoFixup for r167558: Store raw pointer (instead of reference) to RelocMap in DIContext...
Alexey Samsonov [Mon, 12 Nov 2012 14:25:36 +0000 (14:25 +0000)]
Fixup for r167558: Store raw pointer (instead of reference) to RelocMap in DIContext. This is needed to prevent crashes because of dangling reference if the clients don't provide RelocMap to DIContext constructor.

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

11 years agoNormalize memcmp constant folding results.
Meador Inge [Mon, 12 Nov 2012 14:00:45 +0000 (14:00 +0000)]
Normalize memcmp constant folding results.

The library call simplifier folds memcmp calls with all constant arguments
to a constant.  For example:

  memcmp("foo", "foo", 3) ->  0
  memcmp("hel", "foo", 3) ->  1
  memcmp("foo", "hel", 3) -> -1

The folding is implemented in terms of the system memcmp that LLVM gets
linked with.  It currently just blindly uses the value returned from
the system memcmp as the folded constant.

This patch normalizes the values returned from the system memcmp to
(-1, 0, 1) so that we get consistent results across multiple platforms.
The test cases were adjusted accordingly.

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

11 years ago[ASan]: Add minimalistic support for turning off initialization-order checking for...
Alexey Samsonov [Mon, 12 Nov 2012 14:00:01 +0000 (14:00 +0000)]
[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

11 years agodo not play preprocessor tricks with 'private', use public interfaces instead; this...
Gabor Greif [Mon, 12 Nov 2012 13:34:59 +0000 (13:34 +0000)]
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

11 years ago[ASan] Add llvm-symbolizer from to tools/
Alexander Potapenko [Mon, 12 Nov 2012 11:33:29 +0000 (11:33 +0000)]
[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

11 years agoadd unit test for waymarking algorithm (Use::getUser)
Gabor Greif [Mon, 12 Nov 2012 10:01:17 +0000 (10:01 +0000)]
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

11 years agoRemove unused field.
Eric Christopher [Mon, 12 Nov 2012 07:35:12 +0000 (07:35 +0000)]
Remove unused field.

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

11 years agoFix PR14314
Michael Liao [Mon, 12 Nov 2012 06:49:17 +0000 (06:49 +0000)]
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

11 years agoAdd --enable-werror and --enable-cxx11 to projects/sample/
Craig Topper [Mon, 12 Nov 2012 06:11:12 +0000 (06:11 +0000)]
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

11 years ago[NVPTX] Add more precise PTX/SM target attributes
Justin Holewinski [Mon, 12 Nov 2012 03:16:43 +0000 (03:16 +0000)]
[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

11 years agoDelete a stale comment. No functional change.
Meador Inge [Mon, 12 Nov 2012 00:28:15 +0000 (00:28 +0000)]
Delete a stale comment.  No functional change.

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

11 years agoMove some helper methods to being static functions in the implementation file.
Craig Topper [Sun, 11 Nov 2012 22:45:02 +0000 (22:45 +0000)]
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

11 years agoRemove hard-coded constant in Transforms/InstCombine/memcmp-1.ll
Meador Inge [Sun, 11 Nov 2012 07:10:25 +0000 (07:10 +0000)]
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

11 years agoinstcombine: Migrate memset optimizations
Meador Inge [Sun, 11 Nov 2012 06:49:03 +0000 (06:49 +0000)]
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

11 years agoUpdate the vectorizer docs.
Nadav Rotem [Sun, 11 Nov 2012 06:47:51 +0000 (06:47 +0000)]
Update the vectorizer docs.

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

11 years agoinstcombine: Migrate memmove optimizations
Meador Inge [Sun, 11 Nov 2012 06:22:40 +0000 (06:22 +0000)]
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

11 years agoinstcombine: Migrate memcpy optimizations
Meador Inge [Sun, 11 Nov 2012 05:54:34 +0000 (05:54 +0000)]
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

11 years agoUse the isTruncFree and isZExtFree API to figure out of these operations are free...
Nadav Rotem [Sun, 11 Nov 2012 05:34:45 +0000 (05:34 +0000)]
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

11 years agoFix a comment typo and add comments.
Nadav Rotem [Sun, 11 Nov 2012 05:15:00 +0000 (05:15 +0000)]
Fix a comment typo and add comments.

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

11 years agoinstcombine: Migrate memcmp optimizations
Meador Inge [Sun, 11 Nov 2012 05:11:20 +0000 (05:11 +0000)]
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

11 years agoinstcombine: Migrate strstr optimizations
Meador Inge [Sun, 11 Nov 2012 03:51:48 +0000 (03:51 +0000)]
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

11 years agoAdd method for replacing instructions to LibCallSimplifier
Meador Inge [Sun, 11 Nov 2012 03:51:43 +0000 (03:51 +0000)]
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

11 years agoProvide definitions for all functions.
Benjamin Kramer [Sat, 10 Nov 2012 16:10:16 +0000 (16:10 +0000)]
Provide definitions for all functions.

ICC refuses to compile a class in an anonymous namespace if some functions
aren't defined. Fixes PR13477.

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

11 years agoinstcombine: Migrate strcspn optimizations
Meador Inge [Sat, 10 Nov 2012 15:16:48 +0000 (15:16 +0000)]
instcombine: Migrate strcspn optimizations

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

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

11 years agoSimplify the SmallVector pretty printer for LLDB a bit and make it work with referenc...
Benjamin Kramer [Sat, 10 Nov 2012 09:45:32 +0000 (09:45 +0000)]
Simplify the SmallVector pretty printer for LLDB a bit and make it work with reference types.

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

11 years agoRemove unnecessary subtraction and addition by 1 around a couple for loops.
Craig Topper [Sat, 10 Nov 2012 09:25:36 +0000 (09:25 +0000)]
Remove unnecessary subtraction and addition by 1 around a couple for loops.

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

11 years agoRemove empty directory.
Duncan Sands [Sat, 10 Nov 2012 09:24:44 +0000 (09:24 +0000)]
Remove empty directory.

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

11 years agoTidy up spacing. No functional change.
Craig Topper [Sat, 10 Nov 2012 09:02:47 +0000 (09:02 +0000)]
Tidy up spacing. No functional change.

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

11 years agoRemoved unimplemented method declaration.
Craig Topper [Sat, 10 Nov 2012 09:00:12 +0000 (09:00 +0000)]
Removed unimplemented method declaration.

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

11 years agoSimplify custom emitter code for pcmp(e/i)str(i/m) and make the helper functions...
Craig Topper [Sat, 10 Nov 2012 08:57:41 +0000 (08:57 +0000)]
Simplify custom emitter code for pcmp(e/i)str(i/m) and make the helper functions static.

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

11 years agoConvert an improper CodeGen test to a MC test.
Evan Cheng [Sat, 10 Nov 2012 04:30:40 +0000 (04:30 +0000)]
Convert an improper CodeGen test to a MC test.

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

11 years agoinstcombine: Query target library information to gate libcall simplifications
Meador Inge [Sat, 10 Nov 2012 03:11:10 +0000 (03:11 +0000)]
instcombine: Query target library information to gate libcall simplifications

Several of the simplifiers migrated from the simplify-libcalls pass to
the instcombine pass were not correctly checking the target library
information to gate the simplifications.  This patch ensures that the
check is made.

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

11 years agoAdd more functions to the target library information.
Meador Inge [Sat, 10 Nov 2012 03:11:06 +0000 (03:11 +0000)]
Add more functions to the target library information.

In the process of migrating optimizations from the simplify-libcalls pass
to the instcombine pass I noticed that a few functions are missing from
the target library information.  These functions need to be available for
querying in the instcombine library call simplifiers.  More functions will
probably be added in the future as more simplifiers are migrated to
instcombine.

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

11 years agoxfail a bad test. This is a MC test but it's dependent on a codegen optimization...
Evan Cheng [Sat, 10 Nov 2012 02:34:36 +0000 (02:34 +0000)]
xfail a bad test. This is a MC test but it's dependent on a codegen optimization which is now disabled.

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

11 years agoDisable the Thumb no-return call optimization:
Evan Cheng [Sat, 10 Nov 2012 02:09:05 +0000 (02:09 +0000)]
Disable the Thumb no-return call optimization:
mov lr, pc
b.w _foo

The "mov" instruction doesn't set bit zero to one, it's putting incorrect
value in lr. It messes up backtraces.

rdar://12663632

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

11 years agoCleanup pcmp(e/i)str(m/i) instruction definitions and load folding support.
Craig Topper [Sat, 10 Nov 2012 01:23:36 +0000 (01:23 +0000)]
Cleanup pcmp(e/i)str(m/i) instruction definitions and load folding support.

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

11 years ago[NVPTX] Use ABI alignment for parameters when alignment is not specified.
Justin Holewinski [Fri, 9 Nov 2012 23:50:24 +0000 (23:50 +0000)]
[NVPTX] Use ABI alignment for parameters when alignment is not specified.

Affects SM 2.0+.  Fixes bug 13324.

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

11 years agoFix issue with invalid flat operand number
Evandro Menezes [Fri, 9 Nov 2012 21:27:03 +0000 (21:27 +0000)]
Fix issue with invalid flat operand number

Avoid iterating over list of operands beyond the number of operands in it.

PS: this fixes issue with revision #167634.

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

11 years agoFix issue with invalid flat operand number
Evandro Menezes [Fri, 9 Nov 2012 20:29:37 +0000 (20:29 +0000)]
Fix issue with invalid flat operand number

Avoid iterating over list of operands beyond the number of operands in it.

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

11 years agoAdd ARM TARGET2 relocation. The testcase will follow with actualy use-case.
Anton Korobeynikov [Fri, 9 Nov 2012 20:20:12 +0000 (20:20 +0000)]
Add ARM TARGET2 relocation. The testcase will follow with actualy use-case.
Based on the patch by Logan Chien!

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

11 years agoSwitch FreeBSD/i386 back to 4byte stack alignment. This partially
Roman Divacky [Fri, 9 Nov 2012 20:10:44 +0000 (20:10 +0000)]
Switch FreeBSD/i386 back to 4byte stack alignment. This partially
reverts r126226.

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

11 years agoFix assertions in updateRegMaskSlots().
Jakob Stoklund Olesen [Fri, 9 Nov 2012 19:18:49 +0000 (19:18 +0000)]
Fix assertions in updateRegMaskSlots().

The RegMaskSlots contains 'r' slots while NewIdx and OldIdx are 'B'
slots. This broke the checks in the assertions.

This fixes PR14302.

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

11 years agoRevert r167620; this can be implemented using an existing CL option.
Chad Rosier [Fri, 9 Nov 2012 18:25:27 +0000 (18:25 +0000)]
Revert r167620; this can be implemented using an existing CL option.

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

11 years agoAdd support for -mstrict-align compiler option for ARM targets.
Chad Rosier [Fri, 9 Nov 2012 17:29:38 +0000 (17:29 +0000)]
Add support for -mstrict-align compiler option for ARM targets.
rdar://12340498

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

11 years agoSilence GCC warning about falling off the end of a non-void function.
Benjamin Kramer [Fri, 9 Nov 2012 15:45:22 +0000 (15:45 +0000)]
Silence GCC warning about falling off the end of a non-void function.

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

11 years agotsan: switch to new memory_order constants (ABI compatible)
Dmitry Vyukov [Fri, 9 Nov 2012 14:12:16 +0000 (14:12 +0000)]
tsan: switch to new memory_order constants (ABI compatible)

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

11 years agotsan: instrument all atomics (including fetch_add, exchange, cas, etc)
Dmitry Vyukov [Fri, 9 Nov 2012 12:55:36 +0000 (12:55 +0000)]
tsan: instrument all atomics (including fetch_add, exchange, cas, etc)

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

11 years agoAdd support for memory runtime check. When we can, we calculate array bounds.
Nadav Rotem [Fri, 9 Nov 2012 07:09:44 +0000 (07:09 +0000)]
Add support for memory runtime check. When we can, we calculate array bounds.
If the arrays are found to be disjoint then we run the vectorized version of
the loop. If they are not, we run the scalar code.

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

11 years agoindent
Nadav Rotem [Fri, 9 Nov 2012 07:02:24 +0000 (07:02 +0000)]
indent

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

11 years agollvm/ConstantFolding.cpp: Make ReadDataFromGlobal() and FoldReinterpretLoadFromConstP...
NAKAMURA Takumi [Thu, 8 Nov 2012 20:34:25 +0000 (20:34 +0000)]
llvm/ConstantFolding.cpp: Make ReadDataFromGlobal() and FoldReinterpretLoadFromConstPtr() Big-endian-aware.

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

11 years agoDrop the limitation to IEEE floating point types from the fdiv of pow2 -> fmul transform.
Benjamin Kramer [Thu, 8 Nov 2012 13:58:10 +0000 (13:58 +0000)]
Drop the limitation to IEEE floating point types from the fdiv of pow2 -> fmul transform.

This is safe for x87 long doubles and ppc double doubles too.

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

11 years agoRecommit modified r167540.
Amara Emerson [Thu, 8 Nov 2012 09:51:45 +0000 (09:51 +0000)]
Recommit modified r167540.

Improve ARM build attribute emission for architectures types.
This also changes the default architecture emitted for a generic CPU to "v7".

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

11 years agoAdd support of RTM from TSX extension
Michael Liao [Thu, 8 Nov 2012 07:28:54 +0000 (07:28 +0000)]
Add support of RTM from TSX extension

- Add RTM code generation support throught 3 X86 intrinsics:
  xbegin()/xend() to start/end a transaction region, and xabort() to abort a
  tranaction region

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

11 years agoinstcombine: Migrate strspn optimizations
Meador Inge [Thu, 8 Nov 2012 01:33:50 +0000 (01:33 +0000)]
instcombine: Migrate strspn optimizations

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

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

11 years agoFix up comment typo and 80-col.
Eric Christopher [Wed, 7 Nov 2012 23:38:51 +0000 (23:38 +0000)]
Fix up comment typo and 80-col.

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

11 years agoAdd a relocation visitor to lib object. This works via caching relocated
Eric Christopher [Wed, 7 Nov 2012 23:22:07 +0000 (23:22 +0000)]
Add a relocation visitor to lib object. This works via caching relocated
values in a map that can be passed to consumers. Add a testcase that
ensures this works for llvm-dwarfdump.

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

11 years agoOnly do switch-to-lookup table transformation when TargetTransformInfo
Hans Wennborg [Wed, 7 Nov 2012 21:35:12 +0000 (21:35 +0000)]
Only do switch-to-lookup table transformation when TargetTransformInfo
is available.

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

11 years ago[mips] Custom-lower ISD::FRAME_TO_ARGS_OFFSET node.
Akira Hatanaka [Wed, 7 Nov 2012 19:10:58 +0000 (19:10 +0000)]
[mips] Custom-lower ISD::FRAME_TO_ARGS_OFFSET node.

Patch by Sasa Stankovic.

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

11 years agoDelete MipsFunctionInfo::NextStackOffset. No functionality change intended.
Akira Hatanaka [Wed, 7 Nov 2012 19:04:26 +0000 (19:04 +0000)]
Delete MipsFunctionInfo::NextStackOffset. No functionality change intended.

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

11 years agoRevert r167540 until regression tests are updated.
Amara Emerson [Wed, 7 Nov 2012 18:57:14 +0000 (18:57 +0000)]
Revert r167540 until regression tests are updated.

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

11 years agoRemove accidental commit.
Bill Wendling [Wed, 7 Nov 2012 18:39:32 +0000 (18:39 +0000)]
Remove accidental commit.

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

11 years agoFix bad test IR in switch_to_lookup_table.ll
Hans Wennborg [Wed, 7 Nov 2012 18:38:24 +0000 (18:38 +0000)]
Fix bad test IR in switch_to_lookup_table.ll

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

11 years agoImprove ARM build attribute emission for architectures types.
Amara Emerson [Wed, 7 Nov 2012 18:01:03 +0000 (18:01 +0000)]
Improve ARM build attribute emission for architectures types.

This also changes the default architecture emitted for a generic CPU to "v7".

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