platform/upstream/llvm.git
7 years agoSimplify interface now that we don't need to pass IsPCRel. NFC.
Rafael Espindola [Tue, 11 Jul 2017 23:56:10 +0000 (23:56 +0000)]
Simplify interface now that we don't need to pass IsPCRel. NFC.

llvm-svn: 307734

7 years ago[PDB] Use a more appropriate message for a fatal error
Reid Kleckner [Tue, 11 Jul 2017 23:44:51 +0000 (23:44 +0000)]
[PDB] Use a more appropriate message for a fatal error

llvm-svn: 307733

7 years ago[codeview] Change readobj symbol dumping format
Reid Kleckner [Tue, 11 Jul 2017 23:41:41 +0000 (23:41 +0000)]
[codeview] Change readobj symbol dumping format

Avoid duplicating DictScope with hand-written names everywhere.  Print
the S_-prefixed symbol kind for every record. This should make it easier
to search for certain kinds of records when debugging PDB linking.

llvm-svn: 307732

7 years ago[CMake] Support multi-target runtimes build
Petr Hosek [Tue, 11 Jul 2017 23:41:15 +0000 (23:41 +0000)]
[CMake] Support multi-target runtimes build

This changes adds support for building runtimes for multiple
different targets using LLVM runtimes directory.

The implementation follow the model used already by the builtins
build which already supports this option. To specify the runtimes
targets to be built, use the LLVM_RUNTIME_TARGETS variable, where
the valuae is the list of targets to build runtimes for. To pass
a per target variable to the runtimes build, you can set
RUNTIMES_<target>_<variable> where <variable> will be passed to the
runtimes build for <target>.

Each runtime target (except for the default one) will be installed
into lib/<target> subdirectory. Build targets will be suffixed with
the target name.

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

llvm-svn: 307731

7 years agoFully fix the movw/movt addend.
Rafael Espindola [Tue, 11 Jul 2017 23:18:25 +0000 (23:18 +0000)]
Fully fix the movw/movt addend.

The issue is not if the value is pcrel. It is whether we have a
relocation or not.

If we have a relocation, the static linker will select the upper
bits. If we don't have a relocation, we have to do it.

llvm-svn: 307730

7 years ago[IPO] Temporarily rollback r307215.
Davide Italiano [Tue, 11 Jul 2017 23:10:17 +0000 (23:10 +0000)]
[IPO] Temporarily rollback r307215.

[GlobalOpt] Remove unreachable blocks before optimizing a function.
While the change is presumably correct, it exposes a latent bug
in DI which breaks on of the CFI checks. I'll analyze it further
and try to understand what's going on.

llvm-svn: 307729

7 years agoUpdate now that the llvm-mc bug is fixed.
Rafael Espindola [Tue, 11 Jul 2017 22:56:51 +0000 (22:56 +0000)]
Update now that the llvm-mc bug is fixed.

llvm-svn: 307728

7 years ago[Dominators] Use a custom DFS implementation
Jakub Kuderski [Tue, 11 Jul 2017 22:55:04 +0000 (22:55 +0000)]
[Dominators] Use a custom DFS implementation

Summary:
Custom DFS implementation allows us to skip over certain nodes without adding them to the visited map, which is not easily doable with llvm's dfs iterators. What's more, caching predecessors becomes easy.

This patch implements a single DFS function (template) for both forward and reverse DFS, which should be easier to maintain then separate two ones.

Skipping over nodes based on a predicate will be necessary later to implement incremental updates.

There also seems to be a very slight performance improved when bootstrapping clang with this patch on my machine (3:28s -> 3:26s) .

Reviewers: dberlin, sanjoy, davide, grosser

Reviewed By: dberlin

Subscribers: llvm-commits

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

llvm-svn: 307727

7 years ago[PDB] Tweak bad type index error handling
Reid Kleckner [Tue, 11 Jul 2017 22:37:50 +0000 (22:37 +0000)]
[PDB] Tweak bad type index error handling

Translate invalid type indices to a sentinel value instead of skipping
the record. Skipping records isn't a good recovery method, because we
can skip a scope open or close record, which will confuse the scope
management code.

We currently have lots of invalid type indices on Microsoft-provided
standard libraries, because the LF_TYPESERVER2 records contain absolute
paths that are only valid on their build servers. Our type server
handlers need to look at other things (GUIDs) to find these type server
PDBs.

llvm-svn: 307726

7 years ago[codeview] Fix type index discovery for four symbol records
Reid Kleckner [Tue, 11 Jul 2017 22:37:25 +0000 (22:37 +0000)]
[codeview] Fix type index discovery for four symbol records

I encountered these when linking LLD, which uses atls.lib. Those objects
appear to use these uncommon symbol records:

  0x115E S_HEAPALLOCSITE
  0x113D S_ENVBLOCK
  0x1113 S_GTHREAD32
  0x1153 S_FILESTATIC

llvm-svn: 307725

7 years agoEnhance synchscope representation (clang)
Konstantin Zhuravlyov [Tue, 11 Jul 2017 22:23:37 +0000 (22:23 +0000)]
Enhance synchscope representation (clang)

Relevant changes required for r307722.

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

llvm-svn: 307723

7 years agoEnhance synchscope representation
Konstantin Zhuravlyov [Tue, 11 Jul 2017 22:23:00 +0000 (22:23 +0000)]
Enhance synchscope representation

  OpenCL 2.0 introduces the notion of memory scopes in atomic operations to
  global and local memory. These scopes restrict how synchronization is
  achieved, which can result in improved performance.

  This change extends existing notion of synchronization scopes in LLVM to
  support arbitrary scopes expressed as target-specific strings, in addition to
  the already defined scopes (single thread, system).

  The LLVM IR and MIR syntax for expressing synchronization scopes has changed
  to use *syncscope("<scope>")*, where <scope> can be "singlethread" (this
  replaces *singlethread* keyword), or a target-specific name. As before, if
  the scope is not specified, it defaults to CrossThread/System scope.

  Implementation details:
    - Mapping from synchronization scope name/string to synchronization scope id
      is stored in LLVM context;
    - CrossThread/System and SingleThread scopes are pre-defined to efficiently
      check for known scopes without comparing strings;
    - Synchronization scope names are stored in SYNC_SCOPE_NAMES_BLOCK in
      the bitcode.

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

llvm-svn: 307722

7 years ago[ODRHash] Support more method types.
Richard Trieu [Tue, 11 Jul 2017 22:10:49 +0000 (22:10 +0000)]
[ODRHash] Support more method types.

Hash CXXConstructorDecl and CXXDestructorDecl.  Extend the diagnostics from
CXXMethodDecl to include constructors and destructors.

llvm-svn: 307720

7 years ago[CodeGen] Rename DEBUG_TYPE to match passnames
Evandro Menezes [Tue, 11 Jul 2017 22:08:28 +0000 (22:08 +0000)]
[CodeGen] Rename DEBUG_TYPE to match passnames

Rename missing DEBUG_TYPE "machine-scheduler" from backend files, which were
absent from https://reviews.llvm.org/rL303921.

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

llvm-svn: 307719

7 years ago[x86] auto-generate full checks; NFC
Sanjay Patel [Tue, 11 Jul 2017 22:04:36 +0000 (22:04 +0000)]
[x86] auto-generate full checks; NFC

llvm-svn: 307718

7 years ago[mips][mt] Correct spelling error in comment. NFCI.
Simon Dardis [Tue, 11 Jul 2017 21:36:58 +0000 (21:36 +0000)]
[mips][mt] Correct spelling error in comment. NFCI.

llvm-svn: 307717

7 years ago[mips][mt][2/7] Implement .module and .set directives for the MT ASE.
Simon Dardis [Tue, 11 Jul 2017 21:28:36 +0000 (21:28 +0000)]
[mips][mt][2/7] Implement .module and .set directives for the MT ASE.

This patch implements the .module and .set directives for the MT ASE,
notably that .module sets the relevant flags in .MIPS.abiflags and .set
doesn't.

Reviewers: slthakur, atanasyan

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

llvm-svn: 307716

7 years ago[clangd] Fix Go to Definition not working in VSCode extension
Marc-Andre Laperle [Tue, 11 Jul 2017 21:26:18 +0000 (21:26 +0000)]
[clangd] Fix Go to Definition not working in VSCode extension

Summary:
The URI conversion logic was returning 'undefined' when going from server to
VSCode which broke the Go to Definition functionality.

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 307715

7 years ago[ARM, ELF] Don't shift movt relocation offsets
Martin Storsjo [Tue, 11 Jul 2017 21:07:10 +0000 (21:07 +0000)]
[ARM, ELF] Don't shift movt relocation offsets

For ELF, a movw+movt pair is handled as two separate relocations.
If an offset should be applied to the symbol address, this offset is
stored as an immediate in the instruction (as opposed to stored as an
offset in the relocation itself).

Even though the actual value stored in the movt immediate after linking
is the top half of the value, we need to store the unshifted offset
prior to linking. When the relocation is made during linking, the offset
gets added to the target symbol value, and the upper half of the value
is stored in the instruction.

This makes sure that movw+movt with offset symbols get properly
handled, in case the offset addition in the lower half should be
carried over to the upper half.

This makes the output from the additions to the test case match
the output from GNU binutils.

For COFF and MachO, the movw/movt relocations are handled as a pair,
and the overflow from the lower half gets carried over to the movt,
so they should keep the shifted offset just as before.

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

llvm-svn: 307713

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