oota-llvm.git
11 years agoPVS-Studio noticed that EmitVBR64 would perform undefined behaviour if the
Duncan Sands [Tue, 21 Aug 2012 13:47:25 +0000 (13:47 +0000)]
PVS-Studio noticed that EmitVBR64 would perform undefined behaviour if the
number of bits was bigger than 32.  I checked every use of this function
that I could find and it looks like the maximum number of bits is 32, so I've
added an assertion checking this property, and a type cast to (hopefully) stop
PVS-Studio from warning about this in the future.

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

11 years agoAdd correct set of regression tests for r162094 commit.
Tim Northover [Tue, 21 Aug 2012 12:43:03 +0000 (12:43 +0000)]
Add correct set of regression tests for r162094 commit.

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

11 years agoPort the global copy optimization from the SROA pass to InstCombine.
Chandler Carruth [Tue, 21 Aug 2012 08:39:44 +0000 (08:39 +0000)]
Port the global copy optimization from the SROA pass to InstCombine.
This optimization is really just replacing allocas wholesale with
globals, there is no scalarization.

The underlying motivation for this patch is to simplify the SROA pass
and focus it on splitting and promoting allocas.

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

11 years agoFix up indentation and remove a couple else's after returns.
Craig Topper [Tue, 21 Aug 2012 08:29:51 +0000 (08:29 +0000)]
Fix up indentation and remove a couple else's after returns.

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

11 years ago[asan] add code to detect global initialization fiasco in C/C++. The sub-pass is...
Kostya Serebryany [Tue, 21 Aug 2012 08:24:25 +0000 (08:24 +0000)]
[asan] add code to detect global initialization fiasco in C/C++. The sub-pass is off by default for now. Patch by Reid Watson. Note: this patch changes the interface between LLVM and compiler-rt parts of asan. The corresponding patch to compiler-rt will follow.

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

11 years agoUse uint16_t for tables of opcodes.
Craig Topper [Tue, 21 Aug 2012 08:23:21 +0000 (08:23 +0000)]
Use uint16_t for tables of opcodes.

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

11 years agoFix up indentation. No functional change.
Craig Topper [Tue, 21 Aug 2012 08:17:07 +0000 (08:17 +0000)]
Fix up indentation. No functional change.

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

11 years agoAdd a couple llvm_unreachables. Add a message to several others.
Craig Topper [Tue, 21 Aug 2012 08:16:16 +0000 (08:16 +0000)]
Add a couple llvm_unreachables. Add a message to several others.

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

11 years agoReplace a break with llvm_unreachable in the default case of a nested switch. Condens...
Craig Topper [Tue, 21 Aug 2012 07:32:16 +0000 (07:32 +0000)]
Replace a break with llvm_unreachable in the default case of a nested switch. Condense code a bit. No functional change.

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

11 years agoCleanup the scalar FMA3 definitions. Add patterns to fold loads with scalar forms.
Craig Topper [Tue, 21 Aug 2012 07:11:11 +0000 (07:11 +0000)]
Cleanup the scalar FMA3 definitions. Add patterns to fold loads with scalar forms.

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

11 years agoMerge FMA3 instructions with and without patterns into single classes using null_frag.
Craig Topper [Tue, 21 Aug 2012 05:56:45 +0000 (05:56 +0000)]
Merge FMA3 instructions with and without patterns into single classes using null_frag.

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

11 years agorevise debug output to avoid dangling pointer
Michael Liao [Tue, 21 Aug 2012 05:55:22 +0000 (05:55 +0000)]
revise debug output to avoid dangling pointer

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

11 years agoAdd a missing def flag.
Jakob Stoklund Olesen [Tue, 21 Aug 2012 00:34:53 +0000 (00:34 +0000)]
Add a missing def flag.

*** Bad machine code: Explicit definition marked as use ***
- function:    test_cos
- basic block: BB#0 L.entry (0x7ff2a2024fd0)
- instruction: VSETLNi32 %D11, %D11<undef>, %R0, 0, pred:14, pred:%noreg, %Q5<imp-use,kill>, %Q5<imp-def>
- operand 0:   %D11

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

11 years agoFix a quadratic algorithm in MachineBranchProbabilityInfo.
Jakob Stoklund Olesen [Mon, 20 Aug 2012 22:01:38 +0000 (22:01 +0000)]
Fix a quadratic algorithm in MachineBranchProbabilityInfo.

The getSumForBlock function was quadratic in the number of successors
because getSuccWeight would perform a linear search for an already known
iterator.

This patch was originally committed as r161460, but reverted again
because of assertion failures. Now that duplicate Machine CFG edges have
been eliminated, this works properly.

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

11 years agoDon't add CFG edges for redundant conditional branches.
Jakob Stoklund Olesen [Mon, 20 Aug 2012 21:39:52 +0000 (21:39 +0000)]
Don't add CFG edges for redundant conditional branches.

IR that hasn't been through SimplifyCFG can look like this:

  br i1 %b, label %r, label %r

Make sure we don't create duplicate Machine CFG edges in this case.

Fix the machine code verifier to accept conditional branches with a
single CFG edge.

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

11 years agoClarify that duplicate edges are not allowed in the Machine CFG.
Jakob Stoklund Olesen [Mon, 20 Aug 2012 21:05:58 +0000 (21:05 +0000)]
Clarify that duplicate edges are not allowed in the Machine CFG.

LLVM IR has labeled duplicate CFG edges, but since Machine CFG edges
don't have labels, it doesn't make sense to allow duplicates. There is
no way of telling what the edges mean.

Duplicate CFG edges cause confusion when dealing with edge weights. It
seems that code producing duplicate CFG edges usually does the wrong
thing with edge weights.

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

11 years agoAdd a verification pass after ExpandISelPseudos.
Jakob Stoklund Olesen [Mon, 20 Aug 2012 20:52:08 +0000 (20:52 +0000)]
Add a verification pass after ExpandISelPseudos.

This pass often has weird CFG hacks and hand-written MI building code
that can go wrong in many ways.

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

11 years agoAdd CFG checks to MachineVerifier.
Jakob Stoklund Olesen [Mon, 20 Aug 2012 20:52:06 +0000 (20:52 +0000)]
Add CFG checks to MachineVerifier.

Verify that the predecessor and successor lists are consistent and free
of duplicates.

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

11 years agoUse a SmallPtrSet to dedup successors in EmitSjLjDispatchBlock.
Jakob Stoklund Olesen [Mon, 20 Aug 2012 20:52:03 +0000 (20:52 +0000)]
Use a SmallPtrSet to dedup successors in EmitSjLjDispatchBlock.

The test case ARM/2011-05-04-MultipleLandingPadSuccs.ll was creating
duplicate successor list entries.

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

11 years agoenable cross compilation with cmake
Sebastian Pop [Mon, 20 Aug 2012 19:56:52 +0000 (19:56 +0000)]
enable cross compilation with cmake

This patch allows us to use cmake to specify a cross compiler: target different
than host. In particular, it moves LLVM_DEFAULT_TARGET_TRIPLE and TARGET_TRIPLE
variables from cmake/config-ix.cmake to the toplevel CMakeLists.txt to make them
available at configure time.

Here is the command line that I have used to test my patches to create a Hexagon
cross compiler hosted on x86:

$ cmake -G Ninja -D LLVM_TARGETS_TO_BUILD:STRING=Hexagon -D TARGET_TRIPLE:STRING=hexagon-unknown-linux-gnu -D LLVM_DEFAULT_TARGET_TRIPLE:STRING=hexagon-unknown-linux-gnu -D LLVM_TARGET_ARCH:STRING=hexagon-unknown-linux-gnu ..
$ ninja check

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

11 years agoenable Hexagon target from cmake
Sebastian Pop [Mon, 20 Aug 2012 19:56:49 +0000 (19:56 +0000)]
enable Hexagon target from cmake

The patch adds a missing case for the Hexagon target in cmake/config-ix.cmake.

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

11 years agofix HexagonSubtarget parsing of -mv flag
Sebastian Pop [Mon, 20 Aug 2012 19:56:47 +0000 (19:56 +0000)]
fix HexagonSubtarget parsing of -mv flag

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

11 years agofix a case where all operands of BUILD_VECTOR are undefined
Michael Liao [Mon, 20 Aug 2012 17:59:18 +0000 (17:59 +0000)]
fix a case where all operands of BUILD_VECTOR are undefined

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

11 years agoFix coding style violations in 162135 and 162136.
Akira Hatanaka [Mon, 20 Aug 2012 17:53:24 +0000 (17:53 +0000)]
Fix coding style violations in 162135 and 162136.

Patch by Petar Jovanovic.

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

11 years agoDataExtractor: Fix integer truncation issues in LEB128 extraction.
Benjamin Kramer [Mon, 20 Aug 2012 10:52:11 +0000 (10:52 +0000)]
DataExtractor: Fix integer truncation issues in LEB128 extraction.

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

11 years agoForget to add testcase for r162195. Sorry.
Stepan Dyatkovskiy [Mon, 20 Aug 2012 08:03:18 +0000 (08:03 +0000)]
Forget to add testcase for r162195. Sorry.

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

11 years agoFixed DAGCombiner bug (found and localized by James Malloy):
Stepan Dyatkovskiy [Mon, 20 Aug 2012 07:57:06 +0000 (07:57 +0000)]
Fixed DAGCombiner bug (found and localized by James Malloy):
The DAGCombiner tries to optimise a BUILD_VECTOR by checking if it
consists purely of get_vector_elts from one or two source vectors. If
so, it either makes a concat_vectors node or a shufflevector node.

However, it doesn't check the element type width of the underlying
vector, so if you have this sequence:

Node0: v4i16 = ...
Node1: i32 = extract_vector_elt Node0
Node2: i32 = extract_vector_elt Node0
Node3: v16i8 = BUILD_VECTOR Node1, Node2, ...

It will attempt to:

Node0:    v4i16 = ...
NewNode1: v16i8 = concat_vectors Node0, ...

Where this is actually invalid because the element width is completely
different. This causes an assertion failure on DAG legalization stage.

Fix:
If output item type of BUILD_VECTOR differs from input item type.
Make concat_vectors based on input element type and then bitcast it to the output vector type. So the case described above will transformed to:
Node0:    v4i16 = ...
NewNode1: v8i16 = concat_vectors Node0, ...
NewNode2: v16i8 = bitcast NewNode1

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

11 years agoRemove FMA3 intrinsic instructions in favor of patterns.
Craig Topper [Mon, 20 Aug 2012 06:21:25 +0000 (06:21 +0000)]
Remove FMA3 intrinsic instructions in favor of patterns.

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

11 years agoUse correct intrinsic for 256-bit VFMSUBADDPS.
Craig Topper [Mon, 20 Aug 2012 06:03:04 +0000 (06:03 +0000)]
Use correct intrinsic for 256-bit VFMSUBADDPS.

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

11 years agoRemove trailing white space and tab characters. No functional change.
Craig Topper [Sun, 19 Aug 2012 23:37:46 +0000 (23:37 +0000)]
Remove trailing white space and tab characters. No functional change.

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

11 years agoWhen unsafe math is used, we can use commutative FMAX and FMIN. In some cases
Nadav Rotem [Sun, 19 Aug 2012 13:06:16 +0000 (13:06 +0000)]
When unsafe math is used, we can use commutative FMAX and FMIN. In some cases
this allows for better code generation.

Added a new DAGCombine transformation to convert FMAX and FMIN to FMANC and
FMINC, which are commutative.

For example:

  movaps  %xmm0, %xmm1
  movsd LC(%rip), %xmm0
  minsd %xmm1, %xmm0

becomes:

  minsd LC(%rip), %xmm0

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

11 years agoFabs folding is implemented.
Benjamin Kramer [Sun, 19 Aug 2012 09:51:44 +0000 (09:51 +0000)]
Fabs folding is implemented.

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

11 years agoInstCombine: Fix a crasher when encountering a function pointer.
Benjamin Kramer [Sat, 18 Aug 2012 22:04:34 +0000 (22:04 +0000)]
InstCombine: Fix a crasher when encountering a function pointer.

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

11 years agoRemove the CAND/COR/CXOR custom ISD nodes and their select code.
Jakob Stoklund Olesen [Sat, 18 Aug 2012 21:49:50 +0000 (21:49 +0000)]
Remove the CAND/COR/CXOR custom ISD nodes and their select code.

These nodes are no longer needed because the peephole pass can fold
CMOV+AND into ANDCC etc.

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

11 years agoRemove virtual from many methods. These methods replace methods in the base class...
Craig Topper [Sat, 18 Aug 2012 21:38:45 +0000 (21:38 +0000)]
Remove virtual from many methods. These methods replace methods in the base class, but the base class methods aren't virtual so it just increased call overhead.

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

11 years agoAlso combine zext/sext into selects for ARM.
Jakob Stoklund Olesen [Sat, 18 Aug 2012 21:25:22 +0000 (21:25 +0000)]
Also combine zext/sext into selects for ARM.

This turns common i1 patterns into predicated instructions:

  (add (zext cc), x) -> (select cc (add x, 1), x)
  (add (sext cc), x) -> (select cc (add x, -1), x)

For a function like:

  unsigned f(unsigned s, int x) {
    return s + (x>0);
  }

We now produce:

  cmp r1, #0
  it  gt
  addgt.w r0, r0, #1

Instead of:

  movs  r2, #0
  cmp r1, #0
  it  gt
  movgt r2, #1
  add r0, r2

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

11 years agoAlso pass logical ops to combineSelectAndUse.
Jakob Stoklund Olesen [Sat, 18 Aug 2012 21:25:16 +0000 (21:25 +0000)]
Also pass logical ops to combineSelectAndUse.

Add these transformations to the existing add/sub ones:

  (and (select cc, -1, c), x) -> (select cc, x, (and, x, c))
  (or  (select cc, 0, c), x)  -> (select cc, x, (or, x, c))
  (xor (select cc, 0, c), x)  -> (select cc, x, (xor, x, c))

The selects can then be transformed to a single predicated instruction
by peephole.

This transformation will make it possible to eliminate the ISD::CAND,
COR, and CXOR custom DAG nodes.

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

11 years agoRemove overly conservative hasOneUse check, this always expands into a single IR...
Benjamin Kramer [Sat, 18 Aug 2012 20:24:19 +0000 (20:24 +0000)]
Remove overly conservative hasOneUse check, this always expands into a single IR instruction.

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

11 years agoInstCombine: Add a couple of fabs identities for comparing with 0.0.
Benjamin Kramer [Sat, 18 Aug 2012 20:06:47 +0000 (20:06 +0000)]
InstCombine: Add a couple of fabs identities for comparing with 0.0.

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

11 years agoSimplifyLibcalls: Add fabs and trunc to the list of libcalls that are safe to shrink...
Benjamin Kramer [Sat, 18 Aug 2012 19:27:32 +0000 (19:27 +0000)]
SimplifyLibcalls: Add fabs and trunc to the list of libcalls that are safe to shrink from double to float.

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

11 years agoReapply r162160 with a fix: Optimize Arith->Trunc->SETCC sequence to allow better...
Nadav Rotem [Sat, 18 Aug 2012 17:53:03 +0000 (17:53 +0000)]
Reapply r162160 with a fix: Optimize Arith->Trunc->SETCC sequence to allow better compare/branch code.

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

11 years agofp16-to-fp32 conversion instructions are available in Thumb mode as well.
Anton Korobeynikov [Sat, 18 Aug 2012 13:08:43 +0000 (13:08 +0000)]
fp16-to-fp32 conversion instructions are available in Thumb mode as well.
Make sure the generic pattern is used.

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

11 years agoRefactor code a bit to reduce number of calls in the final compiled code. No function...
Craig Topper [Sat, 18 Aug 2012 06:39:34 +0000 (06:39 +0000)]
Refactor code a bit to reduce number of calls in the final compiled code. No functional change intended.

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

11 years agoReorder initialization list to silence -Wreorder
Craig Topper [Sat, 18 Aug 2012 06:20:54 +0000 (06:20 +0000)]
Reorder initialization list to silence -Wreorder

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

11 years agoRevert r162160 because it made a few buildbots fail.
Nadav Rotem [Sat, 18 Aug 2012 05:02:36 +0000 (05:02 +0000)]
Revert r162160 because it made a few buildbots fail.

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

11 years agoThe X86 backend has a number of optimizations for SETCC nodes which use
Nadav Rotem [Sat, 18 Aug 2012 02:43:28 +0000 (02:43 +0000)]
The X86 backend has a number of optimizations for SETCC nodes which use
arithmetic instructions. However, when small data types are used, a truncate
node appears between the SETCC node and the arithmetic operation. This patch
adds support for this pattern.

Before:
  xorl  %esi, %edi
  testb %dil, %dil
  setne %al
  ret

After:
  xorb  %dil, %sil
  setne %al
  ret

rdar://12081007

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

11 years agoMake atomic load and store of pointers work. Tighten verification of atomic operations
Eli Friedman [Fri, 17 Aug 2012 23:24:29 +0000 (23:24 +0000)]
Make atomic load and store of pointers work.  Tighten verification of atomic operations
so other unexpected operations don't slip through.  Based on patch by Logan Chien.
PR11786/PR13186.

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

11 years agoFix undefined behavior (binding a reference to a dereferenced null pointer) if
Richard Smith [Fri, 17 Aug 2012 21:42:44 +0000 (21:42 +0000)]
Fix undefined behavior (binding a reference to a dereferenced null pointer) if
SSAUpdater was created and destroyed without being initialized.

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

11 years agoAdd MipsELFWriterInfo.{h,cpp}.
Akira Hatanaka [Fri, 17 Aug 2012 21:38:47 +0000 (21:38 +0000)]
Add MipsELFWriterInfo.{h,cpp}.

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

11 years agoCorrect MCJIT functionality for MIPS32 architecture.
Akira Hatanaka [Fri, 17 Aug 2012 21:28:04 +0000 (21:28 +0000)]
Correct MCJIT functionality for MIPS32 architecture.

No new tests are added.
All tests in ExecutionEngine/MCJIT that have been failing pass after this patch
is applied (when "make check" is done on a mips board).

Patch by Petar Jovanovic.

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

11 years agoImplement stack protectors for structures with character arrays in them.
Bill Wendling [Fri, 17 Aug 2012 20:59:56 +0000 (20:59 +0000)]
Implement stack protectors for structures with character arrays in them.
<rdar://problem/10545247>

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

11 years agoAvoid folding ADD instructions with FI operands.
Jakob Stoklund Olesen [Fri, 17 Aug 2012 20:55:34 +0000 (20:55 +0000)]
Avoid folding ADD instructions with FI operands.

PEI can't handle the pseudo-instructions. This can be removed when the
pseudo-instructions are replaced by normal predicated instructions.

Fixes PR13628.

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

11 years agoAdd stub methods for mips assembly matcher.
Akira Hatanaka [Fri, 17 Aug 2012 20:16:42 +0000 (20:16 +0000)]
Add stub methods for mips assembly matcher.

Patch by Vladimir Medic.

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

11 years agoMemoryBuiltins: Properly guard ObjectSizeOffsetVisitor against cycles in the IR.
Benjamin Kramer [Fri, 17 Aug 2012 19:26:41 +0000 (19:26 +0000)]
MemoryBuiltins: Properly guard ObjectSizeOffsetVisitor against cycles in the IR.

The previous fix only checked for simple cycles, use a set to catch longer
cycles too.

Drop the broken check from the ObjectSizeOffsetEvaluator. The BoundsChecking
pass doesn't have to deal with invalid IR like InstCombine does.

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

11 years agoChange the `linker_private_weak_def_auto' linkage to `linkonce_odr_auto_hide' to
Bill Wendling [Fri, 17 Aug 2012 18:33:14 +0000 (18:33 +0000)]
Change the `linker_private_weak_def_auto' linkage to `linkonce_odr_auto_hide' to
make it more consistent with its intended semantics.

The `linker_private_weak_def_auto' linkage type was meant to automatically hide
globals which never had their addresses taken. It has nothing to do with the
`linker_private' linkage type, which outputs the symbols with a `l' (ell) prefix
among other things.

The intended semantic is more like the `linkonce_odr' linkage type.

Change the name of the linkage type to `linkonce_odr_auto_hide'. And therefore
changing the semantics so that it produces the correct output for the linker.

Note: The old linkage name `linker_private_weak_def_auto' will still parse but
is not a synonym for `linkonce_odr_auto_hide'. This should be removed in 4.0.
<rdar://problem/11754934>

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

11 years agoAssert that dominates is not given a multiple edge. Finding out if we have
Rafael Espindola [Fri, 17 Aug 2012 18:21:28 +0000 (18:21 +0000)]
Assert that dominates is not given a multiple edge. Finding out if we have
multiple edges between two blocks is linear. If the caller is iterating all
edges leaving a BB that would be a square time algorithm. It is more efficient
to have the callers handle that case.

Currently the only callers are:
* GVN: already avoids the multiple edge case.
* Verifier: could only hit this assert when looking at an invalid invoke. Since
it already rejects the invoke, just avoid computing the dominance for it.

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

11 years agoAdd comment, clean up code. No functional change.
Jakob Stoklund Olesen [Fri, 17 Aug 2012 16:59:09 +0000 (16:59 +0000)]
Add comment, clean up code. No functional change.

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

11 years agoTargetLowering: Use the large shift amount during legalize types. The legalizer may...
Benjamin Kramer [Fri, 17 Aug 2012 15:54:21 +0000 (15:54 +0000)]
TargetLowering: Use the large shift amount during legalize types. The legalizer may call us with an overly large type.

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

11 years agoUse standard pattern for iterate+erase.
Jakob Stoklund Olesen [Fri, 17 Aug 2012 14:38:59 +0000 (14:38 +0000)]
Use standard pattern for iterate+erase.

Increment the MBB iterator at the top of the loop to properly handle the
current (and previous) instructions getting erased.

This fixes PR13625.

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

11 years agoGuard MemoryBuiltins against self-looping GEPs, which can occur in unreachable code...
Benjamin Kramer [Fri, 17 Aug 2012 14:16:37 +0000 (14:16 +0000)]
Guard MemoryBuiltins against self-looping GEPs, which can occur in unreachable code due to constant propagation.

Fixes PR13621.

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

11 years agoFix broken check lines.
Benjamin Kramer [Fri, 17 Aug 2012 12:28:26 +0000 (12:28 +0000)]
Fix broken check lines.

I really need to find a way to automate this, but I can't come up with a regex
that has no false positives while handling tricky cases like custom check
prefixes.

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

11 years agoImplement NEON domain switching for scalar <-> S-register vmovs on ARM
Tim Northover [Fri, 17 Aug 2012 11:32:52 +0000 (11:32 +0000)]
Implement NEON domain switching for scalar <-> S-register vmovs on ARM

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

11 years agoInsertion of NoFolder functions to avoid ambiguous overload warnings or errors about...
Jin-Gu Kang [Fri, 17 Aug 2012 08:54:57 +0000 (08:54 +0000)]
Insertion of NoFolder functions to avoid ambiguous overload warnings or errors about whether to convert Idx to ArrayRef<Constant *> or ArrayRef<Value *> like ConstantFolder and TargetFolder.

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

11 years agoUse nested switch to select arguments to reduce calls to EmitPCMP.
Craig Topper [Fri, 17 Aug 2012 07:15:56 +0000 (07:15 +0000)]
Use nested switch to select arguments to reduce calls to EmitPCMP.

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

11 years agoMake ReplaceATOMIC_BINARY_64 a static function. Use a nested switch to reduce to...
Craig Topper [Fri, 17 Aug 2012 06:55:11 +0000 (06:55 +0000)]
Make ReplaceATOMIC_BINARY_64 a static function. Use a nested switch to reduce to only a single call to it thus allowing it to be inlined by the compiler.

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

11 years agoTest commit.
Pranav Bhandarkar [Fri, 17 Aug 2012 06:36:26 +0000 (06:36 +0000)]
Test commit.
include/llvm/IntrinsicsHexagon.td: Hexagon_Intrinsic is the base class
for all Hexagon intrinsics and not altivec intrinsics.

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

11 years agoRemove unnecessary include of ARMGenInstrInfo.inc.
Craig Topper [Fri, 17 Aug 2012 06:21:09 +0000 (06:21 +0000)]
Remove unnecessary include of ARMGenInstrInfo.inc.

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

11 years agoDeclare some for loop indices inside the for loop statement.
Craig Topper [Fri, 17 Aug 2012 05:42:16 +0000 (05:42 +0000)]
Declare some for loop indices inside the for loop statement.

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

11 years agoFix up indentation of outputted decode function for readability.
Craig Topper [Fri, 17 Aug 2012 05:16:15 +0000 (05:16 +0000)]
Fix up indentation of outputted decode function for readability.

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

11 years agolit: Show actually created count of threads. The incorrect threads count is printed...
NAKAMURA Takumi [Fri, 17 Aug 2012 04:15:41 +0000 (04:15 +0000)]
lit: Show actually created count of threads. The incorrect threads count is printed if the number of tests are less than the number of default threads.

Thanks to Vinson Lee, reported in PR13620.

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

11 years agoFlatten the aligned-char-array utility template to be a directly
Chandler Carruth [Fri, 17 Aug 2012 01:47:25 +0000 (01:47 +0000)]
Flatten the aligned-char-array utility template to be a directly
templated union at the request of Richard Smith. This makes it
substantially easier to type. =]

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

11 years agoAdd ADD and SUB to the predicable ARM instructions.
Jakob Stoklund Olesen [Thu, 16 Aug 2012 23:21:55 +0000 (23:21 +0000)]
Add ADD and SUB to the predicable ARM instructions.

It is not my plan to duplicate the entire ARM instruction set with
predicated versions. We need a way of representing predicated
instructions in SSA form without requiring a separate opcode.

Then the pseudo-instructions can go away.

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

11 years agoHandle ARM MOVCC optimization in PeepholeOptimizer.
Jakob Stoklund Olesen [Thu, 16 Aug 2012 23:14:20 +0000 (23:14 +0000)]
Handle ARM MOVCC optimization in PeepholeOptimizer.

Use the target independent select analysis hooks.

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

11 years agoAdd an MCID::Select flag and TII hooks for optimizing selects.
Jakob Stoklund Olesen [Thu, 16 Aug 2012 23:11:47 +0000 (23:11 +0000)]
Add an MCID::Select flag and TII hooks for optimizing selects.

Select instructions pick one of two virtual registers based on a
condition, like x86 cmov. On targets like ARM that support predication,
selects can sometimes be eliminated by predicating the instruction
defining one of the operands.

Teach PeepholeOptimizer to recognize select instructions, and ask the
target to optimize them.

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

11 years agoRevert r162034, r162035 and r162037.
Roman Divacky [Thu, 16 Aug 2012 19:07:59 +0000 (19:07 +0000)]
Revert r162034, r162035 and r162037.

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

11 years agoDefine and handle additional fixup kinds. By Adhemerval Zanella.
Roman Divacky [Thu, 16 Aug 2012 18:37:52 +0000 (18:37 +0000)]
Define and handle additional fixup kinds. By Adhemerval Zanella.

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

11 years agoAdd PPC64 relocations definitions, by Adhemerval Zanella.
Roman Divacky [Thu, 16 Aug 2012 18:31:29 +0000 (18:31 +0000)]
Add PPC64 relocations definitions, by Adhemerval Zanella.

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

11 years agoHandle PowerPC.
Roman Divacky [Thu, 16 Aug 2012 18:30:03 +0000 (18:30 +0000)]
Handle PowerPC.

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

11 years agoFix typo and grammar. By Adhemerval Zanella.
Roman Divacky [Thu, 16 Aug 2012 18:19:29 +0000 (18:19 +0000)]
Fix typo and grammar. By Adhemerval Zanella.

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

11 years agoTeach GVN to reason about edges dominating uses. This allows it to handle cases
Rafael Espindola [Thu, 16 Aug 2012 15:09:43 +0000 (15:09 +0000)]
Teach GVN to reason about edges dominating uses. This allows it to handle cases
where some fact lake a=b dominates a use in a phi, but doesn't dominate the
basic block itself.

This feature could also be implemented by splitting critical edges, but at least
with the current algorithm reasoning about the dominance directly is faster.

The time for running "opt -O2" in the testcase in pr10584 is 1.003 times slower
and on gcc as a single file it is 1.0007 times faster.

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

11 years agoAdd dump/dumpr methods to SDValue.
Nadav Rotem [Thu, 16 Aug 2012 07:39:52 +0000 (07:39 +0000)]
Add dump/dumpr methods to SDValue.

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

11 years ago[arm-fast-isel] Add support for fastcc.
Jush Lu [Thu, 16 Aug 2012 05:15:53 +0000 (05:15 +0000)]
[arm-fast-isel] Add support for fastcc.

Without fastcc support, the caller just falls through to CallingConv::C
for fastcc, but callee still uses fastcc, this inconsistency of calling
convention is a problem, and fastcc support can fix it.

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

11 years agoPatch to enable FMA on bdver2 target. Make XOP feature enable FMA4 as well.
Anitha Boyapati [Thu, 16 Aug 2012 04:04:02 +0000 (04:04 +0000)]
Patch to enable FMA on bdver2 target. Make XOP feature enable FMA4 as well.

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

11 years agogit-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162010 91177308-0d34-0410...
Anitha Boyapati [Thu, 16 Aug 2012 03:50:04 +0000 (03:50 +0000)]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162010 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoTest case for r162008.
Akira Hatanaka [Thu, 16 Aug 2012 03:48:41 +0000 (03:48 +0000)]
Test case for r162008.

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

11 years agoAdd Android ABI to Mips backend to handle functions returning vectors of four
Akira Hatanaka [Thu, 16 Aug 2012 03:48:05 +0000 (03:48 +0000)]
Add Android ABI to Mips backend to handle functions returning vectors of four
floats.

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

11 years agobug in experimental targets
Victor Oliveira [Wed, 15 Aug 2012 22:35:36 +0000 (22:35 +0000)]
bug in experimental targets

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

11 years agoFold predicable instructions into MOVCC / t2MOVCC.
Jakob Stoklund Olesen [Wed, 15 Aug 2012 22:16:39 +0000 (22:16 +0000)]
Fold predicable instructions into MOVCC / t2MOVCC.

The ARM select instructions are just predicated moves. If the select is
the only use of an operand, the instruction defining the operand can be
predicated instead, saving one instruction and decreasing register
pressure.

This implementation can turn AND/ORR/EOR instructions into their
corresponding ANDCC/ORRCC/EORCC variants. Ideally, we should be able to
predicate any instruction, but we don't yet support predicated
instructions in SSA form.

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

11 years agoRemove dead flag.
Bill Wendling [Wed, 15 Aug 2012 21:18:10 +0000 (21:18 +0000)]
Remove dead flag.

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

11 years agoRework test so that it reproduces the error without the horrible flag.
Bill Wendling [Wed, 15 Aug 2012 21:10:18 +0000 (21:10 +0000)]
Rework test so that it reproduces the error without the horrible flag.

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

11 years agoRemove invalid test. This test requires that dead basic blocks be kept
Bill Wendling [Wed, 15 Aug 2012 20:54:09 +0000 (20:54 +0000)]
Remove invalid test. This test requires that dead basic blocks be kept
around. That's not how we do things. Besides, the commit message tells us that
it is covered by the GCC test suite.

------------------------------------------------------------------------
r127497 | zwarich | 2011-03-11 13:51:56 -0800 (Fri, 11 Mar 2011) | 3 lines

Fix the GCC test suite issue exposed by r127477, which was caused by stack
protector insertion not working correctly with unreachable code. Since that
revision was rolled out, this test doesn't actual fail before this fix.
------------------------------------------------------------------------

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

11 years agoFixed a problem in the JIT memory allocator where
Sean Callanan [Wed, 15 Aug 2012 20:53:52 +0000 (20:53 +0000)]
Fixed a problem in the JIT memory allocator where
allocations of executable memory would not be padded
to account for the size of the allocation header.
This resulted in undersized allocations, meaning that
when the allocation was written to later the next
allocation's header would be corrupted.

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

11 years agoAdd a CoveringSubRegIndices field to SubRegIndex records.
Jakob Stoklund Olesen [Wed, 15 Aug 2012 20:15:48 +0000 (20:15 +0000)]
Add a CoveringSubRegIndices field to SubRegIndex records.

This can be used to tell TableGen to use a specific SubRegIndex instead
of synthesizing one when discovering all sub-registers.

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

11 years agoProperly test the LLVM_USE_RVALUE_REFERENCES macro.
Michael J. Spencer [Wed, 15 Aug 2012 19:21:42 +0000 (19:21 +0000)]
Properly test the LLVM_USE_RVALUE_REFERENCES macro.

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

11 years agoProperly test the LLVM_USE_RVALUE_REFERENCES macro.
Michael J. Spencer [Wed, 15 Aug 2012 19:16:27 +0000 (19:16 +0000)]
Properly test the LLVM_USE_RVALUE_REFERENCES macro.

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

11 years ago[PathV2] Add mapped_file_region. Implementation for Windows and POSIX.
Michael J. Spencer [Wed, 15 Aug 2012 19:05:47 +0000 (19:05 +0000)]
[PathV2] Add mapped_file_region. Implementation for Windows and POSIX.

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

11 years agoAdd LLVM_DELETED_FUNCTION compatibility macro.
Michael J. Spencer [Wed, 15 Aug 2012 18:54:36 +0000 (18:54 +0000)]
Add LLVM_DELETED_FUNCTION compatibility macro.

This should replace uses of:

class A {
  A(const &A); // DO NOT IMPLEMENT
public:
  ...
};

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

11 years agoFix a typo in VariadicFunction.h that leads to invalid code in macro expansion.
Chad Rosier [Wed, 15 Aug 2012 18:48:14 +0000 (18:48 +0000)]
Fix a typo in VariadicFunction.h that leads to invalid code in macro expansion.
Patch by Andy Gibbs <andyg1001@hotmail.co.uk>

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

11 years agoFix another roundToIntegral bug where very large values could become infinity. Probl...
Owen Anderson [Wed, 15 Aug 2012 18:28:45 +0000 (18:28 +0000)]
Fix another roundToIntegral bug where very large values could become infinity.  Problem and solution identified by Steve Canon.

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

11 years agoMake synthesized sub-register indexes available in the target namespace.
Jakob Stoklund Olesen [Wed, 15 Aug 2012 18:00:55 +0000 (18:00 +0000)]
Make synthesized sub-register indexes available in the target namespace.

TableGen sometimes synthesizes missing sub-register indexes. Emit these
indexes as enumerators in the target namespace along with the
user-defined ones.

Also take this opportunity to stop creating new Record objects for
synthetic indexes.

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