platform/upstream/llvm.git
7 years agoswitch on enum should be exhaustive and warning-free
Tim Hammerquist [Tue, 11 Jul 2017 21:06:20 +0000 (21:06 +0000)]
switch on enum should be exhaustive and warning-free

Summary:
Testing the value of type_code against the closed enum TypeCodes
provides statically verifiable completeness of testing. However, one
branch assigns to type_code by casting directly from a masked integer
value. This is currently handled by adding a default: case after
checking each TypeCodes instance. This patch introduces a bool variable
containing the "default" state value, allowing the switch to be
exhaustive, protect against future instances not being handled in the
switch, and preserves the original logic.

This addresses the warning:
warning: default label in switch which covers all enumeration values
[-Wcovered-switch-default]

As an issue of maintainability, the bitmask on line 524 handles the
current values of TypeCodes enum, but this will be invalid if the enum
is extended. This patch does not address this, and a more closed
conversion from cfinfoa -> TypeCodes would help protect against this.

Reviewers: spyffe, lhames, sas

Reviewed By: sas

Subscribers: sas, lldb-commits

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

llvm-svn: 307712

7 years ago [AArch64] Remove unused IsDarwin & IsNotDarwin predicates (NFCI).
Florian Hahn [Tue, 11 Jul 2017 20:56:24 +0000 (20:56 +0000)]
 [AArch64] Remove unused IsDarwin & IsNotDarwin predicates (NFCI).

Reviewers: t.p.northover, rengolin

Reviewed By: t.p.northover

Subscribers: aemerson, javed.absar, llvm-commits, kristof.beyls

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

llvm-svn: 307706

7 years ago[LoopUnrollRuntime] NFC: Add some debugging trace messages for why loop wasn't unrolled.
Anna Thomas [Tue, 11 Jul 2017 20:44:37 +0000 (20:44 +0000)]
[LoopUnrollRuntime] NFC: Add some debugging trace messages for why loop wasn't unrolled.

llvm-svn: 307705

7 years ago[WWW] Add a section to Getting Started about building out-of-tree
Philip Pfaffe [Tue, 11 Jul 2017 20:37:28 +0000 (20:37 +0000)]
[WWW] Add a section to Getting Started about building out-of-tree

llvm-svn: 307704

7 years agoRemove unnecessary local variable.
Rui Ueyama [Tue, 11 Jul 2017 20:33:04 +0000 (20:33 +0000)]
Remove unnecessary local variable.

llvm-svn: 307703

7 years ago[ProfileData] Add new option to dump topn hottest functions
Xinliang David Li [Tue, 11 Jul 2017 20:30:43 +0000 (20:30 +0000)]
[ProfileData] Add new option to dump topn hottest functions

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

llvm-svn: 307702

7 years agoFix clang-tidy diagnostic.cpp test on Windows
Reid Kleckner [Tue, 11 Jul 2017 20:22:17 +0000 (20:22 +0000)]
Fix clang-tidy diagnostic.cpp test on Windows

llvm-svn: 307701

7 years ago[NewGVN] Check for congruency of memory accesses.
Davide Italiano [Tue, 11 Jul 2017 19:49:12 +0000 (19:49 +0000)]
[NewGVN] Check for congruency of memory accesses.

This is fine as nothing in the code relies on leader and memory
leader being the same for a given congruency class. Ack'ed by
Dan.

Fixes PR33720.

llvm-svn: 307699

7 years agoreverting 307677.
Michael Zuckerman [Tue, 11 Jul 2017 19:46:11 +0000 (19:46 +0000)]
reverting 307677.

llvm-svn: 307698

7 years ago[OPENMP] Skip BuildMemberExpr() in BuildFieldReferenceExpr(), NFC, by Kai Noda
Alexey Bataev [Tue, 11 Jul 2017 19:43:28 +0000 (19:43 +0000)]
[OPENMP] Skip BuildMemberExpr() in BuildFieldReferenceExpr(), NFC, by Kai Noda

In the OpenMP mode, we don't need to call BuildMemberExpr() only to discard its
return value. BuildDeclRefExpr() is called instead.

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

llvm-svn: 307697

7 years agoUse internal_strncpy to copy filename in linux procmaps
Francis Ricci [Tue, 11 Jul 2017 19:40:54 +0000 (19:40 +0000)]
Use internal_strncpy to copy filename in linux procmaps

Cleaner than using a while loop to copy the string character by character.

Reviewers: alekseyshl, glider

Subscribers: llvm-commits

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

llvm-svn: 307696

7 years agoInline function to get mac segment address range
Francis Ricci [Tue, 11 Jul 2017 19:40:53 +0000 (19:40 +0000)]
Inline function to get mac segment address range

Summary:
This function is only called once and is fairly simple. Inline to
keep API simple.

Reviewers: alekseyshl, kubamracek

Subscribers: llvm-commits

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

llvm-svn: 307695

7 years ago[NewGVN] Fix an innocent typo I found while debugging PR33720.
Davide Italiano [Tue, 11 Jul 2017 19:19:45 +0000 (19:19 +0000)]
[NewGVN] Fix an innocent typo I found while debugging PR33720.

llvm-svn: 307694

7 years ago[OPENMP] Add restriction for reduction clause in taskloop directives.
Alexey Bataev [Tue, 11 Jul 2017 19:16:44 +0000 (19:16 +0000)]
[OPENMP] Add restriction for reduction clause in taskloop directives.

Added checks for the reduction clauses in the taskloop directives:
1. Only addressable items must be used in reduction clauses.
2. Reduction clauses cannot be used with nogroup clauses.

llvm-svn: 307693

7 years ago[NewGVN] Clarify the function invariants formatting them properly.
Davide Italiano [Tue, 11 Jul 2017 19:15:36 +0000 (19:15 +0000)]
[NewGVN] Clarify the function invariants formatting them properly.

llvm-svn: 307692

7 years ago[PPC] Fix one test case regression for patch https://reviews.llvm.org/D34337.
Tony Jiang [Tue, 11 Jul 2017 19:07:10 +0000 (19:07 +0000)]
[PPC] Fix one test case regression for patch https://reviews.llvm.org/D34337.

llvm-svn: 307691

7 years agoDelete redundant InVersionScript field.
Rafael Espindola [Tue, 11 Jul 2017 18:59:45 +0000 (18:59 +0000)]
Delete redundant InVersionScript field.

Thanks to Rui for the suggestion.

llvm-svn: 307690

7 years agoRefactor MemoryMappingLayout::Next to use a single struct instead of output parameter...
Francis Ricci [Tue, 11 Jul 2017 18:54:00 +0000 (18:54 +0000)]
Refactor MemoryMappingLayout::Next to use a single struct instead of output parameters. NFC.

Summary:
This is the first in a series of patches to refactor sanitizer_procmaps
to allow MachO section information to be exposed on darwin.

In addition, grouping all segment information in a single struct is
cleaner than passing it through a large set of output parameters, and
avoids the need for annotations of NULL parameters for unneeded
information.

The filename string is optional and must be managed and supplied by the
calling function. This is to allow the MemoryMappedSegment struct to be
stored on the stack without causing overly large stack sizes.

Reviewers: alekseyshl, kubamracek, glider

Subscribers: emaste, llvm-commits

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

llvm-svn: 307688

7 years ago[LibFuzzer] Fix `-Wcomment` warning emitted by GCC.
Dan Liew [Tue, 11 Jul 2017 18:27:52 +0000 (18:27 +0000)]
[LibFuzzer] Fix `-Wcomment` warning emitted by GCC.

```
./FuzzerIOWindows.cpp:185:1: warning: multi-line comment [-Wcomment]
 // Parse a directory ending in separator, like: SomeDir\
 ^
./FuzzerIOWindows.cpp:200:1: warning: multi-line comment [-Wcomment]
 // Parse a servername and share, like: SomeServer\SomeShare\
 ^
```

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

llvm-svn: 307687

7 years ago[LibFuzzer] Fix `-Wpedantic` warning reported by Eric Christopher.
Dan Liew [Tue, 11 Jul 2017 18:27:48 +0000 (18:27 +0000)]
[LibFuzzer] Fix `-Wpedantic` warning reported by Eric Christopher.

The warning is reproducible with GCC 4.8. Thanks to David Blaikie for
the suggested fix.

The reported warning was

```
/usr/local/google/home/echristo/sources/llvm/lib/Fuzzer/FuzzerExtFunctions.def:29:10: warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object [-Wpedantic]
 EXT_FUNC(__lsan_enable, void, (), false);
          ^
/usr/local/google/home/echristo/sources/llvm/lib/Fuzzer/FuzzerExtFunctionsWeak.cpp:44:24: note: in definition of macro ‘EXT_FUNC’
   CheckFnPtr((void *)::NAME, #NAME, WARN);
                        ^
```

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

llvm-svn: 307686

7 years ago[asan] Fix asan_device_setup --use-su mode on Android 7.x.
Evgeniy Stepanov [Tue, 11 Jul 2017 18:18:50 +0000 (18:18 +0000)]
[asan] Fix asan_device_setup --use-su mode on Android 7.x.

mount command does not accept -o remount,rw flag on some versions of Android.
mount -o rw,remount works everywhere.

llvm-svn: 307685

7 years ago[msan] Only check shadow memory for operands that are sized.
Evgeniy Stepanov [Tue, 11 Jul 2017 18:13:52 +0000 (18:13 +0000)]
[msan] Only check shadow memory for operands that are sized.

Fixes PR33347: https://bugs.llvm.org/show_bug.cgi?id=33347.

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

Patch by Matt Morehouse.

llvm-svn: 307684

7 years agoRename z_Linux_asm.s to z_Linux_asm.S
Dimitry Andric [Tue, 11 Jul 2017 18:04:56 +0000 (18:04 +0000)]
Rename z_Linux_asm.s to z_Linux_asm.S

Summary:
On Unix, a .S file is normally an assembly source which must be
preprocessed with a C preprocessor, while a .s file is "plain" assembly.
The former is handled by the compiler driver (cc), the latter is
directly passed to the assembler binary (as).

Because z_Linux_asm.s is supposed to be preprocessed, rename it to .S,
so it can be automatically picked up correctly by build systems.

Reviewers: AndreyChurbanov, emaste, jlpeyton

Reviewed By: AndreyChurbanov

Subscribers: mgorny, openmp-commits

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

llvm-svn: 307680

7 years ago[mips][mt][1/7] Add the MT ASE as a subtarget feature.
Simon Dardis [Tue, 11 Jul 2017 18:03:20 +0000 (18:03 +0000)]
[mips][mt][1/7] Add the MT ASE as a subtarget feature.

Preparatory work for adding the MIPS MT (multi-threading) ASE instructions.

Reviewers: slthakur, atanasyan

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

llvm-svn: 307679

7 years agoRevert "AMDGPU: Do not test for SI in getIsaVersion"
Konstantin Zhuravlyov [Tue, 11 Jul 2017 17:57:41 +0000 (17:57 +0000)]
Revert "AMDGPU: Do not test for SI in getIsaVersion"

This reverts commit r307573.

This breaks downstream test.

llvm-svn: 307678

7 years ago[X86][LLVM]Expanding Supports lowerInterleavedStore() in X86InterleavedAccess.
Michael Zuckerman [Tue, 11 Jul 2017 17:17:49 +0000 (17:17 +0000)]
[X86][LLVM]Expanding Supports lowerInterleavedStore() in X86InterleavedAccess.
Base test for avx512
adding new base test to trunk befor commit change on the test

llvm-svn: 307677

7 years ago[LoopUnrollRuntime] Avoid multi-exit nested loop with epilog generation
Anna Thomas [Tue, 11 Jul 2017 17:16:33 +0000 (17:16 +0000)]
[LoopUnrollRuntime] Avoid multi-exit nested loop with epilog generation

The loop structure for the outer loop does not contain the epilog
preheader when we try to unroll inner loop with multiple exits and
epilog code is generated. For now, we just bail out in such cases.
Added a test case that shows the problem. Without this bailout, we would
trip on assert saying LCSSA form is incorrect for outer loop.

llvm-svn: 307676

7 years ago[Hexagon] Do not rely on callee-saved info in hasFP
Krzysztof Parzyszek [Tue, 11 Jul 2017 17:11:54 +0000 (17:11 +0000)]
[Hexagon] Do not rely on callee-saved info in hasFP

llvm-svn: 307675

7 years ago[Support] - Add bad alloc error handler for handling allocation malfunctions
Reid Kleckner [Tue, 11 Jul 2017 16:45:30 +0000 (16:45 +0000)]
[Support] - Add bad alloc error handler for handling allocation malfunctions

Summary:
Patch by Klaus Kretzschmar

We would like to introduce a new type of llvm error handler for handling
bad alloc fault situations.  LLVM already provides a fatal error handler
for serious non-recoverable error situations which by default writes
some error information to stderr and calls exit(1) at the end (functions
are marked as 'noreturn').

For long running processes (e.g. a server application), exiting the
process is not an acceptable option, especially not when the system is
in a temporary resource bottleneck with a good chance to recover from
this fault situation. In such a situation you would rather throw an
exception to stop the current compilation and try to overcome the
resource bottleneck. The user should be aware of the problem of throwing
an exception in bad alloc situations, e.g. you must not do any
allocations in the unwind chain. This is especially true when adding
exceptions in existing unfamiliar code (as already stated in the comment
of the current fatal error handler)

So the new handler can also be used to distinguish from general fatal
error situations where recovering is no option.  It should be used in
cases where a clean unwind after the allocation is guaranteed.

This patch contains:
- A report_bad_alloc function which calls a user defined bad alloc
  error handler. If no user handler is registered the
  report_fatal_error function is called. This function is not marked as
  'noreturn'.
- A install/restore_bad_alloc_error_handler to install/restore the bad
  alloc handler.
- An example (in Mutex.cpp) where the report_bad_alloc function is
  called in case of a malloc returns a nullptr.

If this patch gets accepted we would create similar patches to fix
corresponding malloc/calloc usages in the llvm code.

Reviewers: chandlerc, greened, baldrick, rnk

Reviewed By: rnk

Subscribers: llvm-commits, MatzeB

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

llvm-svn: 307673

7 years ago[PPC] Fix two bugs in frame lowering.
Tony Jiang [Tue, 11 Jul 2017 16:42:20 +0000 (16:42 +0000)]
[PPC] Fix two bugs in frame lowering.

1. The available program storage region of the red zone to compilers is 288
 bytes rather than 244 bytes.
2. The formula for negative number alignment calculation should be
y = x & ~(n-1) rather than y = (x + (n-1)) & ~(n-1).

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

llvm-svn: 307672

7 years ago[Hexagon] Add support for nontemporal loads and stores on HVX
Krzysztof Parzyszek [Tue, 11 Jul 2017 16:39:33 +0000 (16:39 +0000)]
[Hexagon] Add support for nontemporal loads and stores on HVX

Patch by Michael Wu.

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

llvm-svn: 307671

7 years agoAdd missing dllimport member pointer template argument test from r307446
Reid Kleckner [Tue, 11 Jul 2017 16:18:05 +0000 (16:18 +0000)]
Add missing dllimport member pointer template argument test from r307446

llvm-svn: 307670

7 years ago[lit] Fix import StringIO errors in Python 3
Reid Kleckner [Tue, 11 Jul 2017 16:12:53 +0000 (16:12 +0000)]
[lit] Fix import StringIO errors in Python 3

Remove the cStringIO micro-optimization, as it isn't portable to Python
3.

llvm-svn: 307669

7 years ago[lit] Implement non-pipelined echo commands internally
Reid Kleckner [Tue, 11 Jul 2017 16:05:50 +0000 (16:05 +0000)]
[lit] Implement non-pipelined echo commands internally

Summary:
This speeds up the LLD test suite on Windows by 3x. Most of the time is
spent on lld/test/ELF/linkerscript/diagnostics.s, which repeatedly
constructs linker scripts with appending echo commands.

Reviewers: dlj, zturner, modocache

Subscribers: llvm-commits

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

llvm-svn: 307668

7 years ago[SLPVectorizer] Revert change in cancelScheduling with referencing to FirstInBundle...
Dinar Temirbulatov [Tue, 11 Jul 2017 15:54:50 +0000 (15:54 +0000)]
[SLPVectorizer] Revert change in cancelScheduling with referencing to FirstInBundle, NFCI.

llvm-svn: 307667

7 years ago[IR] Remove unnecessary const_casts from ConstantDataSequential and it's subclasses.
Craig Topper [Tue, 11 Jul 2017 15:52:21 +0000 (15:52 +0000)]
[IR] Remove unnecessary const_casts from ConstantDataSequential and it's subclasses.

llvm-svn: 307666

7 years agoNetBSD uses soft-float by default, unless the environment is EABIHF or
Joerg Sonnenberger [Tue, 11 Jul 2017 15:50:48 +0000 (15:50 +0000)]
NetBSD uses soft-float by default, unless the environment is EABIHF or
GNUEABIHF.

llvm-svn: 307665

7 years agoRun the preprocessor test as frontend test for NetBSD, since CC1 mode
Joerg Sonnenberger [Tue, 11 Jul 2017 15:49:45 +0000 (15:49 +0000)]
Run the preprocessor test as frontend test for NetBSD, since CC1 mode
doesn't get flags like the default target CPU. Update for test to
reflect the difference.

llvm-svn: 307664

7 years ago[ASTMatchers][NFC] integerLiteral(): Mention negative integers in
Clement Courbet [Tue, 11 Jul 2017 15:45:22 +0000 (15:45 +0000)]
[ASTMatchers][NFC] integerLiteral(): Mention negative integers in
documentation.

Trying to match integerLiteral(-1) will silently fail, because an numeric
literal is always positive.
- Update the documentation to explain how to match negative numeric
  literals.
- Add a unit test.

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

llvm-svn: 307663

7 years agofix formatting; NFC
Hiroshi Inoue [Tue, 11 Jul 2017 15:41:31 +0000 (15:41 +0000)]
fix formatting; NFC

llvm-svn: 307662

7 years ago[clang-tidy] Extend diagnostics test.
Alexander Kornienko [Tue, 11 Jul 2017 15:23:05 +0000 (15:23 +0000)]
[clang-tidy] Extend diagnostics test.

  * test that no diagnostics are redirected to stderr
  * test that a file-based compilation database is not picked up when the
    command line after -- contains an error

llvm-svn: 307661

7 years ago[Simplify] Also remove redundant writes which originally came from PHI nodes
Tobias Grosser [Tue, 11 Jul 2017 14:29:39 +0000 (14:29 +0000)]
[Simplify] Also remove redundant writes which originally came from PHI nodes

llvm-svn: 307660

7 years ago[globalisel][tablegen] Change method of squashing unused variable warnings following...
Daniel Sanders [Tue, 11 Jul 2017 14:23:14 +0000 (14:23 +0000)]
[globalisel][tablegen] Change method of squashing unused variable warnings following post-commit comments.

llvm-svn: 307659

7 years ago[SystemZ] Minor fixing in SystemZScheduleZ13.td
Jonas Paulsson [Tue, 11 Jul 2017 14:07:55 +0000 (14:07 +0000)]
[SystemZ]  Minor fixing in SystemZScheduleZ13.td

Some minor corrections for the recently added instructions.

Review: Ulrich Weigand
llvm-svn: 307658

7 years agoRemove duplicate assignments in stat64/kernel_stat_to_stat functions
Petar Jovanovic [Tue, 11 Jul 2017 13:03:48 +0000 (13:03 +0000)]
Remove duplicate assignments in stat64/kernel_stat_to_stat functions

Remove duplicate assignments in stat64_to_stat() and kernel_stat_to_stat().

llvm-svn: 307657

7 years ago[ARM] GlobalISel: Tighten G_FCMP selection test. NFC
Diana Picus [Tue, 11 Jul 2017 12:34:33 +0000 (12:34 +0000)]
[ARM] GlobalISel: Tighten G_FCMP selection test. NFC

Use CHECK-NEXT for the comparison sequence, to make sure we don't get
any unexpected instructions in the middle of our flag manipulation
efforts.

llvm-svn: 307656

7 years ago[DWARF] - Add testcase for checking message about broken relocations.
George Rimar [Tue, 11 Jul 2017 12:29:07 +0000 (12:29 +0000)]
[DWARF] - Add testcase for checking message about broken relocations.

Addresses comments for r306677, which fixed error message itself.

llvm-svn: 307655

7 years ago[X86][AVX512] regenerate avx512-insert-extract.ll
Guy Blank [Tue, 11 Jul 2017 11:51:49 +0000 (11:51 +0000)]
[X86][AVX512] regenerate avx512-insert-extract.ll

llvm-svn: 307654

7 years ago[ARM] GlobalISel: Add reg mapping for s64 G_FCMP
Diana Picus [Tue, 11 Jul 2017 11:47:45 +0000 (11:47 +0000)]
[ARM] GlobalISel: Add reg mapping for s64 G_FCMP

Map the result into GPR and the operands into FPR.

llvm-svn: 307653

7 years ago[ELF] - Fix functionality treating IFunc definitions in DSOs as functions.
George Rimar [Tue, 11 Jul 2017 11:40:59 +0000 (11:40 +0000)]
[ELF] - Fix functionality treating IFunc definitions in DSOs as functions.

It was intially implemented in D19517 but then broken.
Patch fixes PR33707, testcase is based on PR's case.

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

llvm-svn: 307652

7 years ago[Polly][CMake] Skip unit-tests in lit if gtest is not available
Philip Pfaffe [Tue, 11 Jul 2017 11:37:35 +0000 (11:37 +0000)]
[Polly][CMake] Skip unit-tests in lit if gtest is not available

Summary:
There is a bug in the current lit configurations for the unittests. If gtest is not available, the site-config for the unit tests won't be generated. Because lit recurses through the test directory, the lit configuration for the unit tests will be discovered nevertheless, leading to a fatal error in lit.

This patch semi-gracefully skips the unittests if gtest is not available. As a result, running lit now prints this: `warning: test suite 'Polly-Unit' contained no test`.

If people think that this is too annoying, the alternative would be to pick apart the test directory, so that the lit testsuite discovery will always only find one configuration. In fact, both of these things could be combined. While it's certainly nice that running a single lit command runs all the tests, I suppose people use the `check-polly` make target over lit most of the time, so the difference might not be noticed.

Reviewers: Meinersbur, grosser

Reviewed By: grosser

Subscribers: mgorny, bollu, pollydev, llvm-commits

Tags: #polly

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

llvm-svn: 307651

7 years ago[Polly][CMake] Use the CMake Package instead of llvm-config in out-of-tree builds
Philip Pfaffe [Tue, 11 Jul 2017 11:24:25 +0000 (11:24 +0000)]
[Polly][CMake] Use the CMake Package instead of llvm-config in out-of-tree builds

Summary:
As of now, Polly uses llvm-config to set up LLVM dependencies in an out-of-tree build.

This is problematic for two reasons:
1) Right now, in-tree and out-of-tree builds in fact do different things. E.g., in an in-tree build, libPolly depends on a handful of LLVM libraries, while in an out-of-tree build it depends on all of them. This means that we often need to treat both paths seperately.
2) I'm specifically unhappy with the way libPolly is linked right now, because it just blindly links against all the LLVM libs. That doesn't make a lot of sense. For instance, one of these libs is LLVMTableGen, which contains a command line definition of a -o option. This means that I can not link an out-of-tree libPolly into a tool which might want to offer a -o option as well.

This patch (mostly) drop the use of llvm-config  in favor of LLVMs exported cmake package. However, building Polly with unittests requires access to the gtest sources (in the LLVM source tree). If we're building against an LLVM installation, this source tree is unavailable and must specified. I'm using llvm-config to provide a default in this case.

Reviewers: Meinersbur, grosser

Reviewed By: grosser

Subscribers: tstellar, bollu, chapuni, mgorny, pollydev, llvm-commits

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

llvm-svn: 307650

7 years ago[PM] Another post-commit fix in NewPMDriver
Philip Pfaffe [Tue, 11 Jul 2017 11:17:44 +0000 (11:17 +0000)]
[PM] Another post-commit fix in NewPMDriver

There were two errors in the parsing of opt's command line options for
extension point pipelines. The EP callbacks are not supposed to return a
value. To check the pipeline text for correctness, I now try to parse it
into a temporary PM object, and print a message on failure. This solves
the compile time error for the lambda return type, as well as correctly
handles unparsable pipelines now.

llvm-svn: 307649

7 years ago[tests] Add import-jscop-dir to lit.site.cfg.in
Tobias Grosser [Tue, 11 Jul 2017 11:07:01 +0000 (11:07 +0000)]
[tests] Add import-jscop-dir to lit.site.cfg.in

For the previous commit I accidentally added this change to lit.site.cfg, which
is autogenerated and was consequently not part of the previous commit.

llvm-svn: 307648

7 years ago[ARM] GlobalISel: Tighten legalizer tests. NFC
Diana Picus [Tue, 11 Jul 2017 10:52:08 +0000 (10:52 +0000)]
[ARM] GlobalISel: Tighten legalizer tests. NFC

Make sure that all the legalizer tests where the original instruction
needs to be removed check for the removal. We do this by adding
CHECK-NOT lines before and after the replacement sequence. This won't
catch pathological cases where the instruction remains somewhere in the
middle of the instruction sequence that's supposed to replace it, but
hopefully that won't occur in practice (since ideally we'd be setting
the insert point for the new instruction sequence either before or after
the original instruction and not fiddle with it while building the
sequence).

llvm-svn: 307647

7 years ago[globalisel][tablegen] Fix an multi-insn match bug where ComplexPattern is used on...
Daniel Sanders [Tue, 11 Jul 2017 10:40:18 +0000 (10:40 +0000)]
[globalisel][tablegen] Fix an multi-insn match bug where ComplexPattern is used on multiple insns.

In each rule, each use of ComplexPattern is assigned an element in the Renderers
array. The matcher then collects renderer functions in this array and they are
used to render instructions. This works well for a single instruction but a
bug in the allocation mechanism causes the elements to be assigned on a
per-instruction basis rather than a per-rule basis.

So in the case of:
  (set GPR32:$dst, (Op complex:$src1, complex:$src2))
tablegen currently assigns elements 0 and 1 to $src1 and $src2 respectively,
but for:
  (set GPR32:$dst, (Op complex:$src1, (Op complex:$src2)))
it currently assigned both $src1 and $src2 the same element (0). This results in
one complex operand being rendered twice and the other being forgotten.
This patch corrects the allocation such that $src1 and $src2 are still allocated
different elements in this case.

llvm-svn: 307646

7 years ago[tests] Set -polly-import-jscop-dir=%S always
Tobias Grosser [Tue, 11 Jul 2017 10:39:01 +0000 (10:39 +0000)]
[tests] Set -polly-import-jscop-dir=%S always

This simplifies the test cases.

llvm-svn: 307645

7 years agoNativeProcessLinux: Fix handling of raise(SIGTRAP)
Pavel Labath [Tue, 11 Jul 2017 10:38:40 +0000 (10:38 +0000)]
NativeProcessLinux: Fix handling of raise(SIGTRAP)

In NativeProcessLinux::MonitorSIGTRAP we were asserting that the si_code
value is one of the codes we know about. However, that list was very
incomplete -- for example, we were not handling SI_TKILL/SI_USER,
generated by raise(SIGTRAP). A cursory examination show there are at
least a dozen codes like these that an app can generate, and more can be
added at any point.

So, instead of trying to play catchup, I change the default behavior to
treat an unknown si_code like an ordinary signal. The only reason we
needed to inspect si_code in the first place is because
watchpoint/breakpoints are notified as SIGTRAP, but we already know
about those, and us starting to use a new debug event is far less likely
than somebody introducing a new non-debug event.

I add a test case to TestRaise to verify we are handling raise(SIGTRAP)
in an application properly.

llvm-svn: 307644

7 years ago[Simplify] Add test case which we currently miss
Tobias Grosser [Tue, 11 Jul 2017 10:30:45 +0000 (10:30 +0000)]
[Simplify] Add test case which we currently miss

llvm-svn: 307643

7 years ago[ObjC] Check that a subscript methods is declared for a qualified id type
Alex Lorenz [Tue, 11 Jul 2017 10:18:35 +0000 (10:18 +0000)]
[ObjC] Check that a subscript methods is declared for a qualified id type

Objective-C subscript expressions report errors when a subscript method is not
declared in the base class. However, prior to this commit, qualified id types
were not checked. This commit ensures that an appropriate error is reported
when a subscript method is not declared in any of the protocols that are
included in the qualified id type.

rdar://33213924

llvm-svn: 307642

7 years agoAlways export the latest memory access relations
Tobias Grosser [Tue, 11 Jul 2017 10:10:13 +0000 (10:10 +0000)]
Always export the latest memory access relations

This allows us to export the results from transformations such as DeLICM.

llvm-svn: 307641

7 years ago[ARM] ldr pc,=expression should be allowed in Thumb2
Peter Smith [Tue, 11 Jul 2017 09:47:12 +0000 (09:47 +0000)]
[ARM] ldr pc,=expression should be allowed in Thumb2

This change allows the pc to be used as a destination register for the
pseudo instruction LDR pc,=expression . The pseudo instruction must not be
transformed into a MOV, but it can use the Thumb2 LDR (literal) instruction
to a constant pool entry. See (A7.7.43 from ARMv7M ARM ARM).

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

llvm-svn: 307640

7 years ago[ARM] GlobalISel: Fix oversight in G_FCMP legalization
Diana Picus [Tue, 11 Jul 2017 09:43:51 +0000 (09:43 +0000)]
[ARM] GlobalISel: Fix oversight in G_FCMP legalization

We used to forget to erase the original instruction when replacing a
G_FCMP true/false. Fix this bug and make sure the tests check for it.

llvm-svn: 307639

7 years agoRecursiveASTVisitor should visit the nested name qualifiers in
Alex Lorenz [Tue, 11 Jul 2017 09:39:23 +0000 (09:39 +0000)]
RecursiveASTVisitor should visit the nested name qualifiers in
a template specialisation

rdar://33123354

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

llvm-svn: 307638

7 years ago[ELF] Add comment to explain LinkerScript::CurAddressState [NFC]
Peter Smith [Tue, 11 Jul 2017 09:28:27 +0000 (09:28 +0000)]
[ELF] Add comment to explain LinkerScript::CurAddressState [NFC]

r307367 via D34345 split out the temporary address state used within
processCommands() and assignAddresses(). Due to the way that getSymbolValue
is used by the ScriptParser there is no way of giving the current
OutputSection to getSymbolValue() without somehow accessing the created
addressState. The suggestion was that by making a pointer that would go out
of scope we would find out by ASAN/MSAN or a crash if someone had misused
currentAddressState.

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

llvm-svn: 307637

7 years agoNativeProcessLinux: Fix some compiler warnings
Pavel Labath [Tue, 11 Jul 2017 09:03:38 +0000 (09:03 +0000)]
NativeProcessLinux: Fix some compiler warnings

llvm-svn: 307636

7 years agoUse new command replace-buffer-contents if available
Philipp Stephani [Tue, 11 Jul 2017 09:01:58 +0000 (09:01 +0000)]
Use new command replace-buffer-contents if available

Reviewers: klimek

Reviewed By: klimek

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

llvm-svn: 307635

7 years ago[globalisel][tablegen] Correct matching of intrinsic ID's.
Daniel Sanders [Tue, 11 Jul 2017 08:57:29 +0000 (08:57 +0000)]
[globalisel][tablegen] Correct matching of intrinsic ID's.

TreePatternNode considers them to be plain integers but MachineInstr considers
them to be a distinct kind of operand.

The tweak to AArch64InstrInfo.td to produce a simple test case is a NFC for
everything except GlobalISelEmitter (confirmed by diffing the tablegenerated
files). GlobalISelEmitter is currently unable to infer the type of operands in
the Dst pattern from the operands in the Src pattern.

llvm-svn: 307634

7 years ago[ARM] GlobalISel: Legalize s64 G_FCMP
Diana Picus [Tue, 11 Jul 2017 08:50:01 +0000 (08:50 +0000)]
[ARM] GlobalISel: Legalize s64 G_FCMP

Same as the s32 version, for both hard and soft float.

llvm-svn: 307633

7 years ago[LLDB][ppc64le] Rename enums in AuxVector
Pavel Labath [Tue, 11 Jul 2017 08:39:44 +0000 (08:39 +0000)]
[LLDB][ppc64le] Rename enums in AuxVector

Summary:
On linux on ppc64le some of the enums in AuxVector have the same name
as macros defined in the system.

Reviewers: mikesart, labath

Reviewed By: labath

Subscribers: joerg, gut, krytarowski, lldb-commits

Differential Revision: https://reviews.llvm.org/D35065
Patch by Bruno Rosa <bruno.rosa@eldorado.org.br>

llvm-svn: 307632

7 years agoRevert Revert [MBP] do not rotate loop if it creates extra branch
Serguei Katkov [Tue, 11 Jul 2017 08:34:58 +0000 (08:34 +0000)]
Revert Revert [MBP] do not rotate loop if it creates extra branch

This is a second attempt to land this patch.

The first one resulted in a crash of clang sanitizer buildbot.
The fix is here and regression test is added.

This is a last fix for the corner case of PR32214. Actually this is not really corner case in general.

We should not do a loop rotation if we create an additional branch due to it.
Consider the case where we have a loop chain H, M, B, C , where
H is header with viable fallthrough from pre-header and exit from the loop
M - some middle block
B - backedge to Header but with exit from the loop also.
C - some cold block of the loop.

Let's H is determined as a best exit. If we do a loop rotation M, B, C, H we can introduce the extra branch.
Let's compute the change in number of branches:
+1 branch from pre-header to header
-1 branch from header to exit
+1 branch from header to middle block if there is such
-1 branch from cold bock to header if there is one

So if C is not a predecessor of H then we introduce extra branch.

This change actually prohibits rotation of the loop if both true
  Best Exit has next element in chain as successor.
  Last element in chain is not a predecessor of first element of chain.

Reviewers: iteratee, xur, sammccall, chandlerc
Reviewed By: iteratee
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D34745

llvm-svn: 307631

7 years ago[GlobalISel][X86] Use correct AND instructions.
Igor Breger [Tue, 11 Jul 2017 08:04:51 +0000 (08:04 +0000)]
[GlobalISel][X86] Use correct AND instructions.

AND8ri8 not supported in 64bit.

llvm-svn: 307630

7 years ago[COFF] Add initial support for some ARM64 relocations and import thunks
Martin Storsjo [Tue, 11 Jul 2017 07:22:44 +0000 (07:22 +0000)]
[COFF] Add initial support for some ARM64 relocations and import thunks

This is enough to link a working hello world executable, with
a call to an imported function, a string constant passed to
the imported function, and loads from a global variable.

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

llvm-svn: 307629

7 years ago[CGP] Relax a bit restriction for optimizeMemoryInst to extend scope
Serguei Katkov [Tue, 11 Jul 2017 06:24:44 +0000 (06:24 +0000)]
[CGP] Relax a bit restriction for optimizeMemoryInst to extend scope

CodeGenPrepare::optimizeMemoryInst contains a check that we do nothing
if all instructions combining the address for memory instruction is in the same
block as memory instruction itself.

However if any of these instruction are placed after memory instruction then
address calculation will not be folded to memory instruction.

The added test case shows an example.

Reviewers: loladiro, spatel, efriedma
Reviewed By: efriedma
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D34862

llvm-svn: 307628

7 years ago[mips] Create the correct profiling symbol on Linux MIPS
Simon Atanasyan [Tue, 11 Jul 2017 06:19:01 +0000 (06:19 +0000)]
[mips] Create the correct profiling symbol on Linux MIPS

llvm-svn: 307627

7 years agofix typos in comments; NFC
Hiroshi Inoue [Tue, 11 Jul 2017 06:04:59 +0000 (06:04 +0000)]
fix typos in comments; NFC

llvm-svn: 307626

7 years ago[PM/ThinLTO] Fix PR33536, a bug where the ThinLTO bitcode writer was
Chandler Carruth [Tue, 11 Jul 2017 05:39:20 +0000 (05:39 +0000)]
[PM/ThinLTO] Fix PR33536, a bug where the ThinLTO bitcode writer was
querying for analysis results on a function declaration rather than
a definition.

The only reason this worked previously is by chance -- because the way
we got alias analysis results with the legacy PM, we happened to not
compute a dominator tree and so we happened to not hit an assert even
though it didn't make any real sense. Now we bail out before trying to
compute alias analysis so that we don't hit these asserts.

llvm-svn: 307625

7 years ago[PowerPC] fix latency for simple integer instructions in POWER9 scheduler
Hiroshi Inoue [Tue, 11 Jul 2017 05:37:16 +0000 (05:37 +0000)]
[PowerPC] fix latency for simple integer instructions in POWER9 scheduler

In the POWER9 instruction scheduler, SchedWriteRes for the simple integer instructions are misconfigured to use that of (costly) DFU instructions.
This results in surprisingly long instruction latency estimation and causes misbehavior in some optimizers such as if-conversion.

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

llvm-svn: 307624

7 years ago[PowerPC] avoid redundant analysis while lowering an immediate; NFC
Hiroshi Inoue [Tue, 11 Jul 2017 05:28:26 +0000 (05:28 +0000)]
[PowerPC] avoid redundant analysis while lowering an immediate; NFC

This patch reduces compilation time by avoiding redundant analysis while selecting instructions to create an immediate.
If the instruction count required to create the input number without rotate is 2, we do not need further analysis to find a shorter instruction sequence with rotate; rotate + load constant cannot be done by 1 instruction (i.e. getInt64CountDirectnever return 0).
This patch should not change functionality.

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

llvm-svn: 307623

7 years ago[AVR] Remove a few very old TODOs that don't have enough context to understand
Dylan McKay [Tue, 11 Jul 2017 05:14:40 +0000 (05:14 +0000)]
[AVR] Remove a few very old TODOs that don't have enough context to understand

llvm-svn: 307622

7 years ago[InstCombine] Add test case for PR33721.
Craig Topper [Tue, 11 Jul 2017 05:12:52 +0000 (05:12 +0000)]
[InstCombine] Add test case for PR33721.

llvm-svn: 307621

7 years ago[AVR] Rename 'ZREGS' to 'ZREG'
Dylan McKay [Tue, 11 Jul 2017 04:53:43 +0000 (04:53 +0000)]
[AVR] Rename 'ZREGS' to 'ZREG'

It will only ever contain one register.

llvm-svn: 307620

7 years ago[AVR] Rename 'AVRTiny' to 'Tiny'
Dylan McKay [Tue, 11 Jul 2017 04:45:15 +0000 (04:45 +0000)]
[AVR] Rename 'AVRTiny' to 'Tiny'

llvm-svn: 307619

7 years agoPass in the disassembler flavor when disassembling in
Jason Molenda [Tue, 11 Jul 2017 04:22:31 +0000 (04:22 +0000)]
Pass in the disassembler flavor when disassembling in
DumpDataExtractor.  Patch from Jeffrey Crowell,

https://reviews.llvm.org/D34929

llvm-svn: 307618

7 years ago[AVR] Use the generic branch relaxer
Dylan McKay [Tue, 11 Jul 2017 04:17:13 +0000 (04:17 +0000)]
[AVR] Use the generic branch relaxer

llvm-svn: 307617

7 years ago[libcxx][CMake] Add install path variable to allow overriding the destination
Petr Hosek [Tue, 11 Jul 2017 02:39:50 +0000 (02:39 +0000)]
[libcxx][CMake] Add install path variable to allow overriding the destination

This is going to be used by the runtime build in the multi-target
setup to allow using different install prefix for each target.

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

llvm-svn: 307615

7 years agoWhitespace.
NAKAMURA Takumi [Tue, 11 Jul 2017 02:31:54 +0000 (02:31 +0000)]
Whitespace.

llvm-svn: 307614

7 years agoRevert r307581, "Avoid doing conservative phi checks in aliasSameBasePointerGEPs...
NAKAMURA Takumi [Tue, 11 Jul 2017 02:31:51 +0000 (02:31 +0000)]
Revert r307581, "Avoid doing conservative phi checks in aliasSameBasePointerGEPs() if no phis have been visited yet."

It broke stage2 tests in selfhosting.

llvm-svn: 307613

7 years ago[WebAssembly] Fix use of cast vs dyn_cast
Sam Clegg [Tue, 11 Jul 2017 02:21:57 +0000 (02:21 +0000)]
[WebAssembly] Fix use of cast vs dyn_cast

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

llvm-svn: 307612

7 years ago[libcxxabi][CMake] Add install path variable to allow overriding the destination
Petr Hosek [Tue, 11 Jul 2017 01:42:26 +0000 (01:42 +0000)]
[libcxxabi][CMake] Add install path variable to allow overriding the destination

This is going to be used by the runtime build in the multi-target
setup to allow using different install prefix for each target.

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

llvm-svn: 307611

7 years ago[llvm-cov] Disable threading in a test. NFC.
Vedant Kumar [Tue, 11 Jul 2017 01:42:12 +0000 (01:42 +0000)]
[llvm-cov] Disable threading in a test. NFC.

PR30735 reports an issue where llvm-cov hangs with a worker thread
waiting on a condition, and the main thread waiting to join() the
workers. While this doesn't appear to be a bug in llvm-cov or the
ThreadPool implementation, it would be helpful to disable the use of
threading in the llvm-cov tests where no test coverage is added.

More context: https://bugs.llvm.org/show_bug.cgi?id=30735

llvm-svn: 307610

7 years ago[llvm-cov] Add a cl::opt to control the number of threads
Vedant Kumar [Tue, 11 Jul 2017 01:23:29 +0000 (01:23 +0000)]
[llvm-cov] Add a cl::opt to control the number of threads

When an output directory is specified, llvm-cov spawns some threads to
speed up the process of writing out file reports. Add an option which
allows users to control how many threads llvm-cov uses.

A CommandGuide.rst update + test is included.

llvm-svn: 307609

7 years agollvm-profdata: Improve memory usage by tuning SmallDenseMap size
David Blaikie [Tue, 11 Jul 2017 01:18:28 +0000 (01:18 +0000)]
llvm-profdata: Improve memory usage by tuning SmallDenseMap size

This takes memory usage from 5.1GB to 970MB - it could go further by
using a small size of 2 instead of the default of 4, but given the
rather high cost of going over this limit by much, I figured a little
slosh would be worth the ~130MB of memory usage.

& this'll might not be such a big deal if we use a custom slab allocator
for the DenseMaps here anyway

While the vast majority (99.9%) of records use only 1 entry, the tuning
parameter to SmallDenseMap is the the number of buckets, not the number
of entries - so a small size of 1 wasn't useful, even for 1 element, it
would tip over into allocating (much, 64 slots worth) more space - none
of them ended up small.

llvm-svn: 307608

7 years ago[cmake] Check for Haiku when setting LIB_NAMES for GNU ld
Andrew Wilkins [Tue, 11 Jul 2017 01:17:44 +0000 (01:17 +0000)]
[cmake] Check for Haiku when setting LIB_NAMES for GNU ld

Haiku uses GNU ld for linking, but is not captured in the
conditional when setting LIB_NAMES. This causes a shared
library with no symbols on Haiku. This patch simply adds
a check for whether the CMake system name is Haiku in
addition to the existing checks.

Patch by Jérôme Duval.

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

llvm-svn: 307607

7 years ago[libunwind][CMake] Add install path variable to allow overriding the destination
Petr Hosek [Tue, 11 Jul 2017 01:12:09 +0000 (01:12 +0000)]
[libunwind][CMake] Add install path variable to allow overriding the destination

This is going to be used by the runtime build in the multi-target
setup to allow using different install prefix for each target.

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

llvm-svn: 307606

7 years agoRemove circular dependency from runtimes/CMakeLists
George Karpenkov [Tue, 11 Jul 2017 00:48:00 +0000 (00:48 +0000)]
Remove circular dependency from runtimes/CMakeLists

llvm-svn: 307605

7 years ago[analyzer] Start fixing modeling of bool based types
Alexander Shaposhnikov [Tue, 11 Jul 2017 00:30:14 +0000 (00:30 +0000)]
[analyzer] Start fixing modeling of bool based types

This is a follow up for one of
the previous diffs https://reviews.llvm.org/D32328.
getTypeSize and with getIntWidth are not equivalent for bool
(see https://clang.llvm.org/doxygen/ASTContext_8cpp_source.html#l08444),
this causes a number of issues
(for instance, if APint X representing a bool is created
with the wrong bit width then X is not comparable against Min/Max
(because of the different bit width), that results in crashes
(triggered asserts) inside assume* methods),
for examples see the newly added test cases.

Test plan: make check-all

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

llvm-svn: 307604

7 years ago[clang-import-test] Test that enumerators and their values are found.
Sean Callanan [Tue, 11 Jul 2017 00:29:37 +0000 (00:29 +0000)]
[clang-import-test] Test that enumerators and their values are found.

llvm-svn: 307603

7 years ago[clang-import-test] Committed missed update to clang-import-test.cpp
Sean Callanan [Tue, 11 Jul 2017 00:27:57 +0000 (00:27 +0000)]
[clang-import-test] Committed missed update to clang-import-test.cpp

I didn't commit clang-import-test.cpp in r307600, but it had some
changes that were part of https://reviews.llvm.org/D35220

Corrected that now.

llvm-svn: 307602

7 years ago[CMake] Use tools template for clangd and modularize
Petr Hosek [Tue, 11 Jul 2017 00:18:07 +0000 (00:18 +0000)]
[CMake] Use tools template for clangd and modularize

This makes them usable as distribution components in the build.

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

llvm-svn: 307601