platform/upstream/llvm.git
8 years ago[MC] Merge VK_PPC_TPREL in to generic VK_TPREL.
Colin LeMahieu [Wed, 10 Feb 2016 18:32:01 +0000 (18:32 +0000)]
[MC] Merge VK_PPC_TPREL in to generic VK_TPREL.

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

llvm-svn: 260401

8 years ago[PGO] Indirect-call profile annotation in IR level profiling
Rong Xu [Wed, 10 Feb 2016 18:24:45 +0000 (18:24 +0000)]
[PGO] Indirect-call profile annotation in IR level profiling

This patch reads the indirect-call value records in the profile and makes the
annotation in the indirect-call instruction. This is for IR level profile
instrumentation.

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

llvm-svn: 260400

8 years agoAMDGPU: Fix indentation and variable names
Matt Arsenault [Wed, 10 Feb 2016 18:21:45 +0000 (18:21 +0000)]
AMDGPU: Fix indentation and variable names

llvm-svn: 260399

8 years agoAMDGPU: Split R600 and SI load lowering
Matt Arsenault [Wed, 10 Feb 2016 18:21:39 +0000 (18:21 +0000)]
AMDGPU: Split R600 and SI load lowering

These weren't actually sharing anything in the common
LowerLOAD.

llvm-svn: 260398

8 years agoRevert "[llvm-readobj] Option to emit readelf like output"
Hemant Kulkarni [Wed, 10 Feb 2016 18:21:01 +0000 (18:21 +0000)]
Revert "[llvm-readobj] Option to emit readelf like output"

This reverts commit a58765909660a7195b32e0cc8c7476168b913750.

llvm-svn: 260397

8 years ago[pdbdump] Fix test for different type ordering with DIA 2015
Reid Kleckner [Wed, 10 Feb 2016 18:17:17 +0000 (18:17 +0000)]
[pdbdump] Fix test for different type ordering with DIA 2015

llvm-svn: 260396

8 years ago[ThinLTO] Move global processing from Linker to TransformUtils (NFC)
Teresa Johnson [Wed, 10 Feb 2016 18:11:31 +0000 (18:11 +0000)]
[ThinLTO] Move global processing from Linker to TransformUtils (NFC)

Summary:
As discussed on IRC, move the ThinLTOGlobalProcessing code out of
the linker, and into TransformUtils. The name of the class is changed
to FunctionImportGlobalProcessing.

Reviewers: joker.eph, rafael

Subscribers: joker.eph, llvm-commits

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

llvm-svn: 260395

8 years agoAdd tests for -m32
Xinliang David Li [Wed, 10 Feb 2016 17:57:55 +0000 (17:57 +0000)]
Add tests for -m32

llvm-svn: 260394

8 years ago[PGO] coverage map bug with cov data produced for 32bit target
Xinliang David Li [Wed, 10 Feb 2016 17:57:08 +0000 (17:57 +0000)]
[PGO] coverage map bug with cov data produced for 32bit target

Fix the result truncation bug: [PR26560]
Test case is following (compiler-rt).

llvm-svn: 260393

8 years ago[llvm-nm] Add -radix option
Hemant Kulkarni [Wed, 10 Feb 2016 17:51:39 +0000 (17:51 +0000)]
[llvm-nm] Add -radix option

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

llvm-svn: 260392

8 years ago[llvm-readobj] Option to emit readelf like output
Hemant Kulkarni [Wed, 10 Feb 2016 17:51:28 +0000 (17:51 +0000)]
[llvm-readobj] Option to emit readelf like output

New option --elf-output-style=LLVM or GNU
Enables -file-headers in readelf style when elf-output-style=GNU

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

llvm-svn: 260391

8 years ago[SPARC] Repair floating-point condition encodings in assembly parser.
James Y Knight [Wed, 10 Feb 2016 17:47:20 +0000 (17:47 +0000)]
[SPARC] Repair floating-point condition encodings in assembly parser.

The encodings for floating point conditions A(lways) and N(ever) were
incorrectly specified for the assembly parser, per Sparc manual v8 page
121. This change corrects that mistake.

Also, strangely, all of the branch instructions already had MC test
cases, except for the broken ones. Added the tests.

Patch by Chris Dewhurst

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

llvm-svn: 260390

8 years agoRename a member variable to be more accurate with how it is used
Daniel Berlin [Wed, 10 Feb 2016 17:41:25 +0000 (17:41 +0000)]
Rename a member variable to be more accurate with how it is used

llvm-svn: 260389

8 years ago[MS ABI] Never reference dllimport'd vtables
David Majnemer [Wed, 10 Feb 2016 17:40:47 +0000 (17:40 +0000)]
[MS ABI] Never reference dllimport'd vtables

Referencing a dllimported vtable is impossible in a constexpr
constructor.  It would be friendlier to C++ programmers if we
synthesized a copy of the vftable which referenced imported virtual
functions.  This would let us initialize the object in a way which
preserves both the intent to import functionality from another DLL while
also making constexpr work.

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

llvm-svn: 260388

8 years agoConstify two functions, make them accessible to unit tests
Daniel Berlin [Wed, 10 Feb 2016 17:39:43 +0000 (17:39 +0000)]
Constify two functions, make them accessible to unit tests

llvm-svn: 260387

8 years agoDisable all llvm-config tests for now, will investigate later
Ehsan Akhgari [Wed, 10 Feb 2016 17:29:50 +0000 (17:29 +0000)]
Disable all llvm-config tests for now, will investigate later

llvm-svn: 260386

8 years ago[PGO] Differentiate Clang instrumentation and IR level instrumentation profiles
Rong Xu [Wed, 10 Feb 2016 17:18:30 +0000 (17:18 +0000)]
[PGO] Differentiate Clang instrumentation and IR level instrumentation profiles

This patch uses one bit in profile version to differentiate Clang
instrumentation and IR level instrumentation profiles.

PGOInstrumenation generates a COMDAT variable __llvm_profile_raw_version so
that the compiler runtime can set the right profile kind.
For Maco-O platform, we generate the variable as linkonce_odr linkage as
COMDAT is not supported.

PGOInstrumenation now checks this bit to make sure it's an IR level
instrumentation profile.

The patch was submitted as r260164 but reverted due to a Darwin test breakage.
Original Differential Revision: http://reviews.llvm.org/D15540

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

llvm-svn: 260385

8 years agoAdd support for R_X86_64_DTPOFF64.
Rafael Espindola [Wed, 10 Feb 2016 16:26:31 +0000 (16:26 +0000)]
Add support for R_X86_64_DTPOFF64.

It is used by clang to produce debug info for tls variables.

llvm-svn: 260384

8 years ago[AArch64] This bit of logic is specific to pairing. NFC.
Chad Rosier [Wed, 10 Feb 2016 15:52:46 +0000 (15:52 +0000)]
[AArch64] This bit of logic is specific to pairing. NFC.

llvm-svn: 260383

8 years agoFix VST_CODE_* bitcode id comments (NFC)
Teresa Johnson [Wed, 10 Feb 2016 15:02:51 +0000 (15:02 +0000)]
Fix VST_CODE_* bitcode id comments (NFC)

llvm-svn: 260382

8 years agoLimit catopen usage to unix-like OSes
Ben Craig [Wed, 10 Feb 2016 13:47:25 +0000 (13:47 +0000)]
Limit catopen usage to unix-like OSes

Operating systems that are not unix-like are unlikely to have access to
catopen. Instead of black-listing each one, we now filter out all non-unix
operating systems first. We then exclude the unix-like operating systems
that don't have catopen. _WIN32 counts as a unix-like operating system
because of cygwin.

http://reviews.llvm.org/D16639

llvm-svn: 260381

8 years agoUse a SymbolBody to represent the personality.
Rafael Espindola [Wed, 10 Feb 2016 13:19:32 +0000 (13:19 +0000)]
Use a SymbolBody to represent the personality.

NFC, just more in line with the rest of lld.

Thanks to Rui for the suggestion.

llvm-svn: 260380

8 years agoReapply the patch of r260376.
Andrey Turetskiy [Wed, 10 Feb 2016 12:56:10 +0000 (12:56 +0000)]
Reapply the patch of r260376.

llvm-svn: 260379

8 years agoclang-format sort include use the source file name to determine the
Daniel Jasper [Wed, 10 Feb 2016 12:42:58 +0000 (12:42 +0000)]
clang-format sort include use the source file name to determine the
"main include" that will be the 1st include (category 0).

Because the clang-format visual studio extension does not pass the file
name and use the standard input, sort include cannot find a "main
include":

Testing fix on llvm\tools\clang\lib\Format\Format.cpp:
Original file:
  #include "clang/Format/Format.h"
  ...
  #include "clang/Basic/SourceManager.h"
  #include "clang/Lex/Lexer.h"

Without fix, selecting the includes and running visual studio
clang-format:
  ...
  #include "clang/Basic/SourceManager.h"
  #include "clang/Format/Format.h"
  #include "clang/Lex/Lexer.h"

With fix, selecting the includes and running visual studio clang-format:
  #include "clang/Format/Format.h"
  ...
  #include "clang/Basic/SourceManager.h"
  #include "clang/Lex/Lexer.h"

Test 2 with main header not at the start:
Original file:
  ...
  #include "clang/Format/Format.h"
  #include "clang/Basic/SourceManager.h"
  #include "clang/Lex/Lexer.h"

Without fix, selecting the includes and running visual studio
clang-format:
  ...
  #include "clang/Basic/SourceManager.h"
  #include "clang/Format/Format.h"
  #include "clang/Lex/Lexer.h"

With fix, selecting the includes and running visual studio clang-format:
  #include "clang/Format/Format.h"
  ...
  #include "clang/Basic/SourceManager.h"
  #include "clang/Lex/Lexer.h"

Patch by Jean-Philippe Dufraigne, thank you.
Review: http://reviews.llvm.org/D16524

llvm-svn: 260378

8 years agoRevert "Improve the handling of missing elf symtab and missing symbol sizes"
Tamas Berghammer [Wed, 10 Feb 2016 12:10:58 +0000 (12:10 +0000)]
Revert "Improve the handling of missing elf symtab and missing symbol sizes"

This reverts commit 252dda67782f2cbf838e375bce21ed4191f6d9ce.

The commit caused several test failure on the OSX build bot.

llvm-svn: 260377

8 years ago[X86] Fix stack alignment for MCU target (Clang part), by Anton Nadolskiy.
Andrey Turetskiy [Wed, 10 Feb 2016 11:58:46 +0000 (11:58 +0000)]
[X86] Fix stack alignment for MCU target (Clang part), by Anton Nadolskiy.

This patch fixes stack alignments for MCU (should be aligned to 4 bytes).

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

llvm-svn: 260376

8 years ago[X86] Fix stack alignment for MCU target, by Anton Nadolskiy.
Andrey Turetskiy [Wed, 10 Feb 2016 11:57:06 +0000 (11:57 +0000)]
[X86] Fix stack alignment for MCU target, by Anton Nadolskiy.

This patch fixes stack alignments for MCU (should be aligned to 4 bytes).

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

llvm-svn: 260375

8 years ago[OPENMP 4.5] Initial support for data members in 'firstprivate' clause.
Alexey Bataev [Wed, 10 Feb 2016 11:29:16 +0000 (11:29 +0000)]
[OPENMP 4.5] Initial support for data members in 'firstprivate' clause.
OpenMP 4.5 allows privatization of non-static data members of current
class in non-static member functions.

llvm-svn: 260374

8 years agoFix assertion "Chunk.Kind == DeclaratorChunk::Function" with attributed type.
Denis Zobnin [Wed, 10 Feb 2016 11:23:48 +0000 (11:23 +0000)]
Fix assertion "Chunk.Kind == DeclaratorChunk::Function" with attributed type.

This patch is to upgrade FunctionTypeUnwrapper for correct processing of
AttributedType. Fixes PR25786.
Patch by Alexander Makarov.

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

llvm-svn: 260373

8 years ago[RenderScript] Refactor allocation expressions
Ewan Crawford [Wed, 10 Feb 2016 11:23:27 +0000 (11:23 +0000)]
[RenderScript] Refactor allocation expressions

Patch refractors RS plugin code specifying how format strings are used to JIT the runtime.

Author: Dean De Leo <dean@codeplay.com>
llvm-svn: 260372

8 years agoFix PR26543: add a check for definition in CXXRecordDecl.
Alexey Bataev [Wed, 10 Feb 2016 10:50:12 +0000 (10:50 +0000)]
Fix PR26543: add a check for definition in CXXRecordDecl.

llvm-svn: 260370

8 years agoImprove the handling of missing elf symtab and missing symbol sizes
Tamas Berghammer [Wed, 10 Feb 2016 10:43:34 +0000 (10:43 +0000)]
Improve the handling of missing elf symtab and missing symbol sizes

* Generate artificial symbol names from eh_fame during symbol parsing
  so these symbols are already present when we calcualte the size of
  the symbols where 0 is specified.
* Fix symbol size calculation for the last symbol in the file where
  it have to last until the end of the parent section.

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

llvm-svn: 260369

8 years agoFix handling of the arm IT instruction in the unwinder
Tamas Berghammer [Wed, 10 Feb 2016 10:42:13 +0000 (10:42 +0000)]
Fix handling of the arm IT instruction in the unwinder

The IT instruction can specify condition code for up to 4 consecutive
instruction and it is used quite often by clang in epilogues causing
an issue when trying to unwind from locations covered by the IT
instruction and for locatins inmediately after the IT instruction.

Changes made to fix it:
* Introduce the concept of conditional instruction block what is a list
  of consecutive instructions with the same condition. We update the
  unwind information during the conditional instruction block and when
  we reach the end of it (first instruction with a differemt condition)
  then we restore the unwind information we had before the condition.
* Fix a bug in the ARM instruction emulator where neither PC nor the
  ITSTATE was advanced when we reached an instruction what we can't
  decode.

After the change we have no regression on android-arm running the
regular test suit and TestStandardUnwind also passes when running it
with clang as the compiler (previously it failed on an IT instruction).

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

llvm-svn: 260368

8 years agoUse BKPT instead of UDF for arm/thumb breakpoints
Tamas Berghammer [Wed, 10 Feb 2016 10:42:00 +0000 (10:42 +0000)]
Use BKPT instead of UDF for arm/thumb breakpoints

The UDF instruction is deprecated in armv7 and in case of thumb2
instructions set it don't work well together with the IT instruction.

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

llvm-svn: 260367

8 years agoAdd new option to lldb-server to display its version
Tamas Berghammer [Wed, 10 Feb 2016 10:35:48 +0000 (10:35 +0000)]
Add new option to lldb-server to display its version

llvm-svn: 260366

8 years ago[ELF][MIPS] Group and sort initialization of MipsTargetInfo class fields. NFC
Simon Atanasyan [Wed, 10 Feb 2016 10:08:39 +0000 (10:08 +0000)]
[ELF][MIPS] Group and sort initialization of MipsTargetInfo class fields. NFC

llvm-svn: 260365

8 years ago[ELF][MIPS] Rename MipsTargetInfo::relocateOne argument SA to S
Simon Atanasyan [Wed, 10 Feb 2016 10:08:35 +0000 (10:08 +0000)]
[ELF][MIPS] Rename MipsTargetInfo::relocateOne argument SA to S

MIPS 32-bit ABI uses REL relocation record format. We read addends from
relocation destinations right in the MipsTargetInfo::relocateOne
function.

llvm-svn: 260364

8 years ago[AVR] Add instruction definitions
Dylan McKay [Wed, 10 Feb 2016 08:55:23 +0000 (08:55 +0000)]
[AVR] Add instruction definitions

Summary: Add the AVR instruction tablegen definitions.

Reviewers: stoklund, hfinkel, dsanders, arsenm, vkalintiris

Subscribers: dylanmckay, agnat, rjordans, llvm-commits

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

llvm-svn: 260363

8 years ago[LLDB][MIPS] Generalise MIPS arch names
Mohit K. Bhakkad [Wed, 10 Feb 2016 06:58:13 +0000 (06:58 +0000)]
[LLDB][MIPS] Generalise MIPS arch names
Patch by Nitesh Jain

Reviewers: clayborg, jaydeep.
Subscribers: zturner, bhushan, mohit.bhakkad, sagar, lldb-commits.
Differential Revision: http://reviews.llvm.org/D16840

llvm-svn: 260362

8 years ago[PGO] fix prof symbol lookup bug
Xinliang David Li [Wed, 10 Feb 2016 06:36:55 +0000 (06:36 +0000)]
[PGO] fix prof symbol lookup bug

Patch by Rong Xu

The problem is exposed by intra-module indirect call promotion where
prof symtab is created from module which does not contain all symbols
from the program. With partial symtab, the result needs to be checked
more strictly.

llvm-svn: 260361

8 years ago[Sema] Issue a warning for integer overflow in nested struct initializer
Akira Hatanaka [Wed, 10 Feb 2016 06:06:06 +0000 (06:06 +0000)]
[Sema] Issue a warning for integer overflow in nested struct initializer

r257357 fixed clang to warn on integer overflow in struct initializers.
However, it didn't warn when a struct had a nested initializer. This
commit makes changes in Sema::CheckForIntOverflow to handle nested
initializers.

For example:

struct s {
  struct t {
    unsigned x;
  } t;
} s = {
  {
    .x = 4 * 1024 * 1024 * 1024
  }
};

rdar://problem/23526454

llvm-svn: 260360

8 years agoX86: Remove useless semicolon
JF Bastien [Wed, 10 Feb 2016 04:04:12 +0000 (04:04 +0000)]
X86: Remove useless semicolon

llvm-svn: 260359

8 years agoThis is an idea to make "thread step-in --target" work for the common
Jim Ingham [Wed, 10 Feb 2016 03:25:24 +0000 (03:25 +0000)]
This is an idea to make "thread step-in --target" work for the common
case where you have:

1 ->    foo (bar(),
2            baz(),
3            lala());
4

You are sitting on line 1, and want to step into foo, but not bar, baz & lala.  Unfortunately
there are line table entries for lines 1-3, and lldb doesn't know anything about the nesting
of statement in these lines.  So we'll have to use the user's intelligence...  This patch adds:

(lldb) thread step-in -t foo --end-line 4

That tells lldb to keep stepping in till line 4, but stop if you step into foo.  I think I would
remember to use this when faced with some of the long gnarly call sequences in lldb.  But there
might be ways I haven't thought of to make it more convenient.  Jason suggests having "end" as a
special token for --end-line which just means keep going to the end of the function, I really want
to get into this thing...

There should be an SB API and tests, which will come if this seems useful.

llvm-svn: 260352

8 years agollvm-config: Fix DLL prefix on cygming.
NAKAMURA Takumi [Wed, 10 Feb 2016 03:09:13 +0000 (03:09 +0000)]
llvm-config: Fix DLL prefix on cygming.

For example, LLVMSupport takes the form of LLVMSupport.dll, not libLLVMSupport.dll.

llvm-svn: 260351

8 years ago[CMake] For multi-stage builds to be deterministic we need to disable timestamps.
Chris Bieneman [Wed, 10 Feb 2016 02:17:21 +0000 (02:17 +0000)]
[CMake] For multi-stage builds to be deterministic we need to disable timestamps.

Duh! With this change I've verified -O3 builds are deterministic.

llvm-svn: 260350

8 years agoChange lldb.value.__int__() so that it takes into account the signedness of the value...
Enrico Granata [Wed, 10 Feb 2016 02:12:42 +0000 (02:12 +0000)]
Change lldb.value.__int__() so that it takes into account the signedness of the value being cast to return a Python number with the proper value

The explicit APIs on SBValue obviously remain if one wants to be explicit in intent, or override this guess, but since __int__() has to pick one, an educated guess is definitely better than than always going to signed regardless

Fixes rdar://24556976

llvm-svn: 260349

8 years agoGet rid of another SAME-NOT. FileCheck does not have this suffix.
Paul Robinson [Wed, 10 Feb 2016 02:08:24 +0000 (02:08 +0000)]
Get rid of another SAME-NOT. FileCheck does not have this suffix.

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

llvm-svn: 260348

8 years agoclang/test/Index/skip-parsed-bodies/compile_commands.json: Appease targeting msvc.
NAKAMURA Takumi [Wed, 10 Feb 2016 01:45:51 +0000 (01:45 +0000)]
clang/test/Index/skip-parsed-bodies/compile_commands.json: Appease targeting msvc.

llvm-svn: 260347

8 years agoRemove some unnecessary CHECK-SAMEs in ModuleDebugInfo.{cpp,m}.
Justin Lebar [Wed, 10 Feb 2016 01:34:17 +0000 (01:34 +0000)]
Remove some unnecessary CHECK-SAMEs in ModuleDebugInfo.{cpp,m}.

Suggested by Paul Robinson.

llvm-svn: 260346

8 years agoAdd a missing break.
Jim Ingham [Wed, 10 Feb 2016 01:33:58 +0000 (01:33 +0000)]
Add a missing break.

llvm-svn: 260345

8 years agolibclang: Enable skip-parsed-bodies on win32.
NAKAMURA Takumi [Wed, 10 Feb 2016 01:29:57 +0000 (01:29 +0000)]
libclang: Enable skip-parsed-bodies on win32.

I guess it would be working since Rafael's r187619.

llvm-svn: 260344

8 years agollvm-config: Quick fix for cross compilation. Don't be confsed between host and targe...
NAKAMURA Takumi [Wed, 10 Feb 2016 01:12:55 +0000 (01:12 +0000)]
llvm-config: Quick fix for cross compilation. Don't be confsed between host and target. It has been there since r252532.

FIXME: The clause may use conditions of host compiler, not HOST_TRIPLE.
llvm-svn: 260343

8 years agoStructurizeCFG: Initialize SkipUniformRegions in the default constructor
Tom Stellard [Wed, 10 Feb 2016 01:10:09 +0000 (01:10 +0000)]
StructurizeCFG: Initialize SkipUniformRegions in the default constructor

This should fix some random bot failures caused by r260336.

llvm-svn: 260342

8 years ago[CMake] Pass LLVM_EXTERNAL_*_SOURCE_DIR variables to subsequent stages
Chris Bieneman [Wed, 10 Feb 2016 01:09:59 +0000 (01:09 +0000)]
[CMake] Pass LLVM_EXTERNAL_*_SOURCE_DIR variables to subsequent stages

For multi-stage builds we need to pass any overridden source directory variables. Without passing these the subsequent stages won't find the project sources.

llvm-svn: 260341

8 years ago[CMake] Fixing the 3-stage cmake cache.
Chris Bieneman [Wed, 10 Feb 2016 01:09:56 +0000 (01:09 +0000)]
[CMake] Fixing the 3-stage cmake cache.

I had hoped this would work from a single cache file, but turns out there is a bug I can't quite figure out relating to passing list arguments to recursive CMake invocations.

This change works around that.

llvm-svn: 260340

8 years agoRevert "Turn on LLVM_ENABLE_PLUGINS by default on Windows"
Reid Kleckner [Wed, 10 Feb 2016 01:06:37 +0000 (01:06 +0000)]
Revert "Turn on LLVM_ENABLE_PLUGINS by default on Windows"

This reverts r260262, it broke some LLVM tests (bugpoint).

llvm-svn: 260339

8 years ago[Orc] Add lazy-JITting support for i386.
Lang Hames [Wed, 10 Feb 2016 01:02:33 +0000 (01:02 +0000)]
[Orc] Add lazy-JITting support for i386.

This patch adds a new class, OrcI386, which contains the hooks needed to
support lazy-JITing on i386 (currently only for Pentium 2 or above, as the JIT
re-entry code uses the FXSAVE/FXRSTOR instructions).

Support for i386 is enabled in the LLI lazy JIT and the Orc C API, and
regression and unit tests are enabled for this architecture.

llvm-svn: 260338

8 years agoFix overload sets of strchr, strpbrk, strrchr, memchr and strstr from
Richard Smith [Wed, 10 Feb 2016 00:59:02 +0000 (00:59 +0000)]
Fix overload sets of strchr, strpbrk, strrchr, memchr and strstr from
<string.h> and wcschr, wcspbrk, wcsrchr, wmemchr, and wcsstr from <wchar.h> to
provide a const-correct overload set even when the underlying C library does
not.

This change adds a new macro, _LIBCPP_PREFERRED_OVERLOAD, which (if defined)
specifies that a given overload is a better match than an otherwise equally
good function declaration without the overload. This is implemented in modern
versions of Clang via __attribute__((enable_if)), and not elsewhere.

We use this new macro to define overloads in the global namespace for these
functions that displace the overloads provided by the C library, unless we
believe the C library is already providing the correct signatures.

llvm-svn: 260337

8 years agoStructurizeCFG: Add an option for skipping regions with only uniform branches
Tom Stellard [Wed, 10 Feb 2016 00:39:37 +0000 (00:39 +0000)]
StructurizeCFG: Add an option for skipping regions with only uniform branches

Summary:
Tests for this will be added once the AMDGPU backend enables this
option.

Reviewers: arsenm

Subscribers: llvm-commits

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

llvm-svn: 260336

8 years agoAdd support for struct in C API test
Amaury Sechet [Wed, 10 Feb 2016 00:38:50 +0000 (00:38 +0000)]
Add support for struct in C API test

Summary: As per title. This also include extra support for insertvalue and extracvalue.

Reviewers: bogner, chandlerc, echristo, dblaikie, joker.eph, Wallbraker

Subscribers: llvm-commits

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

llvm-svn: 260335

8 years agoGet rid of CHECK-SAME-NOT in tests.
Justin Lebar [Wed, 10 Feb 2016 00:38:15 +0000 (00:38 +0000)]
Get rid of CHECK-SAME-NOT in tests.

Summary: This isn't a FileCheck directive; it does nothing.

Reviewers: jroelofs

Subscribers: cfe-commits, majnemer

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

llvm-svn: 260334

8 years agoThis patch adds doxygen comments for all the intrinsincs in the header file f16cintri...
Ekaterina Romanova [Wed, 10 Feb 2016 00:12:24 +0000 (00:12 +0000)]
This patch adds doxygen comments for all the intrinsincs in the header file f16cintrin.h. The doxygen comments are automatically generated based on Sony's intrinsics document.

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

llvm-svn: 260333

8 years agoAdd binding for counting argument and find called value of call and invoke instructio...
Amaury Sechet [Wed, 10 Feb 2016 00:09:37 +0000 (00:09 +0000)]
Add binding for counting argument and find called value of call and invoke instruction from the C API.

Summary: As per title. This remove the need to rely on internal knowledge of call and invoke instruction to find called value and argument count.

Reviewers: bogner, chandlerc, echristo, dblaikie, joker.eph, Wallbraker

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

llvm-svn: 260332

8 years agoDon't dereference the first element of an empty container.
Adrian McCarthy [Wed, 10 Feb 2016 00:06:50 +0000 (00:06 +0000)]
Don't dereference the first element of an empty container.

llvm-svn: 260331

8 years agoRemove FreeBSD failure decorator from TestCppIncompleteTypes
Ed Maste [Wed, 10 Feb 2016 00:03:52 +0000 (00:03 +0000)]
Remove FreeBSD failure decorator from TestCppIncompleteTypes

CFLAGS is now being set correctly to pass -flimit-debug-info or
-fno-limit-debug-info on FreeBSD.  I'm not sure which change is
responsible for the fix, though.

llvm.org/pr25626

llvm-svn: 260330

8 years agoARM: improve documentation slightly.
Tim Northover [Tue, 9 Feb 2016 23:55:48 +0000 (23:55 +0000)]
ARM: improve documentation slightly.

It seems the ARMv8 instruction set overview is no longer provided by ARM, so
I've removed it. Since most of the other documents were the same I unified the
two sections.

llvm-svn: 260329

8 years agoAdd status for LLDB on Windows to status.html.
Adrian McCarthy [Tue, 9 Feb 2016 23:52:57 +0000 (23:52 +0000)]
Add status for LLDB on Windows to status.html.

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

llvm-svn: 260328

8 years ago[asan] update the scariness score: tweak a few weights and add tests
Kostya Serebryany [Tue, 9 Feb 2016 23:46:43 +0000 (23:46 +0000)]
[asan] update the scariness score: tweak a few weights and add tests

llvm-svn: 260327

8 years agoChange `CoreTests` to LLDBCoreTests to avoid name clash.
Zachary Turner [Tue, 9 Feb 2016 23:45:21 +0000 (23:45 +0000)]
Change `CoreTests` to LLDBCoreTests to avoid name clash.

lld was already using a target named CoreTests so CMake
was erroring due to this conflict.

llvm-svn: 260326

8 years ago[x86] convert masked load of exactly one element to scalar load
Sanjay Patel [Tue, 9 Feb 2016 23:44:35 +0000 (23:44 +0000)]
[x86] convert masked load of exactly one element to scalar load

This is the load counterpart to the store optimization that was added in:
http://reviews.llvm.org/rL260145

llvm-svn: 260325

8 years agoSplit clone value and instruction in the echo C API test
Amaury Sechet [Tue, 9 Feb 2016 23:41:20 +0000 (23:41 +0000)]
Split clone value and instruction in the echo C API test

Summary: This is a bit of refactoring required to be able to generate instruction in forward basic block. This, for instance, is a requirement for phi in loops.

Reviewers: bogner, chandlerc, echristo, dblaikie, joker.eph, Wallbraker

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

llvm-svn: 260324

8 years agoRevert "Introduce a cmake module to figure out whether we need to link with libatomic."
Vasileios Kalintiris [Tue, 9 Feb 2016 23:38:28 +0000 (23:38 +0000)]
Revert "Introduce a cmake module to figure out whether we need to link with libatomic."

This reverts commit r260235. It breaks LLVM's bootstrap when building
with a -gcc-toolchain and the system's gcc installation does not provide
the libatomic library and its headers. We should check whether
LIBCXX_GCC_TOOLCHAIN is set and adjust the flags accordingly.

llvm-svn: 260323

8 years agoAdded code that was commented out during testing to stops template member functions...
Greg Clayton [Tue, 9 Feb 2016 23:25:54 +0000 (23:25 +0000)]
Added code that was commented out during testing to stops template member functions from being added to class definitions (see revision 260308 for details).

<rdar://problem/24483905>
<rdar://problem/24508374>

llvm-svn: 260322

8 years agoAdd icmp and conditional branches in the C API echo test.
Amaury Sechet [Tue, 9 Feb 2016 23:15:02 +0000 (23:15 +0000)]
Add icmp and conditional branches in the C API echo test.

Summary:
Improving coverage.

Depends on D16912 .

Reviewers: bogner, chandlerc, echristo, dblaikie, joker.eph, Wallbraker

Subscribers: llvm-commits

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

llvm-svn: 260321

8 years agoRangefy, and replace a switch with `if`s. NFC.
Rui Ueyama [Tue, 9 Feb 2016 23:11:21 +0000 (23:11 +0000)]
Rangefy, and replace a switch with `if`s. NFC.

llvm-svn: 260320

8 years agoAdd convergent-removing bits to FunctionAttrs pass.
Justin Lebar [Tue, 9 Feb 2016 23:03:22 +0000 (23:03 +0000)]
Add convergent-removing bits to FunctionAttrs pass.

Summary:
Remove the convergent attribute on any functions which provably do not
contain or invoke any convergent functions.

After this change, we'll be able to modify clang to conservatively add
'convergent' to all functions when compiling CUDA.

Reviewers:  jingyue, joker.eph

Subscribers: llvm-commits, tra, jhen, hfinkel, resistor, chandlerc, arsenm

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

llvm-svn: 260319

8 years agoUpdate documentation about convergent attribute.
Justin Lebar [Tue, 9 Feb 2016 23:03:17 +0000 (23:03 +0000)]
Update documentation about convergent attribute.

Summary:
Be more explicit about what 'convergent' means, and indicate that the
compiler may remove the attribute from a function if it can prove that
the function doesn't in fact execute any convergent ops.

Reviewers: resistor, jingyue, joker.eph

Subscribers: hfinkel, chandlerc, arsenm, jhen, tra, llvm-commits

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

llvm-svn: 260318

8 years agoFix GCC build.
Peter Collingbourne [Tue, 9 Feb 2016 23:01:38 +0000 (23:01 +0000)]
Fix GCC build.

llvm-svn: 260317

8 years ago[CodeGen] Prefer "if (SDValue R = ...)" to "if (R.getNode())". NFCI.
Ahmed Bougacha [Tue, 9 Feb 2016 22:54:12 +0000 (22:54 +0000)]
[CodeGen] Prefer "if (SDValue R = ...)" to "if (R.getNode())". NFCI.

llvm-svn: 260316

8 years ago[X86] Don't reuse an unrelated variable, create a new one. NFC.
Ahmed Bougacha [Tue, 9 Feb 2016 22:54:05 +0000 (22:54 +0000)]
[X86] Don't reuse an unrelated variable, create a new one. NFC.

Using Op makes it look like we're doing something with it.
We're really not.

llvm-svn: 260315

8 years ago[X86] Remove unnecessary assignment. NFC.
Ahmed Bougacha [Tue, 9 Feb 2016 22:53:58 +0000 (22:53 +0000)]
[X86] Remove unnecessary assignment. NFC.

llvm-svn: 260314

8 years agoAdd C binding for AllocaInst::getAllocatedType
Amaury Sechet [Tue, 9 Feb 2016 22:50:53 +0000 (22:50 +0000)]
Add C binding for AllocaInst::getAllocatedType

Summary:
Comes with an awesome test.

Depends on D16912

Reviewers: bogner, chandlerc, echristo, dblaikie, joker.eph, Wallbraker

Subscribers: llvm-commits

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

llvm-svn: 260313

8 years agoWholeProgramDevirt: introduce.
Peter Collingbourne [Tue, 9 Feb 2016 22:50:34 +0000 (22:50 +0000)]
WholeProgramDevirt: introduce.

This pass implements whole program optimization of virtual calls in cases
where we know (via bitset information) that the list of callees is fixed. This
includes the following:

- Single implementation devirtualization: if a virtual call has a single
  possible callee, replace all calls with a direct call to that callee.

- Virtual constant propagation: if the virtual function's return type is an
  integer <=64 bits and all possible callees are readnone, for each class and
  each list of constant arguments: evaluate the function, store the return
  value alongside the virtual table, and rewrite each virtual call as a load
  from the virtual table.

- Uniform return value optimization: if the conditions for virtual constant
  propagation hold and each function returns the same constant value, replace
  each virtual call with that constant.

- Unique return value optimization for i1 return values: if the conditions
  for virtual constant propagation hold and a single vtable's function
  returns 0, or a single vtable's function returns 1, replace each virtual
  call with a comparison of the vptr against that vtable's address.

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

llvm-svn: 260312

8 years agoUpdate documentation to reflect that libc++abi provides __cxa_thread_atexit (and...
Richard Smith [Tue, 9 Feb 2016 22:48:14 +0000 (22:48 +0000)]
Update documentation to reflect that libc++abi provides __cxa_thread_atexit (and has for quite a while). Also document that we have not yet implemented the new inheriting constructor rules.

llvm-svn: 260311

8 years agoFix inverted comparison.
Rafael Espindola [Tue, 9 Feb 2016 22:47:34 +0000 (22:47 +0000)]
Fix inverted comparison.

llvm-svn: 260310

8 years agoImprove the C API echo test tool to emit basic block is the right order.
Amaury Sechet [Tue, 9 Feb 2016 22:36:41 +0000 (22:36 +0000)]
Improve the C API echo test tool to emit basic block is the right order.

Summary: As per title. Also add a facility method to get the name of a basic block from the C API.

Reviewers: bogner, chandlerc, echristo, dblaikie, joker.eph, Wallbraker

Subscribers: llvm-commits

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

llvm-svn: 260309

8 years agoFixed many issues that were causing differing type definition issues to show up when...
Greg Clayton [Tue, 9 Feb 2016 22:36:24 +0000 (22:36 +0000)]
Fixed many issues that were causing differing type definition issues to show up when parsing expressions.

1) Turns out we weren't correctly uniquing types for C++. We would search our repository for "lldb_private::Process", but yet store just "Process" in the unique type map. Now we store things correctly and correctly unique types.
2) SymbolFileDWARF::CompleteType() can be called at any time in order to complete a C++ or Objective C class. All public inquiries into the SymbolFile go through SymbolVendor, and SymbolVendor correctly takes the module lock before it call the SymbolFile API call, but when we let CompilerType objects out in the wild, they can complete themselves at any time from the expression parser, so the ValueObjects or (SBValue objects in the public API), and many more places. So we now take the module lock when completing a type to avoid two threads being in the SymbolFileDWARF at the same time.
3) If a class has a template member function like:

    class A
    {
        <template T>
        void Foo(T t);
    };

    The DWARF will _only_ contain a DW_TAG_subprogram for "Foo" if anyone specialized it. This would cause a class definition for A inside a.cpp that used a "int" and "float" overload to look like:
    class A
    {
        void Foo(int t);
        void Foo(double t);
    };

    And a version from b.cpp that used a "float" overload to look like:
    class A
    {
        void Foo(float t);
    };

    And a version from c.cpp that use no overloads to look like:

    class A
    {
    };

    Then in an expression if you have two variables, one name "a" from a.cpp in liba.dylib, and one named "b" from b.cpp in libb.dylib, you will get conflicting definitions for "A" and your expression will fail. This all stems from the fact that DWARF _only_ emits template specializations, not generic definitions, and they are only emitted if they are used. There are two solutions to this:
    a) When ever you run into ANY class, you must say "just because this class doesn't have templatized member functions, it doesn't mean that any other instances might not have any, so when ever I run into ANY class, I must parse all compile units and parse all instances of class "A" just in case it has member functions that are templatized.". That is really bad because it means you always pull in ALL DWARF that contains most likely exact duplicate definitions of the class "A" and you bloat the memory that the SymbolFileDWARF plug-in uses in LLDB (since you pull in all DIEs from all compile units that contain a "A" definition) uses for little value most of the time.
    b) Modify DWARF to emit generic template member function definitions so that you know from looking at any instance of class "A" wether it has template member functions or not. In order to do this, we would have to have the ability to correctly parse a member function template, but there is a compiler bug:
    <rdar://problem/24515533> [PR 26553] C++ Debug info should reference DW_TAG_template_type_parameter
    This bugs means that not all of the info needed to correctly make a template member function is in the DWARF. The main source of the problem is if we have DWARF for a template instantiation for "int" like: "void A::Foo<int>(T)" the DWARF comes out as "void A::Foo<int>(int)" (it doesn't mention type "T", it resolves the type to the specialized type to "int"). But if you actually have your function defined as "<template T> void Foo(int t)" and you only use T for local variables inside the function call, we can't correctly make the function prototype up in the clang::ASTContext.

    So the best we can do for now we just omit all member functions that are templatized from the class definition so that "A" never has any template member functions. This means all defintions of "A" look like:

    class A
    {
    };

    And our expressions will work. You won't be able to call template member fucntions in expressions (not a regression, we weren't able to do this before) and if you are stopped in a templatized member function, we won't know that are are in a method of class "A". All things we should fix, but we need <rdar://problem/24515533> fixed first, followed by:

    <rdar://problem/24515624> Classes should always include a template subprogram definition, even when no template member functions are used

    before we can do anything about it in LLDB.

This bug mainly fixed the following Apple radar:

<rdar://problem/24483905>

llvm-svn: 260308

8 years agoPR26349: correctly check whether a digit sequence is empty in the presence of digit...
Richard Smith [Tue, 9 Feb 2016 22:34:35 +0000 (22:34 +0000)]
PR26349: correctly check whether a digit sequence is empty in the presence of digit separators.

llvm-svn: 260307

8 years agoProxy task fix: task_state stack push condition on fork
Jonathan Peyton [Tue, 9 Feb 2016 22:32:41 +0000 (22:32 +0000)]
Proxy task fix: task_state stack push condition on fork

The problem is that the master's thread state was not saved before entering a
parallel region so it does not remember tasks when it returns.

llvm-svn: 260306

8 years ago[mips] Extend MipsAsmParser class to handle %got(sym + const) expressions
Simon Atanasyan [Tue, 9 Feb 2016 22:31:49 +0000 (22:31 +0000)]
[mips] Extend MipsAsmParser class to handle %got(sym + const) expressions

Now the parser supports `%got(sym)` expressions only but `%got(sym + const)`
variant is also valid and accepted by GAS.

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

llvm-svn: 260305

8 years agoconfigure: Remove llvm 3.6 defines
Jan Vesely [Tue, 9 Feb 2016 22:17:48 +0000 (22:17 +0000)]
configure: Remove llvm 3.6 defines

we require llvm 3.7

reviewer: tstellard
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 260304

8 years agoconfigure: Remove cl_khr_fp64 for device that don't support doubles
Jan Vesely [Tue, 9 Feb 2016 22:17:46 +0000 (22:17 +0000)]
configure: Remove cl_khr_fp64 for device that don't support doubles

Also remove definitions if provided by clang (3.7+)
This halves the size of builtin.opt.{cedar,barts}.bc

reviewer: tstellard
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 260303

8 years agoconfigure: Introduce per device defines
Jan Vesely [Tue, 9 Feb 2016 22:17:45 +0000 (22:17 +0000)]
configure: Introduce per device defines

Make cl_khr_fp64 define per-device.
This patch does not change the generated Makefile (for llvm 3.6, 3.7)

v2: Make the device defines per LLVM version, 'all' for all versions

reviewer: tstellard
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 260302

8 years agomath: Fix log2 vectorization on non-fp64 hw
Jan Vesely [Tue, 9 Feb 2016 22:17:42 +0000 (22:17 +0000)]
math: Fix log2 vectorization on non-fp64 hw

reviewer: tstellard
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 260301

8 years agoHave Mac builds use @rpath when supported in CMake
Jonathan Peyton [Tue, 9 Feb 2016 22:15:30 +0000 (22:15 +0000)]
Have Mac builds use @rpath when supported in CMake

The -install_name linker flag will use "@rpath/" when supported in CMake
which is the recommended usage for dynamic libraries on Mac OSX.

llvm-svn: 260300

8 years agoDon't complete a class type just to test if it is a class. Code in CompilerType and...
Greg Clayton [Tue, 9 Feb 2016 22:09:26 +0000 (22:09 +0000)]
Don't complete a class type just to test if it is a class. Code in CompilerType and in clang::QualType knows how to complete a type if it needs to.

llvm-svn: 260299

8 years ago[MemoryBuiltins] Fix an issue with hasNoAliasAttr
Sanjoy Das [Tue, 9 Feb 2016 21:54:18 +0000 (21:54 +0000)]
[MemoryBuiltins] Fix an issue with hasNoAliasAttr

Summary:
`hasNoAliasAttr` is buggy: it checks to see if the called function has
a `noalias` attribute, which is incorrect since functions are not even
allowed to have the `noalias` attribute.  The comment on its only
caller, `llvm::isNoAliasFn`, makes it pretty clear that the intention
to do the `noalias` check on the return value, and not the callee.

Unfortunately I couldn't find a way to test this upstream -- fixing
this does not change the observable behavior of any of the passes that
use this.  This is not very surprising, since `noalias` does not tell
anything about the contents of the allocated memory (so, e.g., you
still cannot fold loads).  I'll be happy to be proven wrong though.

Reviewers: chandlerc, reames

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 260298

8 years agoELF: Add 'using namespace llvm::dwarf'.
Rui Ueyama [Tue, 9 Feb 2016 21:46:11 +0000 (21:46 +0000)]
ELF: Add 'using namespace llvm::dwarf'.

Most constants defined in llvm::dwarf namespace start with "DW_".
We don't have to worry about name conflicts.

llvm-svn: 260297

8 years ago[Verifier] Add checks for masked.load and masked.store intrinsics
Philip Reames [Tue, 9 Feb 2016 21:43:12 +0000 (21:43 +0000)]
[Verifier] Add checks for masked.load and masked.store intrinsics

While trying to track down what appears to be a LoopVectorizer bug, I noticed that we had no validation of the correctness of calls emitted to @llvm.masked.load and @llvm.masked.store.  This meant malformed IR was showing up much much later than it should.  Hopefully, having Verifier rules in place will make this easier to isolate.

llvm-svn: 260296

8 years ago[SelectionDAG] make getMemBasePlusOffset() accessible; NFCI
Sanjay Patel [Tue, 9 Feb 2016 21:42:04 +0000 (21:42 +0000)]
[SelectionDAG] make getMemBasePlusOffset() accessible; NFCI

I reinvented this functionality in http://reviews.llvm.org/D16828 because it was
hidden away as a static function. The changes in x86 are not based on a complete
audit. I suspect there are other possible uses there, and there are almost certainly
more potential users in other targets.

llvm-svn: 260295