OSDN Git Service

android-x86/external-llvm.git
5 years ago[DAGCombine][NFC] GatherAllAliases should take a LSBaseSDNode.
Clement Courbet [Wed, 6 Feb 2019 12:36:17 +0000 (12:36 +0000)]
[DAGCombine][NFC] GatherAllAliases should take a LSBaseSDNode.

GatherAllAliases only makes sense for LSBaseSDNode. Enforce it with
static typing instead of runtime cast.

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

5 years ago[NFC] Simplify check in guard widening
Max Kazantsev [Wed, 6 Feb 2019 11:27:00 +0000 (11:27 +0000)]
[NFC] Simplify check in guard widening

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

5 years ago[llvm-objcopy] Allow regular expressions in name comparison
Eugene Leviant [Wed, 6 Feb 2019 11:00:07 +0000 (11:00 +0000)]
[llvm-objcopy] Allow regular expressions in name comparison

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

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

5 years ago[DebugInfo]Print correct value for special opcode address increment
James Henderson [Wed, 6 Feb 2019 10:31:50 +0000 (10:31 +0000)]
[DebugInfo]Print correct value for special opcode address increment

The wrong variable was being used when printing the address increment in
verbose output of .debug_line. This patch fixes this.

Reviewed by: JDevlieghere

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

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

5 years ago[DebugInfo][llvm-symbolizer]Add some tests for edge cases when symbolizing
James Henderson [Wed, 6 Feb 2019 10:13:14 +0000 (10:13 +0000)]
[DebugInfo][llvm-symbolizer]Add some tests for edge cases when symbolizing

This patch adds half a dozen new tests that test various edge cases in
the behaviour of the symbolizer and DWARF data parsing. All of them test
the current behaviour.

Reviewed by: JDevlieghere, aprantl

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

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

5 years ago[yaml::BinaryRef] Slight perf tuning (for llvm-exegesis analysis mode)
Roman Lebedev [Wed, 6 Feb 2019 08:57:01 +0000 (08:57 +0000)]
[yaml::BinaryRef] Slight perf tuning (for llvm-exegesis analysis mode)

Summary:
llvm-exegesis uses this functionality to read it's benchmark dumps.
This reading of `.yaml`s takes ~60% of runtime for 14656 benchmark points (i.e. one sweep over all x86 instructions),
but only 30% of time for 3x as much benchmark points.

In particular, this `BinaryRef` appears to be an obvious pain point.
Without patch:
```
$ perf stat -r 25 ./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-orig.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-orig.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-orig.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-orig.html' (25 runs):

            972.86 msec task-clock                #    0.994 CPUs utilized            ( +-  0.25% )
                30      context-switches          #   30.774 M/sec                    ( +- 21.74% )
                 0      cpu-migrations            #    0.370 M/sec                    ( +- 67.81% )
             11873      page-faults               # 12211.512 M/sec                   ( +-  0.00% )
        3898373408      cycles                    # 4009682.186 GHz                   ( +-  0.25% )  (83.12%)
         360399748      stalled-cycles-frontend   #    9.24% frontend cycles idle     ( +-  0.54% )  (83.24%)
        1099450483      stalled-cycles-backend    #   28.20% backend cycles idle      ( +-  0.59% )  (33.63%)
        4910528820      instructions              #    1.26  insn per cycle
                                                  #    0.22  stalled cycles per insn  ( +-  0.13% )  (50.21%)
        1111976775      branches                  # 1143726625.854 M/sec              ( +-  0.10% )  (66.77%)
          23248474      branch-misses             #    2.09% of all branches          ( +-  0.19% )  (83.29%)

           0.97850 +- 0.00647 seconds time elapsed  ( +-  0.66% )
```
With the patch:
```
$ perf stat -r 25 ./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-new.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-new.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-new.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-new.html' (25 runs):

            905.29 msec task-clock                #    0.999 CPUs utilized            ( +-  0.11% )
                15      context-switches          #   16.533 M/sec                    ( +- 32.27% )
                 0      cpu-migrations            #    0.000 K/sec
             11873      page-faults               # 13121.789 M/sec                   ( +-  0.00% )
        3627759720      cycles                    # 4009283.100 GHz                   ( +-  0.11% )  (83.19%)
         370401480      stalled-cycles-frontend   #   10.21% frontend cycles idle     ( +-  0.22% )  (83.19%)
        1007114438      stalled-cycles-backend    #   27.76% backend cycles idle      ( +-  0.34% )  (33.62%)
        4414014304      instructions              #    1.22  insn per cycle
                                                  #    0.23  stalled cycles per insn  ( +-  0.08% )  (50.36%)
        1003751700      branches                  # 1109314021.971 M/sec              ( +-  0.07% )  (66.97%)
          24611010      branch-misses             #    2.45% of all branches          ( +-  0.10% )  (83.41%)

           0.90593 +- 0.00105 seconds time elapsed  ( +-  0.12% )
```
So this decreases the overall run time of llvm-exegesis analysis mode (on one sweep) by roughly -7%.

To be noted, `BinaryRef::writeAsBinary()` change is the reason for the perf changes,
usage of `llvm::isHexDigit()` instead of `isxdigit()` does not appear to have any perf impact,
i have only changed it "for symmetry".

`writeAsBinary()` change is correct, it produces identical de-hex-ified buffer, and the final output is thus identical:
```
$ sha512sum /tmp/clusters-*
db4bbd904fe8840853b589b032c5041bc060b91bcd9c27b914b56581fbc473550eea74b852238c79963b5adf2419f379e9f5db76784048b48e3937f9f3e732bf  /tmp/clusters-new.html
db4bbd904fe8840853b589b032c5041bc060b91bcd9c27b914b56581fbc473550eea74b852238c79963b5adf2419f379e9f5db76784048b48e3937f9f3e732bf  /tmp/clusters-orig.html
```

Reviewers: silvas, espindola, sbc100, zturner, courbet, gchatelet

Reviewed By: gchatelet

Subscribers: tschuett, RKSimon, llvm-commits

Tags: #llvm

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

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

5 years agoFix misspelled filenames in file headers of llvm/{MC,Object,CodeGen}/*.h
Fangrui Song [Wed, 6 Feb 2019 08:02:46 +0000 (08:02 +0000)]
Fix misspelled filenames in file headers of llvm/{MC,Object,CodeGen}/*.h

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

5 years ago[NFC] Factor out detatchment of dead blocks from their erasing
Max Kazantsev [Wed, 6 Feb 2019 07:56:36 +0000 (07:56 +0000)]
[NFC] Factor out detatchment of dead blocks from their erasing

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

5 years ago[LoopSimplifyCFG] Do not count dead exit blocks twice, make CFG simpler
Max Kazantsev [Wed, 6 Feb 2019 07:49:17 +0000 (07:49 +0000)]
[LoopSimplifyCFG] Do not count dead exit blocks twice, make CFG simpler

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

5 years ago[NFC] Revert rL353274
Max Kazantsev [Wed, 6 Feb 2019 06:33:02 +0000 (06:33 +0000)]
[NFC] Revert rL353274

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

5 years ago[NFC] Extend API of DeleteDeadBlock(s) to collect updates without DTU
Max Kazantsev [Wed, 6 Feb 2019 06:00:02 +0000 (06:00 +0000)]
[NFC] Extend API of DeleteDeadBlock(s) to collect updates without DTU

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

5 years ago[NFC] Replace readonly SmallVectorImpl with ArrayRef
Max Kazantsev [Wed, 6 Feb 2019 05:40:31 +0000 (05:40 +0000)]
[NFC] Replace readonly SmallVectorImpl with ArrayRef

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

5 years ago[HotColdSplit] Move splitting after instrumented PGO use
Teresa Johnson [Wed, 6 Feb 2019 04:29:39 +0000 (04:29 +0000)]
[HotColdSplit] Move splitting after instrumented PGO use

Summary:
Follow up to D57082 which moved splitting earlier in the pipeline, in
order to perform it before inlining. However, it was moved too early,
before the IR is annotated with instrumented PGO data. This caused the
splitting to incorrectly determine cold functions.

Move it to just after PGO annotation (still before inlining), in both
pass managers.

Reviewers: vsk, hiraditya, sebpop

Subscribers: mehdi_amini, llvm-commits

Tags: #llvm

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

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

5 years ago[CMake] Unify scripts for generating VCS headers
Petr Hosek [Wed, 6 Feb 2019 03:51:00 +0000 (03:51 +0000)]
[CMake] Unify scripts for generating VCS headers

Previously, there were two different scripts for generating VCS headers:
one used by LLVM and one used by Clang and lldb. They were both similar,
but different. They were both broken in their own ways, for example the
one used by Clang didn't properly handle monorepo resulting in an
incorrect version information reported by Clang.

This change unifies two the scripts by introducing a new script that's
used from both LLVM, Clang and lldb, ensures that the new script
supports both monorepo and standalone SVN and Git setups, and removes
the old scripts.

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

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

5 years ago[AliasSetTracker] Minor style tweak to avoid a variable w/two distinct live ranges...
Philip Reames [Wed, 6 Feb 2019 03:46:40 +0000 (03:46 +0000)]
[AliasSetTracker] Minor style tweak to avoid a variable w/two distinct live ranges [NFC]

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

5 years ago[Test] Add codegen tests for unordered and monotonic integer operations
Philip Reames [Wed, 6 Feb 2019 03:19:04 +0000 (03:19 +0000)]
[Test] Add codegen tests for unordered and monotonic integer operations

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

5 years agoMove DomTreeUpdater from IR to Analysis
Richard Trieu [Wed, 6 Feb 2019 02:52:52 +0000 (02:52 +0000)]
Move DomTreeUpdater from IR to Analysis

DomTreeUpdater depends on headers from Analysis, but is in IR.  This is a
layering violation since Analysis depends on IR.  Relocate this code from IR
to Analysis to fix the layering violation.

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

5 years ago[x86] add tests for extract+sitofp; NFC
Sanjay Patel [Wed, 6 Feb 2019 00:19:56 +0000 (00:19 +0000)]
[x86] add tests for extract+sitofp; NFC

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

5 years ago[WebAssembly] Tidy up `let` statements in .td files (NFC)
Heejin Ahn [Wed, 6 Feb 2019 00:17:03 +0000 (00:17 +0000)]
[WebAssembly] Tidy up `let` statements in .td files (NFC)

Summary:
- Delete {} for one-line `let` statements
- Don't indent within `let` blocks
- Add comments after `let` block's closing braces

Reviewers: tlively

Subscribers: dschuff, sbc100, jgravelle-google, sunfish, jfb, llvm-commits

Tags: #llvm

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

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

5 years ago[BasicAA] Cache nonEscapingLocalObjects for alias() calls.
Alina Sbirlea [Tue, 5 Feb 2019 23:52:08 +0000 (23:52 +0000)]
[BasicAA] Cache nonEscapingLocalObjects for alias() calls.

Summary:
Use a small cache for Values tested by nonEscapingLocalObject().
Since the calls to PointerMayBeCaptured are fairly expensive, this saves
a good amount of compile time for anything relying heavily on
BasicAA.alias() calls.

This uses the same approach as the AliasCache, i.e. the cache is reset
after each alias() call. The cache is not used or updated by modRefInfo
calls since it's harder to know when to reset the cache.

Testcases that show improvements with this patch are too large to
include. Example compile time improvement: 7s to 6s.

Reviewers: chandlerc, sunfish

Subscribers: sanjoy, jlebar, llvm-commits

Tags: #llvm

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

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

5 years agogn build: Fix clang-tidy build
Nico Weber [Tue, 5 Feb 2019 23:48:13 +0000 (23:48 +0000)]
gn build: Fix clang-tidy build

Not depending on //clang/lib/StaticAnalyzer/Core and
//clang/lib/StaticAnalyzer/Frontend causes a linker error even if
ClangSACheckers are not supported.

Undefined symbols for architecture x86_64:
  "clang::ento::CreateAnalysisConsumer(clang::CompilerInstance&)", referenced from:
      clang::tidy::ClangTidyASTConsumerFactory::CreateASTConsumer(
              clang::CompilerInstance&, llvm::StringRef)
          in libclangTidy.a(libclangTidy.ClangTidy.o)

Patch from Mirko Bonadei <mbonadei@webrtc.org>!

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

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

5 years ago[HotColdSplit] Do not split out `resume` instructions
Vedant Kumar [Tue, 5 Feb 2019 23:39:02 +0000 (23:39 +0000)]
[HotColdSplit] Do not split out `resume` instructions

Resumes that are not reachable from a cleanup landing pad are considered
to be unreachable. It’s not safe to split them out.

rdar://47808235

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

5 years agoOrc: Simplify RPC naming system by using function-local statics
David Blaikie [Tue, 5 Feb 2019 23:38:55 +0000 (23:38 +0000)]
Orc: Simplify RPC naming system by using function-local statics

The existing scheme of class template static members for Name and
NameMutex is a bit verbose, involves global ctors (even if they're cheap
for string and mutex, still not entirely free), and (importantly/my
immediate motivation here) trips over a bug in LLVM's modules
implementation that's a bit involved (hmm, sounds like Mr. Smith has a
fix for the modules thing - but I'm still inclined to commit this patch
as general goodness).

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

5 years agoFixup test on Windows with a case-insensitive filesystem due to path printing changes...
Douglas Yung [Tue, 5 Feb 2019 23:27:38 +0000 (23:27 +0000)]
Fixup test on Windows with a case-insensitive filesystem due to path printing changes from r352704.

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

5 years ago[ADT] Add a fallible_iterator wrapper.
Lang Hames [Tue, 5 Feb 2019 23:17:11 +0000 (23:17 +0000)]
[ADT] Add a fallible_iterator wrapper.

A fallible iterator is one whose increment or decrement operations may fail.
This would usually be supported by replacing the ++ and -- operators with
methods that return error:

    class MyFallibleIterator {
    public:
      // ...
      Error inc();
      Errro dec();
      // ...
    };

The downside of this style is that it no longer conforms to the C++ iterator
concept, and can not make use of standard algorithms and features such as
range-based for loops.

The fallible_iterator wrapper takes an iterator written in the style above
and adapts it to (mostly) conform with the C++ iterator concept. It does this
by providing standard ++ and -- operator implementations, returning any errors
generated via a side channel (an Error reference passed into the wrapper at
construction time), and immediately jumping the iterator to a known 'end'
value upon error. It also marks the Error as checked any time an iterator is
compared with a known end value and found to be inequal, allowing early exit
from loops without redundant error checking*.

Usage looks like:

    MyFallibleIterator I = ..., E = ...;

    Error Err = Error::success();
    for (auto &Elem : make_fallible_range(I, E, Err)) {
      // Loop body is only entered when safe.

      // Early exits from loop body permitted without checking Err.
      if (SomeCondition)
        return;

    }
    if (Err)
      // Handle error.

* Since failure causes a fallible iterator to jump to end, testing that a
  fallible iterator is not an end value implicitly verifies that the error is a
  success value, and so is equivalent to an error check.

Reviewers: dblaikie, rupprecht

Subscribers: mgorny, dexonsmith, kristina, llvm-commits

Tags: #llvm

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

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

5 years ago[WebAssembly] Add a comment about why v128.const test was disabled (NFC)
Heejin Ahn [Tue, 5 Feb 2019 23:01:41 +0000 (23:01 +0000)]
[WebAssembly] Add a comment about why v128.const test was disabled (NFC)

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

5 years ago[InstCombine] limit extracting shuffle transform based on uses
Sanjay Patel [Tue, 5 Feb 2019 22:58:45 +0000 (22:58 +0000)]
[InstCombine] limit extracting shuffle transform based on uses

As discussed in D53037, this can lead to worse codegen, and we
don't generally expect the backend to be able to optimize
arbitrary shuffles. If there's only one use of the 1st shuffle,
that means it's getting removed, so that should always be
safe.

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

5 years ago[WebAssembly] Disable a v128.const test line temporarily
Heejin Ahn [Tue, 5 Feb 2019 22:47:29 +0000 (22:47 +0000)]
[WebAssembly] Disable a v128.const test line temporarily

r353131 caused failures in v128.const test for clang-ppc64be-linux-lnt
and clang-s390x-linux bots. This temporarily disables that line until
it is fixed.

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

5 years ago[InstCombine] split shuffle test to show extra use constraint; NFC
Sanjay Patel [Tue, 5 Feb 2019 22:46:13 +0000 (22:46 +0000)]
[InstCombine] split shuffle test to show extra use constraint; NFC

As discussed in D53037, this transform can cause codegen problems
if the 1st shuffle has multiple uses.

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

5 years ago[PGO] Use a function for creating variable for profile file name. NFC.
Rong Xu [Tue, 5 Feb 2019 22:34:45 +0000 (22:34 +0000)]
[PGO] Use a function for creating variable for profile file name. NFC.

Factored out the code for creating variable for profile file name to
a function.

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

5 years ago[elfabi] Fix the type of the variable formated for error output
Petar Jovanovic [Tue, 5 Feb 2019 22:23:46 +0000 (22:23 +0000)]
[elfabi] Fix the type of the variable formated for error output

Change the format type of Dyn.SONameOffset to PRIx64 since it is a uint64_t.
The problem was detected on mips builds, where it was printing junk values
and causing test failure.

Patch by Milos Stojanovic.

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

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

5 years ago[NFC][GlobalISel]: Add a convenience method to MachineInstrBuilder to simplify getOpe...
Aditya Nandakumar [Tue, 5 Feb 2019 22:14:40 +0000 (22:14 +0000)]
[NFC][GlobalISel]: Add a convenience method to MachineInstrBuilder to simplify getOperand(i).getReg()

https://reviews.llvm.org/D57608

It's a common pattern in GISel to have a MachineInstrBuilder from which we get various regs
(commonly MIB->getOperand(0).getReg()). This adds a helper method and the above can be
replaced with MIB.getReg(0).

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

5 years ago[X86] Regenerate tests missed in r353061. NFC
Craig Topper [Tue, 5 Feb 2019 21:47:42 +0000 (21:47 +0000)]
[X86] Regenerate tests missed in r353061. NFC

We now print the implicit %st register on these instruction, but since they occur at the end of the line, FileCheck didn't see they were missing.

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

5 years ago[MC] Don't error on numberless .file directives on MachO
Reid Kleckner [Tue, 5 Feb 2019 21:14:09 +0000 (21:14 +0000)]
[MC] Don't error on numberless .file directives on MachO

Summary:
Before r349976, MC ignored such directives when producing an object file
and asserted when re-producing textual assembly output. I turned this
assertion into a hard error in both cases in r349976, but this makes it
unnecessarily difficult to write a single assembly file that supports
both MachO and other object formats that support .file. A user reported
this as PR40578, and we decided to go back to ignoring the directive.

Fixes PR40578

Reviewers: mstorsjo

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[llvm-readobj] Display sections that do not belong to a segment in the section-mapping
Matt Davis [Tue, 5 Feb 2019 21:01:01 +0000 (21:01 +0000)]
[llvm-readobj] Display sections that do not belong to a segment in the section-mapping

Summary:
The following patch adds the "None" line to the section to segment mapping dump.
That line lists the sections that do not belong to any segment.
I realize that this change differs from GNU readelf which does not display the latter information.

I'd rather not add this "feature" under a command line option.  I think that might introduce confusion, since users would have to
make an additional decision as to if they want to see all of the section-to-segment map or just a subset of it.

Another option is to only print the "None" line if the `--section-mapping` option is passed; however,
that might also introduce some confusion, because the section-to-segment map would be different between`--program-headers`
and the `--section-mapping` output.  While the difference is just the "None" line, it seems that if we choose to display
the segment-to-section mapping, then we should always display the whole map including the sections
that do not belong to segments.

```
Section to Segment mapping:
  Segment Sections...
   00
   01     .interp
   02     .interp .note.ABI-tag .gnu.hash
   03     .init_array .fini_array .dynamic
   04     .dynamic
   05     .note.ABI-tag
   06     .eh_frame_hdr
   07
   08     .init_array .fini_array .dynamic .got
   None   .comment .symtab .strtab .shstrtab <--- THIS LINE
```

Reviewers: grimar, rupprecht, jhenderson, espindola

Reviewed By: rupprecht

Subscribers: khemant, emaste, arichardson, llvm-commits

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

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

5 years ago[WebAssembly] Lower memmove to memory.copy
Thomas Lively [Tue, 5 Feb 2019 20:57:40 +0000 (20:57 +0000)]
[WebAssembly] Lower memmove to memory.copy

Summary: The lowering is identical to the memcpy lowering.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

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

5 years ago[TargetLibraryInfo] Regroup run time functions for Windows (NFC)
Evandro Menezes [Tue, 5 Feb 2019 20:24:21 +0000 (20:24 +0000)]
[TargetLibraryInfo] Regroup run time functions for Windows (NFC)

Regroup supported and unsupported functions by precision and C standard.

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

5 years agoMove some llvm-mc tests where they belong
Matt Arsenault [Tue, 5 Feb 2019 20:12:48 +0000 (20:12 +0000)]
Move some llvm-mc tests where they belong

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

5 years agoGlobalISel: Verify G_GEP
Matt Arsenault [Tue, 5 Feb 2019 20:04:12 +0000 (20:04 +0000)]
GlobalISel: Verify G_GEP

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

5 years ago[AMDGPU] Consider XOR in waterfall loop as a terminator
Scott Linder [Tue, 5 Feb 2019 19:50:32 +0000 (19:50 +0000)]
[AMDGPU] Consider XOR in waterfall loop as a terminator

Ensure the XOR in the waterfall loop for indirect addressing is considered a terminator.

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

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

5 years ago[DEBUG_INFO][NVPTX] Generate DW_AT_address_class to get the values in debugger.
Alexey Bataev [Tue, 5 Feb 2019 19:33:47 +0000 (19:33 +0000)]
[DEBUG_INFO][NVPTX] Generate DW_AT_address_class to get the values in debugger.

Summary:
According to
https://docs.nvidia.com/cuda/archive/10.0/ptx-writers-guide-to-interoperability/index.html#cuda-specific-dwarf,
the compiler should emit the DW_AT_address_class attribute for all
variable and parameter. It means, that DW_AT_address_class attribute
should be used in the non-standard way to support compatibility with the
cuda-gdb debugger.
Clang is able to generate the information about the variable address
class. This information is emitted as the expression sequence
`DW_OP_constu <DWARF Address Space> DW_OP_swap DW_OP_xderef`. The patch
tries to find all such expressions and transform them into
`DW_AT_address_class <DWARF Address Space>` if target is NVPTX and the debugger is gdb.
If the expression is not found, then default values are used. For the
local variables <DWARF Address Space> is set to ADDR_local_space(6), for
the globals <DWARF Address Space> is set to ADDR_global_space(5). The
values are taken from the table in the same section 5.2. CUDA-Specific
DWARF Definitions.

Reviewers: echristo, probinson

Subscribers: jholewinski, aprantl, llvm-commits

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

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

5 years agoAMDGPU: Fix assert on trunc from bitcast of build_vector
Matt Arsenault [Tue, 5 Feb 2019 19:23:57 +0000 (19:23 +0000)]
AMDGPU: Fix assert on trunc from bitcast of build_vector

The v2i64 argument is lowered to a bitcast of v4i32 build_vector.
This would then attempt to use the i32-element as the source of the
vector truncate. This really would need to collect 2 elements from the
build_vector to produce the intended truncate.

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

5 years ago[X86][SSE] Disable ZERO_EXTEND shuffle combining
Simon Pilgrim [Tue, 5 Feb 2019 19:15:48 +0000 (19:15 +0000)]
[X86][SSE] Disable ZERO_EXTEND shuffle combining

rL352997 enabled ZERO_EXTEND from non-shuffle-able value types. I've disabled it for now to fix a regression identified by @asbirlea until I can fix this properly.

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

5 years ago[PGO] Fix the type of the formated variable
Petar Jovanovic [Tue, 5 Feb 2019 18:09:28 +0000 (18:09 +0000)]
[PGO] Fix the type of the formated variable

Change the format type of Value to PRIu64 since it is a uint64_t.
The problem was detected on mips boards building 32-bit binaries,
where it was printing junk values and causing test failure.

Patch by Milos Stojanovic.

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

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

5 years ago[LLVM-C] Add Bindings to GlobalIFunc
Robert Widmann [Tue, 5 Feb 2019 18:05:44 +0000 (18:05 +0000)]
[LLVM-C] Add Bindings to GlobalIFunc

Summary:
Adds the standard gauntlet of accessors for global indirect functions and updates the echo test.

Now it would be nice to have a target abstraction so one could know if they have access to a suitable ELF linker and runtime.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

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

5 years agoEnable integrated assembler on MSP430 by default.
Anton Korobeynikov [Tue, 5 Feb 2019 18:01:45 +0000 (18:01 +0000)]
Enable integrated assembler on MSP430 by default.

Patch by Kristina Bessonova!

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

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

5 years ago[AArch64][Outliner] Don't outline BTI instructions
Oliver Stannard [Tue, 5 Feb 2019 17:21:57 +0000 (17:21 +0000)]
[AArch64][Outliner] Don't outline BTI instructions

We can't outline BTI instructions, because they need to be the very first
instruction executed after an indirect call or branch. If we outline them, then
an indirect call might go to the branch to the outlined function, which will
fault.

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

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

5 years ago[X86][AVX] Attempt to combine shuffles to subvector broadcast load
Simon Pilgrim [Tue, 5 Feb 2019 17:02:49 +0000 (17:02 +0000)]
[X86][AVX] Attempt to combine shuffles to subvector broadcast load

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

5 years agoAArch64/GlobalISel: Don't clamp from 2 to 2
Matt Arsenault [Tue, 5 Feb 2019 16:57:18 +0000 (16:57 +0000)]
AArch64/GlobalISel: Don't clamp from 2 to 2

This is equivalent to clampMaxNumElements, but saves a check.

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

5 years ago[WebAssembly] Object: Remove redundant method. NFC.
Sam Clegg [Tue, 5 Feb 2019 16:30:21 +0000 (16:30 +0000)]
[WebAssembly] Object: Remove redundant method. NFC.

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

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

5 years ago[X86][AVX] Add PR34041 subvector broadcast test cases
Simon Pilgrim [Tue, 5 Feb 2019 16:18:30 +0000 (16:18 +0000)]
[X86][AVX] Add PR34041 subvector broadcast test cases

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

5 years ago[CGP] add test for unsigned subtract of 1 with overflow; NFC
Sanjay Patel [Tue, 5 Feb 2019 15:27:40 +0000 (15:27 +0000)]
[CGP] add test for unsigned subtract of 1 with overflow; NFC

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

5 years ago[AArch64][x86] add tests for unsigned subtract with overflow; NFC
Sanjay Patel [Tue, 5 Feb 2019 15:26:42 +0000 (15:26 +0000)]
[AArch64][x86] add tests for unsigned subtract with overflow; NFC

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

5 years agogn build: BUILD.gn files for clang-tidy and clang-apply-replacements
Nico Weber [Tue, 5 Feb 2019 15:14:38 +0000 (15:14 +0000)]
gn build: BUILD.gn files for clang-tidy and clang-apply-replacements

Patch from Mirko Bonadei <mbonadei@webrtc.org>!

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

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

5 years agoFix typo in comment, NFCI
Krasimir Georgiev [Tue, 5 Feb 2019 15:00:56 +0000 (15:00 +0000)]
Fix typo in comment, NFCI

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

5 years agogn build: Merge r353072
Nico Weber [Tue, 5 Feb 2019 14:47:36 +0000 (14:47 +0000)]
gn build: Merge r353072

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

5 years agoRecommit: Detect incorrect FileCheck variable CLI definition
Thomas Preud'homme [Tue, 5 Feb 2019 14:17:28 +0000 (14:17 +0000)]
Recommit: Detect incorrect FileCheck variable CLI definition

Summary:
While the backend code of FileCheck relies on definition of variable
from the command-line to have an equal sign '=' and a variable name
before that, the frontend does not actually enforce it. This leads to
FileCheck crashing when invoked with invalid syntax for the -D option.

This patch adds the missing validation in the frontend. It also makes
the -D option an AlwaysPrefix option to be able to detect -D=FOO as
being a define without variable and -D as missing its value.

Copyright:
- Linaro (changes in version 2 of revision D55940)
- GraphCore (changes in later versions)

Reviewers: jdenny

Subscribers: JonChesterfield, hiraditya, kristina, probinson,
llvm-commits

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

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

5 years agoRecommit: Add support for prefix-only CLI options
Thomas Preud'homme [Tue, 5 Feb 2019 14:17:16 +0000 (14:17 +0000)]
Recommit: Add support for prefix-only CLI options

Summary:
Add support for options that always prefix their value, giving an error
if the value is in the next argument or if the option is given a value
assignment (ie. opt=val). This is the desired behavior for the -D option
of FileCheck for instance.

Copyright:
- Linaro (changes in version 2 of revision D55940)
- GraphCore (changes in later versions and introduced when creating
  D56549)

Reviewers: jdenny

Subscribers: llvm-commits, probinson, kristina, hiraditya,
JonChesterfield

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

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

5 years ago[X86][SSE] Rename SimplifyDemandedVectorElts BLENDV tests
Simon Pilgrim [Tue, 5 Feb 2019 14:11:50 +0000 (14:11 +0000)]
[X86][SSE] Rename SimplifyDemandedVectorElts BLENDV tests

I'm going to be adding SimplifyDemandedBits tests shortly.

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

5 years ago[MCA] Moved the logic that updates register dependencies from DispatchStage to Regist...
Andrea Di Biagio [Tue, 5 Feb 2019 14:11:41 +0000 (14:11 +0000)]
[MCA] Moved the logic that updates register dependencies from DispatchStage to RegisterFile. NFC

DispatchStage should always delegate to an object of class RegisterFile the task
of updating data dependencies.  ReadState and WriteState objects should not be
modified directly by DispatchStage.
This patch also renames stage IS_AVAILABLE to IS_DISPATCHED.

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

5 years agogn build: Fix Python 3 write_vcsrevision script compatibility
Serge Guelton [Tue, 5 Feb 2019 13:01:12 +0000 (13:01 +0000)]
gn build: Fix Python 3 write_vcsrevision script compatibility

Trivial fix: decode was not called for all subprocess.check_output calls.

Commited on behalf of Andrew Boyarshin

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

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

5 years ago[X86][SSE] Add SimplifyDemandedVectorElts support for X86ISD::BLENDV
Simon Pilgrim [Tue, 5 Feb 2019 12:27:29 +0000 (12:27 +0000)]
[X86][SSE] Add SimplifyDemandedVectorElts support for X86ISD::BLENDV

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

5 years ago[X86][SSE] Add tests showing missing SimplifyDemandedVectorElts support for X86ISD...
Simon Pilgrim [Tue, 5 Feb 2019 12:18:34 +0000 (12:18 +0000)]
[X86][SSE] Add tests showing missing SimplifyDemandedVectorElts support for X86ISD::BLENDV

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

5 years ago[MCA] Simplify the logic in method WriteState::addUser. NFCI
Andrea Di Biagio [Tue, 5 Feb 2019 11:36:55 +0000 (11:36 +0000)]
[MCA] Simplify the logic in method WriteState::addUser. NFCI

In some cases, it is faster to just grow the set of 'Users' rather than
performing a llvm::find_if every time a new user is added to
the set. No functional change intended.

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

5 years ago[DebugInfo][NFCI] Split salvageDebugInfo into helper functions
Jeremy Morse [Tue, 5 Feb 2019 11:11:28 +0000 (11:11 +0000)]
[DebugInfo][NFCI] Split salvageDebugInfo into helper functions

Some use cases are appearing where salvaging is needed that does not
correspond to an instruction being deleted -- for example an instruction
being sunk, or a Value not being available in a block being isel'd.

Enable more fine grained control over how salavging occurs by splitting
the logic into helper functions, separating things that are specific to
working on DbgVariableIntrinsics from those specific to interpreting IR
and building DIExpressions.

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

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

5 years agoFix format string in bindings/go/llvm/ir_test.go (PR40561)
Hans Wennborg [Tue, 5 Feb 2019 11:01:54 +0000 (11:01 +0000)]
Fix format string in bindings/go/llvm/ir_test.go (PR40561)

The test started failing for me recently. I don't see any changes around
this code, so maybe it's my local go version that changed or something.

The error seems real to me: we're trying to print an Attribute with %d.
The test talks about "attribute masks" I'm not sure what that refers to,
but I suppose we could print the raw pointer value, since that's
what the test seems to be comparing.

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

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

5 years ago[X86][AVX] Attempt to share broadcasts of different widths (PR39454)
Simon Pilgrim [Tue, 5 Feb 2019 10:58:43 +0000 (10:58 +0000)]
[X86][AVX] Attempt to share broadcasts of different widths (PR39454)

If we have broadcasts of different vector widths, keep the longest vector width and extract subvectors for the shorter vectors (which should be free).

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

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

5 years ago[CostModel][X86] Add UMUL fixed point cost tests
Simon Pilgrim [Tue, 5 Feb 2019 10:55:38 +0000 (10:55 +0000)]
[CostModel][X86] Add UMUL fixed point cost tests

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

5 years ago[CGP] Add support for sinking operands to their users, if they are free.
Florian Hahn [Tue, 5 Feb 2019 10:27:40 +0000 (10:27 +0000)]
[CGP] Add support for sinking operands to their users, if they are free.

This patch improves code generation for some AArch64 ACLE intrinsics. It adds
support to CGP to duplicate and sink operands to their user, if they can be
folded into a target instruction, like zexts and sub into usubl. It adds a
TargetLowering hook shouldSinkOperands, which looks at the operands of
instructions to see if sinking is profitable.

I decided to add a new target hook, as for the sinking to be profitable,
at least on AArch64, we have to look at multiple operands of an
instruction, instead of looking at the users of a zext for example.

The sinking is done in CGP, because it works around an instruction
selection limitation. If instruction selection is not limited to a
single basic block, this patch should not be needed any longer.

Alternatively this could be done in the LoopSink pass, which tries to
undo LICM for instructions in blocks that are not executed frequently.

Note that we do not force the operands to sink to have a single user,
because we duplicate them before sinking. Therefore this is only
desirable if they really can be done for free. Additionally we could
consider the impact on live ranges later on.

This should fix https://bugs.llvm.org/show_bug.cgi?id=40025.

As for performance, we have internal code that uses intrinsics and can
be speed up by 10% by this change.

Reviewers: SjoerdMeijer, t.p.northover, samparker, efriedma, RKSimon, spatel

Reviewed By: samparker

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

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

5 years ago[ARM GlobalISel] Support G_GEP for Thumb2
Diana Picus [Tue, 5 Feb 2019 10:21:37 +0000 (10:21 +0000)]
[ARM GlobalISel] Support G_GEP for Thumb2

Same as ARM, but use a different opcode in the instruction selection.

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

5 years agoPreviously if the user configured their build but then changed
Dan Liew [Tue, 5 Feb 2019 08:47:28 +0000 (08:47 +0000)]
Previously if the user configured their build but then changed
LLVM_ENABLED_PROJECT and reconfigured it had no effect on what
projects were actually built. This was very confusing behaviour. The
reason for this is that the value of the `LLVM_TOOL_<PROJECT>_BUILD`
variables are already set.

The problem here is that we have two sources of truth:

* The projects listed in LLVM_ENABLE_PROJECTS.
* The projects enabled/disabled with LLVM_TOOL_<PROJECT>_BUILD.

At configure time we have no real way of knowing which source of truth
the user wants so we apply the following heuristic:

If the user ever sets `LLVM_ENABLE_PROJECTS` in the CMakeCache then that
is used as the single source of truth and we force the
`LLVM_TOOL_<PROJECT>_BUILD` CMake cache variables to have the
appropriate values that match the contents of the
`LLVM_ENABLE_PROJECTS`. If the user never sets `LLVM_ENABLE_PROJECTS`
then they can continue to use and set the `LLVM_TOOL_<PROJECT>_BUILD`
variables as the "source of truth".

The problem with this approach is that if the user ever tries to use
both `LLVM_ENABLE_PROJECTS` and `LLVM_TOOL_<PROJECT>_BUILD` for the same
build directory then any user set value for `LLVM_TOOL_<PROJECT>_BUILD`
variables will get overwriten, likely without the user noticing.

Hopefully the above shouldn't matter in practice because the
LLVM_TOOL_<PROJECT>_BUILD variables are not documented, but
LLVM_ENABLE_PROJECTS is.

We should probably deprecate the `LLVM_TOOL_<PROJECT>_BUILD`
variables at some point by turning them into to regular CMake
variables that don't live in the CMake cache.

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

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

5 years ago[NFC] fix trivial typos in comments
Hiroshi Inoue [Tue, 5 Feb 2019 08:30:48 +0000 (08:30 +0000)]
[NFC] fix trivial typos in comments

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

5 years ago[DAG][NFC] Add unit tests.
Clement Courbet [Tue, 5 Feb 2019 08:00:17 +0000 (08:00 +0000)]
[DAG][NFC] Add unit tests.

In preparation for D57541.

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

5 years ago[DAG] BaseIndexOffset: FrameIndexSDNodes with the same FrameIndex compare equal.
Clement Courbet [Tue, 5 Feb 2019 07:36:20 +0000 (07:36 +0000)]
[DAG] BaseIndexOffset: FrameIndexSDNodes with the same FrameIndex compare equal.

Reviewers: niravd

Subscribers: arphaman, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] Connect the default fpsr and dirflag clobbers in inline assembly to the registe...
Craig Topper [Tue, 5 Feb 2019 06:13:06 +0000 (06:13 +0000)]
[X86] Connect the default fpsr and dirflag clobbers in inline assembly to the registers we have defined for them.

Summary:
We don't currently map these constraints to physical register numbers so they don't make it to the MachineIR representation of inline assembly.

This could have problems for proper dependency tracking in the machine schedulers though I don't have a test case that shows that.

Reviewers: rnk

Reviewed By: rnk

Subscribers: eraman, llvm-commits

Tags: #llvm

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

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

5 years agogn build: Upgrade to NDK r19.
Peter Collingbourne [Tue, 5 Feb 2019 05:10:19 +0000 (05:10 +0000)]
gn build: Upgrade to NDK r19.

NDK r19 includes a sysroot that can be used directly by the compiler
without creating a standalone toolchain, so we just need a handful
of flags to point Clang there.

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

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

5 years ago[X86] Add test case from PR40529. NFC
Craig Topper [Tue, 5 Feb 2019 04:48:23 +0000 (04:48 +0000)]
[X86] Add test case from PR40529. NFC

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

5 years ago[LSR] Check SCEV on isZero() after extend. PR40514
Max Kazantsev [Tue, 5 Feb 2019 04:30:37 +0000 (04:30 +0000)]
[LSR] Check SCEV on isZero() after extend. PR40514

When LSR first adds SCEVs to BaseRegs, it only does it if `isZero()` has
returned false. In the end, in invocation of `InsertFormula`, it asserts that
all values there are still not zero constants. However between these two
points, it makes some transformations, in particular extends them to wider
type.

SCEV does not give us guarantee that if `S` is not a constant zero, then
`sext(S)` is also not a constant zero. It might have missed some optimizing
transforms when it was calculating `S` and then made them when it took `sext`.
For example, it may happen if previously optimizing transforms were limited
by depth or somehow else.

This patch adds a bailout when we may end up with a zero SCEV after extension.

Differential Revision: https://reviews.llvm.org/D57565
Reviewed By: samparker

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

5 years ago[SamplePGO] More pipeline changes when flattened profile used in ThinLTO postlink
Teresa Johnson [Tue, 5 Feb 2019 04:09:19 +0000 (04:09 +0000)]
[SamplePGO] More pipeline changes when flattened profile used in ThinLTO postlink

Summary:
Follow on to D54819/r351476.

We also don't need to perform extra InstCombine pass when we aren't
loading the sample profile in the ThinLTO backend because we have a
flattened sample profile.

Additionally, for consistency and clarity, when we aren't reloading the
sample profile, perform ICP in the same location as non-sample PGO
backends. To this end I have moved the ICP invocation for non-SamplePGO
ThinLTO down into buildModuleSimplificationPipeline (partly addresses
the FIXME where we were previously setting this up).

Reviewers: wmi

Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits

Tags: #llvm

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

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

5 years agoFix narrowing issue from r353129
Richard Trieu [Tue, 5 Feb 2019 02:26:03 +0000 (02:26 +0000)]
Fix narrowing issue from r353129

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

5 years ago[WebAssembly] Fix indentation after adding IsCanonical property (NFC)
Heejin Ahn [Tue, 5 Feb 2019 01:59:49 +0000 (01:59 +0000)]
[WebAssembly] Fix indentation after adding IsCanonical property (NFC)

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

5 years ago[WebAssembly] Make disassembler always emit most canonical name.
Wouter van Oortmerssen [Tue, 5 Feb 2019 01:19:45 +0000 (01:19 +0000)]
[WebAssembly] Make disassembler always emit most canonical name.

Summary:
There are a few instructions that all map to the same opcode, so
when disassembling, we have to pick one. That was just the first one
before (the except_ref variant in the case of "call"), now it is the
one marked as IsCanonical in tablegen, or failing that, the shortest
name (which is typically the "canonical" one).

Also introduced a canonical "end" instruction for this purpose.

Reviewers: dschuff, tlively

Subscribers: sbc100, jgravelle-google, aheejin, llvm-commits, sunfish

Tags: #llvm

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

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

5 years ago[SamplePGO][NFC] Minor improvement to replace a temporary vector with a
Wei Mi [Tue, 5 Feb 2019 00:57:50 +0000 (00:57 +0000)]
[SamplePGO][NFC] Minor improvement to replace a temporary vector with a
brace-enclosed init list.

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

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

5 years agoGlobalISel: Fix verifier crashing on non-register operands
Matt Arsenault [Tue, 5 Feb 2019 00:53:22 +0000 (00:53 +0000)]
GlobalISel: Fix verifier crashing on non-register operands

Also correct the wording of error on subregisters.

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

5 years ago[WebAssembly] memory.copy
Thomas Lively [Tue, 5 Feb 2019 00:49:55 +0000 (00:49 +0000)]
[WebAssembly] memory.copy

Summary: Depends on D57495.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, hiraditya, sunfish

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

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

5 years agoGlobalISel: Consolidate load/store legalization
Matt Arsenault [Tue, 5 Feb 2019 00:26:12 +0000 (00:26 +0000)]
GlobalISel: Consolidate load/store legalization

The fewerElementsVectors implementation for load/stores
handles the scalar reduction case just as well, so drop
the redundant code in narrowScalar. This also introduces
support for narrowing irregular size breakdowns for
scalars.

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

5 years ago[DAGCombiner] Discard pointer info when combining extract_vector_elt of a vector...
Craig Topper [Tue, 5 Feb 2019 00:22:23 +0000 (00:22 +0000)]
[DAGCombiner] Discard pointer info when combining extract_vector_elt of a vector load when the index isn't constant

Summary:
If the index isn't constant, this transform inserts a multiply and an add on the index to calculating the base pointer for a scalar load. But we still create a memory operand with an offset of 0 and the size of the scalar access. But the access is really to an unknown offset within the original access size.

This can cause the machine scheduler to incorrectly calculate dependencies between this load and other accesses. In the case we saw, there was a 32 byte vector store that was split into two 16 byte stores, one with offset 0 and one with offset 16. The size of the memory operand for both was 16. The scheduler correctly detected the alias with the offset 0 store, but not the offset 16 store.

This patch discards the pointer info so we don't incorrectly detect aliasing. I wasn't sure if we could keep using the original offset and size without risking some other transform on the load changing the size.

I tried to reduce a test case, but there's still a lot of memory operations needed to get the scheduler to do the bad reordering. So it looked pretty fragile to maintain.

Reviewers: efriedma

Reviewed By: efriedma

Subscribers: arphaman, llvm-commits

Tags: #llvm

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

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

5 years ago[SamplePGO] Minor efficiency improvement in samplePGO ICP
Teresa Johnson [Tue, 5 Feb 2019 00:18:38 +0000 (00:18 +0000)]
[SamplePGO] Minor efficiency improvement in samplePGO ICP

Summary:
When attaching prof metadata to promoted direct calls in SamplePGO
mode, no need to construct and use a SmallVector to pass a single count
to the ArrayRef parameter, we can simply use a brace-enclosed init list.

This made a small but consistent improvement for a ThinLTO backend
compile I was measuring.

Reviewers: wmi

Subscribers: mehdi_amini, dexonsmith, llvm-commits

Tags: #llvm

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

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

5 years agoGlobalISel: Implement narrowScalar for select
Matt Arsenault [Tue, 5 Feb 2019 00:13:44 +0000 (00:13 +0000)]
GlobalISel: Implement narrowScalar for select

Don't handle vector conditions.

I think this can be merged in the future with
fewerElementsVectorSelect, although this becomes slightly tricky with
a vector condition.

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

5 years agoGlobalISel: Combine g_extract with g_merge_values
Matt Arsenault [Mon, 4 Feb 2019 23:41:59 +0000 (23:41 +0000)]
GlobalISel: Combine g_extract with g_merge_values

Try to use the underlying source registers.

This enables legalization in more cases where some irregular
operations are widened and others narrowed.

This seems to make the test_combines_2 AArch64 test worse, since the
MERGE_VALUES has multiple uses. Since this should be required for
legalization, a hasOneUse check is probably inappropriate (or maybe
should only be used if the merge is legal?).

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

5 years ago[Sanitizers] UBSan unreachable incompatible with Kernel ASan
Julian Lettner [Mon, 4 Feb 2019 23:37:50 +0000 (23:37 +0000)]
[Sanitizers] UBSan unreachable incompatible with Kernel ASan

Summary:
This is a follow up for https://reviews.llvm.org/D57278. The previous
revision should have also included Kernel ASan.

rdar://problem/40723397

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[llvm-readobj] Fix readobj test expectation broken in rL353109. NFC.
Sam Clegg [Mon, 4 Feb 2019 23:36:38 +0000 (23:36 +0000)]
[llvm-readobj] Fix readobj test expectation broken in rL353109. NFC.

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

5 years agoRevert "[PATCH] [TargetLibraryInfo] Update run time support for Windows"
Evandro Menezes [Mon, 4 Feb 2019 23:34:50 +0000 (23:34 +0000)]
Revert "[PATCH] [TargetLibraryInfo] Update run time support for Windows"

This reverts accidental commit ff5527718d5d3b9966f6e8948866c0dc15ffcf3c.

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

5 years ago[ADT] Refactor the Windows query functions (NFC)
Evandro Menezes [Mon, 4 Feb 2019 23:34:38 +0000 (23:34 +0000)]
[ADT] Refactor the Windows query functions (NFC)

Increase reuse in the query functions for Windows.

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

5 years ago[PATCH] [TargetLibraryInfo] Update run time support for Windows
Evandro Menezes [Mon, 4 Feb 2019 23:29:41 +0000 (23:29 +0000)]
[PATCH] [TargetLibraryInfo] Update run time support for Windows

It seems that the run time for Windows has changed and supports more math
functions than before.  Since LLVM requires at least VS2015, I assume that
this is the run time that would be redistributed with programs built with
Clang.  Thus, I based this update on the header file `math.h` that
accompanies it.

This patch addresses the PR40541.  Unfortunately, I have no access to a
Windows development environment to validate it.

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

5 years agoGlobalISel: Enforce operand types for constants
Matt Arsenault [Mon, 4 Feb 2019 23:29:31 +0000 (23:29 +0000)]
GlobalISel: Enforce operand types for constants

A number of of tests were using imm operands, not cimm. Since CSE
relies on the exact ConstantInt* pointer used, and implicit
conversions are generally evil, also enforce the bitsize of the types.

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

5 years agoGlobalISel: Verify g_select
Matt Arsenault [Mon, 4 Feb 2019 23:29:16 +0000 (23:29 +0000)]
GlobalISel: Verify g_select

Factor the common vector element consistency check many instructions
need out, although this makes the error messages worse.

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

5 years agoMachineVerifier: Move verification of G_* instructions to function
Matt Arsenault [Mon, 4 Feb 2019 23:29:11 +0000 (23:29 +0000)]
MachineVerifier: Move verification of G_* instructions to function

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

5 years ago[WebAssembly] MC: Mark more function aliases as functions
Sam Clegg [Mon, 4 Feb 2019 23:07:34 +0000 (23:07 +0000)]
[WebAssembly] MC: Mark more function aliases as functions

Aliases of functions are now marked as function symbols even if
they are bitcast to some other other non-function type.
This is important for WebAssembly where object and function
symbols can't alias each other.

Fixes PR38866

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

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

5 years agoMIR: Validate LLT types when parsing
Matt Arsenault [Mon, 4 Feb 2019 22:59:56 +0000 (22:59 +0000)]
MIR: Validate LLT types when parsing

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