platform/upstream/llvm.git
5 years ago[llvm-objcopy][NFC] Fix trailing semicolon warning.
Clement Courbet [Mon, 4 Feb 2019 10:24:42 +0000 (10:24 +0000)]
[llvm-objcopy][NFC] Fix trailing semicolon warning.

llvm-svn: 353035

5 years ago[NFC] Remove redundant parameters for better readability
Max Kazantsev [Mon, 4 Feb 2019 10:20:51 +0000 (10:20 +0000)]
[NFC] Remove redundant parameters for better readability

llvm-svn: 353034

5 years ago[clang-format] Fix breaking of qualified operator
Krasimir Georgiev [Mon, 4 Feb 2019 09:56:16 +0000 (09:56 +0000)]
[clang-format] Fix breaking of qualified operator

Summary:
From https://bugs.llvm.org/show_bug.cgi?id=40516
```
$ cat a.cpp
const NamespaceName::VeryLongClassName &NamespaceName::VeryLongClassName::myFunction() {
  // do stuff
}

const NamespaceName::VeryLongClassName &NamespaceName::VeryLongClassName::operator++() {
  // do stuff
}
$ ~/ll/build/opt/bin/clang-format -style=LLVM a.cpp
const NamespaceName::VeryLongClassName &
NamespaceName::VeryLongClassName::myFunction() {
  // do stuff
}

const NamespaceName::VeryLongClassName &NamespaceName::VeryLongClassName::
operator++() {
  // do stuff
}
```
What was happening is that the split penalty before `operator` was being set to
a smaller value by a prior if block. Moved checks around to fix this and added a
regression test.

Reviewers: djasper

Reviewed By: djasper

Tags: #clang

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

llvm-svn: 353033

5 years ago[NFC] Replace equivalent condition for better readability
Max Kazantsev [Mon, 4 Feb 2019 09:55:18 +0000 (09:55 +0000)]
[NFC] Replace equivalent condition for better readability

llvm-svn: 353032

5 years ago[clang] Add getCommentHandler to PreambleCallbacks
Kadir Cetinkaya [Mon, 4 Feb 2019 09:42:33 +0000 (09:42 +0000)]
[clang] Add getCommentHandler to PreambleCallbacks

Summary:
Enables users to add comment handlers to preprocessor when building
preambles.

Reviewers: ilya-biryukov, ioeric

Subscribers: cfe-commits

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

llvm-svn: 353030

5 years ago[SelectionDAG] Add a BaseIndexOffset::print() method for debugging.
Clement Courbet [Mon, 4 Feb 2019 09:30:43 +0000 (09:30 +0000)]
[SelectionDAG] Add a BaseIndexOffset::print() method for debugging.

llvm-svn: 353028

5 years ago[clangd] Bump vscode-clangd v0.0.10
Haojian Wu [Mon, 4 Feb 2019 09:26:42 +0000 (09:26 +0000)]
[clangd] Bump vscode-clangd v0.0.10

CHANGELOG:
- cleanup filestatus caches when clangd crashes
- extension workwith LSP v3.14.0, support go-to-declaration feature

llvm-svn: 353027

5 years ago[clangd] Update vscode dependencies
Haojian Wu [Mon, 4 Feb 2019 09:20:41 +0000 (09:20 +0000)]
[clangd] Update vscode dependencies

This allows us to use latest LSP v3.14.0 (for go-to-declaration feature).

llvm-svn: 353026

5 years ago[llvm-exegesis] Cut run time of analysis mode by another -35% (*sic*) (YamlContext...
Roman Lebedev [Mon, 4 Feb 2019 09:12:25 +0000 (09:12 +0000)]
[llvm-exegesis] Cut run time of analysis mode by another -35% (*sic*) (YamlContext::getRegNo())

Summary:

Together with the previous patch, it's an -90% improvement,
or roughly -96% improvement if you look starting with rL347204

```
$ perf stat -r 9 ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput-onefull.yaml -analysis-clusters-output-file="" -analysis-inconsistencies-output-file=/tmp/clusters-bew.html
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 14656 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-bew.html'
...
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 14656 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-bew.html'

 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput-onefull.yaml -analysis-clusters-output-file= -analysis-inconsistencies-output-file=/tmp/clusters-bew.html' (9 runs):

           1483.18 msec task-clock                #    0.999 CPUs utilized            ( +-  0.10% )
                68      context-switches          #   46.085 M/sec                    ( +- 22.62% )
                 0      cpu-migrations            #    0.000 K/sec
             11641      page-faults               # 7850.880 M/sec                    ( +-  0.62% )
        5943246799      cycles                    # 4008184.428 GHz                   ( +-  0.10% )  (83.28%)
         442869514      stalled-cycles-frontend   #    7.45% frontend cycles idle     ( +-  0.41% )  (83.29%)
        1443375663      stalled-cycles-backend    #   24.29% backend cycles idle      ( +-  0.47% )  (33.43%)
        7714006752      instructions              #    1.30  insn per cycle
                                                  #    0.19  stalled cycles per insn  ( +-  0.07% )  (50.17%)
        1977242936      branches                  # 1333472193.855 M/sec              ( +-  0.07% )  (66.79%)
          32624220      branch-misses             #    1.65% of all branches          ( +-  0.18% )  (83.34%)

           1.48438 +- 0.00143 seconds time elapsed  ( +-  0.10% )
```
```
$ perf stat -r 9 ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput-onefull.yaml -analysis-clusters-output-file="" -analysis-inconsistencies-output-file=/tmp/clusters-newer.html
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 14656 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-newer.html'
...
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 14656 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-newer.html'

 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput-onefull.yaml -analysis-clusters-output-file= -analysis-inconsistencies-output-file=/tmp/clusters-newer.html' (9 runs):

            963.28 msec task-clock                #    0.999 CPUs utilized            ( +-  0.37% )
                12      context-switches          #   12.695 M/sec                    ( +- 52.79% )
                 0      cpu-migrations            #    0.000 K/sec
             11599      page-faults               # 12046.971 M/sec                   ( +-  0.59% )
        3860122322      cycles                    # 4009359.596 GHz                   ( +-  0.37% )  (83.19%)
         380300669      stalled-cycles-frontend   #    9.85% frontend cycles idle     ( +-  0.34% )  (83.30%)
        1071910340      stalled-cycles-backend    #   27.77% backend cycles idle      ( +-  1.30% )  (33.51%)
        4773418224      instructions              #    1.24  insn per cycle
                                                  #    0.22  stalled cycles per insn  ( +-  0.15% )  (50.17%)
        1106990316      branches                  # 1149787979.919 M/sec              ( +-  0.11% )  (66.80%)
          23632231      branch-misses             #    2.13% of all branches          ( +-  0.18% )  (83.33%)

           0.96389 +- 0.00356 seconds time elapsed  ( +-  0.37% )
```
```
$ sha512sum /tmp/clusters-*
db4bbd904fe8840853b589b032c5041bc060b91bcd9c27b914b56581fbc473550eea74b852238c79963b5adf2419f379e9f5db76784048b48e3937f9f3e732bf  /tmp/clusters-bew.html
db4bbd904fe8840853b589b032c5041bc060b91bcd9c27b914b56581fbc473550eea74b852238c79963b5adf2419f379e9f5db76784048b48e3937f9f3e732bf  /tmp/clusters-newer.html
db4bbd904fe8840853b589b032c5041bc060b91bcd9c27b914b56581fbc473550eea74b852238c79963b5adf2419f379e9f5db76784048b48e3937f9f3e732bf  /tmp/clusters-old.html
```

Reviewers: courbet, gchatelet

Reviewed By: courbet

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

llvm-svn: 353025

5 years ago[llvm-exegesis] Cut run time of analysis mode by -84% (*sic*) (YamlContext::getInstrO...
Roman Lebedev [Mon, 4 Feb 2019 09:12:21 +0000 (09:12 +0000)]
[llvm-exegesis] Cut run time of analysis mode by -84% (*sic*) (YamlContext::getInstrOpcode())

Summary:
```
$ perf stat -r 9 ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput-onefull.yaml -analysis-clusters-output-file="" -analysis-inconsistencies-output-file=/tmp/clusters-old.html
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 14656 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-old.html'
...
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 14656 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-old.html'

 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput-onefull.yaml -analysis-clusters-output-file= -analysis-inconsistencies-output-file=/tmp/clusters-old.html' (9 runs):

           9465.46 msec task-clock                #    1.000 CPUs utilized            ( +-  0.05% )
                60      context-switches          #    6.363 M/sec                    ( +- 79.45% )
                 0      cpu-migrations            #    0.000 K/sec
             11364      page-faults               # 1200.697 M/sec                    ( +-  0.60% )
       37935623543      cycles                    # 4008083.912 GHz                   ( +-  0.05% )  (83.32%)
        2371625356      stalled-cycles-frontend   #    6.25% frontend cycles idle     ( +-  0.37% )  (83.32%)
        8476077875      stalled-cycles-backend    #   22.34% backend cycles idle      ( +-  0.18% )  (33.36%)
       41822439158      instructions              #    1.10  insn per cycle
                                                  #    0.20  stalled cycles per insn  ( +-  0.02% )  (50.03%)
       11607658944      branches                  # 1226405861.486 M/sec              ( +-  0.01% )  (66.69%)
         210864633      branch-misses             #    1.82% of all branches          ( +-  0.06% )  (83.34%)

           9.46636 +- 0.00441 seconds time elapsed  ( +-  0.05% )
```
```
$ perf stat -r 9 ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput-onefull.yaml -analysis-clusters-output-file="" -analysis-inconsistencies-output-file=/tmp/clusters-bew.html
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 14656 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-bew.html'
...
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 14656 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-bew.html'

 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput-onefull.yaml -analysis-clusters-output-file= -analysis-inconsistencies-output-file=/tmp/clusters-bew.html' (9 runs):

           1480.66 msec task-clock                #    1.000 CPUs utilized            ( +-  0.19% )
                13      context-switches          #    8.483 M/sec                    ( +- 83.10% )
                 0      cpu-migrations            #    0.075 M/sec                    ( +-100.00% )
             11596      page-faults               # 7834.247 M/sec                    ( +-  0.59% )
        5933732194      cycles                    # 4008977.535 GHz                   ( +-  0.19% )  (83.22%)
         438111928      stalled-cycles-frontend   #    7.38% frontend cycles idle     ( +-  0.37% )  (83.25%)
        1454969705      stalled-cycles-backend    #   24.52% backend cycles idle      ( +-  0.94% )  (33.53%)
        7724218604      instructions              #    1.30  insn per cycle
                                                  #    0.19  stalled cycles per insn  ( +-  0.07% )  (50.14%)
        1979796413      branches                  # 1337599858.945 M/sec              ( +-  0.06% )  (66.74%)
          32641638      branch-misses             #    1.65% of all branches          ( +-  0.18% )  (83.31%)

           1.48128 +- 0.00284 seconds time elapsed  ( +-  0.19% )

$ sha512sum /tmp/clusters-*
db4bbd904fe8840853b589b032c5041bc060b91bcd9c27b914b56581fbc473550eea74b852238c79963b5adf2419f379e9f5db76784048b48e3937f9f3e732bf  /tmp/clusters-bew.html
db4bbd904fe8840853b589b032c5041bc060b91bcd9c27b914b56581fbc473550eea74b852238c79963b5adf2419f379e9f5db76784048b48e3937f9f3e732bf  /tmp/clusters-old.html
```

Reviewers: courbet, gchatelet

Reviewed By: courbet

Subscribers: tschuett, llvm-commits, RKSimon

Tags: #llvm

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

llvm-svn: 353024

5 years ago[llvm-exegesis] Throughput support in analysis mode
Roman Lebedev [Mon, 4 Feb 2019 09:12:17 +0000 (09:12 +0000)]
[llvm-exegesis] Throughput support in analysis mode

Summary:
D57000 / [[ https://bugs.llvm.org/show_bug.cgi?id=37698 | PR37698 ]] added support for measuring of the inverse throughput.
But the support for the analysis was not added.
This attempts to fix that. (analysis done o bdver2 / piledriver)

First, small-scale experiment:
```
$ ./bin/llvm-exegesis -num-repetitions=10000 -mode=inverse_throughput -opcode-name=BSF64rr
Check generated assembly with: /usr/bin/objdump -d /tmp/snippet-d0acdd.o
---
mode:            inverse_throughput
key:
  instructions:
    - 'BSF64rr RAX RDX'
  config:          ''
  register_initial_values:
    - 'RDX=0x0'
cpu_name:        bdver2
llvm_triple:     x86_64-unknown-linux-gnu
num_repetitions: 10000
measurements:
  - { key: inverse_throughput, value: 3.0278, per_snippet_value: 3.0278 }
error:           ''
info:            instruction has no tied variables picking Uses different from defs
assembled_snippet: 48BA0000000000000000480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2C3
...
```
If we plug `bsfq %r12, %r10` into llvm-mca:
https://godbolt.org/z/ZtOyhJ
```
Dispatch Width:    4
uOps Per Cycle:    3.00
IPC:               0.50
Block RThroughput: 2.0
```
So RThroughput mismatch exists.

Now, let's upscale and analyse:
{F8207148}
`$ ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html`:
{F8207172}
{F8207197}
And if we now look at https://www.agner.org/optimize/instruction_tables.pdf,
`Reciprocal throughput` for `BSF r,r` is listed as `3`.
Yay?

Reviewers: courbet, gchatelet

Reviewed By: courbet

Subscribers: tschuett, RKSimon, llvm-commits

Tags: #llvm

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

llvm-svn: 353023

5 years ago[llvm-exegesis] deserializeMCInst(): bump SmallVector small size up to 16
Roman Lebedev [Mon, 4 Feb 2019 09:12:13 +0000 (09:12 +0000)]
[llvm-exegesis] deserializeMCInst(): bump SmallVector small size up to 16

Summary:
... from 8.
`VALIGNDZ128rmbik XMM0 XMM0 K1 XMM3 RDI i_0x1  i_0x0  i_0x1` instruction already has 9 components.
It does not matter much in terms of performance, but avoiding allocation seems to come with low cost here..

Reviewers: courbet, gchatelet

Reviewed By: courbet

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

llvm-svn: 353022

5 years ago[llvm-exegesis] Don't default to running&dumping all analyses to '-'
Roman Lebedev [Mon, 4 Feb 2019 09:12:08 +0000 (09:12 +0000)]
[llvm-exegesis] Don't default to running&dumping all analyses to '-'

Summary:
Up until the point i have looked in the source, i didn't even understood that
i can disable 'cluster' output. I have always silenced it via ` &> /dev/null`.
(And hoped it wasn't contributing much of the run time.)

While i expect that it has it's use-cases i never once needed it so far.
If i forget to silence it, console is completely flooded with that output.

How about not expecting users to opt-out of analyses,
but to explicitly specify the analyses that should be performed?

Reviewers: courbet, gchatelet

Reviewed By: courbet

Subscribers: tschuett, RKSimon, llvm-commits

Tags: #llvm

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

llvm-svn: 353021

5 years ago[OpenMP] Adding support to the mutexinoutset dep-type
Sergi Mateo Bellido [Mon, 4 Feb 2019 07:33:19 +0000 (07:33 +0000)]
[OpenMP] Adding support to the mutexinoutset dep-type

Summary: this commit adds support to a new dependence type introduced in OpenMP
5.0. The LLVM OpenMP RTL already supports this feature, so we  only need to
modify CLANG to take advantage of them.

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

llvm-svn: 353018

5 years ago[SCEV] Do not bother creating separate SCEVUnknown for unreachable nodes
Max Kazantsev [Mon, 4 Feb 2019 05:04:19 +0000 (05:04 +0000)]
[SCEV] Do not bother creating separate SCEVUnknown for unreachable nodes

Currently, SCEV creates SCEVUnknown for every node of unreachable code. If we
have a huge amounts of such code, we will be littering SE with these nodes. We could
just state that they all are undef and save some memory.

Differential Revision: https://reviews.llvm.org/D57567
Reviewed By: sanjoy

llvm-svn: 353017

5 years agoRecommit r352660 "[X86] Mark EMMS and FEMMS as clobbering MM0-7 and ST0-7."
Craig Topper [Mon, 4 Feb 2019 04:44:20 +0000 (04:44 +0000)]
Recommit r352660 "[X86] Mark EMMS and FEMMS as clobbering MM0-7 and ST0-7."

We now print ST0 as 'st' when generating the clobber list for MS inline assembly in clang. This matches what the gcc reg name list expects.

Original commit message:

This fixes the test case in PR35982 by preventing MMX instructions that read MM0-7 from being moved below EMMS/FEMMS by the post RA scheduler.

Though as discussed in bugzilla, this is not a complete fix. There is still the possibility of reordering in IR or by the pre-RA scheduler.

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

llvm-svn: 353016

5 years ago[X86] Print %st(0) as %st when its implicit to the instruction. Continue printing...
Craig Topper [Mon, 4 Feb 2019 04:15:10 +0000 (04:15 +0000)]
[X86] Print %st(0) as %st when its implicit to the instruction. Continue printing it as %st(0) when its encoded in the instruction.

This is a step back from the change I made in r352985. This appears to be more consistent with gcc and objdump behavior.

llvm-svn: 353015

5 years ago[X86] Regenerate test to drop 'End function' comments some other other regex updates.
Craig Topper [Mon, 4 Feb 2019 04:15:04 +0000 (04:15 +0000)]
[X86] Regenerate test to drop 'End function' comments some other other regex updates.

llvm-svn: 353014

5 years agoRevert r352985 "[X86] Print %st(0) as %st to match what gcc inline asm uses as the...
Craig Topper [Mon, 4 Feb 2019 04:15:02 +0000 (04:15 +0000)]
Revert r352985 "[X86] Print %st(0) as %st to match what gcc inline asm uses as the clobber name to make MS inline asm work correctly"

Looking into gcc and objdump behavior more this was overly aggressive. If the register is encoded in the instruction we should print %st(0), if its implicit we should print %st.

I'll be making a more directed change in a future patch.

llvm-svn: 353013

5 years agotests: loosen restriction
Saleem Abdulrasool [Mon, 4 Feb 2019 00:09:32 +0000 (00:09 +0000)]
tests: loosen restriction

The MachO tests can run on any target, but require that the x86 backend
is available.  Broaden the coverage of the test.

llvm-svn: 353012

5 years agoCompute the correct symbol size in llvm-nm even without --print-size
Sunil Srivastava [Sun, 3 Feb 2019 22:40:01 +0000 (22:40 +0000)]
Compute the correct symbol size in llvm-nm even without --print-size

In llvm-nm, the symbol size was being computed only with --print-size option,
even though it was being printed in other cases, such as with --format=posix.

This patch simply removes the guard, so that the size is computed
independently of the later decision to print it or not.

Fixes PR39997.

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

llvm-svn: 353011

5 years agoProvide a placement new definition for the SEH version of UnwindCursor
Martin Storsjo [Sun, 3 Feb 2019 22:16:53 +0000 (22:16 +0000)]
Provide a placement new definition for the SEH version of UnwindCursor

This fixes compilation after SVN r352966 in SEH mode.

llvm-svn: 353010

5 years ago[opaque pointer types] Trivial changes towards CallInst requiring
James Y Knight [Sun, 3 Feb 2019 21:53:49 +0000 (21:53 +0000)]
[opaque pointer types] Trivial changes towards CallInst requiring
explicit function types.

llvm-svn: 353009

5 years ago[docs] Recommend assertions when testing.
Davide Italiano [Sun, 3 Feb 2019 20:37:13 +0000 (20:37 +0000)]
[docs] Recommend assertions when testing.

Pointed out by Shoaib Meenai.

llvm-svn: 353008

5 years ago[LoopIdiomRecognize] @llvm.dbg values shouldn't affect the transformation.
Davide Italiano [Sun, 3 Feb 2019 20:33:20 +0000 (20:33 +0000)]
[LoopIdiomRecognize] @llvm.dbg values shouldn't affect the transformation.

Summary: PR40564

Reviewers: aprantl, rnk

Subscribers: llvm-commits, hiraditya

Tags: #llvm

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

llvm-svn: 353007

5 years ago[AST] Update the comments of the various Expr::Ignore* + Related cleanups
Bruno Ricci [Sun, 3 Feb 2019 19:50:56 +0000 (19:50 +0000)]
[AST] Update the comments of the various Expr::Ignore* + Related cleanups

The description of what the various Expr::Ignore* do has drifted from the
actual implementation.

Inspection reveals that IgnoreParenImpCasts() is not equivalent to doing
IgnoreParens() + IgnoreImpCasts() until reaching a fixed point, but
IgnoreParenCasts() is equivalent to doing IgnoreParens() + IgnoreCasts()
until reaching a fixed point. There is also a fair amount of duplication
in the various Expr::Ignore* functions which increase the chance of further
future inconsistencies. In preparation for the next patch which will factor
out the implementation of the various Expr::Ignore*, do the following cleanups:

Remove Stmt::IgnoreImplicit, in favor of Expr::IgnoreImplicit. IgnoreImplicit
is the only function among all of the Expr::Ignore* which is available in Stmt.
There are only a few users of Stmt::IgnoreImplicit. They can just use instead
Expr::IgnoreImplicit like they have to do for the other Ignore*.

Move Expr::IgnoreImpCasts() from Expr.h to Expr.cpp. This made no difference
in the run-time with my usual benchmark (-fsyntax-only on all of Boost).

While we are at it, make IgnoreParenNoopCasts take a const reference to the
ASTContext for const correctness.

Update the comments to match what the Expr::Ignore* are actually doing.
I am not sure that listing exactly what each Expr::Ignore* do is optimal,
but it certainly looks better than the current state which is in my opinion
between misleading and just plain wrong.

The whole patch is NFC (if you count removing Stmt::IgnoreImplicit as NFC).

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

Reviewed By: aaron.ballman

llvm-svn: 353006

5 years ago[NFC] Make vector types legal in UREM test
Simon Pilgrim [Sun, 3 Feb 2019 19:38:15 +0000 (19:38 +0000)]
[NFC] Make vector types legal in UREM test

As discussed in D50222, this changes the vector types in tests required for that revision to ones legal for X86.

Patch by @hermord (Dmytro Shynkevych)

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

llvm-svn: 353004

5 years ago[ASTDump] Add a flag indicating whether a CXXThisExpr is implicit
Bruno Ricci [Sun, 3 Feb 2019 18:20:27 +0000 (18:20 +0000)]
[ASTDump] Add a flag indicating whether a CXXThisExpr is implicit

There is currently no way to distinguish implicit from explicit
CXXThisExpr in the AST dump output.

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

Reviewed By: steveire

llvm-svn: 353003

5 years ago[PowerPC] adjust test for uaddo change in rL353001
Sanjay Patel [Sun, 3 Feb 2019 18:10:16 +0000 (18:10 +0000)]
[PowerPC] adjust test for uaddo change in rL353001

We don't need a mtctr/bctr for this test now; a regular
conditional branch is fine.

llvm-svn: 353002

5 years ago[CGP] adjust target constraints for forming uaddo
Sanjay Patel [Sun, 3 Feb 2019 17:53:09 +0000 (17:53 +0000)]
[CGP] adjust target constraints for forming uaddo

There are 2 changes visible here:
1. There's no reason to limit this transform based on number
   of condition registers. That diff allows PPC to produce
   slightly better (dot-instructions should be generally good)
   code.
   Note: someone that cares about PPC codegen might want to
   look closer at that output because it seems like we could
   still improve this.

2. We (probably?) should not bother trying to form uaddo (or
   other overflow ops) when there's no target support for such
   an op. This goes beyond checking whether the op is expanded
   because both PPC and AArch64 show better codegen for standard
   types regardless of whether the op is legal/custom.

llvm-svn: 353001

5 years ago[libFuzzer][Windows] Reenable passing tests
Jonathan Metzman [Sun, 3 Feb 2019 16:53:32 +0000 (16:53 +0000)]
[libFuzzer][Windows] Reenable passing tests

Summary:
Enable tests that were previously disabled because they didn't work on
Windows.

Reviewers: morehouse

Reviewed By: morehouse

Subscribers: morehouse

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

llvm-svn: 353000

5 years ago[X86][AVX] Support shuffle combining for VBROADCAST with smaller vector sources
Simon Pilgrim [Sun, 3 Feb 2019 16:51:33 +0000 (16:51 +0000)]
[X86][AVX] Support shuffle combining for VBROADCAST with smaller vector sources

getTargetShuffleMask can only do this safely if we're extracting the lowest subvector from a vector of the same result type.

llvm-svn: 352999

5 years ago[PatternMatch] add special-case uaddo matching for increment-by-one (2nd try)
Sanjay Patel [Sun, 3 Feb 2019 16:16:48 +0000 (16:16 +0000)]
[PatternMatch] add special-case uaddo matching for increment-by-one (2nd try)

This is the most important uaddo problem mentioned in PR31754:
https://bugs.llvm.org/show_bug.cgi?id=31754
...but that was overcome in x86 codegen with D57637.

That patch also corrects the inc vs. add regressions seen with the  previous attempt at this.

Still, we want to make this matcher complete, so we can potentially canonicalize the pattern
even if it's an 'add 1' operation.
Pattern matching, however, shouldn't assume that we have canonicalized IR, so we match 4
commuted variants of uaddo.

There's also a test with a crazy type to show that the existing CGP transform based on this
matcher is not limited by target legality checks.

I'm not sure if the Hexagon diff means the test is no longer testing what it intended to
test, but that should be solvable in a follow-up.

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

llvm-svn: 352998

5 years ago[X86][AVX] Support shuffle combining for VPMOVZX with smaller vector sources
Simon Pilgrim [Sun, 3 Feb 2019 16:10:18 +0000 (16:10 +0000)]
[X86][AVX] Support shuffle combining for VPMOVZX with smaller vector sources

llvm-svn: 352997

5 years agoHot fix two test regressions (%T vs %t)
David Zarzycki [Sun, 3 Feb 2019 15:49:11 +0000 (15:49 +0000)]
Hot fix two test regressions (%T vs %t)

Different Unix "errno" values are returned for the following scenarios:

$ echo test > /tmp/existingFile/impossibleDir/impossibleFile
"Not a directory"
$ echo test > /tmp/nonexistentDir/impossibleFile
"No such file or directory"

This fixes the regression introduced by r352971 / D57592.

llvm-svn: 352996

5 years ago[objc-gnustep] Fix encoding of ivar size for _Bool.
David Chisnall [Sun, 3 Feb 2019 15:05:52 +0000 (15:05 +0000)]
[objc-gnustep] Fix encoding of ivar size for _Bool.

llvm-svn: 352995

5 years ago[X86][AVX] More aggressively simplify BROADCAST source operand
Simon Pilgrim [Sun, 3 Feb 2019 14:39:41 +0000 (14:39 +0000)]
[X86][AVX] More aggressively simplify BROADCAST source operand

Aim to use scalar source or lowest 128-bit vector directly.

We're still missing some VZMOVL_LOAD combines.

llvm-svn: 352994

5 years ago[x86] add CGP uaddo test with weird type; NFC
Sanjay Patel [Sun, 3 Feb 2019 14:22:43 +0000 (14:22 +0000)]
[x86] add CGP uaddo test with weird type; NFC

There's probably no reason to try this transform
for an obviously unsupported op.

llvm-svn: 352993

5 years ago[CGP] move test file to prevent bot failures
Sanjay Patel [Sun, 3 Feb 2019 14:19:45 +0000 (14:19 +0000)]
[CGP] move test file to prevent bot failures

The test specifiies the triple, so it needs to be in the
x86 directory in case a bot has been configured without
the x86 target.

llvm-svn: 352992

5 years agoRemove trailing semicolon. NFCI.
Simon Pilgrim [Sun, 3 Feb 2019 14:11:32 +0000 (14:11 +0000)]
Remove trailing semicolon. NFCI.

llvm-svn: 352991

5 years agoRemove trailing semicolon. NFCI.
Simon Pilgrim [Sun, 3 Feb 2019 14:08:30 +0000 (14:08 +0000)]
Remove trailing semicolon. NFCI.

llvm-svn: 352990

5 years ago[AST] Extract ASTNodeTraverser class from ASTDumper
Stephen Kelly [Sun, 3 Feb 2019 14:06:54 +0000 (14:06 +0000)]
[AST] Extract ASTNodeTraverser class from ASTDumper

Summary:
This new traverser class allows clients to re-use the traversal logic
which was previously part of ASTDumper.  This means that alternative
visit logic may be implemented, such as

* Dump to alternative data formats such as JSON
* Implement AST Matcher parent/child visitation matching AST dumps

Reviewers: aaron.ballman

Subscribers: jfb, cfe-commits

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

llvm-svn: 352989

5 years ago[CGP] refactor optimizeCmpExpression (NFCI)
Sanjay Patel [Sun, 3 Feb 2019 13:48:03 +0000 (13:48 +0000)]
[CGP] refactor optimizeCmpExpression (NFCI)

This is not truly NFC because we are bailing out without
a TLI now. That should not be a real concern though because
there should be a TLI in any real-world scenario.

That seems better than passing around a pointer and then
checking it for null-ness all over the place.

The motivation is to fix what appears to be an unintended
restriction on the uaddo transform -
hasMultipleConditionRegisters() shouldn't be reason to limit
the transform.

llvm-svn: 352988

5 years ago[PowerPC] add tests for saturating add; NFC
Sanjay Patel [Sun, 3 Feb 2019 12:42:54 +0000 (12:42 +0000)]
[PowerPC] add tests for saturating add; NFC

This is copied from the existing test files for x86/AArch.

llvm-svn: 352987

5 years ago[DA][NewPM] Handle transitive dependencies in the new-pm version of DA
Philip Pfaffe [Sun, 3 Feb 2019 12:25:41 +0000 (12:25 +0000)]
[DA][NewPM] Handle transitive dependencies in the new-pm version of DA

Summary:
The analysis result of DA caches pointers to AA, SCEV, and LI, but it
never checks for their invalidation. Fix that.

Reviewers: chandlerc, dmgreen, bogner

Reviewed By: dmgreen

Subscribers: hiraditya, bollu, javed.absar, llvm-commits

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

llvm-svn: 352986

5 years ago[X86] Print %st(0) as %st to match what gcc inline asm uses as the clobber name to...
Craig Topper [Sun, 3 Feb 2019 07:53:39 +0000 (07:53 +0000)]
[X86] Print %st(0) as %st to match what gcc inline asm uses as the clobber name to make MS inline asm work correctly

Summary:
When calculating clobbers for MS style inline assembly we fail if the asm clobbers stack top because we print st(0) and try to pass it through the gcc register name check. This was found with when I attempted to make a emms/femms clobber all ST registers. If you use emms/femms in MS inline asm we would try to use st(0) as the clobber name but clang would think that wasn't a valid clobber name.

This also matches what objdump disassembly prints. It's also what is printed by gcc -S.

Reviewers: RKSimon, rnk, efriedma, spatel, andreadb, lebedev.ri

Reviewed By: rnk

Subscribers: eraman, gbedwell, lebedev.ri, llvm-commits

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

llvm-svn: 352985

5 years ago[X86] Lower ISD::UADDO to use the Z flag instead of C flag when the RHS is a constant...
Craig Topper [Sun, 3 Feb 2019 07:25:06 +0000 (07:25 +0000)]
[X86] Lower ISD::UADDO to use the Z flag instead of C flag when the RHS is a constant 1 to encourage INC formation.

Summary:
Add an additional combine to combineCarryThroughADD to reverse it back to the C flag to avoid regressions.

I believe this catches the cases that D57547 got.

Reviewers: RKSimon, spatel

Reviewed By: spatel

Subscribers: javed.absar, llvm-commits

Tags: #llvm

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

llvm-svn: 352984

5 years agoCorrect test my *really really* overaligning a type.
Eric Fiselier [Sun, 3 Feb 2019 04:10:38 +0000 (04:10 +0000)]
Correct test my *really really* overaligning a type.

llvm-svn: 352983

5 years ago[AMDGPU] Fix -Wunused-variable after rL352978
Fangrui Song [Sun, 3 Feb 2019 03:51:52 +0000 (03:51 +0000)]
[AMDGPU] Fix -Wunused-variable after rL352978

llvm-svn: 352982

5 years ago[InstSimplify] Missed optimization in math expression: log10(pow(10.0,x)) == x, log2...
Dmitry Venikov [Sun, 3 Feb 2019 03:48:30 +0000 (03:48 +0000)]
[InstSimplify] Missed optimization in math expression: log10(pow(10.0,x)) == x, log2(pow(2.0,x)) == x

Summary: This patch enables folding following instructions under -ffast-math flag: log10(pow(10.0,x)) -> x, log2(pow(2.0,x)) -> x

Reviewers: hfinkel, spatel, efriedma, craig.topper, zvi, majnemer, lebedev.ri

Reviewed By: spatel, lebedev.ri

Subscribers: lebedev.ri, llvm-commits

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

llvm-svn: 352981

5 years agoFix handling of usual deallocation functions in various configuratios.
Eric Fiselier [Sun, 3 Feb 2019 03:44:31 +0000 (03:44 +0000)]
Fix handling of usual deallocation functions in various configuratios.

Clang allows users to enable or disable various types of allocation
and deallocation regardless of the C++ dialect. When extended new/delete
overloads are enabled in older dialects, we need to treat them as if
they're usual.

Also, disabling one usual deallocation form shouldn't
disable any others. For example, disabling aligned allocation in C++2a
should have no effect on destroying delete.

llvm-svn: 352980

5 years agoGlobalISel: Implement widenScalar for G_UNMERGE_VALUES
Matt Arsenault [Sun, 3 Feb 2019 00:07:33 +0000 (00:07 +0000)]
GlobalISel: Implement widenScalar for G_UNMERGE_VALUES

For the scalar case only.

Also move the similar G_MERGE_VALUES handling to a separate function
and cleanup to make them look more similar.

llvm-svn: 352979

5 years agoGlobalISel: Implement widenScalar for G_EXTRACT vector sources
Matt Arsenault [Sat, 2 Feb 2019 23:56:00 +0000 (23:56 +0000)]
GlobalISel: Implement widenScalar for G_EXTRACT vector sources

Handle the basic element extract case.

llvm-svn: 352978

5 years agoAMDGPU/GlobalISel: Avoid reporting illegal extloads as legal
Matt Arsenault [Sat, 2 Feb 2019 23:39:13 +0000 (23:39 +0000)]
AMDGPU/GlobalISel: Avoid reporting illegal extloads as legal

This avoids breaking a test in a future commit.

llvm-svn: 352977

5 years agoAMDGPU/GlobalISel: Legalize icmp for pointer types
Matt Arsenault [Sat, 2 Feb 2019 23:35:15 +0000 (23:35 +0000)]
AMDGPU/GlobalISel: Legalize icmp for pointer types

llvm-svn: 352976

5 years agoAMDGPU/GlobalISel: Legalize constant for pointer types
Matt Arsenault [Sat, 2 Feb 2019 23:33:49 +0000 (23:33 +0000)]
AMDGPU/GlobalISel: Legalize constant for pointer types

llvm-svn: 352975

5 years agoAMDGPU/GlobalISel: Legalize select for pointer types
Matt Arsenault [Sat, 2 Feb 2019 23:31:50 +0000 (23:31 +0000)]
AMDGPU/GlobalISel: Legalize select for pointer types

llvm-svn: 352974

5 years agoGlobalISel: Legalization for inttoptr/ptrtoint
Matt Arsenault [Sat, 2 Feb 2019 23:29:55 +0000 (23:29 +0000)]
GlobalISel: Legalization for inttoptr/ptrtoint

llvm-svn: 352973

5 years ago[NewPM] Add support for new-PM plugins to clang
Philip Pfaffe [Sat, 2 Feb 2019 23:19:32 +0000 (23:19 +0000)]
[NewPM] Add support for new-PM plugins to clang

Summary:
This adds support for new-PM plugin loading to clang. The option
`-fpass-plugin=` may be used to specify a dynamic shared object file
that adheres to the PassPlugin API.

Tested: created simple plugin that registers an EP callback; with optimization level > 0, the pass is run as expected.

Committed on behalf of Marco Elver

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

llvm-svn: 352972

5 years agoReplace uses of %T with %t in from previous frontend test differential
Nico Weber [Sat, 2 Feb 2019 23:16:30 +0000 (23:16 +0000)]
Replace uses of %T with %t in from previous frontend test differential

After committing a change I had made to a few frontend tests, it was pointed
out to me that %T is being deprecated in LLVM in favor of %t. This change
simply converts usages of %T to %t while maintaining the integrity of the test.

Previous revision where this discussion took place:
https://reviews.llvm.org/D50563

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

Patch from Justice Adams <justice.adams@sony.com>!

llvm-svn: 352971

5 years agoMove the feature test macros script to the utils directory.
Eric Fiselier [Sat, 2 Feb 2019 23:13:49 +0000 (23:13 +0000)]
Move the feature test macros script to the utils directory.

It doesn't make a lot of sense to keep it with the tests,
deep into the test suite directonies.

llvm-svn: 352970

5 years agoRevert rCTE352968 due to compilation failures 💥
Stephane Moore [Sat, 2 Feb 2019 23:01:20 +0000 (23:01 +0000)]
Revert rCTE352968 due to compilation failures ðŸ’¥

llvm-svn: 352969

5 years ago[clang-tidy] Make google-objc-function-naming ignore implicit functions 🙈
Stephane Moore [Sat, 2 Feb 2019 22:07:00 +0000 (22:07 +0000)]
[clang-tidy] Make google-objc-function-naming ignore implicit functions ðŸ™ˆ

Summary:
Implicit functions are outside the control of source authors and should
be exempt from style restrictions.

Tested via running clang tools tests.

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: xazax.hun, cfe-commits

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

llvm-svn: 352968

5 years ago[X86] Add another test case for PR40539. NFC
Craig Topper [Sat, 2 Feb 2019 22:01:41 +0000 (22:01 +0000)]
[X86] Add another test case for PR40539. NFC

llvm-svn: 352967

5 years ago[libunwind] Provide placement new definition
Petr Hosek [Sat, 2 Feb 2019 21:15:49 +0000 (21:15 +0000)]
[libunwind] Provide placement new definition

While Clang automatically generates the code for placement new,
g++ doesn't do that so we need to provide our own definition.

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

llvm-svn: 352966

5 years ago[libunwind] Remove the remote unwinding support
Petr Hosek [Sat, 2 Feb 2019 20:54:03 +0000 (20:54 +0000)]
[libunwind] Remove the remote unwinding support

This is unfinished, unused and incomplete. This could be brought back in
the future if there's a desire to build a more complete implementation,
but at the moment it's just bitrotting.

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

llvm-svn: 352965

5 years ago[clang-tidy] Rename time lookup functions; NFC
Hyrum Wright [Sat, 2 Feb 2019 19:57:37 +0000 (19:57 +0000)]
[clang-tidy] Rename time lookup functions; NFC

llvm-svn: 352964

5 years ago[X86][AVX] Enable INSERT_SUBVECTOR(SRC0, SHUFFLE(SRC1)) shuffle combining
Simon Pilgrim [Sat, 2 Feb 2019 18:08:04 +0000 (18:08 +0000)]
[X86][AVX] Enable INSERT_SUBVECTOR(SRC0, SHUFFLE(SRC1)) shuffle combining

Push the insert_subvector up through the shuffle operands to help find more cross-lane shuffles.

The is exposes a couple of minor issues that will be fixed shortly:
Missed broadcast folds - we have a mixture of vzext_load lengths that need cleaning up
combine-sdiv.ll - AVX1 SimplifyDemandedVectorElts failure (hits max depth due to a couple of extra bitcasts).

llvm-svn: 352963

5 years ago[SDAG] Add SDNode/SDValue getConstantOperandAPInt helper. NFCI.
Simon Pilgrim [Sat, 2 Feb 2019 17:35:06 +0000 (17:35 +0000)]
[SDAG] Add SDNode/SDValue getConstantOperandAPInt helper. NFCI.

We already have the getConstantOperandVal helper which returns a uint64_t, but along comes the fuzzer and inserts a i128 -1 constant or something and the whole thing asserts.......

I've updated a few obvious cases, and tried to make use of the const reference where possible, but there's more to do. A number of existing oss-fuzz tickets should be fixed if we start using APInt and perform value clamping where necessary.

llvm-svn: 352961

5 years ago[LCSSA] Handle case with single new PHI faster.
Florian Hahn [Sat, 2 Feb 2019 15:26:05 +0000 (15:26 +0000)]
[LCSSA] Handle case with single new PHI faster.

If there is only a single available value, all uses must be dominated by
the single value and there is no need to search for a reaching
definition.

This drastically speeds up LCSSA in some cases. For the test case
from PR37202, it speeds up LCSSA construction by 4 times.

Time-passes without this patch for test case from PR37202:

    Total Execution Time: 29.9285 seconds (29.9276 wall clock)

    ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---
    5.2786 ( 17.7%)   0.0021 (  1.2%)   5.2806 ( 17.6%)   5.2808 ( 17.6%)  Unswitch loops
    4.3739 ( 14.7%)   0.0303 ( 18.1%)   4.4042 ( 14.7%)   4.4042 ( 14.7%)  Loop-Closed SSA Form Pass
    4.2658 ( 14.3%)   0.0192 ( 11.5%)   4.2850 ( 14.3%)   4.2851 ( 14.3%)  Loop-Closed SSA Form Pass #2
    2.2307 (  7.5%)   0.0013 (  0.8%)   2.2320 (  7.5%)   2.2318 (  7.5%)  Loop Invariant Code Motion
    2.0888 (  7.0%)   0.0012 (  0.7%)   2.0900 (  7.0%)   2.0897 (  7.0%)  Unroll loops
    1.6761 (  5.6%)   0.0013 (  0.8%)   1.6774 (  5.6%)   1.6774 (  5.6%)  Value Propagation
    1.3686 (  4.6%)   0.0029 (  1.8%)   1.3716 (  4.6%)   1.3714 (  4.6%)  Induction Variable Simplification
    1.1457 (  3.8%)   0.0010 (  0.6%)   1.1468 (  3.8%)   1.1468 (  3.8%)  Loop-Closed SSA Form Pass #4
    1.1384 (  3.8%)   0.0005 (  0.3%)   1.1389 (  3.8%)   1.1389 (  3.8%)  Loop-Closed SSA Form Pass #6
    1.1360 (  3.8%)   0.0027 (  1.6%)   1.1387 (  3.8%)   1.1387 (  3.8%)  Loop-Closed SSA Form Pass #5
    1.1331 (  3.8%)   0.0010 (  0.6%)   1.1341 (  3.8%)   1.1340 (  3.8%)  Loop-Closed SSA Form Pass #3

Time passes with this patch

  Total Execution Time: 19.2802 seconds (19.2813 wall clock)

   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---
   4.4234 ( 23.2%)   0.0038 (  2.0%)   4.4272 ( 23.0%)   4.4273 ( 23.0%)  Unswitch loops
   2.3828 ( 12.5%)   0.0020 (  1.1%)   2.3848 ( 12.4%)   2.3847 ( 12.4%)  Unroll loops
   1.8714 (  9.8%)   0.0020 (  1.1%)   1.8734 (  9.7%)   1.8735 (  9.7%)  Loop Invariant Code Motion
   1.7973 (  9.4%)   0.0022 (  1.2%)   1.7995 (  9.3%)   1.8003 (  9.3%)  Value Propagation
   1.4010 (  7.3%)   0.0033 (  1.8%)   1.4043 (  7.3%)   1.4044 (  7.3%)  Induction Variable Simplification
   0.9978 (  5.2%)   0.0244 ( 13.1%)   1.0222 (  5.3%)   1.0224 (  5.3%)  Loop-Closed SSA Form Pass #2
   0.9611 (  5.0%)   0.0257 ( 13.8%)   0.9868 (  5.1%)   0.9868 (  5.1%)  Loop-Closed SSA Form Pass
   0.5856 (  3.1%)   0.0015 (  0.8%)   0.5871 (  3.0%)   0.5869 (  3.0%)  Unroll loops #2
   0.4132 (  2.2%)   0.0012 (  0.7%)   0.4145 (  2.1%)   0.4143 (  2.1%)  Loop Invariant Code Motion #3

Reviewers: efriedma, davide, mzolotukhin

Reviewed By: efriedma

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

llvm-svn: 352960

5 years ago[analyzer][UninitializedObjectChecker] New flag to ignore guarded uninitialized fields
Kristof Umann [Sat, 2 Feb 2019 14:50:04 +0000 (14:50 +0000)]
[analyzer][UninitializedObjectChecker] New flag to ignore guarded uninitialized fields

This patch is an implementation of the ideas discussed on the mailing list[1].

The idea is to somewhat heuristically guess whether the field that was confirmed
to be uninitialized is actually guarded with ifs, asserts, switch/cases and so
on. Since this is a syntactic check, it is very much prone to drastically
reduce the amount of reports the checker emits. The reports however that do not
get filtered out though have greater likelihood of them manifesting into actual
runtime errors.

[1] http://lists.llvm.org/pipermail/cfe-dev/2018-September/059255.html

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

llvm-svn: 352959

5 years ago[LCSSA] Add expensive verification of LCSSA form for sub-loops.
Florian Hahn [Sat, 2 Feb 2019 14:42:27 +0000 (14:42 +0000)]
[LCSSA] Add expensive verification of LCSSA form for sub-loops.

This assertion makes sure all sub-loops are in LCSSA form before
bringing their parent in LCSSA form. This precondition was added to
formLCSSA in D56848.

Reviewers: davide, efriedma, mzolotukhin

Reviewed By: davide

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

llvm-svn: 352958

5 years ago[clangd] Fix heap-use-after-free after r352868
Eric Liu [Sat, 2 Feb 2019 10:35:39 +0000 (10:35 +0000)]
[clangd] Fix heap-use-after-free after r352868

llvm-svn: 352957

5 years ago[ASTImporter] Fix up test that only works on X86.
David Green [Sat, 2 Feb 2019 08:31:22 +0000 (08:31 +0000)]
[ASTImporter] Fix up test that only works on X86.

The test will fail if the default target triple is not X86,
even if the host platform is. So move the check into the
test at runtime.

llvm-svn: 352956

5 years ago[X86][SSE]: Adding full coverage of MC encoding tests for the SSE isa sets.<NFC>
Craig Topper [Sat, 2 Feb 2019 06:21:54 +0000 (06:21 +0000)]
[X86][SSE]: Adding full coverage of MC encoding tests for the SSE isa sets.<NFC>

Summary:
NFC.
Adding MC regressions tests to cover all the SSE ISA sets as follows:
SSE, SSE2, SSE3, SSE4, SSE42, SSEMXCSR, SSE_PREFETCH, SSSE3

This patch is part of a larger task to cover MC encoding of all X86 ISA Sets.
See revision: https://reviews.llvm.org/D39952

Patch by Gadi Haber and Wang Tianqing

Reviewers: RKSimon, zvi, craig.topper, AndreiGrischenko, gadi.haber, LuoYuanke

Reviewed By: craig.topper

Subscribers: jfb, llvm-commits

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

llvm-svn: 352955

5 years agoRevert "Bump minimum toolchain version"
JF Bastien [Sat, 2 Feb 2019 06:01:12 +0000 (06:01 +0000)]
Revert "Bump minimum toolchain version"

Reverting D57264 again, it looks like we're down to two bots that need fixing:

polly-amd64-linux
polly-arm-linux

They both have old versions of libstdc++ and recent clang.

llvm-svn: 352954

5 years ago[Clangd] textDocument/definition and textDocument/declaration "bounce" between defini...
Sam McCall [Sat, 2 Feb 2019 05:56:00 +0000 (05:56 +0000)]
[Clangd] textDocument/definition and textDocument/declaration "bounce" between definition and declaration location when they are distinct.

Summary:
This helps minimize the disruption of not returning declarations as part of
a find-definition response (r352864).

Reviewers: hokein

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, ilya-biryukov

Tags: #clang

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

llvm-svn: 352953

5 years ago[BPF] [BTF] Process FileName with absolute path correctly
Yonghong Song [Sat, 2 Feb 2019 05:54:59 +0000 (05:54 +0000)]
[BPF] [BTF] Process FileName with absolute path correctly

In IR, sometimes the following attributes for DIFile may be
generated:
  filename: /home/yhs/test.c
  directory: /tmp
The /tmp may represent the working directory of the compilation
process.

In such cases, since filename is with absolute path,
the directory should be ignored by BTF. The filename alone is
enough to get the source.

Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 352952

5 years agoBump minimum toolchain version
JF Bastien [Sat, 2 Feb 2019 05:15:34 +0000 (05:15 +0000)]
Bump minimum toolchain version

Summary:
The RFC on moving past C++11 got good traction:
  http://lists.llvm.org/pipermail/llvm-dev/2019-January/129452.html

This patch therefore bumps the toolchain versions according to our policy:
  llvm.org/docs/DeveloperPolicy.html#toolchain

Subscribers: mgorny, jkorous, dexonsmith, llvm-commits, mehdi_amini, jyknight, rsmith, chandlerc, smeenai, hans, reames, lattner, lhames, erichkeane

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

llvm-svn: 352951

5 years ago[llvm-objcopy] Temporarily limit one test to darwin
Alexander Shaposhnikov [Sat, 2 Feb 2019 05:01:00 +0000 (05:01 +0000)]
[llvm-objcopy] Temporarily limit one test to darwin

Some triples in llvm-mc appear to be unavailable on some buildbots.
To please those buildbots we temporarily limit the test to darwin
(where the required triple is guranteed to be available)
until we find the right solution.

llvm-svn: 352950

5 years ago[Sema][ObjC] Allow declaring ObjC pointer members with non-trivial
Akira Hatanaka [Sat, 2 Feb 2019 02:23:40 +0000 (02:23 +0000)]
[Sema][ObjC] Allow declaring ObjC pointer members with non-trivial
ownership qualifications in C++ unions under ARC.

An ObjC pointer member with non-trivial ownership qualifications causes
all of the defaulted special functions of the enclosing union to be
defined as deleted, except when the member has an in-class initializer,
the default constructor isn't defined as deleted.

rdar://problem/34213306

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

llvm-svn: 352949

5 years ago[ASan] Do not instrument other runtime functions with `__asan_handle_no_return`
Julian Lettner [Sat, 2 Feb 2019 02:05:16 +0000 (02:05 +0000)]
[ASan] Do not instrument other runtime functions with `__asan_handle_no_return`

Summary:
Currently, ASan inserts a call to `__asan_handle_no_return` before every
`noreturn` function call/invoke. This is unnecessary for calls to other
runtime funtions. This patch changes ASan to skip instrumentation for
functions calls marked with `!nosanitize` metadata.

Reviewers: TODO

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

llvm-svn: 352948

5 years ago[llvm-objcopy] Fix triples in macho tests.
Alexander Shaposhnikov [Sat, 2 Feb 2019 02:04:09 +0000 (02:04 +0000)]
[llvm-objcopy] Fix triples in macho tests.

Update triples used by the macho tests to fix some buildbots.

llvm-svn: 352947

5 years agoRemove redundant FunctionDecl argument from a couple functions.
James Y Knight [Sat, 2 Feb 2019 01:48:23 +0000 (01:48 +0000)]
Remove redundant FunctionDecl argument from a couple functions.

This argument was added in r254554 in order to support the
pass_object_size attribute. However, in r296076, the attribute's
presence is now also represented in FunctionProtoType's
ExtParameterInfo, and thus it's unnecessary to pass along a separate
FunctionDecl.

The functions modified are:
 RequiredArgs::forPrototype{,Plus}, and
 CodeGenTypes::ConvertFunctionType.

After this, it's also (again) unnecessary to have a separate
ConvertFunctionType function ConvertType, so convert callers back to
the latter, leaving the former as an internal helper function.

llvm-svn: 352946

5 years ago[AutoUpgrade] Fix AutoUpgrade for x86.seh.recoverfp
Mandeep Singh Grang [Sat, 2 Feb 2019 01:32:48 +0000 (01:32 +0000)]
[AutoUpgrade] Fix AutoUpgrade for x86.seh.recoverfp

Summary: This fixes the bug in https://reviews.llvm.org/D56747#inline-502711.

Reviewers: efriedma

Reviewed By: efriedma

Subscribers: javed.absar, llvm-commits

Tags: #llvm

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

llvm-svn: 352945

5 years ago[llvm-objcopy] Add ability to copy MachO object files
Alexander Shaposhnikov [Sat, 2 Feb 2019 00:38:07 +0000 (00:38 +0000)]
[llvm-objcopy] Add ability to copy MachO object files

This diff implements first bits for copying (without modification) MachO object files.

Test plan: make check-all

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

llvm-svn: 352944

5 years ago[ELF] Default to --no-allow-shlib-undefined for executables
Fangrui Song [Sat, 2 Feb 2019 00:34:28 +0000 (00:34 +0000)]
[ELF] Default to --no-allow-shlib-undefined for executables

Summary:
This follows the ld.bfd/gold behavior.

The error check is useful as it captures a common type of ld.so undefined symbol errors as link-time errors:

    // a.cc => a.so (not linked with -z defs)
    void f(); // f is undefined
    void g() { f(); }

    // b.cc => executable with a DT_NEEDED entry on a.so
    void g();
    int main() { g(); }

    // ld.so errors when g() is executed (lazy binding) or when the program is started (-z now)
    // symbol lookup error: ... undefined symbol: f

Reviewers: ruiu, grimar, pcc, espindola

Reviewed By: ruiu

Subscribers: llvm-commits, emaste, arichardson

Tags: #llvm

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

llvm-svn: 352943

5 years agoHandle cases where the dirent::d_type macros aren't defined
Eric Fiselier [Fri, 1 Feb 2019 23:52:17 +0000 (23:52 +0000)]
Handle cases where the dirent::d_type macros aren't defined

llvm-svn: 352942

5 years agoRevert "[BPF] [BTF] Process FileName with absolute path correctly"
Yonghong Song [Fri, 1 Feb 2019 23:49:52 +0000 (23:49 +0000)]
Revert "[BPF] [BTF] Process FileName with absolute path correctly"

This reverts commit r352939.

Some tests failed. Revert to unblock others.

llvm-svn: 352941

5 years ago[AArch64] Fix unused variable [NFC]
Mandeep Singh Grang [Fri, 1 Feb 2019 23:42:34 +0000 (23:42 +0000)]
[AArch64] Fix unused variable [NFC]

llvm-svn: 352940

5 years ago[BPF] [BTF] Process FileName with absolute path correctly
Yonghong Song [Fri, 1 Feb 2019 23:23:17 +0000 (23:23 +0000)]
[BPF] [BTF] Process FileName with absolute path correctly

In IR, sometimes the following attributes for DIFile may be
generated:
  filename: /home/yhs/test.c
  directory: /tmp
The /tmp may represent the working directory of the compilation
process.

In such cases, since filename is with absolute path,
the directory should be ignored by BTF. The filename alone is
enough to get the source.

Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 352939

5 years ago[analyzer] Hotfix for RetainCountChecker: assert was too strong.
George Karpenkov [Fri, 1 Feb 2019 23:06:44 +0000 (23:06 +0000)]
[analyzer] Hotfix for RetainCountChecker: assert was too strong.

Bridged casts can happen to non-CF objects as well.

llvm-svn: 352938

5 years ago[CodeGen] Be as conservative about atomic accesses as for volatile
Philip Reames [Fri, 1 Feb 2019 22:58:52 +0000 (22:58 +0000)]
[CodeGen] Be as conservative about atomic accesses as for volatile

Background: At the moment, we record the AtomicOrdering of an access in the MMO, but also mark any atomic access as volatile in SelectionDAG. I'm working towards separating that. See https://reviews.llvm.org/D57601 for context.

Update all usages of isVolatile in lib/CodeGen to preserve behaviour once atomic MMOs stop being also volatile. This is NFC in it's current form, but is essential for correctness once we make that final change.

It useful to keep in mind that AtomicSDNode is not a parent of LoadSDNode, StoreSDNode, or LSBaseSDNode. As a result, any call to isVolatile on one of those static types doesn't need a companion isAtomic check.  We should probably adjust that class hierarchy long term, but for now, that seperation is useful.

I'm deliberately being conservative about handling. I want the change to stop adding volatile to be NFC itself, and then will work through places where we can be less conservative for atomics one by one in separate changes w/tests.

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

llvm-svn: 352937

5 years ago[WebAssembly] Fix ImportName's position in this test.
Dan Gohman [Fri, 1 Feb 2019 22:52:29 +0000 (22:52 +0000)]
[WebAssembly] Fix ImportName's position in this test.

This is a follow-up to r352930.

llvm-svn: 352936

5 years ago[InstCombine] Refactor test checks (NFC)
Evandro Menezes [Fri, 1 Feb 2019 22:52:05 +0000 (22:52 +0000)]
[InstCombine] Refactor test checks (NFC)

llvm-svn: 352935

5 years agoRevert "[AST][OpenMP] OpenMP Sections / Section constructs contain Structured blocks"
Roman Lebedev [Fri, 1 Feb 2019 22:43:08 +0000 (22:43 +0000)]
Revert "[AST][OpenMP] OpenMP Sections / Section constructs contain Structured blocks"

Further reviews (D57594, D57615) have revealed that this was not reviewed,
and that the differential's description was not read during the review,
thus rendering this commit invalid.

This reverts commit r352882.

llvm-svn: 352933

5 years ago[Test] Update file w/update_test_checks.py to make a follow on change obvious
Philip Reames [Fri, 1 Feb 2019 22:30:51 +0000 (22:30 +0000)]
[Test] Update file w/update_test_checks.py to make a follow on change obvious

llvm-svn: 352932

5 years ago[WebAssembly] Add codegen support for the import_field attribute
Dan Gohman [Fri, 1 Feb 2019 22:27:34 +0000 (22:27 +0000)]
[WebAssembly] Add codegen support for the import_field attribute

This adds the LLVM side of https://reviews.llvm.org/D57602 -- the
import_field attribute. See that patch for details.

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

llvm-svn: 352931

5 years ago[WebAssembly] Add an import_field function attribute
Dan Gohman [Fri, 1 Feb 2019 22:25:23 +0000 (22:25 +0000)]
[WebAssembly] Add an import_field function attribute

This is similar to import_module, but sets the import field name
instead.

By default, the import field name is the same as the C/asm/.o symbol
name. However, there are situations where it's useful to have it be
different. For example, suppose I have a wasm API with a module named
"pwsix" and a field named "read". There's no risk of namespace
collisions with user code at the wasm level because the generic name
"read" is qualified by the module name "pwsix". However in the C/asm/.o
namespaces, the module name is not used, so if I have a global function
named "read", it is intruding on the user's namespace.

With the import_field module, I can declare my function (in libc) to be
"__read", and then set the wasm import module to be "pwsix" and the wasm
import field to be "read". So at the C/asm/.o levels, my symbol is
outside the user namespace.

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

llvm-svn: 352930

5 years ago[COFF] Create range extension thunks for ARM64
Martin Storsjo [Fri, 1 Feb 2019 22:08:09 +0000 (22:08 +0000)]
[COFF] Create range extension thunks for ARM64

On ARM64, this is normally necessary only after a module exceeds
128 MB in size (while the limit for thumb is 16 MB). For conditional
branches, the range limit is only 1 MB though (the same as for thumb),
and for the tbz instruction, the range is only 32 KB, which allows for
a test much smaller than the full 128 MB.

This fixes PR40467.

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

llvm-svn: 352929