platform/upstream/llvm.git
7 years agoRecommit r289979 [OpenCL] Allow disabling types and declarations associated with...
Yaxun Liu [Sun, 18 Dec 2016 05:18:55 +0000 (05:18 +0000)]
Recommit r289979 [OpenCL] Allow disabling types and declarations associated with extensions

Fixed undefined behavior due to cast integer to bool in initializer list.

llvm-svn: 290056

7 years ago[AVX-512] Make sure VLX is also enabled before using EVEX encoded logic ops for scala...
Craig Topper [Sun, 18 Dec 2016 04:17:00 +0000 (04:17 +0000)]
[AVX-512] Make sure VLX is also enabled before using EVEX encoded logic ops for scalars. I missed this in r290049.

llvm-svn: 290055

7 years ago[PDB] Don't reimplement CRC32
David Majnemer [Sun, 18 Dec 2016 00:41:15 +0000 (00:41 +0000)]
[PDB] Don't reimplement CRC32

We already have a CRC32 implementation which is compatible with the PDB
hash, reuse it.

llvm-svn: 290054

7 years ago[PDB] Validate superblock addresses
David Majnemer [Sun, 18 Dec 2016 00:41:10 +0000 (00:41 +0000)]
[PDB] Validate superblock addresses

- Validate the address of the block map.
- Validate the address of the free block map.

llvm-svn: 290053

7 years ago[CMake] Fix issue reported on sanitizer bots
Chris Bieneman [Sat, 17 Dec 2016 21:28:24 +0000 (21:28 +0000)]
[CMake] Fix issue reported on sanitizer bots

This should resolve an issue reported on the commit thread that impacted sanitizer bots.

llvm-svn: 290052

7 years ago[clang-tidy] Remove duplicated check from move-constructor-init
Malcolm Parsons [Sat, 17 Dec 2016 20:23:14 +0000 (20:23 +0000)]
[clang-tidy] Remove duplicated check from move-constructor-init

Summary:
An addition to the move-constructor-init check was duplicating the
modernize-pass-by-value check.
Remove the additional check and UseCERTSemantics option.
Run the move-constructor-init test with both checks enabled.
Fix modernize-pass-by-value false-positive when initializing a base
class.
Add option to modernize-pass-by-value to only warn about parameters
that are already values.

Reviewers: alexfh, flx, aaron.ballman

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26453

llvm-svn: 290051

7 years agoAMDGPU: Fix broken check prefix in test
Matt Arsenault [Sat, 17 Dec 2016 20:03:59 +0000 (20:03 +0000)]
AMDGPU: Fix broken check prefix in test

llvm-svn: 290050

7 years ago[AVX-512] Use EVEX encoded logic operations for scalar types when they are available...
Craig Topper [Sat, 17 Dec 2016 19:26:00 +0000 (19:26 +0000)]
[AVX-512] Use EVEX encoded logic operations for scalar types when they are available. This gives the register allocator more registers to work with.

llvm-svn: 290049

7 years ago[AVX-512] Update scalar logic test to show missed opportunity to use EVEX encoded...
Craig Topper [Sat, 17 Dec 2016 19:25:55 +0000 (19:25 +0000)]
[AVX-512] Update scalar logic test to show missed opportunity to use EVEX encoded logic instructions to get more registers to use.

llvm-svn: 290048

7 years agoRevert "AArch64CollectLOH: Rewrite as block-local analysis."
Matthias Braun [Sat, 17 Dec 2016 18:53:11 +0000 (18:53 +0000)]
Revert "AArch64CollectLOH: Rewrite as block-local analysis."

It is still breaking Chrome. http://llvm.org/PR31361

This reverts commit r290026.

llvm-svn: 290047

7 years ago[InstCombine] Simplify code slightly. NFC
Craig Topper [Sat, 17 Dec 2016 18:10:04 +0000 (18:10 +0000)]
[InstCombine] Simplify code slightly. NFC

llvm-svn: 290046

7 years agoFix the cmake declaration syntax
Sylvestre Ledru [Sat, 17 Dec 2016 13:04:35 +0000 (13:04 +0000)]
Fix the cmake declaration syntax

llvm-svn: 290045

7 years agoSupport of lldb on Kfreebsd
Sylvestre Ledru [Sat, 17 Dec 2016 12:48:06 +0000 (12:48 +0000)]
Support of lldb on Kfreebsd

Summary: Patch by Pino Toscano. Reported in http://bugs.debian.org/835665

Reviewers: tfiala, emaste

Subscribers: beanz, mgorny, emaste, krytarowski, brucem, tberghammer, danalbert, srhines, #lldb

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D23977

llvm-svn: 290044

7 years agoRevert "[libFuzzer] add an experimental flag -experimental_len_control=1 that sets...
Daniel Jasper [Sat, 17 Dec 2016 12:27:49 +0000 (12:27 +0000)]
Revert "[libFuzzer] add an experimental flag -experimental_len_control=1 that sets max_len to 1M and tries to increases the actual max sizes of mutations very gradually. Also remove a bit of dead code"

This reverts commit r289998.

See comment:
https://reviews.llvm.org/rL289998

llvm-svn: 290043

7 years ago[ELF] - Use DWARFDebugPubTable parser class intead of hand-written parsing.
George Rimar [Sat, 17 Dec 2016 10:18:05 +0000 (10:18 +0000)]
[ELF] - Use DWARFDebugPubTable parser class intead of hand-written parsing.

DWARFDebugPubTable was introduced recently and allows us to get rid of
code duplication in LLD.

llvm-svn: 290042

7 years ago[DWARF] - Make PubIndexEntryDescriptor::toBits() to be const.
George Rimar [Sat, 17 Dec 2016 10:15:39 +0000 (10:15 +0000)]
[DWARF] - Make PubIndexEntryDescriptor::toBits() to be const.

That is usefull when iterating over entries of new DWARFDebugPubTable class
via DWARFDebugPubTable::getData which returns ArrayRef.

llvm-svn: 290041

7 years ago[DWARF] - Introduce DWARFDebugPubTable class for dumping pub* sections.
George Rimar [Sat, 17 Dec 2016 09:10:32 +0000 (09:10 +0000)]
[DWARF] - Introduce DWARFDebugPubTable class for dumping pub* sections.

Patch implements parser of pubnames/pubtypes tables instead of static
function used before. It is now should be possible to reuse it
in LLD or other projects and clean up the duplication code.

Differential revision: https://reviews.llvm.org/D27851

llvm-svn: 290040

7 years ago[libFuzzer] use less memory for merge
Kostya Serebryany [Sat, 17 Dec 2016 08:20:24 +0000 (08:20 +0000)]
[libFuzzer] use less memory for merge

llvm-svn: 290039

7 years ago[OpenMP] Sema and parsing for 'target teams' pragma
Kelvin Li [Sat, 17 Dec 2016 05:48:59 +0000 (05:48 +0000)]
[OpenMP] Sema and parsing for 'target teams' pragma

This patch is to implement sema and parsing for 'target teams' pragma.

Differential Revision: https://reviews.llvm.org/D27818

llvm-svn: 290038

7 years agoAdd custom type for PseudoSourceValue
Tom Stellard [Sat, 17 Dec 2016 04:41:53 +0000 (04:41 +0000)]
Add custom type for PseudoSourceValue

Summary:
PseudoSourceValue can be used to attach a target specific value for "well behaved" side-effects lowered from target specific intrinsics.
This is useful whenever there is not an LLVM IR Value around when representing such "well behaved" side-effected operations in backends by attaching a MachineMemOperand with a custom PseudoSourceValue as this makes the scheduler not treating them as "GlobalMemoryObjects" which triggers a logic that makes the operation act like a barrier in the Schedule DAG.

This patch adds another Kind to the PseudoSourceValue object which is "TargetCustom". It indicates a type of PseudoSourceValue that has a target specific meaning (aka. LLVM shouldn't assume any specific usage for such a PSV).

It supports the possibility of having many different kinds of "TargetCustom" PseudoSourceValues.

We had a discussion about if this was valuable or not (in particular because there was a believe that PSV were going away sooner or later) but seems like they are not going anywhere and I think they are useful backend side.

It is not clear the interaction of this with MIRParser (do we need a target hook to parse these?) and I would like a comment from Alex about that :)

Reviewers: arphaman, hfinkel, arsenm

Subscribers: Eugene.Zelenko, llvm-commits

Patch By: Marcello Maggioni

Differential Revision: https://reviews.llvm.org/D13575

llvm-svn: 290037

7 years agoADT: Add a getArrayRef() accessor to MapVector.
Peter Collingbourne [Sat, 17 Dec 2016 04:04:18 +0000 (04:04 +0000)]
ADT: Add a getArrayRef() accessor to MapVector.

llvm-svn: 290036

7 years ago[libFuzzer] speed up __sanitizer_cov_trace_switch a bit more (remove DIV)
Kostya Serebryany [Sat, 17 Dec 2016 02:23:35 +0000 (02:23 +0000)]
[libFuzzer] speed up __sanitizer_cov_trace_switch a bit more (remove DIV)

llvm-svn: 290034

7 years ago[libFuzzer] remove stale test
Kostya Serebryany [Sat, 17 Dec 2016 02:18:59 +0000 (02:18 +0000)]
[libFuzzer] remove stale test

llvm-svn: 290033

7 years agoMove test to correct directory
Matthias Braun [Sat, 17 Dec 2016 02:16:26 +0000 (02:16 +0000)]
Move test to correct directory

See also test/CodeGen/MIR/README

llvm-svn: 290032

7 years ago[libFuzzer] when tracing switch statements, handle only one case at a time (to make...
Kostya Serebryany [Sat, 17 Dec 2016 02:03:34 +0000 (02:03 +0000)]
[libFuzzer] when tracing switch statements, handle only one case at a time (to make things faster). Also ensure that the signals from value profile do not intersect with the regular coverage

llvm-svn: 290031

7 years agoRevert "[GVNHoist] Move GVNHoist to function simplification part of pipeline."
Evgeniy Stepanov [Sat, 17 Dec 2016 01:53:15 +0000 (01:53 +0000)]
Revert "[GVNHoist] Move GVNHoist to function simplification part of pipeline."

This reverts r289696, which caused TSan perf regression.

See PR31382.

llvm-svn: 290030

7 years agoFix compilation.
Evgeniy Stepanov [Sat, 17 Dec 2016 01:31:46 +0000 (01:31 +0000)]
Fix compilation.

unittests/ADT/TwineTest.cpp:106:38: error: field 'Count' will be initialized after base 'llvm::FormatAdapter<int>' [-Werror,-Wreorder]
    explicit formatter(int &Count) : Count(Count), FormatAdapter(0) {}

llvm-svn: 290029

7 years ago[Hexagon] Other attempt to fix build with enabled asserts broken in 290024 (NFC).
Eugene Zelenko [Sat, 17 Dec 2016 01:29:35 +0000 (01:29 +0000)]
[Hexagon] Other attempt to fix build with enabled asserts broken in 290024 (NFC).

llvm-svn: 290028

7 years ago[Hexagon] Fix build with enabled asserts broken in 290024 (NFC).
Eugene Zelenko [Sat, 17 Dec 2016 01:17:18 +0000 (01:17 +0000)]
[Hexagon] Fix build with enabled asserts broken in 290024 (NFC).

llvm-svn: 290027

7 years agoAArch64CollectLOH: Rewrite as block-local analysis.
Matthias Braun [Sat, 17 Dec 2016 01:15:59 +0000 (01:15 +0000)]
AArch64CollectLOH: Rewrite as block-local analysis.

Re-apply r288561: Liveness tracking should be correct now after r290014.

Previously this pass was using up to 5% compile time in some cases which
is a bit much for what it is doing. The pass featured a full blown
data-flow analysis which in the default configuration was restricted to a
single block.

This rewrites the pass under the assumption that we only ever work on a
single block. This is done in a single pass maintaining a state machine
per general purpose register to catch LOH patterns.

Differential Revision: https://reviews.llvm.org/D27329

llvm-svn: 290026

7 years ago[libclang] Remove the 'extern "C"' blocks from the implementation files.
Argyrios Kyrtzidis [Sat, 17 Dec 2016 01:09:40 +0000 (01:09 +0000)]
[libclang] Remove the 'extern "C"' blocks from the implementation files.

These are unnecessary, the declarations already carry the 'extern C' property, and if there is mismatch
between declaration and definition then we will get linker errors via libclang.exports.

llvm-svn: 290025

7 years ago[Hexagon] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Sat, 17 Dec 2016 01:09:05 +0000 (01:09 +0000)]
[Hexagon] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 290024

7 years ago[analyzer] UnixAPIChecker: Don't diagnose for functions in C++ namespaces
Devin Coughlin [Sat, 17 Dec 2016 01:08:17 +0000 (01:08 +0000)]
[analyzer] UnixAPIChecker: Don't diagnose for functions in C++ namespaces

Update the UnixAPIChecker to not diagnose for calls to functions that
are declared in C++ namespaces. This avoids false positives when a
namespaced function has the same name as a Unix API.

This address PR28331.

llvm-svn: 290023

7 years agoRetry: [BPI] Use a safer constructor to calculate branch probabilities
Vedant Kumar [Sat, 17 Dec 2016 01:02:08 +0000 (01:02 +0000)]
Retry: [BPI] Use a safer constructor to calculate branch probabilities

BPI may trigger signed overflow UB while computing branch probabilities for
cold calls or to unreachables. For example, with our current choice of weights,
we'll crash if there are >= 2^12 branches to an unreachable.

Use a safer BranchProbability constructor which is better at handling fractions
with large denominators.

Changes since the initial commit:
  - Use explicit casts to ensure that multiplication operands are 64-bit
    ints.

rdar://problem/29368161

Differential Revision: https://reviews.llvm.org/D27862

llvm-svn: 290022

7 years agoDelete unused file.
Zachary Turner [Sat, 17 Dec 2016 00:58:19 +0000 (00:58 +0000)]
Delete unused file.

llvm-svn: 290021

7 years agoAdd support for formatv to llvm::Twine.
Zachary Turner [Sat, 17 Dec 2016 00:38:15 +0000 (00:38 +0000)]
Add support for formatv to llvm::Twine.

Differential Revision: https://reviews.llvm.org/D27835

llvm-svn: 290020

7 years agoRevert "[BPI] Use a safer constructor to calculate branch probabilities"
Vedant Kumar [Sat, 17 Dec 2016 00:19:06 +0000 (00:19 +0000)]
Revert "[BPI] Use a safer constructor to calculate branch probabilities"

This reverts commit r290016. It breaks this bot, even though the test
passes locally:

  http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/32956/

AnalysisTests: /home/bb/ninja-x64-msvc-RA-centos6/llvm-project/llvm/lib/Support/BranchProbability.cpp:52: static llvm::BranchProbability llvm::BranchProbability::getBranchProbability(uint64_t, uint64_t): Assertion `Numerator <= Denominator && "Probability cannot be bigger than 1!"' failed.
llvm-svn: 290019

7 years ago[libfuzzer] removing experimental FuzzerFnAdapter
Mike Aizatsky [Sat, 17 Dec 2016 00:12:13 +0000 (00:12 +0000)]
[libfuzzer] removing experimental FuzzerFnAdapter

Summary: This is superceded by protobuf mutation work.

Reviewers: kcc

Subscribers: mgorny

Differential Revision: https://reviews.llvm.org/D27865

llvm-svn: 290018

7 years ago[sancov] skip dead files from computations
Mike Aizatsky [Sat, 17 Dec 2016 00:11:48 +0000 (00:11 +0000)]
[sancov] skip dead files from computations

Differential Revision: https://reviews.llvm.org/D27863

llvm-svn: 290017

7 years ago[BPI] Use a safer constructor to calculate branch probabilities
Vedant Kumar [Sat, 17 Dec 2016 00:09:51 +0000 (00:09 +0000)]
[BPI] Use a safer constructor to calculate branch probabilities

BPI may trigger signed overflow UB while computing branch probabilities
for cold calls or to unreachables. For example, with our current choice
of weights, we'll crash if there are >= 2^12 branches to an unreachable.

Use a safer BranchProbability constructor which is better at handling
fractions with large denominators.

rdar://problem/29368161

Differential Revision: https://reviews.llvm.org/D27862

llvm-svn: 290016

7 years ago[ORC][RPC] Use more meaningful template parameter names.
Lang Hames [Sat, 17 Dec 2016 00:04:24 +0000 (00:04 +0000)]
[ORC][RPC] Use more meaningful template parameter names.

llvm-svn: 290015

7 years agoAArch64: Enable post-ra liveness updates
Matthias Braun [Fri, 16 Dec 2016 23:55:43 +0000 (23:55 +0000)]
AArch64: Enable post-ra liveness updates

Differential Revision: https://reviews.llvm.org/D27559

llvm-svn: 290014

7 years agoBranchRelaxation: Recompute live-ins when splitting a block
Matthias Braun [Fri, 16 Dec 2016 23:55:37 +0000 (23:55 +0000)]
BranchRelaxation: Recompute live-ins when splitting a block

Factors out and reuses live-in computation code from BranchFolding.

Differential Revision: https://reviews.llvm.org/D27558

llvm-svn: 290013

7 years agoAllow "line 0" to be the first explicit debug location in a function.
Paul Robinson [Fri, 16 Dec 2016 23:54:33 +0000 (23:54 +0000)]
Allow "line 0" to be the first explicit debug location in a function.

Feedback on r289468 from Adrian Prantl.

llvm-svn: 290012

7 years agoGDB pretty printers: Basic DenseMap support
David Blaikie [Fri, 16 Dec 2016 23:53:14 +0000 (23:53 +0000)]
GDB pretty printers: Basic DenseMap support

Still prints the empty/tombstone keys (which some people would prefer,
but I find pretty noisy) because I haven't yet found a reliable way to
skip them (it requires calling into the running process to do so, which
isn't ideal for a pretty printer (doesn't work on a core file, for
example) - and gdb's ability to do so (or my ability to figure out how
to get gdb to do so) is limited) left some breadcrumbs for the next
person who might try to address that.

llvm-svn: 290011

7 years agoAdded clangLex to the dependencies for clang-import-test.
Sean Callanan [Fri, 16 Dec 2016 23:45:03 +0000 (23:45 +0000)]
Added clangLex to the dependencies for clang-import-test.

This is part of the effort to get the i686-mingw32-RA-on-linux bot to like clang-import-test.

llvm-svn: 290010

7 years agoFix MSVC build of libclang after r288438
Reid Kleckner [Fri, 16 Dec 2016 23:44:44 +0000 (23:44 +0000)]
Fix MSVC build of libclang after r288438

llvm-svn: 290009

7 years agoAdd explicit triple to test to fix arm bots.
Peter Collingbourne [Fri, 16 Dec 2016 23:43:51 +0000 (23:43 +0000)]
Add explicit triple to test to fix arm bots.

llvm-svn: 290008

7 years agoAdd isl_multi_pw_aff to GICHelper
Alexandre Isoard [Fri, 16 Dec 2016 23:41:26 +0000 (23:41 +0000)]
Add isl_multi_pw_aff to GICHelper

Add isl_multi_pw_aff* to GICHelper and add some missing isl_pw_multi_aff* handlers.

llvm-svn: 290007

7 years agoFixed library dependencies on clang-import-test to clean up the bots.
Sean Callanan [Fri, 16 Dec 2016 23:34:16 +0000 (23:34 +0000)]
Fixed library dependencies on clang-import-test to clean up the bots.

llvm-svn: 290006

7 years ago[analyzer] Extend UnixAPIChecker open() checks to handle openat().
Devin Coughlin [Fri, 16 Dec 2016 23:31:56 +0000 (23:31 +0000)]
[analyzer] Extend UnixAPIChecker open() checks to handle openat().

The openat() API has similar constraints to the open() API -- it just takes
an extra parameter.

rdar://problem/29526458

llvm-svn: 290005

7 years agoTestbed and skeleton of a new expression parser
Sean Callanan [Fri, 16 Dec 2016 23:21:38 +0000 (23:21 +0000)]
Testbed and skeleton of a new expression parser

LLVM's JIT is now the foundation of dynamic-compilation features for many languages. Clang also has low-level support for dynamic compilation (ASTImporter and ExternalASTSource, notably). How the compiler is set up for dynamic parsing is generally left up to individual clients, for example LLDB's C/C++/Objective-C expression parser and the ROOT project.

Although this arrangement offers external clients the flexibility to implement dynamic features as they see fit, the lack of an in-tree client means that subtle bugs can be introduced that cause regressions in the external clients but aren't caught by tests (or users) until much later. LLDB for example regularly encounters complicated ODR violation scenarios where it is not immediately clear who is at fault.

Other external clients (notably, Cling) rely on similar functionality, and another goal is to break this functionality up into composable parts so that any client can be built easily on top of Clang without requiring extensive additional code.

I propose that the parts required to build a simple expression parser be added to Clang.  Initially, I aim to have the following features:

- A piece that looks up external declarations from a variety of sources (e.g., from previous dynamic compilations, from modules, or from DWARF) and uses clear conflict resolution rules to reconcile differences, with easily understood errors. This functionality will be supported by in-tree tests.

- A piece that works hand in hand with the LLVM JIT to resolve the locations of external declarations so that e.g. variables can be redeclared and (for high-performance applications like DTrace) external variables can be accessed directly from the registers where they reside.

This commit adds a tester that parses a sequence of source files and then uses them as source data for an expression. External references are resolved using an ExternalASTSource that responds to name queries using an ASTImporter. This is the setup that LLDB uses, and the motivating reason for MinimalImport in ASTImporter.  When complete, this tester will implement the first of the above goals.

Differential Revision: https://reviews.llvm.org/D27180

llvm-svn: 290004

7 years agoModuleSummaryAnalysis: Remove some duplicate code. NFCI.
Peter Collingbourne [Fri, 16 Dec 2016 23:19:02 +0000 (23:19 +0000)]
ModuleSummaryAnalysis: Remove some duplicate code. NFCI.

llvm-svn: 290003

7 years agoFix compiler warning.
Zachary Turner [Fri, 16 Dec 2016 23:12:58 +0000 (23:12 +0000)]
Fix compiler warning.

Differential Revision: https://reviews.llvm.org/D27860

llvm-svn: 290002

7 years agoFix a bugs with using some Mach-O command line flags like "-arch armv7m".
Kevin Enderby [Fri, 16 Dec 2016 22:54:02 +0000 (22:54 +0000)]
Fix a bugs with using some Mach-O command line flags like "-arch armv7m".

The Mach-O command line flag like "-arch armv7m" does not match the
arch name part of its llvm Triple which is "thumbv7m-apple-darwin”.

I think the best way to fix this is to have
llvm::object::MachOObjectFile::getArchTriple() optionally return the
name of the Mach-O arch flag that would be used with -arch that
matches the CPUType and CPUSubType.  Then change
llvm::object::MachOUniversalBinary::ObjectForArch::getArchTypeName()
to use that and change it to getArchFlagName() as the type name is
really part of the Triple and the -arch flag name is a Mach-O thing
for a specific Triple with a specific Mcpu value.

rdar://29663637

llvm-svn: 290001

7 years agoResubmit "[CodeView] Hook CodeViewRecordIO for reading/writing symbols."
Zachary Turner [Fri, 16 Dec 2016 22:48:14 +0000 (22:48 +0000)]
Resubmit "[CodeView] Hook CodeViewRecordIO for reading/writing symbols."

The original patch was broken due to some undefined behavior
as well as warnings that were triggering -Werror.

llvm-svn: 290000

7 years ago[libFuzzer] avoid msan false positives in more cases
Kostya Serebryany [Fri, 16 Dec 2016 22:45:25 +0000 (22:45 +0000)]
[libFuzzer] avoid msan false positives in more cases

llvm-svn: 289999

7 years ago[libFuzzer] add an experimental flag -experimental_len_control=1 that sets max_len...
Kostya Serebryany [Fri, 16 Dec 2016 22:42:05 +0000 (22:42 +0000)]
[libFuzzer] add an experimental flag -experimental_len_control=1 that sets max_len to 1M and tries to increases the actual max sizes of mutations very gradually. Also remove a bit of dead code

llvm-svn: 289998

7 years agoReally revert all changes from r289979. Apparently conflict resolution failed
Reid Kleckner [Fri, 16 Dec 2016 22:11:28 +0000 (22:11 +0000)]
Really revert all changes from r289979. Apparently conflict resolution failed

llvm-svn: 289997

7 years agoIRGen: Fix assertion failure when creating debug info for an integer constant wider...
Peter Collingbourne [Fri, 16 Dec 2016 22:10:52 +0000 (22:10 +0000)]
IRGen: Fix assertion failure when creating debug info for an integer constant wider than 64 bits.

llvm-svn: 289996

7 years ago[libclang] Restore the CXXRecordDecl path for clang_Type_getNumTemplateArguments...
Argyrios Kyrtzidis [Fri, 16 Dec 2016 21:40:16 +0000 (21:40 +0000)]
[libclang] Restore the CXXRecordDecl path for clang_Type_getNumTemplateArguments and clang_Type_getTemplateArgumentAsType

Patch by Emilio Cobos Álvarez!
See https://reviews.llvm.org/D26907

llvm-svn: 289995

7 years agoFix compiler warning.
Zachary Turner [Fri, 16 Dec 2016 21:35:12 +0000 (21:35 +0000)]
Fix compiler warning.

llvm-svn: 289994

7 years ago[ThinLTO] Import composite types as declarations
Teresa Johnson [Fri, 16 Dec 2016 21:25:01 +0000 (21:25 +0000)]
[ThinLTO] Import composite types as declarations

Summary:
When reading the metadata bitcode, create a type declaration when
possible for composite types when we are importing. Doing this in
the bitcode reader saves memory. Also it works naturally in the case
when the type ODR map contains a definition for the same composite type
because it was used in the importing module (buildODRType will
automatically use the existing definition and not create a type
declaration).

For Chromium built with -g2, this reduces the aggregate size of the
generated native object files by 66% (from 31G to 10G). It reduced
the time through the ThinLTO link and backend phases by about 20% on
my machine.

Reviewers: mehdi_amini, dblaikie, aprantl

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D27775

llvm-svn: 289993

7 years agoPreserve loop metadata when folding branches to a common destination.
Michael Kuperstein [Fri, 16 Dec 2016 21:23:59 +0000 (21:23 +0000)]
Preserve loop metadata when folding branches to a common destination.

Differential Revision: https://reviews.llvm.org/D27830

llvm-svn: 289992

7 years agoRevert r289979 due to regressions
Yaxun Liu [Fri, 16 Dec 2016 21:23:55 +0000 (21:23 +0000)]
Revert r289979 due to regressions

llvm-svn: 289991

7 years ago[Sema] Transform the default arguments of a lambda expression when the
Akira Hatanaka [Fri, 16 Dec 2016 21:16:57 +0000 (21:16 +0000)]
[Sema] Transform the default arguments of a lambda expression when the
lambda expression is instantiated.

Rather than waiting until Sema::CheckCXXDefaultArgExpr tries to
transform the default arguments (which fails because it can't get the
template arguments that are used), transform the default arguments
earlier when the lambda expression is transformed in
TransformLambdaExpr.

rdar://problem/27535319

Differential Revision: https://reviews.llvm.org/D23096

llvm-svn: 289990

7 years ago[OpenMP] support the 'is_device_ptr' clause with 'target parallel' pragma
Kelvin Li [Fri, 16 Dec 2016 20:50:46 +0000 (20:50 +0000)]
[OpenMP] support the 'is_device_ptr' clause with 'target parallel' pragma

This patch is to add support of the 'is_device_ptr' clause in the 'target parallel' pragma.

Differential Revision: https://reviews.llvm.org/D27821

llvm-svn: 289989

7 years ago[CodeGenPrep] Skip merging empty case blocks
Jun Bum Lim [Fri, 16 Dec 2016 20:38:39 +0000 (20:38 +0000)]
[CodeGenPrep] Skip merging empty case blocks

This is recommit of r287553 after fixing the invalid loop info after eliminating an empty block and unit test failures in AVR and WebAssembly :

Summary: Merging an empty case block into the header block of switch could cause ISel to add COPY instructions in the header of switch, instead of the case block, if the case block is used as an incoming block of a PHI. This could potentially increase dynamic instructions, especially when the switch is in a loop. I added a test case which was reduced from the benchmark I was targetting.

Reviewers: t.p.northover, mcrosier, manmanren, wmi, joerg, davidxl

Subscribers: joerg, qcolombet, danielcdh, hfinkel, mcrosier, llvm-commits

Differential Revision: https://reviews.llvm.org/D22696

llvm-svn: 289988

7 years agoInline stripInvariantGroupMetadata out of existence
Sanjoy Das [Fri, 16 Dec 2016 20:29:39 +0000 (20:29 +0000)]
Inline stripInvariantGroupMetadata out of existence

As a one liner function, I don't think it is pulling its weight in terms
of helping readability.

llvm-svn: 289987

7 years agoRemove the temporary fix to the RUN line that was committed in r289924.
Akira Hatanaka [Fri, 16 Dec 2016 20:25:11 +0000 (20:25 +0000)]
Remove the temporary fix to the RUN line that was committed in r289924.

Also, dump the AST and run FileCheck to make sure the expected nodes are
created in the AST.

llvm-svn: 289986

7 years agoFix clang build
Zachary Turner [Fri, 16 Dec 2016 19:49:14 +0000 (19:49 +0000)]
Fix clang build

llvm-svn: 289985

7 years agoRevert "Update for LLVM global variable debug info API change."
Adrian Prantl [Fri, 16 Dec 2016 19:39:18 +0000 (19:39 +0000)]
Revert "Update for LLVM global variable debug info API change."

This reverts commit r289921.

llvm-svn: 289984

7 years agoRevert "Fix debug info metadata for upstream change in LLVM."
Adrian Prantl [Fri, 16 Dec 2016 19:39:18 +0000 (19:39 +0000)]
Revert "Fix debug info metadata for upstream change in LLVM."

llvm-svn: 289983

7 years agoRevert "[IR] Remove the DIExpression field from DIGlobalVariable."
Adrian Prantl [Fri, 16 Dec 2016 19:39:01 +0000 (19:39 +0000)]
Revert "[IR] Remove the DIExpression field from DIGlobalVariable."

This reverts commit 289920 (again).
I forgot to implement a Bitcode upgrade for the case where a DIGlobalVariable
has not DIExpression. Unfortunately it is not possible to safely upgrade
these variables without adding a flag to the bitcode record indicating which
version they are.
My plan of record is to roll the planned follow-up patch that adds a
unit: field to DIGlobalVariable into this patch before recomitting.
This way we only need one Bitcode upgrade for both changes (with a
version flag in the bitcode record to safely distinguish the record
formats).

Sorry for the churn!

llvm-svn: 289982

7 years agoRevert "[CodeView] Hook CodeViewRecordIO for reading/writing symbols."
Zachary Turner [Fri, 16 Dec 2016 19:25:23 +0000 (19:25 +0000)]
Revert "[CodeView] Hook CodeViewRecordIO for reading/writing symbols."

This reverts commit r289978, which is failing due to some rebase/merge
issues.

llvm-svn: 289981

7 years agoFix comment on the verifier (typo + doxygen) (NFC)
Mehdi Amini [Fri, 16 Dec 2016 19:24:13 +0000 (19:24 +0000)]
Fix comment on the verifier (typo + doxygen) (NFC)

llvm-svn: 289980

7 years ago[OpenCL] Allow disabling types and declarations associated with extensions
Yaxun Liu [Fri, 16 Dec 2016 19:22:08 +0000 (19:22 +0000)]
[OpenCL] Allow disabling types and declarations associated with extensions

Added a map to associate types and declarations with extensions.

Refactored existing diagnostic for disabled types associated with extensions and extended it to declarations for generic situation.

Fixed some bugs for types associated with extensions.

Allow users to use pragma to declare types and functions for supported extensions, e.g.

#pragma OPENCL EXTENSION the_new_extension_name : begin
// declare types and functions associated with the extension here
#pragma OPENCL EXTENSION the_new_extension_name : end

Differential Revision: https://reviews.llvm.org/D21698

llvm-svn: 289979

7 years ago[CodeView] Hook CodeViewRecordIO for reading/writing symbols.
Zachary Turner [Fri, 16 Dec 2016 19:20:35 +0000 (19:20 +0000)]
[CodeView] Hook CodeViewRecordIO for reading/writing symbols.

This is the 3rd of 3 patches to get reading and writing of
CodeView symbol and type records to use a single codepath.

Differential Revision: https://reviews.llvm.org/D26427

llvm-svn: 289978

7 years agoStrip invalid TBAA when reading bitcode
Mehdi Amini [Fri, 16 Dec 2016 19:16:29 +0000 (19:16 +0000)]
Strip invalid TBAA when reading bitcode

This ensures backward compatibility on bitcode loading.

Differential Revision: https://reviews.llvm.org/D27839

llvm-svn: 289977

7 years agoGDB pretty printer for llvm::Optional
David Blaikie [Fri, 16 Dec 2016 19:16:22 +0000 (19:16 +0000)]
GDB pretty printer for llvm::Optional

(some other implementations of an optional pretty printer print the full
name of the optional type (including template parameter) - but seems if
the template parameter isn't printed for std::vector, not sure why it
would be printed for optional, so erring on the side of consistency in
that direction here - compact, etc, as well)

llvm-svn: 289976

7 years agoReapply "[LV] Enable vectorization of loops with conditional stores by default"
Matthew Simpson [Fri, 16 Dec 2016 19:12:02 +0000 (19:12 +0000)]
Reapply "[LV] Enable vectorization of loops with conditional stores by default"

This patch reapplies r289863. The original patch was reverted because it
exposed a bug causing the loop vectorizer to crash in the Python runtime on
PPC. The underlying issue was fixed with r289958.

llvm-svn: 289975

7 years agoImplement LaneBitmask::any(), use it to replace !none(), NFCI
Krzysztof Parzyszek [Fri, 16 Dec 2016 19:11:56 +0000 (19:11 +0000)]
Implement LaneBitmask::any(), use it to replace !none(), NFCI

llvm-svn: 289974

7 years agoFix CodeGenPrepare::stripInvariantGroupMetadata
Sanjoy Das [Fri, 16 Dec 2016 18:52:33 +0000 (18:52 +0000)]
Fix CodeGenPrepare::stripInvariantGroupMetadata

`dropUnknownNonDebugMetadata` takes a list of "known" metadata IDs.  The
only reason it worked at all is that `getMetadataID` returns something
unrelated -- it returns the subclass ID of the receiver (which is used
in `dyn_cast` etc.).  That does not numerically match
`LLVMContext::MD_invariant_group` and ends up dropping `invariant_group`
along with every other metadata that does not numerically match
`LLVMContext::MD_invariant_group`.

llvm-svn: 289973

7 years ago[ARM] Add ARMISD::VLD1DUP to match vld1_dup more consistently.
Eli Friedman [Fri, 16 Dec 2016 18:44:08 +0000 (18:44 +0000)]
[ARM] Add ARMISD::VLD1DUP to match vld1_dup more consistently.

Currently, there are substantial problems forming vld1_dup even if the
VDUP survives legalization. The lack of an actual node
leads to terrible results: not only can we not form post-increment vld1_dup
instructions, but we form scalar pre-increment and post-increment
loads which force the loaded value into a GPR. This patch fixes that
by combining the vdup+load into an ARMISD node before DAGCombine
messes it up.

Also includes a crash fix for vld2_dup (see testcase @vld2dupi8_postinc_variable).

Recommiting with fix to avoid forming vld1dup if the type of the load
doesn't match the type of the vdup (see
https://llvm.org/bugs/show_bug.cgi?id=31404).

Differential Revision: https://reviews.llvm.org/D27694

llvm-svn: 289972

7 years agoFollow-up for r289831: Lower the unjoined thread count to 100 in the libcxx-future...
Kuba Mracek [Fri, 16 Dec 2016 18:44:01 +0000 (18:44 +0000)]
Follow-up for r289831: Lower the unjoined thread count to 100 in the libcxx-future.mm testcase.

Turns out 1000 unjoined threads are a bit too rough in certain environments.

llvm-svn: 289971

7 years ago[analyzer] Fix crash in MallocChecker.
Devin Coughlin [Fri, 16 Dec 2016 18:41:40 +0000 (18:41 +0000)]
[analyzer] Fix crash in MallocChecker.

Fix a crash in the MallocChecker when the extent size for the argument
to new[] is not known.

A patch by Abramo Bagnara and Dániel Krupp!

https://reviews.llvm.org/D27849

Differential Revision: https://reviews.llvm.org/D27849

llvm-svn: 289970

7 years agoFix name typo in SelectonDAG
Joel Jones [Fri, 16 Dec 2016 18:22:54 +0000 (18:22 +0000)]
Fix name typo in SelectonDAG

llvm-svn: 289969

7 years ago[ELF] - Linkerscript: Implement two argument version of ALIGN()
Rui Ueyama [Fri, 16 Dec 2016 18:19:35 +0000 (18:19 +0000)]
[ELF] - Linkerscript: Implement two argument version of ALIGN()

Fixes http://llvm.org/PR31129

Patch by Alexander Richardson!

Differential Revision: https://reviews.llvm.org/D27848

llvm-svn: 289968

7 years agoAMDGPU: Fix name for v_ashrrev_i16
Matt Arsenault [Fri, 16 Dec 2016 17:40:11 +0000 (17:40 +0000)]
AMDGPU: Fix name for v_ashrrev_i16

llvm-svn: 289967

7 years ago[libFuzzer] Fix index error in SearchMemory() implementation for Windows.
Marcos Pividori [Fri, 16 Dec 2016 17:35:25 +0000 (17:35 +0000)]
[libFuzzer] Fix index error in SearchMemory() implementation for Windows.

Differential Revision: https://reviews.llvm.org/D27731

llvm-svn: 289966

7 years ago[libFuzzer] Remove unnecessary includes of posix headers.
Marcos Pividori [Fri, 16 Dec 2016 17:35:21 +0000 (17:35 +0000)]
[libFuzzer] Remove unnecessary includes of posix headers.

Remove includes of "unistd.h" header, which is missing in non posix
systems.

Differential Revision: https://reviews.llvm.org/D277300

llvm-svn: 289965

7 years ago[libFuzzer] Update tests to use more general functions instead of posix specific.
Marcos Pividori [Fri, 16 Dec 2016 17:35:13 +0000 (17:35 +0000)]
[libFuzzer] Update tests to use more general functions instead of posix specific.

Replace sleep() posix function by a more portable sleep_for() function
from std. Also, ignore memmem() and strcasestr() on Windows.

Differential Revision: https://reviews.llvm.org/D27729

llvm-svn: 289964

7 years ago[CMake] Put headers relative to clang
Chris Bieneman [Fri, 16 Dec 2016 17:30:51 +0000 (17:30 +0000)]
[CMake] Put headers relative to clang

When libcxx isn't building with an installed LLVM we copy the libcxx headers into the LLVM build directory so that a clang in that build tree can find the headers relative to itself.

This is only important in situations where you don't have headers installed under /, which is common these days on Darwin.

llvm-svn: 289963

7 years agoFix -Wself-assign from r289955
Hans Wennborg [Fri, 16 Dec 2016 17:16:46 +0000 (17:16 +0000)]
Fix -Wself-assign from r289955

llvm-svn: 289962

7 years agoRevert "dwarfdump: Support/process relocations on a CU's abbrev_off"
David Blaikie [Fri, 16 Dec 2016 17:10:17 +0000 (17:10 +0000)]
Revert "dwarfdump: Support/process relocations on a CU's abbrev_off"

Reverting because this breaks lld's gdb_index support - it's probably
double counting the abbrev relocation offset.

This reverts commit r289954.

llvm-svn: 289961

7 years agoRevert "[CodeGenPrep] Skip merging empty case blocks"
Jun Bum Lim [Fri, 16 Dec 2016 17:06:14 +0000 (17:06 +0000)]
Revert "[CodeGenPrep] Skip merging empty case blocks"

This reverts commit r289951.

llvm-svn: 289960

7 years ago[InstCombine] auto-generate checks; NFC
Sanjay Patel [Fri, 16 Dec 2016 16:58:54 +0000 (16:58 +0000)]
[InstCombine] auto-generate checks; NFC

llvm-svn: 289959

7 years ago[LV] Don't attempt to type-shrink scalarized instructions
Matthew Simpson [Fri, 16 Dec 2016 16:52:35 +0000 (16:52 +0000)]
[LV] Don't attempt to type-shrink scalarized instructions

After r288909, instructions feeding predicated instructions may be scalarized
if profitable. Since these instructions will remain scalar, we shouldn't
attempt to type-shrink them. We should only truncate vector types to their
minimal bit widths. This bug was exposed by enabling the vectorization of loops
containing conditional stores by default.

llvm-svn: 289958

7 years agoPass sample pgo flags to thinlto.
Dehao Chen [Fri, 16 Dec 2016 16:48:46 +0000 (16:48 +0000)]
Pass sample pgo flags to thinlto.

Summary: ThinLTO needs to invoke SampleProfileLoader pass during link time in order to annotate profile correctly after module importing.

Reviewers: davidxl, mehdi_amini, tejohnson

Subscribers: pcc, davide, llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D27790

llvm-svn: 289957

7 years agoFix broken escaping of commands in the build
Luke Drummond [Fri, 16 Dec 2016 16:38:25 +0000 (16:38 +0000)]
Fix broken escaping of commands in the build

A combination of broken escaping in CMake and in the python swig
generation scripts meant that the swig generation step would fail
whenever there were spaces or special characters in parameters passed to
swig.

The fix for this in CMakeLists is to use the VERBATIM option on all
COMMAND-based custom builders relying on CMake to properly escape each
argument in the generated file.

Within the python swig scripts, the fix is to call subprocess.Popen with
a list of raw argument strings rather than ones that are incorrectly
manually escaped, then passed to a shell subprocess via
subprocess.Popen(' '.join(params)). This also prevents nasty things
happening such as accidental command-injection.

This allows us to have the swig / python executables in paths containing
special chars and spaces, (or on shared storage on Win32, e.g
\\some\path or C:\Program Files\swig\swig.exe).

Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D26757

llvm-svn: 289956