platform/upstream/llvm.git
7 years ago[llvm-cxxfilt] Use llvm::outs(). Simplify.
Davide Italiano [Tue, 27 Sep 2016 18:50:30 +0000 (18:50 +0000)]
[llvm-cxxfilt] Use llvm::outs(). Simplify.

This adds a dependency on Support/. As llvm-cxxfilt will grow
support for options this will be needed anyway.

llvm-svn: 282523

7 years ago[x86] use isNullFPConstant(); NFCI
Sanjay Patel [Tue, 27 Sep 2016 18:48:02 +0000 (18:48 +0000)]
[x86] use isNullFPConstant(); NFCI

Also, put the related FP logic functions together to see the similarities.

llvm-svn: 282522

7 years ago[DebugInfo] Add comments to phi dbg.value tracking code, NFC
Reid Kleckner [Tue, 27 Sep 2016 18:45:31 +0000 (18:45 +0000)]
[DebugInfo] Add comments to phi dbg.value tracking code, NFC

LLVM developers might be surprised to learn that there are blocks
without valid insertion points (catchswitch), so it seems worth calling
that out explicitly.  Also add a FIXME about what we should really be
doing if we ever need to make optimized Windows EH code debuggable.

While I'm here, make auto usage more consistent with LLVM standards and
avoid an unecessary call to insertBefore.

llvm-svn: 282521

7 years ago[RDF] Add "dead" flag to node attributes
Krzysztof Parzyszek [Tue, 27 Sep 2016 18:24:33 +0000 (18:24 +0000)]
[RDF] Add "dead" flag to node attributes

llvm-svn: 282520

7 years ago[RDF] Special treatment of exception handling registers
Krzysztof Parzyszek [Tue, 27 Sep 2016 18:18:44 +0000 (18:18 +0000)]
[RDF] Special treatment of exception handling registers

A landing pad can have live-in registers that are defined by the runtime,
not the program (exception pointer register and exception selector
register). Make sure to recognize that case and not link these registers
with any defs in the program.
Each landing pad will have phi nodes added at the beginning to provide
definitions of these registers, but the uses of those phi nodes will not
have any reaching defs.

llvm-svn: 282519

7 years agoImprove CMake output of host and target triple
Chris Bieneman [Tue, 27 Sep 2016 18:08:40 +0000 (18:08 +0000)]
Improve CMake output of host and target triple

Summary:
The previous output was confusing as it would output "Taget triple:
x86_64-unknown-linux-gnu" even when LLVM_HOST_TRIPLE or
LLVM_DEFAULT_TARGET_TRIPLE were set on the CMake command line

Patch by: Alex Richardson!

Reviewers: beanz

Subscribers: Eugene.Zelenko

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

llvm-svn: 282516

7 years ago[SCEV] Replace a struct with a function; NFC
Sanjoy Das [Tue, 27 Sep 2016 18:01:48 +0000 (18:01 +0000)]
[SCEV] Replace a struct with a function; NFC

We can do this now thanks to C++11 lambdas.

llvm-svn: 282515

7 years ago[SCEV] Use find instead of find_as; NFC
Sanjoy Das [Tue, 27 Sep 2016 18:01:46 +0000 (18:01 +0000)]
[SCEV] Use find instead of find_as; NFC

We don't need the extra generality here.

llvm-svn: 282514

7 years ago[SCEV] Reduce the scope of a struct; NFC
Sanjoy Das [Tue, 27 Sep 2016 18:01:44 +0000 (18:01 +0000)]
[SCEV] Reduce the scope of a struct; NFC

llvm-svn: 282513

7 years ago[SCEV] Remove custom RAII wrapper; NFC
Sanjoy Das [Tue, 27 Sep 2016 18:01:42 +0000 (18:01 +0000)]
[SCEV] Remove custom RAII wrapper; NFC

Instead use the pre-existing `scope_exit` class.

llvm-svn: 282512

7 years ago[SCEV] Make PendingLoopPredicates more frugal; NFCI
Sanjoy Das [Tue, 27 Sep 2016 18:01:38 +0000 (18:01 +0000)]
[SCEV] Make PendingLoopPredicates more frugal; NFCI

I don't expect `PendingLoopPredicates` to have very many
elements (e.g. when -O3'ing the sqlite3 amalgamation,
`PendingLoopPredicates` has at most 3 elements).  So now we use a
`SmallPtrSet` for it instead of the more heavyweight `DenseSet`.

llvm-svn: 282511

7 years ago[CMake] Use if(... IN_LIST ...) instead of list(FIND...)
Chris Bieneman [Tue, 27 Sep 2016 17:47:24 +0000 (17:47 +0000)]
[CMake] Use if(... IN_LIST ...) instead of list(FIND...)

NFC. This is just a little code cleanup to make things easier to read and understand.

llvm-svn: 282510

7 years agoMixed type atomic routines for unsigned integers.
Jonathan Peyton [Tue, 27 Sep 2016 17:38:48 +0000 (17:38 +0000)]
Mixed type atomic routines for unsigned integers.

New routines should be used for atomics like "<int>OP=<float>" when <int> is
unsigned. Using functions __kmpc_atomic_fixed<bits>_<op>_fp) produces incorrect
results

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

llvm-svn: 282509

7 years agoconvert TestFatArchives.py over to no-debug-info test
Todd Fiala [Tue, 27 Sep 2016 17:17:21 +0000 (17:17 +0000)]
convert TestFatArchives.py over to no-debug-info test

We only use the .o-style debug info here regardless, so having
it run all three debuginfo styles was a waste.

This also strips out the custom build function and uses the
TestBase.build() method.

llvm-svn: 282508

7 years agoDisable monitor thread creation by default.
Jonathan Peyton [Tue, 27 Sep 2016 17:11:17 +0000 (17:11 +0000)]
Disable monitor thread creation by default.

This change set disables creation of the monitor thread by default.  The global
counter maintained by the monitor thread was replaced by logic that uses system
time directly, and cyclic yielding on Linux target was also removed since there
was no clear benefit of using it. Turning on KMP_USE_MONITOR variable (=1)
enables creation of monitor thread again if it is really necessary for some
reasons.

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

llvm-svn: 282507

7 years agoPropagate DBG_VALUE entries when there are unvisited predecessors
Keith Walker [Tue, 27 Sep 2016 16:46:07 +0000 (16:46 +0000)]
Propagate DBG_VALUE entries when there are unvisited predecessors

Variables are sometimes missing their debug location information in
blocks in which the variables should be available. This would occur
when one or more predecessor blocks had not yet been visited by the
routine which propagated the information from predecessor blocks.

This is addressed by only considering predecessor blocks which have
already been visited.

The solution to this problem was suggested by Daniel Berlin on the
LLVM developer mailing list.

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

llvm-svn: 282506

7 years agoUse xxhash for fast --build-id.
Rafael Espindola [Tue, 27 Sep 2016 16:43:49 +0000 (16:43 +0000)]
Use xxhash for fast --build-id.

The speed improvements I got were:

firefox
  master 7.050784981
  patch  6.842361079 0.970439617353
chromium
  master 4.260626249
  patch  4.183148025 0.981815296749
chromium fast
  master 1.829028591
  patch  1.806439277 0.987649556649
the gold plugin
  master 0.336154128
  patch  0.331893374 0.987324998728
clang
  master 0.561869781
  patch  0.558640828 0.994253200458
llvm-as
  master 0.034025959
  patch  0.033984389 0.99877828572
the gold plugin fsds
  master 0.360710529
  patch  0.356483564 0.988281559145
clang fsds
  master 0.640518422
  patch  0.632329874 0.987215749432
llvm-as fsds
  master 0.031569416
  patch  0.030822055 0.976326423017
scylla
  master 3.154770529
  patch  3.11982016 0.988921422754

llvm-svn: 282505

7 years agoRevert "Adapt to LLVM optimization remark interface change. NFC"
Adam Nemet [Tue, 27 Sep 2016 16:39:27 +0000 (16:39 +0000)]
Revert "Adapt to LLVM optimization remark interface change. NFC"

This reverts commit r282500.

llvm-svn: 282504

7 years agoRevert "Output optimization remarks in YAML"
Adam Nemet [Tue, 27 Sep 2016 16:39:24 +0000 (16:39 +0000)]
Revert "Output optimization remarks in YAML"

This reverts commit r282499.

The GCC bots are failing

llvm-svn: 282503

7 years agoAdd llvm::join_items to StringExtras.
Zachary Turner [Tue, 27 Sep 2016 16:37:30 +0000 (16:37 +0000)]
Add llvm::join_items to StringExtras.

llvm::join_items is similar to llvm::join, which produces a string
by concatenating a sequence of values together separated by a
given separator.  But it differs in that the arguments to
llvm::join() are same-type members of a container, whereas the
arguments to llvm::join_items are arbitrary types passed into
a variadic template.  The only requirement on parameters to
llvm::join_items (including for the separator themselves) is
that they be implicitly convertible to std::string or have
an overload of std::string::operator+

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

llvm-svn: 282502

7 years ago[lit] Fix refacto introduced by rL282479.
Daniel Dunbar [Tue, 27 Sep 2016 16:17:42 +0000 (16:17 +0000)]
[lit] Fix refacto introduced by rL282479.

llvm-svn: 282501

7 years agoAdapt to LLVM optimization remark interface change. NFC
Adam Nemet [Tue, 27 Sep 2016 16:15:21 +0000 (16:15 +0000)]
Adapt to LLVM optimization remark interface change. NFC

llvm-svn: 282500

7 years agoOutput optimization remarks in YAML
Adam Nemet [Tue, 27 Sep 2016 16:15:16 +0000 (16:15 +0000)]
Output optimization remarks in YAML

This allows various presentation of this data using an external tool.
This was first recommended here[1].

As an example, consider this module:

  1 int foo();
  2 int bar();
  3
  4 int baz() {
  5   return foo() + bar();
  6 }

The inliner generates these missed-optimization remarks today (the
hotness information is pulled from PGO):

  remark: /tmp/s.c:5:10: foo will not be inlined into baz (hotness: 30)
  remark: /tmp/s.c:5:18: bar will not be inlined into baz (hotness: 30)

Now with -pass-remarks-output=<yaml-file>, we generate this YAML file:

  --- !Missed
  Pass:            inline
  Name:            NotInlined
  DebugLoc:        { File: /tmp/s.c, Line: 5, Column: 10 }
  Function:        baz
  Hotness:         30
  Args:
    - Callee: foo
    - String:  will not be inlined into
    - Caller: baz
  ...
  --- !Missed
  Pass:            inline
  Name:            NotInlined
  DebugLoc:        { File: /tmp/s.c, Line: 5, Column: 18 }
  Function:        baz
  Hotness:         30
  Args:
    - Callee: bar
    - String:  will not be inlined into
    - Caller: baz
  ...

This is a summary of the high-level decisions:

* There is a new streaming interface to emit optimization remarks.
E.g. for the inliner remark above:

   ORE.emit(DiagnosticInfoOptimizationRemarkMissed(
                DEBUG_TYPE, "NotInlined", &I)
            << NV("Callee", Callee) << " will not be inlined into "
            << NV("Caller", CS.getCaller()) << setIsVerbose());

NV stands for named value and allows the YAML client to process a remark
using its name (NotInlined) and the named arguments (Callee and Caller)
without parsing the text of the message.

Subsequent patches will update ORE users to use the new streaming API.

* I am using YAML I/O for writing the YAML file.  YAML I/O requires you
to specify reading and writing at once but reading is highly non-trivial
for some of the more complex LLVM types.  Since it's not clear that we
(ever) want to use LLVM to parse this YAML file, the code supports and
asserts that we're writing only.

On the other hand, I did experiment that the class hierarchy starting at
DiagnosticInfoOptimizationBase can be mapped back from YAML generated
here (see D24479).

* The YAML stream is stored in the LLVM context.

* In the example, we can probably further specify the IR value used,
i.e. print "Function" rather than "Value".

* As before hotness is computed in the analysis pass instead of
DiganosticInfo.  This avoids the layering problem since BFI is in
Analysis while DiagnosticInfo is in IR.

[1] https://reviews.llvm.org/D19678#419445

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

llvm-svn: 282499

7 years agoSort headers
Adam Nemet [Tue, 27 Sep 2016 16:15:11 +0000 (16:15 +0000)]
Sort headers

llvm-svn: 282498

7 years ago[ELF] - Fixed string encoding in test. NFC.
George Rimar [Tue, 27 Sep 2016 15:58:31 +0000 (15:58 +0000)]
[ELF] - Fixed string encoding in test. NFC.

llvm-svn: 282497

7 years agoxfail TestExec.py on macOS
Todd Fiala [Tue, 27 Sep 2016 15:57:12 +0000 (15:57 +0000)]
xfail TestExec.py on macOS

Tracked by:
rdar://28476369

llvm-svn: 282496

7 years ago[ELF] - Fixed linkage error when using -g --gc-sections together.
George Rimar [Tue, 27 Sep 2016 15:55:29 +0000 (15:55 +0000)]
[ELF] - Fixed linkage error when using -g --gc-sections together.

r282444 introduced new issue, sample program below
fails to link on

assert(Piece.Live);
int main() { return 0; }
clang test.cpp -c -o out.o -g
ld.lld -flavor gnu --gc-sections out.o -o out

Problem is that .debug_info contains relocations to .debug_str:
Section (7) .rela.debug_info {
..

0xC R_X86_64_32 .debug_str 0x0
0x12 R_X86_64_32 .debug_str 0x37
..
But we do not preserve .debug_str in a right way now.

To fix this we should ignore relocations from non-allocatable sections to allocatable
to allow GC work at full power, but still should proccess relocations from non-allocatable to non-allocatable sections
as usual to mark some parts of debug sections alive to keep them so we do not end
up with such assert when trying to access dead pieces. That looks like what gold/ld do, they do
not strip .debug_str section from what I saw using sample provided.

Thanks to Evgeny Leviant for suggestions about how to fix this.

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

llvm-svn: 282495

7 years agoproject_id is from another era in phabricator land and does not provide any value.
Manuel Klimek [Tue, 27 Sep 2016 15:47:29 +0000 (15:47 +0000)]
project_id is from another era in phabricator land and does not provide any value.

Patch by Eitan Adler.

llvm-svn: 282494

7 years agoAdd xxhash to llvm.
Rafael Espindola [Tue, 27 Sep 2016 15:45:57 +0000 (15:45 +0000)]
Add xxhash to llvm.

It will be used for fast fingerprinting in lld at least.

llvm-svn: 282493

7 years agoUpdate to commit r282488, fix the buildboot failure.
Ayman Musa [Tue, 27 Sep 2016 15:37:31 +0000 (15:37 +0000)]
Update to commit r282488, fix the buildboot failure.

llvm-svn: 282492

7 years ago[SE] Change CoreTests target name
Jason Henline [Tue, 27 Sep 2016 15:32:52 +0000 (15:32 +0000)]
[SE] Change CoreTests target name

Summary:
Call it StreamExecutorCoreTests in order to prevent collision with
targets from other modules.

Reviewers: jlebar, jprice

Subscribers: beanz, mgorny, jlebar, parallel_libs-commits

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

llvm-svn: 282491

7 years ago[docs] Fix naming style in the example
Alexander Kornienko [Tue, 27 Sep 2016 14:49:45 +0000 (14:49 +0000)]
[docs] Fix naming style in the example

llvm-svn: 282490

7 years ago[AMDGPU] Enable changing instprinter's behavior based on the per-function
Konstantin Zhuravlyov [Tue, 27 Sep 2016 14:42:48 +0000 (14:42 +0000)]
[AMDGPU] Enable changing instprinter's behavior based on the per-function
subtarget

This is a prerequisite for coming waitcnt changes

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

llvm-svn: 282489

7 years ago[avx512] Add aliases to some missing avx512 intrinsics.
Ayman Musa [Tue, 27 Sep 2016 14:06:32 +0000 (14:06 +0000)]
[avx512] Add aliases to some missing avx512 intrinsics.

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

llvm-svn: 282488

7 years ago[mips] Disable tail calls temporarily
Simon Dardis [Tue, 27 Sep 2016 13:15:54 +0000 (13:15 +0000)]
[mips] Disable tail calls temporarily

Disable tail calls while the remaining bugs are fixed. Enable only for tests.

Reviewers: vkalintiris

Differential Review: https://reviews.llvm.org/D24912

llvm-svn: 282487

7 years agoWorkaround ASTMatcher crashes. Added some more test cases.
Eric Liu [Tue, 27 Sep 2016 12:54:48 +0000 (12:54 +0000)]
Workaround ASTMatcher crashes. Added some more test cases.

Summary:
- UsingDecl matcher crashed when `UsingShadowDecl` has no parent map. Workaround by moving parent check into `UsingDecl`.
- FunctionDecl matcher crashed when there is a lambda defined in parameter list (also due to no parent map).
  Workaround by putting `unless(cxxMethodDecl())` before parent check.

Reviewers: klimek, sbenza, aaron.ballman, hokein

Subscribers: aaron.ballman, cfe-commits

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

llvm-svn: 282486

7 years ago[mips] Add rsqrt, recip for MIPS
Simon Dardis [Tue, 27 Sep 2016 12:25:15 +0000 (12:25 +0000)]
[mips] Add rsqrt, recip for MIPS

Add rsqrt.[ds], recip.[ds] for MIPS. Correct the microMIPS definitions for
architecture support and register usage.

Reviewers: vkalintiris, zoran.jovanoic

Differential Review: https://reviews.llvm.org/D24499

llvm-svn: 282485

7 years agoSilencing a Sphinx diagnostic with options, again.
Aaron Ballman [Tue, 27 Sep 2016 12:17:05 +0000 (12:17 +0000)]
Silencing a Sphinx diagnostic with options, again.

Warning, treated as error:
/opt/llvm/build.attributes.src/tools/clang/docs/CommandGuide/clang.rst:413: WARNING: unknown option: -save-stats=cwd

llvm-svn: 282484

7 years ago[cmake] Add linker option "-Wl,-z,defs" in standalone build
Michal Gorny [Tue, 27 Sep 2016 12:15:35 +0000 (12:15 +0000)]
[cmake] Add linker option "-Wl,-z,defs" in standalone build

Add the "-Wl,-z,defs" linker option that is used to prevent
underlinking. It is already used by LLVM itself but does not get
propagated into stand-alone build of libc++. This patch ensures
that the option is passed in independently of whether libc++ is built
in-tree or out-of-tree.

Patch by Lei Zhang.

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

llvm-svn: 282483

7 years ago[docs] Make WritingAnLLVMPass.rst up-to-date with current state of things
Andrey Bokhanko [Tue, 27 Sep 2016 12:07:21 +0000 (12:07 +0000)]
[docs] Make WritingAnLLVMPass.rst up-to-date with current state of things

This patch updates WritingAnLLVMPass.rst to make it in line with current state of things.

Specifically:

* Makefile instructions replaced with CMake ones
* Filenames replaced with correct ones
* Example reformatted a bit to make it less confusing and more conforming to LLVM Coding Standards
* opt tool output updated with what it actually prints nowdays
* "gcse" (which doesn't exist anymore) replaced with "gvn" (which still does)

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

llvm-svn: 282482

7 years ago[Power9] Builtins for ELF v.2 ABI conformance - front end portion
Nemanja Ivanovic [Tue, 27 Sep 2016 10:45:22 +0000 (10:45 +0000)]
[Power9] Builtins for ELF v.2 ABI conformance - front end portion

This patch corresponds to review:
https://reviews.llvm.org/D24397

It adds the __POWER9_VECTOR__ macro and the -mpower9-vector option along with
a number of altivec.h functions (refer to the code review for a list).

llvm-svn: 282481

7 years ago[include-fixer] Add customized editor settings documents.
Haojian Wu [Tue, 27 Sep 2016 10:43:38 +0000 (10:43 +0000)]
[include-fixer] Add customized editor settings documents.

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 282480

7 years agoTrying to fix lldb build breakage probably caused by rL282452
Dimitar Vlahovski [Tue, 27 Sep 2016 10:34:43 +0000 (10:34 +0000)]
Trying to fix lldb build breakage probably caused by rL282452

llvm-svn: 282479

7 years ago[Power9] Builtins for ELF v.2 API conformance - back end portion
Nemanja Ivanovic [Tue, 27 Sep 2016 08:42:12 +0000 (08:42 +0000)]
[Power9] Builtins for ELF v.2 API conformance - back end portion

This patch corresponds to review:
https://reviews.llvm.org/D24396

This patch adds support for the "vector count trailing zeroes",
"vector compare not equal" and "vector compare not equal or zero instructions"
as well as "scalar count trailing zeroes" instructions. It also changes the
vector negation to use XXLNOR (when VSX is enabled) so as not to increase
register pressure (previously this was done with a splat immediate of all
ones followed by an XXLXOR). This was done because the altivec.h
builtins (patch to follow) use vector negation and the use of an additional
register for the splat immediate is not optimal.

llvm-svn: 282478

7 years ago[clang-move] Use isStaticStorageClass matcher.
Haojian Wu [Tue, 27 Sep 2016 08:01:04 +0000 (08:01 +0000)]
[clang-move] Use isStaticStorageClass matcher.

llvm-svn: 282477

7 years ago[clang-tidy] Use isStaticStorageClass ast matcher.
Haojian Wu [Tue, 27 Sep 2016 07:58:52 +0000 (07:58 +0000)]
[clang-tidy] Use isStaticStorageClass ast matcher.

llvm-svn: 282476

7 years ago[cmake] Strip possibly-inherited compiler flags in in-tree build only
Michal Gorny [Tue, 27 Sep 2016 07:55:26 +0000 (07:55 +0000)]
[cmake] Strip possibly-inherited compiler flags in in-tree build only

Strip the set of flags (including debug defs, -m32) that could
be inherited from top-level LLVM build only when in-tree build is
performed. This prevents libcxx from confusingly and undesiredly
stripping user-supplied flags e.g. when performing packaging system
controlled multi-ABI build.

Otherwise, in order to perform 32-bit builds the build scripts would
have to use LIBCXX_BUILD_32_BITS. However, -m32 is only one of the many
different ABI flags for different targets, and it really makes no sense
to add separate CMake options for each possible -m* flag and then keep
a mapping from well-known flags to the custom CMake options.

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

llvm-svn: 282475

7 years ago[ASTMatcher] Clarify isStaticStorageClass and hasStaticStorageDuration documents.
Haojian Wu [Tue, 27 Sep 2016 07:53:20 +0000 (07:53 +0000)]
[ASTMatcher] Clarify isStaticStorageClass and hasStaticStorageDuration documents.

Reviewers: aaron.ballman

Subscribers: klimek, cfe-commits

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

llvm-svn: 282474

7 years ago[X86] Add test case for PR30511 and r282341.
Craig Topper [Tue, 27 Sep 2016 06:44:30 +0000 (06:44 +0000)]
[X86] Add test case for PR30511 and r282341.

llvm-svn: 282473

7 years ago[X86] Expand all-ones-vector test to cover 256-bit and 512-bit vectors.
Craig Topper [Tue, 27 Sep 2016 06:44:27 +0000 (06:44 +0000)]
[X86] Expand all-ones-vector test to cover 256-bit and 512-bit vectors.

llvm-svn: 282472

7 years ago[X86] Use std::max to calculate alignment instead of assuming RC->getSize() will...
Craig Topper [Tue, 27 Sep 2016 06:44:25 +0000 (06:44 +0000)]
[X86] Use std::max to calculate alignment instead of assuming RC->getSize() will not return a value greater than 32. I think it theoretically could be 64 for AVX-512.

llvm-svn: 282471

7 years ago[libc++abi] Default to DLL annotations on Windows
Shoaib Meenai [Tue, 27 Sep 2016 03:44:09 +0000 (03:44 +0000)]
[libc++abi] Default to DLL annotations on Windows

`__declspec(dllexport)` and `__declspec(dllimport)` should only be used
when building libc++abi as a DLL, but that's the more common use case,
so default to adding the annotations and add an option to opt out.

Similar to r282449, which made the corresponding change for libc++.

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

llvm-svn: 282470

7 years ago[libFuzzer] run re2 test in 8 threads by default
Kostya Serebryany [Tue, 27 Sep 2016 03:33:57 +0000 (03:33 +0000)]
[libFuzzer] run re2 test in 8 threads by default

llvm-svn: 282469

7 years agoFix possible division by zero
Eric Fiselier [Tue, 27 Sep 2016 02:13:27 +0000 (02:13 +0000)]
Fix possible division by zero

llvm-svn: 282468

7 years ago[sanitizer-coverage] fix a bug in trace-gep
Kostya Serebryany [Tue, 27 Sep 2016 01:55:08 +0000 (01:55 +0000)]
[sanitizer-coverage] fix a bug in trace-gep

llvm-svn: 282467

7 years agoRemove out of date items in TODO.txt
Eric Fiselier [Tue, 27 Sep 2016 01:28:47 +0000 (01:28 +0000)]
Remove out of date items in TODO.txt

llvm-svn: 282466

7 years ago[sanitizer-coverage] don't emit the CTOR function if nothing has been instrumented
Kostya Serebryany [Tue, 27 Sep 2016 01:08:33 +0000 (01:08 +0000)]
[sanitizer-coverage] don't emit the CTOR function if nothing has been instrumented

llvm-svn: 282465

7 years agoRemove default argument from lambda to appease old MSVC.
Richard Smith [Tue, 27 Sep 2016 00:53:24 +0000 (00:53 +0000)]
Remove default argument from lambda to appease old MSVC.

llvm-svn: 282464

7 years agoDefend test against differences between 32-bit and 64-bit MSABI manglings.
Richard Smith [Tue, 27 Sep 2016 00:52:29 +0000 (00:52 +0000)]
Defend test against differences between 32-bit and 64-bit MSABI manglings.

llvm-svn: 282463

7 years agoRevert r277556. Add -lowertypetests-bitsets-level to control bitsets generation
Ivan Krasin [Tue, 27 Sep 2016 00:29:53 +0000 (00:29 +0000)]
Revert r277556. Add -lowertypetests-bitsets-level to control bitsets generation

Summary:
We don't currently need this facility for CFI. Disabling individual hot methods proved
to be a better strategy in Chrome.

Also, the design of the feature is suboptimal, as pointed out by Peter Collingbourne.

Reviewers: pcc

Subscribers: kcc

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

llvm-svn: 282461

7 years ago[libFuzzer] add a test based on openssl-1.0.1f (finds heartbleed)
Kostya Serebryany [Tue, 27 Sep 2016 00:27:40 +0000 (00:27 +0000)]
[libFuzzer] add a test based on openssl-1.0.1f (finds heartbleed)

llvm-svn: 282460

7 years ago[libFuzzer] add -exit_on_src_pos to test libFuzzer itself, add a test script for...
Kostya Serebryany [Tue, 27 Sep 2016 00:10:20 +0000 (00:10 +0000)]
[libFuzzer] add -exit_on_src_pos to test libFuzzer itself, add a test script for RE2 that uses this flag

llvm-svn: 282458

7 years agoP0145R3 (C++17 evaluation order tweaks): evaluate the base expression before
Richard Smith [Mon, 26 Sep 2016 23:56:57 +0000 (23:56 +0000)]
P0145R3 (C++17 evaluation order tweaks): evaluate the base expression before
the pointer-to-member expression in calls through .* and ->* expressions.

llvm-svn: 282457

7 years agoLowerTypeTests: Remove unused variable.
Peter Collingbourne [Mon, 26 Sep 2016 23:56:17 +0000 (23:56 +0000)]
LowerTypeTests: Remove unused variable.

llvm-svn: 282456

7 years agoLowerTypeTests: Create LowerTypeTestsModule class and move implementation there....
Peter Collingbourne [Mon, 26 Sep 2016 23:54:39 +0000 (23:54 +0000)]
LowerTypeTests: Create LowerTypeTestsModule class and move implementation there. Related simplifications.

llvm-svn: 282455

7 years agoCreate FileOutputBuffer lazily.
Rui Ueyama [Mon, 26 Sep 2016 23:53:55 +0000 (23:53 +0000)]
Create FileOutputBuffer lazily.

So that it is clear that FileOutputBuffer does not depend on
PDB file builder. Eventually we will have to to get the file size
info from the file builder to create a file with the exact size.
NFC.

llvm-svn: 282454

7 years agoP0145R3 (C++17 evaluation order tweaks): consistently emit the LHS of array
Richard Smith [Mon, 26 Sep 2016 23:49:47 +0000 (23:49 +0000)]
P0145R3 (C++17 evaluation order tweaks): consistently emit the LHS of array
subscripting before the RHS, regardless of which is the base and which is the
index.

llvm-svn: 282453

7 years ago[lit] Add a --max-failures option.
Daniel Dunbar [Mon, 26 Sep 2016 23:38:23 +0000 (23:38 +0000)]
[lit] Add a --max-failures option.

 - This is primarily useful as a "fail fast" mode for lit, where it will stop
   running tests after the first failure.

 - Patch by Max Moiseev.

llvm-svn: 282452

7 years ago[CodeGen] Add support for emitting .init_array instead of .ctors on FreeBSD.
Davide Italiano [Mon, 26 Sep 2016 22:53:15 +0000 (22:53 +0000)]
[CodeGen] Add support for emitting .init_array instead of .ctors on FreeBSD.

PR: 30494
llvm-svn: 282451

7 years ago[CodeGen] Switch test as FreeBSD will support .init_array soon.
Davide Italiano [Mon, 26 Sep 2016 22:38:17 +0000 (22:38 +0000)]
[CodeGen] Switch test as FreeBSD will support .init_array soon.

llvm-svn: 282450

7 years agoExpect DLL builds on Windows by default and require a custom __config for static
Eric Fiselier [Mon, 26 Sep 2016 22:19:41 +0000 (22:19 +0000)]
Expect DLL builds on Windows by default and require a custom __config for static
builds.

On Windows the __declspec(dllimport) and __declspec(dllexport) attributes
require linking to a DLL, not a static library. Previously these annotations
were disabled by default unless _LIBCPP_DLL was defined. However the DLL
configuration is probably the more common one, so it should be supported by
default.

This patch enables import/export attributes by default and adds a
_LIBCPP_DISABLE_DLL_IMPORT_EXPORT macro which can be used to disable this
behavior. If libc++ is built as a static library on Windows then a custom __config
header will be generated that predefines this macro.

This patch is based off work by Shoaib Meenai.

llvm-svn: 282449

7 years ago[clang-format] Don't allow newline after uppercase Obj-C block return types
Daniel Jasper [Mon, 26 Sep 2016 22:19:08 +0000 (22:19 +0000)]
[clang-format] Don't allow newline after uppercase Obj-C block return types

Fixes the following:
  BOOL (^aaa)(void) = ^BOOL {
  };

The first BOOL's token was getting set to TT_FunctionAnnotationRParen
incorrectly, which was causing an unexpected newline after (^aaa). This
was introduced in r245846.

Patch by Kent Sutherland, thank you!

llvm-svn: 282448

7 years agoheaders: add missing Windows ARM Interlocked intrinsics
Saleem Abdulrasool [Mon, 26 Sep 2016 22:12:43 +0000 (22:12 +0000)]
headers: add missing Windows ARM Interlocked intrinsics

On ARM, there are multiple versions of each of the intrinsics, with
acquire/relaxed/release barrier semantics.

The newly added ones are provided as inline functions here instead of builtins,
since they should only be available on certain archs (arm/aarch64).

This is necessary in order to compile C++ code for ARM in MSVC mode.

Patch by Martin Storsjö!

llvm-svn: 282447

7 years ago[libc++] Fix typos causing compilation errors when _LIBCPP_DEBUG_LEVEL >= 2
Oleg Ranevskyy [Mon, 26 Sep 2016 21:39:38 +0000 (21:39 +0000)]
[libc++] Fix typos causing compilation errors when _LIBCPP_DEBUG_LEVEL >= 2

Summary: This patch fixes a couple of typos that cause compilation errors when application includes <unordered_map> and enables the libc++'s debugging capabilities.

Reviewers: EricWF

Subscribers: llvm-commits

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

llvm-svn: 282446

7 years agoFix an issue where LLDB would not accept the --description-verbosity option to 'po...
Enrico Granata [Mon, 26 Sep 2016 21:36:17 +0000 (21:36 +0000)]
Fix an issue where LLDB would not accept the --description-verbosity option to 'po' without an argument after the StringRef refactoring

Fixes rdar://28480275

llvm-svn: 282445

7 years agoNon alloca sections should not keep other sections live.
Rafael Espindola [Mon, 26 Sep 2016 21:34:34 +0000 (21:34 +0000)]
Non alloca sections should not keep other sections live.

This matches the gold behaviour and is important to prevent debug info
from effectively disabling gc.

llvm-svn: 282444

7 years ago[Modules TS] Diagnose 'export' declaration within 'export' declaration.
Richard Smith [Mon, 26 Sep 2016 21:27:23 +0000 (21:27 +0000)]
[Modules TS] Diagnose 'export' declaration within 'export' declaration.

llvm-svn: 282443

7 years ago[WebAssembly] Use the frame pointer instead of the stack pointer
Derek Schuff [Mon, 26 Sep 2016 21:18:03 +0000 (21:18 +0000)]
[WebAssembly] Use the frame pointer instead of the stack pointer

When we have dynamic allocas we have a frame pointer, and
when we're lowering frame indexes we should make sure we use it.

Patch by Jacob Gravelle

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

llvm-svn: 282442

7 years agoNext set of additional error checks for invalid Mach-O files for the
Kevin Enderby [Mon, 26 Sep 2016 21:11:03 +0000 (21:11 +0000)]
Next set of additional error checks for invalid Mach-O files for the
other load commands that use the Mach::linkedit_data_command type
but not used in llvm libObject code but used in llvm tool code.

This includes LC_FUNCTION_STARTS, LC_SEGMENT_SPLIT_INFO
and LC_DYLIB_CODE_SIGN_DRS load commands.

llvm-svn: 282441

7 years agoMove computation past early return
Aditya Kumar [Mon, 26 Sep 2016 21:01:13 +0000 (21:01 +0000)]
Move computation past early return

Reviewers:
        rafael
        spatel

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

llvm-svn: 282440

7 years ago[libc++] Extension: Make `move` and `forward` constexpr in C++11.
Eric Fiselier [Mon, 26 Sep 2016 20:55:02 +0000 (20:55 +0000)]
[libc++] Extension: Make `move` and `forward` constexpr in C++11.

Summary:
`std::move` and `std::forward` were not marked constexpr in C++11.  This can be very damaging because it makes otherwise constant expressions non-constant. For example:

```
#include <utility>
template <class T>
struct Foo {
  constexpr Foo(T&& tx) :  t(std::move(tx)) {}
  T t;
};
[[clang::require_constant_initialization]] Foo<int> f(42); // Foo should be constant initialized but C++11 move is not constexpr. As a result `f` is an unsafe global.
```

This patch applies `constexpr` to `move` and `forward` as an extension in C++11. Normally the library is not allowed to add `constexpr` because it may be observable to the user. In particular adding constexpr may cause valid code to stop compiling. However these problems only happen in more complex situations, like making `__invoke(...)` constexpr. `forward` and `move` are simply enough that applying `constexpr` is safe.

Note that libstdc++ has offered this extension since at least 4.8.1.

Most of the changes in this patch are simply test cleanups or additions. The main changes in the tests are:

* Fold all `forward_N.fail.cpp` tests into a single `forward.fail.cpp` test using -verify.
* Delete most `move_only_N.fail.cpp` tests because they weren't actually testing anything.
* Fold `move_copy.pass.cpp` and `move_only.pass.cpp` into a single `move.pass.cpp` test.
* Add return type and noexcept tests for `forward` and `move`.

Reviewers: rsmith, mclow.lists, EricWF

Subscribers: K-ballo, loladiro

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

llvm-svn: 282439

7 years agoFix test on windows
Matthias Braun [Mon, 26 Sep 2016 20:48:34 +0000 (20:48 +0000)]
Fix test on windows

llvm-svn: 282438

7 years ago[thinlto] Basic thinlto fdo heuristic
Piotr Padlewski [Mon, 26 Sep 2016 20:37:32 +0000 (20:37 +0000)]
[thinlto] Basic thinlto fdo heuristic

Summary:
This patch improves thinlto importer
by importing 3x larger functions that are called from hot block.

I compared performance with the trunk on spec, and there
were about 2% on povray and 3.33% on milc. These results seems
to be consistant and match the results Teresa got with her simple
heuristic. Some benchmarks got slower but I think they are just
noisy (mcf, xalancbmki, omnetpp)- running the benchmarks again with
more iterations to confirm. Geomean of all benchmarks including the noisy ones
were about +0.02%.

I see much better improvement on google branch with Easwaran patch
for pgo callsite inlining (the inliner actually inline those big functions)
Over all I see +0.5% improvement, and I get +8.65% on povray.
So I guess we will see much bigger change when Easwaran patch will land
(it depends on new pass manager), but it is still worth putting this to trunk
before it.

Implementation details changes:
- Removed CallsiteCount.
- ProfileCount got replaced by Hotness
- hot-import-multiplier is set to 3.0 for now,
didn't have time to tune it up, but I see that we get most of the interesting
functions with 3, so there is no much performance difference with higher, and
binary size doesn't grow as much as with 10.0.

Reviewers: eraman, mehdi_amini, tejohnson

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 282437

7 years agoadded Linux support for test timeout sampling
Todd Fiala [Mon, 26 Sep 2016 20:25:47 +0000 (20:25 +0000)]
added Linux support for test timeout sampling

This is the Linux counterpart to the sampling support I added
on the macOS side.

This change also introduces zip-file compression if the size of
the sample output is greater than 10 KB.  The Linux side can be
quite large and the textual content is averaging over a 10x
compression factor on tests that I force to time out.  When
compression takes place, the filename becomes:

    {session_dir}/{TestFilename.py}-{pid}.sample.zip

This support relies on the linux 'perf' tool.  If it isn't
present, the behavior is to ignore pre-kill processing of
the timed out test process.

Note calling the perf tool under the timeout command appears
to nuke the profiled process.  This was causing the timeout
kill logic to fail due to the process having disappeared.
I modified the kill logic to catch the case of the process
not existing, and I have it ignore the kill request in that
case.  Any other exception is still raised.

Reviewers: labath

Subscribers: lldb-commits

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

llvm-svn: 282436

7 years ago[include] Declare __STDC_*_MACROS for C++11 compat in old libc
Michal Gorny [Mon, 26 Sep 2016 20:20:00 +0000 (20:20 +0000)]
[include] Declare __STDC_*_MACROS for C++11 compat in old libc

Declare __STDC_FORMAT_MACROS, __STDC_LIMIT_MACROS and
__STDC_CONSTANT_MACROS before including real inttypes.h/stdint.h when
the wrapper-header is included in C++11, in order to enable
the necessary macros in C99-compliant libc.

The C99 standard defined that the format macros in inttypes.h should be
defined by the C++ implementations only when __STDC_FORMAT_MACROS is
defined, and the limit and constant macros in stdint.h should be defined
only when __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS are defined
appropriately. Following this specification, multiple old versions of
glibc up to 2.17 do not define those macros by default for C++,
rendering the libc++ headers non-compliant to the C++11 standard.

In order to achieve the necessary compliance, __STDC_FORMAT_MACROS is
defined in wrapped inttypes.h just before including the system
inttypes.h, when C++11 or newer is used. Both __STDC_LIMIT_MACROS
and __STDC_CONSTANT_MACROS are defined in newly-wrapped stdint.h. This
fixes the C++11 compliance while preserving the current behavior for
C++03.

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

llvm-svn: 282435

7 years agoAdded a setting that enables saving all .o files from a given JIT expression.
Sean Callanan [Mon, 26 Sep 2016 20:18:51 +0000 (20:18 +0000)]
Added a setting that enables saving all .o files from a given JIT expression.

This allows debugging of the JIT and other analyses of the internals of the
expression parser.  I've also added a testcase that verifies that the setting
works correctly when off and on.

llvm-svn: 282434

7 years agoAllow StringRef to be constructed from a null pointer.
Zachary Turner [Mon, 26 Sep 2016 20:08:05 +0000 (20:08 +0000)]
Allow StringRef to be constructed from a null pointer.

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

llvm-svn: 282433

7 years agoFix serialization of Python breakpoint commands.
Jim Ingham [Mon, 26 Sep 2016 19:47:37 +0000 (19:47 +0000)]
Fix serialization of Python breakpoint commands.

CommandData breakpoint commands didn't know whether they were
Python or Command line commands, so they couldn't serialize &
deserialize themselves properly.  Fix that.
I also changed the "breakpoint list" command to note in the output
when the commands are Python commands.  Fortunately only one test
was relying on this explicit bit of text output.

llvm-svn: 282432

7 years agoAdd support for Code16GCC
Nirav Dave [Mon, 26 Sep 2016 19:33:36 +0000 (19:33 +0000)]
Add support for Code16GCC

[X86] The .code16gcc directive parses X86 assembly input in 32-bit mode and
outputs in 16-bit mode. Teach parser to switch modes appropriately.

Reviewers: dwmw2, craig.topper

Subscribers: llvm-commits

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

llvm-svn: 282430

7 years ago[ELF] - Linkerscript: implemented BYTE/SHORT/LONG/QUAD commands.
George Rimar [Mon, 26 Sep 2016 19:22:50 +0000 (19:22 +0000)]
[ELF] - Linkerscript: implemented BYTE/SHORT/LONG/QUAD commands.

The BYTE, SHORT, LONG, and QUAD commands store one, two, four, and eight bytes (respectively).
After storing the bytes, the location counter is incremented by the number of bytes
stored.

Previously our scripts handles these commands incorrectly. For example:
SECTIONS  {
  .foo : {
 *(.foo.1)
 BYTE(0x11)
...
We accepted the script above treating BYTE as input section description.
These commands are used in the wild though.

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

llvm-svn: 282429

7 years agoAdd optimization bisect support to an optional Mips pass
Andrew Kaylor [Mon, 26 Sep 2016 19:05:37 +0000 (19:05 +0000)]
Add optimization bisect support to an optional Mips pass

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

llvm-svn: 282428

7 years ago[ELF] - Fix for: Bug 30521 - lld exits non-zero return value linking a library with...
George Rimar [Mon, 26 Sep 2016 19:04:42 +0000 (19:04 +0000)]
[ELF] - Fix for: Bug 30521 - lld exits non-zero return value linking a library with no entry symbol

PR30521 was about linking shared library. After r282295 code when linking -shared produced
"entry symbol not found" warning, what in combination with --fatal-errors failed linkage.

Patch fixes logic (and adds testcases) to follow next rules:

1) If entry was specified and not found report warning.
2) If entry was not specified then:
 a) Emit warning if not -shared.
 b) Do not emit warning if -shared.

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

llvm-svn: 282427

7 years agoCC1: Add -save-stats option
Matthias Braun [Mon, 26 Sep 2016 18:53:34 +0000 (18:53 +0000)]
CC1: Add -save-stats option

This option behaves in a similar spirit as -save-temps and writes
internal llvm statistics in json format to a file.

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

llvm-svn: 282426

7 years agoStatistic: Only print statistics on exit for -stats
Matthias Braun [Mon, 26 Sep 2016 18:38:07 +0000 (18:38 +0000)]
Statistic: Only print statistics on exit for -stats

Previously enabling the statistics with EnableStatistics() would lead to
them getting printed to stderr/-info-output-file on exit. However
frontends may want a way to enable statistics and do the printing on
their own instead of the forced printing on exit.

This changes the code so that only the -stats option enables printing on
exit, EnableStatistics() only enables the tracking but requires invoking
one of the PrintStatistics() variants.

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

llvm-svn: 282425

7 years agoMachineInstr: Fix comment typo, further refine comment; NFC
Matthias Braun [Mon, 26 Sep 2016 18:38:05 +0000 (18:38 +0000)]
MachineInstr: Fix comment typo, further refine comment; NFC

llvm-svn: 282424

7 years ago[AArch64] Fix test triplet
Evandro Menezes [Mon, 26 Sep 2016 18:09:21 +0000 (18:09 +0000)]
[AArch64] Fix test triplet

Specify proper target triplet to pass under Windows too.

llvm-svn: 282423

7 years ago[llvm-cov] Silence a warning from the MSVC runtime (NFC)
Vedant Kumar [Mon, 26 Sep 2016 17:57:13 +0000 (17:57 +0000)]
[llvm-cov] Silence a warning from the MSVC runtime (NFC)

Rework getLongestCommonPrefixLen() so that it doesn't access string null
terminators. The old version with std::mismatch would do this:

                        |
                        v
    Strings[0] = ['a', nil]

    Strings[1] = ['a', 'a', nil]
                        ^
                        |

This should silence a warning from the MSVC runtime (PR30515). As
before, I tested this out by preparing a coverage report for FileCheck.
Thanks to Yaron Keren for the report!

llvm-svn: 282422

7 years agoUpdate MemorySSA unittest to account for non-pruned SSA form
Daniel Berlin [Mon, 26 Sep 2016 17:44:31 +0000 (17:44 +0000)]
Update MemorySSA unittest to account for non-pruned SSA form

llvm-svn: 282421

7 years agoAMDGPU/SI: Don't crash on anonymous GlobalValues
Tom Stellard [Mon, 26 Sep 2016 17:29:25 +0000 (17:29 +0000)]
AMDGPU/SI: Don't crash on anonymous GlobalValues

Summary:
We need to call AsmPrinter::getNameWithPrefix() in order to handle
anonymous GlobalValues (e.g. @0, @1).

Reviewers: arsenm, b-sumner

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

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

llvm-svn: 282420

7 years agoRemove pruning of phi nodes in MemorySSA - it makes updating harder
Daniel Berlin [Mon, 26 Sep 2016 17:22:54 +0000 (17:22 +0000)]
Remove pruning of phi nodes in MemorySSA - it makes updating harder

Reviewers: george.burgess.iv

Subscribers: llvm-commits

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

llvm-svn: 282419