platform/upstream/llvm.git
7 years agoFix build broken by changes in StringMatcher interface r290213
Vitaly Buka [Wed, 21 Dec 2016 02:27:14 +0000 (02:27 +0000)]
Fix build broken by changes in StringMatcher interface r290213

llvm-svn: 290231

7 years ago[Orc][RPC] Actually specialize SerializationTraits and RPCTypeName in the right
Lang Hames [Wed, 21 Dec 2016 02:08:23 +0000 (02:08 +0000)]
[Orc][RPC] Actually specialize SerializationTraits and RPCTypeName in the right
namespace.

r290226 was a think-o - just qualifying the name doesn't count.

llvm-svn: 290230

7 years agoFix defaulted-functions-in-C++98 extension to give the functions the same
Richard Smith [Wed, 21 Dec 2016 01:57:02 +0000 (01:57 +0000)]
Fix defaulted-functions-in-C++98 extension to give the functions the same
effect they would have in C++11. In particular, they do not prevent
value-initialization from performing zero-initialization, nor do they prevent a
struct from being an aggregate.

llvm-svn: 290229

7 years agomachine combiner: fix pretty printer
Sebastian Pop [Wed, 21 Dec 2016 01:41:12 +0000 (01:41 +0000)]
machine combiner: fix pretty printer

we used to print UNKNOWN instructions when the instruction to be printer was not
yet inserted in any BB: in that case the pretty printer would not be able to
compute a TII as the instruction does not belong to any BB or function yet.
This patch explicitly passes the TII to the pretty-printer.

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

llvm-svn: 290228

7 years ago[c++1z] When initializing a const-qualified class type, don't forget to add on
Richard Smith [Wed, 21 Dec 2016 01:31:56 +0000 (01:31 +0000)]
[c++1z] When initializing a const-qualified class type, don't forget to add on
the requested cv-qualifiers after construction. This usually doesn't matter,
but it does matter within a ?: operator.

llvm-svn: 290227

7 years ago[Orc][RPC] Specialize RPCTypeName and SerializationTraits in the right namespace.
Lang Hames [Wed, 21 Dec 2016 01:17:19 +0000 (01:17 +0000)]
[Orc][RPC] Specialize RPCTypeName and SerializationTraits in the right namespace.

llvm-svn: 290226

7 years agoFactor out checking of template arguments after deduction into a separate
Richard Smith [Wed, 21 Dec 2016 01:10:31 +0000 (01:10 +0000)]
Factor out checking of template arguments after deduction into a separate
function. (This change would also allow us to handle default template arguments
in partial specializations if the standard ever permits them.)

llvm-svn: 290225

7 years agoImprove natvis for llvm::SmallString so that it correctly displays only the valid...
Antonio Maiorano [Wed, 21 Dec 2016 01:05:29 +0000 (01:05 +0000)]
Improve natvis for llvm::SmallString so that it correctly displays only the valid portion of the string

The usual method, and the one employed before my change, of displaying strings in natvis is to make use of the "<variable>,s" format specifier; however, this method only works for null-terminated strings. My fix here is to use the "<pointer>,[size]" format specifier to display a bounded array, and then cast it to "const char*", which in the MSVC debugger has the desired effect of rendering the character array as a string.

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

llvm-svn: 290224

7 years ago[Orc] Add some static-assert checks to improve the error messages for RPC calls
Lang Hames [Wed, 21 Dec 2016 00:59:33 +0000 (00:59 +0000)]
[Orc] Add some static-assert checks to improve the error messages for RPC calls
and handler registrations.

Also add a unit test for alternate-type serialization/deserialization.

llvm-svn: 290223

7 years agoIPO: Remove the ModuleSummary argument to the FunctionImport pass. NFCI.
Peter Collingbourne [Wed, 21 Dec 2016 00:50:12 +0000 (00:50 +0000)]
IPO: Remove the ModuleSummary argument to the FunctionImport pass. NFCI.

No existing client is passing a non-null value here. This will come back
in a slightly different form as part of the type identifier summary work.

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

llvm-svn: 290222

7 years agoFix build breakage in r290219. Notes should not be in diagnostic groups.
Graydon Hoare [Wed, 21 Dec 2016 00:48:14 +0000 (00:48 +0000)]
Fix build breakage in r290219. Notes should not be in diagnostic groups.

llvm-svn: 290221

7 years ago[modules] Handle modules with nonstandard names in module.private.modulemaps
Graydon Hoare [Wed, 21 Dec 2016 00:24:39 +0000 (00:24 +0000)]
[modules] Handle modules with nonstandard names in module.private.modulemaps

Summary:
The module system supports accompanying a primary module (say Foo) with
an auxiliary "private" module (defined in an adjacent module.private.modulemap
file) that augments the primary module when associated private headers are
available. The feature is intended to be used to augment the primary
module with a submodule (say Foo.Private), however some users in the wild
are choosing to augment the primary module with an additional top-level module
with a "similar" name (in all cases so far: FooPrivate).

This "works" when a user of the module initially imports a private header,
such as '#import "Foo/something_private.h"' since the Foo import winds up
importing FooPrivate in passing. But if the import is subsequently recorded
in a PCH file, reloading the PCH will fail to validate because of a cross-check
that attempts to find the module.modulemap (or module.private.modulemap) using
HeaderSearch algorithm, applied to the "FooPrivate" name. Since it's stored in
Foo.framework/Modules, not FooPrivate.framework/Modules, the check fails and
the PCH is rejected.

This patch adds a compensatory workaround in the HeaderSearch algorithm
when searching (and failing to find) a module of the form FooPrivate: the
name used to derive filesystem paths is decoupled from the module name
being searched for, and if the initial search fails and the module is
named "FooPrivate", the filesystem search name is altered to remove the
"Private" suffix, and the algorithm is run a second time (still looking for
a module named FooPrivate, but looking in directories derived from Foo).

Accompanying this change is a new warning that triggers when a user loads
a module.private.modulemap that defines a top-level module with a different
name from the top-level module defined in its adjacent module.modulemap.

Reviewers: doug.gregor, manmanren, bruno

Subscribers: bruno, cfe-commits

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

llvm-svn: 290219

7 years agoReduce the size of quarantine cache in ASAN_LOW_MEMORY configuration.
Evgeniy Stepanov [Wed, 21 Dec 2016 00:18:10 +0000 (00:18 +0000)]
Reduce the size of quarantine cache in ASAN_LOW_MEMORY configuration.

Summary:
Experiments show that on Android the current values result in too much
of the memory consumption for all quarantined chunks.

Reviewers: kcc, eugenis

Subscribers: mgorny, danalbert, srhines, llvm-commits, kubabrecka

Patch by Aleksey Shlyapnikov.

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

llvm-svn: 290218

7 years agoStore the "current position" index within the ASTRecordReader.
David L. Jones [Wed, 21 Dec 2016 00:17:49 +0000 (00:17 +0000)]
Store the "current position" index within the ASTRecordReader.

Summary:
For ASTDeclReader and ASTStmtReader, every parameter "unsigned &Idx" ultimately
comes from a variable that is defined on the stack, next to the RecordData. This
change moves that index into the ASTRecordReader.

TypeLocReader cannot be transitioned, due to TableGen-generated code which calls
ASTReader::GetTypeSourceInfo.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 290217

7 years agoIgnore SIGPIPE in the mini-driver used by these tests.
Jim Ingham [Wed, 21 Dec 2016 00:12:54 +0000 (00:12 +0000)]
Ignore SIGPIPE in the mini-driver used by these tests.

We're seeing some very occasional failures in these tests where the
mini-driver dies with a SIGPIPE.  We don't use SIGPIPE for anything, and
the main lldb driver program already ignores SIGPIPE, so ignoring it in
the mini-driver is a good way to remove these spurious failures.

<rdar://problem/29740488>

llvm-svn: 290216

7 years agoMove a function defintion to make it static.
Rui Ueyama [Wed, 21 Dec 2016 00:05:39 +0000 (00:05 +0000)]
Move a function defintion to make it static.

llvm-svn: 290215

7 years ago[Analysis] Centralize objectsize lowering logic.
George Burgess IV [Tue, 20 Dec 2016 23:46:36 +0000 (23:46 +0000)]
[Analysis] Centralize objectsize lowering logic.

We're currently doing nearly the same thing for @llvm.objectsize in
three different places: two of them are missing checks for overflow,
and one of them could subtly break if InstCombine gets much smarter
about removing alloc sites. Seems like a good idea to not do that.

llvm-svn: 290214

7 years agoUse ArrayRef instead of `const std::vector`.
Rui Ueyama [Tue, 20 Dec 2016 23:17:00 +0000 (23:17 +0000)]
Use ArrayRef instead of `const std::vector`.

llvm-svn: 290213

7 years agoMove GlobPattern class from LLD to llvm/Support.
Rui Ueyama [Tue, 20 Dec 2016 23:09:09 +0000 (23:09 +0000)]
Move GlobPattern class from LLD to llvm/Support.

GlobPattern is a class to handle glob pattern matching. Currently
only LLD is using that, but technically that feature is not specific
to linkers, so in this patch I move that file to LLVM.

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

llvm-svn: 290212

7 years ago[SCEV] Be less conservative when extending bitwidths for computing ranges.
Michael Zolotukhin [Tue, 20 Dec 2016 23:03:42 +0000 (23:03 +0000)]
[SCEV] Be less conservative when extending bitwidths for computing ranges.

Summary:
In getRangeForAffineAR we compute ranges for affine exprs E = A + B*C,
where ranges for A, B, and C are known. To avoid overflow, we need to
operate on a bigger bitwidth, and originally we chose 2*x+1 for this
(x being the original bitwidth). However, it is safe to use just 2*x:

A+B*C <= (2^x - 1) + (2^x - 1)*(2^x - 1) =
       =  2^x - 1 + 2^2x - 2^x - 2^x + 1 =
       = 2^2x - 2^x <= 2^2x - 1

Unnecessary extending of bitwidths results in noticeable slowdowns: ranges
perform arithmetic operations using APInt, which are much slower when bitwidths
are bigger than 64.

Reviewers: sanjoy, majnemer, chandlerc

Subscribers: llvm-commits

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

llvm-svn: 290211

7 years agoComment out char16_t and char32_t tests
Malcolm Parsons [Tue, 20 Dec 2016 22:57:21 +0000 (22:57 +0000)]
Comment out char16_t and char32_t tests

llvm-svn: 290210

7 years agoRevert "[ObjectYAML] Support for DWARF debug_info section"
Chris Bieneman [Tue, 20 Dec 2016 22:36:42 +0000 (22:36 +0000)]
Revert "[ObjectYAML] Support for DWARF debug_info section"

This reverts commit r290204.

Still breaking bots... In a meeting now, so I can't fix it immediately.

Bot URL:
http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/2415

llvm-svn: 290209

7 years agoMake a test use a specific C++ dialect
Paul Robinson [Tue, 20 Dec 2016 22:30:44 +0000 (22:30 +0000)]
Make a test use a specific C++ dialect

In stack-reuse-miscompile.cpp, the allocas for the temps come out in
a different order depending on whether the dialect is C++03 or
C++11. Specify C++03 explicitly to avoid depending on the default.

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

llvm-svn: 290208

7 years agoC++11 test cleanup: nonthrowing destructors
Paul Robinson [Tue, 20 Dec 2016 22:26:11 +0000 (22:26 +0000)]
C++11 test cleanup: nonthrowing destructors

If a dtor has no interesting members, then it ends up being nothrow,
which affects the generated IR. Modify some tests to tolerate this
difference between C++03 and C++11.

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

llvm-svn: 290207

7 years ago[ELF] Do not warn about missed entry symbol in case of relocatable output
Simon Atanasyan [Tue, 20 Dec 2016 22:24:45 +0000 (22:24 +0000)]
[ELF] Do not warn about missed entry symbol in case of relocatable output

Relocatable file does not need to have an entry symbol so the warning is
useless in that case.

llvm-svn: 290206

7 years agoMake two vtable tests tolerate C++11.
Paul Robinson [Tue, 20 Dec 2016 22:22:24 +0000 (22:22 +0000)]
Make two vtable tests tolerate C++11.

In C++11 we don't emit vtables as eagerly as we do for C++03, so
fiddle the tests to emit them when the test expects them.

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

llvm-svn: 290205

7 years ago[ObjectYAML] Support for DWARF debug_info section
Chris Bieneman [Tue, 20 Dec 2016 21:35:31 +0000 (21:35 +0000)]
[ObjectYAML] Support for DWARF debug_info section

This patch adds support for YAML<->DWARF for debug_info sections.

This re-lands r290147, after fixing the issue that caused bots to fail (thank you UBSan!).

llvm-svn: 290204

7 years ago[c++1z] P0195R2: Support pack-expansion of using-declarations.
Richard Smith [Tue, 20 Dec 2016 21:35:28 +0000 (21:35 +0000)]
[c++1z] P0195R2: Support pack-expansion of using-declarations.

This change introduces UsingPackDecl as a marker for the set of UsingDecls
produced by pack expansion of a single (unresolved) using declaration. This is
not strictly necessary (we just need to be able to map from the original using
declaration to its expansions somehow), but it's useful to maintain the
invariant that each declaration reference instantiates to refer to one
declaration.

This is a re-commit of r290080 (reverted in r290092) with a fix for a
use-after-lifetime bug.

llvm-svn: 290203

7 years ago[clang-tidy] Add modernize-use-default-member-init check
Malcolm Parsons [Tue, 20 Dec 2016 21:26:07 +0000 (21:26 +0000)]
[clang-tidy] Add modernize-use-default-member-init check

Summary: Fixes PR18858

Reviewers: alexfh, hokein, aaron.ballman

Subscribers: JDevlieghere, Eugene.Zelenko, Prazek, mgorny, cfe-commits, modocache

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

llvm-svn: 290202

7 years ago[scudo] ARM32 support
Kostya Kortchinsky [Tue, 20 Dec 2016 21:17:58 +0000 (21:17 +0000)]
[scudo] ARM32 support

Summary:
With the previous modifications, the code works on ARM32. The random shuffle
test is unsupported on 32-bit platforms for the moment and being marked as
such. There is no hardware support for the checksum computation yet, this will
come at a later point.

Reviewers: kcc, alekseyshl

Subscribers: llvm-commits, aemerson, rengolin, mgorny

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

llvm-svn: 290201

7 years agoIR: Eliminate non-determinism in the module summary analysis.
Peter Collingbourne [Tue, 20 Dec 2016 21:12:28 +0000 (21:12 +0000)]
IR: Eliminate non-determinism in the module summary analysis.

Also make the summary ref and call graph vectors immutable. This means
a smaller API surface and fewer places to audit for non-determinism.

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

llvm-svn: 290200

7 years ago[LoopUnroll] Modify a comment to clarify the usage of TripCount. NFC.
Haicheng Wu [Tue, 20 Dec 2016 20:23:48 +0000 (20:23 +0000)]
[LoopUnroll] Modify a comment to clarify the usage of TripCount. NFC.

Make it clear that TripCount is the upper bound of the iteration on which
control exits LatchBlock.

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

llvm-svn: 290199

7 years ago[ARM] Implement isExtractSubvectorCheap.
Eli Friedman [Tue, 20 Dec 2016 20:05:07 +0000 (20:05 +0000)]
[ARM] Implement isExtractSubvectorCheap.

See https://reviews.llvm.org/D6678 for the history of
isExtractSubvectorCheap. Essentially the same considerations apply
to ARM.

This temporarily breaks the formation of vpadd/vpaddl in certain cases;
AddCombineToVPADDL essentially assumes that we won't form VUZP shuffles.
See https://reviews.llvm.org/D27779 for followup fix.

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

llvm-svn: 290198

7 years agoRollback my commit r290168 to fix linux tests failure. I'll be back!
Boris Ulasevich [Tue, 20 Dec 2016 20:00:58 +0000 (20:00 +0000)]
Rollback my commit r290168 to fix linux tests failure. I'll be back!

llvm-svn: 290197

7 years ago[ARM] Generate checks for shuffle tests using update_llc_test_checks.py.
Eli Friedman [Tue, 20 Dec 2016 19:33:24 +0000 (19:33 +0000)]
[ARM] Generate checks for shuffle tests using update_llc_test_checks.py.

llvm-svn: 290196

7 years agoUse MaxDepth instead of repeating its value
Matt Arsenault [Tue, 20 Dec 2016 19:06:15 +0000 (19:06 +0000)]
Use MaxDepth instead of repeating its value

llvm-svn: 290194

7 years agoAMDGPU: Allow 16-bit types in inline asm constraints
Matt Arsenault [Tue, 20 Dec 2016 19:06:12 +0000 (19:06 +0000)]
AMDGPU: Allow 16-bit types in inline asm constraints

llvm-svn: 290193

7 years agoAMDGPU: Run fp combine tests on VI
Matt Arsenault [Tue, 20 Dec 2016 18:55:11 +0000 (18:55 +0000)]
AMDGPU: Run fp combine tests on VI

llvm-svn: 290192

7 years agoAMDGPU: Don't add same instruction multiple times to worklist
Matt Arsenault [Tue, 20 Dec 2016 18:55:06 +0000 (18:55 +0000)]
AMDGPU: Don't add same instruction multiple times to worklist

When the instruction is processed the first time, it may be
deleted resulting in crashes. While the new test adds the same
user to the worklist twice, this particular case doesn't crash
but I'm not sure why.

llvm-svn: 290191

7 years agoReplace std::find_if with llvm::find_if. NFC.
George Burgess IV [Tue, 20 Dec 2016 18:46:27 +0000 (18:46 +0000)]
Replace std::find_if with llvm::find_if. NFC.

llvm-svn: 290190

7 years agoRevert "Re-add the assert to StringRef's const char *, length constructor."
Zachary Turner [Tue, 20 Dec 2016 18:05:47 +0000 (18:05 +0000)]
Revert "Re-add the assert to StringRef's const char *, length constructor."

This reverts commit r290188, which is causing internal compiler errors
on GCC 4.8

llvm-svn: 290189

7 years agoRe-add the assert to StringRef's const char *, length constructor.
Zachary Turner [Tue, 20 Dec 2016 17:57:56 +0000 (17:57 +0000)]
Re-add the assert to StringRef's const char *, length constructor.

By putting the assert behind a conditional in the initializer list
we can ensure that it will still work in a constexpr context as
the else branch of the ternary operator won't be examined unless
the condition fails.

llvm-svn: 290188

7 years agoFix missing '>' in docs (hopefully fixes bot error... )
David Blaikie [Tue, 20 Dec 2016 17:43:48 +0000 (17:43 +0000)]
Fix missing '>' in docs (hopefully fixes bot error... )

llvm-svn: 290187

7 years agoAdd some brief documentation about GDB pretty printers
David Blaikie [Tue, 20 Dec 2016 17:33:58 +0000 (17:33 +0000)]
Add some brief documentation about GDB pretty printers

llvm-svn: 290186

7 years agoAMDGPU/SI: Make a function const
Tom Stellard [Tue, 20 Dec 2016 17:26:34 +0000 (17:26 +0000)]
AMDGPU/SI: Make a function const

llvm-svn: 290185

7 years agoAMDGPU/SI: Add a MachineMemOperand when lowering llvm.amdgcn.buffer.load.*
Tom Stellard [Tue, 20 Dec 2016 17:19:44 +0000 (17:19 +0000)]
AMDGPU/SI: Add a MachineMemOperand when lowering llvm.amdgcn.buffer.load.*

Reviewers: arsenm, nhaehnle, mareko

Subscribers: kzhuravl, wdng, yaxunl, llvm-commits, tony-tye

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

llvm-svn: 290184

7 years ago[X86][SSE] Ensure we're only combining shuffles with legal mask types.
Simon Pilgrim [Tue, 20 Dec 2016 17:09:52 +0000 (17:09 +0000)]
[X86][SSE] Ensure we're only combining shuffles with legal mask types.

I haven't managed to get this to fail yet but its technically possible for the AND -> shuffle decomposition to result in illegal types.

llvm-svn: 290183

7 years ago[OPENMP] Fix for PR31416: Clang crashes on OMPCapturedExpr during source
Alexey Bataev [Tue, 20 Dec 2016 16:51:02 +0000 (16:51 +0000)]
[OPENMP] Fix for PR31416: Clang crashes on OMPCapturedExpr during source
based coverage compilation

Added source location info to captured expression declaration + fixed
source location info for loop based directives.

llvm-svn: 290181

7 years ago[CMake] [PR31433] Fix LLDB tool installation
Chris Bieneman [Tue, 20 Dec 2016 16:28:18 +0000 (16:28 +0000)]
[CMake] [PR31433] Fix LLDB tool installation

This resolves PR 31433.

llvm-svn: 290180

7 years agoAMDGPU/SI: Add a MachineMemOperand to MIMG instructions
Tom Stellard [Tue, 20 Dec 2016 15:52:17 +0000 (15:52 +0000)]
AMDGPU/SI: Add a MachineMemOperand to MIMG instructions

Summary:
Without a MachineMemOperand, the scheduler was assuming MIMG instructions
were ordered memory references, so no loads or stores could be reordered
across them.

Reviewers: arsenm

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, tony-tye

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

llvm-svn: 290179

7 years agoclang-format: Fix bug in understanding string-label&value analysis.
Daniel Jasper [Tue, 20 Dec 2016 15:27:46 +0000 (15:27 +0000)]
clang-format: Fix bug in understanding string-label&value analysis.

While for <<-operators often used in log statments, a single key value
pair is always on the second operator, e.g.

  llvm::errs() << "aaaaa=" << aaaaa;

It is on the first operator for plus- or comma-concatenated strings:

  string s = "aaaaaaaaaa: " + aaaaaaaa;

(the "=" not counting because that's a different operator precedence)

llvm-svn: 290177

7 years ago[change-namespace] do not fix calls to overloaded operator functions.
Eric Liu [Tue, 20 Dec 2016 14:39:04 +0000 (14:39 +0000)]
[change-namespace] do not fix calls to overloaded operator functions.

Summary: Also make sure one function reference is only processed once.

Reviewers: hokein

Subscribers: cfe-commits

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

llvm-svn: 290176

7 years ago[OPENMP] Fix for PR31428: variable named like directive name modifier
Alexey Bataev [Tue, 20 Dec 2016 12:10:05 +0000 (12:10 +0000)]
[OPENMP] Fix for PR31428: variable named like directive name modifier

Directive name modifiers in 'if' clause are allowed only for OpenMP 4.5
and higher + in OpenMP 4.5 parsing procedure emits error message if ':'
is not found after directive name modifier.

llvm-svn: 290175

7 years ago[ELF] - Treat .openbsd.randomdata as relro section
George Rimar [Tue, 20 Dec 2016 11:28:54 +0000 (11:28 +0000)]
[ELF] - Treat .openbsd.randomdata as relro section

That was requested by Mark Kettenis in llvm-dev:

"It is the intention that .openbsd.randomdata sections are made
read-only after initialization. The native (ld.bfd based) OpenBSD
toolchain accomplishes this by including .openbsd.randomdata into the
PT_GNU_RELRO segment."

He suggested code change, I added testcase.

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

llvm-svn: 290174

7 years agoRevert "[OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand."
Daniel Jasper [Tue, 20 Dec 2016 10:05:04 +0000 (10:05 +0000)]
Revert "[OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand."

This reverts commit r290171. It triggers a bunch of warnings, because
the new enumerator isn't handled in all switches. We want a warning-free
build.

Replied on the commit with more details.

llvm-svn: 290173

7 years agoFix for clang_Cursor_getSpellingNameRange()
Kevin Funk [Tue, 20 Dec 2016 09:56:56 +0000 (09:56 +0000)]
Fix for clang_Cursor_getSpellingNameRange()

Summary:
Fixes spelling name ranges for user-defined string literal operators.

Example:
  constexpr int operator""_toint(unsigned long long val)
  { return int(val); }

Before this patch the spelling name range on consisted of 'operator'.

After this patch: 'operator""_toint'.

Related to http://reviews.llvm.org/D5041, which fixes the function for
other cursor kinds.

Reviewers: akyrtzi, craigt, skalinichev, klimek, milianw, bkramer

Subscribers: cfe-commits

Tags: #clang-c

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

llvm-svn: 290172

7 years ago[OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand.
Egor Churaev [Tue, 20 Dec 2016 09:15:21 +0000 (09:15 +0000)]
[OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand.

Summary: Enabling the compression of CLK_NULL_QUEUE to variable of type queue_t.

Reviewers: Anastasia

Subscribers: cfe-commits, yaxunl, bader

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

llvm-svn: 290171

7 years agoFix build with expensive checks enabled
Serge Pavlov [Tue, 20 Dec 2016 08:48:51 +0000 (08:48 +0000)]
Fix build with expensive checks enabled

Include of llvm/IR/Verifier.h was removed from HexagonCommonGEP.cpp in r289604
as unused. In fact it is required when expensive checks are enabled, because
it declared function `verifyFunction`, which is called in conditionally compiled
part of the file.

llvm-svn: 290170

7 years agoRevert r290149: Add the alloc_size attribute to clang.
Chandler Carruth [Tue, 20 Dec 2016 08:28:19 +0000 (08:28 +0000)]
Revert r290149: Add the alloc_size attribute to clang.

This commit fails MSan when running test/CodeGen/object-size.c in
a confusing way. After some discussion with George, it isn't really
clear what is going on here. We can make the MSan failure go away by
testing for the invalid bit, but *why* things are invalid isn't clear.
And yet, other code in the surrounding area is doing precisely this and
testing for invalid.

George is going to take a closer look at this to better understand the
nature of the failure and recommit it, for now backing it out to clean
up MSan builds.

llvm-svn: 290169

7 years agoBug 30863 - Step doesn't stop with coditional breakpoint on the next line
Boris Ulasevich [Tue, 20 Dec 2016 08:09:50 +0000 (08:09 +0000)]
Bug 30863 - Step doesn't stop with coditional breakpoint on the next line
Fixed by additional completed plans detection, and applying them on breakpoint condition fail.
Thread::GetStopInfo reworked. New test added.
Review https://reviews.llvm.org/D26497
Many thanks to Jim

llvm-svn: 290168

7 years agoFix build breakage on FreeBSD after rL289878/rL289881
Dimitry Andric [Tue, 20 Dec 2016 07:58:49 +0000 (07:58 +0000)]
Fix build breakage on FreeBSD after rL289878/rL289881

Summary:
After rL289878/rL289881, the build on FreeBSD is broken, because
sanitizer_platform_limits_posix.cc attempts to include <utmp.h> and use
`struct utmp`, neither of which are supported anymore on FreeBSD.

Fix this by adding `&& !SANITIZER_FREEBSD` in a few places, and stop
intercepting utmp functions altogether for FreeBSD.

Reviewers: kubabrecka, emaste, eugenis, ed

Subscribers: ed, llvm-commits

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

llvm-svn: 290167

7 years agoAdd test for DR692.
Richard Smith [Tue, 20 Dec 2016 07:24:53 +0000 (07:24 +0000)]
Add test for DR692.

llvm-svn: 290166

7 years agoRemove extraneous space.
Rui Ueyama [Tue, 20 Dec 2016 05:49:56 +0000 (05:49 +0000)]
Remove extraneous space.

llvm-svn: 290165

7 years agoRemove `Compressed` member from InputSectionData.
Rui Ueyama [Tue, 20 Dec 2016 05:47:55 +0000 (05:47 +0000)]
Remove `Compressed` member from InputSectionData.

This value is used only once, and we can compute a value.
So we don't need to save it.

llvm-svn: 290164

7 years agoChange the timeout in CallBoardSystemServiceOpenApplication to
Jason Molenda [Tue, 20 Dec 2016 04:54:04 +0000 (04:54 +0000)]
Change the timeout in CallBoardSystemServiceOpenApplication to
30 seconds to match the old springboard timeout; the launcher
should time out before that and we will hopefully get back
an informative error message instead of timing out ourselves.

llvm-svn: 290163

7 years ago[PM] Rework a loop in the CGSCC update logic to be more conservative and
Chandler Carruth [Tue, 20 Dec 2016 03:32:17 +0000 (03:32 +0000)]
[PM] Rework a loop in the CGSCC update logic to be more conservative and
clear. The current RefSCC can occur in exactly one position so we should
just enforce that and leverage the property rather than checking for it
anywhere.

This addresses review comments made on another patch.

llvm-svn: 290162

7 years ago[PM] Provide an initial, minimal port of the inliner to the new pass manager.
Chandler Carruth [Tue, 20 Dec 2016 03:15:32 +0000 (03:15 +0000)]
[PM] Provide an initial, minimal port of the inliner to the new pass manager.

This doesn't implement *every* feature of the existing inliner, but
tries to implement the most important ones for building a functional
optimization pipeline and beginning to sort out bugs, regressions, and
other problems.

Notable, but intentional omissions:
- No alloca merging support. Why? Because it isn't clear we want to do
  this at all. Active discussion and investigation is going on to remove
  it, so for simplicity I omitted it.
- No support for trying to iterate on "internally" devirtualized calls.
  Why? Because it adds what I suspect is inappropriate coupling for
  little or no benefit. We will have an outer iteration system that
  tracks devirtualization including that from function passes and
  iterates already. We should improve that rather than approximate it
  here.
- Optimization remarks. Why? Purely to make the patch smaller, no other
  reason at all.

The last one I'll probably work on almost immediately. But I wanted to
skip it in the initial patch to try to focus the change as much as
possible as there is already a lot of code moving around and both of
these *could* be skipped without really disrupting the core logic.

A summary of the different things happening here:

1) Adding the usual new PM class and rigging.

2) Fixing minor underlying assumptions in the inline cost analysis or
   inline logic that don't generally hold in the new PM world.

3) Adding the core pass logic which is in essence a loop over the calls
   in the nodes in the call graph. This is a bit duplicated from the old
   inliner, but only a handful of lines could realistically be shared.
   (I tried at first, and it really didn't help anything.) All told,
   this is only about 100 lines of code, and most of that is the
   mechanics of wiring up analyses from the new PM world.

4) Updating the LazyCallGraph (in the new PM) based on the *newly
   inlined* calls and references. This is very minimal because we cannot
   form cycles.

5) When inlining removes the last use of a function, eagerly nuking the
   body of the function so that any "one use remaining" inline cost
   heuristics are immediately refined, and queuing these functions to be
   completely deleted once inlining is complete and the call graph
   updated to reflect that they have become dead.

6) After all the inlining for a particular function, updating the
   LazyCallGraph and the CGSCC pass manager to reflect the
   function-local simplifications that are done immediately and
   internally by the inline utilties. These are the exact same
   fundamental set of CG updates done by arbitrary function passes.

7) Adding a bunch of test cases to specifically target CGSCC and other
   subtle aspects in the new PM world.

Many thanks to the careful review from Easwaran and Sanjoy and others!

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

llvm-svn: 290161

7 years agoFix a bug that the glob pattern parser falls in an infinite loop for invalid patterns.
Rui Ueyama [Tue, 20 Dec 2016 03:12:28 +0000 (03:12 +0000)]
Fix a bug that the glob pattern parser falls in an infinite loop for invalid patterns.

llvm-svn: 290160

7 years agoFix the spelling of 'bitfield' in diagnostics to be consistently 'bit-field'.
Chandler Carruth [Tue, 20 Dec 2016 02:43:58 +0000 (02:43 +0000)]
Fix the spelling of 'bitfield' in diagnostics to be consistently 'bit-field'.

The latter agrees with most existing diagnostics and the C and C++ standards.

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

llvm-svn: 290159

7 years agoReapply r289926: attempt to fix windows build
Adrian Prantl [Tue, 20 Dec 2016 02:33:30 +0000 (02:33 +0000)]
Reapply r289926: attempt to fix windows build

llvm-svn: 290158

7 years agoSet Config->ColorDiagnostics early so that all error messages are colored.
Rui Ueyama [Tue, 20 Dec 2016 02:17:24 +0000 (02:17 +0000)]
Set Config->ColorDiagnostics early so that all error messages are colored.

Previously, some errors that were checked before we set to
Config->ColorDiagnostics weren't colored. This patch moves the code
to set the variable so that such error messages are colored just like
other error messages.

llvm-svn: 290157

7 years ago[Parser] Correct typo after lambda capture initializer is parsed.
Akira Hatanaka [Tue, 20 Dec 2016 02:11:29 +0000 (02:11 +0000)]
[Parser] Correct typo after lambda capture initializer is parsed.

This patch fixes an assertion that is triggered when RecordLayoutBuilder
tries to compute the size of a field (for capture "name" in the test
case) whose type hasn't been deduced. The patch fixes the bug by
correcting the typo of the capture initializer after the initializer is
parsed and before setting the expression for the annotation token.

Fixes PR30566.

rdar://problem/23380132

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

llvm-svn: 290156

7 years agoUpdate for LLVM global variable debug info API change.
Adrian Prantl [Tue, 20 Dec 2016 02:10:02 +0000 (02:10 +0000)]
Update for LLVM global variable debug info API change.

This reapplies r289921.

llvm-svn: 290155

7 years agoFix debug info metadata for upstream change in LLVM.
Adrian Prantl [Tue, 20 Dec 2016 02:09:59 +0000 (02:09 +0000)]
Fix debug info metadata for upstream change in LLVM.

llvm-svn: 290154

7 years ago[IR] Remove the DIExpression field from DIGlobalVariable.
Adrian Prantl [Tue, 20 Dec 2016 02:09:43 +0000 (02:09 +0000)]
[IR] Remove the DIExpression field from DIGlobalVariable.

This patch implements PR31013 by introducing a
DIGlobalVariableExpression that holds a pair of DIGlobalVariable and
DIExpression.

Currently, DIGlobalVariables holds a DIExpression. This is not the
best way to model this:

(1) The DIGlobalVariable should describe the source level variable,
    not how to get to its location.

(2) It makes it unsafe/hard to update the expressions when we call
    replaceExpression on the DIGLobalVariable.

(3) It makes it impossible to represent a global variable that is in
    more than one location (e.g., a variable with multiple
    DW_OP_LLVM_fragment-s).  We also moved away from attaching the
    DIExpression to DILocalVariable for the same reasons.

This reapplies r289902 with additional testcase upgrades and a change
to the Bitcode record for DIGlobalVariable, that makes upgrading the
old format unambiguous also for variables without DIExpressions.

<rdar://problem/29250149>
https://llvm.org/bugs/show_bug.cgi?id=31013
Differential Revision: https://reviews.llvm.org/D26769

llvm-svn: 290153

7 years agoMake this REQUIRES match the other REQUIRES lines that mention requiring
Chandler Carruth [Tue, 20 Dec 2016 01:57:31 +0000 (01:57 +0000)]
Make this REQUIRES match the other REQUIRES lines that mention requiring
a darwin system.

llvm-svn: 290152

7 years agoSimplify type of Config->SymbolOrderingFile.
Rui Ueyama [Tue, 20 Dec 2016 01:51:08 +0000 (01:51 +0000)]
Simplify type of Config->SymbolOrderingFile.

That variable was of type DenseMap<StringRef, unsigned>, but the
unsigned numbers needed to be monotonicly increasing numbers because
the implementation that used the variable depended on that fact.
That was an implementation detail and shouldn't have leaked into Config.

This patch simplifies its type to std::vector<StringRef>.

llvm-svn: 290151

7 years agoInline a small function.
Rui Ueyama [Tue, 20 Dec 2016 01:34:31 +0000 (01:34 +0000)]
Inline a small function.

llvm-svn: 290150

7 years agoAdd the alloc_size attribute to clang.
George Burgess IV [Tue, 20 Dec 2016 01:05:42 +0000 (01:05 +0000)]
Add the alloc_size attribute to clang.

This patch does three things:

- Gives us the alloc_size attribute in clang, which lets us infer the
  number of bytes handed back to us by malloc/realloc/calloc/any user
  functions that act in a similar manner.
- Teaches our constexpr evaluator that evaluating some `const` variables
  is OK sometimes. This is why we have a change in
  test/SemaCXX/constant-expression-cxx11.cpp and other seemingly
  unrelated tests. Richard Smith okay'ed this idea some time ago in
  person.
- Uniques some Blocks in CodeGen, which was reviewed separately at
  D26410. Lack of uniquing only really shows up as a problem when
  combined with our new eagerness in the face of const.

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

llvm-svn: 290149

7 years agoRevert "[ObjectYAML] Support for DWARF debug_info section"
Chris Bieneman [Tue, 20 Dec 2016 00:42:06 +0000 (00:42 +0000)]
Revert "[ObjectYAML] Support for DWARF debug_info section"

This reverts commit r290147.

This commit is breaking a bot (http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/621). I don't have time to investigate at the moment, so I'll revert for now.

llvm-svn: 290148

7 years ago[ObjectYAML] Support for DWARF debug_info section
Chris Bieneman [Tue, 20 Dec 2016 00:26:24 +0000 (00:26 +0000)]
[ObjectYAML] Support for DWARF debug_info section

This patch adds support for YAML<->DWARF for debug_info sections.

llvm-svn: 290147

7 years agoFix completely bogus types for some builtins:
Richard Smith [Mon, 19 Dec 2016 23:59:34 +0000 (23:59 +0000)]
Fix completely bogus types for some builtins:

 * In C++, never create a FunctionNoProtoType for a builtin (fixes C++1z
   crasher from r289754).

 * Fix type of __sync_synchronize to be a no-parameter function rather than a
   varargs function. This matches GCC.

 * Fix type of vfprintf to match its actual type. We gave it a wrong type due
   to PR4290 (apparently autoconf generates invalid code and expects compilers
   to choke it down or it miscompiles the program; the relevant error in clang
   was downgraded to a warning in r122744 to fix other occurrences of this
   autoconf brokenness, so we don't need this workaround any more).

 * Turn off vararg argument checking for __noop, since it's not *really* a
   varargs function. Alternatively we could add custom type checking for it
   and synthesize parameter types matching the actual arguments in each call,
   but that seemed like overkill.

llvm-svn: 290146

7 years agoMake another test insensitive to the default C++ dialect.
Paul Robinson [Mon, 19 Dec 2016 23:32:10 +0000 (23:32 +0000)]
Make another test insensitive to the default C++ dialect.

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

llvm-svn: 290145

7 years agoAdd ARM support to update_llc_test_checks.py
Eli Friedman [Mon, 19 Dec 2016 23:09:51 +0000 (23:09 +0000)]
Add ARM support to update_llc_test_checks.py

Just the minimal support to get it working at the moment.

Includes checks for test/CodeGen/ARM/vzip.ll as an example.

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

llvm-svn: 290144

7 years ago[analyzer] Add checker modeling gtest APIs.
Devin Coughlin [Mon, 19 Dec 2016 22:50:31 +0000 (22:50 +0000)]
[analyzer] Add checker modeling gtest APIs.

gtest is a widely-used unit-testing API. It provides macros for unit test
assertions:

  ASSERT_TRUE(p != nullptr);

that expand into an if statement that constructs an object representing
the result of the assertion and returns when the assertion is false:

  if (AssertionResult gtest_ar_ = AssertionResult(p == nullptr))
      ;
  else
    return ...;

Unfortunately, the analyzer does not model the effect of the constructor
precisely because (1) the copy constructor implementation is missing from the
the header (so it can't be inlined) and (2) the boolean-argument constructor
is constructed into a temporary (so the analyzer decides not to inline it since
it doesn't reliably call temporary destructors right now).

This results in false positives because the analyzer does not realize that the
the assertion must hold along the non-return path.

This commit addresses the false positives by explicitly modeling the effects
of the two un-inlined constructors on the AssertionResult state.

I've added a new package, "apiModeling", for these kinds of checkers that
model APIs but don't emit any diagnostics. I envision all the checkers in
this package always being on by default.

This addresses the false positives reported in PR30936.

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

rdar://problem/22705813

llvm-svn: 290143

7 years ago[LV] Sink tripcount query to where it's actually used. NFC.
Michael Kuperstein [Mon, 19 Dec 2016 22:47:52 +0000 (22:47 +0000)]
[LV] Sink tripcount query to where it's actually used. NFC.

llvm-svn: 290142

7 years agoDon't try to emit nullability fix-its within/around macros.
Jordan Rose [Mon, 19 Dec 2016 22:35:24 +0000 (22:35 +0000)]
Don't try to emit nullability fix-its within/around macros.

The newly-added notes from r290132 are too noisy even when the fix-it
is valid. For the existing warning from r286521, it's probably the
right decision 95% of the time to put the change outside the macro if
the array is outside the macro and inside otherwise, but I don't want
to overthink it right now.

Caught by the ASan bot!

More rdar://problem/29524992

llvm-svn: 290141

7 years ago[analyzer] Add sink after construction of temporary with no-return destructor.
Devin Coughlin [Mon, 19 Dec 2016 22:23:22 +0000 (22:23 +0000)]
[analyzer] Add sink after construction of temporary with no-return destructor.

The analyzer's CFG currently doesn't have nodes for calls to temporary
destructors. This causes the analyzer to explore infeasible paths in which
a no-return destructor would have stopped exploration and so results in false
positives when no-return destructors are used to implement assertions.

To mitigate these false positives, this patch stops generates a sink after
evaluating a constructor on a temporary object that has a no-return destructor.
This results in a loss of coverage because the time at which the destructor is
called may be after the time of construction (especially for lifetime-extended
temporaries).

This addresses PR15599.

rdar://problem/29131566

llvm-svn: 290140

7 years ago[ObjectYAML] Support for DWARF Pub Sections
Chris Bieneman [Mon, 19 Dec 2016 22:22:12 +0000 (22:22 +0000)]
[ObjectYAML] Support for DWARF Pub Sections

This patch adds support for YAML<->DWARF round tripping for pub* section data. The patch supports both GNU and non-GNU style entries.

llvm-svn: 290139

7 years ago[libfuzzer] dump_coverage command line flag
Mike Aizatsky [Mon, 19 Dec 2016 22:18:08 +0000 (22:18 +0000)]
[libfuzzer] dump_coverage command line flag

Reviewers: kcc, vitalybuka

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

llvm-svn: 290138

7 years ago[Axccel] Remove -Wno-missing-braces in build
Jason Henline [Mon, 19 Dec 2016 21:34:07 +0000 (21:34 +0000)]
[Axccel] Remove -Wno-missing-braces in build

Summary:
I originally added the -Wno-missing-braces flag because I thought it was
erroneously flagging std::array initializations. Now I realize the extra
braces really are desired for these initializations, so I'm turning the
warning flag back on.

Reviewers: jlebar

Subscribers: mgorny, parallel_libs-commits

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

llvm-svn: 290137

7 years agoFix corner cases of setting the section address.
Rafael Espindola [Mon, 19 Dec 2016 21:21:07 +0000 (21:21 +0000)]
Fix corner cases of setting the section address.

This handles all the corner cases if setting a section address:

- If the address is too low, we cannot allocate the program headers.
- If the load address is lowered, we have to do that before finalize

This also shares some code with the linker script since it was already
hitting similar cases.

This is used by the freebsd boot loader. It is not clear if we need to
support this with a non binary output, but it is not as bad as I was
expecting.

llvm-svn: 290136

7 years ago[Format] Remove dead code.
Benjamin Kramer [Mon, 19 Dec 2016 21:10:50 +0000 (21:10 +0000)]
[Format] Remove dead code.

No functionality change.

llvm-svn: 290135

7 years ago[ASTReader] Sort RawComments before merging
Bruno Cardoso Lopes [Mon, 19 Dec 2016 21:06:06 +0000 (21:06 +0000)]
[ASTReader] Sort RawComments before merging

`RawComments` are sorted by comparing underlying `SourceLocation`'s. This is
done by comparing `FileID` and `Offset`; when the `FileID` is the same it means
the locations are within the same TU and the `Offset` is used.

FileID, from the source code: "A mostly-opaque identifier, where 0 is
"invalid", >0 is this module, and <-1 is something loaded from another
module.". That said, when de-serializing SourceLocations, FileID's from
RawComments loaded from other modules get negative IDs where previously they
were positive. This makes imported RawComments unsorted, leading to a wrong
merge with other comments from the current TU. Fix that by sorting RawComments
properly after de-serialization and before merge.

This fixes an assertion in `ASTContext::getRawCommentForDeclNoCache`,
which fires only in a debug build of clang.

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

rdar://problem/29287314

llvm-svn: 290134

7 years ago[TargetInstrInfo] replace redundant expression in getMemOpBaseRegImmOfs
Michael LeMay [Mon, 19 Dec 2016 21:02:41 +0000 (21:02 +0000)]
[TargetInstrInfo] replace redundant expression in getMemOpBaseRegImmOfs

Summary:
The expression for computing the return value of getMemOpBaseRegImmOfs has only
one possible value. The other value would result in a return earlier in the
function. This patch replaces the expression with its only possible value.

Reviewers: sanjoy

Subscribers: llvm-commits

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

llvm-svn: 290133

7 years agoAdd fix-it notes to the nullability consistency warning.
Jordan Rose [Mon, 19 Dec 2016 20:58:20 +0000 (20:58 +0000)]
Add fix-it notes to the nullability consistency warning.

This is especially important for arrays, since no one knows the proper
syntax for putting qualifiers in arrays.

    nullability.h:3:26: warning: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)
    void arrayParameter(int x[]);
                             ^
    nullability.h:3:26: note: insert '_Nullable' if the array parameter may be null
    void arrayParameter(int x[]);
                             ^
                              _Nullable
    nullability.h:3:26: note: insert '_Nonnull' if the array parameter should never be null
    void arrayParameter(int x[]);
                             ^
                              _Nonnull

rdar://problem/29524992

llvm-svn: 290132

7 years agoMake a function to correctly extract the DW_AT_high_pc given the low pc value.
Greg Clayton [Mon, 19 Dec 2016 20:36:41 +0000 (20:36 +0000)]
Make a function to correctly extract the DW_AT_high_pc given the low pc value.

DWARF 4 and later supports encoding the PC as an address or as as offset from the low PC. Clients using DWARFDie should be insulated from how to extract the high PC value. This function takes care of extracting the form value and looking for the correct form.

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

llvm-svn: 290131

7 years agoReverting r290004, r290006, r290010 pending review.
Sean Callanan [Mon, 19 Dec 2016 19:15:43 +0000 (19:15 +0000)]
Reverting r290004, r290006, r290010 pending review.

llvm-svn: 290130

7 years agoFixup for r290119: Only run debug_alloc_stack.cc on Darwin until I figure out how...
Kuba Mracek [Mon, 19 Dec 2016 18:54:34 +0000 (18:54 +0000)]
Fixup for r290119: Only run debug_alloc_stack.cc on Darwin until I figure out how to make it work on Linux.

llvm-svn: 290129

7 years agoMake a few OpenMP tests "C++11 clean."
Paul Robinson [Mon, 19 Dec 2016 18:43:26 +0000 (18:43 +0000)]
Make a few OpenMP tests "C++11 clean."

This time trying to commit just the relevant 3 tests!
Reviewed by abataev (in D27794)

llvm-svn: 290128