platform/upstream/llvm.git
6 years ago[X86] Simplify some code in combineSetCC. NFCI
Craig Topper [Sat, 25 Nov 2017 07:20:24 +0000 (07:20 +0000)]
[X86] Simplify some code in combineSetCC. NFCI

Make the condition for doing a std::swap simpler so we don't have to repeat the full checks.

llvm-svn: 318970

6 years ago[X86] Qualify some vector specific code with VT.isVector(). NFCI
Craig Topper [Sat, 25 Nov 2017 07:20:23 +0000 (07:20 +0000)]
[X86] Qualify some vector specific code with VT.isVector(). NFCI

Other checks inside require a build_vector, but we this lets us stop earlier and makes the code more clear.

llvm-svn: 318969

6 years ago[X86] Support folding to andnps with SSE1 only.
Craig Topper [Sat, 25 Nov 2017 07:20:22 +0000 (07:20 +0000)]
[X86] Support folding to andnps with SSE1 only.

With SSE1 only, we emit FAND and FXOR nodes for v4f32.

llvm-svn: 318968

6 years ago[X86] Add some early DAG combines to turn v4i32 AND/OR/XOR into FAND/FOR/FXOR whe...
Craig Topper [Sat, 25 Nov 2017 07:20:21 +0000 (07:20 +0000)]
[X86] Add some early DAG combines to turn v4i32 AND/OR/XOR into FAND/FOR/FXOR whe only SSE1 is available.

v4i32 isn't a legal type with sse1 only and would end up getting scalarized otherwise.

This isn't completely ideal as it doesn't handle cases like v8i32 that would get split to v4i32. But it at least helps with code written using the clang intrinsic header.

llvm-svn: 318967

6 years agoRecommit r318963 "[APInt] Don't print debug messages from the APInt knuth division...
Craig Topper [Fri, 24 Nov 2017 20:29:04 +0000 (20:29 +0000)]
Recommit r318963 "[APInt] Don't print debug messages from the APInt knuth division algorithm by default"

The previous commit had the condition in the do/while backwards.

Debug builds currently print out low level details of the Knuth division algorithm when -debug is used. This information isn't useful in most cases and just adds noise to the log.

This adds a new preprocessor flag to enable the prints in the knuth division code in APInt.

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

llvm-svn: 318966

6 years ago[X86] Prevent using X * rsqrt(X) to approximate sqrt when only sse1 is enabled.
Craig Topper [Fri, 24 Nov 2017 19:57:48 +0000 (19:57 +0000)]
[X86] Prevent using X * rsqrt(X) to approximate sqrt when only sse1 is enabled.

This optimization can occur after type legalization and emit a vselect with v4i32 type. But that type is not legal with sse1. This ultimately gets scalarized by the second type legalization that runs after vector op legalization, but that's really intended to handle the scalar types that might be introduced by legalizing vector ops.

For now just stop this from happening by disabling the optimization with sse1.

llvm-svn: 318965

6 years agoRevert 318963 "[APInt] Don't print debug messages from the APInt knuth division algor...
Craig Topper [Fri, 24 Nov 2017 19:32:34 +0000 (19:32 +0000)]
Revert 318963 "[APInt] Don't print debug messages from the APInt knuth division algorithm by default"

I seem to have botched the logic when switching to push_macro

llvm-svn: 318964

6 years ago[APInt] Don't print debug messages from the APInt knuth division algorithm by default
Craig Topper [Fri, 24 Nov 2017 19:13:24 +0000 (19:13 +0000)]
[APInt] Don't print debug messages from the APInt knuth division algorithm by default

Debug builds currently print out low level details of the Knuth division algorithm when -debug is used. This information isn't useful in most cases and just adds noise to the log.

This adds a new preprocessor flag to enable the prints in the knuth division code in APInt.

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

llvm-svn: 318963

6 years agoDelete dead code.
Rafael Espindola [Fri, 24 Nov 2017 19:06:14 +0000 (19:06 +0000)]
Delete dead code.

The parent constructor is already setting the binding.

llvm-svn: 318962

6 years agoFix MSVC double-float implicit truncation warning. NFCI
Simon Pilgrim [Fri, 24 Nov 2017 18:18:42 +0000 (18:18 +0000)]
Fix MSVC double-float implicit truncation warning. NFCI

llvm-svn: 318961

6 years ago[clang-format] Deduplicate using declarations
Krasimir Georgiev [Fri, 24 Nov 2017 18:00:01 +0000 (18:00 +0000)]
[clang-format] Deduplicate using declarations

Summary: This deduplicated equivalent using declarations within a block.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits, klimek

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

llvm-svn: 318960

6 years agoclang-format: [JS] do not break in ArrayType[].
Martin Probst [Fri, 24 Nov 2017 17:05:56 +0000 (17:05 +0000)]
clang-format: [JS] do not break in ArrayType[].

Summary:
Wrapping between the type name and the array type indicator creates
invalid syntax in TypeScript.

Before:
    const xIsALongIdent:
        YJustBarelyFitsLinex
            [];  // illegal syntax.

After:
    const xIsALongIdent:
        YJustBarelyFitsLinex[];

Reviewers: djasper

Subscribers: klimek

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

llvm-svn: 318959

6 years agoclang-format: [JS] do not wrap before yield.
Martin Probst [Fri, 24 Nov 2017 17:05:35 +0000 (17:05 +0000)]
clang-format: [JS] do not wrap before yield.

Summary: The same rules apply as for `return`.

Reviewers: djasper

Subscribers: klimek

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

llvm-svn: 318958

6 years agoclang-format: [JS] space between ! assert and in.
Martin Probst [Fri, 24 Nov 2017 17:04:40 +0000 (17:04 +0000)]
clang-format: [JS] space between ! assert and in.

Summary:
Before:
    x = y!in z;
After:
    x = y! in z;

Reviewers: djasper

Subscribers: klimek

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

llvm-svn: 318957

6 years ago[CodeGenPrepare] Check that erased sunken address are not reused
Simon Dardis [Fri, 24 Nov 2017 16:45:28 +0000 (16:45 +0000)]
[CodeGenPrepare] Check that erased sunken address are not reused

CodeGenPrepare sinks address computations from one basic block to another
and attempts to reuse address computations that have already been sunk. If
the same address computation appears twice with the first instance as an
operand of a load whose result is an operand to a simplifable select,
CodeGenPrepare simplifies the select and recursively erases the now dead
instructions. CodeGenPrepare then attempts to use the erased address
computation for the second load.

Fix this by erasing the cached address value if it has zero uses before
looking for the address value in the sunken address map.

This partially resolves PR35209.

Thanks to Alexander Richardson for reporting the issue!

This fixed version relands r318032 which was reverted in r318049 due to
sanitizer buildbot failures.

Reviewers: john.brawn

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

llvm-svn: 318956

6 years ago[AMDGPU][MC][GFX9] Added v_interp_p2_f16 and v_interp_p2_legacy_f16
Dmitry Preobrazhensky [Fri, 24 Nov 2017 15:37:14 +0000 (15:37 +0000)]
[AMDGPU][MC][GFX9] Added v_interp_p2_f16 and v_interp_p2_legacy_f16

See bug 33629: https://bugs.llvm.org//show_bug.cgi?id=33629

Reviewers: artem.tamazov, SamWot, arsenm

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

llvm-svn: 318955

6 years ago[AVR] Use the short form of 'clr <reg>'
Dylan McKay [Fri, 24 Nov 2017 15:36:43 +0000 (15:36 +0000)]
[AVR] Use the short form of 'clr <reg>'

r318895 made it so that the simpler instruction aliases are printed
rather than their expanded form.

llvm-svn: 318954

6 years agoMake helpers static. NFC.
Benjamin Kramer [Fri, 24 Nov 2017 14:55:41 +0000 (14:55 +0000)]
Make helpers static. NFC.

llvm-svn: 318953

6 years ago[SCEV] : Simplify loop to range-loop.NFC.
Javed Absar [Fri, 24 Nov 2017 14:35:38 +0000 (14:35 +0000)]
[SCEV] : Simplify loop to range-loop.NFC.

llvm-svn: 318952

6 years ago[clang-tidy] rename_check.py: fix header guard handling
Alexander Kornienko [Fri, 24 Nov 2017 14:33:06 +0000 (14:33 +0000)]
[clang-tidy] rename_check.py: fix header guard handling

llvm-svn: 318951

6 years ago[clang-tidy] Move a few more checks from misc to bugprone.
Alexander Kornienko [Fri, 24 Nov 2017 14:16:29 +0000 (14:16 +0000)]
[clang-tidy] Move a few more checks from misc to bugprone.

Summary:
clang_tidy/rename_check.py misc-assert-side-effect bugprone-assert-side-effect
clang_tidy/rename_check.py misc-bool-pointer-implicit-conversion bugprone-bool-pointer-implicit-conversion
clang_tidy/rename_check.py misc-fold-init-type bugprone-fold-init-type
clang_tidy/rename_check.py misc-forward-declaration-namespace bugprone-forward-declaration-namespace
clang_tidy/rename_check.py misc-inaccurate-erase bugprone-inaccurate-erase
clang_tidy/rename_check.py misc-move-forwarding-reference bugprone-move-forwarding-reference
clang_tidy/rename_check.py misc-multiple-statement-macro bugprone-multiple-statement-macro
clang_tidy/rename_check.py misc-use-after-move bugprone-use-after-move
clang_tidy/rename_check.py misc-virtual-near-miss bugprone-virtual-near-miss

Manually fixed a reference to UseAfterMoveCheck in the hicpp module.
Manually fixed header guards.

Reviewers: hokein

Reviewed By: hokein

Subscribers: nemanjai, mgorny, javed.absar, xazax.hun, kbarton, cfe-commits

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

llvm-svn: 318950

6 years ago[CGP] Make optimizeMemoryInst able to combine more kinds of ExtAddrMode fields
John Brawn [Fri, 24 Nov 2017 14:10:45 +0000 (14:10 +0000)]
[CGP] Make optimizeMemoryInst able to combine more kinds of ExtAddrMode fields

This patch extends the recent work in optimizeMemoryInst to make it able to
combine more ExtAddrMode fields than just the BaseReg.

This fixes some benchmark regressions introduced by r309397, where GVN PRE is
hoisting a getelementptr such that it can no longer be combined into the
addressing mode of the load or store that uses it.

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

llvm-svn: 318949

6 years ago[mips] Set microMIPS ASE flag
Aleksandar Beserminji [Fri, 24 Nov 2017 14:00:47 +0000 (14:00 +0000)]
[mips] Set microMIPS ASE flag

This patch fixes an issue where microMIPS ASE flag is not set
when a function has micromips attribute or when .set micromips
directive is used.

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

llvm-svn: 318948

6 years ago[AMDGPU][MC][GFX9] Added support of 'inst_offset' modifier for compatibility with SP3
Dmitry Preobrazhensky [Fri, 24 Nov 2017 13:22:38 +0000 (13:22 +0000)]
[AMDGPU][MC][GFX9] Added support of 'inst_offset' modifier for compatibility with SP3

See bug 35329: https://bugs.llvm.org//show_bug.cgi?id=35329

Reviewers: arsenm, vpykhtin, artem.tamazov

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

llvm-svn: 318947

6 years ago[clangd] Sort list of sources in CMakeLists.txt. NFC
Ilya Biryukov [Fri, 24 Nov 2017 13:13:41 +0000 (13:13 +0000)]
[clangd] Sort list of sources in CMakeLists.txt. NFC

llvm-svn: 318946

6 years agoAvoid copying the data of in-memory preambles
Ilya Biryukov [Fri, 24 Nov 2017 13:12:38 +0000 (13:12 +0000)]
Avoid copying the data of in-memory preambles

Summary: Preambles are large and we should avoid copying them.

Reviewers: bkramer, klimek

Reviewed By: bkramer

Subscribers: cfe-commits

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

llvm-svn: 318945

6 years ago[clangd] Ensure preamble outlives the AST
Ilya Biryukov [Fri, 24 Nov 2017 13:04:21 +0000 (13:04 +0000)]
[clangd] Ensure preamble outlives the AST

Summary:
In-memory preambles will not be copied anymore, so we need to make
sure they outlive the AST.

Reviewers: bkramer, sammccall, klimek

Reviewed By: sammccall

Subscribers: cfe-commits

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

llvm-svn: 318944

6 years ago[Tooling] Acknowledge that many CompilationDatabases don't support enumeration.
Sam McCall [Fri, 24 Nov 2017 12:13:55 +0000 (12:13 +0000)]
[Tooling] Acknowledge that many CompilationDatabases don't support enumeration.

Summary: Provide default implementations so that only getCompileCommands() is mandatory.

Reviewers: ioeric

Subscribers: cfe-commits, bkramer, klimek

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

llvm-svn: 318943

6 years agoclang-format: [JS] handle destructuring `of`.
Martin Probst [Fri, 24 Nov 2017 10:48:25 +0000 (10:48 +0000)]
clang-format: [JS] handle destructuring `of`.

Summary:
Previously, clang-format would drop a space character between `of` and
then following (non-identifier) token if the preceding token was part of
a destructuring assignment (`}` or `]`).

Before:
    for (const [a, b] of[]) {}

After:
    for (const [a, b] of []) {}

Reviewers: djasper

Subscribers: klimek

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

llvm-svn: 318942

6 years ago[clang-tidy] rename_check.py misc-dangling-handle bugprone-dangling-handle
Alexander Kornienko [Fri, 24 Nov 2017 09:52:05 +0000 (09:52 +0000)]
[clang-tidy] rename_check.py misc-dangling-handle bugprone-dangling-handle

Reviewers: hokein

Reviewed By: hokein

Subscribers: mgorny, xazax.hun, cfe-commits

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

llvm-svn: 318941

6 years ago[ELF] Rename .bss.rel.ro to .data.rel.ro.bss for some Linker Scripts.
Peter Smith [Fri, 24 Nov 2017 08:48:29 +0000 (08:48 +0000)]
[ELF] Rename .bss.rel.ro to .data.rel.ro.bss for some Linker Scripts.

LLD uses .bss.rel.ro for read-only copy relocations whereas the ld.bfd and
gold linkers use .data.rel.ro. In some linker scripts including ld.bfd's
internal linker script, the relro sections are placed sequentially assuming
.data.rel.ro is used. LLD's use of .bss.rel.ro means that the copy
relocations get matched into the .bss section causing the relro sections to
be non-contiguous.

This change checks for a .data.rel.ro OutputSection when a linker script
with the SECTIONS command is used. The section will match in the
.data.rel.ro output section and will maintain contiguous relro.

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

Fixes PR35265

llvm-svn: 318940

6 years ago[ELF] Make tests with undefined symbols more explicit.
Igor Kudrin [Fri, 24 Nov 2017 06:42:32 +0000 (06:42 +0000)]
[ELF] Make tests with undefined symbols more explicit.

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

llvm-svn: 318939

6 years agoUse lambdas to store lazy-evaluated .dynamic entries.
Rui Ueyama [Fri, 24 Nov 2017 02:15:51 +0000 (02:15 +0000)]
Use lambdas to store lazy-evaluated .dynamic entries.

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

llvm-svn: 318938

6 years agoMake a test stricter.
Rafael Espindola [Thu, 23 Nov 2017 23:40:33 +0000 (23:40 +0000)]
Make a test stricter.

It now has a DT_NEEDED that could be removed by --gc-sections and one
that cannot. Without this all tests would pass if --gc-sections just
removed all DT_NEEDED.

llvm-svn: 318937

6 years ago[YAMLParser] Fix unused variable warning.
Benjamin Kramer [Thu, 23 Nov 2017 21:07:11 +0000 (21:07 +0000)]
[YAMLParser] Fix unused variable warning.

llvm-svn: 318936

6 years ago[YAMLParser] Don't crash on null keys in KeyValueNodes.
Benjamin Kramer [Thu, 23 Nov 2017 20:57:20 +0000 (20:57 +0000)]
[YAMLParser] Don't crash on null keys in KeyValueNodes.

Found by clangd-fuzzer!

llvm-svn: 318935

6 years ago[X86] Don't invert NewCC variable while processing the jcc/setcc/cmovcc instructions...
Craig Topper [Thu, 23 Nov 2017 19:25:45 +0000 (19:25 +0000)]
[X86] Don't invert NewCC variable while processing the jcc/setcc/cmovcc instructions in optimizeCompareInstr.

The NewCC variable is calculated outside of the loop that processes jcc/setcc/cmovcc instructions. If we invert it during the loop it can cause an incorrect value to be used by a later iteration. Instead only read it during the loop and use a new variable to store the possibly inverted value.

Fixes PR35399.

llvm-svn: 318934

6 years ago[X86] Teach isel that X86ISD::CMPM_RND zeros the upper bits of the mask register.
Craig Topper [Thu, 23 Nov 2017 18:41:21 +0000 (18:41 +0000)]
[X86] Teach isel that X86ISD::CMPM_RND zeros the upper bits of the mask register.

llvm-svn: 318933

6 years ago[X86] Remove some unneeded opcodes from getVectorMaskingNode. NFC
Craig Topper [Thu, 23 Nov 2017 18:41:20 +0000 (18:41 +0000)]
[X86] Remove some unneeded opcodes from getVectorMaskingNode. NFC

We never reach here with these opcodes.

llvm-svn: 318932

6 years ago[X86] Add X86ISD::CMPM_RND to getVectorMaskingNode to select ISD::AND instead of...
Craig Topper [Thu, 23 Nov 2017 18:41:19 +0000 (18:41 +0000)]
[X86] Add X86ISD::CMPM_RND to getVectorMaskingNode to select ISD::AND instead of ISD::VSELECT

A later DAG combine will turn the VSELECT into an AND, but we have the other mask compare opcodes here so add this one too.

llvm-svn: 318931

6 years ago[X86] Remove some dead code leftover from when i1 was a legal type. NFCI
Craig Topper [Thu, 23 Nov 2017 18:41:18 +0000 (18:41 +0000)]
[X86] Remove some dead code leftover from when i1 was a legal type. NFCI

llvm-svn: 318930

6 years ago[X86] Remove some dead code. NFC
Craig Topper [Thu, 23 Nov 2017 18:41:17 +0000 (18:41 +0000)]
[X86] Remove some dead code. NFC

AVX512 code never reaches here so we don't need to handle X86ISD::CMPM as an opcode.

llvm-svn: 318929

6 years ago[clangd] Tracing improvements
Sam McCall [Thu, 23 Nov 2017 17:12:04 +0000 (17:12 +0000)]
[clangd] Tracing improvements

Summary:
[clangd] Tracing improvements

Compose JSON using JSONExpr
Allow attaching metadata to spans (and avoid it if tracing is off)
Attach IDs and responses of JSON RPCs to their spans

The downside is that large responses make the trace viewer sluggish.
We should make our responses less huge :-) Or fix trace viewer.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

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

llvm-svn: 318928

6 years ago[clangd] Make completion scores use 0-1 floats internally.
Sam McCall [Thu, 23 Nov 2017 17:09:04 +0000 (17:09 +0000)]
[clangd] Make completion scores use 0-1 floats internally.

Summary:
This scale is much easier to mix with other signals, such as fuzzy match strength.
Mostly NFC, but it does reorder some low-priority items that get folded together at a score of 0 (see completion-qualifiers.test).
Removed the exact sortText from the testcases, because it's the ranking that we want to test.

Reviewers: hokein

Subscribers: ilya-biryukov, cfe-commits

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

llvm-svn: 318927

6 years ago[clang-tidy] rename_check.py misc-argument-comment bugprone-argument-comment
Alexander Kornienko [Thu, 23 Nov 2017 17:02:48 +0000 (17:02 +0000)]
[clang-tidy] rename_check.py misc-argument-comment bugprone-argument-comment

Summary: + manually convert the unit test to lit test.

Reviewers: hokein

Reviewed By: hokein

Subscribers: mgorny, xazax.hun, cfe-commits

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

llvm-svn: 318926

6 years ago[clangd] Drop impossible completions (unavailable or inaccessible)
Sam McCall [Thu, 23 Nov 2017 16:58:22 +0000 (16:58 +0000)]
[clangd] Drop impossible completions (unavailable or inaccessible)

Summary: (There must be some reason why D38077 didn't just do this, but I don't get it!)

Reviewers: ilya-biryukov

Subscribers: cfe-commits

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

llvm-svn: 318925

6 years ago[ELF] Skip over empty sections when checking for contiguous relro
Peter Smith [Thu, 23 Nov 2017 15:10:00 +0000 (15:10 +0000)]
[ELF] Skip over empty sections when checking for contiguous relro

When checking for contiguous relro sections we can skip over empty sections.
If there is an empty non-relro section in the middle of a contiguous block
of relro sections then it cannot be written to so it is safe to include in
PT_GNU_RELRO header. If there is a contiguous block of empty relro sections
then no PT_GNU_RELRO header is required for them.

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

llvm-svn: 318924

6 years agoMSan: remove an unnecessary cast. NFC for userspace instrumenetation.
Alexander Potapenko [Thu, 23 Nov 2017 15:06:51 +0000 (15:06 +0000)]
MSan: remove an unnecessary cast. NFC for userspace instrumenetation.

llvm-svn: 318923

6 years ago[clang-tidy] rename_check.py: fix a bug in check presence detection
Alexander Kornienko [Thu, 23 Nov 2017 14:59:19 +0000 (14:59 +0000)]
[clang-tidy] rename_check.py: fix a bug in check presence detection

llvm-svn: 318922

6 years agoFixing a typo; NFC.
Aaron Ballman [Thu, 23 Nov 2017 14:57:24 +0000 (14:57 +0000)]
Fixing a typo; NFC.

llvm-svn: 318921

6 years ago[ELF] Give error message when relro sections are not contiguous.
Peter Smith [Thu, 23 Nov 2017 14:53:10 +0000 (14:53 +0000)]
[ELF] Give error message when relro sections are not contiguous.

If a linker script is used that names linker generated synthetic sections
it is possible that the OutputSections for which isRelroSection() is true
are not contiguous. When the relro sections are not contiguous we cannot
describe them with a single PT_GNU_RELRO PHDR. Unfortunately at least one
contemporary dynamic loader only supports one PT_GNU_RELRO PHDR so we
cannot output more than one of these PHDRs. As not including relro
sections in the PHDR will lead to security sensitive sections being
writeable we choose to give an error message instead.

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

[ELF] Skip over empty sections when checking for contiguous relro

llvm-svn: 318920

6 years agoUpdate C++2a status and add Glen to CREDITS.TXT. Reviewed as https://reviews.llvm...
Marshall Clow [Thu, 23 Nov 2017 14:50:56 +0000 (14:50 +0000)]
Update C++2a status and add Glen to CREDITS.TXT. Reviewed as https://reviews.llvm.org/D40379

llvm-svn: 318919

6 years ago[clang-tidy] rename_check.py: Update '=====...' line in the docs.
Alexander Kornienko [Thu, 23 Nov 2017 14:05:32 +0000 (14:05 +0000)]
[clang-tidy] rename_check.py: Update '=====...' line in the docs.

llvm-svn: 318918

6 years ago[X86][SSE] Use (V)PHMINPOSUW for vXi16 SMAX/SMIN/UMAX/UMIN horizontal reductions...
Simon Pilgrim [Thu, 23 Nov 2017 13:50:27 +0000 (13:50 +0000)]
[X86][SSE] Use (V)PHMINPOSUW for vXi16 SMAX/SMIN/UMAX/UMIN horizontal reductions (PR32841)

(V)PHMINPOSUW determines the UMIN element in an v8i16 input, with suitable bit flipping it can also be used for SMAX/SMIN/UMAX cases as well.

This patch matches vXi16 SMAX/SMIN/UMAX/UMIN horizontal reductions and reduces the input down to a v8i16 vector before calling (V)PHMINPOSUW.

A later patch will use this for v16i8 reductions as well (PR32841).

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

llvm-svn: 318917

6 years ago[clang-tidy] rename_check.py misc-string-constructor bugprone-string-constructor
Alexander Kornienko [Thu, 23 Nov 2017 13:49:14 +0000 (13:49 +0000)]
[clang-tidy] rename_check.py misc-string-constructor bugprone-string-constructor

Summary:
Rename misc-string-constructor to bugprone-string-constructor +
manually update the lenght of '==='s in the doc file.

Reviewers: hokein, xazax.hun

Reviewed By: hokein, xazax.hun

Subscribers: mgorny, xazax.hun, cfe-commits

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

llvm-svn: 318916

6 years ago[ARM GlobalISel] Support G_FDIV for s32 and s64
Diana Picus [Thu, 23 Nov 2017 13:26:07 +0000 (13:26 +0000)]
[ARM GlobalISel] Support G_FDIV for s32 and s64

TableGen already generates code for selecting a G_FDIV, so we only need
to add a test.

For the legalizer and reg bank select, we do the same thing as for the
other floating point binary operations: either mark as legal if we have
a FP unit or lower to a libcall, and map to the floating point
registers.

llvm-svn: 318915

6 years agoReverted rL318911 since it broke the sanitizer-windows.
Ying Yi [Thu, 23 Nov 2017 13:23:21 +0000 (13:23 +0000)]
Reverted rL318911 since it broke the sanitizer-windows.

llvm-svn: 318914

6 years ago[clang-tidy] Detect bugs in bugprone-misplaced-operator-in-strlen-in-alloc even in...
Adam Balogh [Thu, 23 Nov 2017 13:12:25 +0000 (13:12 +0000)]
[clang-tidy] Detect bugs in bugprone-misplaced-operator-in-strlen-in-alloc even in the case the allocation function is called using a constant function pointer

Detect bugs even if a function of the malloc() family is called using a constant pointer.

llvm-svn: 318913

6 years ago[clang-tidy] Add support for operator new[] in check bugprone-misplaced-operator...
Adam Balogh [Thu, 23 Nov 2017 12:56:23 +0000 (12:56 +0000)]
[clang-tidy] Add support for operator new[] in check bugprone-misplaced-operator-in-strlen-in-alloc

The check now recognizes error cases like `new char[strlen(s + 1)]` and suggests
a fix in the format `new char[strlen(s) + 1]`.

llvm-svn: 318912

6 years ago[lit] Implement non-pipelined ‘mkdir’, ‘diff’ and ‘rm’ commands internally
Ying Yi [Thu, 23 Nov 2017 12:48:41 +0000 (12:48 +0000)]
[lit] Implement non-pipelined ‘mkdir’, ‘diff’ and ‘rm’ commands internally

Summary:
The internal shell already supports 'cd', ‘export’ and ‘echo’ commands.
This patch adds implementation of non-pipelined ‘mkdir’, ‘diff’ and ‘rm’
commands as the internal shell builtins.

Reviewers: Zachary Turner, Reid Kleckner

Subscribers: llvm-commits

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

llvm-svn: 318911

6 years ago[ARM GlobalISel] Support G_FMUL for s32 and s64
Diana Picus [Thu, 23 Nov 2017 12:44:20 +0000 (12:44 +0000)]
[ARM GlobalISel] Support G_FMUL for s32 and s64

TableGen already generates code for selecting a G_FMUL, so we only need
to add a test for that part.

For the legalizer and reg bank select, we do the same thing as the other
floating point binary operators: either mark as legal if we have a FP
unit or lower to a libcall, and map to the floating point registers.

llvm-svn: 318910

6 years ago[ASTMatchers] Matchers for new[] operators
Adam Balogh [Thu, 23 Nov 2017 12:43:20 +0000 (12:43 +0000)]
[ASTMatchers] Matchers for new[] operators

Two new matchers for `CXXNewExpr` are added which may be useful e.g. in
`clang-tidy` checkers. One of them is `isArray` which matches `new[]` but not
plain `new`. The other one, `hasArraySize` matches `new[]` for a given size.

llvm-svn: 318909

6 years ago[mips] Use the delay slot filler to convert branches for microMIPSR6.
Simon Dardis [Thu, 23 Nov 2017 12:38:04 +0000 (12:38 +0000)]
[mips] Use the delay slot filler to convert branches for microMIPSR6.

The MIPS delay slot filler converts delay slot branches into compact
forms for the MIPS ISAs which support them. For branches that compare
(in)equality with with zero, it converts them into branches with implict
zero register operands. These branches have a slightly greater range
than normal two register operands branches.

Changing the branches at this point in the pipeline offers the long
branch pass the ability to mark better judgements if a long branch
sequence is required.

Reviewers: atanasyan

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

llvm-svn: 318908

6 years ago[clang-tidy] Misplaced Operator in Strlen in Alloc
Adam Balogh [Thu, 23 Nov 2017 12:33:12 +0000 (12:33 +0000)]
[clang-tidy] Misplaced Operator in Strlen in Alloc

A possible error is to write `malloc(strlen(s+1))` instead of
`malloc(strlen(s)+1)`. Unfortunately the former is also valid syntactically,
but allocates less memory by two bytes (if `s` is at least one character long,
undefined behavior otherwise) which may result in overflow cases. This check
detects such cases and also suggests the fix for them.

Fix for r318906, forgot to add new files.

llvm-svn: 318907

6 years ago[clang-tidy] Misplaced Operator in Strlen in Alloc
Adam Balogh [Thu, 23 Nov 2017 12:26:28 +0000 (12:26 +0000)]
[clang-tidy] Misplaced Operator in Strlen in Alloc

A possible error is to write `malloc(strlen(s+1))` instead of
`malloc(strlen(s)+1)`. Unfortunately the former is also valid syntactically,
but allocates less memory by two bytes (if s` is at least one character long,
undefined behavior otherwise) which may result in overflow cases. This check
detects such cases and also suggests the fix for them.

llvm-svn: 318906

6 years agoclang-tidy/rename_check.py: support for moving between modules
Alexander Kornienko [Thu, 23 Nov 2017 12:08:53 +0000 (12:08 +0000)]
clang-tidy/rename_check.py: support for moving between modules

llvm-svn: 318905

6 years ago[x86][icelake]BITALG
Coby Tayree [Thu, 23 Nov 2017 11:15:50 +0000 (11:15 +0000)]
[x86][icelake]BITALG
2/3
vpshufbitqmb encoding
3/3
vpshufbitqmb intrinsics
Differential Revision: https://reviews.llvm.org/D40222

llvm-svn: 318904

6 years agoelf-core: Split up parsing code into os-specific functions
Pavel Labath [Thu, 23 Nov 2017 10:50:34 +0000 (10:50 +0000)]
elf-core: Split up parsing code into os-specific functions

Summary:
We've had a single function responsible for splitting a core segment
into notes, and parsing the notes themselves, bearing in mind variations
between 4 supported OS types. This commit splits that code into 5
pieces:
- (os-independent) code for splitting a segment into individual notes
- per-os function for parsing the notes into thread information

Reviewers: clayborg, krytarowski, emaste, alexandreyy, kettenis

Subscribers: lldb-commits

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

llvm-svn: 318903

6 years agoAllow to set locale on Windows.
Martin Storsjo [Thu, 23 Nov 2017 10:38:18 +0000 (10:38 +0000)]
Allow to set locale on Windows.

Fix the problem PR31516 with setting locale on Windows by wrapping
_locale_t with a pointer-like class.

Reduces 74 test failures in std/localization test suite to 47 test
failures (on llvm clang, Visual Studio 2015). Number of test failures
doesn't depend on the platform (x86 or x64).

Patch by Andrey Khalyavin.

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

llvm-svn: 318902

6 years ago[MSan] Move the access address check before the shadow access for that address
Alexander Potapenko [Thu, 23 Nov 2017 08:34:32 +0000 (08:34 +0000)]
[MSan] Move the access address check before the shadow access for that address

MSan used to insert the shadow check of the store pointer operand
_after_ the shadow of the value operand has been written.
This happens to work in the userspace, as the whole shadow range is
always mapped. However in the kernel the shadow page may not exist, so
the bug may cause a crash.

This patch moves the address check in front of the shadow access.

llvm-svn: 318901

6 years agoDo not perform the analysis based warning if the warnings are ignored
Olivier Goffart [Thu, 23 Nov 2017 08:15:22 +0000 (08:15 +0000)]
Do not perform the analysis based warning if the warnings are ignored

This saves some cycles when compiling with "-w".

(Also fix a potential crash on invalid code for tools that tries to recover from some
errors, because analysis might compute the CFG which crashes if the code contains
invalid declaration. This does not happen normally with because we also don't perform
these analysis if there was an error.)

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

llvm-svn: 318900

6 years agoRevert r318822 "[llvm-tblgen] - Stop using std::string in RecordKeeper."
George Rimar [Thu, 23 Nov 2017 06:52:44 +0000 (06:52 +0000)]
Revert r318822 "[llvm-tblgen] - Stop using std::string in RecordKeeper."

It reported to have problems with memory sanitizers and DBUILD_SHARED_LIBS=ON.

llvm-svn: 318899

6 years ago[IRCE][NFC] Add no wrap flags to no-wrapping SCEV calculation
Max Kazantsev [Thu, 23 Nov 2017 06:14:39 +0000 (06:14 +0000)]
[IRCE][NFC] Add no wrap flags to no-wrapping SCEV calculation

In a lambda where we expect to have result within bounds, add respective `nsw/nuw` flags to
help SCEV just in case if it fails to figure them out on its own.

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

llvm-svn: 318898

6 years agoAdd additional 'UNSUPPORTED' to the test case.
Marshall Clow [Thu, 23 Nov 2017 05:43:25 +0000 (05:43 +0000)]
Add additional 'UNSUPPORTED' to the test case.

llvm-svn: 318897

6 years ago[DeclPrinter] Allow printing fully qualified name of function declaration
Serge Pavlov [Thu, 23 Nov 2017 05:38:20 +0000 (05:38 +0000)]
[DeclPrinter] Allow printing fully qualified name of function declaration

When requesting a tooltip for a function call in an IDE, the fully
qualified name helps to remove ambiguity in the function signature.

Patch by Nikolai Kosjar!

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

llvm-svn: 318896

6 years agoAdd backend name to AVR Target to enable runtime info to be fed back into TableGen
Leslie Zhai [Thu, 23 Nov 2017 04:11:11 +0000 (04:11 +0000)]
Add backend name to AVR Target to enable runtime info to be fed back into TableGen

llvm-svn: 318895

6 years ago[X86] Turn an if condition that should always be true into an assert. NFCI
Craig Topper [Thu, 23 Nov 2017 03:24:01 +0000 (03:24 +0000)]
[X86] Turn an if condition that should always be true into an assert. NFCI

If Values.size() == 0, we should have returned 0 or undef earlier. If it was 1, it's a splat and we already handled that too.

llvm-svn: 318894

6 years ago[X86] Remove unnecessary check for is128BitVector. NFC
Craig Topper [Thu, 23 Nov 2017 03:24:00 +0000 (03:24 +0000)]
[X86] Remove unnecessary check for is128BitVector. NFC

256 and 512 bit vectors were picked off earlier in the function. Lots of code between there and here already assumed 128-bit vectors.

llvm-svn: 318893

6 years ago[X86] Simplify some bitmasking and use llvm_unreachable to mark an impossible case...
Craig Topper [Thu, 23 Nov 2017 03:23:59 +0000 (03:23 +0000)]
[X86] Simplify some bitmasking and use llvm_unreachable to mark an impossible case. NFC

llvm-svn: 318892

6 years ago[X86] Remove a ternary operator that can only ever be false. NFC
Craig Topper [Thu, 23 Nov 2017 03:23:58 +0000 (03:23 +0000)]
[X86] Remove a ternary operator that can only ever be false. NFC

We are checking for AVX512 in an SSE1 only block.

llvm-svn: 318891

6 years ago[NFC] CodeGen: Handle shift amount type in DAGTypeLegalizer::SplitInteger
Yaxun Liu [Thu, 23 Nov 2017 03:08:51 +0000 (03:08 +0000)]
[NFC] CodeGen: Handle shift amount type in DAGTypeLegalizer::SplitInteger

This patch reverts change to X86TargetLowering::getScalarShiftAmountTy in
rL318727 and move the logic to DAGTypeLegalizer::SplitInteger.

The reason is that getScalarShiftAmountTy returns a shift amount type that
is suitable for common use cases in CodeGen. DAGTypeLegalizer::SplitInteger
is a rare situation which requires a shift amount type larger than what
getScalarShiftAmountTy. In this case, it is more reasonable to do special
handling of shift amount type in DAGTypeLegalizer::SplitInteger only. If
similar situations arises the logic may be moved to a separate function.

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

llvm-svn: 318890

6 years agoAdd [[nodiscard]] to std::async as part of P0600.
Marshall Clow [Thu, 23 Nov 2017 01:25:03 +0000 (01:25 +0000)]
Add [[nodiscard]] to std::async as part of P0600.

llvm-svn: 318889

6 years ago[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Thu, 23 Nov 2017 01:20:07 +0000 (01:20 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 318888

6 years agoInstrumentation.h: Remove dead/untested code for DFSan JIT support
David Blaikie [Thu, 23 Nov 2017 00:08:40 +0000 (00:08 +0000)]
Instrumentation.h: Remove dead/untested code for DFSan JIT support

llvm-svn: 318887

6 years agoRun clang-format on source/Host/common/Symbols.cpp
Stephane Sezer [Wed, 22 Nov 2017 23:56:32 +0000 (23:56 +0000)]
Run clang-format on source/Host/common/Symbols.cpp

I saw a bunch of style errors so this fixes them.

llvm-svn: 318886

6 years ago[X86] Regenerate the vector-popcnt and vector-tzcnt tests to get BITALG CHECK linse...
Craig Topper [Wed, 22 Nov 2017 23:35:12 +0000 (23:35 +0000)]
[X86] Regenerate the vector-popcnt and vector-tzcnt tests to get BITALG CHECK linse on all functions not just the vXi16/vXi8.

llvm-svn: 318885

6 years ago[AArch64] Adjust the cost model for Exynos M1 and M2
Evandro Menezes [Wed, 22 Nov 2017 22:48:50 +0000 (22:48 +0000)]
[AArch64] Adjust the cost model for Exynos M1 and M2

Fix the modeling of some loads and stores.

llvm-svn: 318884

6 years agoAdd testcase for pr34113.
Rafael Espindola [Wed, 22 Nov 2017 22:00:50 +0000 (22:00 +0000)]
Add testcase for pr34113.

llvm-svn: 318883

6 years ago[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Wed, 22 Nov 2017 21:32:07 +0000 (21:32 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 318882

6 years ago[OPENMP] Add support for cancel constructs in `target teams distribute
Alexey Bataev [Wed, 22 Nov 2017 21:12:03 +0000 (21:12 +0000)]
[OPENMP] Add support for cancel constructs in `target teams distribute
parallel for`.

Add support for cancel/cancellation point directives inside `target
teams distribute parallel for` directives.

llvm-svn: 318881

6 years agoMachONormalizedFile.h: Remove unimplemented function
David Blaikie [Wed, 22 Nov 2017 21:10:19 +0000 (21:10 +0000)]
MachONormalizedFile.h: Remove unimplemented function

dump had no definition, so op<< was never usable anyway - remove the
definition of the latter and the declaration of the former.

llvm-svn: 318880

6 years agowasm/OutputSegment.h: Include missing header
David Blaikie [Wed, 22 Nov 2017 21:10:17 +0000 (21:10 +0000)]
wasm/OutputSegment.h: Include missing header

llvm-svn: 318879

6 years agoIR printing improvement for loop passes
Fedor Sergeev [Wed, 22 Nov 2017 20:59:53 +0000 (20:59 +0000)]
IR printing improvement for loop passes

Summary:
Loop-pass printing is somewhat deficient since it does not provide the
context around the loop (e.g. preheader). This context information becomes
pretty essential when analyzing transformations that move stuff out of the loop.

Extending printLoop to cover preheader and exit blocks (if any).

Reviewers: sanjoy, silvas, weimingz

Reviewed By: sanjoy

Subscribers: apilipenko, skatkov, llvm-commits

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

llvm-svn: 318878

6 years ago[Hexagon] Implement buildVector32 and buildVector64 as utility functions
Krzysztof Parzyszek [Wed, 22 Nov 2017 20:56:23 +0000 (20:56 +0000)]
[Hexagon] Implement buildVector32 and buildVector64 as utility functions

Change LowerBUILD_VECTOR to use those functions. This commit will tempora-
rily affect constant vector generation (it will generate constant-extended
values instead of non-extended combines), but the code for the general case
should be better. The constant selection part will be fixed later.

llvm-svn: 318877

6 years ago[Hexagon] Add patterns to select A2_combine_ll and its variants
Krzysztof Parzyszek [Wed, 22 Nov 2017 20:55:41 +0000 (20:55 +0000)]
[Hexagon] Add patterns to select A2_combine_ll and its variants

llvm-svn: 318876

6 years ago[Hexagon] Remove trailing spaces, NFC
Krzysztof Parzyszek [Wed, 22 Nov 2017 20:43:00 +0000 (20:43 +0000)]
[Hexagon] Remove trailing spaces, NFC

llvm-svn: 318875

6 years ago[demangler] Support for abi_tag attribute
Erik Pilkington [Wed, 22 Nov 2017 20:38:22 +0000 (20:38 +0000)]
[demangler] Support for abi_tag attribute

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

llvm-svn: 318874

6 years agoAdd a missing include found by modules bot.
Paul Robinson [Wed, 22 Nov 2017 20:31:39 +0000 (20:31 +0000)]
Add a missing include found by modules bot.

llvm-svn: 318873

6 years ago[OPENMP] Add support for cancel constructs in [teams] distribute
Alexey Bataev [Wed, 22 Nov 2017 20:19:50 +0000 (20:19 +0000)]
[OPENMP] Add support for cancel constructs in [teams] distribute
parallel for directives.

Added codegen/sema support for cancel constructs in [teams] distribute
parallel for directives.

llvm-svn: 318872

6 years ago[X86] Support v32i16/v64i8 CTLZ using lookup table.
Craig Topper [Wed, 22 Nov 2017 20:05:57 +0000 (20:05 +0000)]
[X86] Support v32i16/v64i8 CTLZ using lookup table.

Had to tweak the setcc's used by the code to use a vXi1 result type with a sign extend back to vector size.

llvm-svn: 318871