platform/upstream/llvm.git
9 years agoFix PTXGenerator after raw_pwrite_stream has been introduced
Tobias Grosser [Mon, 27 Apr 2015 12:06:32 +0000 (12:06 +0000)]
Fix PTXGenerator after raw_pwrite_stream has been introduced

Without this patch Polly with GPGPU support enabled did not compile any more.

llvm-svn: 235868

9 years agoFix formatting issues in banner
Tobias Grosser [Mon, 27 Apr 2015 12:02:36 +0000 (12:02 +0000)]
Fix formatting issues in banner

llvm-svn: 235867

9 years agoDo not expose code generator choice in the header
Tobias Grosser [Mon, 27 Apr 2015 12:02:33 +0000 (12:02 +0000)]
Do not expose code generator choice in the header

There is no need for other passes to access the code-generator command-line
option. Hence, drop it from the header to simplify the interface.

llvm-svn: 235866

9 years agoFix LLDB ARM build error on ubuntu precise with gcc4.7
Omair Javaid [Mon, 27 Apr 2015 12:01:59 +0000 (12:01 +0000)]
Fix LLDB ARM build error on ubuntu precise with gcc4.7

Differential revision: http://reviews.llvm.org/D9100

llvm-svn: 235865

9 years agoRemove unused variable, found with gcc-5.1 -Wunused-variable.
Patrik Hagglund [Mon, 27 Apr 2015 11:03:53 +0000 (11:03 +0000)]
Remove unused variable, found with gcc-5.1 -Wunused-variable.

The variable, MachOSectionTypes, seems to have been unused since its
introduction in r178679.

llvm-svn: 235863

9 years ago[MC] [IAS] Add support for the \@ .macro pseudo-variable.
Toma Tabacu [Mon, 27 Apr 2015 10:50:29 +0000 (10:50 +0000)]
[MC] [IAS] Add support for the \@ .macro pseudo-variable.

Summary:
When used, it is substituted with the number of .macro instantiations we've done up to that point in time.
So if this is the 1st time we've instantiated a .macro (any .macro, regardless of name), \@ will instantiate to 0, if it's the 2nd .macro instantiation, it will instantiate to 1 etc.

It can only be used inside a .macro definition, an .irp definition or an .irpc definition (those last 2 uses are undocumented).

Reviewers: echristo, rafael

Reviewed By: rafael

Subscribers: dsanders, llvm-commits

Differential Revision: http://reviews.llvm.org/D9197

llvm-svn: 235862

9 years agoRemove flag '-polly-annotate-alias-scopes'
Tobias Grosser [Mon, 27 Apr 2015 10:43:10 +0000 (10:43 +0000)]
Remove flag '-polly-annotate-alias-scopes'

This option is enabled since a long time and there does not seem to be a
situation in which we would not want to print alias scopes. Remove this option
to reduce the set of command-line option combinations that may expose bugs.

llvm-svn: 235861

9 years agoRemove implementation of getNumberOfIterations from header [NFC]
Tobias Grosser [Mon, 27 Apr 2015 10:38:45 +0000 (10:38 +0000)]
Remove implementation of getNumberOfIterations from header [NFC]

We moved this implementation into the header file to share it between
the CLooG and isl code generator. As the CLooG code generator was dropped,
the implementation can be folded back into the .cpp file.

No functional change intended.

llvm-svn: 235860

9 years agoFix double stdout/stderr output from CLI commands in MI mode (MI)
Ilia K [Mon, 27 Apr 2015 10:07:49 +0000 (10:07 +0000)]
Fix double stdout/stderr output from CLI commands in MI mode (MI)

Summary:
This patch fixes stdout/stderr output that printed twice for CLI commands:
was:
```
(gdb)
target create ~/p/hello
Current executable set to '~/p/hello' (x86_64).
Current executable set to '~/p/hello' (x86_64).
^done
(gdb)
```
now:
```
(gdb)
target create ~/p/hello
Current executable set to '~/p/hello' (x86_64).
^done
(gdb)
```

Test Plan: ./dotest.py -v --executable $BUILDDIR/bin/lldb tools/lldb-mi/

Reviewers: abidh

Reviewed By: abidh

Subscribers: lldb-commits, abidh

Differential Revision: http://reviews.llvm.org/D9277

llvm-svn: 235857

9 years agoConstfold insertelement to undef when index is out-of-bounds
Pawel Bylica [Mon, 27 Apr 2015 09:30:49 +0000 (09:30 +0000)]
Constfold insertelement to undef when index is out-of-bounds

Summary:
This patch adds constant folding of insertelement instruction to undef value when index operand is constant and is not less than vector size or is undef.

InstCombine does not support this case, but I'm happy to add it there also if this change is accepted.

Test Plan: Unittests and regression tests for ConstProp pass.

Reviewers: majnemer

Reviewed By: majnemer

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D9287

llvm-svn: 235854

9 years agoAdd missing libraries to unittest link
Pavel Labath [Mon, 27 Apr 2015 09:26:03 +0000 (09:26 +0000)]
Add missing libraries to unittest link

Summary:
Currently, linking of the unittests fails on linux because it is missing a bunch of symbols from
libedit, curses, etc. This fixes the build by adding the correct dependencies.

Test Plan: Linking works, unit tests run.

Reviewers: zturner

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D9244

llvm-svn: 235853

9 years agoFix register read callback in linux-arm single stepping
Pavel Labath [Mon, 27 Apr 2015 09:21:14 +0000 (09:21 +0000)]
Fix register read callback in linux-arm single stepping

The previous read callback always read the value of the register what
caused problems when the emulator wrote some value into a register and
then expected to read the same value back. This CL add a register value
cache into the callbacks to return the correct value after a register
write also.

Test Plan: Stepping over BL/BLX instruction works on android-arm if the instruction set isn't change (other, unrelated patch will come for the case when we move to an other instruction set)

Reviewers: omjavaid, sas, clayborg

Reviewed By: clayborg

Subscribers: labath, tberghammer, rengolin, aemerson, lldb-commits

Differential Revision: http://reviews.llvm.org/D9187

From: Tamas Berghammer <tberghammer@google.com>
llvm-svn: 235852

9 years agoXFAIL two mi tests on gcc to stabilise build bots
Pavel Labath [Mon, 27 Apr 2015 09:10:30 +0000 (09:10 +0000)]
XFAIL two mi tests on gcc to stabilise build bots

llvm-svn: 235851

9 years ago[OPENMP] Simplified iteration over clauses, NFC.
Alexey Bataev [Mon, 27 Apr 2015 08:00:32 +0000 (08:00 +0000)]
[OPENMP] Simplified iteration over clauses, NFC.

llvm-svn: 235838

9 years ago[X86][SSE] Add v16i8/v32i8 multiplication support
Simon Pilgrim [Mon, 27 Apr 2015 07:55:46 +0000 (07:55 +0000)]
[X86][SSE] Add v16i8/v32i8 multiplication support

Patch to allow int8 vectors to be multiplied on the SSE unit instead of being scalarized.

The patch sign extends the i8 lanes to i16, uses the SSE2 pmullw multiplication instruction, then packs the lower byte from each result.

Differential Revision: http://reviews.llvm.org/D9115

llvm-svn: 235837

9 years ago[OPENMP] Codegen for 'taskwait' directive.
Alexey Bataev [Mon, 27 Apr 2015 05:22:09 +0000 (05:22 +0000)]
[OPENMP] Codegen for 'taskwait' directive.

Emit the following code for 'taskwait' directive within tied task:
call i32 @__kmpc_omp_taskwait(<loc>, i32 <thread_id>);
Differential Revision: http://reviews.llvm.org/D9245

llvm-svn: 235836

9 years ago[OPENMP] Codegen for 'reduction' clause in 'sections' directive.
Alexey Bataev [Mon, 27 Apr 2015 05:04:13 +0000 (05:04 +0000)]
[OPENMP] Codegen for 'reduction' clause in 'sections' directive.

Emit a code for reduction clause. Next code should be emitted for reductions:

static kmp_critical_name lock = { 0 };

void reduce_func(void *lhs[<n>], void *rhs[<n>]) {
    *(Type0*)lhs[0] = ReductionOperation0(*(Type0*)lhs[0], *(Type0*)rhs[0]);
      ...
        *(Type<n>-1*)lhs[<n>-1] =
          ReductionOperation<n>-1(*(Type<n>-1*)lhs[<n>-1],
            *(Type<n>-1*)rhs[<n>-1]);
}

...
void *RedList[<n>] = {&<RHSExprs>[0], ..., &<RHSExprs>[<n>-1]};
switch (__kmpc_reduce{_nowait}(<loc>, <gtid>, <n>, sizeof(RedList), RedList, reduce_func, &<lock>)) {
case 1:
  <LHSExprs>[0] = ReductionOperation0(*<LHSExprs>[0], *<RHSExprs>[0]);
  ...
  <LHSExprs>[<n>-1] = ReductionOperation<n>-1(*<LHSExprs>[<n>-1], *<RHSExprs>[<n>-1]);
  __kmpc_end_reduce{_nowait}(<loc>, <gtid>, &<lock>);
  break;
case 2:
  Atomic(<LHSExprs>[0] = ReductionOperation0(*<LHSExprs>[0], *<RHSExprs>[0]));
  ...
  Atomic(<LHSExprs>[<n>-1] = ReductionOperation<n>-1(*<LHSExprs>[<n>-1], *<RHSExprs>[<n>-1]));
  break;
default:;
}
Reduction variables are a kind of a private variables, they have private copies, but initial values are chosen in accordance with the reduction operation.
If sections directive has only single section, then original shared variables are used instead with barrier at the end of the directive.
Differential Revision: http://reviews.llvm.org/D9242

llvm-svn: 235835

9 years ago[OPENMP] Codegen for 'lastprivate' clause in 'sections' directive.
Alexey Bataev [Mon, 27 Apr 2015 04:34:03 +0000 (04:34 +0000)]
[OPENMP] Codegen for 'lastprivate' clause in 'sections' directive.

#pragma omp sections lastprivate(<var>)
<BODY>;
This construct is translated into something like:

<last_iter> = alloca i32
<init for lastprivates>;
<last_iter> = 0
; No initializer for simple variables or a default constructor is called for objects.
; For arrays perform element by element initialization by the call of the default constructor.
...
OMP_FOR_START(...,<last_iter>, ..); sets <last_iter> to 1 if this is the last iteration.
<BODY>
...
OMP_FOR_END
if (<last_iter> != 0) {
  <final copy for lastprivate>; Update original variable with the lastprivate value.
}
call __kmpc_cancel_barrier() ; an implicit barrier to avoid possible data race.
If there is only one section, there is no special code generation, original shared variables are used + barrier is emitted at the end of the directive.
Differential Revision: http://reviews.llvm.org/D9240

llvm-svn: 235834

9 years ago[OPENMP] Codegen for 'private' clause in 'sections' directive.
Alexey Bataev [Mon, 27 Apr 2015 04:12:12 +0000 (04:12 +0000)]
[OPENMP] Codegen for 'private' clause in 'sections' directive.

If there are 2 or more sections in a 'section' directive the following code is generated:

<default init for privates>
@__kmpc_for_static_init_4();
<BODY for sections directive>
@__kmpc_for_static_fini()
If there is only one section, the following code is generated:

if (@__kmpc_single()) {
  <default init for privates>
  @__kmpc_end_single();
}
Differential Revision: http://reviews.llvm.org/D9239

llvm-svn: 235833

9 years ago[OPENMP] Codegen for 'private' clause in 'single' directive.
Alexey Bataev [Mon, 27 Apr 2015 03:48:52 +0000 (03:48 +0000)]
[OPENMP] Codegen for 'private' clause in 'single' directive.
Emit the following code for 'single' directive with 'private' clause:

if (@__kmpc_single()) {
  <default init for privates>
  @__kmpc_end_single();
}
Differential Revision: http://reviews.llvm.org/D9238

llvm-svn: 235832

9 years ago[MS ABI] Rephrase the mangling of array types in parameters
David Majnemer [Mon, 27 Apr 2015 03:07:47 +0000 (03:07 +0000)]
[MS ABI] Rephrase the mangling of array types in parameters

Make the canonicalization of array types more consistent.

llvm-svn: 235831

9 years agolibc++abi: remove unused variable
Saleem Abdulrasool [Mon, 27 Apr 2015 02:21:57 +0000 (02:21 +0000)]
libc++abi: remove unused variable

The externC variable was set but unused.  This constantly flagged a warning from
gcc.  Replace it with a comment until such a time that we need it.

llvm-svn: 235830

9 years agolibc++abi: clear up some -Wqual-cast warnings
Saleem Abdulrasool [Mon, 27 Apr 2015 02:21:55 +0000 (02:21 +0000)]
libc++abi: clear up some -Wqual-cast warnings

Cleans up cast qualifier warnings identified by GCC 4.9.2.

llvm-svn: 235829

9 years agolibc++abi: silence some warnings
Saleem Abdulrasool [Mon, 27 Apr 2015 02:21:52 +0000 (02:21 +0000)]
libc++abi: silence some warnings

Cleans up the -Wundef warning caused by the use of the __LITTLE_ENDIAN__ macro.
Instead use `__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__`.  `__BYTE_ORDER__` is
defined by GCC since 4.2 and by clang.  This avoids the undef case where a macro
may be undefined.  This has previously caught real errors in libunwind.

llvm-svn: 235828

9 years ago[PerformanceTips] Italics are *word*, not _word_
Philip Reames [Sun, 26 Apr 2015 22:25:29 +0000 (22:25 +0000)]
[PerformanceTips] Italics are *word*, not _word_

llvm-svn: 235827

9 years ago[PerformanceTips] Provide context on the impact of assume(x)
Philip Reames [Sun, 26 Apr 2015 22:23:12 +0000 (22:23 +0000)]
[PerformanceTips] Provide context on the impact of assume(x)

Sean Silva suggested I add something here a while back.  Sorry it's taken so long to get back to this.

llvm-svn: 235826

9 years agoAdd two new items to PerformanceTips
Philip Reames [Sun, 26 Apr 2015 22:15:18 +0000 (22:15 +0000)]
Add two new items to PerformanceTips

1) Turns out we're not great at recognizing redundant checks when one is a != and the other is an ==.  This is a bug, but it's one that matters to frontend authors.

2) Frontends shouldn't use intrinsics unless strictly neccessary.  This has been pretty widely proven by this point and is good to document.

llvm-svn: 235825

9 years agoMake the message associated with a fatal error slightly more helpful
Philip Reames [Sun, 26 Apr 2015 22:00:34 +0000 (22:00 +0000)]
Make the message associated with a fatal error slightly more helpful

Looking into 23095, my best guess is that the CodeGen library itself isn't getting linked and initialized properly.  To make this slightly more obvious to consumers of LLVM, emit a different error message if we can tell that the registry is empty vs you've simply happened to name a collector which hasn't been registered.

llvm-svn: 235824

9 years agoUse all available range information for parameters
Johannes Doerfert [Sun, 26 Apr 2015 20:07:21 +0000 (20:07 +0000)]
Use all available range information for parameters

  In the following even full-range information will help to avoid
  runtime checks for wrapping integers, hence we enable it now.

llvm-svn: 235823

9 years agoUse the original no-wrap flags for normalized AddRecs
Johannes Doerfert [Sun, 26 Apr 2015 19:55:21 +0000 (19:55 +0000)]
Use the original no-wrap flags for normalized AddRecs

llvm-svn: 235822

9 years ago[RewriteStatepointsForGC] Exclude constant values from being considered live at a...
Philip Reames [Sun, 26 Apr 2015 19:48:03 +0000 (19:48 +0000)]
[RewriteStatepointsForGC] Exclude constant values from being considered live at a safepoint

There can be various constant pointers in the IR which do not get relocated at a safepoint. One example is the address of a global variable. Another example is a pointer created via inttoptr. Note that the optimizer itself likes to create such inttoptrs when locally propagating constants through dynamically dead code.

To deal with this, we need to exclude uses of constants from contributing to the liveness of a safepoint which might reach that use. At some later date, it might be worth exploring what could be done to support the relocation of various special types of "constants", but that's future work.

Differential Revision: http://reviews.llvm.org/D9236

llvm-svn: 235821

9 years agoDon't Place Entry Safepoints Before the llvm.frameescape() Intrinsic
Philip Reames [Sun, 26 Apr 2015 19:41:23 +0000 (19:41 +0000)]
Don't Place Entry Safepoints Before the llvm.frameescape() Intrinsic

llvm.frameescape() intrinsic is not a real call. The intrinsic can only exist in the entry block. Inserting a gc.statepoint() before llvm.frameescape() may split the entry block, and push the intrinsic out of the entry block.

Patch by: Swaroop.Sridhar@microsoft.com
Differential Revision: http://reviews.llvm.org/D8910

llvm-svn: 235820

9 years agoAdd SBLaunchInfo in include/lldb/API/SBDefines.h and fix spacing in scripts/Python...
Ilia K [Sun, 26 Apr 2015 07:51:14 +0000 (07:51 +0000)]
Add SBLaunchInfo in include/lldb/API/SBDefines.h and fix spacing in scripts/Python/buildSwigPython.py

llvm-svn: 235819

9 years ago[Sema] Do not permit binding a reference to a compound literal
David Majnemer [Sun, 26 Apr 2015 07:35:03 +0000 (07:35 +0000)]
[Sema] Do not permit binding a reference to a compound literal

We could probably make this work if we cared enough.  However, we are
far outside any language rules at this point.

This fixes PR21834.

llvm-svn: 235818

9 years agoClean the CMIDriver (MI)
Ilia K [Sun, 26 Apr 2015 05:55:59 +0000 (05:55 +0000)]
Clean the CMIDriver (MI)

This patch does the following things:
* Use CMICmnStreamStdout::TextToStdout to print (gdb) prompt in CMIDriver::InitClientIDEEclipse
* Remove unnecessary inclusions

llvm-svn: 235817

9 years ago[Sema] Don't allow unverified bitfields in FieldDecls
David Majnemer [Sun, 26 Apr 2015 04:58:18 +0000 (04:58 +0000)]
[Sema] Don't allow unverified bitfields in FieldDecls

VerifyBitField must be called if we are to form a bitfield FieldDecl.
We will not verify the bitfield if the decl is known to be malformed in
other ways; pretend that we don't have a bitfield if this happens.

llvm-svn: 235816

9 years agoCorrectly handle zero-sized but non-empty base classes in IRGen.
John McCall [Sun, 26 Apr 2015 04:43:26 +0000 (04:43 +0000)]
Correctly handle zero-sized but non-empty base classes in IRGen.

Fixes rdar://20621065.

A more elegant fix would preclude this case by defining the
rules such that zero-size classes are always formally empty.
I believe the only extensions which create zero-size classes
right now are flexible arrays and zero-length arrays; it's
not abstractly unreasonable to say that those don't count
as members for the purposes of emptiness, just as zero-width
bitfields don't count.  But that's an ABI-affecting change
and requires further discussion; in the meantime, let's not
assert / miscompile.

llvm-svn: 235815

9 years ago[bpf] fix build and remove a compiler warning in Release mode
Alexei Starovoitov [Sun, 26 Apr 2015 01:58:08 +0000 (01:58 +0000)]
[bpf] fix build and remove a compiler warning in Release mode

Patch by Brenden Blanco.

llvm-svn: 235814

9 years agoR600: Remove / merge redundant testcases
Matt Arsenault [Sun, 26 Apr 2015 00:53:33 +0000 (00:53 +0000)]
R600: Remove / merge redundant testcases

llvm-svn: 235813

9 years agoClean CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStateSuspended (MI)
Ilia K [Sat, 25 Apr 2015 21:21:55 +0000 (21:21 +0000)]
Clean CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStateSuspended (MI)

Don't call the lldb::SBProcess::GetRestartedFromEvent twice while
handling the CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStateSuspended.

llvm-svn: 235812

9 years agoFix CMIUtilThreadActiveObjBase::ThreadIsActive when a thread has died (MI)
Ilia K [Sat, 25 Apr 2015 21:20:00 +0000 (21:20 +0000)]
Fix CMIUtilThreadActiveObjBase::ThreadIsActive when a thread has died (MI)

llvm-svn: 235811

9 years ago[x86] instcombine more cases of insertps into a shufflevector
Sanjay Patel [Sat, 25 Apr 2015 20:55:25 +0000 (20:55 +0000)]
[x86] instcombine more cases of insertps into a shufflevector

This is a follow-on to D8833 (insertps optimization when the zero mask is not used).

In this patch, we check for the case where the zmask is used, but both input vectors
to the insertps intrinsic are the same operand or the zmask overrides the destination
lane. This lets us replace the 2nd shuffle input operand with the zero vector.

Differential Revision: http://reviews.llvm.org/D9257

llvm-svn: 235810

9 years agoadd SSE run to check non-AVX codegen
Sanjay Patel [Sat, 25 Apr 2015 20:41:51 +0000 (20:41 +0000)]
add SSE run to check non-AVX codegen

llvm-svn: 235809

9 years agoDisable MiGdbSetShowTestCase.test_lldbmi_gdb_set_show_print_char_array_as_string...
Ilia K [Sat, 25 Apr 2015 20:37:41 +0000 (20:37 +0000)]
Disable MiGdbSetShowTestCase.test_lldbmi_gdb_set_show_print_char_array_as_string test on Linux

llvm-svn: 235808

9 years agoAdd -gdb-set/-gdb-show aggregate-field-names option (MI)
Ilia K [Sat, 25 Apr 2015 20:33:02 +0000 (20:33 +0000)]
Add -gdb-set/-gdb-show aggregate-field-names option (MI)

Use this option to print/skip field names (default is on):
```
-var-create var1 * complx
^done,name="var1",numchild="3",value="{i = 3, inner = {l = 3}, complex_ptr = 0x[0-9a-f]+}",type="complex_type",thread-id="1",has_more="0"
-var-create var2 * complx_array
^done,name="var2",numchild="2",value="{[0] = {i = 4, inner = {l = 4}, complex_ptr = 0x[0-9a-f]+}, [1] = {i = 5, inner = {l = 5}, complex_ptr = 0x[0-9a-f]+}}",type="complex_type [2]",thread-id="1",has_more="0"
-gdb-set print aggregate-field-names off
^done
-var-create var3 * complx
^done,name="var3",numchild="3",value="{3,{3},0x[0-9a-f]+}",type="complex_type",thread-id="1",has_more="0"
-var-create var4 * complx_array
^done,name="var4",numchild="2",value="{{4,{4},0x[0-9a-f]+},{5,{5},0x[0-9a-f]+}}",type="complex_type [2]",thread-id="1",has_more="0"
```

llvm-svn: 235807

9 years ago[Sema] Check if a builtin is FunctionPrototype().
Davide Italiano [Sat, 25 Apr 2015 20:20:04 +0000 (20:20 +0000)]
[Sema] Check if a builtin is FunctionPrototype().

Don't assume it's always is. This prevents a crash in Sema while
trying to merge return type for a builtin w/out function prototype.

PR: 23086
Differential Revision: http://reviews.llvm.org/D9235
Reviewed by: rsmith

llvm-svn: 235806

9 years agoAdd -gdb-set/-gdb-show expand-aggregates option (MI)
Ilia K [Sat, 25 Apr 2015 20:10:02 +0000 (20:10 +0000)]
Add -gdb-set/-gdb-show expand-aggregates option (MI)

Use this option to expand complex types always:
```
-var-create var1 * complx
^done,name="var1",numchild="3",value="{...}",type="complex_type",thread-id="1",has_more="0"
-var-create var2 * complx_array
^done,name="var2",numchild="2",value="[2]",type="complex_type [2]",thread-id="1",has_more="0"
-gdb-set print expand-aggregates on
^done
-var-create var3 * complx
^done,name="var3",numchild="3",value="{i = 3, inner = {l = 3}, complex_ptr = 0x[0-9a-f]+}",type="complex_type",thread-id="1",has_more="0"
-var-create var4 * complx_array
^done,name="var4",numchild="2",value="{[0] = {i = 4, inner = {l = 4}, complex_ptr = 0x[0-9a-f]+}, [1] = {i = 5, inner = {l = 5}, complex_ptr = 0x[0-9a-f]+}}",type="complex_type [2]",thread-id="1",has_more="0"
```

llvm-svn: 235805

9 years agoAdd -gdb-set/-gdb-show print char-array-as-string option (MI)
Ilia K [Sat, 25 Apr 2015 19:44:56 +0000 (19:44 +0000)]
Add -gdb-set/-gdb-show print char-array-as-string option (MI)

llvm-svn: 235804

9 years ago[ARM] Simplify code. NFC.
Benjamin Kramer [Sat, 25 Apr 2015 17:25:13 +0000 (17:25 +0000)]
[ARM] Simplify code. NFC.

llvm-svn: 235803

9 years ago[hexagon] Use range-based for loops. No functionality change intended.
Benjamin Kramer [Sat, 25 Apr 2015 14:46:53 +0000 (14:46 +0000)]
[hexagon] Use range-based for loops. No functionality change intended.

llvm-svn: 235802

9 years ago[hexagon] Remove setHexLibcallName, it leaks memory.
Benjamin Kramer [Sat, 25 Apr 2015 14:46:46 +0000 (14:46 +0000)]
[hexagon] Remove setHexLibcallName, it leaks memory.

Just spell out the full names, it's not that much more code.
No functional change intended.

llvm-svn: 235801

9 years agoline endings fix
Simon Pilgrim [Sat, 25 Apr 2015 12:12:43 +0000 (12:12 +0000)]
line endings fix

llvm-svn: 235800

9 years ago[Msan] Fix the iconv.cc test to build and pass on FreeBSD
Viktor Kutuzov [Sat, 25 Apr 2015 11:07:05 +0000 (11:07 +0000)]
[Msan] Fix the iconv.cc test to build and pass on FreeBSD
Differential Revision: http://reviews.llvm.org/D9252

llvm-svn: 235799

9 years ago[asan] Print SHADOW_SCALE and SHADOW_GRANULARITY as decimal values.
Daniel Sanders [Sat, 25 Apr 2015 10:57:35 +0000 (10:57 +0000)]
[asan] Print SHADOW_SCALE and SHADOW_GRANULARITY as decimal values.

Summary:
During the review of http://reviews.llvm.org/D9199 where I had originally
changed the debug_mapping.cc test to accept hexadecimal values, we realized
that SHADOW_SCALE and SHADOW_GRANULARITY ought to be printed as decimal values.
This patch makes that change.

This patch also adds a '0x' prefix to the SHADOW_OFFSET to make it clear that
it is hexadecimal while the other two are decimal.

Reviewers: kcc, timurrrr, samsonov

Reviewed By: timurrrr, samsonov

Subscribers: samsonov, llvm-commits, sagar

Differential Revision: http://reviews.llvm.org/D9224

llvm-svn: 235798

9 years agounwind: clean up warnings from the build
Saleem Abdulrasool [Sat, 25 Apr 2015 02:06:15 +0000 (02:06 +0000)]
unwind: clean up warnings from the build

Now thta the build is split, clean up some of the warnings in the build:
  cc1: warning: command line option '-nostdinc++' is valid for C++/ObjC++ but not for C
  cc1: warning: command line option '-fno-rtti' is valid for C++/ObjC++ but not for C

Append the C++ specific flags specifically to the C++ sources.  Avoids the
spurious warnings due to invalid flags being passed during the compilation of
C++ sources.

llvm-svn: 235797

9 years agobuild: make libunwind a proper project
Saleem Abdulrasool [Sat, 25 Apr 2015 01:47:39 +0000 (01:47 +0000)]
build: make libunwind a proper project

This allows the build infrastructure to properly detect and build libunwind.

llvm-svn: 235796

9 years agolibunwind: add new build logic
Saleem Abdulrasool [Sat, 25 Apr 2015 01:46:35 +0000 (01:46 +0000)]
libunwind: add new build logic

This replicates most of the build infrastructure from libc++abi ported to
libunwind.  This allows building libunwind without requiring libc++abi.

llvm-svn: 235795

9 years agolibc++abi: remove build infrastructure for unwind
Saleem Abdulrasool [Sat, 25 Apr 2015 01:46:29 +0000 (01:46 +0000)]
libc++abi: remove build infrastructure for unwind

This removes the libunwind build infrastructure as libunwind is gaining its own
CMakeLists.txt.  The removal must occur first due to the multiple definitions of
the same target.

llvm-svn: 235794

9 years agoInstrProf: Fix coverage maps for conditional operators
Justin Bogner [Fri, 24 Apr 2015 23:37:57 +0000 (23:37 +0000)]
InstrProf: Fix coverage maps for conditional operators

This fixes a crash when we're emitting coverage and a macro appears
between two binary conditional operators, ie, "foo ?: MACRO ?: bar",
and fixes the interaction of macros and conditional operators in
general.

llvm-svn: 235793

9 years agoFix build error from accidental change
Andrew Kaylor [Fri, 24 Apr 2015 23:34:46 +0000 (23:34 +0000)]
Fix build error from accidental change

llvm-svn: 235792

9 years ago[WinEH] Find correct cloned entry block for outlined handler functions.
Andrew Kaylor [Fri, 24 Apr 2015 23:27:32 +0000 (23:27 +0000)]
[WinEH] Find correct cloned entry block for outlined handler functions.

llvm-svn: 235791

9 years agoEliminate redundant Alias test and improve Common Short Spellings test http://review...
Adrian McCarthy [Fri, 24 Apr 2015 23:18:15 +0000 (23:18 +0000)]
Eliminate redundant Alias test and improve Common Short Spellings test  reviews.llvm.org/D9268

llvm-svn: 235790

9 years ago[WinEH] Find correct cloned entry block for outlined handler functions.
Andrew Kaylor [Fri, 24 Apr 2015 23:10:38 +0000 (23:10 +0000)]
[WinEH] Find correct cloned entry block for outlined handler functions.

llvm-svn: 235789

9 years agoAssert that Process::FindInEnvPath() is passed a relative path.
Nico Weber [Fri, 24 Apr 2015 22:18:46 +0000 (22:18 +0000)]
Assert that Process::FindInEnvPath() is passed a relative path.

It misbehaves with absolute paths. (So does path::append().)
Goes with clang r235787.

llvm-svn: 235788

9 years agoclang-cl: Don't look up absolute paths in %LIB%.
Nico Weber [Fri, 24 Apr 2015 22:16:53 +0000 (22:16 +0000)]
clang-cl: Don't look up absolute paths in %LIB%.

Before this patch, passing a non-existent absolute path to clang-cl would cause
stat'ing of impossible paths. For example, `clang-cl -c d:\adsfasdf.txt` would
cause a stat of
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIBd:\asdfadsf.cc

llvm-svn: 235787

9 years agoLinker: Copy over function metadata attachments
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 22:07:31 +0000 (22:07 +0000)]
Linker: Copy over function metadata attachments

Update `lib/Linker` to handle `Function` metadata attachments.  The
attachments stick with the function body.

llvm-svn: 235786

9 years agoIR: Add assembly/bitcode support for function metadata attachments
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 22:04:41 +0000 (22:04 +0000)]
IR: Add assembly/bitcode support for function metadata attachments

Add serialization support for function metadata attachments (added in
r235783).  The syntax is:

    define @foo() !attach !0 {

Metadata attachments are only allowed on functions with bodies.  Since
they come before the `{`, they're not really part of the body; since
they require a body, they're not really part of the header.  In
`LLParser` I gave them a separate function called from `ParseDefine()`,
`ParseOptionalFunctionMetadata()`.

In bitcode, I'm using the same `METADATA_ATTACHMENT` record used by
instructions.  Instruction metadata attachments are included in a
special "attachment" block at the end of a `Function`.  The attachment
records are laid out like this:

    InstID (KindID MetadataID)+

Note that these records always have an odd number of fields.  The new
code takes advantage of this to recognize function attachments (which
don't need an instruction ID):

    (KindID MetadataID)+

This means we can use the same attachment block already used for
instructions.

This is part of PR23340.

llvm-svn: 235785

9 years agoVerifier: Function metadata attachments require a body
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 21:53:27 +0000 (21:53 +0000)]
Verifier: Function metadata attachments require a body

Add a verifier check that only functions with bodies have metadata
attachments.  This should help catch bugs in frontends and
transformation passes.  Part of PR23340.

llvm-svn: 235784

9 years agoIR: Add Function metadata attachments
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 21:51:02 +0000 (21:51 +0000)]
IR: Add Function metadata attachments

Add IR support for `Metadata` attachments.  Assembly and bitcode support
will follow shortly, but for now we just have unit tests.  This is part
of PR23340.

llvm-svn: 235783

9 years agoLLParser: Simplify ParseInstructionMetadata(), NFC
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 21:29:36 +0000 (21:29 +0000)]
LLParser: Simplify ParseInstructionMetadata(), NFC

Remove unused `PFS` variable and take the `Instruction` by reference.
(Not really related to PR23340, but might as well clean this up while
I'm here.)

llvm-svn: 235782

9 years ago[DAGCombiner] Fix the type used in canFoldInAddressingMode to account for the
Quentin Colombet [Fri, 24 Apr 2015 21:28:00 +0000 (21:28 +0000)]
[DAGCombiner] Fix the type used in canFoldInAddressingMode to account for the
right scaling.

In the function canFoldInAddressingMode, VT is computed as the type of the
destination/source of a LOAD/STORE operations, instead of the memory type of the
operation.
On targets with a scaling factor on the offset of the LOAD/STORE operations, the
function may return false for actually valid cases. This may then prevent the
selection of profitable pre or post indexed load/store operations, and instead
select pre or post indexed load/store for unprofitable cases.

Patch by Francois de Ferriere <francois.de-ferriere@st.com>!

Differential Revision: http://reviews.llvm.org/D9146

llvm-svn: 235780

9 years ago[ASan/Win] Increase the size of the PC array for coverage on Windows
Timur Iskhodzhanov [Fri, 24 Apr 2015 21:24:51 +0000 (21:24 +0000)]
[ASan/Win] Increase the size of the PC array for coverage on Windows

llvm-svn: 235779

9 years agoLLParser: Split out ParseMetadataAttachment(), NFC
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 21:21:57 +0000 (21:21 +0000)]
LLParser: Split out ParseMetadataAttachment(), NFC

Make the code reusable for `Function` metadata attachments (PR23340).

llvm-svn: 235778

9 years ago[opaque pointer type] Verifier/AutoUpgrade: Remove a few uses of PointerType::getElem...
David Blaikie [Fri, 24 Apr 2015 21:16:07 +0000 (21:16 +0000)]
[opaque pointer type] Verifier/AutoUpgrade: Remove a few uses of PointerType::getElementType

llvm-svn: 235777

9 years agoUse MemoryBufferRef instead of MemoryBuffer&. NFC.
Rafael Espindola [Fri, 24 Apr 2015 21:10:50 +0000 (21:10 +0000)]
Use MemoryBufferRef instead of MemoryBuffer&. NFC.

This just reduces the noise from another patch.

llvm-svn: 235776

9 years agoAsmWriter: Parameterize the syntactic separator for attachments
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 21:06:21 +0000 (21:06 +0000)]
AsmWriter: Parameterize the syntactic separator for attachments

Parameterize the separator for attachments, since `Function` metadata
attachments (PR23340) aren't going to use a `,` (comma).  No real
functionality change.

llvm-svn: 235775

9 years agoAsmWriter: Only collect attachment names once per module
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 21:03:05 +0000 (21:03 +0000)]
AsmWriter: Only collect attachment names once per module

Collect metadata names once per `AssemblyWriter` instead of every time
we need to print some attachments.  Just a drive-by; this caught my eye
while I was refactoring the code in r235772.

llvm-svn: 235774

9 years agoRemove an unused variable to prevent -Werror build failures.
Kaelyn Takata [Fri, 24 Apr 2015 21:02:18 +0000 (21:02 +0000)]
Remove an unused variable to prevent -Werror build failures.

llvm-svn: 235773

9 years agoAsmWriter: Split out code for printing Metadata attachments, NFC
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 20:59:52 +0000 (20:59 +0000)]
AsmWriter: Split out code for printing Metadata attachments, NFC

Refactor the code for printing `Instruction` metadata attachments so it
can be reused for `Function`.

llvm-svn: 235772

9 years agoSimplifyCFG: Correctly handle switch lookup tables which fully cover the input type...
Hans Wennborg [Fri, 24 Apr 2015 20:57:56 +0000 (20:57 +0000)]
SimplifyCFG: Correctly handle switch lookup tables which fully cover the input type and use bit tests to check for holes

When using bit tests for hole checks, we call AddPredecessorToBlock to give the
phi node a value from the bit test block. This would break if we've
previously called removePredecessor on the default destination because the
switch is fully covered.

Test case by Mark Lacey.

llvm-svn: 235771

9 years agoIR: Use a bitmask to access GlobalObject subclass data
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 20:47:23 +0000 (20:47 +0000)]
IR: Use a bitmask to access GlobalObject subclass data

Make room for more than just `Function::isMaterializable()` in the
`GlobalObject` subclass data bitfield.  Since we're treating it like a
bitfield, change `Function::Function()` to zero-out the whole thing.

llvm-svn: 235770

9 years agoIR: Extract set logic from Instruction attachments, NFC
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 20:36:25 +0000 (20:36 +0000)]
IR: Extract set logic from Instruction attachments, NFC

Extract the set logic for metadata attachments from `Instruction` so it
can be reused for `Function` (PR23340).

This data structure makes a `SmallVector<>` look (a little) like a map,
just doing the bare minimum to support the `Instruction` (and soon,
`Function`) metadata API.

llvm-svn: 235769

9 years ago[SEH] Implement GetExceptionCode in __except blocks
Reid Kleckner [Fri, 24 Apr 2015 20:25:05 +0000 (20:25 +0000)]
[SEH] Implement GetExceptionCode in __except blocks

This introduces an intrinsic called llvm.eh.exceptioncode. It is lowered
by copying the EAX value live into whatever basic block it is called
from. Obviously, this only works if you insert it late during codegen,
because otherwise mid-level passes might reschedule it.

llvm-svn: 235768

9 years agoIR: Use remove_if for Instruction::dropUnknownMetadata()
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 20:23:44 +0000 (20:23 +0000)]
IR: Use remove_if for Instruction::dropUnknownMetadata()

Technically the operations are different -- the old logic moved items
from the back into the opened-up slots, instead of the usual
`remove_if()` logic of a slow and a fast iterator -- but unless a
profile tells us otherwise I prefer the simpler logic here.  Regardless,
there shouldn't be an observable function change.

llvm-svn: 235767

9 years agounwind: remove libc++abi tests
Saleem Abdulrasool [Fri, 24 Apr 2015 20:21:43 +0000 (20:21 +0000)]
unwind: remove libc++abi tests

These are related to libc++abi's personality routine and not core unwinding.
These have been restored in libc++abi, and are no longer needed here.

llvm-svn: 235766

9 years agolibc++abi: move tests back
Saleem Abdulrasool [Fri, 24 Apr 2015 20:20:54 +0000 (20:20 +0000)]
libc++abi: move tests back

These are apparently related to libc++'s unwind personality handler and not
unwind core.  Move them back to the correct location.

llvm-svn: 235765

9 years agoIR: Remove MDMapTy and MDPairTy typedefs, NFC
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 20:19:13 +0000 (20:19 +0000)]
IR: Remove MDMapTy and MDPairTy typedefs, NFC

Remove some typedefs in preparation for factoring out attachment logic
from `Instruction`.

llvm-svn: 235764

9 years agoIR: Rename LLVMContextImpl::MetadataStore to InstructionMetadata
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 20:16:42 +0000 (20:16 +0000)]
IR: Rename LLVMContextImpl::MetadataStore to InstructionMetadata

Rename `MetadataStore` to the more explicit `InstructionMetadata`.  This
will make room for `FunctionMetadata` (start of PR23340).

llvm-svn: 235763

9 years agoFix compilation warnings without cl_khr_fp64
Jan Vesely [Fri, 24 Apr 2015 19:54:17 +0000 (19:54 +0000)]
Fix compilation warnings without cl_khr_fp64

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 235762

9 years ago[LSan] Add function attribute forgotten in r235728.
Alexey Samsonov [Fri, 24 Apr 2015 19:45:46 +0000 (19:45 +0000)]
[LSan] Add function attribute forgotten in r235728.

llvm-svn: 235761

9 years agolibc++abi: remove the duplicated unwind content
Saleem Abdulrasool [Fri, 24 Apr 2015 19:40:31 +0000 (19:40 +0000)]
libc++abi: remove the duplicated unwind content

The unwinder has been moved into its own project setup at
http://svn.llvm.org/projects/libunwind/trunk.  This simply removes the now
duplicated content.  This move was previously discussed on llvmdev at [1].

[1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-January/081507.html

llvm-svn: 235759

9 years agounwind: move src/Unwind, include/, and test/ unwind content
Saleem Abdulrasool [Fri, 24 Apr 2015 19:39:17 +0000 (19:39 +0000)]
unwind: move src/Unwind, include/, and test/ unwind content

This moves the majority of the unwind sources into the new project layout for
libunwind.  This was previously discussed on llvmdev at [1].  This is a
purely movement related change, with the build infrastructure currently still
residing in the libc++abi repository.

[1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-January/081507.html

llvm-svn: 235758

9 years ago[opaque pointer type] Update test cases now that the type for an invoke is just a...
David Blaikie [Fri, 24 Apr 2015 19:33:25 +0000 (19:33 +0000)]
[opaque pointer type] Update test cases now that the type for an invoke is just a function type, not a pointer-to-function type

llvm-svn: 235756

9 years ago[opaque pointer type] Add textual IR support for explicit type parameter to the invok...
David Blaikie [Fri, 24 Apr 2015 19:32:54 +0000 (19:32 +0000)]
[opaque pointer type] Add textual IR support for explicit type parameter to the invoke instruction

Same as r235145 for the call instruction - the justification, tradeoffs,
etc are all the same. The conversion script worked the same without any
false negatives (after replacing 'call' with 'invoke').

llvm-svn: 235755

9 years ago[PATCH] [Hexagon] Adding a test case for calling convention.
Sundeep Kushwaha [Fri, 24 Apr 2015 19:22:02 +0000 (19:22 +0000)]
[PATCH] [Hexagon] Adding a test case for calling convention.

http://reviews.llvm.org/D9241

llvm-svn: 235754

9 years ago[AsmPrinter] Make AsmPrinter's OutStreamer member a unique_ptr.
Lang Hames [Fri, 24 Apr 2015 19:11:51 +0000 (19:11 +0000)]
[AsmPrinter] Make AsmPrinter's OutStreamer member a unique_ptr.

AsmPrinter owns the OutStreamer, so an owning pointer makes sense here. Using a
reference for this is crufty.

llvm-svn: 235752

9 years agoSimplify parseMemberFiles to take a single file.
Rafael Espindola [Fri, 24 Apr 2015 19:08:51 +0000 (19:08 +0000)]
Simplify parseMemberFiles to take a single file.

llvm-svn: 235751

9 years agoRevert r235749 - Accidentally commited cruft from the wrong path.
Lang Hames [Fri, 24 Apr 2015 19:08:30 +0000 (19:08 +0000)]
Revert r235749 - Accidentally commited cruft from the wrong path.

llvm-svn: 235750

9 years ago[CodeGen] Make AsmPrinter's OutStreamer member a unique_ptr.
Lang Hames [Fri, 24 Apr 2015 19:04:55 +0000 (19:04 +0000)]
[CodeGen] Make AsmPrinter's OutStreamer member a unique_ptr.

AsmPrinter owns the OutStreamer, so an owning pointer makes sense here. Using a
reference for this is crufty.

llvm-svn: 235749

9 years agoSimplify now that there is only one file. NFC.
Rafael Espindola [Fri, 24 Apr 2015 19:01:30 +0000 (19:01 +0000)]
Simplify now that there is only one file. NFC.

llvm-svn: 235747