platform/upstream/llvm.git
9 years agoAdd missing include.
Benjamin Kramer [Wed, 17 Jun 2015 21:08:22 +0000 (21:08 +0000)]
Add missing include.

llvm-svn: 239946

9 years agoCOFF: Simplify. NFC.
Rui Ueyama [Wed, 17 Jun 2015 21:01:56 +0000 (21:01 +0000)]
COFF: Simplify. NFC.

Executor is a convenience class to run an external command.

llvm-svn: 239945

9 years ago[Bitcode] Replace hand-coded little endian handling with Endian.h functions.
Benjamin Kramer [Wed, 17 Jun 2015 20:55:30 +0000 (20:55 +0000)]
[Bitcode] Replace hand-coded little endian handling with Endian.h functions.

No functional change intended.

llvm-svn: 239944

9 years agoAMDGPU: Change unreachable into reported error
Matt Arsenault [Wed, 17 Jun 2015 20:55:25 +0000 (20:55 +0000)]
AMDGPU: Change unreachable into reported error

llvm-svn: 239943

9 years agoremove unnecessary casts; NFC
Sanjay Patel [Wed, 17 Jun 2015 20:54:46 +0000 (20:54 +0000)]
remove unnecessary casts; NFC

llvm-svn: 239942

9 years agoUpdate clang to take into account the changes to personality fns
David Majnemer [Wed, 17 Jun 2015 20:53:19 +0000 (20:53 +0000)]
Update clang to take into account the changes to personality fns

llvm-svn: 239941

9 years agoMove the personality function from LandingPadInst to Function
David Majnemer [Wed, 17 Jun 2015 20:52:32 +0000 (20:52 +0000)]
Move the personality function from LandingPadInst to Function

The personality routine currently lives in the LandingPadInst.

This isn't desirable because:
- All LandingPadInsts in the same function must have the same
  personality routine.  This means that each LandingPadInst beyond the
  first has an operand which produces no additional information.

- There is ongoing work to introduce EH IR constructs other than
  LandingPadInst.  Moving the personality routine off of any one
  particular Instruction and onto the parent function seems a lot better
  than have N different places a personality function can sneak onto an
  exceptional function.

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

llvm-svn: 239940

9 years ago[CodeGenPrepare] Generalize inserted set from truncs to any inst.
Ahmed Bougacha [Wed, 17 Jun 2015 20:44:32 +0000 (20:44 +0000)]
[CodeGenPrepare] Generalize inserted set from truncs to any inst.

It's been used before to avoid infinite loops caused by separate CGP
optimizations undoing one another.  We found one more such issue
caused by r238054.  To avoid it, generalize the "InsertedTruncs"
set to any inst, and use it to avoid touching those again.

llvm-svn: 239938

9 years agoCOFF: Create import library files.
Rui Ueyama [Wed, 17 Jun 2015 20:40:43 +0000 (20:40 +0000)]
COFF: Create import library files.

On Windows, we have to create a .lib file for each .dll.
When linking against DLLs, the linker doesn't use the DLL files,
but instead read a list of dllexported symbols from corresponding
lib files.

A library file containing descriptors of a DLL is called an
import library file.

lib.exe has a feature to create an import library file from a
module-definition file. In this patch, we create a module-definition
file and pass that to lib.exe.

We eventually want to create an import library file by ourselves
to eliminate dependency to lib.exe. For now, we just use the MSVC
tool.

llvm-svn: 239937

9 years ago[modules] If we merge a template, also track that its parameters are merged so
Richard Smith [Wed, 17 Jun 2015 20:39:41 +0000 (20:39 +0000)]
[modules] If we merge a template, also track that its parameters are merged so
that we know when its default arguments should be visible.

llvm-svn: 239936

9 years ago[Hexagon] Adding a number of other tests for min/max instructions and loading i1s.
Colin LeMahieu [Wed, 17 Jun 2015 20:29:33 +0000 (20:29 +0000)]
[Hexagon] Adding a number of other tests for min/max instructions and loading i1s.

llvm-svn: 239935

9 years ago[modules] Improve diagnostic for a template-id that's invalid because a default
Richard Smith [Wed, 17 Jun 2015 20:16:32 +0000 (20:16 +0000)]
[modules] Improve diagnostic for a template-id that's invalid because a default
argument is not visible.

llvm-svn: 239934

9 years agoMove IsUsedInReloc from MCSymbolELF to MCSymbol.
Rafael Espindola [Wed, 17 Jun 2015 20:08:20 +0000 (20:08 +0000)]
Move IsUsedInReloc from MCSymbolELF to MCSymbol.

There is a free bit is MCSymbol and MachO needs the same information.

llvm-svn: 239933

9 years ago[ARM] Replace hard coded metadata arguments in tests with a regex.
Ranjeet Singh [Wed, 17 Jun 2015 19:56:30 +0000 (19:56 +0000)]
[ARM] Replace hard coded metadata arguments in tests with a regex.

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

llvm-svn: 239932

9 years agoCOFF: Fix a test which was failing with debug build.
Rui Ueyama [Wed, 17 Jun 2015 19:28:01 +0000 (19:28 +0000)]
COFF: Fix a test which was failing with debug build.

llvm-svn: 239931

9 years agoCOFF: Support module-definition files.
Rui Ueyama [Wed, 17 Jun 2015 19:19:25 +0000 (19:19 +0000)]
COFF: Support module-definition files.

Module-definition files (.def files) are yet another way to
specify parameters to the linker. You can write a list of dllexported
symbols in module-definition files instead of using /export command
line option. It also supports a few more directives.

The parser code is taken from lib/Driver/WinLinkModuleDef.cpp
with the following modifications.

 - variable names are updated to comply with the LLVM coding style.
 - Instead of returning parsing results as "directive" objects,
   it updates Config object directly.

llvm-svn: 239929

9 years agoCodeGen: Factor out some of the bitset entry creation code. NFC.
Peter Collingbourne [Wed, 17 Jun 2015 19:08:05 +0000 (19:08 +0000)]
CodeGen: Factor out some of the bitset entry creation code. NFC.

llvm-svn: 239927

9 years agoMove xtest to its own file to match the gcc header organization.
Eric Christopher [Wed, 17 Jun 2015 18:42:07 +0000 (18:42 +0000)]
Move xtest to its own file to match the gcc header organization.

llvm-svn: 239926

9 years agoUpdate comments on HLE, RTM, and ADX support for intrinsics.
Eric Christopher [Wed, 17 Jun 2015 18:42:03 +0000 (18:42 +0000)]
Update comments on HLE, RTM, and ADX support for intrinsics.

llvm-svn: 239925

9 years ago[NativeProcessLinux] Use fast memory reads, if the system supports it
Pavel Labath [Wed, 17 Jun 2015 18:38:49 +0000 (18:38 +0000)]
[NativeProcessLinux] Use fast memory reads, if the system supports it

Summary:
Memory reads using the ptrace API need to be executed on a designated thread
and in 4-byte increments. The process_vm_read syscall has no such requirements
and it is about 50 times faster. This patch makes lldb-server use the faster
API if the target kernel supports it. Kernel support for this feature is
determined at runtime. Using process_vm_writev in the same manner is more
complicated since this syscall (unlike ptrace) respects page protection settings
and so it cannot be used to set a breakpoint, since code pages are typically
read-only. However, memory writes are not currently a performance bottleneck as
they happen much more rarely.

Test Plan: all tests continue to pass

Reviewers: ovyalov, vharron

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 239924

9 years agoLowerBitSets: Do not assign names to aliases of unnamed bitset element objects.
Peter Collingbourne [Wed, 17 Jun 2015 18:31:02 +0000 (18:31 +0000)]
LowerBitSets: Do not assign names to aliases of unnamed bitset element objects.

The restriction on unnamed aliases was removed in r239921. Mostly reverts
r239590, but we keep the test.

llvm-svn: 239923

9 years agoAllow aliases to be unnamed.
Rafael Espindola [Wed, 17 Jun 2015 17:53:31 +0000 (17:53 +0000)]
Allow aliases to be unnamed.

If globals can be unnamed, there is no reason for aliases to be different.

The restriction was there since the original implementation in r36435. I
can only guess it was there because of the old bison parser for the old
alias syntax.

llvm-svn: 239921

9 years ago[fixit] Use overwriteChangedFiles() to deal with Windows mapped files
Reid Kleckner [Wed, 17 Jun 2015 17:47:30 +0000 (17:47 +0000)]
[fixit] Use overwriteChangedFiles() to deal with Windows mapped files

Fixes one instance of PR17960.

llvm-svn: 239920

9 years agoUse a range loop. NFC.
Rafael Espindola [Wed, 17 Jun 2015 17:33:37 +0000 (17:33 +0000)]
Use a range loop. NFC.

llvm-svn: 239919

9 years agoCorrect type in for loop to remove signedness warning
Ed Maste [Wed, 17 Jun 2015 17:29:56 +0000 (17:29 +0000)]
Correct type in for loop to remove signedness warning

llvm-svn: 239918

9 years ago[Hexagon] Adding some compare tests, fixing existing XFAILed tests, and removing...
Colin LeMahieu [Wed, 17 Jun 2015 17:19:05 +0000 (17:19 +0000)]
[Hexagon] Adding some compare tests, fixing existing XFAILed tests, and removing mcpu=hexagonv4 since that's the minimum version anyway.

llvm-svn: 239917

9 years agofix typos in comments; NFC
Sanjay Patel [Wed, 17 Jun 2015 16:34:48 +0000 (16:34 +0000)]
fix typos in comments; NFC

llvm-svn: 239916

9 years agoAdd documentation for new backedge mass propagation in irregular loops.
Diego Novillo [Wed, 17 Jun 2015 16:28:22 +0000 (16:28 +0000)]
Add documentation for new backedge mass propagation in irregular loops.

Tweak test cases and rename headerIndexFor -> getHeaderIndex.

llvm-svn: 239915

9 years agoUse named temporaries for directional labels.
Rafael Espindola [Wed, 17 Jun 2015 16:26:47 +0000 (16:26 +0000)]
Use named temporaries for directional labels.

Directional labels can show up in symbol tables (and we have a llvm-mc test for
that). Given that, we need to make sure they are named.

With that out of the way, use setUseNamesOnTempLabels in llvm-mc so that it
too benefits from the memory saving.

llvm-svn: 239914

9 years ago[ArchiveWriter] Use EndianStream. No functional change intended.
Benjamin Kramer [Wed, 17 Jun 2015 16:02:56 +0000 (16:02 +0000)]
[ArchiveWriter] Use EndianStream. No functional change intended.

llvm-svn: 239913

9 years agoHave CMake error out on Windows when user wants OMPT support
Jonathan Peyton [Wed, 17 Jun 2015 15:43:34 +0000 (15:43 +0000)]
Have CMake error out on Windows when user wants OMPT support

Currently, OMPT support requires the weak attribute which isn't supported
on Windows.  This patch has CMake error out when LIBOMP_OMPT_SUPPORT=true
and the users is building on Windows.
http://lists.cs.uiuc.edu/pipermail/openmp-dev/2015-June/000692.html

Patch by Jonas Hahnfeld

llvm-svn: 239912

9 years ago[MC/Dwarf] Encode DW_CFA_advance_loc in target endianess.
Benjamin Kramer [Wed, 17 Jun 2015 15:14:35 +0000 (15:14 +0000)]
[MC/Dwarf] Encode DW_CFA_advance_loc in target endianess.

This matches GNU as output.

llvm-svn: 239911

9 years ago[mips] [IAS] Add support for expanding LASym with a source register operand.
Toma Tabacu [Wed, 17 Jun 2015 14:31:51 +0000 (14:31 +0000)]
[mips] [IAS] Add support for expanding LASym with a source register operand.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

llvm-svn: 239910

9 years agoclang-tidy: Add checker that warn when macro argument with side effects is repeated...
Daniel Marjamaki [Wed, 17 Jun 2015 14:19:35 +0000 (14:19 +0000)]
clang-tidy: Add checker that warn when macro argument with side effects is repeated in the macro

llvm-svn: 239909

9 years ago[ELF/x86_64] Fix initial-exec TLS access
Adhemerval Zanella [Wed, 17 Jun 2015 14:00:12 +0000 (14:00 +0000)]
[ELF/x86_64] Fix initial-exec TLS access

Current approach for initial-exec in ELF/x86_64 is to create a GOT entry
and change the relocation to R_X86_64_PC32 to be handled as a GOT offfset.
However there are two issues with this approach: 1. the R_X86_64_PC32 is
not really required since the GOT relocation will be handle dynamically and
2. the TLS symbols are not being exported externally and then correct
realocation are not being applied.

This patch fixes the R_X86_64_GOTTPOFF handling by just emitting a
R_X86_64_TPOFF64 dynamically one; it also sets R_X86_64_TPOFF64 to be
handled by runtime one.  For second part, the patches uses a similar
strategy used for aarch64, by reimplementing buildDynamicSymbolTable
from X86_64ExecutableWriter and adding the TLS symbols in the dynamic
symbol table.

Some tests had to be adjusted due the now missing R_X86_64_PC32 relocation.
With this test the simple testcase:

* t1.c:

__thread int t0;
__thread int t1;
__thread int t2;
__thread int t3;

* t0.c:

extern __thread int t0;
extern __thread int t1;
extern __thread int t2;
extern __thread int t3;

__thread int t4;
__thread int t5;
__thread int t6;
__thread int t7;

int main ()
{
  t0 = 1;
  t1 = 2;
  t2 = 3;
  t3 = 4;

  t4 = 5;
  t5 = 6;
  t6 = 7;
  t7 = 8;

  printf ("%i %i %i %i\n", t0, t1, t2, t3);
  printf ("%i %i %i %i\n", t4, t5, t6, t7);

  return 0;
}

Shows correct output for x86_64.

llvm-svn: 239908

9 years agoTweak wording of alignment static_assert messages.
James Y Knight [Wed, 17 Jun 2015 13:53:12 +0000 (13:53 +0000)]
Tweak wording of alignment static_assert messages.

llvm-svn: 239907

9 years ago[ELF] Fix wrong TBSS size
Adhemerval Zanella [Wed, 17 Jun 2015 13:46:07 +0000 (13:46 +0000)]
[ELF] Fix wrong TBSS size

This patch fixes the wrong .tbss segment size generated for cases where
multiple modules have non initialized threads variables.  For instance:

* t0.c

__thread int x0;
__thread int x1;
__thread int x2;

extern __thread int e0;
extern __thread int e1;
extern __thread int e2;
extern __thread int e3;

int foo0 ()
{
  return x0;
}

int main ()
{
  return x0;
}

* t1.c

__thread int e0;
__thread int e1;
__thread int e2;
__thread int e3;

lld is generating (for aarch64):

  [14] .tbss             NOBITS           0000000000401000  00001000
       0000000000000010  0000000000000000 WAT       0     0     4

Where is just taking in consideration the largest tbss segment, not all
from all objects.  ld generates a correct output:

  [17] .tbss             NOBITS           0000000000410dec  00000dec
       000000000000001c  0000000000000000 WAT       0     0     4

This issue is at 'lib/ReaderWriter/ELF/SegmentChunks.cpp' where
Segment<ELFT>::assignVirtualAddress is setting wrong slice values, not taking care
of although tbss segments file size does noy play role in other segment virtual
address placement, its size should still be considered.

llvm-svn: 239906

9 years ago[mips] [IAS] Add support for the B{L,G}{T,E}(U) branch pseudo-instructions.
Toma Tabacu [Wed, 17 Jun 2015 13:20:24 +0000 (13:20 +0000)]
[mips] [IAS] Add support for the B{L,G}{T,E}(U) branch pseudo-instructions.

Summary:
This does not include support for the immediate variants of these pseudo-instructions.
Fixes llvm.org/PR20968.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: seanbruno, emaste, llvm-commits

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

llvm-svn: 239905

9 years ago[clang-tidy] Move user-defined matches to unnamed namespaces to prevent ODR violations.
Alexander Kornienko [Wed, 17 Jun 2015 13:11:37 +0000 (13:11 +0000)]
[clang-tidy] Move user-defined matches to unnamed namespaces to prevent ODR violations.

llvm-svn: 239904

9 years agoclang-format: clang-format (NFC)
Daniel Jasper [Wed, 17 Jun 2015 13:08:06 +0000 (13:08 +0000)]
clang-format: clang-format (NFC)

llvm-svn: 239903

9 years agoQualify all types used in AST matcher macros.
Alexander Kornienko [Wed, 17 Jun 2015 12:49:00 +0000 (12:49 +0000)]
Qualify all types used in AST matcher macros.

Summary:
Qualify all types used in AST matcher macros. This makes it possible to
put AST matchers in user code into a namespace other than clang::ast_matchers
and this way prevent ODR violations that could happen when a matcher with the
same name is defined in multiple translation units. Updated comments
accordingly.

Reviewers: djasper, klimek

Reviewed By: djasper, klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 239902

9 years ago[mips] [IAS] Fix LA with relative label operands.
Toma Tabacu [Wed, 17 Jun 2015 12:30:37 +0000 (12:30 +0000)]
[mips] [IAS] Fix LA with relative label operands.

Summary:
Call MCSymbolRefExpr::create() with a MCSymbol* argument, not with a StringRef
of the Symbol's name, in order to avoid creating invalid temporary symbols for
relative labels (e.g. {$,.L}tmp00, {$,.L}tmp10 etc.).

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

llvm-svn: 239901

9 years agoclang-format: Don't generate unnecessary replacements for \r\n line endings.
Daniel Jasper [Wed, 17 Jun 2015 12:23:15 +0000 (12:23 +0000)]
clang-format: Don't generate unnecessary replacements for \r\n line endings.

Patch by Mathieu Champlon. Thank you.

llvm-svn: 239900

9 years ago[mips] [IAS] Add test for SW with relative label operands. NFC.
Toma Tabacu [Wed, 17 Jun 2015 11:46:37 +0000 (11:46 +0000)]
[mips] [IAS] Add test for SW with relative label operands. NFC.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

llvm-svn: 239899

9 years agoRemove empty directories left after r239657
Alexander Kornienko [Wed, 17 Jun 2015 11:31:18 +0000 (11:31 +0000)]
Remove empty directories left after r239657

llvm-svn: 239898

9 years ago[mips] [IAS] Fix LW with relative label operands.
Toma Tabacu [Wed, 17 Jun 2015 10:43:45 +0000 (10:43 +0000)]
[mips] [IAS] Fix LW with relative label operands.

Summary:
Previously, MCSymbolRefExpr::create() was called with a StringRef of the symbol
name, which it would then search for in the Symbols StringMap (from MCContext).

However, relative labels (which are temporary symbols) are apparently not stored
in the Symbols StringMap, so we end up creating a new {$,.L}tmp symbol
({$,.L}tmp00, {$,.L}tmp10 etc.) each time we create an MCSymbolRefExpr by
passing in the symbol name as a StringRef.

Fortunately, there is a version of MCSymbolRefExpr::create() which takes an
MCSymbol* and we already have an MCSymbol* at that point, so we can just pass
that in instead of the StringRef.

I also removed the local StringRef calls to MCSymbolRefExpr::create() from
expandMemInst(), as those cases can be handled by evaluateRelocExpr() anyway.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

llvm-svn: 239897

9 years agoFix clang/test/Headers/x86intrin-2.c. _readfsbase_u32() is provided in not i686 but...
NAKAMURA Takumi [Wed, 17 Jun 2015 10:40:51 +0000 (10:40 +0000)]
Fix clang/test/Headers/x86intrin-2.c. _readfsbase_u32() is provided in not i686 but x86-64.

llvm-svn: 239896

9 years ago[OPENMP] Fixed failed test for reduction clause in simd constructs.
Alexey Bataev [Wed, 17 Jun 2015 09:51:18 +0000 (09:51 +0000)]
[OPENMP] Fixed failed test for reduction clause in simd constructs.

llvm-svn: 239895

9 years agoclang-format: [JS] Don't put top-level typescript enums on a single line.
Daniel Jasper [Wed, 17 Jun 2015 09:44:07 +0000 (09:44 +0000)]
clang-format: [JS] Don't put top-level typescript enums on a single line.

This makes this consistent with non-typescript enums.

Also shuffle the language-dependent stuff in mustBreakBefore to a
single location.

Patch initiated by Martin Probst.

llvm-svn: 239894

9 years agoclang-format: [JS] Fix typescript enum formatting.
Daniel Jasper [Wed, 17 Jun 2015 09:44:02 +0000 (09:44 +0000)]
clang-format: [JS] Fix typescript enum formatting.

Patch by Martin Probst.

Before:
  enum {
    A,
    B
  } var x = 1;

After:
  enum {
    A,
    B
  }
  var x = 1;

llvm-svn: 239893

9 years agoclang-format: NFC. Add a function to test whether an annotated line
Daniel Jasper [Wed, 17 Jun 2015 09:43:56 +0000 (09:43 +0000)]
clang-format: NFC. Add a function to test whether an annotated line
starts with a given sequence of tokens. Only the one-token version is
used yet, but other usages are coming up momentarily.

llvm-svn: 239892

9 years ago[PM/AA] Update Polly for r239886 which removed UnknownSize from
Chandler Carruth [Wed, 17 Jun 2015 08:29:32 +0000 (08:29 +0000)]
[PM/AA] Update Polly for r239886 which removed UnknownSize from
AliasAnalysis by getting it from its newly canonical home of
MemoryLocation::UnknownSize.

llvm-svn: 239890

9 years ago[OPENMP] Code reformatting for omp simd codegen, NFC.
Alexey Bataev [Wed, 17 Jun 2015 07:45:51 +0000 (07:45 +0000)]
[OPENMP] Code reformatting for omp simd codegen, NFC.

llvm-svn: 239889

9 years agoAVX-512: cvtusi2ss/d intrinsics.
Igor Breger [Wed, 17 Jun 2015 07:23:57 +0000 (07:23 +0000)]
AVX-512: cvtusi2ss/d intrinsics.
Change builtin function name and signature ( add third parameter - rounding mode ).
Added tests for intrinsics.

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

llvm-svn: 239888

9 years ago[PM/AA] Suffix lots of member variables that directly use enumeration
Chandler Carruth [Wed, 17 Jun 2015 07:21:41 +0000 (07:21 +0000)]
[PM/AA] Suffix lots of member variables that directly use enumeration
names for counts with the word 'Count' to make them less ambiguous.

This will be an actual error if we use unscoped enums for any of these,
and generally this seems much clearer to read.

Also, use clang-format to normalize the formatting of this code which
seems to have been needlessly odd.

No functionality changed here.

llvm-svn: 239887

9 years ago[PM/AA] Remove the UnknownSize static member from AliasAnalysis.
Chandler Carruth [Wed, 17 Jun 2015 07:21:38 +0000 (07:21 +0000)]
[PM/AA] Remove the UnknownSize static member from AliasAnalysis.

This is now living in MemoryLocation, which is what it pertains to. It
is also an enum there rather than a static data member which is left
never defined.

llvm-svn: 239886

9 years ago[PM/AA] Remove the Location typedef from the AliasAnalysis class now
Chandler Carruth [Wed, 17 Jun 2015 07:18:54 +0000 (07:18 +0000)]
[PM/AA] Remove the Location typedef from the AliasAnalysis class now
that it is its own entity in the form of MemoryLocation, and update all
the callers.

This is an entirely mechanical change. References to "Location" within
AA subclases become "MemoryLocation", and elsewhere
"AliasAnalysis::Location" becomes "MemoryLocation". Hope that helps
out-of-tree folks update.

llvm-svn: 239885

9 years ago[PM/AA] Split the location computation out of getArgLocation so the
Chandler Carruth [Wed, 17 Jun 2015 07:12:40 +0000 (07:12 +0000)]
[PM/AA] Split the location computation out of getArgLocation so the
virtual interface on AliasAnalysis only deals with ModRef information.

This interface was both computing memory locations by using TLI and
other tricks to estimate the size of memory referenced by an operand,
and computing ModRef information through similar investigations. This
change narrows the scope of the virtual interface on AliasAnalysis
slightly.

Note that all of this code could live in BasicAA, and be done with
a single investigation of the argument, if it weren't for the fact that
the generic code in AliasAnalysis::getModRefBehavior for a callsite
calls into the virtual aspect of (now) getArgModRefInfo. But this
patch's arrangement seems a not terrible way to go for now.

The other interesting wrinkle is how we could reasonably extend LLVM
with support for custom memory location sizes and mod/ref behavior for
library routines. After discussions with Hal on the review, the
conclusion is that this would be best done by fleshing out the much
desired support for extensions to TLI, and support these types of
queries in that interface where we would likely be doing other library
API recognition and analysis.

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

llvm-svn: 239884

9 years agoUpdate the intel intrinsic headers to use the target attribute support.
Eric Christopher [Wed, 17 Jun 2015 07:09:32 +0000 (07:09 +0000)]
Update the intel intrinsic headers to use the target attribute support.

This involved removing the conditional inclusion and replacing them
with target attributes matching the original conditional inclusion
and checks. The testcase update removes the macro checks for each
file and replaces them with usage of the __target__ attribute, e.g.:

int __attribute__((__target__(("sse3")))) foo(int a) {
  _mm_mwait(0, 0);
  return 4;
}

This usage does require the enclosing function have the requisite
__target__ attribute for inlining and code generation - also for
any macro intrinsic uses in the enclosing function. There's no change
for existing uses of the intrinsic headers.

llvm-svn: 239883

9 years agoUse a define for per-file function attributes for the Intel intrinsic headers.
Eric Christopher [Wed, 17 Jun 2015 07:09:20 +0000 (07:09 +0000)]
Use a define for per-file function attributes for the Intel intrinsic headers.

This is a precursor to changing them to use the new target attribute
code.

llvm-svn: 239882

9 years ago[OPENMP] Supported reduction clause in omp simd construct.
Alexey Bataev [Wed, 17 Jun 2015 06:21:39 +0000 (06:21 +0000)]
[OPENMP] Supported reduction clause in omp simd construct.

The following code is generated for reduction clause within 'omp simd' loop construct:
#pragma omp simd reduction(op:var)
for (...)
  <body>

alloca priv_var
priv_var = <initial reduction value>;
<loop_start>:
<body> // references to original 'var' are replaced by 'priv_var'
<loop_end>:
var op= priv_var;

llvm-svn: 239881

9 years agoRevert "AArch64: Use CMP;CCMP sequences for and/or/setcc trees."
Matthias Braun [Wed, 17 Jun 2015 04:02:32 +0000 (04:02 +0000)]
Revert "AArch64: Use CMP;CCMP sequences for and/or/setcc trees."

The patch triggers a miscompile on SPEC 2006 403.gcc with the (ref)
200.i and scilab.i inputs. I opened PR23866 to track analysis of this.

This reverts commit r238793.

llvm-svn: 239880

9 years agoparser: wordsmith diagnostic message
Saleem Abdulrasool [Wed, 17 Jun 2015 03:54:21 +0000 (03:54 +0000)]
parser: wordsmith diagnostic message

Address post-commit commit about the wording of the warning.

llvm-svn: 239879

9 years agoBasic: tweak whitespace in Attr.td
Saleem Abdulrasool [Wed, 17 Jun 2015 03:54:19 +0000 (03:54 +0000)]
Basic: tweak whitespace in Attr.td

Separate two class definitions that had been merged into a single line.  NFC.

llvm-svn: 239878

9 years agoTry to fix the MSVC build.
Rafael Espindola [Wed, 17 Jun 2015 03:13:26 +0000 (03:13 +0000)]
Try to fix the MSVC build.

llvm-svn: 239877

9 years ago[Hexagon] Adding MC ELF streamer and updating addend relocation test which shows...
Colin LeMahieu [Wed, 17 Jun 2015 03:06:16 +0000 (03:06 +0000)]
[Hexagon] Adding MC ELF streamer and updating addend relocation test which shows correct ELF symbol.

llvm-svn: 239876

9 years ago[.gitignore] ignore vim swap files harder
Sean Silva [Wed, 17 Jun 2015 02:21:35 +0000 (02:21 +0000)]
[.gitignore] ignore vim swap files harder

This matches the patterns for vim swap files in llvm/.gitignore

llvm-svn: 239875

9 years agoRevert r239873 - I actually want to think some more about this
Enrico Granata [Wed, 17 Jun 2015 02:11:48 +0000 (02:11 +0000)]
Revert r239873 - I actually want to think some more about this

llvm-svn: 239874

9 years agoFix an issue where the oneliner printing of variables would ignore custom formatting
Enrico Granata [Wed, 17 Jun 2015 02:06:24 +0000 (02:06 +0000)]
Fix an issue where the oneliner printing of variables would ignore custom formatting

Because vector types use their formats in special ways (i.e. children get generated based on them), this change by itself would cause a regression in printing vector types with some custom formats
Work around that issue by special casing vector types out of this format-passdown mode. I believe there is a more general feature to be designed in this space, but until I see more cases of interest, I am going to leave this as a special case

Fixes rdar://20810062

llvm-svn: 239873

9 years agoFix alignment issues in LLVM.
James Y Knight [Wed, 17 Jun 2015 01:21:20 +0000 (01:21 +0000)]
Fix alignment issues in LLVM.

Adds static_asserts to ensure alignment of concatenated objects is
correct, and fixes them where they are not.

Also changes the definition of AlignOf to use constexpr, except on
MSVC, to avoid enum comparison warnings from GCC.

(There's not too much of this in llvm itself, most of the fun is in
clang).

This seems to make LLVM actually work without Bus Error on 32bit
sparc.

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

llvm-svn: 239872

9 years agoHandle forward referenced function when streaming bitcode.
Rafael Espindola [Wed, 17 Jun 2015 01:15:47 +0000 (01:15 +0000)]
Handle forward referenced function when streaming bitcode.

Without this the included unit test would assert in

  assert(BasicBlockFwdRefs.empty() && "Unresolved blockaddress fwd references");

llvm-svn: 239871

9 years agoHandle MaterializeAll in getLazyBitcodeModuleImpl. NFC.
Rafael Espindola [Wed, 17 Jun 2015 00:40:56 +0000 (00:40 +0000)]
Handle MaterializeAll in getLazyBitcodeModuleImpl. NFC.

This just handles both cases in the same place.

Extracted from a patch by Karl Schimpf.

llvm-svn: 239870

9 years agoCOFF: Support creating DLLs.
Rui Ueyama [Wed, 17 Jun 2015 00:16:33 +0000 (00:16 +0000)]
COFF: Support creating DLLs.

DLL files are in the same format as executables but they have export tables.
The format of the export table is described in PE/COFF spec section 5.3.

A new class, EdataContents, takes care of creating chunks for export tables.
What we need to do is to parse command line flags for dllexports, and then
instantiate the class to create chunks. For the writer, export table chunks
are opaque data -- it just add chunks to .edata section.

llvm-svn: 239869

9 years agoCOFF: Fix tests.
Rui Ueyama [Tue, 16 Jun 2015 23:51:58 +0000 (23:51 +0000)]
COFF: Fix tests.

I was accidentally testing not -flavor link2 but -flavor link.

llvm-svn: 239868

9 years agoUse std::unique_ptr to manage the DataStreamer in bitcode parsing.
Rafael Espindola [Tue, 16 Jun 2015 23:29:49 +0000 (23:29 +0000)]
Use std::unique_ptr to manage the DataStreamer in bitcode parsing.

We were already deleting it, this just makes it explicit.

llvm-svn: 239867

9 years agoRename and improve emitSectionOffset.
Rafael Espindola [Tue, 16 Jun 2015 23:22:02 +0000 (23:22 +0000)]
Rename and improve emitSectionOffset.

Different object formats represent references from dwarf in different ways.

ELF uses a relocation to the referenced point (except for .dwo) and
COFF/MachO use the offset of the referenced point inside its section.

This patch renames emitSectionOffset because

* It doesn't produce an offset on ELF.
* It changes behavior depending on how DWARF is represented, so adding
dwarf to its name is probably a good thing.

The patch also adds an option to force the use of offsets.That avoids
funny looking code like

  if (!UseOffsets)
    Asm->emitSectionOffset....

It was correct, but read as if the ! was inverted.

llvm-svn: 239866

9 years agoAdd a ThreadSafe adapter over llvm::DenseSet
Enrico Granata [Tue, 16 Jun 2015 23:20:12 +0000 (23:20 +0000)]
Add a ThreadSafe adapter over llvm::DenseSet

llvm-svn: 239865

9 years agoCOFF: Add miscellaneous boolean flags.
Rui Ueyama [Tue, 16 Jun 2015 23:13:00 +0000 (23:13 +0000)]
COFF: Add miscellaneous boolean flags.

llvm-svn: 239864

9 years agoClear the "thread-format" setting after mucking with it.
Greg Clayton [Tue, 16 Jun 2015 23:09:37 +0000 (23:09 +0000)]
Clear the "thread-format" setting after mucking with it.

llvm-svn: 239863

9 years agoRefactor RecurrenceInstDesc
Tyler Nowicki [Tue, 16 Jun 2015 22:59:45 +0000 (22:59 +0000)]
Refactor RecurrenceInstDesc

Moved RecurrenceInstDesc into RecurrenceDescriptor to simplify the namespaces.

llvm-svn: 239862

9 years agoFix comments (MI).
Dawn Perchik [Tue, 16 Jun 2015 22:53:27 +0000 (22:53 +0000)]
Fix comments (MI).

llvm-svn: 239861

9 years agoAdd some tests based on PR21711
Sanjay Patel [Tue, 16 Jun 2015 22:37:50 +0000 (22:37 +0000)]
Add some tests based on PR21711

These were originally added in r227242,
but that patch was reverted because it
caused a failure on AArch64.

llvm-svn: 239860

9 years agoUpdate for llvm api change.
Rafael Espindola [Tue, 16 Jun 2015 22:32:44 +0000 (22:32 +0000)]
Update for llvm api change.

llvm-svn: 239859

9 years agoReturn a unique_ptr from getLazyBitcodeModule and parseBitcodeFile. NFC.
Rafael Espindola [Tue, 16 Jun 2015 22:27:55 +0000 (22:27 +0000)]
Return a unique_ptr from getLazyBitcodeModule and parseBitcodeFile. NFC.

llvm-svn: 239858

9 years ago[modules] Fix merging of default template arguments onto friend templates.
Richard Smith [Tue, 16 Jun 2015 21:57:05 +0000 (21:57 +0000)]
[modules] Fix merging of default template arguments onto friend templates.

Previously we'd complain about redefinition of default arguments when we
instantiated a class with a friend template that inherits its default argument,
because we propagate the default template arguemnt onto the friend when we
reload the AST.

llvm-svn: 239857

9 years ago[llvm-readobj] Print MIPS .reginfo section content
Simon Atanasyan [Tue, 16 Jun 2015 21:47:43 +0000 (21:47 +0000)]
[llvm-readobj] Print MIPS .reginfo section content

llvm-svn: 239856

9 years ago[X86][SSE] Vectorize v2i32 to v2f64 conversions
Simon Pilgrim [Tue, 16 Jun 2015 21:40:28 +0000 (21:40 +0000)]
[X86][SSE] Vectorize v2i32 to v2f64 conversions

This patch enables support for the conversion of v2i32 to v2f64 to use the CVTDQ2PD xmm instruction and stay on the SSE unit instead of scalarizing, sign extending to i64 and using CVTSI2SDQ scalar conversions.

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

llvm-svn: 239855

9 years agoFix a typo in the help.
Jim Ingham [Tue, 16 Jun 2015 21:39:56 +0000 (21:39 +0000)]
Fix a typo in the help.

llvm-svn: 239854

9 years agoAdd a .parent property to SBFrame's Python interface which allows easy access to...
Enrico Granata [Tue, 16 Jun 2015 21:07:52 +0000 (21:07 +0000)]
Add a .parent property to SBFrame's Python interface which allows easy access to the caller frame of the current frame

llvm-svn: 239853

9 years agoHonor the objc_runtime_name attribute when encoding class/protocol names.
Douglas Gregor [Tue, 16 Jun 2015 21:04:55 +0000 (21:04 +0000)]
Honor the objc_runtime_name attribute when encoding class/protocol names.

While the rest of the Objective-C metadata seems to honor
objc_runtime_name, the encoding strings produced by, e.g., @encode and
property meta, were not. Fixes rdar://problem/21408305.

llvm-svn: 239852

9 years agoFixing a potential issue where the NSIndexPath formatter could try to access stale...
Enrico Granata [Tue, 16 Jun 2015 20:48:49 +0000 (20:48 +0000)]
Fixing a potential issue where the NSIndexPath formatter could try to access stale data

No test because I did not see this happen - it has been found by code inspection as a response to seeing crash logs about this

llvm-svn: 239851

9 years agorename variables; NFC
Sanjay Patel [Tue, 16 Jun 2015 20:47:19 +0000 (20:47 +0000)]
rename variables; NFC

...because I see 'StoreBW' and read it as 'store bandwidth'

llvm-svn: 239850

9 years agoReapply 239795 - [InstCombine] Propagate non-null facts to call parameters
Philip Reames [Tue, 16 Jun 2015 20:24:25 +0000 (20:24 +0000)]
Reapply 239795 - [InstCombine] Propagate non-null facts to call parameters

The original change broke clang side tests.  I will be submitting those momentarily.  This change includes post commit feedback on the original change from from Pete Cooper.

Original Submission comments:
If a parameter to a function is known non-null, use the existing parameter attributes to record that fact at the call site. This has no optimization benefit by itself - that I know of - but is an enabling change for http://reviews.llvm.org/D9129.

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

llvm-svn: 239849

9 years agoAdjust clang side tests effected by 239795 before reapplying said change
Philip Reames [Tue, 16 Jun 2015 20:24:06 +0000 (20:24 +0000)]
Adjust clang side tests effected by 239795 before reapplying said change

llvm-svn: 239848

9 years agoextract some code into a helper function for MergeConsecutiveStores(); NFCI
Sanjay Patel [Tue, 16 Jun 2015 20:05:00 +0000 (20:05 +0000)]
extract some code into a helper function for MergeConsecutiveStores(); NFCI

llvm-svn: 239847

9 years agoparser: diagnose empty attribute blocks
Saleem Abdulrasool [Tue, 16 Jun 2015 20:03:47 +0000 (20:03 +0000)]
parser: diagnose empty attribute blocks

MS attributes do not permit empty attribute blocks.  Correctly diagnose those.
We continue to parse to ensure that we recover correctly.  Because the block is
empty, we do not need to skip any tokens.

Bonus: tweak the comment that I updated but forgot to remove the function name
in a previous commit.

llvm-svn: 239846

9 years agoImprove handling of end of file in the bitcode reader.
Rafael Espindola [Tue, 16 Jun 2015 20:03:39 +0000 (20:03 +0000)]
Improve handling of end of file in the bitcode reader.

Before this patch the bitcode reader would read a module from a file
that contained in order:

* Any number of non MODULE_BLOCK sub blocks.
* One MODULE_BLOCK
* Any number of non MODULE_BLOCK sub blocks.
* 4 '\n' characters to handle OS X's ranlib.

Since we support lazy reading of modules, any information that is relevant
for the module has to be in the MODULE_BLOCK or before it. We don't gain
anything from checking what is after.

This patch then changes the reader to stop once the MODULE_BLOCK has been
successfully parsed.

This avoids the ugly special case for .bc files in an archive and makes it
easier to embed bitcode files.

llvm-svn: 239845

9 years agoRemove duplicated alteration to getProgramPaths().
Douglas Katzman [Tue, 16 Jun 2015 19:34:52 +0000 (19:34 +0000)]
Remove duplicated alteration to getProgramPaths().

This appears to have been accidental.

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

llvm-svn: 239844

9 years agoFix PR 23525 - Separate header mass propagation in irregular loops.
Diego Novillo [Tue, 16 Jun 2015 19:10:58 +0000 (19:10 +0000)]
Fix PR 23525 - Separate header mass propagation in irregular loops.

Summary:
When propagating mass through irregular loops, the mass flowing through
each loop header may not be equal. This was causing wrong frequencies
to be computed for irregular loop headers.

Fixed by keeping track of masses flowing through each of the headers in
an irregular loop. To do this, we now keep track of per-header backedge
weights. After the loop mass is distributed through the loop, the
backedge weights are used to re-distribute the loop mass to the loop
headers.

Since each backedge will have a mass proportional to the different
branch weights, the loop headers will end up with a more approximate
weight distribution (as opposed to the current distribution that assumes
that every loop header is the same).

Reviewers: dexonsmith

Subscribers: llvm-commits

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

llvm-svn: 239843

9 years ago[Statepoints] Test only change. Check that statepoint lowering didn't generate more...
Igor Laevsky [Tue, 16 Jun 2015 19:07:05 +0000 (19:07 +0000)]
[Statepoints] Test only change. Check that statepoint lowering didn't generate more than expected amount of spills.
See http://reviews.llvm.org/D10402 for related discussion.

llvm-svn: 239842