]> granicus.if.org Git - llvm/log
llvm
5 years ago[MCA][Bottleneck Analysis] Teach how to compute a critical sequence of instructions...
Andrea Di Biagio [Fri, 21 Jun 2019 13:32:54 +0000 (13:32 +0000)]
[MCA][Bottleneck Analysis] Teach how to compute a critical sequence of instructions based on the simulation.

This patch teaches the bottleneck analysis how to identify and print the most
expensive sequence of instructions according to the simulation. Fixes PR37494.

The goal is to help users identify the sequence of instruction which is most
critical for performance.

A dependency graph is internally used by the bottleneck analysis to describe
data dependencies and processor resource interferences between instructions.

There is one node in the graph for every instruction in the input assembly
sequence. The number of nodes in the graph is independent from the number of
iterations simulated by the tool. It means that a single node of the graph
represents all the possible instances of a same instruction contributed by the
simulated iterations.

Edges are dynamically "discovered" by the bottleneck analysis by observing
instruction state transitions and "backend pressure increase" events generated
by the Execute stage. Information from the events is used to identify critical
dependencies, and materialize edges in the graph. A dependency edge is uniquely
identified by a pair of node identifiers plus an instance of struct
DependencyEdge::Dependency (which provides more details about the actual
dependency kind).

The bottleneck analysis internally ranks dependency edges based on their impact
on the runtime (see field DependencyEdge::Dependency::Cost). To this end, each
edge of the graph has an associated cost. By default, the cost of an edge is a
function of its latency (in cycles). In practice, the cost of an edge is also a
function of the number of cycles where the dependency has been seen as
'contributing to backend pressure increases'. The idea is that the higher the
cost of an edge, the higher is the impact of the dependency on performance. To
put it in another way, the cost of an edge is a measure of criticality for
performance.

Note how a same edge may be found in multiple iteration of the simulated loop.
The logic that adds new edges to the graph checks if an equivalent dependency
already exists (duplicate edges are not allowed). If an equivalent dependency
edge is found, field DependencyEdge::Frequency of that edge is incremented by
one, and the new cost is cumulatively added to the existing edge cost.

At the end of simulation, costs are propagated to nodes through the edges of the
graph. The goal is to identify a critical sequence from a node of the root-set
(composed by node of the graph with no predecessors) to a 'sink node' with no
successors.  Note that the graph is intentionally kept acyclic to minimize the
complexity of the critical sequence computation algorithm (complexity is
currently linear in the number of nodes in the graph).

The critical path is finally computed as a sequence of dependency edges. For
edges describing processor resource interferences, the view also prints a
so-called "interference probability" value (by dividing field
DependencyEdge::Frequency by the total number of iterations).

Examples of critical sequence computations can be found in tests added/modified
by this patch.

On output streams that support colored output, instructions from the critical
sequence are rendered with a different color.

Strictly speaking the analysis conducted by the bottleneck analysis view is not
a critical path analysis. The cost of an edge doesn't only depend on the
dependency latency. More importantly, the cost of a same edge may be computed
differently by different iterations.

The number of dependencies is discovered dynamically based on the events
generated by the simulator. However, their number is not fixed. This is
especially true for edges that model processor resource interferences; an
interference may not occur in every iteration. For that reason, it makes sense
to also print out a "probability of interference".

By construction, the accuracy of this analysis (as always) is strongly dependent
on the simulation (and therefore the quality of the information available in the
scheduling model).

That being said, the critical sequence effectively identifies a performance
criticality. Instructions from that sequence are expected to have a very big
impact on performance. So, users can take advantage of this information to focus
their attention on specific interactions between instructions.
In my experience, it works quite well in practice, and produces useful
output (in a reasonable amount time).

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

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

5 years ago[ARM] Add MVE 64-bit GPR <-> vector move instructions.
Simon Tatham [Fri, 21 Jun 2019 13:17:23 +0000 (13:17 +0000)]
[ARM] Add MVE 64-bit GPR <-> vector move instructions.

These instructions let you load half a vector register at once from
two general-purpose registers, or vice versa.

The assembly syntax for these instructions mentions the vector
register name twice. For the move _into_ a vector register, the MC
operand list also has to mention the register name twice (once as the
output, and once as an input to represent where the unchanged half of
the output register comes from). So we can conveniently assign one of
the two asm operands to be the output $Qd, and the other $QdSrc, which
avoids confusing the auto-generated AsmMatcher too much. For the move
_from_ a vector register, there's no way to get round the fact that
both instances of that register name have to be inputs, so we need a
custom AsmMatchConverter to avoid generating two separate output MC
operands. (And even that wouldn't have worked if it hadn't been for
D60695.)

Reviewers: dmgreen, samparker, SjoerdMeijer, t.p.northover

Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[ARM] Add MVE vector instructions that take a scalar input.
Simon Tatham [Fri, 21 Jun 2019 13:17:08 +0000 (13:17 +0000)]
[ARM] Add MVE vector instructions that take a scalar input.

This adds the `MVE_qDest_rSrc` superclass and all its instances, plus
a few other instructions that also take a scalar input register or two.

I've also belatedly added custom diagnostic messages to the operand
classes for odd- and even-numbered GPRs, which required matching
changes in two of the existing MVE assembly test files.

Reviewers: dmgreen, samparker, SjoerdMeijer, t.p.northover

Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years agoFix a crash with assembler source and -g.
Paul Robinson [Fri, 21 Jun 2019 13:10:19 +0000 (13:10 +0000)]
Fix a crash with assembler source and -g.

llvm-mc or clang with -g normally produces debug info describing the
assembler source itself; however, if that source already contains some
.file/.loc directives, we should instead emit the debug info described
by those directives.  For certain assembler sources seen in the wild
(particularly in the Chrome build) this was causing a crash due to
incorrect assumptions about legal sequences of assembler source text.

Fixes PR38994.

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

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

5 years ago[X86] X86ISD::ANDNP is a (non-commutative) binop
Simon Pilgrim [Fri, 21 Jun 2019 12:42:39 +0000 (12:42 +0000)]
[X86] X86ISD::ANDNP is a (non-commutative) binop

The sat add/sub tests still have unnecessary extract_subvector((vandnps ymm, ymm), 0) uses that should be split to (vandnps (extract_subvector(ymm, 0), extract_subvector(ymm, 0)), but its getting better.

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

5 years ago[ARM] Add a batch of similarly encoded MVE instructions.
Simon Tatham [Fri, 21 Jun 2019 12:13:59 +0000 (12:13 +0000)]
[ARM] Add a batch of similarly encoded MVE instructions.

Summary:
This adds the `MVE_qDest_qSrc` superclass and all instructions that
inherit from it. It's not the complete class of _everything_ with a
q-register as both destination and source; it's a subset of them that
all have similar encodings (but it would have been hopelessly unwieldy
to call it anything like MVE_111x11100).

This category includes add/sub with carry; long multiplies; halving
multiplies; multiply and accumulate, and some more complex
instructions.

Reviewers: dmgreen, samparker, SjoerdMeijer, t.p.northover

Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[binutils] Add response file option to help and docs
James Henderson [Fri, 21 Jun 2019 11:49:20 +0000 (11:49 +0000)]
[binutils] Add response file option to help and docs

Many LLVM-based tools already support response files (i.e. files
containing a list of options, specified with '@'). This change simply
updates the documentation and help text for some of these tools to
include it. I haven't attempted to fix all tools, just a selection that
I am interested in.

I've taken the opportunity to add some tests for --help behaviour, where
they were missing. We could expand these tests, but I don't think that's
within scope of this patch.

This fixes https://bugs.llvm.org/show_bug.cgi?id=42233 and
https://bugs.llvm.org/show_bug.cgi?id=42236.

Reviewed by: grimar, MaskRay, jkorous

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

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

5 years ago[X86] createMMXBuildVector - call with BuildVectorSDNode directly. NFCI.
Simon Pilgrim [Fri, 21 Jun 2019 11:25:06 +0000 (11:25 +0000)]
[X86] createMMXBuildVector - call with BuildVectorSDNode directly. NFCI.

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

5 years ago[llvm-dwarfdump] Remove unnecessary explicit -h behaviour
James Henderson [Fri, 21 Jun 2019 11:22:20 +0000 (11:22 +0000)]
[llvm-dwarfdump] Remove unnecessary explicit -h behaviour

--help and -h are automatically supported by the command-line parser,
unless overridden by the tool. The behaviour of the PrintHelpMessage
being used for -h prior to this patch is subtly different to that
provided by --help automatically (it omits certain elements of help text
and options, such as --help-list), so overriding the default is not
desirable, without good reason. This patch removes the explicit
specification of -h and its behaviour, so that the default behaviour is
used.

Reviewed by: hintonda

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

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

5 years ago[ARM] Fix -Wimplicit-fallthrough after D62675
Fangrui Song [Fri, 21 Jun 2019 11:19:11 +0000 (11:19 +0000)]
[ARM] Fix -Wimplicit-fallthrough after D62675

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

5 years ago[ARM] Add MVE vector compare instructions.
Simon Tatham [Fri, 21 Jun 2019 11:14:51 +0000 (11:14 +0000)]
[ARM] Add MVE vector compare instructions.

Summary:
These take a pair of vector register to compare, and a comparison type
(written in the form of an Arm condition suffix); they output a vector
of booleans in the VPR register, where predication can conveniently
use them.

Reviewers: dmgreen, samparker, SjoerdMeijer, t.p.northover

Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] combineAndnp - use isNOT instead of manually checking for (XOR x, -1)
Simon Pilgrim [Fri, 21 Jun 2019 11:13:15 +0000 (11:13 +0000)]
[X86] combineAndnp - use isNOT instead of manually checking for (XOR x, -1)

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

5 years ago[Symbolize] Avoid lifetime extension and simplify std::map find/insert. NFC
Fangrui Song [Fri, 21 Jun 2019 11:05:26 +0000 (11:05 +0000)]
[Symbolize] Avoid lifetime extension and simplify std::map find/insert. NFC

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

5 years ago[X86] foldVectorXorShiftIntoCmp - use isConstOrConstSplat. NFCI.
Simon Pilgrim [Fri, 21 Jun 2019 10:54:30 +0000 (10:54 +0000)]
[X86] foldVectorXorShiftIntoCmp - use isConstOrConstSplat. NFCI.

Use the isConstOrConstSplat helper instead of inspecting the build vector manually.

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

5 years ago[X86][AVX] isNOT - handle concat_vectors(xor X, -1, xor Y, -1) pattern
Simon Pilgrim [Fri, 21 Jun 2019 10:44:15 +0000 (10:44 +0000)]
[X86][AVX] isNOT - handle concat_vectors(xor X, -1, xor Y, -1) pattern

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

5 years ago[docs][llvm-objdump] Improve llvm-objdump documentation
James Henderson [Fri, 21 Jun 2019 10:12:53 +0000 (10:12 +0000)]
[docs][llvm-objdump] Improve llvm-objdump documentation

The llvm-objdump document was missing many options, and there were also
some style issues with it. This patches fixes all but the first issue
listed in https://bugs.llvm.org/show_bug.cgi?id=42249 by:

    1. Adding missing options and commands.
    2. Standardising on double dashes for long-options throughout.
    3. Moving Mach-O specific options to a separate section.
    4. Removing options that don't exist or aren't relevant to
       llvm-objdump.

Reviewed by: MaskRay, mtrent, alexshap

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

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

5 years ago[GN] Fix check-clang by disabling plugins
Vitaly Buka [Fri, 21 Jun 2019 09:54:32 +0000 (09:54 +0000)]
[GN] Fix check-clang by disabling plugins

We can't link Analysis/plugins without -fPIC

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

5 years ago[GN] Put libcxx include into the same place as cmake to fix Driver/print-file-name...
Vitaly Buka [Fri, 21 Jun 2019 09:54:31 +0000 (09:54 +0000)]
[GN] Put libcxx include into the same place as cmake to fix Driver/print-file-name.c test

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

5 years ago[ARM] Add a batch of MVE floating-point instructions.
Simon Tatham [Fri, 21 Jun 2019 09:35:07 +0000 (09:35 +0000)]
[ARM] Add a batch of MVE floating-point instructions.

Summary:
This includes floating-point basic arithmetic (add/sub/multiply),
complex add/multiply, unary negation and absolute value, rounding to
integer value, and conversion to/from integer formats.

Reviewers: dmgreen, samparker, SjoerdMeijer, t.p.northover

Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years agoUse std::iterator_traits to infer result type of llvm::enumerate iterator wrapper
Mehdi Amini [Fri, 21 Jun 2019 05:43:08 +0000 (05:43 +0000)]
Use std::iterator_traits to infer result type of llvm::enumerate iterator wrapper

Update the llvm::enumerate helper class result_pair<R> to use the 'iterator_traits<R>::reference'
type as the result of 'value()' instead 'ValueOfRange<R> &'. This enables support for iterators
that return value types, i.e. non reference. This is a common pattern for some classes of
iterators, e.g. mapped_iterator.

Patch by: River Riddle <riverriddle@google.com>

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

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

5 years agoSimplify std::lower_bound with llvm::{bsearch,lower_bound}. NFC
Fangrui Song [Fri, 21 Jun 2019 05:40:31 +0000 (05:40 +0000)]
Simplify std::lower_bound with llvm::{bsearch,lower_bound}. NFC

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

5 years ago[LICM & MSSA] Fixed test to run only with assertions enabled as it uses -debug-only
Yevgeny Rouban [Fri, 21 Jun 2019 04:49:40 +0000 (04:49 +0000)]
[LICM & MSSA] Fixed test to run only with assertions enabled as it uses -debug-only

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

5 years ago[GN] Fix build
Vitaly Buka [Fri, 21 Jun 2019 02:15:07 +0000 (02:15 +0000)]
[GN] Fix build

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

5 years ago[MIPS GlobalISel] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after...
Fangrui Song [Fri, 21 Jun 2019 01:51:50 +0000 (01:51 +0000)]
[MIPS GlobalISel] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after D63541

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

5 years ago[GlobalISel][Localizer] Allow localization of G_INTTOPTR and chains of instructions.
Amara Emerson [Fri, 21 Jun 2019 00:36:19 +0000 (00:36 +0000)]
[GlobalISel][Localizer] Allow localization of G_INTTOPTR and chains of instructions.

G_INTTOPTR can prevent the localizer from moving G_CONSTANTs, but since it's
essentially a side effect free cast instruction we can remat both instructions.
This patch changes the localizer to enable localization of the chains by
iterating over the entry block instructions in reverse order. That way, uses will
localized first, and then the defs are free to be localized as well.

This also changes the previous SmallPtrSet of localized instructions to use a
SetVector instead. We're dealing with pointers and need deterministic iteration
order.

Overall, this change improves ARM64 -O0 CTMark code size by around 0.7% geomean.

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

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

5 years ago[llvm-objcopy][MachO] Rebuild the symbol/string table in the writer
Seiya Nuta [Fri, 21 Jun 2019 00:21:50 +0000 (00:21 +0000)]
[llvm-objcopy][MachO] Rebuild the symbol/string table in the writer

Summary: Build the string table using StringTableBuilder, reassign symbol indices, and update symbol indices in relocations to allow adding/modifying/removing symbols from the object.

Reviewers: alexshap, rupprecht, jhenderson

Reviewed By: alexshap

Subscribers: mgorny, jakehehrlich, llvm-commits

Tags: #llvm

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

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

5 years ago[Reassociate] Remove bogus assert reported in PR42349.
Cameron McInally [Thu, 20 Jun 2019 23:03:55 +0000 (23:03 +0000)]
[Reassociate] Remove bogus assert reported in PR42349.

Also, add a FIXME for the unsafe transform on a unary FNeg. A unary FNeg can only be transformed to a FMul by -1.0 when the nnan flag is present. The unary FNeg project is a WIP, so the unsafe transformation is acceptable until that work is complete.

The bogus assert with introduced in D63445.

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

5 years ago[InstSimplify] simplify power-of-2 (single bit set) sequences
Sanjay Patel [Thu, 20 Jun 2019 22:55:28 +0000 (22:55 +0000)]
[InstSimplify] simplify power-of-2 (single bit set) sequences

As discussed in PR42314:
https://bugs.llvm.org/show_bug.cgi?id=42314

Improving the canonicalization for these patterns:
rL363956
...means we should adjust/enhance the related simplification.

https://rise4fun.com/Alive/w1cp

  Name: isPow2 or zero
  %x = and i32 %xx, 2048
  %a = add i32 %x, -1
  %r = and i32 %a, %x
  =>
  %r = i32 0

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

5 years ago[CodeGen] Refactor check of suitability for a jump table (NFC)
Evandro Menezes [Thu, 20 Jun 2019 22:03:54 +0000 (22:03 +0000)]
[CodeGen] Refactor check of suitability for a jump table (NFC)

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

5 years ago[ARM GlobalISel] Tests for s64 G_ADD and G_SUB.
Eli Friedman [Thu, 20 Jun 2019 22:00:07 +0000 (22:00 +0000)]
[ARM GlobalISel] Tests for s64 G_ADD and G_SUB.

Forgot to commit these in r363989 (https://reviews.llvm.org/D63585)

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

5 years agoAMDGPU: Always use s33 for global scratch wave offset
Matt Arsenault [Thu, 20 Jun 2019 21:58:24 +0000 (21:58 +0000)]
AMDGPU: Always use s33 for global scratch wave offset

Every called function could possibly need this to calculate the
absolute address of stack objectst, and this avoids inserting a copy
around every call site in the kernel. It's also somewhat cleaner to
keep this in a callee saved SGPR.

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

5 years ago[ARM GlobalISel] Add support for s64 G_ADD and G_SUB.
Eli Friedman [Thu, 20 Jun 2019 21:56:47 +0000 (21:56 +0000)]
[ARM GlobalISel] Add support for s64 G_ADD and G_SUB.

Teach RegisterBankInfo to use the correct register class, and tell the
legalizer it's legal.  Everything else just works.

The one thing that's slightly weird about this compared to SelectionDAG
isel is that legalization can't distinguish between i64 and <1 x i64>,
so we might end up with more NEON instructions than the user expects.

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

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

5 years ago[PowerPC][NFC] Fix comments for AltVSXFMARel mapping.
Jinsong Ji [Thu, 20 Jun 2019 21:36:06 +0000 (21:36 +0000)]
[PowerPC][NFC] Fix comments for AltVSXFMARel mapping.

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

5 years ago[profile] Solaris ld supports __start___llvm_prof_data etc. labels
Rainer Orth [Thu, 20 Jun 2019 21:27:06 +0000 (21:27 +0000)]
[profile] Solaris ld supports __start___llvm_prof_data etc. labels

Currently, many profiling tests on Solaris FAIL like

  Command Output (stderr):
  --
  Undefined                       first referenced
   symbol                             in file
  __llvm_profile_register_names_function /tmp/lit_tmp_Nqu4eh/infinite_loop-9dc638.o
  __llvm_profile_register_function    /tmp/lit_tmp_Nqu4eh/infinite_loop-9dc638.o

Solaris 11.4 ld supports the non-standard GNU ld extension of adding
__start_SECNAME and __stop_SECNAME labels to sections whose names are valid
as C identifiers.  Given that we already use Solaris 11.4-only features
like ld -z gnu-version-script-compat and fully working .preinit_array
support in compiler-rt, we don't need to worry about older versions of
Solaris ld.

The patch documents that support (although the comment in
lib/Transforms/Instrumentation/InstrProfiling.cpp
(needsRuntimeRegistrationOfSectionRange) is quite cryptic what it's
actually about), and adapts the affected testcase not to expect the
alternativeq __llvm_profile_register_functions and __llvm_profile_init.
It fixes all affected tests.

Tested on amd64-pc-solaris2.11.

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

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

5 years agoAMDGPU: Add intrinsics for DS GWS semaphore instructions
Matt Arsenault [Thu, 20 Jun 2019 21:11:42 +0000 (21:11 +0000)]
AMDGPU: Add intrinsics for DS GWS semaphore instructions

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

5 years ago[LICM & MSSA] Limit unsafe sinking and hoisting.
Alina Sbirlea [Thu, 20 Jun 2019 21:09:09 +0000 (21:09 +0000)]
[LICM & MSSA] Limit unsafe sinking and hoisting.

Summary:
The getClobberingMemoryAccess API checks for clobbering accesses in a loop by walking the backedge. This may check if a memory access is being
clobbered by the loop in a previous iteration, depending how smart AA got over the course of the updates in MemorySSA (it does not occur when built from scratch).
If no clobbering access is found inside the loop, it will optimize to an access outside the loop. This however does not mean that access is safe to sink.
Given:
```
for i
  load a[i]
  store a[i]
```
The access corresponding to the load can be optimized to outside the loop, and the load can be hoisted. But it is incorrect to sink it.
In order to sink the load, we'd need to check no Def clobbers the Use in the same iteration. With this patch we currently restrict sinking to either
Defs not existing in the loop, or Defs preceding the load in the same block. An easy extension is to ensure the load (Use) post-dominates all Defs.

Caught by PR42294.

This issue also shed light on the converse problem: hoisting stores in this same scenario would be illegal. With this patch we restrict
hoisting of stores to the case when their corresponding Defs are dominating all Uses in the loop.

Reviewers: george.burgess.iv

Subscribers: jlebar, Prazek, llvm-commits

Tags: #llvm

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

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

5 years ago[InstSimplify] add tests for known-not-a-power-of-2; NFC
Sanjay Patel [Thu, 20 Jun 2019 21:04:14 +0000 (21:04 +0000)]
[InstSimplify] add tests for known-not-a-power-of-2; NFC

I added a canonicalization to create this general pattern in:
rL363956

But as noted in PR42314:
https://bugs.llvm.org/show_bug.cgi?id=42314#c11

...we have a (potentially expensive) simplification for the version
of the code that we just canonicalized away from, so we should
add/adjust that code to match.

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

5 years agoAMDGPU: Insert mem_viol check loop around GWS pre-GFX9
Matt Arsenault [Thu, 20 Jun 2019 20:54:32 +0000 (20:54 +0000)]
AMDGPU: Insert mem_viol check loop around GWS pre-GFX9

It is necessary to emit this loop around GWS operations in case the
wave is preempted pre-GFX9.

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

5 years ago[NFC][SLP] Pre-commit unary FNeg test to X86/propagate_ir_flags.ll
Cameron McInally [Thu, 20 Jun 2019 20:53:51 +0000 (20:53 +0000)]
[NFC][SLP] Pre-commit unary FNeg test to X86/propagate_ir_flags.ll

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

5 years agoUpdate LLVM test to not check for the EliminateAvailableExternallyPass
Leonard Chan [Thu, 20 Jun 2019 20:51:58 +0000 (20:51 +0000)]
Update LLVM test to not check for the EliminateAvailableExternallyPass
for lto-pre-link O2 pipeline runs.

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

5 years ago[InstCombine] fix typo in comment; NFC
Sanjay Patel [Thu, 20 Jun 2019 20:23:32 +0000 (20:23 +0000)]
[InstCombine] fix typo in comment; NFC

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

5 years ago[clang][NewPM] Do not eliminate available_externally durng `-O2 -flto` runs
Leonard Chan [Thu, 20 Jun 2019 19:44:51 +0000 (19:44 +0000)]
[clang][NewPM] Do not eliminate available_externally durng `-O2 -flto` runs

This fixes CodeGen/available-externally-suppress.c when the new pass manager is
turned on by default. available_externally was not emitted during -O2 -flto
runs when it should still be retained for link time inlining purposes. This can
be fixed by checking that we aren't LTOPrelinking when adding the
EliminateAvailableExternallyPass.

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

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

5 years ago[NFC] Add more tests for D46262
David Bolvansky [Thu, 20 Jun 2019 19:39:15 +0000 (19:39 +0000)]
[NFC] Add more tests for D46262

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

5 years ago[NFC] Updated tests for D63546
David Bolvansky [Thu, 20 Jun 2019 19:30:56 +0000 (19:30 +0000)]
[NFC] Updated tests for D63546

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

5 years ago[LFTR] Fix a (latent?) bug related to nested loops
Philip Reames [Thu, 20 Jun 2019 18:45:06 +0000 (18:45 +0000)]
[LFTR] Fix a (latent?) bug related to nested loops

I can't actually come up with a test case this triggers on without an out of tree change, but in theory, it's a bug in the recently added multiple exit LFTR support.  The root issue is that an exiting block common to two loops can (in theory) have computable exit counts for both loops.  Rewriting the exit of an inner loop in terms of the outer loops IV would cause the inner loop to either a) run forever, or b) terminate on the first iteration.

In practice, we appear to get lucky and not have the exit count computable for the outer loop, except when it's trivially zero.  Given we bail on zero exit counts, we don't appear to ever trigger this.  But I can't come up with a reason we *can't* compute an exit count for the outer loop on the common exiting block, so this may very well be triggering in some cases.

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

5 years agogn build: Merge r363948
Nico Weber [Thu, 20 Jun 2019 18:18:40 +0000 (18:18 +0000)]
gn build: Merge r363948

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

5 years ago[X86] Add BLSI to isUseDefConvertible.
Craig Topper [Thu, 20 Jun 2019 17:52:53 +0000 (17:52 +0000)]
[X86] Add BLSI to isUseDefConvertible.

Summary:
BLSI sets the C flag is the input is not zero. So if its followed
by a TEST of the input where only the Z flag is consumed, we can
replace it with the opposite check of the C flag.

We should be able to do the same for BLSMSK and BLSR, but the
naive test case for those is being optimized to a subo by
CodeGenPrepare.

Reviewers: spatel, RKSimon

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[InstCombine] canonicalize check for power-of-2
Sanjay Patel [Thu, 20 Jun 2019 17:41:15 +0000 (17:41 +0000)]
[InstCombine] canonicalize check for power-of-2

The form that compares against 0 is better because:
1. It removes a use of the input value.
2. It's the more standard form for this pattern: https://graphics.stanford.edu/~seander/bithacks.html#DetermineIfPowerOf2
3. It results in equal or better codegen (tested with x86, AArch64, ARM, PowerPC, MIPS).

This is a root cause for PR42314, but probably doesn't completely answer the codegen request:
https://bugs.llvm.org/show_bug.cgi?id=42314

Alive proof:
https://rise4fun.com/Alive/9kG

  Name: is power-of-2
  %neg = sub i32 0, %x
  %a = and i32 %neg, %x
  %r = icmp eq i32 %a, %x
  =>
  %dec = add i32 %x, -1
  %a2 = and i32 %dec, %x
  %r = icmp eq i32 %a2, 0

  Name: is not power-of-2
  %neg = sub i32 0, %x
  %a = and i32 %neg, %x
  %r = icmp ne i32 %a, %x
  =>
  %dec = add i32 %x, -1
  %a2 = and i32 %dec, %x
  %r = icmp ne i32 %a2, 0

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

5 years ago[DAGCombiner] Use getAPIntValue() instead of getZExtValue() where possible.
Simon Pilgrim [Thu, 20 Jun 2019 17:36:23 +0000 (17:36 +0000)]
[DAGCombiner] Use getAPIntValue() instead of getZExtValue() where possible.

Better handling of out-of-i64-range values due to large integer types or from fuzz tests.

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

5 years ago[DAGCombiner][NFC] Remove unused var
Jordan Rupprecht [Thu, 20 Jun 2019 17:30:01 +0000 (17:30 +0000)]
[DAGCombiner][NFC] Remove unused var

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

5 years ago[Tests] Add a tricky LFTR case for documentation purposes
Philip Reames [Thu, 20 Jun 2019 17:16:53 +0000 (17:16 +0000)]
[Tests] Add a tricky LFTR case for documentation purposes

Thought of this case while working on something else.  We appear to get it right in all of the variations I tried, but that's by accident.  So, add a test which would catch the potential bug.

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

5 years agoStore a pointer to the return value in a static alloca and let the debugger use that
Amy Huang [Thu, 20 Jun 2019 17:15:21 +0000 (17:15 +0000)]
Store a pointer to the return value in a static alloca and let the debugger use that
as the variable address for NRVO variables.

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[InstCombine] cttz(-x) -> cttz(x)
David Bolvansky [Thu, 20 Jun 2019 17:04:14 +0000 (17:04 +0000)]
[InstCombine] cttz(-x) -> cttz(x)

Summary: Signedness does not change number of trailing zeros.

Reviewers: spatel, lebedev.ri, nikic

Reviewed By: spatel

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years agoAMDGPU: Eliminate test usage of legacy FP elim attributes
Matt Arsenault [Thu, 20 Jun 2019 17:03:27 +0000 (17:03 +0000)]
AMDGPU: Eliminate test usage of legacy FP elim attributes

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

5 years agoAMDGPU: Fix ignoring DisableFramePointerElim in leaf functions
Matt Arsenault [Thu, 20 Jun 2019 17:03:23 +0000 (17:03 +0000)]
AMDGPU: Fix ignoring DisableFramePointerElim in leaf functions

The attribute can specify elimination for leaf or non-leaf, so it
should always be considered. I copied this bug from AArch64, which
probably should also be fixed.

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

5 years ago[CodeGen] Fix formatting and comments (NFC)
Evandro Menezes [Thu, 20 Jun 2019 16:34:00 +0000 (16:34 +0000)]
[CodeGen] Fix formatting and comments (NFC)

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

5 years ago[AMDGPU] gfx10 tests. NFC.
Stanislav Mekhanoshin [Thu, 20 Jun 2019 16:29:40 +0000 (16:29 +0000)]
[AMDGPU] gfx10 tests. NFC.

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

5 years ago[InstCombine] add commuted variants for power-of-2 checks; NFC
Sanjay Patel [Thu, 20 Jun 2019 16:27:23 +0000 (16:27 +0000)]
[InstCombine] add commuted variants for power-of-2 checks; NFC

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

5 years agoAMDGPU: Treat undef as an inline immediate
Matt Arsenault [Thu, 20 Jun 2019 16:01:09 +0000 (16:01 +0000)]
AMDGPU: Treat undef as an inline immediate

This should only matter in vectors with an undef component, since a
full undef vector would have been folded out.

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

5 years agoAMDGPU: Make test functions hidden
Matt Arsenault [Thu, 20 Jun 2019 15:38:30 +0000 (15:38 +0000)]
AMDGPU: Make test functions hidden

Reduces amount of code in the function from eliminating the GOT load.

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

5 years ago[InstCombine] add tests for checking power-of-2; NFC
Sanjay Patel [Thu, 20 Jun 2019 15:25:18 +0000 (15:25 +0000)]
[InstCombine] add tests for checking power-of-2; NFC

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

5 years ago[NFC][SLP] Pre-commit unary FNeg test to X86/phi3.ll
Cameron McInally [Thu, 20 Jun 2019 15:17:17 +0000 (15:17 +0000)]
[NFC][SLP] Pre-commit unary FNeg test to X86/phi3.ll

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

5 years ago[ARM] Add a batch of MVE integer instructions.
Simon Tatham [Thu, 20 Jun 2019 15:16:56 +0000 (15:16 +0000)]
[ARM] Add a batch of MVE integer instructions.

This includes integer arithmetic of various kinds (add/sub/multiply,
saturating and not), and the immediate forms of VMOV and VMVN that
load an immediate into all lanes of a vector.

Reviewers: dmgreen, samparker, SjoerdMeijer, t.p.northover

Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[AMDGPU] gfx1010 core wave32 changes
Stanislav Mekhanoshin [Thu, 20 Jun 2019 15:08:34 +0000 (15:08 +0000)]
[AMDGPU] gfx1010 core wave32 changes

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

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

5 years agoVirtualize TargetInstrInfo::getRegClass()
Stanislav Mekhanoshin [Thu, 20 Jun 2019 14:59:28 +0000 (14:59 +0000)]
Virtualize TargetInstrInfo::getRegClass()

AMDGPU target needs to override getRegClass() used during
instruction selection. We now may have either 32 or 64 bit
conditional registers used in the same instructions. For
that purpose special SReg_1 register class is created which
is dynamically resolved to either SReg_64 or SGPR_32 depending
on the subtarget attributes.

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

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

5 years ago[yaml2obj] - Convert `ELFState<ELFT>::addSymbols` method to `toELFSymbols` helper...
George Rimar [Thu, 20 Jun 2019 14:44:48 +0000 (14:44 +0000)]
[yaml2obj] - Convert `ELFState<ELFT>::addSymbols` method to `toELFSymbols` helper. NFCI.

ELFState<ELFT>::addSymbols method looks a bit strange.
User code have to create the destination symbols vector outside,
add a null symbol and then pass it to addSymbols when it seems
the more natural logic is to isolate all work with symbols inside some
function, build the list right there and return it.

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

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

5 years ago[DAGCombiner] Support (shl (zext (srl x, C)), C) -> (zext (shl (srl x, C), C)) non...
Simon Pilgrim [Thu, 20 Jun 2019 14:42:27 +0000 (14:42 +0000)]
[DAGCombiner] Support (shl (zext (srl x, C)), C) -> (zext (shl (srl x, C), C)) non-uniform folds.

Use matchBinaryPredicate instead of isConstOrConstSplat to let us handle non-uniform shift cases.

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

5 years ago[SLP][X86] Add lookahead reordering tests from D60897
Simon Pilgrim [Thu, 20 Jun 2019 12:52:58 +0000 (12:52 +0000)]
[SLP][X86] Add lookahead reordering tests from D60897

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

5 years ago[DAGCombine] Add TODOs for some combines that should support non-uniform vectors
Simon Pilgrim [Thu, 20 Jun 2019 12:48:49 +0000 (12:48 +0000)]
[DAGCombine] Add TODOs for some combines that should support non-uniform vectors

We tend to only test for scalar/scalar consts when really we could support non-uniform vectors using ISD::matchUnaryPredicate/matchBinaryPredicate etc.

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

5 years ago[X86] LowerAVXExtend - handle ANY_EXTEND_VECTOR_INREG lowering as well.
Simon Pilgrim [Thu, 20 Jun 2019 11:31:54 +0000 (11:31 +0000)]
[X86] LowerAVXExtend - handle ANY_EXTEND_VECTOR_INREG lowering as well.

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

5 years ago[DAGCombine] Reduce scope of ShAmtVal variable. NFCI.
Simon Pilgrim [Thu, 20 Jun 2019 10:56:37 +0000 (10:56 +0000)]
[DAGCombine] Reduce scope of ShAmtVal variable. NFCI.

Fixes cppcheck warning.

Use the more capable getAPIntVal() instead of getZExtValue() as well since I'm here.

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

5 years ago[llvm-nm] Generalize ELF symbol types 'N' and 'n'
Fangrui Song [Thu, 20 Jun 2019 10:15:11 +0000 (10:15 +0000)]
[llvm-nm] Generalize ELF symbol types 'N' and 'n'

Reviewed By: grimar, jhenderson

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

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

5 years ago[NFC] Update documentation for AtomicCmpXchgInst
Serge Guelton [Thu, 20 Jun 2019 09:37:52 +0000 (09:37 +0000)]
[NFC] Update documentation for AtomicCmpXchgInst

Fix bz#42325

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

5 years agoTargetParserTest.ARMExtensionFeatures run out of memory on 32-bit (PR42316)
Sjoerd Meijer [Thu, 20 Jun 2019 09:33:11 +0000 (09:33 +0000)]
TargetParserTest.ARMExtensionFeatures run out of memory on 32-bit (PR42316)

Nothing of these tests made much sense. Loops were iterating too much, and I
also don't think it was actually testing anything. I think we simply want to
check that AEK_SOME_EXT returns "+some_ext".

I've given the AArch64 tests the same treatment as they very similarly didn't
made any sense either.

This fixes PR42316.

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

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

5 years ago[MIPS GlobalISel] Select integer to floating point conversions
Petar Avramovic [Thu, 20 Jun 2019 09:05:02 +0000 (09:05 +0000)]
[MIPS GlobalISel] Select integer to floating point conversions

Select G_SITOFP and G_UITOFP for MIPS32.

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

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

5 years ago[MIPS GlobalISel] Select floating point to integer conversions
Petar Avramovic [Thu, 20 Jun 2019 08:52:53 +0000 (08:52 +0000)]
[MIPS GlobalISel] Select floating point to integer conversions

Select G_FPTOSI and G_FPTOUI for MIPS32.

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

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

5 years ago[X86] Add test cases showing missed opportunities to use the C flag from the BLSI...
Craig Topper [Thu, 20 Jun 2019 06:45:01 +0000 (06:45 +0000)]
[X86] Add test cases showing missed opportunities to use the C flag from the BLSI instruction to avoid a TEST instruction

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

5 years ago[X86] Remove memory instructions form isUseDefConvertible.
Craig Topper [Thu, 20 Jun 2019 04:58:40 +0000 (04:58 +0000)]
[X86] Remove memory instructions form isUseDefConvertible.

The caller of this is looking for comparisons of the input
to these instructions with 0. But the memory instructions
input is an addess not a value input in a register.

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

5 years ago[X86] Add v64i8/v32i16 to several places in X86CallingConv.td where they seemed obvio...
Craig Topper [Thu, 20 Jun 2019 04:29:00 +0000 (04:29 +0000)]
[X86] Add v64i8/v32i16 to several places in X86CallingConv.td where they seemed obviously missing.

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

5 years agoAMDGPU: Don't clobber VCC in MUBUF addr64 emulation
Matt Arsenault [Thu, 20 Jun 2019 00:51:28 +0000 (00:51 +0000)]
AMDGPU: Don't clobber VCC in MUBUF addr64 emulation

Introducing VCC defs during SIFixSGPRCopies is generally
problematic. Avoid it by starting with the VOP3 form with the general
condition register. This is the easiest to fix instance, but doesn't
solve any specific problems I'm looking at.

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

5 years ago[llvm-objdump] Switch between ARM/Thumb based on mapping symbols.
Eli Friedman [Thu, 20 Jun 2019 00:29:40 +0000 (00:29 +0000)]
[llvm-objdump] Switch between ARM/Thumb based on mapping symbols.

The ARMDisassembler changes allow changing between ARM and Thumb mode
based on the MCSubtargetInfo, rather than the Target, which simplifies
the other changes a bit.

I'm not really happy with adding more target-specific logic to
tools/llvm-objdump/, but there isn't any easy way around it: the logic
in question specifically applies to disassembling an object file, and
that code simply isn't located in lib/Target, at least at the moment.

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

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

5 years agoAMDGPU: Consolidate some getGeneration checks
Matt Arsenault [Wed, 19 Jun 2019 23:54:58 +0000 (23:54 +0000)]
AMDGPU: Consolidate some getGeneration checks

This is incomplete, and ideally these would all be removed, but it's
better to localize them to the subtarget first with comments about
what they're for.

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

5 years ago[FileCheck] Stop qualifying expressions as numeric
Thomas Preud'homme [Wed, 19 Jun 2019 23:47:24 +0000 (23:47 +0000)]
[FileCheck] Stop qualifying expressions as numeric

Summary:
Stop referring to "numeric expression", using simply the term
"expression" instead. Likewise for numeric operation since operations
are only used in numeric expressions.

Reviewers: jhenderson, jdenny, probinson, arichardson

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years agoFileCheck: Return parse error w/ Error & Expected
Thomas Preud'homme [Wed, 19 Jun 2019 23:47:10 +0000 (23:47 +0000)]
FileCheck: Return parse error w/ Error & Expected

Summary:
Make use of Error and Expected to bubble up diagnostics and force
checking of errors in the callers.

Reviewers: jhenderson, jdenny, probinson, arichardson

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years agoAMDGPU: Undo sub x, c canonicalization for v2i16
Matt Arsenault [Wed, 19 Jun 2019 23:37:43 +0000 (23:37 +0000)]
AMDGPU: Undo sub x, c canonicalization for v2i16

Should avoid regression from D62341

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

5 years agoAMDGPU: Add baseline test for vector sub x, c canonicalization
Matt Arsenault [Wed, 19 Jun 2019 22:37:08 +0000 (22:37 +0000)]
AMDGPU: Add baseline test for vector sub x, c canonicalization

This will catch regressions from D62341, and show improvements from a
future patch to fix them.

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

5 years ago[DAGCombine] Use ConstantSDNode::getAPIntValue() instead of getZExtValue().
Simon Pilgrim [Wed, 19 Jun 2019 22:14:24 +0000 (22:14 +0000)]
[DAGCombine] Use ConstantSDNode::getAPIntValue() instead of getZExtValue().

Use getAPIntValue() in a few more places. Most of the time getZExtValue() is fine, but occasionally there's fuzzed code or someone decides to create i65536 or something.....

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

5 years ago[mips] Mark the `lwupc` instruction as MIPS64 R6 only
Simon Atanasyan [Wed, 19 Jun 2019 22:08:06 +0000 (22:08 +0000)]
[mips] Mark the `lwupc` instruction as MIPS64 R6 only

The "The MIPS64 Instruction Set Reference Manual" [1] states that
the `lwupc` is MIPS64 Release 6 only. It should not be supported
for 32-bit CPUs.

[1] https://s3-eu-west-1.amazonaws.com/downloads-mips/documents/MD00087-2B-MIPS64BIS-AFP-6.06.pdf

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

5 years ago[mips] Add (GPR|PTR)_64 predicates to PseudoReturn64 and PseudoIndirectHazardBranch64
Simon Atanasyan [Wed, 19 Jun 2019 22:07:46 +0000 (22:07 +0000)]
[mips] Add (GPR|PTR)_64 predicates to PseudoReturn64 and PseudoIndirectHazardBranch64

This patch is one of a series of patches. The goal is to make P5600
scheduler model complete and turn on the `CompleteModel` flag.

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

5 years ago[Util] Add a helper script for converting -print-before-all output into a file based...
Philip Reames [Wed, 19 Jun 2019 22:05:47 +0000 (22:05 +0000)]
[Util] Add a helper script for converting -print-before-all output into a file based equivelent

Simple little utility which takes a opt logfile generated with "opt -print-before-all -print-module-scope -o /dev/null <args> 2&>1", and splits into a series of individual "chunk-X.ll" files. The intended purpose is to help automate one step in failure reduction.

The imagined workflow is:

    New crasher bug reported against clang or other frontend
    Frontend run with -emit-llvm equivalent and manually confirmed that opt -O2 <emit.ll> crashes
    Run this splitter script
    Manually map pass name to invocation command (next on the to automate list)
    Run bugpoint on last chunk file + manual command

I chose to dump every chunk rather than only the last since miscompile debugging frequently requires either manual step by step reduction, or cross feeding IR into different compiler versions. Not an immediate target, but there may be applications.

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

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

5 years agoLFTR for multiple exit loops
Philip Reames [Wed, 19 Jun 2019 21:58:25 +0000 (21:58 +0000)]
LFTR for multiple exit loops

Teach IndVarSimply's LinearFunctionTestReplace transform to handle multiple exit loops. LFTR does two key things 1) it rewrites (all) exit tests in terms of a common IV potentially eliminating one in the process and 2) it moves any offset/indexing/f(i) style logic out of the loop.

This turns out to actually be pretty easy to implement. SCEV already has all the information we need to know what the backedge taken count is for each individual exit. (We use that when computing the BE taken count for the loop as a whole.) We basically just need to iterate through the exiting blocks and apply the existing logic with the exit specific BE taken count. (The previously landed NFC makes this super obvious.)

I chose to go ahead and apply this to all loop exits instead of only latch exits as originally proposed. After reviewing other passes, the only case I could find where LFTR form was harmful was LoopPredication. I've fixed the latch case, and guards aren't LFTRed anyways. We'll have some more work to do on the way towards widenable_conditions, but that's easily deferred.

I do want to note that I added one bit after the review.  When running tests, I saw a new failure (no idea why didn't see previously) which pointed out LFTR can rewrite a constant condition back to a loop varying one.  This was theoretically possible with a single exit, but the zero case covered it in practice.  With multiple exits, we saw this happening in practice for the eliminate-comparison.ll test case because we'd compute a ExitCount for one of the exits which was guaranteed to never actually be reached.  Since LFTR ran after simplifyAndExtend, we'd immediately turn around and undo the simplication work we'd just done.  The solution seemed obvious, so I didn't bother with another round of review.

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

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

5 years ago[Tests] Autogen a test so that future changes are understandable
Philip Reames [Wed, 19 Jun 2019 21:39:07 +0000 (21:39 +0000)]
[Tests] Autogen a test so that future changes are understandable

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

5 years ago[MemorySSA] Cleanup trivial phis.
Alina Sbirlea [Wed, 19 Jun 2019 21:33:09 +0000 (21:33 +0000)]
[MemorySSA] Cleanup trivial phis.

Summary:
This is unfortunately needed for correctness, if we are to extend the tolerance of the update API to the way simple loop unswitch is doing cloning.

In simple loop unswitch (as opposed to loop unswitch), not all blocks are cloned. This can create unreachable cloned blocks (no predecessor), which are later cleaned up.

In MemorySSA, the  APIs for supporting these kind of updates (clone + update exit blocks), make certain assumption on the integrity of the CFG. When cloning, if something was not cloned, it's values in MemorySSA default to LiveOnEntry. When updating exit blocks, it is safe to assume that we can first insert phis in the blocks merging two clones, then add additional phis in the IDF of the blocks that received phis. This no longer holds true if one of the clones being merged comes from an unreachable block. We'd conservatively need to add all phis before filling in their incoming definitions. In practice this restriction can be relaxed if we clean up trivial phis after the first round of insertion.

Reviewers: george.burgess.iv

Subscribers: jlebar, Prazek, llvm-commits

Tags: #llvm

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

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

5 years ago[MemorySSA] Use GraphDiff info when computing IDF.
Alina Sbirlea [Wed, 19 Jun 2019 21:17:31 +0000 (21:17 +0000)]
[MemorySSA] Use GraphDiff info when computing IDF.

Summary:
When computing IDF for insert updates, ensure we use the snapshot CFG offered by GraphDiff.
Caught by D63389.

Reviewers: kuhar, george.burgess.iv

Subscribers: jlebar, Prazek, llvm-commits, Szelethus

Tags: #llvm

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

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

5 years ago[LFTR] Stylistic cleanup as suggested in last review comment of D62939 [NFC]
Philip Reames [Wed, 19 Jun 2019 20:45:57 +0000 (20:45 +0000)]
[LFTR] Stylistic cleanup as suggested in last review comment of D62939 [NFC]

(Resumbit of r363292 which was reverted along w/an earlier patch)

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

5 years agoAMDGPU: Fix folding immediate into readfirstlane through reg_sequence
Matt Arsenault [Wed, 19 Jun 2019 20:44:15 +0000 (20:44 +0000)]
AMDGPU: Fix folding immediate into readfirstlane through reg_sequence

The def instruction for the vreg may not match, because it may be
folding through a reg_sequence. The assert was overly conservative and
not necessary. It's not actually important if DefMI really defined the
register, because the fold that will be done cares about the def of
the value that will be folded.

For some reason copies aren't making it through the reg_sequence,
although they should.

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

5 years ago[LFTR] Rename variable to minimize confusion [NFC]
Philip Reames [Wed, 19 Jun 2019 20:41:28 +0000 (20:41 +0000)]
[LFTR] Rename variable to minimize confusion [NFC]

(Recommit of r363293 which was reverted when a dependent patch was.)

As pointed out by Nikita in D62625, BackedgeTakenCount is generally used to refer to the backedge taken count of the loop. A conditional backedge taken count - one which only applies if a particular exit is taken - is called a ExitCount in SCEV code, so be consistent here.

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

5 years agohwasan: Shrink outlined checks by 1 instruction.
Peter Collingbourne [Wed, 19 Jun 2019 20:40:03 +0000 (20:40 +0000)]
hwasan: Shrink outlined checks by 1 instruction.

Turns out that we can save an instruction by folding the right shift into
the compare.

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

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

5 years agoReapply "AMDGPU: Add ds_gws_init / ds_gws_barrier intrinsics"
Matt Arsenault [Wed, 19 Jun 2019 19:55:27 +0000 (19:55 +0000)]
Reapply "AMDGPU: Add ds_gws_init / ds_gws_barrier intrinsics"

This reapplies r363678, using the correct chain for the CopyToReg for
v0. glueCopyToM0 counterintuitively changes the operands of the
original node.

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

5 years ago[llvm-readobj] Match GNU output for DT_RPATH and DT_RUNPATH when dumping dynamic...
Yuanfang Chen [Wed, 19 Jun 2019 19:31:07 +0000 (19:31 +0000)]
[llvm-readobj] Match GNU output for DT_RPATH and DT_RUNPATH when dumping dynamic symbol table.

Reviewers: jhenderson, grimar, MaskRay, rupprecht, espindola

Subscribers: emaste, nemanjai, arichardson, kbarton, llvm-commits

Tags: #llvm

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

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