platform/upstream/llvm.git
9 years ago[Tsan] Fix the thread_name tests to build on FreeBSD
Viktor Kutuzov [Fri, 24 Oct 2014 09:27:34 +0000 (09:27 +0000)]
[Tsan] Fix the thread_name tests to build on FreeBSD
Differential Revision: http://reviews.llvm.org/D5855

llvm-svn: 220552

9 years ago[Tsan] Intercept pthread_set_name_np on FreeBSD
Viktor Kutuzov [Fri, 24 Oct 2014 09:23:06 +0000 (09:23 +0000)]
[Tsan] Intercept pthread_set_name_np on FreeBSD
Differential Revision: http://reviews.llvm.org/D5932

llvm-svn: 220551

9 years ago[Tsan] Fix the signal_recursive.cc test to build on FreeBSD
Viktor Kutuzov [Fri, 24 Oct 2014 09:20:20 +0000 (09:20 +0000)]
[Tsan] Fix the signal_recursive.cc test to build on FreeBSD
Differential Revision: http://reviews.llvm.org/D5841

llvm-svn: 220550

9 years ago[CMake] clangRewrite: Roll back clangAST in libdeps, due to clang::Stmt::printPretty().
NAKAMURA Takumi [Fri, 24 Oct 2014 08:44:01 +0000 (08:44 +0000)]
[CMake] clangRewrite: Roll back clangAST in libdeps, due to clang::Stmt::printPretty().

llvm-svn: 220549

9 years agoUpdate test/MC/ARM/coff-debugging-secrel.ll expectations to fix breakage caused by...
Timur Iskhodzhanov [Fri, 24 Oct 2014 06:24:07 +0000 (06:24 +0000)]
Update test/MC/ARM/coff-debugging-secrel.ll expectations to fix breakage caused by r220544

llvm-svn: 220548

9 years agoDriver: add missed file from previous commit
Saleem Abdulrasool [Fri, 24 Oct 2014 03:24:33 +0000 (03:24 +0000)]
Driver: add missed file from previous commit

llvm-svn: 220547

9 years agoDriver: add CrossWindowsToolChain
Saleem Abdulrasool [Fri, 24 Oct 2014 03:13:37 +0000 (03:13 +0000)]
Driver: add CrossWindowsToolChain

This is a very basic toolchain.  It supports cross-compiling Windows (primarily
inspired by the WoA target).  It is meant to use clang with the LLVM IAS and a
binutils ld-compatible interface for the linker (eventually to be lld).  It does
not perform any "standard" GCC lookup, nor does it perform any special
adjustments given that it is expected to be used in an environment where the
user is using MSVCRT (and as such Visual Studio headers) and the Windows SDK.
The primary runtime library is expected to be compiler-rt and the C++
implementation to be libc++.

It also expects that a sysroot has been setup given the usual Unix semantics
(standard C headers in /usr/include, all the import libraries available in
/usr/lib).  It also expects that an entry point stub is present in /usr/lib
(crtbegin.obj for executables, crtbeginS.obj for shared libraries).

The entry point stub is responsible for running any GNU constructors.

llvm-svn: 220546

9 years agoAdded reset of LexicalScope in LiveDebugVariables reset function.
Marcello Maggioni [Fri, 24 Oct 2014 02:46:50 +0000 (02:46 +0000)]
Added reset of LexicalScope in LiveDebugVariables reset function.

llvm-svn: 220545

9 years agoFix PR21189 -- Emit symbol subsection required to debug LLVM-built binaries with...
Timur Iskhodzhanov [Fri, 24 Oct 2014 01:27:45 +0000 (01:27 +0000)]
Fix PR21189 -- Emit symbol subsection required to debug LLVM-built binaries with VS2012+

Reviewed at http://reviews.llvm.org/D5772

llvm-svn: 220544

9 years agoAdd a new -fmerge-functions -cc1 flag that enables function merging.
Nick Lewycky [Fri, 24 Oct 2014 00:49:29 +0000 (00:49 +0000)]
Add a new -fmerge-functions -cc1 flag that enables function merging.

llvm-svn: 220543

9 years agoDebugInfo: Remove DwarfDebug::addScopeVariable now that it's just a trivial wrapper
David Blaikie [Fri, 24 Oct 2014 00:43:47 +0000 (00:43 +0000)]
DebugInfo: Remove DwarfDebug::addScopeVariable now that it's just a trivial wrapper

llvm-svn: 220542

9 years agoMake test for r220533 more robust by using GPR pattern.
Ahmed Bougacha [Fri, 24 Oct 2014 00:03:46 +0000 (00:03 +0000)]
Make test for r220533 more robust by using GPR pattern.

llvm-svn: 220541

9 years ago[AVX512] FMA support for the 231 variants
Adam Nemet [Fri, 24 Oct 2014 00:03:00 +0000 (00:03 +0000)]
[AVX512] FMA support for the 231 variants

This is asm/diasm-only support, similar to AVX.

For ISeling the register variant, they are no different from 213 other than
whether the multiplication or the addition operand is destructed.

For ISeling the memory variant, i.e. to fold a load, they are no different
than the 132 variant.  The addition operand (op3) in both cases can come from
memory.  Again the ony difference is which operand is destructed.

There could be a post-RA pass that would convert a 213 or 132 into a 231.

Part of <rdar://problem/17082571>

llvm-svn: 220540

9 years ago[AVX512] Introduce fma3p_forms from AVX
Adam Nemet [Fri, 24 Oct 2014 00:02:55 +0000 (00:02 +0000)]
[AVX512] Introduce fma3p_forms from AVX

This multiclass generates the different forms: 213, 231, 132 in AVX.

132 in AVX512 is a separate class but I am planning to use this same
multiclass to generate 231 relying on the nice the null_frag trick from AVX to
disable codegen pattern for 231.

No functionality change, no change in X86.td.expanded except for the different
instruction definition names.

llvm-svn: 220539

9 years agoIf requested, apply function merging at -O0 too. It's useful there to reduce the...
Nick Lewycky [Thu, 23 Oct 2014 23:49:31 +0000 (23:49 +0000)]
If requested, apply function merging at -O0 too. It's useful there to reduce the time to compile.

llvm-svn: 220537

9 years agoMake getDISubprogram(const Function *F) available in LLVM
Timur Iskhodzhanov [Thu, 23 Oct 2014 23:46:28 +0000 (23:46 +0000)]
Make getDISubprogram(const Function *F) available in LLVM

Reviewed at http://reviews.llvm.org/D5950

llvm-svn: 220536

9 years agoChange uses of `sys.platform == 'linux2' to `sys.platform.startswith('linux')
Eric Fiselier [Thu, 23 Oct 2014 23:05:46 +0000 (23:05 +0000)]
Change uses of `sys.platform == 'linux2' to `sys.platform.startswith('linux')

Although the current method is valid up till python 3.3 (which is not supported)
this seems to be a clearer way of checking for linux and moves the tests towards
python 3 compatibility.

llvm-svn: 220535

9 years agoChange uses of `sys.platform == 'linux2' to `sys.platform.startswith('linux')
Eric Fiselier [Thu, 23 Oct 2014 22:57:56 +0000 (22:57 +0000)]
Change uses of `sys.platform == 'linux2' to `sys.platform.startswith('linux')

Although the current method is valid up till python 3.3 (which is not supported)
this seems to be a clearer way of checking for linux and moves the tests towards
python 3 compatibility.

llvm-svn: 220534

9 years ago[SelectionDAG] Teach the vector scalarizer about FP conversions.
Ahmed Bougacha [Thu, 23 Oct 2014 22:49:25 +0000 (22:49 +0000)]
[SelectionDAG] Teach the vector scalarizer about FP conversions.

This adds support for legalization of instructions of the form:

  [fp_conv] <1 x i1> %op to <1 x double>

where fp_conv is one of fpto[us]i, [us]itofp.  This used to assert
because they were simply missing from the vector operand scalarizer.

A similar problem arose in r190830, with trunc instead.

Fixes PR20778.

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

llvm-svn: 220533

9 years agoDon't emit strong vtable definitions for imported classes with key functions (PR21355)
Hans Wennborg [Thu, 23 Oct 2014 22:40:46 +0000 (22:40 +0000)]
Don't emit strong vtable definitions for imported classes with key functions (PR21355)

Clang would previously assert on the following code when targeting MinGW:

  struct __declspec(dllimport) S {
      virtual ~S();
  };
  S::~S() {}

Because ~S is a key function and the class is dllimport, we would try to emit a
strong definition of the vtable, with dllimport - which is a conflict. We
should not emit strong vtable definitions for imported classes.

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

llvm-svn: 220532

9 years agoUpdate comment and fix typos in assert message. (NFC)
Ahmed Bougacha [Thu, 23 Oct 2014 22:40:34 +0000 (22:40 +0000)]
Update comment and fix typos in assert message. (NFC)

llvm-svn: 220531

9 years agoUpdate llvm.donothing documentation.
Juergen Ributzka [Thu, 23 Oct 2014 22:36:13 +0000 (22:36 +0000)]
Update llvm.donothing documentation.

llvm.donothing is no longer the only intrinsic that can be invoked.

llvm-svn: 220530

9 years agoScheduleDAG: record PhysReg dependencies represented by CopyFromReg nodes
Tim Northover [Thu, 23 Oct 2014 22:31:48 +0000 (22:31 +0000)]
ScheduleDAG: record PhysReg dependencies represented by CopyFromReg nodes

x86's CMPXCHG -> EFLAGS consumer wasn't being recorded as a real EFLAGS
dependency because it was represented by a pair of CopyFromReg(EFLAGS) ->
CopyToReg(EFLAGS) nodes. ScheduleDAG was expecting the source to be an
implicit-def on the instruction, where the result numbers in the DAG and the
Uses list in TableGen matched up precisely.

The Copy notation seems much more robust, so this patch extends ScheduleDAG
rather than refactoring x86.

Should fix PR20376.

llvm-svn: 220529

9 years ago[sanitizer] Add a bunch of sanity checks.
Evgeniy Stepanov [Thu, 23 Oct 2014 22:29:51 +0000 (22:29 +0000)]
[sanitizer] Add a bunch of sanity checks.

llvm-svn: 220528

9 years agoDebugInfo: Remove DwarfDebug::CurrentFnArguments since we have to handle argument...
David Blaikie [Thu, 23 Oct 2014 22:27:50 +0000 (22:27 +0000)]
DebugInfo: Remove DwarfDebug::CurrentFnArguments since we have to handle argument ordering of other arguments (abstract arguments) in the same way and already have code for that too.

While refactoring this code I was confused by both the name I had
introduced (addNonArgumentVariable... but it has all this logic to
handle argument numbering and keep things in order?) and by the
redundancy. Seems when I fixed the misordered inlined argument handling,
I didn't realize it was mostly redundant with the argument ordering code
(which I may've also written, I'm not sure). So let's just rely on the
more general case.

The only oddity in output this produces is that it means when we emit
all the variables for the current function, we don't track when we've
finished the argument variables and are about to start the local
variables and insert DW_AT_unspecified_parameters (for varargs
functions) there. Instead it ends up after the local variables, scopes,
etc. But this isn't invalid and doesn't cause DWARF consumers problems
that I know of... so we'll just go with that because it makes the code
nice & simple.

(though, let's see what the buildbots have to say about this - *crosses
fingers*)

There will be some cleanup commits to follow to remove the now trivial
wrappers, etc.

llvm-svn: 220527

9 years agoPR21189: Teach llvm-readobj to dump bits of COFF symbol subsections required to debug...
Timur Iskhodzhanov [Thu, 23 Oct 2014 22:25:31 +0000 (22:25 +0000)]
PR21189: Teach llvm-readobj to dump bits of COFF symbol subsections required to debug using VS2012+

Reviewed at http://reviews.llvm.org/D5755
Thanks to Andrey Guskov for his help investigating this!

llvm-svn: 220526

9 years agoDriver: Include driver diagnostics when we --serialize-diagnostics
Justin Bogner [Thu, 23 Oct 2014 22:20:11 +0000 (22:20 +0000)]
Driver: Include driver diagnostics when we --serialize-diagnostics

Currently, when --serialize-diagnostics is passed this only includes
the diagnostics from clang -cc1, and driver diagnostics are
dropped. This causes issues for tools that use the serialized
diagnostics, since stderr is lost and these diagnostics aren't seen at
all.

We handle this by merging the diagnostics from the CC1 process and the
driver diagnostics into a single file when the driver invokes CC1.

Fixes rdar://problem/10585062

llvm-svn: 220525

9 years ago[modules] Simplify reading of INPUT_FILE_OFFSETS record and make it robust against...
Richard Smith [Thu, 23 Oct 2014 22:18:29 +0000 (22:18 +0000)]
[modules] Simplify reading of INPUT_FILE_OFFSETS record and make it robust against changes to record order.

llvm-svn: 220524

9 years agoCmake variables are global, which is why we would get crud like /machine:X86 in the...
Aaron Ballman [Thu, 23 Oct 2014 22:13:52 +0000 (22:13 +0000)]
Cmake variables are global, which is why we would get crud like /machine:X86 in the list of compiler options for MSVC. Clear out the variable before attempting to enumerate arguments and set them.

llvm-svn: 220522

9 years agoFactor out common checks from module map deserialization. No functionality change.
Richard Smith [Thu, 23 Oct 2014 22:12:14 +0000 (22:12 +0000)]
Factor out common checks from module map deserialization. No functionality change.

llvm-svn: 220521

9 years agoDebugInfo: Sink DwarfDebug::addNonArgumentScopeVariable into DwarfFile.
David Blaikie [Thu, 23 Oct 2014 22:04:30 +0000 (22:04 +0000)]
DebugInfo: Sink DwarfDebug::addNonArgumentScopeVariable into DwarfFile.

llvm-svn: 220520

9 years agoAppeasing an MSVC compile warning about "and"; NFC.
Aaron Ballman [Thu, 23 Oct 2014 21:59:34 +0000 (21:59 +0000)]
Appeasing an MSVC compile warning about "and"; NFC.

llvm-svn: 220519

9 years agoMachODump.cpp: fix MSVC build
Hans Wennborg [Thu, 23 Oct 2014 21:59:17 +0000 (21:59 +0000)]
MachODump.cpp: fix MSVC build

llvm-svn: 220518

9 years agoDo not set linker flags for MSVC; they are not the same thing as compiler flags....
Aaron Ballman [Thu, 23 Oct 2014 21:58:36 +0000 (21:58 +0000)]
Do not set linker flags for MSVC; they are not the same thing as compiler flags. Note, this is already done in the add_compiler_rt_test test_suite function.

llvm-svn: 220517

9 years ago[X86] Improve mul w/ overflow codegen, to MUL8+SETO.
Ahmed Bougacha [Thu, 23 Oct 2014 21:55:31 +0000 (21:55 +0000)]
[X86] Improve mul w/ overflow codegen, to MUL8+SETO.

Currently, @llvm.smul.with.overflow.i8 expands to 9 instructions, where
3 are really needed.

This adds X86ISD::UMUL8/SMUL8 SD nodes, and custom lowers them to
MUL8/IMUL8 + SETO.

i8 is a special case because there is no two/three operand variants of
(I)MUL8, so the first operand and return value need to go in AL/AX.

Also, we can't write patterns for these instructions: TableGen refuses
patterns where output operands don't match SDNode results. In this case,
instructions where the output operand is an implicitly defined register.

A related special case (and FIXME) exists for MUL8 (X86InstrArith.td):

  // FIXME: Used for 8-bit mul, ignore result upper 8 bits.
  // This probably ought to be moved to a def : Pat<> if the
  // syntax can be accepted.
  [(set AL, (mul AL, GR8:$src)), (implicit EFLAGS)]

Ideally, these go away with UMUL8, but we still need to improve TableGen
support of implicit operands in patterns.

Before this change:
  movsbl  %sil, %eax
  movsbl  %dil, %ecx
  imull   %eax, %ecx
  movb    %cl, %al
  sarb    $7, %al
  movzbl  %al, %eax
  movzbl  %ch, %esi
  cmpl    %eax, %esi
  setne   %al

After:
  movb    %dil, %al
  imulb   %sil
  seto    %al

Also, remove a made-redundant testcase for PR19858, and enable more FastISel
ALU-overflow tests for SelectionDAG too.

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

llvm-svn: 220516

9 years agoDebugInfo: Remove DwarfDebug::addCurrentFnArgument declaration now that it's moved...
David Blaikie [Thu, 23 Oct 2014 21:53:17 +0000 (21:53 +0000)]
DebugInfo: Remove DwarfDebug::addCurrentFnArgument declaration now that it's moved to DwarfFile.

llvm-svn: 220515

9 years agoHandle sqrt() shrinking in SimplifyLibCalls like any other call
Sanjay Patel [Thu, 23 Oct 2014 21:52:45 +0000 (21:52 +0000)]
Handle sqrt() shrinking in SimplifyLibCalls like any other call

This patch removes a chunk of special case logic for folding
(float)sqrt((double)x) -> sqrtf(x)
in InstCombineCasts and handles it in the mainstream path of SimplifyLibCalls.

No functional change intended, but I loosened the restriction on the existing
sqrt testcases to allow for this optimization even without unsafe-fp-math because
that's the existing behavior.

I also added a missing test case for not shrinking the llvm.sqrt.f64 intrinsic
in case the result is used as a double.

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

llvm-svn: 220514

9 years agoThis test case should not rely on stepping behavior because that might chance due...
Enrico Granata [Thu, 23 Oct 2014 21:35:18 +0000 (21:35 +0000)]
This test case should not rely on stepping behavior because that might chance due to inlining. Set breakpoints where you want them instead. Fixes rdar://18724175

llvm-svn: 220513

9 years ago[libcxx] XFAIL all currently failing libc++ tests for linux.
Eric Fiselier [Thu, 23 Oct 2014 21:17:36 +0000 (21:17 +0000)]
[libcxx] XFAIL all currently failing libc++ tests for linux.

Summary:
Pretty please? We now have a significant number of builders that test libc++. I really want those builders to be green.
Most of these failures are due to differences in locale data, including those in regex. I will continue working on fixing the locale and regex tests but there is no consensus on what the correct direction to go.

Since the builders display a list of XFAIL tests they are by no means hidden. It just means they are expected failures. Now unexpected failures won't get mixed in with well known and expected failures.

Reviewers: mclow.lists, jroelofs, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

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

llvm-svn: 220512

9 years agoFix a problem where an SBType was advertising its static type class even though a...
Enrico Granata [Thu, 23 Oct 2014 21:15:20 +0000 (21:15 +0000)]
Fix a problem where an SBType was advertising its static type class even though a dynamic type was available. Solves rdar://18744420

llvm-svn: 220511

9 years agoOnly link tests against -ldl on linux
Eric Fiselier [Thu, 23 Oct 2014 20:45:37 +0000 (20:45 +0000)]
Only link tests against -ldl on linux

llvm-svn: 220510

9 years agoOnly link the tests against -ldl on linux
Eric Fiselier [Thu, 23 Oct 2014 20:44:25 +0000 (20:44 +0000)]
Only link the tests against -ldl on linux

llvm-svn: 220509

9 years ago[PECOFF] Fix /nodefaultlib option.
Rui Ueyama [Thu, 23 Oct 2014 20:42:07 +0000 (20:42 +0000)]
[PECOFF] Fix /nodefaultlib option.

/nodefaultlib argument is a path name, so that needs to be compared
case-insensitive way. Also the ".lib" extension should be ignored.

llvm-svn: 220508

9 years agoDisabling some MSVC warnings that are of questionable value. Note, these are disabled...
Aaron Ballman [Thu, 23 Oct 2014 20:39:58 +0000 (20:39 +0000)]
Disabling some MSVC warnings that are of questionable value. Note, these are disabled by default in LLVM as well, so there is precedence.

C4146: 'unary minus operator applied to unsigned type, result still unsigned'
C4291: ''declaration' : no matching operator delete found; memory will not be freed if initialization throws an exception'
C4800: ''type' : forcing value to bool 'true' or 'false' (performance warning)'
llvm-svn: 220507

9 years agoChange all of the build flags to switch /MD and /MDd into /MT, instead of just some...
Aaron Ballman [Thu, 23 Oct 2014 20:24:00 +0000 (20:24 +0000)]
Change all of the build flags to switch /MD and /MDd into /MT, instead of just some of the targets. Fixes PR21241.

llvm-svn: 220506

9 years agoclang-format: Fix incorrect space after "<".
Daniel Jasper [Thu, 23 Oct 2014 20:22:22 +0000 (20:22 +0000)]
clang-format: Fix incorrect space after "<".

Before:
  bool a = 2 <::SomeFunction();

After:
  bool a = 2 < ::SomeFunction();

llvm-svn: 220505

9 years agoChange the name of the field BindTable to bindtable to not over lap the type.
Kevin Enderby [Thu, 23 Oct 2014 19:53:12 +0000 (19:53 +0000)]
Change the name of the field BindTable to bindtable to not over lap the type.

Should fix the build bot issues from commit r220500.

llvm-svn: 220504

9 years agoMake llvm-go test dependency optional.
Peter Collingbourne [Thu, 23 Oct 2014 19:51:40 +0000 (19:51 +0000)]
Make llvm-go test dependency optional.

llvm-svn: 220503

9 years agoRemove code duplication and cut dependency from clangRewrite on
Daniel Jasper [Thu, 23 Oct 2014 19:47:36 +0000 (19:47 +0000)]
Remove code duplication and cut dependency from clangRewrite on
clangAST.

llvm-svn: 220502

9 years agoMake llvm-link behave a bit more like LTO.
Rafael Espindola [Thu, 23 Oct 2014 19:40:45 +0000 (19:40 +0000)]
Make llvm-link behave a bit more like LTO.

* Read modules lazily
* Don't treat the first file specially, instead merge all inputs into an empty
  module.

llvm-svn: 220501

9 years agoUpdate llvm-objdump’s Mach-O symbolizer code for Objective-C references.
Kevin Enderby [Thu, 23 Oct 2014 19:37:31 +0000 (19:37 +0000)]
Update llvm-objdump’s Mach-O symbolizer code for Objective-C references.

This prints disassembly comments for Objective-C references to CFStrings,
Selectors, Classes and method calls.

llvm-svn: 220500

9 years agoCleanup this test a bit.
Rafael Espindola [Thu, 23 Oct 2014 19:36:21 +0000 (19:36 +0000)]
Cleanup this test a bit.

Use simpler names and remove unnecessary fields.

llvm-svn: 220499

9 years agoCleanup this test a bit.
Rafael Espindola [Thu, 23 Oct 2014 19:23:42 +0000 (19:23 +0000)]
Cleanup this test a bit.

Use simpler names and remove unnecessary fields.

llvm-svn: 220498

9 years agoDebugInfo: Simplify/tidy/correct global variable decl/def emission handling.
David Blaikie [Thu, 23 Oct 2014 19:12:43 +0000 (19:12 +0000)]
DebugInfo: Simplify/tidy/correct global variable decl/def emission handling.

This fixes a bug (introduced by fixing the IR emitted from Clang where
the definition of a static member would be scoped within the class,
rather than within its lexical decl context) where the definition of a
static variable would be placed inside a class.

It also improves source fidelity by scoping static class member
definitions inside the lexical decl context in which tehy are written
(eg: namespace n { class foo { static int i; } int foo::i; } - the
definition of 'i' will be within the namespace 'n' in the DWARF output
now).

Lastly, and the original goal, this reduces debug info size slightly
(and makes debug info easier to read, etc) by placing the definitions of
non-member global variables within their namespace, rather than using a
separate namespace-scoped declaration along with a definition at global
scope.

Based on patches and discussion with Frédéric.

llvm-svn: 220497

9 years agopatch to issue warning on comparing parameters with
Fariborz Jahanian [Thu, 23 Oct 2014 19:00:10 +0000 (19:00 +0000)]
patch to issue warning on comparing parameters with
nonnull attribute when comparison is always
true/false. Patch by Steven Wu with few fixes and minor
refactoring and adding tests by me. rdar://18712242

llvm-svn: 220496

9 years agoMake this test a bit stricter.
Rafael Espindola [Thu, 23 Oct 2014 18:52:46 +0000 (18:52 +0000)]
Make this test a bit stricter.

This now:
* Forces the linker to include the internal definition.
* Checks the full output.

llvm-svn: 220495

9 years agoMake this test a bit stricter.
Rafael Espindola [Thu, 23 Oct 2014 18:44:07 +0000 (18:44 +0000)]
Make this test a bit stricter.

This now:
* Forces the linker to include the internal definition.
* Checks the full output.

llvm-svn: 220494

9 years agoAdd a "signature" to AST files to verify that they haven't changed
Ben Langmuir [Thu, 23 Oct 2014 18:05:36 +0000 (18:05 +0000)]
Add a "signature" to AST files to verify that they haven't changed

Since the order of the IDs in the AST file (e.g. DeclIDs, SelectorIDs)
is not stable, it is not safe to load an AST file that depends on
another AST file that has been rebuilt since the importer was built,
even if "nothing changed". We previously used size and modtime to check
this, but I've seen cases where a module rebuilt quickly enough to foil
this check and caused very hard to debug build errors.

To save cycles when we're loading the AST, we just generate a random
nonce value and check that it hasn't changed when we load an imported
module, rather than actually hash the whole file.

This is slightly complicated by the fact that we need to verify the
signature inside addModule, since we might otherwise consider that a
mdoule is "OutOfDate" when really it is the importer that is out of
date. I didn't see any regressions in module load time after this
change.

llvm-svn: 220493

9 years agoRevert "Don't count inreg params when mangling fastcall functions"
Reid Kleckner [Thu, 23 Oct 2014 17:50:42 +0000 (17:50 +0000)]
Revert "Don't count inreg params when mangling fastcall functions"

This reverts commit r214981.

I'm not sure what I was thinking when I wrote this. Testing with MSVC
shows that this function is mangled to '@f@8':
  int __fastcall f(int a, int b);

llvm-svn: 220492

9 years agoAdd flag --enable-check-profile to clang-tidy.
Samuel Benzaquen [Thu, 23 Oct 2014 17:23:20 +0000 (17:23 +0000)]
Add flag --enable-check-profile to clang-tidy.

Summary:
Add flag --enable-check-profile to clang-tidy.
It turns on per-matcher profiles in MatchFinder and prints a report to
stderr at the end.

Reviewers: alexfh

Subscribers: curdeius, cfe-commits

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

llvm-svn: 220491

9 years agoAdding llvm-shlib to CMake build system with a few new bells and whistles
Chris Bieneman [Thu, 23 Oct 2014 17:22:14 +0000 (17:22 +0000)]
Adding llvm-shlib to CMake build system with a few new bells and whistles

Summary:
This patch adds a new CMake build setting LLVM_BUILD_LLVM_DYLIB, which defaults to OFF. When set to ON, this will generate a shared library containing most of LLVM. The contents of the shared library can be overriden by specifying LLVM_DYLIB_COMPONENTS. LLVM_DYLIB_COMPONENTS can be set to a semi-colon delimited list of any LLVM components that you llvm-config can resolve.

On Windows, unless you are using Cygwin, you must specify an explicit symbol export file using LLVM_EXPORTED_SYMBOL_FILE. On Cygwin and all unix-like platforms if you do not specify LLVM_EXPORTED_SYMBOL_FILE, an export file containing only the LLVM C API will be auto-generated from the list of LLVM components specified in LLVM_DYLIB_COMPONENTS.

Reviewers: rnk

Reviewed By: rnk

Subscribers: rnk, llvm-commits

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

llvm-svn: 220490

9 years agoMake headers available in the build directory
Justin Bogner [Thu, 23 Oct 2014 16:51:12 +0000 (16:51 +0000)]
Make headers available in the build directory

This essentially re-does r194825 and makes it possible to run clang
with libc++ without having to install it, even if you don't have any
version of libc++ installed in /usr/.

This behaviour broke in r210577/r211629, which fixed pr18681.

llvm-svn: 220489

9 years agoDebugInfo: Correctly describe the lexical decl context of static member variable...
David Blaikie [Thu, 23 Oct 2014 16:39:49 +0000 (16:39 +0000)]
DebugInfo: Correctly describe the lexical decl context of static member variable definitions.

The previous IR representation used the non-lexical decl context, which
placed the definitions in the same scope as the declarations (ie: within
the class) - this was hidden by the fact that LLVM currently doesn't
respect the context of global variable definitions at all, and always
puts them at the top level (as direct children of the compile_unit).
Having the correct lexical scope improves source fidelity and simplify
backend global variable emission (with changes coming shortly).

Doing something similar for non-member global variables would help
simplify/cleanup things further (see FIXME in the commit) and provide
similar source fidelity benefits to the final debug info.

llvm-svn: 220488

9 years agoRemove explicit (void) use of DwarfFile::DD that was accidentally left in r220452.
David Blaikie [Thu, 23 Oct 2014 16:12:58 +0000 (16:12 +0000)]
Remove explicit (void) use of DwarfFile::DD that was accidentally left in r220452.

Caught in post-commit review by Frédéric.

llvm-svn: 220487

9 years agoDo not emit intermediate register for zero FP immediate
Renato Golin [Thu, 23 Oct 2014 15:31:50 +0000 (15:31 +0000)]
Do not emit intermediate register for zero FP immediate

This updates check for double precision zero floating point constant to allow
use of instruction with immediate value rather than temporary register.
Currently "a == 0.0", where "a" is of "double" type generates:

vmov.i32        d16, #0x0
vcmpe.f64       d0, d16

With this change it becomes:

vcmpe.f64        d0, #0

Patch by Sergey Dmitrouk.

llvm-svn: 220486

9 years agoDisable dsym tests on !Darwin hosts
Ed Maste [Thu, 23 Oct 2014 15:21:45 +0000 (15:21 +0000)]
Disable dsym tests on !Darwin hosts

This was missing from r219984

llvm.org/pr21324

llvm-svn: 220485

9 years agoclang-format two code snippets to make the next patch easy to read.
Rafael Espindola [Thu, 23 Oct 2014 15:20:05 +0000 (15:20 +0000)]
clang-format two code snippets to make the next patch easy to read.

llvm-svn: 220484

9 years agoAdd unittest for extreme alignments.
Rafael Espindola [Thu, 23 Oct 2014 14:45:19 +0000 (14:45 +0000)]
Add unittest for extreme alignments.

llvm-svn: 220483

9 years agoHexagon/Disassembler/LLVMBuild.txt: Update libdeps.
NAKAMURA Takumi [Thu, 23 Oct 2014 11:32:16 +0000 (11:32 +0000)]
Hexagon/Disassembler/LLVMBuild.txt: Update libdeps.

llvm-svn: 220482

9 years agoHexagon/LLVMBuild.txt: Prune CRLF.
NAKAMURA Takumi [Thu, 23 Oct 2014 11:32:03 +0000 (11:32 +0000)]
Hexagon/LLVMBuild.txt: Prune CRLF.

llvm-svn: 220481

9 years ago[CMake] Prune CRLF in CMakeLists.txt(s).
NAKAMURA Takumi [Thu, 23 Oct 2014 11:31:50 +0000 (11:31 +0000)]
[CMake] Prune CRLF in CMakeLists.txt(s).

llvm-svn: 220480

9 years ago[CMake] Prune trailing whitespace.
NAKAMURA Takumi [Thu, 23 Oct 2014 11:31:33 +0000 (11:31 +0000)]
[CMake] Prune trailing whitespace.

llvm-svn: 220479

9 years agoRevert r220427, "[Hexagon] Adding encoding bits for add opcode."
NAKAMURA Takumi [Thu, 23 Oct 2014 11:31:22 +0000 (11:31 +0000)]
Revert r220427, "[Hexagon] Adding encoding bits for add opcode."

It brought cyclic dependecy between HexagonAsmPrinter and HexagonDesc.

llvm-svn: 220478

9 years ago[mips][microMIPS] Implement ADDIUR1SP instruction
Zoran Jovanovic [Thu, 23 Oct 2014 11:13:59 +0000 (11:13 +0000)]
[mips][microMIPS] Implement ADDIUR1SP instruction
Differential Revision: http://reviews.llvm.org/D5153

llvm-svn: 220477

9 years agops][microMIPS] Implement ADDIUR2 instruction
Zoran Jovanovic [Thu, 23 Oct 2014 11:06:34 +0000 (11:06 +0000)]
ps][microMIPS] Implement ADDIUR2 instruction
Differential Revision: http://reviews.llvm.org/D5151

llvm-svn: 220476

9 years agops][microMIPS] Implement LI16 instruction
Zoran Jovanovic [Thu, 23 Oct 2014 10:59:24 +0000 (10:59 +0000)]
ps][microMIPS] Implement LI16 instruction
Differential Revision: http://reviews.llvm.org/D5149

llvm-svn: 220475

9 years ago[mips][microMIPS] Implement CodeGen support for SLL16 and SRL16 instructions
Zoran Jovanovic [Thu, 23 Oct 2014 10:42:01 +0000 (10:42 +0000)]
[mips][microMIPS] Implement CodeGen support for SLL16 and SRL16 instructions
Differential Revision: http://reviews.llvm.org/D5774

llvm-svn: 220474

9 years agoFix code where goto jumped over local variable initialization.
Hafiz Abid Qadeer [Thu, 23 Oct 2014 10:36:53 +0000 (10:36 +0000)]
Fix code where goto jumped over local variable initialization.

llvm-svn: 220473

9 years ago[Thumb2] Improve disassembly of memory hints
Oliver Stannard [Thu, 23 Oct 2014 08:52:58 +0000 (08:52 +0000)]
[Thumb2] Improve disassembly of memory hints

Currently, the ARM disassembler will disassemble the Thumb2 memory hint
instructions (PLD, PLDW and PLI), even for targets which do not have
these instructions. This patch adds the required checks to the
disassmebler.

llvm-svn: 220472

9 years agoAdd support for "fancy" pointers to promise and packaged_task.
Eric Fiselier [Thu, 23 Oct 2014 06:24:45 +0000 (06:24 +0000)]
Add support for "fancy" pointers to promise and packaged_task.

Summary:
This patch is very closely related to D4859. Please see http://reviews.llvm.org/D4859 for more information.

This patch adds support for "fancy" pointers and allocators to promise and packaged_task. The changes made to support this are exactly the same as in D4859.

Test Plan: "fancy" pointer tests were added to each constructor affected by the change.

Reviewers: danalbert, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 220471

9 years ago[ARM, stack protector] If supported, use armv7 instructions.
Akira Hatanaka [Thu, 23 Oct 2014 04:17:05 +0000 (04:17 +0000)]
[ARM, stack protector] If supported, use armv7 instructions.

This commit enables using movt/movw to load the stack guard address:

movw r0, :lower16:(L_g3$non_lazy_ptr-(LPC0_0+8))
movt r0, :upper16:(L_g3$non_lazy_ptr-(LPC0_0+8))
ldr r0, [pc, r0]

Previously a pc-relative load was emitted:

ldr r0, LCPI0_0
ldr r0, [pc, r0]

rdar://problem/18740489

llvm-svn: 220470

9 years agoAdd support for "fancy" pointers to shared_ptr. Fixes PR20616
Eric Fiselier [Thu, 23 Oct 2014 04:12:28 +0000 (04:12 +0000)]
Add support for "fancy" pointers to shared_ptr. Fixes PR20616

Summary:
This patch add support for "fancy pointers/allocators" as well as fixing support for shared_pointer and "minimal" allocators.

Fancy pointers are class types that meet the NullablePointer requirements. In our case they are created by fancy allocators. `support/min_allocator.h` is an archetype for these types.

There are three types of changes made in this patch:
1. `_Alloc::template rebind<T>::other` -> `__allocator_traits_rebind<_Alloc, T>::type`. This change was made because allocators don't need a rebind template. `__allocator_traits_rebind` is used instead of `allocator_traits::rebind` because use of `allocator_traits::rebind` requires a workaround for when template aliases are unavailable.
2. `a.deallocate(this, 1)` -> `a.deallocate(pointer_traits<self>::pointer_to(*this), 1)`. This change change is made because fancy pointers aren't always constructible from raw pointers.
3. `p.get()` -> `addressof(*p.get())`. Fancy pointers aren't actually a pointer. When we need a "real" pointer we take the address of dereferencing the fancy pointer. This should give us the actual raw pointer.

Test Plan: Tests were added using `support/min_allocator.h` to each affected shared_ptr overload and creation function. These tests can only be executed in C++11 or greater since min_allocator is only available then. A extra test was added for the non-variadic versions of allocate_shared.

Reviewers: danalbert, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 220469

9 years agoAssert that ValueHandleBase::ValueIsRAUWd doesn't change the tracked Value type.
Frederic Riss [Thu, 23 Oct 2014 04:08:42 +0000 (04:08 +0000)]
Assert that ValueHandleBase::ValueIsRAUWd doesn't change the tracked Value type.

This invariant is enforced in Value::replaceAllUsesWith, thus it seems
logical to apply it also to ValueHandles. This commit fixes InstCombine
to not trigger the assertion during the removal of constant bitcasts in
call instructions.

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

llvm-svn: 220468

9 years agoModernize doxygen comments in Support/Dwarf.h
Frederic Riss [Thu, 23 Oct 2014 04:08:38 +0000 (04:08 +0000)]
Modernize doxygen comments in Support/Dwarf.h

In post-commit review of r219442, Rafael pointed out that the comment style
of the newly introduced helper didn't follow LLVM's coding standard.
Modernize the whole file to the new standards.

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

llvm-svn: 220467

9 years ago[dwarfdump] Dump DW_AT_ranges values inline in the debug_info dump.
Frederic Riss [Thu, 23 Oct 2014 04:08:34 +0000 (04:08 +0000)]
[dwarfdump] Dump DW_AT_ranges values inline in the debug_info dump.

The output looks like that:
                      DW_AT_ranges [FORM_data4]    (0x00000000
                         [0x00000001000024a0 - 0x00000001000024c2)
                         [0x0000000100002505 - 0x000000010000268b))

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

llvm-svn: 220466

9 years agoFix a couple of failing tests for C++03 by checking for rvalue reference support...
Marshall Clow [Thu, 23 Oct 2014 03:57:52 +0000 (03:57 +0000)]
Fix a couple of failing tests for C++03 by checking for rvalue reference support first.

llvm-svn: 220465

9 years ago[libcxxabi] Add support for running libc++abi tests with sanitizers
Eric Fiselier [Thu, 23 Oct 2014 03:10:43 +0000 (03:10 +0000)]
[libcxxabi] Add support for running libc++abi tests with sanitizers

Summary: Add support for LLVM_USE_SANITIZER to the libc++abi tests. Currently, if libc++abi is configured with LLVM_USE_SANITIZER then none of the tests will pass.

Reviewers: jroelofs, mclow.lists, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

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

llvm-svn: 220464

9 years agoAdd -ldl to libc++ tests when sanitizers are used.
Eric Fiselier [Thu, 23 Oct 2014 02:54:15 +0000 (02:54 +0000)]
Add -ldl to libc++ tests when sanitizers are used.

Clang 3.6 no longer links the sanitizer runtime library dependancies when
-nodefaultlibs is used. This patch manually links in a missing dependancy.

llvm-svn: 220463

9 years agoAdd llvm-go tool.
Peter Collingbourne [Thu, 23 Oct 2014 02:33:23 +0000 (02:33 +0000)]
Add llvm-go tool.

This tool lets us build LLVM components within the tree by setting up a
$GOPATH that resembles a tree fetched in the normal way with "go get".

It is intended that components such as the Go frontend will be built in-tree
using this tool.

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

llvm-svn: 220462

9 years agoRevert accidentally-committed files in r220460.
Richard Smith [Thu, 23 Oct 2014 02:02:31 +0000 (02:02 +0000)]
Revert accidentally-committed files in r220460.

llvm-svn: 220461

9 years agoRefactor implementation of 'exclude header'.
Richard Smith [Thu, 23 Oct 2014 02:01:19 +0000 (02:01 +0000)]
Refactor implementation of 'exclude header'.

This was not a real header role, and was never exposed to clients of ModuleMap.
Remove the enumeration value for it and track it as marking the header as
'known' rather than creating an extra KnownHeader entry that *every single*
client ignores.

llvm-svn: 220460

9 years ago[msan] Emit checks for constant shadow values under an experimental flag.
Evgeniy Stepanov [Thu, 23 Oct 2014 01:05:46 +0000 (01:05 +0000)]
[msan] Emit checks for constant shadow values under an experimental flag.

Does not change the default behavior.

llvm-svn: 220457

9 years agoFix covered-switch warning.
Richard Smith [Thu, 23 Oct 2014 01:03:45 +0000 (01:03 +0000)]
Fix covered-switch warning.

llvm-svn: 220456

9 years agoRevert r218541 - Don't link in sanitizer runtimes if -nostdlib/-nodefaultlibs is...
Alexey Samsonov [Thu, 23 Oct 2014 00:46:10 +0000 (00:46 +0000)]
Revert r218541 - Don't link in sanitizer runtimes if -nostdlib/-nodefaultlibs is provided.

This is a sad thing to do, but all the alternatives look ugly.

Looks like there are legitimate cases when users may want to link
with sanitizer runtimes *and* -nodefaultlibs (and ensure they provide
replacements for system libraries). For example, this happens in libc++
test suite.

"-nodefaultlibs" is told to link only the libraries explicitly provided
by the user, and providing "-fsanitize=address" is a clear indication of
intention to link with ASan runtime.
We can't easily introduce analogue of "-print-libgcc-name": linking with
sanitizers runtimes is not trivial: some runtimes are split into several
archive libraries, which are required to be wrapped in
-whole-archive/-no-whole-archive.

If "-fsanitize=whatever" and "-nodefaultlibs" are provided, system library
dependencies of sanitizer runtimes (-lc/-ldl/-lpthread/-lrt) will *not* be
linked, and user would have to link them in manually. Note that this can
cause problems, as failing to provide "-lrt" might lead to crashes in runtime
during ASan initialization. But looks like we should bite this bullet.

See r218541 review thread for the discussion.

llvm-svn: 220455

9 years ago[DebugInfo] Sink DwarfDebug::addCurrentFnArgument down into DwarfFile.
David Blaikie [Thu, 23 Oct 2014 00:16:05 +0000 (00:16 +0000)]
[DebugInfo] Sink DwarfDebug::addCurrentFnArgument down into DwarfFile.

Variable handling will be sunk into DwarfFile so that abstract variables
and the like can be shared across multiple CUs (to handle cross-CU
inlining, for example).

llvm-svn: 220453

9 years ago[DebugInfo] Add DwarfDebug& to DwarfFile.
David Blaikie [Thu, 23 Oct 2014 00:16:03 +0000 (00:16 +0000)]
[DebugInfo] Add DwarfDebug& to DwarfFile.

Use the DwarfDebug in one function that previously took it as a
parameter, and lay the foundation for use this for other operations
coming soon.

llvm-svn: 220452

9 years ago[DebugInfo] Remove LexicalScopes::isCurrentFunctionScope and CSE a use of LexicalScop...
David Blaikie [Thu, 23 Oct 2014 00:06:27 +0000 (00:06 +0000)]
[DebugInfo] Remove LexicalScopes::isCurrentFunctionScope and CSE a use of LexicalScopes::getCurrentFunctionScope

Now that we're sure the only root (non-abstract) scope is the current
function scope, there's no need for isCurrentFunctionScope, the property
can be tested directly instead.

llvm-svn: 220451

9 years agoUpdate the documentation for API change to CreateASTConsumer the rest of the way.
Nick Lewycky [Wed, 22 Oct 2014 23:57:14 +0000 (23:57 +0000)]
Update the documentation for API change to CreateASTConsumer the rest of the way.

llvm-svn: 220450

9 years agoTest files I forgot to svn add in r220448.
Richard Smith [Wed, 22 Oct 2014 23:52:04 +0000 (23:52 +0000)]
Test files I forgot to svn add in r220448.

llvm-svn: 220449

9 years ago[modules] Add support for 'textual header' directives.
Richard Smith [Wed, 22 Oct 2014 23:50:56 +0000 (23:50 +0000)]
[modules] Add support for 'textual header' directives.

This allows a module to specify that it logically contains a file, but that
said file is non-modular and intended for textual inclusion. This allows
layering checks to work properly in the presence of such files.

llvm-svn: 220448