platform/upstream/llvm.git
7 years agofix typo in document; NFC
Hiroshi Inoue [Wed, 12 Jul 2017 12:16:22 +0000 (12:16 +0000)]
fix typo in document; NFC

llvm-svn: 307775

7 years ago[mips][mt][3/7] Add IAS support for emt, dmt instructions.
Simon Dardis [Wed, 12 Jul 2017 11:57:44 +0000 (11:57 +0000)]
[mips][mt][3/7] Add IAS support for emt, dmt instructions.

Reviewers: slthakur, atanasyan

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

llvm-svn: 307774

7 years agoFixing Android builder
Ravitheja Addepally [Wed, 12 Jul 2017 11:54:17 +0000 (11:54 +0000)]
Fixing Android builder

llvm-svn: 307773

7 years ago[Linker] Add directives to support mixing ARM/Thumb module-level inline asm.
Florian Hahn [Wed, 12 Jul 2017 11:52:28 +0000 (11:52 +0000)]
[Linker] Add directives to support mixing ARM/Thumb module-level inline asm.

Summary:
By prepending `.text .thumb .balign 2` to the module-level inline
assembly from a Thumb module, the assembler will generate the assembly
from that module as Thumb, even if the destination module uses an ARM
triple. Similar directives are used for module-level inline assembly in
ARM modules.

The alignment and instruction set are reset based on the target triple
before emitting the first function label.

Reviewers: olista01, tejohnson, echristo, t.p.northover, rafael

Reviewed By: echristo

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

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

llvm-svn: 307772

7 years ago[libclang] Support for querying whether an enum is scoped
Alex Lorenz [Wed, 12 Jul 2017 11:35:11 +0000 (11:35 +0000)]
[libclang] Support for querying whether an enum is scoped

This commit allows checking whether an enum declaration is scoped
through libclang and clang.cindex (Python).

Patch by Johann Klähn!

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

llvm-svn: 307771

7 years agoRevert r307769 (Forgot to mention the name of the contributor).
Alex Lorenz [Wed, 12 Jul 2017 11:34:14 +0000 (11:34 +0000)]
Revert r307769 (Forgot to mention the name of the contributor).

llvm-svn: 307770

7 years ago[libclang] Support for querying whether an enum is scoped
Alex Lorenz [Wed, 12 Jul 2017 11:31:37 +0000 (11:31 +0000)]
[libclang] Support for querying whether an enum is scoped

This commit allows checking whether an enum declaration is scoped
through libclang and clang.cindex (Python).

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

llvm-svn: 307769

7 years agoAdding Support for Error Strings in Remote Packets
Ravitheja Addepally [Wed, 12 Jul 2017 11:15:34 +0000 (11:15 +0000)]
Adding Support for Error Strings in Remote Packets

Summary:
This patch adds support for sending strings along with
error codes in the reply packets. The implementation is
based on the feedback recieved in the lldb-dev mailing
list. The patch also adds an extra packet for the client
to query if the server has the capability to provide
strings along with error replys.

Reviewers: labath, jingham, sas, lldb-commits, clayborg

Reviewed By: labath, clayborg

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

llvm-svn: 307768

7 years ago[ELF] - Fix handling of weak symbols from static library when using version script.
George Rimar [Wed, 12 Jul 2017 11:09:46 +0000 (11:09 +0000)]
[ELF] - Fix handling of weak symbols from static library when using version script.

When version script was used, binding opf undefined weak symbols sometimes
was calculated as STB_LOCAL, making them non-preemtible what
broke correct relocations handling logic for them.

Fixes PR33738.

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

llvm-svn: 307767

7 years ago[ARM] GlobalISel: Simplify inst selector code. NFC
Diana Picus [Wed, 12 Jul 2017 10:31:16 +0000 (10:31 +0000)]
[ARM] GlobalISel: Simplify inst selector code. NFC

Refactor CmpHelper into something simpler. It was overkill to use
templates for this - instead, use a simple CmpConstants structure to
hold the opcodes and other constants that are different when selecting
int / float / double comparisons. Also, extract some of the helpers that
were in CmpHelper into ARMInstructionSelector and make use of some of
them when selecting other things than just compares.

llvm-svn: 307766

7 years ago[Polly] [Tests] Update `lit.cfg` uses of `lit.util.capture` to `subprocess.check_output`
Siddharth Bhat [Wed, 12 Jul 2017 09:42:05 +0000 (09:42 +0000)]
[Polly] [Tests] Update `lit.cfg` uses of `lit.util.capture` to `subprocess.check_output`

- `lit.util.capture` was removed in `r306625`.
- Replace `lit.util.capture` to `subprocess.check_output` as LLVM did.
- LLVM revision of this change: `https://reviews.llvm.org/D35088`.

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

llvm-svn: 307765

7 years ago[PM] Fix a silly bug in my recent update to the CG update logic.
Chandler Carruth [Wed, 12 Jul 2017 09:08:11 +0000 (09:08 +0000)]
[PM] Fix a silly bug in my recent update to the CG update logic.

I used the wrong variable to update. This was even covered by a unittest
I wrote, and the comments for the unittest were correct (if confusing)
but the test itself just matched the buggy behavior. =[

llvm-svn: 307764

7 years ago[ARM] GlobalISel: Select s64 G_FCMP
Diana Picus [Wed, 12 Jul 2017 09:01:54 +0000 (09:01 +0000)]
[ARM] GlobalISel: Select s64 G_FCMP

Very similar to how we select s32 G_FCMP, the only thing that is
different is the exact opcodes that we use.

llvm-svn: 307763

7 years agoHave Module::createRNG return a unique_ptr
Serge Guelton [Wed, 12 Jul 2017 08:03:44 +0000 (08:03 +0000)]
Have Module::createRNG return a unique_ptr

Instead of a raw pointer, this makes memory management safer.

llvm-svn: 307762

7 years ago[X86][LLVM]Expanding Supports lowerInterleavedStore() in X86InterleavedAccess.
Michael Zuckerman [Wed, 12 Jul 2017 08:01:44 +0000 (08:01 +0000)]
[X86][LLVM]Expanding Supports lowerInterleavedStore() in X86InterleavedAccess.
Adding base test for AVX512

llvm-svn: 307761

7 years agoExpose some type-conversion functions as part of the IRGen ABI.
John McCall [Wed, 12 Jul 2017 07:44:17 +0000 (07:44 +0000)]
Expose some type-conversion functions as part of the IRGen ABI.

Patch by Benoit Vey!

llvm-svn: 307760

7 years agoCFG: Add CFGElement for automatic variables that leave the scope
Matthias Gehre [Wed, 12 Jul 2017 07:04:19 +0000 (07:04 +0000)]
CFG: Add CFGElement for automatic variables that leave the scope

Summary:
This mimics the implementation for the implicit destructors. The
generation of this scope leaving elements is hidden behind
a flag to the CFGBuilder, thus it should not affect existing code.

Currently, I'm missing a test (it's implicitly tested by the clang-tidy
lifetime checker that I'm proposing).
I though about a test using debug.DumpCFG, but then I would
have to add an option to StaticAnalyzer/Core/AnalyzerOptions
to enable the scope leaving CFGElement,
which would only be useful to that particular test.

Any other ideas how I could make a test for this feature?

Reviewers: krememek, jordan_rose

Subscribers: cfe-commits

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

llvm-svn: 307759

7 years ago[X86] Synchronize the ProcessorFeatures enum used by getHostCPUName with the enum...
Craig Topper [Wed, 12 Jul 2017 06:49:58 +0000 (06:49 +0000)]
[X86] Synchronize the ProcessorFeatures enum used by getHostCPUName with the enum in libgcc and soon compiler-rt.

This adds all the feature bits libgcc has. They will soon be added to compiler-rt as well. This adds a second 32 bit feature variable to hold the bits that are needed by getHostCPUName that are not in libgcc. libgcc had already used 31 of the 32 bits in the existing variable and we needed 3 bits so at minimum 2 bits would spill over. I chose to move all 3.

llvm-svn: 307758

7 years ago[X86] Sync ProcessorTypes and ProcessorSubtypes enums used by getHostCPUName with...
Craig Topper [Wed, 12 Jul 2017 06:49:57 +0000 (06:49 +0000)]
[X86] Sync ProcessorTypes and ProcessorSubtypes enums used by getHostCPUName with the version proposed to for compiler-rt's cpu_model.c

This keeps the starting entries in the enums in sync with what's in gcc and in review D35214 for compiler-rt.

llvm-svn: 307757

7 years ago[X86] Cleanup the switches in getHostCPUName to remove impossible combinations.
Craig Topper [Wed, 12 Jul 2017 06:49:56 +0000 (06:49 +0000)]
[X86] Cleanup the switches in getHostCPUName to remove impossible combinations.

llvm-svn: 307756

7 years ago[X86] Remove 'barcelona' string from getHostCPUName. Use 'amdfam10' instead. The...
Craig Topper [Wed, 12 Jul 2017 06:49:55 +0000 (06:49 +0000)]
[X86] Remove 'barcelona' string from getHostCPUName. Use 'amdfam10' instead. The x86 backend doesn't distinguish.

llvm-svn: 307755

7 years ago[MemoryBuiltins] Allow truncation in visitAllocaInst()
Mikael Holmen [Wed, 12 Jul 2017 06:19:10 +0000 (06:19 +0000)]
[MemoryBuiltins] Allow truncation in visitAllocaInst()

Summary:
Solves PR33689.

If the pointer size is less than the size of the type used for the array
size in an alloca (the <ty> type below) then we could trigger the assert in
the PR. In that example we have pointer size i16 and <ty> is i32.

<result> = alloca [inalloca] <type> [, <ty> <NumElements>] [, align <alignment>]

Handle the situation by allowing truncation as well as zero extension in
ObjectSizeOffsetVisitor::visitAllocaInst().

Also, we now detect overflow in visitAllocaInst(), similar to how it was
already done in visitCallSite().

Reviewers: craig.topper, rnk, george.burgess.iv

Reviewed By: george.burgess.iv

Subscribers: davide, llvm-commits

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

llvm-svn: 307754

7 years agoRevert "[PDB] Use a more appropriate message for a fatal error"
Vitaly Buka [Wed, 12 Jul 2017 04:34:17 +0000 (04:34 +0000)]
Revert "[PDB] Use a more appropriate message for a fatal error"
Revert "[PDB] Tweak bad type index error handling"

check-lld with asan detects use-after-poison.

This reverts commits r307733 and r307726.

llvm-svn: 307752

7 years agoFix unrepresentable enum for clang-cl unstable ABI
Ben Craig [Wed, 12 Jul 2017 01:45:13 +0000 (01:45 +0000)]
Fix unrepresentable enum for clang-cl unstable ABI

When using LIBCXX_ABI_UNSTABLE=YES, clang-cl gave the following warning:

P:\llvm_master\src\llvm\projects\libcxx\include\string(683,51):
warning: enumerator value is not representable in the underlying type
'int' [-Wmicrosoft-enum-value]

Fixed by switching from enums to static const size_type.

https://reviews.llvm.org/D35174

llvm-svn: 307751

7 years agoRemove redundant newline.
Rui Ueyama [Wed, 12 Jul 2017 01:43:01 +0000 (01:43 +0000)]
Remove redundant newline.

llvm-svn: 307750

7 years agoRemove <__refstring> header; Move it into source directory.
Eric Fiselier [Wed, 12 Jul 2017 01:38:35 +0000 (01:38 +0000)]
Remove <__refstring> header; Move it into source directory.

The libc++ <__refstring> headers has no real reason why it should
be a public header that libc++ ships. The only reason it was in the include
directory was because libc++abi needed it to build the library.

However keeping <__refstring> a header had other problems, like requiring its
dependancies to also be in the headers. For that reason this patch
moves it into the source directory.

To work around libc++abi's need for this header a duplicated copy was added
to libc++abi in r307748. While duplicating the code is an unfortunate solution
it's the best solution that's currently possible.

In the future I would like to start a discussion on the mailing lists about
making libc++abi build as a sub-project of libc++, requiring the libc++ sources
always be present.

llvm-svn: 307749

7 years agoRemove dependancy on __refstring header; use local copy instead.
Eric Fiselier [Wed, 12 Jul 2017 01:34:21 +0000 (01:34 +0000)]
Remove dependancy on __refstring header; use local copy instead.

This patch removes the dependancy on libc++'s __refstring header,
which was only a header in the first place so that libc++abi could
build library code using it, and not because libc++ needed it in
the headers.

This patch allows libc++ to stop shipping <__refstring> publicaly
at the cost of duplicating it across projects. Ideally libc++abi
would always require the libc++ sources when building, but that's
a separate discussion I plan to start on the mailing lists shortly.

llvm-svn: 307748

7 years agoSpecify complete target triple in test
Matthias Braun [Wed, 12 Jul 2017 01:16:50 +0000 (01:16 +0000)]
Specify complete target triple in test

This should fix the problems on the greendragon build.

llvm-svn: 307747

7 years agoRevert "[libc++] Refactoring __sync_* builtins; NFC (Reland)"
Eric Fiselier [Wed, 12 Jul 2017 01:16:33 +0000 (01:16 +0000)]
Revert "[libc++] Refactoring __sync_* builtins; NFC (Reland)"

This reverts commit r307595. The commit had some issues that needed
to first be addressed in review.

llvm-svn: 307746

7 years agoFix minor typo introduced in r276404
Don Hinton [Wed, 12 Jul 2017 01:15:46 +0000 (01:15 +0000)]
Fix minor typo introduced in r276404

Summary:
A space was added between '-' and 'help' when emitting help output.

See https://reviews.llvm.org/D22621 for details.

Reviewers: MaggieYi, vsk

Reviewed By: vsk

Subscribers: llvm-commits

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

llvm-svn: 307745

7 years agoLowerTypeTests: When importing functions skip definitions where the summary contains...
Peter Collingbourne [Wed, 12 Jul 2017 00:39:12 +0000 (00:39 +0000)]
LowerTypeTests: When importing functions skip definitions where the summary contains a decl.

This normally indicates mixed CFI + non-CFI compilation, and will
result in us treating the function in the same way as a function
defined outside of the LTO unit.

Part of PR33752.

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

llvm-svn: 307744

7 years ago[ODRHash] Revert r307720 to fix buildbot.
Richard Trieu [Wed, 12 Jul 2017 00:38:27 +0000 (00:38 +0000)]
[ODRHash] Revert r307720 to fix buildbot.

llvm-svn: 307743

7 years ago[Dominators][NFC] Remove extra semicolon...
Jakub Kuderski [Wed, 12 Jul 2017 00:29:16 +0000 (00:29 +0000)]
[Dominators][NFC] Remove extra semicolon...

to silence a gcc warning.

llvm-svn: 307742

7 years ago[WebAssembly] Expose the offset of each data segment
Sam Clegg [Wed, 12 Jul 2017 00:24:54 +0000 (00:24 +0000)]
[WebAssembly] Expose the offset of each data segment

Summary:
This allows tools like lld that process relocations
to apply data relocation correctly. This information
is required because relocation are stored as section
offset.

Subscribers: jfb, dschuff, jgravelle-google, aheejin

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

llvm-svn: 307741

7 years agoFix unused variable warnings
Konstantin Zhuravlyov [Wed, 12 Jul 2017 00:15:53 +0000 (00:15 +0000)]
Fix unused variable warnings

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

llvm-svn: 307740

7 years ago[tsan] Update test to r307338
Vitaly Buka [Wed, 12 Jul 2017 00:14:05 +0000 (00:14 +0000)]
[tsan] Update test to r307338

r307338 enabled new optimization reducing number of operation in tested functions.
There is no any performance regression detectable with TsanRtlTest DISABLED_BENCH.Mop* tests.

llvm-svn: 307739

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