platform/upstream/llvm.git
6 years ago[AArch64] Refactor cheap cost model
Evandro Menezes [Mon, 1 Oct 2018 16:11:19 +0000 (16:11 +0000)]
[AArch64] Refactor cheap cost model

Refactor the order in `TII::isAsCheapAsAMove()` to ease future development
and maintenance.  Practically NFC.

llvm-svn: 343489

6 years ago[Basic] Update clang tests (really testing sys::fs) that broke with r343460
Sam McCall [Mon, 1 Oct 2018 16:07:03 +0000 (16:07 +0000)]
[Basic] Update clang tests (really testing sys::fs) that broke with r343460

llvm-svn: 343488

6 years ago[X86] Remove unnecessary BTmi/BTmr scheduler overrides
Simon Pilgrim [Mon, 1 Oct 2018 15:01:00 +0000 (15:01 +0000)]
[X86] Remove unnecessary BTmi/BTmr scheduler overrides

llvm-svn: 343487

6 years ago[InstCombine] Handle vector compares in foldGEPIcmp(), take 2
Jesper Antonsson [Mon, 1 Oct 2018 14:59:25 +0000 (14:59 +0000)]
[InstCombine] Handle vector compares in foldGEPIcmp(), take 2

Summary:
This is a continuation of the fix for PR34627 "InstCombine assertion at vector gep/icmp folding". (I just realized bugpoint had fuzzed the original test for me, so I had fixed another trigger of the same assert in adjacent code in InstCombine.)

This patch avoids optimizing an icmp (to look only at the base pointers) when the resulting icmp would have a different type.

The patch adds a testcase and also cleans up and shrinks the pre-existing test for the adjacent assert trigger.

Reviewers: lebedev.ri, majnemer, spatel

Reviewed By: lebedev.ri

Subscribers: llvm-commits

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

llvm-svn: 343486

6 years ago[mips] Generate tests expectations using update_llc_test_checks. NFC
Simon Atanasyan [Mon, 1 Oct 2018 14:43:07 +0000 (14:43 +0000)]
[mips] Generate tests expectations using update_llc_test_checks. NFC

Generate tests expectations using update_llc_test_checks and reduce
number of "check prefixes" used in the tests.

llvm-svn: 343485

6 years ago[X86][Btver2] Fix BTmr schedule uop counts
Simon Pilgrim [Mon, 1 Oct 2018 14:42:16 +0000 (14:42 +0000)]
[X86][Btver2] Fix BTmr schedule uop counts

Match AMD Fam16h SOG + llvm-exegesis tests

llvm-svn: 343484

6 years ago[OPENMP] Simplify code, NFC.
Alexey Bataev [Mon, 1 Oct 2018 14:40:06 +0000 (14:40 +0000)]
[OPENMP] Simplify code, NFC.

llvm-svn: 343483

6 years ago[InstCombine] try to convert vector insert+extract to trunc; 2nd try
Sanjay Patel [Mon, 1 Oct 2018 14:40:00 +0000 (14:40 +0000)]
[InstCombine] try to convert vector insert+extract to trunc; 2nd try

This was originally committed at rL343407, but reverted at
rL343458 because it crashed trying to handle a case where
the destination type is FP. This version of the patch adds
a check for that possibility. Tests added at rL343480.

Original commit message:

This transform is requested for the backend in:
https://bugs.llvm.org/show_bug.cgi?id=39016
...but I figured it was worth doing in IR too, and it's probably
easier to implement here, so that's this patch.

In the simplest case, we are just truncating a scalar value. If the
extract index doesn't correspond to the LSBs of the scalar, then we
have to shift-right before the truncate. Endian-ness makes this tricky,
but hopefully the ASCII-art helps visualize the transform.

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

llvm-svn: 343482

6 years ago[Preprocessor] Fix a crash when handling non-alpha include header.
Haojian Wu [Mon, 1 Oct 2018 14:38:43 +0000 (14:38 +0000)]
[Preprocessor] Fix a crash when handling non-alpha include header.

Summary: the crash is casued by an assertion in StringRef.
(llvm::StringRef::front() const: Assertion `!empty()' failed.)

Reviewers: sammccall

Subscribers: jsji, cfe-commits

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

llvm-svn: 343481

6 years ago[InstCombine] add more insert-extract tests for D52439; NFC
Sanjay Patel [Mon, 1 Oct 2018 14:29:09 +0000 (14:29 +0000)]
[InstCombine] add more insert-extract tests for D52439; NFC

The first attempt at this transform:
rL343407
...was reverted:
rL343458
...because it did not handle the case where we bitcast to FP.
The patch was already limited to avoid the case where we
bitcast from FP, but we might want to transform that too.

llvm-svn: 343480

6 years ago[OPENMP] Fix enum identifier, NFC.
Alexey Bataev [Mon, 1 Oct 2018 14:26:31 +0000 (14:26 +0000)]
[OPENMP] Fix enum identifier, NFC.

llvm-svn: 343479

6 years ago[X86] Create schedule classes for BTmi and BTmr instructions
Simon Pilgrim [Mon, 1 Oct 2018 14:23:37 +0000 (14:23 +0000)]
[X86] Create schedule classes for BTmi and BTmr instructions

llvm-svn: 343478

6 years ago[libomptarget-nvptx] Enable asserts in bclib
Jonas Hahnfeld [Mon, 1 Oct 2018 14:16:55 +0000 (14:16 +0000)]
[libomptarget-nvptx] Enable asserts in bclib

If the user requested LIBOMPTARGET_NVPTX_DEBUG, include asserts in
the bitcode library. Everything else will have very unpleasent
effects because asserts will appear when falling back to the static
library libomptarget-nvptx.a.

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

llvm-svn: 343477

6 years ago[libomptarget-nvptx] reduction: Determine if runtime uninitialized
Jonas Hahnfeld [Mon, 1 Oct 2018 14:14:26 +0000 (14:14 +0000)]
[libomptarget-nvptx] reduction: Determine if runtime uninitialized

Pass in the correct value of isRuntimeUninitialized() which solves
parallel reductions as reported on the mailing list.
For reference: r333285 did the same for loop scheduling.

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

llvm-svn: 343476

6 years agoFixed workaround made in https://reviews.llvm.org/D51694.
Andrey Churbanov [Mon, 1 Oct 2018 14:08:50 +0000 (14:08 +0000)]
Fixed workaround made in https://reviews.llvm.org/D51694.

Patch suggested by Kelvin Li: removed optional "kind=" part of kind-selector
for variables with long names and kind names.

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

llvm-svn: 343475

6 years ago[clangd] Add "check-clangd" target
Haojian Wu [Mon, 1 Oct 2018 14:02:02 +0000 (14:02 +0000)]
[clangd] Add "check-clangd" target

Summary:
So we don't have to run "check-clang-tools" (which builds and tests all
clang tools) to verify our clangd-related change. It'd save waiting time for
clangd developers.

check-clangd (build ~1000 files, run ~340 tests) vs check-clang-tools (build
~3000 files, run ~1000 tests).

In the future, we probably want to add similar target for other
clang-tools (e.g. clang-tidy).

Reviewers: sammccall

Subscribers: mgorny, ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 343474

6 years agoMove llvm util dependencies from clang-tools-extra to add_lit_target.
Haojian Wu [Mon, 1 Oct 2018 14:00:51 +0000 (14:00 +0000)]
Move llvm util dependencies from clang-tools-extra to add_lit_target.

Summary:
Address fixme in r301762. And would simplify the cmake file in
clang-tools-extra.

Reviewers: sammccall

Subscribers: mgorny, llvm-commits, cfe-commits

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

llvm-svn: 343473

6 years agoAdd support for unified_shared_memory clause on requires directive
Patrick Lyster [Mon, 1 Oct 2018 13:47:43 +0000 (13:47 +0000)]
Add support for unified_shared_memory clause on requires directive

llvm-svn: 343472

6 years ago[Interpreter] Escape backticks when dumping format entities.
Jonas Devlieghere [Mon, 1 Oct 2018 13:22:24 +0000 (13:22 +0000)]
[Interpreter] Escape backticks when dumping format entities.

Currently we reject our own default disassembly-format string because it
contains two backticks which causes everything in between to be
interpreter as an expression by the command interpreter. This patch
fixes that by escaping backticks when dumping format strings.

llvm-svn: 343471

6 years agoEscape newlines in default disassembly format.
Jonas Devlieghere [Mon, 1 Oct 2018 13:20:15 +0000 (13:20 +0000)]
Escape newlines in default disassembly format.

We can safely escape newlines in format strings because they will be
ignored by the format entity parser.

llvm-svn: 343470

6 years ago[LLVM-C] Add an accessor for the kind of a Metadata Node
Robert Widmann [Mon, 1 Oct 2018 13:15:09 +0000 (13:15 +0000)]
[LLVM-C] Add an accessor for the kind of a Metadata Node

Summary: Allows for retrieving the type of a metadata node.  Has the added benefit of ensuring that the C and C++ kind APIs stay in sync as a failure to add a corresponding LLVMMetadataKind will result in the switch in the accessor being semantically malformed.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 343469

6 years ago[X86][Btver2] Fix masked load schedule
Simon Pilgrim [Mon, 1 Oct 2018 13:12:05 +0000 (13:12 +0000)]
[X86][Btver2] Fix masked load schedule

JFPU01 resource usage should match JFPX

Match AMD Fam16h SOG + llvm-exegesis tests

llvm-svn: 343468

6 years ago[llvm-exegesis][NFC] Move random functions from CodeTemplate to SnippetGenerator.
Guillaume Chatelet [Mon, 1 Oct 2018 12:19:10 +0000 (12:19 +0000)]
[llvm-exegesis][NFC] Move random functions from CodeTemplate to SnippetGenerator.

Summary: Just moving methods around.

Reviewers: courbet

Subscribers: tschuett, llvm-commits

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

llvm-svn: 343461

6 years ago[Support] Listing a directory containing dangling symlinks is not an error.
Sam McCall [Mon, 1 Oct 2018 12:17:05 +0000 (12:17 +0000)]
[Support] Listing a directory containing dangling symlinks is not an error.

Summary:
Reporting this as an error required stat()ing every file, as well as seeming
semantically questionable.

Reviewers: vsk, bkramer

Subscribers: mgrang, kristina, llvm-commits, liaoyuke

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

llvm-svn: 343460

6 years agoBuild clang-headers when building clang tools.
Haojian Wu [Mon, 1 Oct 2018 12:16:38 +0000 (12:16 +0000)]
Build clang-headers when building clang tools.

Summary:
clang tools require clang headers to work on real project, e.g. when we
build clangd via `ninja clangd`, we expect the binary can run on
real-world project (without running another command `ninja clang-headers`).

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: mgorny, ilya-biryukov, ioeric, kadircet, cfe-commits

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

llvm-svn: 343459

6 years agoRevert r343407 "[InstCombine] try to convert vector insert+extract to trunc"
Hans Wennborg [Mon, 1 Oct 2018 12:07:45 +0000 (12:07 +0000)]
Revert r343407 "[InstCombine] try to convert vector insert+extract to trunc"

This caused Chromium builds to fail with "Illegal Trunc" assertion.
See https://crbug.com/890723 for repro.

> This transform is requested for the backend in:
> https://bugs.llvm.org/show_bug.cgi?id=39016
> ...but I figured it was worth doing in IR too, and it's probably
> easier to implement here, so that's this patch.
>
> In the simplest case, we are just truncating a scalar value. If the
> extract index doesn't correspond to the LSBs of the scalar, then we
> have to shift-right before the truncate. Endian-ness makes this tricky,
> but hopefully the ASCII-art helps visualize the transform.
>
> Differential Revision: https://reviews.llvm.org/D52439

llvm-svn: 343458

6 years ago[CodeComplete] #include completion treats -I as non-system (require header-like exten...
Sam McCall [Mon, 1 Oct 2018 11:56:42 +0000 (11:56 +0000)]
[CodeComplete] #include completion treats -I as non-system (require header-like extension).

llvm-svn: 343457

6 years ago[llvm-exegesis][NFC] Make randomizeUnsetVariables a free function.
Guillaume Chatelet [Mon, 1 Oct 2018 11:46:06 +0000 (11:46 +0000)]
[llvm-exegesis][NFC] Make randomizeUnsetVariables a free function.

Summary: This is prelimineary to moving random functions to SnippetGenerator.

Reviewers: courbet

Subscribers: tschuett, llvm-commits

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

llvm-svn: 343456

6 years ago[AMDGPU] Divergence driven instruction selection. Shift operations.
Alexander Timofeev [Mon, 1 Oct 2018 11:06:35 +0000 (11:06 +0000)]
[AMDGPU] Divergence driven instruction selection. Shift operations.

Summary: This change enables VOP3 shifts to be explicitly selected
         dependent on the divergence.

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

Reviewers: rampitec
llvm-svn: 343455

6 years ago[NFC] Adding "REQUIRES: zlib" to a llvm-objcopy test for bots without zlib.
Puyan Lotfi [Mon, 1 Oct 2018 10:50:23 +0000 (10:50 +0000)]
[NFC] Adding "REQUIRES: zlib" to a llvm-objcopy test for bots without zlib.

M    test/tools/llvm-objcopy/compress-and-decompress-debug-sections-error.test

llvm-svn: 343454

6 years ago[clangd] Query dex index using query-style trigrams, not identifier-style trigrams
Sam McCall [Mon, 1 Oct 2018 10:42:51 +0000 (10:42 +0000)]
[clangd] Query dex index using query-style trigrams, not identifier-style trigrams

llvm-svn: 343453

6 years ago[X86][BtVer2] Teach how to identify zero-idiom VPERM2F128rr instructions.
Andrea Di Biagio [Mon, 1 Oct 2018 10:35:13 +0000 (10:35 +0000)]
[X86][BtVer2] Teach how to identify zero-idiom VPERM2F128rr instructions.

This patch adds another variant class to identify zero-idiom VPERM2F128rr
instructions.

On Jaguar, a VPERM wih bit 3 and 7 of the mask set, is a zero-idiom.

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

llvm-svn: 343452

6 years ago[llvm-objcopy] Adding support for decompressing zlib compressed dwarf sections.
Puyan Lotfi [Mon, 1 Oct 2018 10:29:41 +0000 (10:29 +0000)]
[llvm-objcopy] Adding support for decompressing zlib compressed dwarf sections.

Summary: I had added support for compressing dwarf sections in a prior commit,
         this one adds support for decompressing. Usage is:

         llvm-objcopy --decompress-debug-sections input.o output.o

Reviewers: jakehehrlich, jhenderson, alexshap

Reviewed By: jhenderson

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

llvm-svn: 343451

6 years agoRecommit r343308: [LoopInterchange] Turn into a loop pass.
Florian Hahn [Mon, 1 Oct 2018 09:59:48 +0000 (09:59 +0000)]
Recommit r343308: [LoopInterchange] Turn into a loop pass.

llvm-svn: 343450

6 years agoFix typo in LLD man page
James Henderson [Mon, 1 Oct 2018 09:57:20 +0000 (09:57 +0000)]
Fix typo in LLD man page

llvm-svn: 343449

6 years ago[clangd] Fix header mapping for std::string. NFC
Eric Liu [Mon, 1 Oct 2018 08:50:49 +0000 (08:50 +0000)]
[clangd] Fix header mapping for std::string. NFC

Some implementation has std::string declared in <iosfwd>.

llvm-svn: 343448

6 years ago[X86][Sched] Update scheduling information for VZEROALL on HWS, BDW, SKX, SNB.
Clement Courbet [Mon, 1 Oct 2018 08:37:48 +0000 (08:37 +0000)]
[X86][Sched] Update scheduling information for VZEROALL on HWS, BDW, SKX, SNB.

    Summary:
    While looking at PR35606, I found out that the scheduling info is incorrect.

    One can check that it's really a P5+P6 and not a 2*P56 with:
    echo -e 'vzeroall\nvandps %xmm1, %xmm2, %xmm3' | ./bin/llvm-exegesis -mode=uops -snippets-file=-
    (vandps executes on P5 only)

    Reviewers: craig.topper, RKSimon

    Subscribers: llvm-commits

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

llvm-svn: 343447

6 years ago[X86][Sched] Add pfm uop counter definitions for SNB,BDW,SKX.
Clement Courbet [Mon, 1 Oct 2018 08:37:37 +0000 (08:37 +0000)]
[X86][Sched] Add pfm uop counter definitions for SNB,BDW,SKX.

llvm-svn: 343446

6 years ago[DebugInfo][Dexter] Incorrect DBG_VALUE after MCP dead copy instruction removal.
Carlos Alberto Enciso [Mon, 1 Oct 2018 08:14:44 +0000 (08:14 +0000)]
[DebugInfo][Dexter] Incorrect DBG_VALUE after MCP dead copy instruction removal.

When MachineCopyPropagation eliminates a dead 'copy', its associated debug information becomes invalid. as the recorded register has been removed.  It causes the debugger to display wrong variable value.

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

llvm-svn: 343445

6 years ago[CodeGen][NFC] Add tests for heterogeneous types in MergeConsecutiveStores
Clement Courbet [Mon, 1 Oct 2018 07:16:22 +0000 (07:16 +0000)]
[CodeGen][NFC] Add tests for heterogeneous types in MergeConsecutiveStores

Reviewers: efriedma

Subscribers: llvm-commits

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

llvm-svn: 343444

6 years ago[X86] Stop X86DomainReassignment from creating copies between GR8/GR16 physical regis...
Craig Topper [Mon, 1 Oct 2018 07:08:41 +0000 (07:08 +0000)]
[X86] Stop X86DomainReassignment from creating copies between GR8/GR16 physical registers and k-registers.

We can only copy between a k-register and a GR32/GR64 register.

This patch detects that the copy will be illegal and prevents the domain reassignment from happening for that closure.

This probably isn't the best fix, and we should probably figure out how to handle this correctly.

Fixes PR38803.

llvm-svn: 343443

6 years ago[ORC] Pass Symbols to ExecutionSession::lookup by value, potentially saving a
Lang Hames [Mon, 1 Oct 2018 04:59:10 +0000 (04:59 +0000)]
[ORC] Pass Symbols to ExecutionSession::lookup by value, potentially saving a
copy.

llvm-svn: 343442

6 years agoAttempt to fix aligned allocation configuration under clang-cl
Eric Fiselier [Mon, 1 Oct 2018 04:08:06 +0000 (04:08 +0000)]
Attempt to fix aligned allocation configuration under clang-cl

When we're using clang-cl and Microsoft's runtime implementation,
we don't provide align_val_t or aligned new/delete ourselves.

This patch updates the _LIBCPP_HAS_NO_ALIGNED_ALLOCATION macro
to reflect this.

llvm-svn: 343441

6 years agoRemove one more warning from clang-cl build
Eric Fiselier [Mon, 1 Oct 2018 03:59:05 +0000 (03:59 +0000)]
Remove one more warning from clang-cl build

llvm-svn: 343440

6 years agoFix Shadowing warning on Windows
Eric Fiselier [Mon, 1 Oct 2018 02:54:08 +0000 (02:54 +0000)]
Fix Shadowing warning on Windows

llvm-svn: 343439

6 years agoFix even more Clang warnings.
Eric Fiselier [Mon, 1 Oct 2018 01:59:37 +0000 (01:59 +0000)]
Fix even more Clang warnings.

This patch disables shift-sign-overflow warnings for now. It also
fixes most -Wfloat-equal warnings and -Wextra-semi warnings.

llvm-svn: 343438

6 years agoBump default dialect to C++14 for clang-cl
Eric Fiselier [Mon, 1 Oct 2018 01:51:46 +0000 (01:51 +0000)]
Bump default dialect to C++14 for clang-cl

llvm-svn: 343437

6 years agoRemove even more clang-cl warnings
Eric Fiselier [Mon, 1 Oct 2018 01:47:23 +0000 (01:47 +0000)]
Remove even more clang-cl warnings

llvm-svn: 343436

6 years agoMork more tests as FLAKY
Eric Fiselier [Mon, 1 Oct 2018 01:43:42 +0000 (01:43 +0000)]
Mork more tests as FLAKY

llvm-svn: 343435

6 years agoRemove even more warnings from clang-cl build
Eric Fiselier [Mon, 1 Oct 2018 01:31:23 +0000 (01:31 +0000)]
Remove even more warnings from clang-cl build

llvm-svn: 343434

6 years agoTurn off warnings under clang-cl
Eric Fiselier [Mon, 1 Oct 2018 01:15:50 +0000 (01:15 +0000)]
Turn off warnings under clang-cl

llvm-svn: 343433

6 years agoFix threaded test under no-threading configuration
Eric Fiselier [Mon, 1 Oct 2018 01:05:51 +0000 (01:05 +0000)]
Fix threaded test under no-threading configuration

llvm-svn: 343432

6 years agoAttempt to unbreak Windows configuration.
Eric Fiselier [Mon, 1 Oct 2018 01:00:11 +0000 (01:00 +0000)]
Attempt to unbreak Windows configuration.

Although libc++ doesn't yet support Windows we still have Windows
builders to track our progress.

Currently the clang-cl configuration seems broken because it doesn't
support -std=c++11 and instead requires /std:c++11. This patch attempts
to fix this.

llvm-svn: 343431

6 years ago[ORC] Add convenience methods for creating DynamicLibraryFallbackGenerators for
Lang Hames [Mon, 1 Oct 2018 00:59:28 +0000 (00:59 +0000)]
[ORC] Add convenience methods for creating DynamicLibraryFallbackGenerators for
libraries on disk, and for the current process.

Avoids more boilerplate during JIT construction.

llvm-svn: 343430

6 years ago[ORC] Add a method to JITTargetMachineBuilder to get the default data layout
Lang Hames [Mon, 1 Oct 2018 00:59:26 +0000 (00:59 +0000)]
[ORC] Add a method to JITTargetMachineBuilder to get the default data layout
for the target machine.

This simplifies usage during setup of concurrent JIT stacks where the client
needs a DataLayout, but not a TargetMachine (TargetMachines are created on
the fly by the compile threads later).

llvm-svn: 343429

6 years ago[X86] Change an llvm_unreachable to a report_fatal_error so the optimizer will stop...
Craig Topper [Sun, 30 Sep 2018 23:43:30 +0000 (23:43 +0000)]
[X86] Change an llvm_unreachable to a report_fatal_error so the optimizer will stop making us reach the other report_fatal_error in this function.

There's a conditional report_fatal_error just above this llvm_unreachable. The optimizer when seeing the unreachable removes the conditional and just makes any other error trigger the existing report_fatal_error.

llvm-svn: 343428

6 years ago[ORC] Add an 'intern' method to ExecutionEngine for interning symbol names.
Lang Hames [Sun, 30 Sep 2018 23:18:24 +0000 (23:18 +0000)]
[ORC] Add an 'intern' method to ExecutionEngine for interning symbol names.

This cuts down on boilerplate by reducing 'ES.getSymbolStringPool().intern(...)'
to 'ES.intern(...)'.

llvm-svn: 343427

6 years agoUse the container form llvm::sort(C, ...)
Fangrui Song [Sun, 30 Sep 2018 22:31:29 +0000 (22:31 +0000)]
Use the container form llvm::sort(C, ...)

There are a few leftovers in rL343163 which span two lines. This commit
changes these llvm::sort(C.begin(), C.end, ...) to llvm::sort(C, ...)

llvm-svn: 343426

6 years agoUse the container form llvm::sort(C, ...)
Fangrui Song [Sun, 30 Sep 2018 21:41:11 +0000 (21:41 +0000)]
Use the container form llvm::sort(C, ...)

There are a few leftovers of rC343147 that are not (\w+)\.begin but in
the form of ([-[:alnum:]>.]+)\.begin or spanning two lines. Change them
to use the container form in this commit. The 12 occurrences have been
inspected manually for safety.

llvm-svn: 343425

6 years ago[X86] Fix scheduler class for BTmi instructions
Simon Pilgrim [Sun, 30 Sep 2018 20:19:16 +0000 (20:19 +0000)]
[X86] Fix scheduler class for BTmi instructions

This wasn't treated as a folded load instruction

llvm-svn: 343424

6 years ago[ORC] Extract and tidy up JITTargetMachineBuilder, add unit test.
Lang Hames [Sun, 30 Sep 2018 19:12:23 +0000 (19:12 +0000)]
[ORC] Extract and tidy up JITTargetMachineBuilder, add unit test.

(1) Adds comments for the API.

(2) Removes the setArch method: This is redundant: the setArchStr method on the
    triple should be used instead.

(3) Turns EmulatedTLS on by default. This matches EngineBuilder's behavior.

llvm-svn: 343423

6 years ago[COFF] In MinGW mode, ignore relocations against a discarded section
Martin Storsjo [Sun, 30 Sep 2018 18:31:03 +0000 (18:31 +0000)]
[COFF] In MinGW mode, ignore relocations against a discarded section

When GCC produces a jump table as part of a comdat function, the
jump table itself is produced as plain non-comdat rdata section. When
linked with ld.bfd, all of those rdata sections are kept, with
relocations unchanged in the sections that refer to discarded comdat
sections.

This has been observed with at least GCC 5.x and 7.x.

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

llvm-svn: 343422

6 years ago[LLVM-MCA][X86] Add missing VCMPESTR/VCMPESTR tests
Simon Pilgrim [Sun, 30 Sep 2018 18:19:00 +0000 (18:19 +0000)]
[LLVM-MCA][X86] Add missing VCMPESTR/VCMPESTR tests

llvm-svn: 343421

6 years agoFix linkage error on ProgramPoint's dump method.
Eric Fiselier [Sun, 30 Sep 2018 18:05:39 +0000 (18:05 +0000)]
Fix linkage error on ProgramPoint's dump method.

Currently, ProgramPoint::dump calls the out-of-line function ProgramPoint::print. This causes
libraries which include ProgramPoint.h to become dependent on libclangAnalysis, which in turn
causes missing symbol link error when building with -DBUILD_SHARED_LIBS=ON -DLLVM_ENABLE_MODULES=ON.

The breakage was introduced in r343160.

This patch fixes the issues by moving ProgramPoint::dump's declaration out of line.

llvm-svn: 343420

6 years ago[X86] Copy memrefs when folding a load for division instruction selection.
Craig Topper [Sun, 30 Sep 2018 17:47:18 +0000 (17:47 +0000)]
[X86] Copy memrefs when folding a load for division instruction selection.

llvm-svn: 343419

6 years agoReverting r343415 as it breaks at least one of the bots.
Aaron Ballman [Sun, 30 Sep 2018 17:39:39 +0000 (17:39 +0000)]
Reverting r343415 as it breaks at least one of the bots.

http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/37336

llvm-svn: 343418

6 years ago[PHIElimination] Lower a PHI node with only undef uses as IMPLICIT_DEF
Bjorn Pettersson [Sun, 30 Sep 2018 17:26:58 +0000 (17:26 +0000)]
[PHIElimination] Lower a PHI node with only undef uses as IMPLICIT_DEF

Summary:
The lowering of PHI nodes used to detect if all inputs originated
from IMPLICIT_DEF's. If so the PHI node was replaced by an
IMPLICIT_DEF. Now we also consider undef uses when checking the
inputs. So if all inputs are implicitly defined or undef we
lower the PHI to an IMPLICIT_DEF. This makes
PHIElimination::LowerPHINode more consistent as it checks
both implicit and undef properties at later stages.

Reviewers: MatzeB, tstellar

Reviewed By: MatzeB

Subscribers: jvesely, nhaehnle, llvm-commits

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

llvm-svn: 343417

6 years ago[PHIElimination] Update the regression test for PR16508
Bjorn Pettersson [Sun, 30 Sep 2018 17:23:21 +0000 (17:23 +0000)]
[PHIElimination] Update the regression test for PR16508

Summary:
When PR16508 was solved (in rL185363) a regression test was
added as test/CodeGen/PowerPC/2013-07-01-PHIElimBug.ll.
I discovered that the test case no longer reproduced the
scenario from PR16508. This problem could have been amended
by adding an extra RUN line with "-O1" (or possibly "-O0"),
but instead I added a mir-reproducer
  test/CodeGen/PowerPC/2013-07-01-PHIElimBug.mir
to get a reproducer that is less sensitive to changes in
earlier passes (including O-level).

While being at it I also corrected a code comment in
PHIElimination::EliminatePHINodes that has been incorrect
since the related bugfix from rL185363.

Reviewers: MatzeB, hfinkel

Reviewed By: MatzeB

Subscribers: nemanjai, jsji, llvm-commits

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

llvm-svn: 343416

6 years agoAllow clang-tidy to be built without a dependency on the clang static analyzer.
Aaron Ballman [Sun, 30 Sep 2018 17:22:58 +0000 (17:22 +0000)]
Allow clang-tidy to be built without a dependency on the clang static analyzer.

Patch by Stephen Kelly.

llvm-svn: 343415

6 years ago[LLVM-MCA][X86] Add some AVX512 tests
Simon Pilgrim [Sun, 30 Sep 2018 17:01:59 +0000 (17:01 +0000)]
[LLVM-MCA][X86] Add some AVX512 tests

These are going to be necessary to check I don't mess up when I start cleaning up all the remaining vector integer overrides

llvm-svn: 343414

6 years ago[X86][Btver2] Fix PCmpIStrI/PCmpIStrM schedules
Simon Pilgrim [Sun, 30 Sep 2018 16:38:38 +0000 (16:38 +0000)]
[X86][Btver2] Fix PCmpIStrI/PCmpIStrM schedules

Missing JFPU0 pipe and double JFPU1 pipe (to match JVALU1) resources

Match AMD Fam16h SOG + llvm-exegesis tests

llvm-svn: 343413

6 years ago[PDB] Add native support for dumping array types.
Zachary Turner [Sun, 30 Sep 2018 16:19:18 +0000 (16:19 +0000)]
[PDB] Add native support for dumping array types.

llvm-svn: 343412

6 years agoFix NetBSD build for r343409
Pavel Labath [Sun, 30 Sep 2018 16:12:09 +0000 (16:12 +0000)]
Fix NetBSD build for r343409

Forgot to remove the method declaration from the header.

llvm-svn: 343411

6 years ago[X86][BtVer2] Add the ability to add additional uops for folded instructions
Simon Pilgrim [Sun, 30 Sep 2018 15:58:56 +0000 (15:58 +0000)]
[X86][BtVer2] Add the ability to add additional uops for folded instructions

Some instructions take an extra load uop - but not consistently.....

llvm-svn: 343410

6 years agoPull GetSoftwareBreakpointPCOffset into base class
Pavel Labath [Sun, 30 Sep 2018 15:58:52 +0000 (15:58 +0000)]
Pull GetSoftwareBreakpointPCOffset into base class

Summary:
This function encodes the knowledge of whether the PC points to the
breakpoint instruction of the one following it after the breakpoint is
"hit". This behavior mainly(*) depends on the architecture and not on the
OS, so it makes sense for it to be implemented in the base class, where
it can be shared between different implementations (Linux and NetBSD
atm).

(*) It is possible for an OS to expose a different API, perhaps by doing
some fixups in the kernel. In this case, the implementation can override
this function to implement custom behavior.

Reviewers: krytarowski, zturner

Subscribers: lldb-commits

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

llvm-svn: 343409

6 years agoUpdate ifunc attribute support documentation
Ed Maste [Sun, 30 Sep 2018 15:08:18 +0000 (15:08 +0000)]
Update ifunc attribute support documentation

Previously we documented GNU binutils and glibc versions required for
ifunc support, but our own lld linker and FreeBSD's rtld also support
ifuncs.

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

llvm-svn: 343408

6 years ago[InstCombine] try to convert vector insert+extract to trunc
Sanjay Patel [Sun, 30 Sep 2018 14:34:01 +0000 (14:34 +0000)]
[InstCombine] try to convert vector insert+extract to trunc

This transform is requested for the backend in:
https://bugs.llvm.org/show_bug.cgi?id=39016
...but I figured it was worth doing in IR too, and it's probably
easier to implement here, so that's this patch.

In the simplest case, we are just truncating a scalar value. If the
extract index doesn't correspond to the LSBs of the scalar, then we
have to shift-right before the truncate. Endian-ness makes this tricky,
but hopefully the ASCII-art helps visualize the transform.

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

llvm-svn: 343407

6 years ago[InstCombine] allow lengthening of insertelement to eliminate shuffles
Sanjay Patel [Sun, 30 Sep 2018 13:50:42 +0000 (13:50 +0000)]
[InstCombine] allow lengthening of insertelement to eliminate shuffles

As noted in post-commit comments for D52548, the limitation on
increasing vector length can be applied by opcode.
As a first step, this patch only allows insertelement to be
widened because that has no logical downsides for IR and has
little risk of pessimizing codegen.

This may cause PR39132 to go into hiding during a full compile,
but that bug is not fixed.

llvm-svn: 343406

6 years ago[DAG] Don't perform SINT_TO_FP<->UINT_TO_FP custom conversion after legalization
Simon Pilgrim [Sun, 30 Sep 2018 12:46:42 +0000 (12:46 +0000)]
[DAG] Don't perform SINT_TO_FP<->UINT_TO_FP custom conversion after legalization

The SINT_TO_FP<->UINT_TO_FP combines for non-negative integers should only occur for legal ops once LegalOperations = true

No test case to hand, noticed when investigating PR38226 + PR38970

llvm-svn: 343405

6 years ago[NFC][CodeGen][X86][AArch64] Add 64-bit constant bit field extract pattern tests
Roman Lebedev [Sun, 30 Sep 2018 12:42:08 +0000 (12:42 +0000)]
[NFC][CodeGen][X86][AArch64] Add 64-bit constant bit field extract pattern tests

llvm-svn: 343404

6 years ago[X86] Regenerate MMX coalescing test
Simon Pilgrim [Sun, 30 Sep 2018 09:42:04 +0000 (09:42 +0000)]
[X86] Regenerate MMX coalescing test

Exposes another extractelement(bitcast(scalartovector())) pattern

llvm-svn: 343403

6 years ago[libomptarget-nvptx] Align data sharing stack
Jonas Hahnfeld [Sun, 30 Sep 2018 09:23:21 +0000 (09:23 +0000)]
[libomptarget-nvptx] Align data sharing stack

NVPTX requires addresses of pointer locations to be 8-byte aligned
or there will be an exception during runtime.
This could happen without this patch as shown in the added test:
getId() requires 4 byte of stack and putValueInParallel() uses 16
bytes to store the addresses of the captured variables.

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

llvm-svn: 343402

6 years ago[libomptarget-nvptx] Fix ancestor_thread_num and team_size (non-SPMD)
Jonas Hahnfeld [Sun, 30 Sep 2018 09:23:14 +0000 (09:23 +0000)]
[libomptarget-nvptx] Fix ancestor_thread_num and team_size (non-SPMD)

According to OpenMP 4.5, p250:12-14:

    If the requested nest level is outside the range of 0 and the
    nest level of the current thread, as returned by the omp_get_level
    routine, the routine returns -1.

The SPMD code path will need a similar fix.

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

llvm-svn: 343401

6 years ago[PDB] Fix this test for real.
Zachary Turner [Sun, 30 Sep 2018 03:57:49 +0000 (03:57 +0000)]
[PDB] Fix this test for real.

I was able to test this fix on an actual Windows machine
so this should get the bot green again.

llvm-svn: 343400

6 years ago[X86] Disable BMI BEXTR in X86DAGToDAGISel::matchBEXTRFromAnd unless we're on compili...
Craig Topper [Sun, 30 Sep 2018 03:01:46 +0000 (03:01 +0000)]
[X86] Disable BMI BEXTR in X86DAGToDAGISel::matchBEXTRFromAnd unless we're on compiling for a CPU with single uop BEXTR

Summary:
This function turns (X >> C1) & C2 into a BMI BEXTR or TBM BEXTRI instruction. For BMI BEXTR we have to materialize an immediate into a register to feed to the BEXTR instruction.

The BMI BEXTR instruction is 2 uops on Intel CPUs. It looks like on SKL its one port 0/6 uop and one port 1/5 uop. Despite what Agner's tables say. I know one of the uops is a regular shift uop so it would have to go through the port 0/6 shifter unit. So that's the same or worse execution wise than the shift+and which is one 0/6 uop and one 0/1/5/6 uop. The move immediate into register is an additional 0/1/5/6 uop.

For now I've limited this transform to AMD CPUs which have a single uop BEXTR. If may also might make sense if we can fold a load or if the and immediate is larger than 32-bits and can't be encoded as a sign extended 32-bit value or if LICM or CSE can hoist the move immediate and share it. But we'd need to look more carefully at that. In the regression I looked at it doesn't look load folding or large immediates were occurring so the regression isn't caused by the loss of those. So we could try to be smarter here if we find a compelling case.

Reviewers: RKSimon, spatel, lebedev.ri, andreadb

Reviewed By: RKSimon

Subscribers: llvm-commits, andreadb, RKSimon

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

llvm-svn: 343399

6 years agoOnly dump the types we need in the test.
Zachary Turner [Sun, 30 Sep 2018 00:51:54 +0000 (00:51 +0000)]
Only dump the types we need in the test.

We added support for dumping pointers but pointers to arrays
won't correctly dump until we add support for dumping arrays.
Instead of trying to dump everything, which this test isn't
even interested in, just dump enums and typedefs.

llvm-svn: 343398

6 years agoFix some tests on Windows.
Zachary Turner [Sun, 30 Sep 2018 00:22:21 +0000 (00:22 +0000)]
Fix some tests on Windows.

I don't actually have a Windows machine at the present moment,
so hopefully this fixes it.

llvm-svn: 343397

6 years ago[ORC] Add partitioning support to CompileOnDemandLayer2.
Lang Hames [Sat, 29 Sep 2018 23:49:57 +0000 (23:49 +0000)]
[ORC] Add partitioning support to CompileOnDemandLayer2.

CompileOnDemandLayer2 now supports user-supplied partition functions (the
original CompileOnDemandLayer already supported these).

Partition functions are called with the list of requested global values
(i.e. global values that currently have queries waiting on them) and have an
opportunity to select extra global values to materialize at the same time.

Also adds testing infrastructure for the new feature to lli.

llvm-svn: 343396

6 years ago[ORC] Clear SymbolToDefinitionMap when materializing a MaterializationUnit.
Lang Hames [Sat, 29 Sep 2018 23:49:56 +0000 (23:49 +0000)]
[ORC] Clear SymbolToDefinitionMap when materializing a MaterializationUnit.

The map is inaccessible at this point, so we may as well reclaim the memory
early.

llvm-svn: 343395

6 years agoAdd a comment to clarify the contract for LLVMGetErrorMessage in the c-bindings
Lang Hames [Sat, 29 Sep 2018 23:49:54 +0000 (23:49 +0000)]
Add a comment to clarify the contract for LLVMGetErrorMessage in the c-bindings
for Error.

llvm-svn: 343394

6 years ago[PDB] Better native API support for pointers.
Zachary Turner [Sat, 29 Sep 2018 23:28:19 +0000 (23:28 +0000)]
[PDB] Better native API support for pointers.

We didn't properly detect when a pointer was a member
pointer, and when that was the case we were not
properly returning class parent info.  This caused
member pointers to render incorrectly in pretty mode.
However, we didn't even have pretty tests for pointers
in native mode, so those are also added now to ensure
this.

llvm-svn: 343393

6 years ago[DAGCombiner][NFC] Tests for X div/rem Y single bit fold
David Bolvansky [Sat, 29 Sep 2018 21:00:37 +0000 (21:00 +0000)]
[DAGCombiner][NFC] Tests for X div/rem Y single bit fold

llvm-svn: 343392

6 years ago[X86][AVX2] Cleanup shuffle combining tests - add common prefixes
Simon Pilgrim [Sat, 29 Sep 2018 20:34:16 +0000 (20:34 +0000)]
[X86][AVX2] Cleanup shuffle combining tests - add common prefixes

llvm-svn: 343391

6 years ago[X86] SimplifyDemandedVectorEltsForTargetNode - remove identity target shuffles befor...
Simon Pilgrim [Sat, 29 Sep 2018 18:15:26 +0000 (18:15 +0000)]
[X86] SimplifyDemandedVectorEltsForTargetNode - remove identity target shuffles before simplifying inputs

By removing demanded target shuffles that simplify to zero/undef/identity before simplifying its inputs we improve chances of further simplification, as only the immediate parent user of the combined is added back to the work list - this still doesn't help us if its passed through other ops though (bitcasts....).

llvm-svn: 343390

6 years ago[X86] Add fast-isel test cases for unaligned load/store intrinsics recently added...
Craig Topper [Sat, 29 Sep 2018 18:03:52 +0000 (18:03 +0000)]
[X86] Add fast-isel test cases for unaligned load/store intrinsics recently added to clang

This adds tests for:
_mm_loadu_si16
_mm_loadu_si32
_mm_loadu_si16
_mm_storeu_si64
_mm_storeu_si32
_mm_storeu_si16

llvm-svn: 343389

6 years ago[X86] Add more of the icc unaligned load/store to/from 128 bit vector intrinsics
Craig Topper [Sat, 29 Sep 2018 17:49:42 +0000 (17:49 +0000)]
[X86] Add more of the icc unaligned load/store to/from 128 bit vector intrinsics

Summary:
This patch adds
_mm_loadu_si32
_mm_loadu_si16
_mm_storeu_si64
_mm_storeu_si32
_mm_storeu_si16

We already had _mm_load_si64.

Reviewers: spatel, RKSimon

Reviewed By: RKSimon

Subscribers: cfe-commits

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

llvm-svn: 343388

6 years ago[X86][SSE] LowerScalarImmediateShift - remove 32-bit vXi64 special case handling.
Simon Pilgrim [Sat, 29 Sep 2018 17:36:22 +0000 (17:36 +0000)]
[X86][SSE] LowerScalarImmediateShift - remove 32-bit vXi64 special case handling.

This is all handled generally by getTargetConstantBitsFromNode now

llvm-svn: 343387

6 years agoFix signed/unsigned mismatch warning. NFCI.
Simon Pilgrim [Sat, 29 Sep 2018 17:11:19 +0000 (17:11 +0000)]
Fix signed/unsigned mismatch warning. NFCI.

llvm-svn: 343385

6 years ago[X86] getTargetConstantBitsFromNode - add support for rearranging constant bits via...
Simon Pilgrim [Sat, 29 Sep 2018 17:01:55 +0000 (17:01 +0000)]
[X86] getTargetConstantBitsFromNode - add support for rearranging constant bits via shuffles

Exposed an issue that recursive calls to getTargetConstantBitsFromNode don't handle changes to EltSizeInBits yet.

llvm-svn: 343384

6 years ago[X86][SSE] LowerScalarImmediateShift - use getTargetConstantBitsFromNode to get immed...
Simon Pilgrim [Sat, 29 Sep 2018 16:40:35 +0000 (16:40 +0000)]
[X86][SSE] LowerScalarImmediateShift - use getTargetConstantBitsFromNode to get immediate data

Don't just attempt to find a splat build vector.

First step towards getting rid of all the 32-bit special case code.

llvm-svn: 343383