]> granicus.if.org Git - llvm/log
llvm
6 years ago[Support] Fix GNU/kFreeBSD build
Eli Friedman [Tue, 18 Dec 2018 01:38:20 +0000 (01:38 +0000)]
[Support] Fix GNU/kFreeBSD build

Patch by James Clarke.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349434 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[codeview] Update comment on aligning symbol records
Reid Kleckner [Tue, 18 Dec 2018 01:36:06 +0000 (01:36 +0000)]
[codeview] Update comment on aligning symbol records

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349433 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[FileCheck] Try to fix test on windows due to r349418
Joel E. Denny [Tue, 18 Dec 2018 01:17:28 +0000 (01:17 +0000)]
[FileCheck] Try to fix test on windows due to r349418

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349432 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[codeview] Align symbol records to save 441MB during linking clang.pdb
Reid Kleckner [Tue, 18 Dec 2018 01:14:05 +0000 (01:14 +0000)]
[codeview] Align symbol records to save 441MB during linking clang.pdb

In PDBs, symbol records must be aligned to four bytes. However, in the
object file, symbol records may not be aligned. MSVC does not pad out
symbol records to make sure they are aligned. That means the linker has
to do extra work to insert the padding. Currently, LLD calculates the
required space with alignment, and copies each record one at a time
while padding them out to the correct size. It has a fast path that
avoids this copy when the records are already aligned.

This change fixes a bug in that codepath so that the copy is actually
saved, and tweaks LLVM's symbol record emission to align symbol records.
Here's how things compare when doing a plain clang Release+PDB build:
- objs are 0.65% bigger (negligible)
- link is 3.3% faster (negligible)
- saves allocating 441MB
- new LLD high water mark is ~1.05GB

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349431 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRecommit r348806: DebugInfo: Use symbol difference for CU length to simplify assembly...
David Blaikie [Tue, 18 Dec 2018 01:06:09 +0000 (01:06 +0000)]
Recommit r348806: DebugInfo: Use symbol difference for CU length to simplify assembly reading/editing

Mucking about simplifying a test case ( https://reviews.llvm.org/D55261 ) I stumbled across something I've hit before - that LLVM's (GCC's does too, FWIW) assembly output includes a hardcode length for a DWARF unit in its header. Instead we could emit a label difference - making the assembly easier to read/edit (though potentially at a slight (I haven't tried to observe it) performance cost of delaying/sinking the length computation into the MC layer).

Fix: Predicated all the changes (including creating the labels, even if they aren't used/needed) behind the NVPTX useSectionsAsReferences, avoiding emitting labels in NVPTX where ptxas can't parse them.

Reviewers: JDevlieghere, probinson, ABataev

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349430 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[FileCheck] Annotate input dump (final tweaks)
Joel E. Denny [Tue, 18 Dec 2018 00:03:51 +0000 (00:03 +0000)]
[FileCheck] Annotate input dump (final tweaks)

Apply final suggestions from probinson for this patch series plus a
few more tweaks:

* Improve various docs, for MatchType in particular.

* Rename some members of MatchType.  The main problem was that the
  term "final match" became a misnomer when CHECK-COUNT-<N> was
  created.

* Split InputStartLine, etc. declarations into multiple lines.

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

Reviewed By: probinson

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349425 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[FileCheck] Annotate input dump (7/7)
Joel E. Denny [Tue, 18 Dec 2018 00:03:36 +0000 (00:03 +0000)]
[FileCheck] Annotate input dump (7/7)

This patch implements annotations for diagnostics reporting CHECK-NOT
failed matches.  These diagnostics are enabled by -vv.  As for
diagnostics reporting failed matches for other directives, these
annotations mark the search ranges using `X~~`.  The difference here
is that failed matches for CHECK-NOT are successes not errors, so they
are green not red when colors are enabled.

For example:

```
$ FileCheck -dump-input=help
The following description was requested by -dump-input=help to
explain the input annotations printed by -dump-input=always and
-dump-input=fail:

  - L:     labels line number L of the input file
  - T:L    labels the only match result for a pattern of type T from line L of
           the check file
  - T:L'N  labels the Nth match result for a pattern of type T from line L of
           the check file
  - ^~~    marks good match (reported if -v)
  - !~~    marks bad match, such as:
           - CHECK-NEXT on same line as previous match (error)
           - CHECK-NOT found (error)
           - CHECK-DAG overlapping match (discarded, reported if -vv)
  - X~~    marks search range when no match is found, such as:
           - CHECK-NEXT not found (error)
           - CHECK-NOT not found (success, reported if -vv)
           - CHECK-DAG not found after discarded matches (error)
  - ?      marks fuzzy match when no match is found
  - colors success, error, fuzzy match, discarded match, unmatched input

If you are not seeing color above or in input dumps, try: -color

$ FileCheck -vv -dump-input=always check5 < input5 |& sed -n '/^<<<</,$p'
<<<<<<
         1: abcdef
check:1     ^~~
not:2          X~~
         2: ghijkl
not:2       ~~~
check:3        ^~~
         3: mnopqr
not:4       X~~~~~
         4: stuvwx
not:4       ~~~~~~
         5:
eof:4       ^
>>>>>>

$ cat check5
CHECK: abc
CHECK-NOT: foobar
CHECK: jkl
CHECK-NOT: foobar

$ cat input5
abcdef
ghijkl
mnopqr
stuvwx
```

Reviewed By: george.karpenkov, probinson

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349424 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[FileCheck] Annotate input dump (6/7)
Joel E. Denny [Tue, 18 Dec 2018 00:03:19 +0000 (00:03 +0000)]
[FileCheck] Annotate input dump (6/7)

This patch implements input annotations for diagnostics reporting
CHECK-DAG discarded matches.  These diagnostics are enabled by -vv.
These annotations mark discarded match ranges using `!~~` because they
are bad matches even though they are not errors.

CHECK-DAG discarded matches create another case where there can be
multiple match results for the same directive.

For example:

```
$ FileCheck -dump-input=help
The following description was requested by -dump-input=help to
explain the input annotations printed by -dump-input=always and
-dump-input=fail:

  - L:     labels line number L of the input file
  - T:L    labels the only match result for a pattern of type T from line L of
           the check file
  - T:L'N  labels the Nth match result for a pattern of type T from line L of
           the check file
  - ^~~    marks good match (reported if -v)
  - !~~    marks bad match, such as:
           - CHECK-NEXT on same line as previous match (error)
           - CHECK-NOT found (error)
           - CHECK-DAG overlapping match (discarded, reported if -vv)
  - X~~    marks search range when no match is found, such as:
           - CHECK-NEXT not found (error)
           - CHECK-DAG not found after discarded matches (error)
  - ?      marks fuzzy match when no match is found
  - colors success, error, fuzzy match, discarded match, unmatched input

If you are not seeing color above or in input dumps, try: -color

$ FileCheck -vv -dump-input=always check4 < input4 |& sed -n '/^<<<</,$p'
<<<<<<
         1: abcdef
dag:1       ^~~~
dag:2'0       !~~~ discard: overlaps earlier match
         2: cdefgh
dag:2'1     ^~~~
check:3         X~ error: no match found
>>>>>>

$ cat check4
CHECK-DAG: abcd
CHECK-DAG: cdef
CHECK: efgh

$ cat input4
abcdef
cdefgh
```

This shows that the line 3 CHECK fails to match even though its
pattern appears in the input because its search range starts after the
line 2 CHECK-DAG's match range.  The trouble might be that the line 2
CHECK-DAG's match range is later than expected because its first match
range overlaps with the line 1 CHECK-DAG match range and thus is
discarded.

Because `!~~` for CHECK-DAG does not indicate an error, it is not
colored red.  Instead, when colors are enabled, it is colored cyan,
which suggests a match that went cold.

Reviewed By: george.karpenkov, probinson

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349423 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[FileCheck] Annotate input dump (5/7)
Joel E. Denny [Tue, 18 Dec 2018 00:03:03 +0000 (00:03 +0000)]
[FileCheck] Annotate input dump (5/7)

This patch implements input annotations for diagnostics enabled by -v,
which report good matches for directives.  These annotations mark
match ranges using `^~~`.

For example:

```
$ FileCheck -dump-input=help
The following description was requested by -dump-input=help to
explain the input annotations printed by -dump-input=always and
-dump-input=fail:

  - L:     labels line number L of the input file
  - T:L    labels the only match result for a pattern of type T from line L of
           the check file
  - T:L'N  labels the Nth match result for a pattern of type T from line L of
           the check file
  - ^~~    marks good match (reported if -v)
  - !~~    marks bad match, such as:
           - CHECK-NEXT on same line as previous match (error)
           - CHECK-NOT found (error)
  - X~~    marks search range when no match is found, such as:
           - CHECK-NEXT not found (error)
  - ?      marks fuzzy match when no match is found
  - colors success, error, fuzzy match, unmatched input

If you are not seeing color above or in input dumps, try: -color

$ FileCheck -v -dump-input=always check3 < input3 |& sed -n '/^<<<</,$p'
<<<<<<
         1: abc foobar def
check:1     ^~~
not:2           !~~~~~     error: no match expected
check:3                ^~~
>>>>>>

$ cat check3
CHECK:     abc
CHECK-NOT: foobar
CHECK:     def

$ cat input3
abc foobar def
```

-vv enables these annotations for FileCheck's implicit EOF patterns as
well.  For an example where EOF patterns become relevant, see patch 7
in this series.

If colors are enabled, `^~~` is green to suggest success.

-v plus color enables highlighting of input text that has no final
match for any expected pattern.  The highlight uses a cyan background
to suggest a cold section.  This highlighting can make it easier to
spot text that was intended to be matched but that failed to be
matched in a long series of good matches.

CHECK-COUNT-<num> good matches are another case where there can be
multiple match results for the same directive.

Reviewed By: george.karpenkov, probinson

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349422 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[FileCheck] Annotate input dump (4/7)
Joel E. Denny [Tue, 18 Dec 2018 00:02:47 +0000 (00:02 +0000)]
[FileCheck] Annotate input dump (4/7)

This patch implements input annotations for diagnostics that report
unexpected matches for CHECK-NOT.  Like wrong-line matches for
CHECK-NEXT, CHECK-SAME, and CHECK-EMPTY, these annotations mark match
ranges using red `!~~` to indicate bad matches that are errors.

For example:

```
$ FileCheck -dump-input=help
The following description was requested by -dump-input=help to
explain the input annotations printed by -dump-input=always and
-dump-input=fail:

  - L:     labels line number L of the input file
  - T:L    labels the only match result for a pattern of type T from line L of
           the check file
  - T:L'N  labels the Nth match result for a pattern of type T from line L of
           the check file
  - !~~    marks bad match, such as:
           - CHECK-NEXT on same line as previous match (error)
           - CHECK-NOT found (error)
  - X~~    marks search range when no match is found, such as:
           - CHECK-NEXT not found (error)
  - ?      marks fuzzy match when no match is found
  - colors error, fuzzy match

If you are not seeing color above or in input dumps, try: -color

$ FileCheck -v -dump-input=always check3 < input3 |& sed -n '/^<<<</,$p'
<<<<<<
       1: abc foobar def
not:2         !~~~~~     error: no match expected
>>>>>>

$ cat check3
CHECK:     abc
CHECK-NOT: foobar
CHECK:     def

$ cat input3
abc foobar def
```

Reviewed By: george.karpenkov, probinson

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349421 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[FileCheck] Annotate input dump (3/7)
Joel E. Denny [Tue, 18 Dec 2018 00:02:22 +0000 (00:02 +0000)]
[FileCheck] Annotate input dump (3/7)

This patch implements input annotations for diagnostics that report
wrong-line matches for the directives CHECK-NEXT, CHECK-SAME, and
CHECK-EMPTY.  Instead of the usual `^~~`, which is used by later
patches for good matches, these annotations use `!~~` to mark the bad
match ranges so that this category of errors is visually distinct.
Because such matches are errors, these annotates are red when colors
are enabled.

For example:

```
$ FileCheck -dump-input=help
The following description was requested by -dump-input=help to
explain the input annotations printed by -dump-input=always and
-dump-input=fail:

  - L:     labels line number L of the input file
  - T:L    labels the only match result for a pattern of type T from line L of
           the check file
  - T:L'N  labels the Nth match result for a pattern of type T from line L of
           the check file
  - !~~    marks bad match, such as:
           - CHECK-NEXT on same line as previous match (error)
  - X~~    marks search range when no match is found, such as:
           - CHECK-NEXT not found (error)
  - ?      marks fuzzy match when no match is found
  - colors error, fuzzy match

If you are not seeing color above or in input dumps, try: -color

$ FileCheck -v -dump-input=always check2 < input2 |& sed -n '/^<<<</,$p'
<<<<<<
        1: foo bar
next:2         !~~ error: match on wrong line
>>>>>>

$ cat check2
CHECK: foo
CHECK-NEXT: bar

$ cat input2
foo bar
```

Reviewed By: george.karpenkov, probinson

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349420 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[FileCheck] Annotate input dump (2/7)
Joel E. Denny [Tue, 18 Dec 2018 00:02:04 +0000 (00:02 +0000)]
[FileCheck] Annotate input dump (2/7)

This patch implements input annotations for diagnostics that suggest
fuzzy matches for directives for which no matches were found.  Instead
of using the usual `^~~`, which is used by later patches for good
matches, these annotations use `?` so that fuzzy matches are visually
distinct.  No tildes are included as these diagnostics (independently
of this patch) currently identify only the start of the match.

For example:

```
$ FileCheck -dump-input=help
The following description was requested by -dump-input=help to
explain the input annotations printed by -dump-input=always and
-dump-input=fail:

  - L:     labels line number L of the input file
  - T:L    labels the only match result for a pattern of type T from line L of
           the check file
  - T:L'N  labels the Nth match result for a pattern of type T from line L of
           the check file
  - X~~    marks search range when no match is found
  - ?      marks fuzzy match when no match is found
  - colors error, fuzzy match

If you are not seeing color above or in input dumps, try: -color

$ FileCheck -v -dump-input=always check1 < input1 |& sed -n '/^<<<</,$p'
<<<<<<
          1: ; abc def
          2: ; ghI jkl
next:3'0     X~~~~~~~~ error: no match found
next:3'1       ?       possible intended match
>>>>>>

$ cat check1
CHECK: abc
CHECK-SAME: def
CHECK-NEXT: ghi
CHECK-SAME: jkl

$ cat input1
; abc def
; ghI jkl
```

This patch introduces the concept of multiple "match results" per
directive.  In the above example, the first match result for the
CHECK-NEXT directive is the failed match, for which the annotation
shows the search range.  The second match result is the fuzzy match.
Later patches will introduce other cases of multiple match results per
directive.

When colors are enabled, `?` is colored magenta.  That is, it doesn't
indicate the actual error, which a red `X~~` marker indicates, but its
color suggests it's closely related.

Reviewed By: george.karpenkov, probinson

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349419 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[FileCheck] Annotate input dump (1/7)
Joel E. Denny [Tue, 18 Dec 2018 00:01:39 +0000 (00:01 +0000)]
[FileCheck] Annotate input dump (1/7)

Extend FileCheck to dump its input annotated with FileCheck's
diagnostics: errors, good matches if -v, and additional information if
-vv.  The goal is to make it easier to visualize FileCheck's matching
behavior when debugging.

Each patch in this series implements input annotations for a
particular category of FileCheck diagnostics.  While the first few
patches alone are somewhat useful, the annotations become much more
useful as later patches implement annotations for -v and -vv
diagnostics, which show the matching behavior leading up to the error.

This first patch implements boilerplate plus input annotations for
error diagnostics reporting that no matches were found for a
directive.  These annotations mark the search ranges of the failed
directives.  Instead of using the usual `^~~`, which is used by later
patches for good matches, these annotations use `X~~` so that this
category of errors is visually distinct.

For example:

```
$ FileCheck -dump-input=help
The following description was requested by -dump-input=help to
explain the input annotations printed by -dump-input=always and
-dump-input=fail:

  - L:     labels line number L of the input file
  - T:L    labels the match result for a pattern of type T from line L of
           the check file
  - X~~    marks search range when no match is found
  - colors error

If you are not seeing color above or in input dumps, try: -color

$ FileCheck -v -dump-input=always check1 < input1 |& sed -n '/^Input file/,$p'
Input file: <stdin>
Check file: check1

-dump-input=help describes the format of the following dump.

Full input was:
<<<<<<
        1: ; abc def
        2: ; ghI jkl
next:3     X~~~~~~~~ error: no match found
>>>>>>

$ cat check1
CHECK: abc
CHECK-SAME: def
CHECK-NEXT: ghi
CHECK-SAME: jkl

$ cat input1
; abc def
; ghI jkl
```

Some additional details related to the boilerplate:

* Enabling: The annotated input dump is enabled by `-dump-input`,
  which can also be set via the `FILECHECK_OPTS` environment variable.
  Accepted values are `help`, `always`, `fail`, or `never`.  As shown
  above, `help` describes the format of the dump.  `always` is helpful
  when you want to investigate a successful FileCheck run, perhaps for
  an unexpected pass. `-dump-input-on-failure` and
  `FILECHECK_DUMP_INPUT_ON_FAILURE` remain as a deprecated alias for
  `-dump-input=fail`.

* Diagnostics: The usual diagnostics are not suppressed in this mode
  and are printed first.  For brevity in the example above, I've
  omitted them using a sed command.  Sometimes they're perfectly
  sufficient, and then they make debugging quicker than if you were
  forced to hunt through a dump of long input looking for the error.
  If you think they'll get in the way sometimes, keep in mind that
  it's pretty easy to grep for the start of the input dump, which is
  `<<<`.

* Colored Annotations: The annotated input is colored if colors are
  enabled (enabling colors can be forced using -color).  For example,
  errors are red.  However, as in the above example, colors are not
  vital to reading the annotations.

I don't know how to test color in the output, so any hints here would
be appreciated.

Reviewed By: george.karpenkov, zturner, probinson

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349418 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Add baseline tests for D55780
Craig Topper [Mon, 17 Dec 2018 23:20:14 +0000 (23:20 +0000)]
[X86] Add baseline tests for D55780

This adds tests for (add (umax X, C), -C) as part of fixing PR40053

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349416 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agohwasan: Move ctor into a comdat.
Peter Collingbourne [Mon, 17 Dec 2018 22:56:34 +0000 (22:56 +0000)]
hwasan: Move ctor into a comdat.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349413 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[VFS] Add isLocal to ProxyFileSystem and add unit tests.
Michael J. Spencer [Mon, 17 Dec 2018 22:30:05 +0000 (22:30 +0000)]
[VFS] Add isLocal to ProxyFileSystem and add unit tests.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349410 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86][SSE] Improve immediate vector shift known bits handling.
Simon Pilgrim [Mon, 17 Dec 2018 22:09:47 +0000 (22:09 +0000)]
[X86][SSE] Improve immediate vector shift known bits handling.

Convert VSRAI to VSRLI is the sign bit is known zero and improve KnownBits output for all shift instruction.

Fixes the poor codegen comments in D55768.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349407 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Fix assembler parsing of br_table.
Wouter van Oortmerssen [Mon, 17 Dec 2018 22:04:44 +0000 (22:04 +0000)]
[WebAssembly] Fix assembler parsing of br_table.

Summary:
We use `variable_ops` in the tablegen defs to denote the list of
branch targets in `br_table`, but unlike other uses of `variable_ops`
(e.g. call) the these branch targets need to actually be encoded in the
instruction. The existing tables for `variable_ops` cause not operands
to be accepted by the assembly matcher.

Following the example of ARM:
https://github.com/llvm-mirror/llvm/blob/2cc0a7da876c1d8c32775b0119e1e15aaa759b9e/lib/Target/ARM/ARMInstrInfo.td#L550-L555
we introduce a new operand type to capture this list, and we use the
same {} syntax as ARM as well to differentiate them from regular
integer operands.

Also removed definition and use of TSFlags in tablegen defs, since
`br_table` now has a non-variable_ops immediate operand, so the
previous logic of only the variable_ops arguments being labels didn't
make sense anymore.

Reviewers: dschuff, aheejin, sunfish

Subscribers: javed.absar, sbc100, jgravelle-google, kristof.beyls, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349405 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Add T1MSKC and TZMSK to isDefConvertible used by optimizeCompareInstr.
Craig Topper [Mon, 17 Dec 2018 21:50:06 +0000 (21:50 +0000)]
[X86] Add T1MSKC and TZMSK to isDefConvertible used by optimizeCompareInstr.

These seem to have been missed when the other TBM instructions were added.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349404 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[codeview] Flush labels before S_DEFRANGE* fragments
Reid Kleckner [Mon, 17 Dec 2018 21:49:35 +0000 (21:49 +0000)]
[codeview] Flush labels before S_DEFRANGE* fragments

This was a pre-existing bug that could be triggered with assembly like
this:
  .p2align 2
  .LtmpN:
  .cv_def_range "..."

I noticed this when attempting to change clang to emit aligned symbol
records.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349403 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86][SSE] Split SimplifyDemandedBitsForTargetNode X86ISD::VSRLI/VSRAI handling.
Simon Pilgrim [Mon, 17 Dec 2018 21:36:17 +0000 (21:36 +0000)]
[X86][SSE] Split SimplifyDemandedBitsForTargetNode X86ISD::VSRLI/VSRAI handling.

First step towards adding more capable combines to fix comments in D55768.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349400 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AggressiveInstCombine] convert rotate with guard branch into funnel shift (PR34924)
Sanjay Patel [Mon, 17 Dec 2018 21:14:51 +0000 (21:14 +0000)]
[AggressiveInstCombine] convert rotate with guard branch into funnel shift (PR34924)

Now, that we have funnel shift intrinsics, it should be safe to convert this form of rotate to it.
In the worst case (a target that doesn't have rotate instructions), we will expand this into a
branch-less sequence of ALU ops (neg/and/and/lshr/shl/or) in the backend, so it's still very
likely to be a perf improvement over the original code.

The motivating source code pattern for this is shown in:
https://bugs.llvm.org/show_bug.cgi?id=34924

Background:
I looked at several different options before deciding where to try this - instcombine, simplifycfg,
CGP - because it doesn't fit cleanly anywhere AFAIK.

The backend (CGP, SDAG, GlobalIsel?) is too late for what we're trying to accomplish. We want to
have the IR converted before we reach things like vectorization because the reduced code can make a
loop much simpler to transform.

Technically, this could be included in instcombine, but it's a large pattern match that includes
control-flow, so it just felt wrong to stuff into there (although I have a draft of that patch).
Similarly, this could be part of simplifycfg, but all of this pattern matching is a stretch.

So we're left with our relatively new dumping ground for homeless transforms: aggressive-instcombine.
This only runs at -O3, but that seems like a reasonable limitation given that source code has many
options to avoid this pattern (including the recently added clang intrinsics for rotates).

I'm including a PhaseOrdering test because we require the teamwork of 3 passes (aggressive-instcombine,
instcombine, simplifycfg) to get this into the minimal IR form that we want. That test shows a bug
with the new pass manager that's independent of this change (but it will be masked if we canonicalize
harder to funnel shift intrinsics in instcombine).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349396 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDebugInfo: Update gold plugin tests due to CU attribute reordering in r349207
David Blaikie [Mon, 17 Dec 2018 21:10:28 +0000 (21:10 +0000)]
DebugInfo: Update gold plugin tests due to CU attribute reordering in r349207

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349395 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SDAG] Clarify the origin of chain in REG_SEQUENCE in comment, NFC
Krzysztof Parzyszek [Mon, 17 Dec 2018 20:30:20 +0000 (20:30 +0000)]
[SDAG] Clarify the origin of chain in REG_SEQUENCE in comment, NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349391 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SelectionDAG] Fix noop detection for vectors in AssertZext/AssertSext in getNode
Craig Topper [Mon, 17 Dec 2018 20:29:13 +0000 (20:29 +0000)]
[SelectionDAG] Fix noop detection for vectors in AssertZext/AssertSext in getNode

The assertion type is always supposed to be a scalar type. So if the result VT of the assertion is a vector, we need to get the scalar VT before we can compare them.

Similarly for the assert above it.

I don't have a test case because I don't know of any place we violate this today. A coworker found this while trying to use r347287 on the 6.0 branch without also having r336868

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349390 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] don't widen an arbitrary sequence of vector ops (PR40032)
Sanjay Patel [Mon, 17 Dec 2018 20:27:43 +0000 (20:27 +0000)]
[InstCombine] don't widen an arbitrary sequence of vector ops (PR40032)

The problem is shown specifically for a case with vector multiply here:
https://bugs.llvm.org/show_bug.cgi?id=40032
...and this might mask the original backend bug for ARM shown in:
https://bugs.llvm.org/show_bug.cgi?id=39967

As the test diffs here show, we were (and probably still aren't) doing
these kinds of transforms in a principled way. We are producing more or
equal wide instructions than we started with in some cases, so we still
need to restrict/correct other transforms from overstepping.

If there are perf regressions from this change, we can either carve out
exceptions to the general IR rules, or improve the backend to do these
transforms when we know the transform is profitable. That's probably
similar to a change like D55448.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349389 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoConvert (CMP (srl/shl X, C), 0) to (CMP (and X, C'), 0) when only the zero flag is...
Craig Topper [Mon, 17 Dec 2018 20:02:16 +0000 (20:02 +0000)]
Convert (CMP (srl/shl X, C), 0) to (CMP (and X, C'), 0) when only the zero flag is used.

This allows a TEST to be used and can be combined with any AND that may already exist as an input to the shift.

This was already done in EmitTest, but was easily tricked by multiple uses because the setcc might be used by multiple instructions. Once the SETCC and users are legalized then we can look for the shift to be used by a single CMP, but the CMP itself can have multiple users.

This appears to fix the case in PR39968.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349385 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoNFC: remove unused variable
JF Bastien [Mon, 17 Dec 2018 19:03:24 +0000 (19:03 +0000)]
NFC: remove unused variable

D55768 removed its use.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349377 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAsmParser: test .double NaN and .double inf
JF Bastien [Mon, 17 Dec 2018 18:54:22 +0000 (18:54 +0000)]
AsmParser: test .double NaN and .double inf

Summary: It looks like this support was added to match GNU AS, but only tests
.float and not .double. I asked RedHat folks to confirm that 0x7fffffffffffffff
was indeed the right value for NaN.

Same for infinity, but it only has positive / negative encodings.

Reviewers: scanon, rjmccall

Subscribers: jkorous, dexonsmith, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349376 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AMDGPU][MC][DOC] A fix for build failure in r349370
Dmitry Preobrazhensky [Mon, 17 Dec 2018 18:53:10 +0000 (18:53 +0000)]
[AMDGPU][MC][DOC] A fix for build failure in r349370

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349375 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[TargetLowering] Add DemandedElts mask to SimplifyDemandedBits (PR40000)
Simon Pilgrim [Mon, 17 Dec 2018 18:43:43 +0000 (18:43 +0000)]
[TargetLowering] Add DemandedElts mask to SimplifyDemandedBits (PR40000)

This is an initial patch to add the necessary support for a DemandedElts argument to SimplifyDemandedBits, more closely matching computeKnownBits and to help improve vector codegen.

I've added only a small amount of the changes necessary to get at least one test to update - a lot more can be done but I'd like to add these methodically with proper test coverage, at the same time the hope is to slowly move some/all of SimplifyDemandedVectorElts into SimplifyDemandedBits as well.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349374 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AMDGPU][MC][DOC] A fix for build failure in r349368
Dmitry Preobrazhensky [Mon, 17 Dec 2018 17:56:13 +0000 (17:56 +0000)]
[AMDGPU][MC][DOC] A fix for build failure in r349368

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349370 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstSimplify] Simplify saturating add/sub + icmp
Nikita Popov [Mon, 17 Dec 2018 17:45:18 +0000 (17:45 +0000)]
[InstSimplify] Simplify saturating add/sub + icmp

If a saturating add/sub has one constant operand, then we can
determine the possible range of outputs it can produce, and simplify
an icmp comparison based on that.

The implementation is based on a similar existing mechanism for
simplifying binary operator + icmps.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349369 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AMDGPU][MC][DOC] Updated AMD GPU assembler description
Dmitry Preobrazhensky [Mon, 17 Dec 2018 17:38:11 +0000 (17:38 +0000)]
[AMDGPU][MC][DOC] Updated AMD GPU assembler description

Stage 2: added detailed description of operands

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349368 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFastIsel: take care to update iterators when removing instructions.
Tim Northover [Mon, 17 Dec 2018 17:25:53 +0000 (17:25 +0000)]
FastIsel: take care to update iterators when removing instructions.

We keep a few iterators into the basic block we're selecting while
performing FastISel. Usually this is fine, but occasionally code wants
to remove already-emitted instructions. When this happens we have to be
careful to update those iterators so they're not pointint at dangling
memory.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349365 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd missing include file.
Zachary Turner [Mon, 17 Dec 2018 16:42:26 +0000 (16:42 +0000)]
Add missing include file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349363 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PDB] Add some helper functions for working with scopes.
Zachary Turner [Mon, 17 Dec 2018 16:15:36 +0000 (16:15 +0000)]
[PDB] Add some helper functions for working with scopes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349361 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[MS Demangler] Add a helper function to print a Node as a string.
Zachary Turner [Mon, 17 Dec 2018 16:14:50 +0000 (16:14 +0000)]
[MS Demangler] Add a helper function to print a Node as a string.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349359 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[MIPS GlobalISel] Remove switch statement (fix r349346 for MSVC)
Petar Avramovic [Mon, 17 Dec 2018 15:12:53 +0000 (15:12 +0000)]
[MIPS GlobalISel] Remove switch statement (fix r349346 for MSVC)

Temporarily remove switch statement without any case labels
in function legalizeCustom in order to fix r349346 for MSVC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349356 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoARM: use acquire/release instruction variants when available.
Tim Northover [Mon, 17 Dec 2018 15:05:32 +0000 (15:05 +0000)]
ARM: use acquire/release instruction variants when available.

These features (fairly) recently got split out into their own feature, so we
should make CodeGen use them when available. The main change here is that the
check used to be based on the triple, but now it's based on CPU features.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349355 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[MCA] Add support for BeginGroup/EndGroup.
Andrea Di Biagio [Mon, 17 Dec 2018 14:27:33 +0000 (14:27 +0000)]
[MCA] Add support for BeginGroup/EndGroup.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349354 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "DebugInfo: Assume an absence of ranges or high_pc on a CU means the CU is...
Eric Liu [Mon, 17 Dec 2018 14:14:40 +0000 (14:14 +0000)]
Revert "DebugInfo: Assume an absence of ranges or high_pc on a CU means the CU is empty (devoid of code addresses)"

This reverts commit r349333. It caused internal test to fail. I have
sent more information to the author.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349353 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[MCA] Don't assume that createMCInstrAnalysis() always returns a valid pointer.
Andrea Di Biagio [Mon, 17 Dec 2018 14:00:37 +0000 (14:00 +0000)]
[MCA] Don't assume that createMCInstrAnalysis() always returns a valid pointer.

Class InstrBuilder wrongly assumed that llvm targets were always able to return
a non-null pointer when createMCInstrAnalysis() was called on them.
This was causing crashes when simulating executions for targets that don't
provide an MCInstrAnalysis object.
This patch fixes the issue by making MCInstrAnalysis optional.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349352 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRegenerate test in prep for SimplifyDemandedBits improvements.
Simon Pilgrim [Mon, 17 Dec 2018 12:48:34 +0000 (12:48 +0000)]
Regenerate test in prep for SimplifyDemandedBits improvements.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349350 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AggressiveInstCombine] add test for rotate insertion point; NFC
Sanjay Patel [Mon, 17 Dec 2018 12:36:35 +0000 (12:36 +0000)]
[AggressiveInstCombine] add test for rotate insertion point; NFC

As noted in D55604 - we need a test to make sure that the new intrinsic
is inserted into a valid position.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349347 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[MIPS GlobalISel] Lower G_UADDE and narrowScalar G_ADD
Petar Avramovic [Mon, 17 Dec 2018 12:31:07 +0000 (12:31 +0000)]
[MIPS GlobalISel] Lower G_UADDE and narrowScalar G_ADD

Lower G_UADDE and legalize G_ADD using narrowScalar on MIPS32.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349346 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AArch64] Re-run load/store optimizer after aggressive tail duplication
Alexandros Lamprineas [Mon, 17 Dec 2018 10:45:43 +0000 (10:45 +0000)]
[AArch64] Re-run load/store optimizer after aggressive tail duplication

The Load/Store Optimizer runs before Machine Block Placement. At O3 the
Tail Duplication Threshold is set to 4 instructions and this can create
new opportunities for the Load/Store Optimizer. It seems worthwhile to
run it once again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349338 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDebugInfo: Assume an absence of ranges or high_pc on a CU means the CU is empty ...
David Blaikie [Mon, 17 Dec 2018 08:27:19 +0000 (08:27 +0000)]
DebugInfo: Assume an absence of ranges or high_pc on a CU means the CU is empty (devoid of code addresses)

GCC emitted these unconditionally on/before 4.4/March 2012
Clang emitted these unconditionally on/before 3.5/March 2014

This improves performance when parsing CUs (especially those using split
DWARF) that contain no code ranges (such as the mini CUs that may be
created by ThinLTO importing - though generally they should be/are
avoided, especially for Split DWARF because it produces a lot of very
small CUs, which don't scale well in a bunch of other ways too
(including size)).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349333 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-mca] Move llvm-mca library to llvm/lib/MCA.
Clement Courbet [Mon, 17 Dec 2018 08:08:31 +0000 (08:08 +0000)]
[llvm-mca] Move llvm-mca library to llvm/lib/MCA.

Summary: See PR38731.

Reviewers: andreadb

Subscribers: mgorny, javed.absar, tschuett, gbedwell, andreadb, RKSimon, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349332 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Add test case for PR39968. NFC
Craig Topper [Mon, 17 Dec 2018 07:51:17 +0000 (07:51 +0000)]
[X86] Add test case for PR39968. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349331 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Fix bad operand lookup for cmov introduced in r349315
Craig Topper [Mon, 17 Dec 2018 06:40:35 +0000 (06:40 +0000)]
[X86] Fix bad operand lookup for cmov introduced in r349315

The CC is operand 2 not operand 3.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349330 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Power9][NFC]update vabsd case for better dumping
Kewen Lin [Mon, 17 Dec 2018 06:32:02 +0000 (06:32 +0000)]
[Power9][NFC]update vabsd case for better dumping

Appended options -ppc-vsr-nums-as-vr and -ppc-asm-full-reg-names to get the
more descriptive output. Also removed useless function attributes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349329 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Power9][NFC]Make pre-inc-disable case more robust
Kewen Lin [Mon, 17 Dec 2018 03:16:12 +0000 (03:16 +0000)]
[Power9][NFC]Make pre-inc-disable case more robust

With some patch adopted for Power9 vabsd* insns, some CHECKs can't get the expected results.
But it's false alarm, we should update the case more robust.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349325 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[gn build] Add build files for opt and its dependency Transforms/Couroutines
Nico Weber [Mon, 17 Dec 2018 02:33:15 +0000 (02:33 +0000)]
[gn build] Add build files for opt and its dependency Transforms/Couroutines

Needed for check-lld.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349324 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[EarlyCSE] If DI can't be salvaged, mark it as unavailable.
Davide Italiano [Mon, 17 Dec 2018 01:42:39 +0000 (01:42 +0000)]
[EarlyCSE] If DI can't be salvaged, mark it as unavailable.

Fixes PR39874.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349323 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Add cttz/ctlz + select non-bitwidth tests; NFC
Nikita Popov [Sun, 16 Dec 2018 23:48:18 +0000 (23:48 +0000)]
[InstCombine] Add cttz/ctlz + select non-bitwidth tests; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349322 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Regenerate test checks; NFC
Nikita Popov [Sun, 16 Dec 2018 23:48:11 +0000 (23:48 +0000)]
[InstCombine] Regenerate test checks; NFC

Also drop unnecessary entry blocks and avoid use of anonymous
variables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349321 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Pull out constant splat rotation detection.
Simon Pilgrim [Sun, 16 Dec 2018 19:46:04 +0000 (19:46 +0000)]
[X86] Pull out constant splat rotation detection.

We had 3 different approaches - consistently use getTargetConstantBitsFromNode and allow undef elts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349319 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Make cttz/ctlz knownbits tests more robust; NFC
Nikita Popov [Sun, 16 Dec 2018 19:12:08 +0000 (19:12 +0000)]
[InstCombine] Make cttz/ctlz knownbits tests more robust; NFC

Tests checking for the addition of !range metadata should be
preserved if cttz/ctlz + icmp is optimized.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349318 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRegenerate test (merges X86+X64 cases). NFCI.
Simon Pilgrim [Sun, 16 Dec 2018 19:07:57 +0000 (19:07 +0000)]
Regenerate test (merges X86+X64 cases). NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349317 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Remove truncation handling from EmitTest. Replace it with a DAG combine.
Craig Topper [Sun, 16 Dec 2018 18:35:55 +0000 (18:35 +0000)]
[X86] Remove truncation handling from EmitTest. Replace it with a DAG combine.

I'd like to try to move a lot of the flag matching out of EmitTest and push it to isel or isel preprocessing. This is a step towards that.

The test-shrink-bug.ll changie is an improvement because we are no longer interfering with test shrink handling in isel.

The pr34137.ll change is a regression, but the IR came from -O0 and was not reduced by InstCombine. So it contains a lot of redundancies like duplicate loads that made it combine poorly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349315 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Sun, 16 Dec 2018 18:35:54 +0000 (18:35 +0000)]
[X86] Autogenerate complete checks. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349314 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "[InstCombine] Regenerate test checks; NFC"
Nikita Popov [Sun, 16 Dec 2018 18:27:37 +0000 (18:27 +0000)]
Revert "[InstCombine] Regenerate test checks; NFC"

This reverts commit r349311.

Didn't check this carefully enough...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349312 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Regenerate test checks; NFC
Nikita Popov [Sun, 16 Dec 2018 18:22:57 +0000 (18:22 +0000)]
[InstCombine] Regenerate test checks; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349311 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombined] Add more tests for cttz/ctlz + icmp; NFC
Nikita Popov [Sun, 16 Dec 2018 17:51:32 +0000 (17:51 +0000)]
[InstCombined] Add more tests for cttz/ctlz + icmp; NFC

Test cases other than icmp with the bitwidth.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349310 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Add additional saturating add/sub + icmp tests; NFC
Nikita Popov [Sun, 16 Dec 2018 17:45:25 +0000 (17:45 +0000)]
[InstCombine] Add additional saturating add/sub + icmp tests; NFC

These test comparisons with saturating add/sub in non-canonical
form.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349309 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] regenerate test checks; NFC
Sanjay Patel [Sun, 16 Dec 2018 16:14:42 +0000 (16:14 +0000)]
[InstCombine] regenerate test checks; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349307 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] add tests for vector widening transforms (PR40032); NFC
Sanjay Patel [Sun, 16 Dec 2018 15:50:50 +0000 (15:50 +0000)]
[InstCombine] add tests for vector widening transforms (PR40032); NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349306 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[x86] increment/decrement constant vector with min/max in vsetcc lowering (PR39859)
Sanjay Patel [Sun, 16 Dec 2018 15:05:48 +0000 (15:05 +0000)]
[x86] increment/decrement constant vector with min/max in vsetcc lowering (PR39859)

This is part of fixing PR39859:
https://bugs.llvm.org/show_bug.cgi?id=39859

We have a crippled vector ISA, so we have to invert a typical fold and create min/max here.

As discussed in the bug report, we can probably do better by using saturating subtract when
it's available, but we should have this improvement for the min/max patterns regardless.

Alive proofs:
https://rise4fun.com/Alive/zsf
https://rise4fun.com/Alive/Qrl

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349304 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DAGCombiner] allow hoisting vector bitwise logic ahead of truncates
Sanjay Patel [Sun, 16 Dec 2018 14:57:04 +0000 (14:57 +0000)]
[DAGCombiner] allow hoisting vector bitwise logic ahead of truncates

The transform performs a bitwise logic op in a wider type followed by
truncate when both inputs are truncated from the same source type:
logic_op (truncate x), (truncate y) --> truncate (logic_op x, y)

There are a bunch of other checks that should prevent doing this when
it might be harmful.

We already do this transform for scalars in this spot. The vector
limitation was shared with a check for the case when the operands are
extended. I'm not sure if that limit is needed either, but that would
be a separate patch.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349303 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUpdate the list of platforms & archs
Sylvestre Ledru [Sun, 16 Dec 2018 14:47:16 +0000 (14:47 +0000)]
Update the list of platforms & archs

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349302 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUse backquotes to avoid a sphinx unexpected error:
Sylvestre Ledru [Sun, 16 Dec 2018 14:19:39 +0000 (14:19 +0000)]
Use backquotes to avoid a sphinx unexpected error:
Unknown target name: "bootstrap".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349301 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDocument the usage of BOOTSTRAP_XXX with stage2 builds
Sylvestre Ledru [Sun, 16 Dec 2018 14:04:10 +0000 (14:04 +0000)]
Document the usage of BOOTSTRAP_XXX with stage2 builds

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349299 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SelectionDAG] Add FSHL/FSHR support to computeKnownBits
Simon Pilgrim [Sun, 16 Dec 2018 13:33:37 +0000 (13:33 +0000)]
[SelectionDAG] Add FSHL/FSHR support to computeKnownBits

Also exposes an issue in DAGCombiner::visitFunnelShift where we were assuming the shift amount had the result type (after legalization it'll have the targets shift amount type).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349298 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Add computeKnownBits tests for funnel shift intrinsics
Simon Pilgrim [Sun, 16 Dec 2018 12:15:31 +0000 (12:15 +0000)]
[X86] Add computeKnownBits tests for funnel shift intrinsics

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349297 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[gn build] Merge r349167
Nico Weber [Sun, 16 Dec 2018 02:32:20 +0000 (02:32 +0000)]
[gn build] Merge r349167

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349291 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[gn build] Add build files for obj2yaml, yaml2obj, and lib/ObjectYAML
Nico Weber [Sun, 16 Dec 2018 02:29:02 +0000 (02:29 +0000)]
[gn build] Add build files for obj2yaml, yaml2obj, and lib/ObjectYAML

The two executables are needed by check-lld.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349290 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[gn build] Add build files for llvm-as, llvm-dis, llvm-dwarfdump, llvm-mc, FileCheck...
Nico Weber [Sun, 16 Dec 2018 02:27:10 +0000 (02:27 +0000)]
[gn build] Add build files for llvm-as, llvm-dis, llvm-dwarfdump, llvm-mc, FileCheck, count, not

These executables are needed by check-lld.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349289 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Sat, 15 Dec 2018 22:52:57 +0000 (22:52 +0000)]
[X86] Autogenerate complete checks. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349287 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Begin cleaning up combineOr -> SHLD/SHRD. NFCI.
Simon Pilgrim [Sat, 15 Dec 2018 21:11:49 +0000 (21:11 +0000)]
[X86] Begin cleaning up combineOr -> SHLD/SHRD. NFCI.

In preparation for converting to funnel shifts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349286 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Lower to SHLD/SHRD on slow machines for optsize
Simon Pilgrim [Sat, 15 Dec 2018 19:43:44 +0000 (19:43 +0000)]
[X86] Lower to SHLD/SHRD on slow machines for optsize

Use consistent rules for when to lower to SHLD/SHRD for slow machines - fixes a weird issue where funnel shift gets expanded but then X86ISelLowering's combineOr sees the optsize and combines to SHLD/SHRD, but now with the modulo amount guard......

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349285 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Add optsize SHLD/SHRD tests
Simon Pilgrim [Sat, 15 Dec 2018 19:32:26 +0000 (19:32 +0000)]
[X86] Add optsize SHLD/SHRD tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349284 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd NetBSD support in needsRuntimeRegistrationOfSectionRange.
Kamil Rytarowski [Sat, 15 Dec 2018 16:51:35 +0000 (16:51 +0000)]
Add NetBSD support in needsRuntimeRegistrationOfSectionRange.

Use linker script magic to get data/cnts/name start/end.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349277 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRegister kASan shadow offset for NetBSD/amd64
Kamil Rytarowski [Sat, 15 Dec 2018 16:32:41 +0000 (16:32 +0000)]
Register kASan shadow offset for NetBSD/amd64

The NetBSD x86_64 kernel uses the 0xdfff900000000000 shadow
offset.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349276 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CodeGen] Enhance machine PHIs optimization
Dinar Temirbulatov [Sat, 15 Dec 2018 14:37:01 +0000 (14:37 +0000)]
[CodeGen] Enhance machine PHIs optimization

Summary:
Make machine PHIs optimization to work for single value register taken from
several different copies. This is the first step to fix PR38917. This change
allows to get rid of redundant PHIs (see opt_phis2.mir test) to make
the subsequent optimizations (like CSE) possible and simpler.

For instance, before this patch the code like this:

%b = COPY %z
...
%a = PHI %bb1, %a; %bb2, %b
could be optimized to:

%a = %b
but the code like this:

%c = COPY %z
...
%b = COPY %z
...
%a = PHI %bb1, %a; %bb2, %b; %bb3, %c
would remain unchanged.
With this patch the latter case will be optimized:

%a = %z```.

Committed on behalf of: Anton Afanasyev anton.a.afanasyev@gmail.com

Reviewers: RKSimon, MatzeB

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349271 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRegenerate neon copy tests. NFCI.
Simon Pilgrim [Sat, 15 Dec 2018 14:23:18 +0000 (14:23 +0000)]
Regenerate neon copy tests. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349270 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix -Wunused-variable warning. NFCI.
Simon Pilgrim [Sat, 15 Dec 2018 12:25:22 +0000 (12:25 +0000)]
Fix -Wunused-variable warning. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349265 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[TargetLowering] Add ISD::OR + ISD::XOR handling to SimplifyDemandedVectorElts
Simon Pilgrim [Sat, 15 Dec 2018 11:36:36 +0000 (11:36 +0000)]
[TargetLowering] Add ISD::OR + ISD::XOR handling to SimplifyDemandedVectorElts

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349264 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstSimplify] Add tests for saturating add/sub + icmp; NFC
Nikita Popov [Sat, 15 Dec 2018 10:37:01 +0000 (10:37 +0000)]
[InstSimplify] Add tests for saturating add/sub + icmp; NFC

If a saturating add/sub with a constant operand is compared to
another constant, we should be able to determine that the condition
is always true/false in some cases (but currently don't).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349261 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[mips] Fix test typo in rL348914
Fangrui Song [Sat, 15 Dec 2018 08:44:47 +0000 (08:44 +0000)]
[mips] Fix test typo in rL348914

RUN; -> RUN:

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349258 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Power9][NFC] add setb exploitation test case
Kewen Lin [Sat, 15 Dec 2018 04:39:37 +0000 (04:39 +0000)]
[Power9][NFC] add setb exploitation test case

Add an original test case for setb before the exploitation actually takes effect, later we can check the difference.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349251 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SILoadStoreOptimizer] Use std::abs to avoid truncation.
Florian Hahn [Sat, 15 Dec 2018 01:32:58 +0000 (01:32 +0000)]
[SILoadStoreOptimizer] Use std::abs to avoid truncation.

Using regular abs() causes the following warning

error: absolute value function 'abs' given an argument of type 'int64_t' (aka 'long') but has parameter of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value]
        (uint32_t)abs(Dist) > MaxDist) {
                  ^
lib/Target/AMDGPU/SILoadStoreOptimizer.cpp:1369:19: note: use function 'std::abs' instead

which causes a bot to fail:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/18284/steps/bootstrap%20clang/logs/stdio

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349224 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Rename hasNoSignedComparisonUses to hasNoSignFlagUses. Add the instruction...
Craig Topper [Sat, 15 Dec 2018 01:07:19 +0000 (01:07 +0000)]
[X86] Rename hasNoSignedComparisonUses to hasNoSignFlagUses. Add the instruction that only modify the O flag to the waiver list.

The only caller of this turns CMP with 0 into TEST. CMP with 0 and TEST both set OF to 0 so we should have no issues with instructions that only use OF.

Though I don't think there's any reason we would read just OF after a compare with 0 anyway. So this probably isn't an observable change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349223 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Make hasNoCarryFlagUses/hasNoSignedComparisonUses take an SDValue that indicate...
Craig Topper [Sat, 15 Dec 2018 01:07:16 +0000 (01:07 +0000)]
[X86] Make hasNoCarryFlagUses/hasNoSignedComparisonUses take an SDValue that indicates which result is the flag result. NFCI

hasNoCarryFlagUses hardcoded that the flag result is 1 and used that to filter which uses were of interest. hasNoSignedComparisonUses just assumes the only result is flags and checks whether any user of the node is a CopyToReg instruction.

After this patch we now do a result number check in both and rely on the caller to provide the result number.

This shouldn't change behavior it was just an odd difference between the two functions that I noticed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349222 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Check if the section order is correct
Heejin Ahn [Sat, 15 Dec 2018 00:58:12 +0000 (00:58 +0000)]
[WebAssembly] Check if the section order is correct

Summary:
This patch checks if the section order is correct when reading a wasm
object file in `WasmObjectFile` and converting YAML to wasm object in
yaml2wasm. (It is not possible to check when reading YAML because it is
handled exclusively by the YAML reader.)

This checks the ordering of all known sections (core sections + known
custom sections). This also adds section ID DataCount section that will
be scheduled to be added in near future.

Reviewers: sbc100

Subscribers: dschuff, mgorny, jgravelle-google, sunfish, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349221 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[NewGVN] Update use counts for SSA copies when replacing them by their operands.
Florian Hahn [Sat, 15 Dec 2018 00:32:38 +0000 (00:32 +0000)]
[NewGVN] Update use counts for SSA copies when replacing them by their operands.

The current code relies on LeaderUseCount to determine if we can remove
an SSA copy, but in that the LeaderUseCount does not refer to the SSA
copy. If a SSA copy is a dominating leader, we use the operand as dominating
leader instead. This means we removed a user of a ssa copy and we should
decrement its use count, so we can remove the ssa copy once it becomes dead.

Fixes PR38804.

Reviewers: efriedma, davide

Reviewed By: davide

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349217 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Util] Refer to [s|z]exts of args when converting dbg.declares (fix PR35400)
Vedant Kumar [Sat, 15 Dec 2018 00:03:33 +0000 (00:03 +0000)]
[Util] Refer to [s|z]exts of args when converting dbg.declares (fix PR35400)

When converting dbg.declares, if the described value is a [s|z]ext,
refer to the ext directly instead of referring to its operand.

This fixes a narrowing bug (the debugger got the sign of a variable
wrong, see llvm.org/PR35400).

The main reason to refer to the ext's operand was that an optimization
may remove the ext itself, leading to a dropped variable. Now that
InstCombine has been taught to use replaceAllDbgUsesWith (r336451), this
is less of a concern. Other passes can/should adopt this API as needed
to fix dropped variable bugs.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349214 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[NVPTX] Lower instructions that expand into libcalls.
Artem Belevich [Fri, 14 Dec 2018 23:53:06 +0000 (23:53 +0000)]
[NVPTX] Lower instructions that expand into libcalls.

The change is an effort to split and refactor abandoned
D34708 into smaller parts.

Here the behaviour of unsupported instructions is changed
to match the behaviour of explicit intrinsics calls.
Currently LLVM crashes with:
> Assertion getInstruction() && "Not a call or invoke instruction!" failed.

With this patch LLVM produces a more sensible error message:
> Cannot select: ... i32 = ExternalSymbol'__foobar'

Author: Denys Zariaiev <denys.zariaiev@gmail.com>

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349213 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDebugInfo: Avoid using split DWARF when the split unit would be empty.
David Blaikie [Fri, 14 Dec 2018 22:44:46 +0000 (22:44 +0000)]
DebugInfo: Avoid using split DWARF when the split unit would be empty.

In ThinLTO many split CUs may be effectively empty because of the lack
of support for cross-unit references in split DWARF.

Using a split unit in those cases is just a waste/overhead - and turned
out to be one contributor to a significant symbolizer performance issue
when global variable debug info was being imported (see r348416 for the
primary fix) due to symbolizers seeing CUs with no ranges, assuming
there might still be addresses covered and walking into the split CU to
see if there are any ranges (when that split CU was in a DWP file, that
meant loading the DWP and its index, the index was extra large because
of all these fractured/empty CUs... and so was very expensive to load).

(the 3rd fix which will follow, is to assume that a CU with no ranges is
empty rather than merely missing its CU level range data - and to not
walk into its DIEs (split or otherwise) in search of address information
that is generally not present)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349207 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[codeview] Add begin/endSymbolRecord helpers, NFC
Reid Kleckner [Fri, 14 Dec 2018 22:40:28 +0000 (22:40 +0000)]
[codeview] Add begin/endSymbolRecord helpers, NFC

Previously beginning a symbol record was excessively verbose. Now it's a
bit simpler. This follows the same pattern as begin/endCVSubsection.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349205 91177308-0d34-0410-b5e6-96231b3b80d8