platform/upstream/llvm.git
8 years ago[sanitizer-coverage] introduce __sanitizer_get_total_unique_caller_callee_pairs
Kostya Serebryany [Thu, 22 Oct 2015 22:06:41 +0000 (22:06 +0000)]
[sanitizer-coverage] introduce __sanitizer_get_total_unique_caller_callee_pairs

llvm-svn: 251071

8 years agoMinor bug fix in Profile Name Prefix interface
Xinliang David Li [Thu, 22 Oct 2015 21:51:09 +0000 (21:51 +0000)]
Minor bug fix in Profile Name Prefix interface

Exposed in uses by clang FE.

llvm-svn: 251070

8 years ago[libFuzzer] remove the deprecated 'tokens' feature
Kostya Serebryany [Thu, 22 Oct 2015 21:48:09 +0000 (21:48 +0000)]
[libFuzzer] remove the deprecated 'tokens' feature

llvm-svn: 251069

8 years agoELF2: Keep .eh_frame even if they are not live.
Rui Ueyama [Thu, 22 Oct 2015 21:42:05 +0000 (21:42 +0000)]
ELF2: Keep .eh_frame even if they are not live.

.eh_frame sections need to be preserved if they refer to live sections.
So the liveness relation is reverse for eh_frame sections. For now,
we simply preserve all .eh_frame sections. Thanks Rafael for pointing
this out. .jcr are kept for the same reason.

llvm-svn: 251068

8 years agoLoopPass: Remove redoLoop, it isn't used. NFC
Justin Bogner [Thu, 22 Oct 2015 21:31:34 +0000 (21:31 +0000)]
LoopPass: Remove redoLoop, it isn't used. NFC

In r251064 I removed a logically unreachable call to `redoLoop`, and
now there aren't any callers of this API at all. Remove the needless
complexity.

llvm-svn: 251067

8 years agoFix Clang-tidy modernize-use-override warnings in include/lldb/Disassembler and Opera...
Eugene Zelenko [Thu, 22 Oct 2015 21:24:37 +0000 (21:24 +0000)]
Fix Clang-tidy modernize-use-override warnings in include/lldb/Disassembler and OperatingSystem; other minor fixes.

Second attempt which should work for MSVC.

llvm-svn: 251066

8 years agoDont required CMake 3 to install a linker script
Eric Fiselier [Thu, 22 Oct 2015 21:24:01 +0000 (21:24 +0000)]
Dont required CMake 3 to install a linker script

llvm-svn: 251065

8 years agoLoopPass: Simplify the API for adding a new loop. NFC
Justin Bogner [Thu, 22 Oct 2015 21:21:32 +0000 (21:21 +0000)]
LoopPass: Simplify the API for adding a new loop. NFC

The insertLoop() API is only used to add new loops, and has confusing
ownership semantics. Simplify it by replacing it with addLoop().

llvm-svn: 251064

8 years agoOnly disable linker script when LIBCXX_CXX_ABI_LIBNAME is none
Eric Fiselier [Thu, 22 Oct 2015 20:54:27 +0000 (20:54 +0000)]
Only disable linker script when LIBCXX_CXX_ABI_LIBNAME is none

llvm-svn: 251063

8 years agoDisable linker scripts when the ABI library is not specified or is none.
Eric Fiselier [Thu, 22 Oct 2015 20:50:07 +0000 (20:50 +0000)]
Disable linker scripts when the ABI library is not specified or is none.

llvm-svn: 251062

8 years ago[SimplifyCFG] Extend SimplifyResume to handle phi of trivial landing pad.
Chen Li [Thu, 22 Oct 2015 20:48:38 +0000 (20:48 +0000)]
[SimplifyCFG] Extend SimplifyResume to handle phi of trivial landing pad.

Summary: Currently SimplifyResume can convert an invoke instruction to a call instruction if its landing pad is trivial. In practice we could have several invoke instructions with trivial landing pads and share a common rethrow block, and in the common rethrow block, all the landing pads join to a phi node. The patch extends SimplifyResume to check the phi of landing pad and their incoming blocks. If any of them is trivial, remove it from the phi node and convert the invoke instruction to a call instruction.

Reviewers: hfinkel, reames

Subscribers: llvm-commits

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

llvm-svn: 251061

8 years agoPython 3 porting - Wrap returns from map() in list()
Zachary Turner [Thu, 22 Oct 2015 20:39:59 +0000 (20:39 +0000)]
Python 3 porting - Wrap returns from map() in list()

Under Python 2 this has no effect, since map() returns a list.
In Python 3 map() returns an iterable, so wrapping in a list is
necessary to keep the same semantics.

llvm-svn: 251060

8 years ago[msan] Intercept process_vm_readv/writev.
Evgeniy Stepanov [Thu, 22 Oct 2015 20:35:42 +0000 (20:35 +0000)]
[msan] Intercept process_vm_readv/writev.

llvm-svn: 251059

8 years agoAdd helper functions and remove hard coded references to instProf related name/name...
Xinliang David Li [Thu, 22 Oct 2015 20:32:12 +0000 (20:32 +0000)]
Add helper functions and remove hard coded references to instProf related name/name-prefixes

This is a clean up patch that defines instr prof section and variable
name prefixes in a common header with access helper functions.
clang FE change will be done as a follow up once this patch is in.

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

llvm-svn: 251058

8 years ago[Sink] Don't check BB.empty()
David Majnemer [Thu, 22 Oct 2015 20:29:08 +0000 (20:29 +0000)]
[Sink] Don't check BB.empty()

As an invariant, BasicBlocks cannot be empty when passed to a transform.
This is not the case for MachineBasicBlocks and the Sink pass was ported
from the MachineSink pass which would explain the check's existence.

llvm-svn: 251057

8 years ago[ASan] Enable instrumentation of dynamic allocas by default.
Alexey Samsonov [Thu, 22 Oct 2015 20:07:28 +0000 (20:07 +0000)]
[ASan] Enable instrumentation of dynamic allocas by default.

llvm-svn: 251056

8 years agoUpdate every test to import `lldb_shared`.
Zachary Turner [Thu, 22 Oct 2015 20:06:20 +0000 (20:06 +0000)]
Update every test to import `lldb_shared`.

This is necessary in order to allow third party modules to be
located under lldb/third_party rather than under the test
folder directly.

Since we're already touching every test file anyway, we also
go ahead and delete the unittest2 import and main block wherever
possible.  The ability to run a test as a standalone file has
already been broken for some time, and if we decide we want this
back, we should use unittest instead of unittest2.

A few places could not have the import of unittest2 removed,because
they depend on the unittest2.expectedFailure or skip decorators.
Removing all those was orthogonal in spirit to the purpose of this
CL, so the import of unittest2 remains in those files that were
using it for its test decorators.  Those can be addressed
separately.

llvm-svn: 251055

8 years agoFix Clang-tidy modernize-use-override warnings in some files in include/lldb/Interpre...
Eugene Zelenko [Thu, 22 Oct 2015 19:59:21 +0000 (19:59 +0000)]
Fix Clang-tidy modernize-use-override warnings in some files in include/lldb/Interpreter and Host; other minor fixes.

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

llvm-svn: 251054

8 years ago[SCEV] Remove a test case added in r249168
Sanjoy Das [Thu, 22 Oct 2015 19:57:41 +0000 (19:57 +0000)]
[SCEV] Remove a test case added in r249168

The test case wasn't testing what it was commented to be testing; and
when I tried to fix the test I noticed that SCEV does not support the
simplification that the test was supposed to test.

This change removes the test case to avoid confusion.

llvm-svn: 251053

8 years ago[SCEV] Commute zero extends through <nuw> additions
Sanjoy Das [Thu, 22 Oct 2015 19:57:38 +0000 (19:57 +0000)]
[SCEV] Commute zero extends through <nuw> additions

llvm-svn: 251052

8 years ago[SCEV] Opportunistically interpret unsigned constraints as signed
Sanjoy Das [Thu, 22 Oct 2015 19:57:34 +0000 (19:57 +0000)]
[SCEV] Opportunistically interpret unsigned constraints as signed

Summary:
An unsigned comparision is equivalent to is corresponding signed version
if both the operands being compared are positive.  Teach SCEV to use
this fact when profitable.

Reviewers: atrick, hfinkel, reames, nlewycky

Subscribers: llvm-commits

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

llvm-svn: 251051

8 years ago[SCEV] Teach SCEV some axioms about non-wrapping arithmetic
Sanjoy Das [Thu, 22 Oct 2015 19:57:29 +0000 (19:57 +0000)]
[SCEV] Teach SCEV some axioms about non-wrapping arithmetic

Summary:
 - A s<  (A + C)<nsw> if C >  0
 - A s<= (A + C)<nsw> if C >= 0
 - (A + C)<nsw> s<  A if C <  0
 - (A + C)<nsw> s<= A if C <= 0

Right now `C` needs to be a constant, but we can later generalize it to
be a non-constant if needed.

Reviewers: atrick, hfinkel, reames, nlewycky

Subscribers: sanjoy, llvm-commits

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

llvm-svn: 251050

8 years ago[SCEV] Commute sign extends through nsw additions
Sanjoy Das [Thu, 22 Oct 2015 19:57:25 +0000 (19:57 +0000)]
[SCEV] Commute sign extends through nsw additions

Summary: Depends on D13613.

Reviewers: atrick, hfinkel, reames, nlewycky

Subscribers: llvm-commits

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

llvm-svn: 251049

8 years ago[SCEV] Mark AddExprs as nsw or nuw if legal
Sanjoy Das [Thu, 22 Oct 2015 19:57:19 +0000 (19:57 +0000)]
[SCEV] Mark AddExprs as nsw or nuw if legal

Summary:
This uses `ScalarEvolution::getRange` and not potentially control
dependent `nsw` and `nuw` bits on the arithmetic instruction.

Reviewers: atrick, hfinkel, nlewycky

Subscribers: llvm-commits, sanjoy

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

llvm-svn: 251048

8 years agoRemove special case logic for finding 3rd party libs
Zachary Turner [Thu, 22 Oct 2015 19:55:18 +0000 (19:55 +0000)]
Remove special case logic for finding 3rd party libs

llvm-svn: 251047

8 years agoMove third party libraries to lldb/third_party
Zachary Turner [Thu, 22 Oct 2015 19:55:01 +0000 (19:55 +0000)]
Move third party libraries to lldb/third_party

llvm-svn: 251046

8 years ago[ASan] Minor fixes to dynamic allocas handling:
Alexey Samsonov [Thu, 22 Oct 2015 19:51:59 +0000 (19:51 +0000)]
[ASan] Minor fixes to dynamic allocas handling:

* Don't instrument promotable dynamic allocas:
  We already have a test that checks that promotable dynamic allocas are
  ignored, as well as static promotable allocas. Make sure this test will
  still pass if/when we enable dynamic alloca instrumentation by default.

* Handle lifetime intrinsics before handling dynamic allocas:
  lifetime intrinsics may refer to dynamic allocas, so we need to emit
  instrumentation before these dynamic allocas would be replaced.

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

llvm-svn: 251045

8 years agoSet device_id to host value only in case of adb protocol.
Oleksiy Vyalov [Thu, 22 Oct 2015 19:17:32 +0000 (19:17 +0000)]
Set device_id to host value only in case of adb protocol.

llvm-svn: 251044

8 years agoELF2: Implement --gc-sections.
Rui Ueyama [Thu, 22 Oct 2015 18:49:53 +0000 (18:49 +0000)]
ELF2: Implement --gc-sections.

Section garbage collection is a feature to remove unused sections
from outputs. Unused sections are sections that cannot be reachable
from known GC-root symbols or sections. Naturally the feature is
implemented as a mark-sweep garbage collector.

In this patch, I added Live bit to InputSectionBase. If and only
if Live bit is on, the section will be written to the output.
Starting from GC-root symbols or sections, a new function, markLive(),
visits all reachable sections and sets their Live bits. Writer then
ignores sections whose Live bit is off, so that such sections are
excluded from the output.

This change has small negative impact on performance if you use
the feature because making sections means more work. The time to
link Clang changes from 0.356s to 0.386s, or +8%.

It reduces Clang size from 57,764,984 bytes to 55,296,600 bytes.
That is 4.3% reduction.

http://reviews.llvm.org/D13950

llvm-svn: 251043

8 years ago[ExecutionEngine] Garbage collect some dead (and unsafe) code.
Davide Italiano [Thu, 22 Oct 2015 18:46:27 +0000 (18:46 +0000)]
[ExecutionEngine] Garbage collect some dead (and unsafe) code.

llvm-svn: 251042

8 years agoDefine weak and __weak to mean ARC-style weak references, even in MRC.
John McCall [Thu, 22 Oct 2015 18:38:17 +0000 (18:38 +0000)]
Define weak and __weak to mean ARC-style weak references, even in MRC.

Previously, __weak was silently accepted and ignored in MRC mode.
That makes this a potentially source-breaking change that we have to
roll out cautiously.  Accordingly, for the time being, actual support
for __weak references in MRC is experimental, and the compiler will
reject attempts to actually form such references.  The intent is to
eventually enable the feature by default in all non-GC modes.
(It is, of course, incompatible with ObjC GC's interpretation of
__weak.)

If you like, you can enable this feature with
  -Xclang -fobjc-weak
but like any -Xclang option, this option may be removed at any point,
e.g. if/when it is eventually enabled by default.

This patch also enables the use of the ARC __unsafe_unretained qualifier
in MRC.  Unlike __weak, this is being enabled immediately.  Since
variables are essentially __unsafe_unretained by default in MRC,
the only practical uses are (1) communication and (2) changing the
default behavior of by-value block capture.

As an implementation matter, this means that the ObjC ownership
qualifiers may appear in any ObjC language mode, and so this patch
removes a number of checks for getLangOpts().ObjCAutoRefCount
that were guarding the processing of these qualifiers.  I don't
expect this to be a significant drain on performance; it may even
be faster to just check for these qualifiers directly on a type
(since it's probably in a register anyway) than to do N dependent
loads to grab the LangOptions.

rdar://9674298

llvm-svn: 251041

8 years ago[IntrinsicEmitter] Remove GET_INTRINSIC_MODREF_BEHAVIOR table
Igor Laevsky [Thu, 22 Oct 2015 18:35:34 +0000 (18:35 +0000)]
[IntrinsicEmitter] Remove GET_INTRINSIC_MODREF_BEHAVIOR table

There is no need to generate separate table for intrinsics mod ref behaviour.
It can now be determined purely from function attributes.

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

llvm-svn: 251040

8 years agoAvoid storing a second copy of each string in StringTableBuilder.
Rafael Espindola [Thu, 22 Oct 2015 18:32:06 +0000 (18:32 +0000)]
Avoid storing a second copy of each string in StringTableBuilder.

This was only use in the extremely uncommon case of @@@ symbols on ELF.

llvm-svn: 251039

8 years agoAArch64: Disable the latency heuristic
Matthias Braun [Thu, 22 Oct 2015 18:07:38 +0000 (18:07 +0000)]
AArch64: Disable the latency heuristic

It turned out not to improve any of our benchmarks but occasionally led
to increased register pressure and spilling.

Only enabling for the Cyclone CPU as the results on the cortex CPUs
give mixed results.

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

llvm-svn: 251038

8 years agoMachineScheduler: Add a way to disable the 'ReduceLatency' heuristic
Matthias Braun [Thu, 22 Oct 2015 18:07:31 +0000 (18:07 +0000)]
MachineScheduler: Add a way to disable the 'ReduceLatency' heuristic

llvm-svn: 251037

8 years ago[MS ABI] Don't crash when inheriting from base with trailing empty array member
David Majnemer [Thu, 22 Oct 2015 18:04:22 +0000 (18:04 +0000)]
[MS ABI] Don't crash when inheriting from base with trailing empty array member

We got this right for Itanium but not MSVC because CGRecordLayoutBuilder
was checking if the base's size was zero when it should have been
checking the non-virtual size.

This fixes PR21040.

llvm-svn: 251036

8 years agoRemove the last traces of X86CompilationCallback as it is completely
Eric Christopher [Thu, 22 Oct 2015 17:55:35 +0000 (17:55 +0000)]
Remove the last traces of X86CompilationCallback as it is completely
unused.

llvm-svn: 251035

8 years agoAdd support for abstract domain sockets.
Oleksiy Vyalov [Thu, 22 Oct 2015 17:50:33 +0000 (17:50 +0000)]
Add support for abstract domain sockets.

http://reviews.llvm.org/D13970

llvm-svn: 251034

8 years agoCodeGen: increase bits allocated for LegalizeActions
Tim Northover [Thu, 22 Oct 2015 17:20:48 +0000 (17:20 +0000)]
CodeGen: increase bits allocated for LegalizeActions

The array handling CondCodes only allocated 2 bits to describe the
desired action for each type. The new addition of a "LibCall" option
overflowed this and caused corruption for Custom actions.

No in-tree targets have a Custom CondCodeAction, so unfortunately it
can't be tested.

llvm-svn: 251033

8 years agoChange makeLibCall to take an ArrayRef<SDValue> instead of pointer and size. This...
Craig Topper [Thu, 22 Oct 2015 17:05:00 +0000 (17:05 +0000)]
Change makeLibCall to take an ArrayRef<SDValue> instead of pointer and size. This removes the need to pass a hardcoded size in many places. NFC

llvm-svn: 251032

8 years agoAttempt to fix MSVC builds after rL250966.
Eugene Zelenko [Thu, 22 Oct 2015 17:01:20 +0000 (17:01 +0000)]
Attempt to fix MSVC builds after rL250966.

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

llvm-svn: 251031

8 years agoFix broken build under MSVC.
Zachary Turner [Thu, 22 Oct 2015 16:42:31 +0000 (16:42 +0000)]
Fix broken build under MSVC.

llvm-svn: 251030

8 years agoUse ArrayRef instead of pointer and size. NFC
Craig Topper [Thu, 22 Oct 2015 16:35:56 +0000 (16:35 +0000)]
Use ArrayRef instead of pointer and size. NFC

llvm-svn: 251029

8 years ago[X86] - Catch extra combine opportunities for redundant imuls.
Zia Ansari [Thu, 22 Oct 2015 16:14:45 +0000 (16:14 +0000)]
[X86] - Catch extra combine opportunities for redundant imuls.

When we fold "mul ((add x, c1), c1)" -> "add ((mul x, c2), c1*c2)", we bail if (add x, c1) has multiple
users which would result in an extra add instruction.
In such cases, this patch adds a check to see if we can eliminate a multiply instruction in exchange for the extra add.

I also added the capability of doing the existing optimization with non-splatted vectors (splatted also works).

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

llvm-svn: 251028

8 years ago[PPC] Fix PR24686 by failing assembly for an invalid relocation
Bill Schmidt [Thu, 22 Oct 2015 15:53:44 +0000 (15:53 +0000)]
[PPC] Fix PR24686 by failing assembly for an invalid relocation

PR24686 identifies a problem where a relocation expression is invalid
when not all of the symbols in the expression can be locally
resolved.  This causes the compiler to request a PC-relative half16ds
relocation, which is nonsensical for PowerPC.  This patch recognizes
this situation and ensures we fail the assembly cleanly.

Test case provided by Anton Blanchard.

llvm-svn: 251027

8 years agoUnbreak the shared cmake build. libToolingCore now depends on libAST.
Benjamin Kramer [Thu, 22 Oct 2015 15:45:54 +0000 (15:45 +0000)]
Unbreak the shared cmake build. libToolingCore now depends on libAST.

llvm-svn: 251026

8 years agoDisable trigraph and escaped newline expansion on all types of raw string literals...
Craig Topper [Thu, 22 Oct 2015 15:35:21 +0000 (15:35 +0000)]
Disable trigraph and escaped newline expansion on all types of raw string literals not just ASCII type.

llvm-svn: 251025

8 years agoAvoid hash lookups when finalizing StringTableBuilder. NFC.
Rafael Espindola [Thu, 22 Oct 2015 15:26:35 +0000 (15:26 +0000)]
Avoid hash lookups when finalizing StringTableBuilder. NFC.

llvm-svn: 251024

8 years agoUse array_pod_sort. NFC.
Rafael Espindola [Thu, 22 Oct 2015 15:15:44 +0000 (15:15 +0000)]
Use array_pod_sort. NFC.

llvm-svn: 251023

8 years ago[Tooling] Add a utility function to replace one nested name with another.
Benjamin Kramer [Thu, 22 Oct 2015 15:04:10 +0000 (15:04 +0000)]
[Tooling] Add a utility function to replace one nested name with another.

One problem in clang-tidy and other clang tools face is that there is no
way to lookup an arbitrary name in the AST, that's buried deep inside Sema
and might not even be what the user wants as the new name may be freshly
inserted and not available in the AST.

A common use case for lookups is replacing one nested name with another
while minimizing namespace qualifications, so replacing 'ns::foo' with
'ns::bar' will use just 'bar' if we happen to be inside the namespace 'ns'.
This adds a little helper utility for exactly that use case.

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

llvm-svn: 251022

8 years agoSwitch check_clang_tidy to argparse and add a -resource-dir argument.
Manuel Klimek [Thu, 22 Oct 2015 14:54:50 +0000 (14:54 +0000)]
Switch check_clang_tidy to argparse and add a -resource-dir argument.

-resource-dir can be used to inject non-standard resource dirs via the
lit site config.

llvm-svn: 251021

8 years agoFix incorrect target triple in fp16-promote.ll
Pirama Arumuga Nainar [Thu, 22 Oct 2015 14:15:00 +0000 (14:15 +0000)]
Fix incorrect target triple in fp16-promote.ll

Summary:
Hyphens were missing from the triple, causing it to be parsed
incorrectly.  This patch updates the triple and makes necessary
changes to the expected output.

Patch is from Vinicius Tinti.

Reviewers: ab, tinti

Subscribers: srhines, llvm-commits

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

llvm-svn: 251020

8 years ago[mips][mips16] Fix typo in FileCheck directive.
Daniel Sanders [Thu, 22 Oct 2015 14:01:52 +0000 (14:01 +0000)]
[mips][mips16] Fix typo in FileCheck directive.

llvm-svn: 251019

8 years ago[X86][AVX512] extend vcvtph2ps to support xmm/ymm and sae versions
Asaf Badouh [Thu, 22 Oct 2015 14:01:16 +0000 (14:01 +0000)]
[X86][AVX512] extend vcvtph2ps to support xmm/ymm and sae versions

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

llvm-svn: 251018

8 years ago[GlobalsAA] Loosen an overly conservative bailout
James Molloy [Thu, 22 Oct 2015 13:44:26 +0000 (13:44 +0000)]
[GlobalsAA] Loosen an overly conservative bailout

Instead of bailing out when we see loads, analyze them. If we can prove that the loaded-from address must escape, then we can conclude that a load from that address must escape too and therefore cannot alias a non-addr-taken global.

When checking if a Value can alias a non-addr-taken global, if the Value is a LoadInst of a non-global, recurse instead of bailing.

If we can follow a trail of loads up to some base that is captured, we know by inference that all the loads we followed are also captured.

llvm-svn: 251017

8 years ago[BasicAA] Non-equal indices in a GEP of a SequentialType don't overlap
James Molloy [Thu, 22 Oct 2015 13:28:18 +0000 (13:28 +0000)]
[BasicAA] Non-equal indices in a GEP of a SequentialType don't overlap

If the final indices of two GEPs can be proven to not be equal, and
the GEP is of a SequentialType (not a StructType), then the two GEPs
do not alias.

llvm-svn: 251016

8 years agoDon't use "auto" on loops over fundamental types in modernize-loop-convert.
Angel Garcia Gomez [Thu, 22 Oct 2015 13:23:46 +0000 (13:23 +0000)]
Don't use "auto" on loops over fundamental types in modernize-loop-convert.

Summary: using "auto" on a loop that iterates over ints is kind of an overkill. Use the real type name instead.

Reviewers: klimek

Subscribers: alexfh, cfe-commits

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

llvm-svn: 251015

8 years agoAttempt to fix build bot test failures.
Gabor Horvath [Thu, 22 Oct 2015 13:23:18 +0000 (13:23 +0000)]
Attempt to fix build bot test failures.

llvm-svn: 251014

8 years agoCorrectly print the type in modernize-make-unique.
Angel Garcia Gomez [Thu, 22 Oct 2015 13:20:49 +0000 (13:20 +0000)]
Correctly print the type in modernize-make-unique.

Summary: Take into account the current LangOptions the check has to add back the template argument.

Reviewers: klimek

Subscribers: alexfh, cfe-commits

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

llvm-svn: 251013

8 years ago[ValueTracking] Add a new predicate: isKnownNonEqual()
James Molloy [Thu, 22 Oct 2015 13:18:42 +0000 (13:18 +0000)]
[ValueTracking] Add a new predicate: isKnownNonEqual()

isKnownNonEqual(A, B) returns true if it can be determined that A != B.

At the moment it only knows two facts, that a non-wrapping add of nonzero to a value cannot be that value:

A + B != A [where B != 0, addition is nsw or nuw]

and that contradictory known bits imply two values are not equal.

This patch also hooks this up to InstSimplify; InstSimplify had a peephole for the first fact but not the second so this teaches InstSimplify a new trick too (alas no measured performance impact!)

llvm-svn: 251012

8 years ago[analyzer] Bug identification
Gabor Horvath [Thu, 22 Oct 2015 11:53:04 +0000 (11:53 +0000)]
[analyzer] Bug identification

This patch adds hashes to the plist and html output to be able to identfy bugs
for suppressing false positives or diff results against a baseline. This hash
aims to be resilient for code evolution and is usable to identify bugs in two
different snapshots of the same software. One missing piece however is a
permanent unique identifier of the checker that produces the warning. Once that
issue is resolved, the hashes generated are going to change. Until that point
this feature is marked experimental, but it is suitable for early adoption.

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

Original patch by: Bence Babati!

llvm-svn: 251011

8 years agoAdd %check_clang_tidy and %clang_tidy_diff.
Manuel Klimek [Thu, 22 Oct 2015 11:31:44 +0000 (11:31 +0000)]
Add %check_clang_tidy and %clang_tidy_diff.

With this, site specific lit configs can inject parameters into the
test scripts if they need site specific parameters.

Next up: enable check_clang_tidy to take a resource dir to enable
non-standard locations for builtin includes.

llvm-svn: 251010

8 years ago[AST] Remove redundant template keywords.
Benjamin Kramer [Thu, 22 Oct 2015 11:26:35 +0000 (11:26 +0000)]
[AST] Remove redundant template keywords.

GCC complains about them, clang does not.

llvm-svn: 251009

8 years ago[AST] Store Decl* and Stmt* directly into the ParentMap.
Benjamin Kramer [Thu, 22 Oct 2015 11:21:40 +0000 (11:21 +0000)]
[AST] Store Decl* and Stmt* directly into the ParentMap.

These are by far the most common types to be parents in the AST so it makes
sense to optimize for them. Put them directly into the value of the map.
This currently saves 32 bytes per parent in the map and a pointer
indirection at the cost of some additional complexity in the code.

Sadly this means we cannot return an ArrayRef from getParents anymore, add
a proxy class that can own a single DynTypedNode and otherwise behaves
exactly the same as ArrayRef.

For example on a random large file (X86ISelLowering.cpp) this reduces the
size of the parent map by 24 MB.

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

llvm-svn: 251008

8 years agoMake SymbolFileDWARF::GetCachedSectionData thread safe
Tamas Berghammer [Thu, 22 Oct 2015 11:14:37 +0000 (11:14 +0000)]
Make SymbolFileDWARF::GetCachedSectionData thread safe

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

llvm-svn: 251007

8 years agoFix some race condition in ConstString around Mangled name handling
Tamas Berghammer [Thu, 22 Oct 2015 11:14:31 +0000 (11:14 +0000)]
Fix some race condition in ConstString around Mangled name handling

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

llvm-svn: 251006

8 years agoMake string constants in the modernize module static.
Angel Garcia Gomez [Thu, 22 Oct 2015 09:48:23 +0000 (09:48 +0000)]
Make string constants in the modernize module static.

Summary: Add static to global variables, if they are not in an anonymous namespace.

Reviewers: klimek

Subscribers: cfe-commits

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

llvm-svn: 251005

8 years ago[AppleObjCRuntime] Don't bother looking for the runtime on non-apple targets
Pavel Labath [Thu, 22 Oct 2015 09:34:40 +0000 (09:34 +0000)]
[AppleObjCRuntime] Don't bother looking for the runtime on non-apple targets

Summary:
This short-circuits the GetObjCVersion function to avoid iterating through target modules on
non-apple targets. This function is called on every Process::IsDynamicValue call, so this
overhead is not negligible.

Reviewers: clayborg, jingham

Subscribers: lldb-commits

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

llvm-svn: 251004

8 years ago[RenderScript] Support for mips64 runtime hook
Ewan Crawford [Thu, 22 Oct 2015 09:01:05 +0000 (09:01 +0000)]
[RenderScript] Support for mips64 runtime hook

Previously we could not hook the RS runtime on mips64 architectures.

Patch implements ABI specific code for inspecting function arguments.

Author: Dean De Leo, dean@codeplay.com
llvm-svn: 251003

8 years agoFix the buildbot.
Igor Kudrin [Thu, 22 Oct 2015 08:58:03 +0000 (08:58 +0000)]
Fix the buildbot.

test/elf2/gnu-hash-table.s requires ppc target support to run.

llvm-svn: 251002

8 years agoFix add_llvm_external_project.
Manuel Klimek [Thu, 22 Oct 2015 08:31:46 +0000 (08:31 +0000)]
Fix add_llvm_external_project.

r250835 unintentionally discarded the optional parameter to the
add_llvm_external_project() macro that may point to a path when the said
path is different from ${name}. This should fix it by passing ${ARGN} on
to add_llvm_subdirectory(). The problem manifests itself with e.g.
add_llvm_external_project(clang-tools-extra extra) from
clang/tools/CMakeLists.txt

Patch by Luchesar V. Iliev.

llvm-svn: 251001

8 years ago[ELF2] Add support for GNU Hash section
Igor Kudrin [Thu, 22 Oct 2015 08:21:35 +0000 (08:21 +0000)]
[ELF2] Add support for GNU Hash section

This patch implements --hash-style command line switch.

* By default, or with "sysv" or "both" parameters, the linker generates
  a standard ELF hash section.
* With "gnu" or "both", it produces a GNU-style hash section.

That section requires the symbols in the dynamic symbol table section, which
are referenced in the GNU hash section, to be placed after not hashed ones and
to be sorted to correspond the order of hash buckets in the GNU Hash section.

The division function, as well as estimations for the section's parameters,
are just the first rough attempt and the subjects for further adjustments.

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

llvm-svn: 251000

8 years agoUse range-based for loop in sys::path::append(). NFC.
Pawel Bylica [Thu, 22 Oct 2015 08:12:15 +0000 (08:12 +0000)]
Use range-based for loop in sys::path::append(). NFC.

llvm-svn: 250999

8 years ago[asan] Get rid of UB in string tests. Patch by Max Ostapenko.
Yury Gribov [Thu, 22 Oct 2015 08:10:56 +0000 (08:10 +0000)]
[asan] Get rid of UB in string tests. Patch by Max Ostapenko.

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

llvm-svn: 250998

8 years ago[MS ABI] Mangle static anonymous unions
David Majnemer [Thu, 22 Oct 2015 07:15:56 +0000 (07:15 +0000)]
[MS ABI] Mangle static anonymous unions

We believed that internal linkage variables at global scope which are
not variable template specializations did not have to be mangled.

However, static anonymous unions have no identifier and therefore must
be mangled.

This fixes PR18204.

llvm-svn: 250997

8 years agoAVX-512: Fixed a bug in select_cc for i1 type
Elena Demikhovsky [Thu, 22 Oct 2015 07:10:29 +0000 (07:10 +0000)]
AVX-512: Fixed a bug in select_cc for i1 type
Fixed faiure:
LLVM ERROR: Cannot select: t33: i1 = select_cc t25, Constant:i32<0>, t45, t42, seteq:ch

added a test

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

llvm-svn: 250996

8 years agoPartially reverted changes from r250686
Elena Demikhovsky [Thu, 22 Oct 2015 06:20:29 +0000 (06:20 +0000)]
Partially reverted changes from r250686
Clang runtime failure was reported.
   Assertion failed: (isExtended() && "Type is not extended!"), function getTypeForEVT
I'll need to add a proper handling for PointerType in masked load/store intrinsics.

llvm-svn: 250995

8 years agoclang driver toolchain refactoring
Xinliang David Li [Thu, 22 Oct 2015 06:15:31 +0000 (06:15 +0000)]
clang driver toolchain refactoring

In this patch, the file static method addProfileRT is
moved to be a virtual member function of base ToolChain class.
This allows derived toolchain to override the default behavior
easily and make it consistent with Darwin toolchain (a TODO was
added for this refactoring - now removed). A new helper method
is also introduced to test if instrumentation profile option
is turned on or not.

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

llvm-svn: 250994

8 years ago[coroutines] Initial stub Sema functionality for handling coroutine await / yield...
Richard Smith [Thu, 22 Oct 2015 06:13:50 +0000 (06:13 +0000)]
[coroutines] Initial stub Sema functionality for handling coroutine await / yield / return.

llvm-svn: 250993

8 years ago[coroutines] Add forgotten test for lexing coroutines keywords.
Richard Smith [Thu, 22 Oct 2015 05:21:12 +0000 (05:21 +0000)]
[coroutines] Add forgotten test for lexing coroutines keywords.

llvm-svn: 250992

8 years ago[coroutines] Add overloaded unary 'operator co_await'.
Richard Smith [Thu, 22 Oct 2015 05:12:22 +0000 (05:12 +0000)]
[coroutines] Add overloaded unary 'operator co_await'.

llvm-svn: 250991

8 years agoConvert ActOnForwardProtocolDeclaration to take an ArrayRef and use a range-based...
Craig Topper [Thu, 22 Oct 2015 05:00:01 +0000 (05:00 +0000)]
Convert ActOnForwardProtocolDeclaration to take an ArrayRef and use a range-based for loop. NFC

llvm-svn: 250990

8 years agoUse an ArrayRef<OffsetOfComponent> instead of pointer and size throughout offsetof...
Craig Topper [Thu, 22 Oct 2015 04:59:59 +0000 (04:59 +0000)]
Use an ArrayRef<OffsetOfComponent> instead of pointer and size throughout offsetof handling code. Also use a range-based for loop. NFC

llvm-svn: 250989

8 years agoChange FindProtocolDeclaration to take an ArrayRef and use a range-based for loop...
Craig Topper [Thu, 22 Oct 2015 04:59:56 +0000 (04:59 +0000)]
Change FindProtocolDeclaration to take an ArrayRef and use a range-based for loop. NFC

llvm-svn: 250988

8 years agoChange MacroInfo::setArgumentList to take an ArrayRef instead of pointer and size...
Craig Topper [Thu, 22 Oct 2015 04:59:52 +0000 (04:59 +0000)]
Change MacroInfo::setArgumentList to take an ArrayRef instead of pointer and size. While there use std::copy intead of a manual loop.

llvm-svn: 250987

8 years agoclang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-type-vararg.cpp: Tweak not...
NAKAMURA Takumi [Thu, 22 Oct 2015 04:51:47 +0000 (04:51 +0000)]
clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-type-vararg.cpp: Tweak not to depend on out-of-tree header <cstdarg>.

llvm-svn: 250986

8 years ago[coroutines] Add parsing support for co_await expression, co_yield expression,
Richard Smith [Thu, 22 Oct 2015 04:46:14 +0000 (04:46 +0000)]
[coroutines] Add parsing support for co_await expression, co_yield expression,
co_await modifier on range-based for loop, co_return statement.

llvm-svn: 250985

8 years ago[coroutines] Fix description of LangOption for coroutines.
Richard Smith [Thu, 22 Oct 2015 04:42:51 +0000 (04:42 +0000)]
[coroutines] Fix description of LangOption for coroutines.

llvm-svn: 250984

8 years agoclang-tools-extra/test/clang-tidy/modernize-use-default.cpp: Appease MS mode.
NAKAMURA Takumi [Thu, 22 Oct 2015 04:32:21 +0000 (04:32 +0000)]
clang-tools-extra/test/clang-tidy/modernize-use-default.cpp: Appease MS mode.

llvm-svn: 250983

8 years ago[coroutines] Add feature-test macro for coroutines, defined to 1 to indicate
Richard Smith [Thu, 22 Oct 2015 04:27:47 +0000 (04:27 +0000)]
[coroutines] Add feature-test macro for coroutines, defined to 1 to indicate
the implementation is incomplete.

llvm-svn: 250982

8 years agoMove the launch-as-root xpc service from lldb to xcode, to
Jason Molenda [Thu, 22 Oct 2015 04:17:26 +0000 (04:17 +0000)]
Move the launch-as-root xpc service from lldb to xcode, to
make it easier to run hand-built lldb roots and retain those
entitlements.  This is currently only used by Xcode; command
line lldb doesn't expose the SBLaunchInfo::SetUserID()
launch option.

<rdar://problem/23154486>

llvm-svn: 250981

8 years ago[coroutines] Add lexer support for co_await, co_yield, and co_return keywords.
Richard Smith [Thu, 22 Oct 2015 03:52:15 +0000 (03:52 +0000)]
[coroutines] Add lexer support for co_await, co_yield, and co_return keywords.
Add -fcoroutines flag (just for -cc1 for now) to enable the feature. Early
indications are that this will be part of -std=c++1z.

llvm-svn: 250980

8 years agoChange ModuleList::GetSharedModule so that it will reject "stub
Jason Molenda [Thu, 22 Oct 2015 03:50:28 +0000 (03:50 +0000)]
Change ModuleList::GetSharedModule so that it will reject "stub
libraries" altogether.  On Mac/iOS, these are libraries which have
a UUID and nlist records but no text or data.  If one of these
gets into the global module list, every time we try to search
for a given filename/arch/UUID, we'll get this stub library back.
We need to prevent them from getting added to the module list
altogether.

I thought about doing this down in ObjectFileMachO -- just rejecting
the file as a valid binary file altogether -- but Greg didn't want
to take that hard line approach at this point, he wanted to keep
the ability for lldb to read one of these if someone wanted to in
the future.

<rdar://problem/23035075>

llvm-svn: 250979

8 years agoAdd some verbose lldb host logging so lldb will show what SDK
Jason Molenda [Thu, 22 Oct 2015 03:44:51 +0000 (03:44 +0000)]
Add some verbose lldb host logging so lldb will show what SDK
directories it is searching for files.

llvm-svn: 250978

8 years agoFix a couple places where InsertText was being called with a pointer and size when...
Craig Topper [Thu, 22 Oct 2015 03:13:10 +0000 (03:13 +0000)]
Fix a couple places where InsertText was being called with a pointer and size when it really expects a StringRef and a normally optional bool argument.

The pointer was being implicitly converted to a StringRef and the size was being passed into the bool. Since the bool has a default value normally, no one noticed that the wrong number of arguments was given.

llvm-svn: 250977

8 years agoPass an ArrayRef instead of pointer and size. NFC
Craig Topper [Thu, 22 Oct 2015 03:13:07 +0000 (03:13 +0000)]
Pass an ArrayRef instead of pointer and size. NFC

llvm-svn: 250976

8 years ago[IR] Add a `makeNoWrapRegion` method to `ConstantRange`
Sanjoy Das [Thu, 22 Oct 2015 03:12:57 +0000 (03:12 +0000)]
[IR] Add a `makeNoWrapRegion` method to `ConstantRange`

Summary: This will be used in a future change to ScalarEvolution.

Reviewers: hfinkel, reames, nlewycky

Subscribers: llvm-commits

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

llvm-svn: 250975

8 years ago[OperandBundles] Teach AliasAnalysis about operand bundles
Sanjoy Das [Thu, 22 Oct 2015 03:12:51 +0000 (03:12 +0000)]
[OperandBundles] Teach AliasAnalysis about operand bundles

Summary:
If a `CallSite` has operand bundles, then do not peek into the called
function to get a more precise `ModRef` answer.

This is tested using `argmemonly`, `-basicaa` and `-gvn`; but the
functionality is not specific to any of these.

Depends on D13961

Reviewers: reames, chandlerc

Subscribers: llvm-commits

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

llvm-svn: 250974

8 years ago[OperandBundles] Make function attributes conservatively correct
Sanjoy Das [Thu, 22 Oct 2015 03:12:22 +0000 (03:12 +0000)]
[OperandBundles] Make function attributes conservatively correct

Summary:
This makes attribute accessors on `CallInst` and `InvokeInst` do the
(conservatively) right thing.  This essentially involves, in some
cases, *not* falling back querying the attributes on the called
`llvm::Function` when operand bundles are present.

Attributes locally present on the `CallInst` or `InvokeInst` will still
override operand bundle semantics.  The LangRef has been amended to
reflect this.  Note: this change does not do anything prevent
`-function-attrs` from inferring `CallSite` local attributes after
inspecting the called function -- that will be done as a separate
change.

I've used `-adce` and `-early-cse` to test these changes.  There is
nothing special about these passes (and they did not require any
changes) except that they seemed be the easiest way to write the tests.

This change does not add deal with `argmemonly`.  That's a later change
because alias analysis requires a related fix before `argmemonly` can be
tested.

Reviewers: reames, chandlerc

Subscribers: llvm-commits

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

llvm-svn: 250973

8 years agoWebAssembly: fix more syntax
JF Bastien [Thu, 22 Oct 2015 02:32:50 +0000 (02:32 +0000)]
WebAssembly: fix more syntax

br_if shouldn't start with a dot.
div and rem went from prefix u/s to suffix.

llvm-svn: 250972