platform/upstream/llvm.git
8 years agoOptionally demote fatal errors to non-fatal errors.
Manuel Klimek [Tue, 1 Mar 2016 10:56:19 +0000 (10:56 +0000)]
Optionally demote fatal errors to non-fatal errors.

This behavior is enabled when the new CXTranslationUnit_KeepGoing
option is passed to clang_parseTranslationUnit{,2}. It is geared
towards use by IDEs and similar consumers of the clang-c API where
fatal errors may arise when parsing incomplete code mid-edit, or
when include paths are not properly configured yet. In such situations
one still wants to get as much information as possible about a TU.
Previously, the semantic analysis would not instantiate templates
or report additional fatal errors after the first fatal error was
encountered.

Fixes PR24268.

Patch by Milian Wolff.

llvm-svn: 262318

8 years ago[MC][YAML] Rangify the loop. NFC
Simon Atanasyan [Tue, 1 Mar 2016 10:11:27 +0000 (10:11 +0000)]
[MC][YAML] Rangify the loop. NFC

llvm-svn: 262317

8 years ago[mips] Promote the result of SETCC nodes to GPR width.
Vasileios Kalintiris [Tue, 1 Mar 2016 10:08:01 +0000 (10:08 +0000)]
[mips] Promote the result of SETCC nodes to GPR width.

Summary:
This patch modifies the existing comparison, branch, conditional-move
and select patterns, and adds new ones where needed. Also, the updated
SLT{u,i,iu} set of instructions generate a GPR width result.

The majority of the code changes in the Mips back-end fix the wrong
assumption that the result of SETCC nodes always produce an i32 value.
The changes in the common code path account for the fact that in 64-bit
MIPS targets, i1 is promoted to i32 instead of i64.

Reviewers: dsanders

Subscribers: dsanders, llvm-commits

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

llvm-svn: 262316

8 years ago[ELF] use of already declared reference instead of indirect access to fields. NFC.
George Rimar [Tue, 1 Mar 2016 08:46:03 +0000 (08:46 +0000)]
[ELF] use of already declared reference instead of indirect access to fields. NFC.

llvm-svn: 262315

8 years ago[TableGen] AsmMatcher: Skip optional operands in the midle of instruction if it is...
Nikolay Haustov [Tue, 1 Mar 2016 08:34:43 +0000 (08:34 +0000)]
[TableGen] AsmMatcher: Skip optional operands in the midle of instruction if it is not present

Previosy, if actual instruction have one of optional operands then other optional operands listed before this also should be presented.
For example instruction v_fract_f32 v0, v1, mul:2 have one optional operand - OMod and do not have optional operand clamp. Previously this was not allowed because clamp is listed before omod in AsmString:

string AsmString = "v_fract_f32$vdst, $src0_modifiers$clamp$omod";
Making this work required some hacks (both OMod and Clamp match classes have same PredicateMethod).

Now, if MatchInstructionImpl meets formal optional operand that is not presented in actual instruction it skips this formal operand and tries to match current actual operand with next formal.

Patch by: Sam Kolton

Review: http://reviews.llvm.org/D17568

[AMDGPU] Assembler: Check immediate types for several optional operands in predicate methods
With this change you should place optional operands in order specified by asm string:

clamp -> omod
offset -> glc -> slc -> tfe
Fixes for several tests.
Depends on D17568

Patch by: Sam Kolton

Review: http://reviews.llvm.org/D17644
llvm-svn: 262314

8 years agoAsmParser: Fix nested .irp/.irpc
Nikolay Haustov [Tue, 1 Mar 2016 08:18:28 +0000 (08:18 +0000)]
AsmParser: Fix nested .irp/.irpc

Count .irp/.irpc in parseMacroLikeBody similar to .rept
Update tests.

Review: http://reviews.llvm.org/D17707
llvm-svn: 262313

8 years ago[X86] Centralize the masking of TSFlags with FormMask into a variable earlier so...
Craig Topper [Tue, 1 Mar 2016 07:15:59 +0000 (07:15 +0000)]
[X86] Centralize the masking of TSFlags with FormMask into a variable earlier so we can stop masking in multiple places. NFC

llvm-svn: 262312

8 years agoTest template instantiation of ns_consumed and ns_returns_retained.
John McCall [Tue, 1 Mar 2016 06:54:30 +0000 (06:54 +0000)]
Test template instantiation of ns_consumed and ns_returns_retained.

llvm-svn: 262311

8 years ago[X86] Localize a temporary variable into the cases its need in. NFC
Craig Topper [Tue, 1 Mar 2016 06:42:48 +0000 (06:42 +0000)]
[X86] Localize a temporary variable into the cases its need in. NFC

llvm-svn: 262310

8 years ago[X86] Be consistent about using pre/post increment/decrement in nearby code. NFC
Craig Topper [Tue, 1 Mar 2016 06:42:46 +0000 (06:42 +0000)]
[X86] Be consistent about using pre/post increment/decrement in nearby code. NFC

llvm-svn: 262309

8 years agoBetter comments for ExtParameterInfo.
John McCall [Tue, 1 Mar 2016 06:27:40 +0000 (06:27 +0000)]
Better comments for ExtParameterInfo.

llvm-svn: 262308

8 years ago[Compiler-rt][MIPS] Correct Dynamic Thread Vector offset for MIPS
Mohit K. Bhakkad [Tue, 1 Mar 2016 05:56:33 +0000 (05:56 +0000)]
[Compiler-rt][MIPS] Correct Dynamic Thread Vector offset for MIPS

Reviewers: samsonov

Subscribers: dsanders, jaydeep, sagar, llvm-commits

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

llvm-svn: 262303

8 years ago[Compiler-rt][MSan] fix param_tls_limit test for platforms where big arguments are...
Mohit K. Bhakkad [Tue, 1 Mar 2016 05:53:30 +0000 (05:53 +0000)]
[Compiler-rt][MSan] fix param_tls_limit test for platforms where big arguments are sliced in smaller ones

Reviewers: eugenis

Subscribers: dsanders, jaydeep, sagar, llvm-commits

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

llvm-svn: 262302

8 years ago[X86] Combine some initialization code with variable declaration and comments. NFC
Craig Topper [Tue, 1 Mar 2016 05:42:16 +0000 (05:42 +0000)]
[X86] Combine some initialization code with variable declaration and comments. NFC

llvm-svn: 262301

8 years agoUpdate the on-device arm specific code to match the API changes
Jason Molenda [Tue, 1 Mar 2016 05:34:05 +0000 (05:34 +0000)]
Update the on-device arm specific code to match the API changes
that happened in other parts of this file so it builds cleanly
for arm again.

llvm-svn: 262300

8 years agoLegalizeDAG: Use correct ptr type when expanding unaligned load/store
Matt Arsenault [Tue, 1 Mar 2016 05:13:35 +0000 (05:13 +0000)]
LegalizeDAG: Use correct ptr type when expanding unaligned load/store

This fixes regressions exposed in existing AMDGPU tests in a
future commit when all loads are custom lowered.

llvm-svn: 262299

8 years agoAMDGPU: Don't emit build_pair during udivrem legalization
Matt Arsenault [Tue, 1 Mar 2016 05:06:05 +0000 (05:06 +0000)]
AMDGPU: Don't emit build_pair during udivrem legalization

Technically you aren't supposed to emit these after type legalization
for some reason, and we use vector extracts of bitcasted integers
as the canonical way to do this.

llvm-svn: 262298

8 years agoAMDGPU: Don't use estimated stack size when we know the real stack size
Matt Arsenault [Tue, 1 Mar 2016 04:58:20 +0000 (04:58 +0000)]
AMDGPU: Don't use estimated stack size when we know the real stack size

llvm-svn: 262297

8 years agoAMDGPU: Set HasExtractBitInsn
Matt Arsenault [Tue, 1 Mar 2016 04:58:17 +0000 (04:58 +0000)]
AMDGPU: Set HasExtractBitInsn

This currently does not have the control over the bitwidth,
and there are missing optimizations to reduce the integer to
32-bit if it can be.

But in most situations we do want the sinking to occur.

llvm-svn: 262296

8 years ago[test] After r262290 reducing stack usage, try re-enabling asan on the related test.
Argyrios Kyrtzidis [Tue, 1 Mar 2016 04:40:20 +0000 (04:40 +0000)]
[test] After r262290 reducing stack usage, try re-enabling asan on the related test.

llvm-svn: 262295

8 years ago[WinEH] Allocate the registration node before the catch objects
David Majnemer [Tue, 1 Mar 2016 04:30:16 +0000 (04:30 +0000)]
[WinEH] Allocate the registration node before the catch objects

The CatchObjOffset is relative to the end of the EH registration node
for 32-bit x86 WinEH targets.  A special sentinel value, 0, is used to
indicate that no catch object should be initialized.

This means that a catch object allocated immediately before the
registration node would be assigned a CatchObjOffset of 0, leading the
runtime to believe that a catch object should not be initialized.

To handle this, allocate the registration node prior to any other frame
object.  This will ensure that catch objects will not be allocated
before the registration node.

This fixes PR26757.

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

llvm-svn: 262294

8 years agoclang-format: Correctly apply wrap before multi-line RHS rule to
Daniel Jasper [Tue, 1 Mar 2016 04:19:59 +0000 (04:19 +0000)]
clang-format: Correctly apply wrap before multi-line RHS rule to
ternary expressions.

Before:
  return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ? aaaaa : bbbbbbbbbbbbbbb +
     cccccccccccccccc;

After:
  return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ?
     aaaaa :
     bbbbbbbbbbbbbbb + cccccccccccccccc;

llvm-svn: 262293

8 years agoclang-format: Increase the penalty for breaking between array subscripts.
Daniel Jasper [Tue, 1 Mar 2016 04:19:55 +0000 (04:19 +0000)]
clang-format: Increase the penalty for breaking between array subscripts.

Before:
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaaaaaaaaaaaa]
                                    [a].aaaaaaaaaaaaaaaaaaaaaa();

After:
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaaaaaaaaaaaa][a]
      .aaaaaaaaaaaaaaaaaaaaaa();

llvm-svn: 262292

8 years agoclang-format: [JS] Support quoted object literal keys.
Daniel Jasper [Tue, 1 Mar 2016 04:19:47 +0000 (04:19 +0000)]
clang-format: [JS] Support quoted object literal keys.

Before:
  var x = {
    a: a,
    b: b, 'c': c,
  };

After:
  var x = {
    a: a,
    b: b,
    'c': c,
  };

llvm-svn: 262291

8 years ago[index] Fix issue where data visitation was disabled with C++ operator call expressio...
Argyrios Kyrtzidis [Tue, 1 Mar 2016 02:46:32 +0000 (02:46 +0000)]
[index] Fix issue where data visitation was disabled with C++ operator call expressions, during indexing.

llvm-svn: 262290

8 years agoFix the template instantiation of ExtParameterInfos; tests to follow.
John McCall [Tue, 1 Mar 2016 02:09:25 +0000 (02:09 +0000)]
Fix the template instantiation of ExtParameterInfos; tests to follow.

llvm-svn: 262289

8 years agoAdd an llvm_unreachable back to the autogeneration of this covered switch.
John McCall [Tue, 1 Mar 2016 02:09:20 +0000 (02:09 +0000)]
Add an llvm_unreachable back to the autogeneration of this covered switch.

llvm-svn: 262288

8 years agoFix MSVC build failure in source/Target/Process.cpp.
Eugene Zelenko [Tue, 1 Mar 2016 02:08:37 +0000 (02:08 +0000)]
Fix MSVC build failure in source/Target/Process.cpp.

Will be good idea to introduce macro/constexpr for NULL thread_result_t.

llvm-svn: 262287

8 years agoFix the testcase in r262282
Steven Wu [Tue, 1 Mar 2016 01:24:54 +0000 (01:24 +0000)]
Fix the testcase in r262282

-bitcode_bundle is only passed to the darwin ld64 linker and it is only
implemented there. Remove the check on the linker flag.

llvm-svn: 262286

8 years agoMake test more robust.
Sean Silva [Tue, 1 Mar 2016 01:20:15 +0000 (01:20 +0000)]
Make test more robust.

Really all these tests are checking is that we find a file path. The
behavior when we don't find one will have `"ps4-ld"` in it. We just need
a path separator to know that a path has been found.

The root cause of the flakiness of these tests is the same on Windows
and non-Windows: setting the PATH environment variable is not sufficient
to guarantee that a particular path is looked up first.
Driver::GetProgramPath checks some paths before deferring to PATH
(in particular, the directory containing the clang binary itself).

I initally ran into this on Windows when putting a PS4 linker in
build-dir/bin/ps4-ld for testing.
After digging for a while thinking that it was some windows path search
oddity (the Windows SearchPathW documentation indicates that its
behavior varies depending on a registry setting...).
I eventually tried reproducing the issue on Mac and to my surprise found
the same issue.
Ultimately I traced it down to the extra lookups in
Driver::GetProgramPath.

llvm-svn: 262285

8 years ago[Verifier] Diagnose when unwinding out of cycles of blocks
David Majnemer [Tue, 1 Mar 2016 01:19:05 +0000 (01:19 +0000)]
[Verifier] Diagnose when unwinding out of cycles of blocks

Generally speaking, this can only happen with unreachable code.
However, neglecting to check for this condition would lead us to loop
forever.

llvm-svn: 262284

8 years ago[asan] Retry failed adb commands in android tests.
Evgeniy Stepanov [Tue, 1 Mar 2016 01:16:03 +0000 (01:16 +0000)]
[asan] Retry failed adb commands in android tests.

Add limited retries for push/pull adb commands in android tests.
May help with the adb flakiness.

llvm-svn: 262283

8 years agoIntroduce -fembed-bitcode driver option
Steven Wu [Tue, 1 Mar 2016 01:07:58 +0000 (01:07 +0000)]
Introduce -fembed-bitcode driver option

Summary:
This is the clang driver part of the change to embedded bitcode. This
includes:
1. -fembed-bitcode option which breaks down the compilation into two
stages. The first stage emits optimized bitcode and the second stage
compiles bitcode into object file.
2. -fembed-bitcode-marker option which doesn't really break down to
two stages to speedup the compilation flow.
3. pass the correct linker flag to darwin linker if tool chains supports
embedded bitcode.

Reviewers: rsmith, thakis

Subscribers: thakis, cfe-commits

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

llvm-svn: 262282

8 years agoFix Clang-tidy modernize-use-nullptr warnings in some files in source/Target/Process...
Eugene Zelenko [Tue, 1 Mar 2016 00:55:51 +0000 (00:55 +0000)]
Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Target/Process.cpp; other minor fixes.

llvm-svn: 262281

8 years ago[LLE] Add testcase for the fix in r262267
Adam Nemet [Tue, 1 Mar 2016 00:50:14 +0000 (00:50 +0000)]
[LLE] Add testcase for the fix in r262267

llvm-svn: 262280

8 years ago[LAA] Add missing debug output
Adam Nemet [Tue, 1 Mar 2016 00:50:08 +0000 (00:50 +0000)]
[LAA] Add missing debug output

llvm-svn: 262279

8 years agoGeneralize the consumed-parameter array on FunctionProtoType
John McCall [Tue, 1 Mar 2016 00:49:02 +0000 (00:49 +0000)]
Generalize the consumed-parameter array on FunctionProtoType
to allow arbitrary data to be associated with a parameter.

Also, fix a bug where we apparently haven't been serializing
this information for the last N years.

llvm-svn: 262278

8 years ago[analyzer] Update CheckObjCDealloc diagnostic for missing -dealloc.
Devin Coughlin [Tue, 1 Mar 2016 00:39:04 +0000 (00:39 +0000)]
[analyzer] Update CheckObjCDealloc diagnostic for missing -dealloc.

Update the diagnostic for classes missing -dealloc to mention an instance
variable that needs to be released.

llvm-svn: 262277

8 years ago[asan] Fix new[]/delete mismatch in tests.
Evgeniy Stepanov [Tue, 1 Mar 2016 00:38:39 +0000 (00:38 +0000)]
[asan] Fix new[]/delete mismatch in tests.

This code is actually never executed because all RUN lines trigger an
earlier heap-use-after-free, but there is still a compiler warning.

llvm-svn: 262276

8 years agoInfrastructure improvements to Clang attribute TableGen.
John McCall [Tue, 1 Mar 2016 00:18:05 +0000 (00:18 +0000)]
Infrastructure improvements to Clang attribute TableGen.

This should make it easier to add new Attr subclasses.

llvm-svn: 262275

8 years ago[x86, InstCombine] transform more x86 masked loads to LLVM intrinsics
Sanjay Patel [Mon, 29 Feb 2016 23:59:00 +0000 (23:59 +0000)]
[x86, InstCombine] transform more x86 masked loads to LLVM intrinsics

Continuation of:
http://reviews.llvm.org/rL262269

llvm-svn: 262273

8 years ago[analyzer] Teach CheckObjCDealloc about Block_release().
Devin Coughlin [Mon, 29 Feb 2016 23:57:10 +0000 (23:57 +0000)]
[analyzer] Teach CheckObjCDealloc about Block_release().

It now treats Block_release(b) as a release in addition to [b release].

llvm-svn: 262272

8 years agoWhen 'help' cannot find a command, produce additional help text that also points...
Enrico Granata [Mon, 29 Feb 2016 23:22:53 +0000 (23:22 +0000)]
When 'help' cannot find a command, produce additional help text that also points the user to the apropos and type lookup commands

This is useful in cases such as, e.g.

(lldb) help NSString
(the user meant type lookup)

or

(lldb) help kill
(the user is looking for process kill)

Fixes rdar://24868537

llvm-svn: 262271

8 years ago[LLE] Fix a comment
Adam Nemet [Mon, 29 Feb 2016 23:21:12 +0000 (23:21 +0000)]
[LLE] Fix a comment

llvm-svn: 262270

8 years ago[x86, InstCombine] transform x86 AVX masked loads to LLVM intrinsics
Sanjay Patel [Mon, 29 Feb 2016 23:16:48 +0000 (23:16 +0000)]
[x86, InstCombine] transform x86 AVX masked loads to LLVM intrinsics

The intended effect of this patch in conjunction with:
http://reviews.llvm.org/rL259392
http://reviews.llvm.org/rL260145

is that customers using the AVX intrinsics in C will benefit from combines when
the load mask is constant:

__m128 mload_zeros(float *f) {
  return _mm_maskload_ps(f, _mm_set1_epi32(0));
}

__m128 mload_fakeones(float *f) {
  return _mm_maskload_ps(f, _mm_set1_epi32(1));
}

__m128 mload_ones(float *f) {
  return _mm_maskload_ps(f, _mm_set1_epi32(0x80000000));
}

__m128 mload_oneset(float *f) {
  return _mm_maskload_ps(f, _mm_set_epi32(0x80000000, 0, 0, 0));
}

...so none of the above will actually generate a masked load for optimized code.

This is the masked load counterpart to:
http://reviews.llvm.org/rL262064

llvm-svn: 262269

8 years ago[Verifier] Handle more funclet edge cases
David Majnemer [Mon, 29 Feb 2016 22:56:36 +0000 (22:56 +0000)]
[Verifier] Handle more funclet edge cases

This change makes the verifier a little more paranoid.  It was possible
to trick the verifier into crashing or infinite looping.

llvm-svn: 262268

8 years ago[LLE] Fix SingleSource/Benchmarks/Polybench/stencils/jacobi-2d-imper with Polly
Adam Nemet [Mon, 29 Feb 2016 22:53:59 +0000 (22:53 +0000)]
[LLE] Fix SingleSource/Benchmarks/Polybench/stencils/jacobi-2d-imper with Polly

We can actually have dependences between accesses with different
underlying types.  Bail in this case.

A test will follow shortly.

llvm-svn: 262267

8 years agoSimplify some boolean conditional return statements in AArch64.
Eric Christopher [Mon, 29 Feb 2016 22:50:49 +0000 (22:50 +0000)]
Simplify some boolean conditional return statements in AArch64.

http://reviews.llvm.org/D9979

Patch by Richard Thomson (and some conflict resolution by me).

llvm-svn: 262266

8 years agoImprove the debug output of DwarfDebug::buildLocationList().
Adrian Prantl [Mon, 29 Feb 2016 22:28:22 +0000 (22:28 +0000)]
Improve the debug output of DwarfDebug::buildLocationList().

llvm-svn: 262265

8 years agoDocument an anomaly in this testcase.
Adrian Prantl [Mon, 29 Feb 2016 22:28:16 +0000 (22:28 +0000)]
Document an anomaly in this testcase.

llvm-svn: 262264

8 years agoReapply r262092: [FileCheck] Abort if -NOT is combined with another suffix.
Paul Robinson [Mon, 29 Feb 2016 22:13:03 +0000 (22:13 +0000)]
Reapply r262092: [FileCheck] Abort if -NOT is combined with another suffix.
Combinations of suffixes that look useful are actually ignored;
complaining about them will avoid mistakes.

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

llvm-svn: 262263

8 years ago[Verifier] Minor fix to error message; NFC
Sanjoy Das [Mon, 29 Feb 2016 22:04:25 +0000 (22:04 +0000)]
[Verifier] Minor fix to error message; NFC

llvm-svn: 262262

8 years ago[analyzer] Don't treat calls to system headers as escaping in CheckObjCDealloc.
Devin Coughlin [Mon, 29 Feb 2016 21:44:08 +0000 (21:44 +0000)]
[analyzer] Don't treat calls to system headers as escaping in CheckObjCDealloc.

This prevents false negatives when a -dealloc method, for example, removes itself as
as an observer with [[NSNotificationCenter defaultCenter] removeObserver:self]. It is
unlikely that passing 'self' to a system header method will release 'self''s instance
variables, so this is unlikely to produce false positives.

A challenge here is that while CheckObjCDealloc no longer treats these calls as
escaping, the rest of the analyzer still does. In particular, this means that loads
from the same instance variable before and after a call to a system header will
result in different symbols being loaded by the region store. To account for this,
the checker now treats different ivar symbols with the same instance and ivar decl as
the same for the purpose of release checking and more eagerly removes a release
requirement when an instance variable is assumed to be nil. This was not needed before
because when an ivar escaped its release requirement was always removed -- now the
requirement is not removed for calls to system headers.

llvm-svn: 262261

8 years agoFix a typo in my previous commit. This would cause mutable NSArrays to show up empty
Enrico Granata [Mon, 29 Feb 2016 21:41:19 +0000 (21:41 +0000)]
Fix a typo in my previous commit. This would cause mutable NSArrays to show up empty

llvm-svn: 262260

8 years agoChange the user-visible name for the argument type language to source-language
Enrico Granata [Mon, 29 Feb 2016 21:37:01 +0000 (21:37 +0000)]
Change the user-visible name for the argument type language to source-language

This makes it so that help language provides help on the language command and help source-language provides the list of source languages one can pass as an option

Fixes rdar://24869942

llvm-svn: 262259

8 years ago[Hexagon] As a size optimization, not lazy extending TPREL or DTPREL variants since...
Colin LeMahieu [Mon, 29 Feb 2016 21:21:56 +0000 (21:21 +0000)]
[Hexagon] As a size optimization, not lazy extending TPREL or DTPREL variants since they're usually in range.

llvm-svn: 262258

8 years agoIdentifierNamingCheck.cpp: try to fix MSVC build
Hans Wennborg [Mon, 29 Feb 2016 21:17:39 +0000 (21:17 +0000)]
IdentifierNamingCheck.cpp: try to fix MSVC build

It was failing to build with:

clang-tidy\readability\IdentifierNamingCheck.cpp(640):
error C2882: 'format' : illegal use of namespace identifier in expression

llvm-svn: 262257

8 years agoNFC: Refactor ProcessWinMiniDump to use a more traditional pimpl idiom.
Adrian McCarthy [Mon, 29 Feb 2016 21:15:23 +0000 (21:15 +0000)]
NFC:  Refactor ProcessWinMiniDump to use a more traditional pimpl idiom.

This is a mechanical refactor.  There should be no functional changes in this commit.

Instead of encapsulating just the Windows-specific data, ProcessWinMiniDump now uses a private implementation class.  This reduces indirections (in the source).  It makes it easier to add private helper methods without touching the header and allows them to have platform-specific types as parameters.  The only trick was that the pimpl class needed a back pointer in order to call a couple methods.

llvm-svn: 262256

8 years agoFix TestInlines.py on Windows
Adrian McCarthy [Mon, 29 Feb 2016 21:13:29 +0000 (21:13 +0000)]
Fix TestInlines.py on Windows

The inlining semantics for C and C++ are different, which affects the test's expectation of the number of times the function should appear in the binary.  In the case of this test, C semantics means there should be three instances of inner_inline, while C++ semantics means there should be only two.

On Windows, clang uses C++ inline semantics even for C code, and there doesn't seem to be a combination of compiler flags to avoid this.

So, for consistency, I've recast the test to use C++ everywhere.  Since the test resided under lang/c, it seemed appropriate to move it to lang/cpp.

This does not address the other XFAIL for this test on Linux/gcc.  See https://llvm.org/bugs/show_bug.cgi?id=26710

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

llvm-svn: 262255

8 years agoAdd an LLDB data formatter for single-element NSArray and NSDictionary Cocoa containers
Enrico Granata [Mon, 29 Feb 2016 21:06:50 +0000 (21:06 +0000)]
Add an LLDB data formatter for single-element NSArray and NSDictionary Cocoa containers

Fixes rdar://23715118

llvm-svn: 262254

8 years ago[Hexagon] Missed member initialization causing ubsan failure.
Colin LeMahieu [Mon, 29 Feb 2016 20:42:25 +0000 (20:42 +0000)]
[Hexagon] Missed member initialization causing ubsan failure.

llvm-svn: 262252

8 years agoAvoid use of -fsanitize=vptr in MSVC env, it is not yet supported
Reid Kleckner [Mon, 29 Feb 2016 20:38:35 +0000 (20:38 +0000)]
Avoid use of -fsanitize=vptr in MSVC env, it is not yet supported

llvm-svn: 262251

8 years agoEnable LoopLoadElimination by default
Adam Nemet [Mon, 29 Feb 2016 20:35:11 +0000 (20:35 +0000)]
Enable LoopLoadElimination by default

Summary:
I re-benchmarked this and results are similar to original results in
D13259:

On ARM64:
  SingleSource/Benchmarks/Polybench/linear-algebra/solvers/dynprog -59.27%
  SingleSource/Benchmarks/Polybench/stencils/adi                   -19.78%

On x86:
  SingleSource/Benchmarks/Polybench/linear-algebra/solvers/dynprog  -27.14%

And of course the original ~20% gain on SPECint_2006/456.hmmer with Loop
Distribution.

In terms of compile time, there is ~5% increase on both
SingleSource/Benchmarks/Misc/oourafft and
SingleSource/Benchmarks/Linkpack/linkpack-pc.  These are both very tiny
loop-intensive programs where SCEV computations dominates compile time.

The reason that time spent in SCEV increases has to do with the design
of the old pass manager.  If a transform pass does not preserve an
analysis we *invalidate* the analysis even if there was *no*
modification made by the transform pass.

This means that currently we don't take advantage of LLE and LV sharing
the same analysis (LAA) and unfortunately we recompute LAA *and* SCEV
for LLE.

(There should be a way to work around this limitation in the case of
SCEV and LAA since both compute things on demand and internally cache
their result.  Thus we could pretend that transform passes preserve
these analyses and manually invalidate them upon actual modification.
On the other hand the new pass manager is supposed to solve so I am not
sure if this is worthwhile.)

Reviewers: hfinkel, dberlin

Subscribers: dberlin, reames, mssimpso, aemerson, joker.eph, llvm-commits

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

llvm-svn: 262250

8 years agoFixup MIPS testcase after r262247 and make it a little more robust.
Adrian Prantl [Mon, 29 Feb 2016 20:25:10 +0000 (20:25 +0000)]
Fixup MIPS testcase after r262247 and make it a little more robust.

llvm-svn: 262249

8 years ago[AArch64] Fix isLegalAddImmediate() to return true for valid negative values.
Geoff Berry [Mon, 29 Feb 2016 19:53:22 +0000 (19:53 +0000)]
[AArch64] Fix isLegalAddImmediate() to return true for valid negative values.

Reviewers: t.p.northover, jmolloy

Subscribers: mcrosier, aemerson, llvm-commits, rengolin

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

llvm-svn: 262248

8 years agoFix PR26585 by improving the promotion of DBG_VALUEs to DW_AT_locations.
Adrian Prantl [Mon, 29 Feb 2016 19:49:46 +0000 (19:49 +0000)]
Fix PR26585 by improving the promotion of DBG_VALUEs to DW_AT_locations.
When a variable is described by a single DBG_VALUE instruction we can
often use a more efficient inline DW_AT_location instead of using a
location list.

This commit makes the heuristic that decides when to apply this
optimization stricter by also verifying that the DBG_VALUE is live at the
entry of the function (instead of just checking that it is valid until
the end of the function).

<rdar://problem/24611008>

llvm-svn: 262247

8 years agoFix Clang-tidy modernize-use-nullptr warnings in source/Plugins/Language; other minor...
Eugene Zelenko [Mon, 29 Feb 2016 19:41:30 +0000 (19:41 +0000)]
Fix Clang-tidy modernize-use-nullptr warnings in source/Plugins/Language; other minor fixes.

llvm-svn: 262246

8 years agoRename embedded bitcode section in MachO
Steven Wu [Mon, 29 Feb 2016 19:40:10 +0000 (19:40 +0000)]
Rename embedded bitcode section in MachO

Summary:
Rename the section embeds bitcode from ".llvmbc,.llvmbc" to "__LLVM,__bitcode".
The new name matches MachO section naming convention.

Reviewers: rafael, pcc

Subscribers: davide, llvm-commits, joker.eph

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

llvm-svn: 262245

8 years ago[X86] Move the ATOMIC_LOAD_OP ISel from DAGToDAG to ISelLowering. NFCI.
Ahmed Bougacha [Mon, 29 Feb 2016 19:28:07 +0000 (19:28 +0000)]
[X86] Move the ATOMIC_LOAD_OP ISel from DAGToDAG to ISelLowering. NFCI.

This is long-standing dirtiness, as acknowledged by r77582:

    The current trick is to select it into a merge_values with
    the first definition being an implicit_def. The proper solution is
    to add new ISD opcodes for the no-output variant.

Doing this before selection will let us combine away some constructs.

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

llvm-svn: 262244

8 years ago[Hexagon] Setting sign mismatch flag on expression instead of using bit tricks.
Colin LeMahieu [Mon, 29 Feb 2016 19:17:56 +0000 (19:17 +0000)]
[Hexagon] Setting sign mismatch flag on expression instead of using bit tricks.

llvm-svn: 262243

8 years agoMinor code cleanup. NFC
Rong Xu [Mon, 29 Feb 2016 19:16:04 +0000 (19:16 +0000)]
Minor code cleanup. NFC

llvm-svn: 262242

8 years ago[WinEH] Make setjmp work correctly with EH
David Majnemer [Mon, 29 Feb 2016 19:16:03 +0000 (19:16 +0000)]
[WinEH] Make setjmp work correctly with EH

32-bit X86 EH on Windows utilizes a stack of registration nodes
allocated and deallocated on entry/exit.  A registration node contains a
bunch of EH personality specific information like which try-state we are
currently in.

Because a setjmp target allows control flow from arbitrary program
points, there is no way to ensure that the try-state we are in is
correctly updated once we transfer control.

MSVC compatible compilers, like MSVC and ICC, utilize runtime helpers to
reinitialize the try-state when a longjmp occurs.  This is implemented
by adding additional arguments to _setjmp3: the desired try-state and
a helper routine to update the try-state.

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

llvm-svn: 262241

8 years agoMove discriminator assignment to the right place.
Dehao Chen [Mon, 29 Feb 2016 18:59:48 +0000 (18:59 +0000)]
Move discriminator assignment to the right place.

Summary: Now discriminator is assigned per-function instead of per-module.

Reviewers: davidxl, dnovillo

Subscribers: dblaikie, llvm-commits

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

llvm-svn: 262240

8 years ago[PGO] clang cc1 option change to enable IR level instrumentation
Rong Xu [Mon, 29 Feb 2016 18:54:59 +0000 (18:54 +0000)]
[PGO] clang cc1 option change to enable IR level instrumentation

This patch expands cc1 option -fprofile-instrument= with a new value: -fprofile-instrument=llvm
which enables IR level PGO instrumentation.

Reviewers: davidxl, silvas

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

llvm-svn: 262239

8 years ago[Hexagon] Using MustExtend flag on expression instead of passing around bools.
Colin LeMahieu [Mon, 29 Feb 2016 18:39:51 +0000 (18:39 +0000)]
[Hexagon] Using MustExtend flag on expression instead of passing around bools.

llvm-svn: 262238

8 years agoFix LLD tests that used CHECK-NEXT-NOT. FileCheck does not support
Paul Robinson [Mon, 29 Feb 2016 18:05:21 +0000 (18:05 +0000)]
Fix LLD tests that used CHECK-NEXT-NOT. FileCheck does not support
combined suffixes.

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

llvm-svn: 262237

8 years agofix typo in comment
Adrian Prantl [Mon, 29 Feb 2016 17:06:46 +0000 (17:06 +0000)]
fix typo in comment

llvm-svn: 262236

8 years ago[ScopDetection] Fix use-after-free.
Michael Kruse [Mon, 29 Feb 2016 16:54:18 +0000 (16:54 +0000)]
[ScopDetection] Fix use-after-free.

removeCachedResults deletes the DetectionContext from
DetectionContextMap such that any it cannot be used anymore.
Unfortunately invalid<ReportUnprofitable> and RejectLogs.insert still do
use it. Because the memory is part of a map and not returned to to the
OS immediatly, such that the observable effect was only a memory leak
due to reference counters not decreased when the second call to
removeCachedResults does not remove the DetectionContext because because
it already has been removed.

Fix by not removing the DetectionContext prematurely. The second call to
removeCachedResults will handle it anyway.

llvm-svn: 262235

8 years agoRevert "Implement new interfaces for code-formatting when applying replacements."
Manuel Klimek [Mon, 29 Feb 2016 16:44:16 +0000 (16:44 +0000)]
Revert "Implement new interfaces for code-formatting when applying replacements."

This reverts commit r262232.

llvm-svn: 262234

8 years agoFix for PR26180
Nemanja Ivanovic [Mon, 29 Feb 2016 16:42:27 +0000 (16:42 +0000)]
Fix for PR26180

Corresponds to Phabricator review:
http://reviews.llvm.org/D16592

This fix includes both an update to how we handle the "generic" CPU on LE
systems as well as Anton's fix for the Fast Isel issue.

llvm-svn: 262233

8 years agoImplement new interfaces for code-formatting when applying replacements.
Manuel Klimek [Mon, 29 Feb 2016 16:27:41 +0000 (16:27 +0000)]
Implement new interfaces for code-formatting when applying replacements.

Patch by Eric Liu.

llvm-svn: 262232

8 years ago[mips] Range check uimm20 and fixed a bug this revealed.
Daniel Sanders [Mon, 29 Feb 2016 16:06:38 +0000 (16:06 +0000)]
[mips] Range check uimm20 and fixed a bug this revealed.

Summary:
The bug was that dextu's operand 3 would print 0-31 instead of 32-63 when
printing assembly. This came up when replacing
MipsInstPrinter::printUnsignedImm() with a version that could handle arbitrary
bit widths.

MipsAsmPrinter::printUnsignedImm*() don't seem to be used so they have been
removed.

Reviewers: vkalintiris

Subscribers: dsanders, llvm-commits

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

llvm-svn: 262231

8 years ago[mips] Do not use SLL for ANY_EXTEND nodes as the high bits are undefined.
Vasileios Kalintiris [Mon, 29 Feb 2016 15:58:12 +0000 (15:58 +0000)]
[mips] Do not use SLL for ANY_EXTEND nodes as the high bits are undefined.

Reviewers: dsanders

Subscribers: dsanders, llvm-commits

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

llvm-svn: 262230

8 years ago[mips] Make isel select the correct DEXT variant up front.
Daniel Sanders [Mon, 29 Feb 2016 15:26:54 +0000 (15:26 +0000)]
[mips] Make isel select the correct DEXT variant up front.

Summary:
Previously, it would always select DEXT and substitute any invalid matches
for DEXTU/DEXTM during MipsMCCodeEmitter::encodeInstruction(). This works
but causes problems when adding range checked immediates to IAS.

Now isel selects the correct variant up front.

Reviewers: vkalintiris

Subscribers: dsanders, llvm-commits

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

llvm-svn: 262229

8 years agoAMDGPU: Add missing Volcanic Islands targets
Tom Stellard [Mon, 29 Feb 2016 15:08:56 +0000 (15:08 +0000)]
AMDGPU: Add missing Volcanic Islands targets

Reviewers: arsenm

Subscribers: cfe-commits

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

llvm-svn: 262228

8 years agoReapply "Add update_test.py script."
Michael Kruse [Mon, 29 Feb 2016 14:58:13 +0000 (14:58 +0000)]
Reapply "Add update_test.py script."

Originally committed in r261899 and reverted in r262202 due to failing
in out-of-LLVM tree builds.

Replace the use of LLVM_TOOLS_BINARY_DIR by LLVM_TOOLS_DIR which exists
in both, in-tree and out-of-tree builds.

Original commit message:
The script updates a lit test case that uses FileCheck using the actual
output of the 'RUN:'-lines program. Useful when updating test cases due
to expected output changes and diff'ing expected and actual output.

llvm-svn: 262227

8 years agolto: don't fetch members for weak undef.
Rafael Espindola [Mon, 29 Feb 2016 14:29:48 +0000 (14:29 +0000)]
lto: don't fetch members for weak undef.

llvm-svn: 262225

8 years agoRevert a part of "Add/Improve complex, vector, aggregate types handling for SysV...
Pavel Labath [Mon, 29 Feb 2016 14:26:45 +0000 (14:26 +0000)]
Revert a part of "Add/Improve complex, vector, aggregate types handling for SysV ARM (hard/soft) ABI."

This partially reverts commit r262218.

The commit added additional checks to a test case. The test case is too big so it's not feasible
to XFAIL it completely. Suggest to implement the checks as a separate test case, which can then
be XFAILed more surgically.

llvm-svn: 262223

8 years agoIRObject: Mark extern_weak as weak.
Rafael Espindola [Mon, 29 Feb 2016 14:26:06 +0000 (14:26 +0000)]
IRObject: Mark extern_weak as weak.

llvm-svn: 262222

8 years agoRemove bogus assert.
Rafael Espindola [Mon, 29 Feb 2016 13:46:39 +0000 (13:46 +0000)]
Remove bogus assert.

llvm-svn: 262219

8 years agoAdd/Improve complex, vector, aggregate types handling for SysV ARM (hard/soft) ABI.
Omair Javaid [Mon, 29 Feb 2016 13:39:20 +0000 (13:39 +0000)]
Add/Improve complex, vector, aggregate types handling for SysV ARM (hard/soft) ABI.

For details see:

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

llvm-svn: 262218

8 years agoclang-format: Don't format unrelated nested blocks.
Daniel Jasper [Mon, 29 Feb 2016 12:26:20 +0000 (12:26 +0000)]
clang-format: Don't format unrelated nested blocks.

With this change:

  SomeFunction(
      [] {
int i;
 return i;  // Format this line.
      },
      [] {
 return 2;  // Don't "fix" this.
      });

llvm-svn: 262216

8 years ago[InstSimplify] Restore fsub 0.0, (fsub 0.0, X) ==> X optzn
Benjamin Kramer [Mon, 29 Feb 2016 12:18:25 +0000 (12:18 +0000)]
[InstSimplify] Restore fsub 0.0, (fsub 0.0, X) ==> X optzn

I accidentally removed this in r262212 but there was no test coverage to
detect it.

llvm-svn: 262215

8 years agoFix compiler warnings in the java code
Pavel Labath [Mon, 29 Feb 2016 11:44:15 +0000 (11:44 +0000)]
Fix compiler warnings in the java code

llvm-svn: 262214

8 years ago[mips] Make symbols an acceptable branch target when expanding compare-to-immediate...
Daniel Sanders [Mon, 29 Feb 2016 11:24:49 +0000 (11:24 +0000)]
[mips] Make symbols an acceptable branch target when expanding compare-to-immediate-and-branch macros.

Reviewers: vkalintiris

Subscribers: llvm-commits, vkalintiris, dim, seanbruno, dsanders

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

llvm-svn: 262213

8 years ago[InstSimplify] fsub 0.0, (fsub -0.0, X) ==> X is only safe if signed zeros are ignored.
Benjamin Kramer [Mon, 29 Feb 2016 11:12:23 +0000 (11:12 +0000)]
[InstSimplify] fsub 0.0, (fsub -0.0, X) ==> X is only safe if signed zeros are ignored.

Only allow fsub -0.0, (fsub -0.0, X) ==> X without nsz. PR26746.

llvm-svn: 262212

8 years ago[test-release.sh] Add lldb to list of projects (disabled by default)
Daniel Sanders [Mon, 29 Feb 2016 11:04:39 +0000 (11:04 +0000)]
[test-release.sh] Add lldb to list of projects (disabled by default)

Reviewers: hans

Subscribers: llvm-commits

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

llvm-svn: 262211

8 years ago[asan] Fix UB in test/asan/TestCases/Linux/recvfrom.cc testcase.
Maxim Ostapenko [Mon, 29 Feb 2016 08:56:26 +0000 (08:56 +0000)]
[asan] Fix UB in test/asan/TestCases/Linux/recvfrom.cc testcase.

llvm-svn: 262210

8 years agoUpdate the link of issue
Mohit K. Bhakkad [Mon, 29 Feb 2016 08:22:55 +0000 (08:22 +0000)]
Update the link of issue

llvm-svn: 262209

8 years ago[index] Print and test module import references.
Argyrios Kyrtzidis [Mon, 29 Feb 2016 07:56:07 +0000 (07:56 +0000)]
[index] Print and test module import references.

llvm-svn: 262208