platform/upstream/llvm.git
6 years ago[Pipeliner] Fix calculation when reusing phis
Krzysztof Parzyszek [Mon, 26 Mar 2018 16:10:48 +0000 (16:10 +0000)]
[Pipeliner] Fix calculation when reusing phis

A schedule may require that a phi from the original loop is used in
multiple iterations in the scheduled loop. When this occurs, we generate
multiple phis in the pipelined loop to save the value across iterations.

When we generate the new phis and update the register names in the
pipelined loop, the pipeliner attempts to reuse a previously generated
phi, when possible. The calculation for the name of the new phi needs
to account for the version/iteration of the original phi. Also, in the
epilog, the code only needs to check backwards for a previous iteration
until reaching the first prolog block.

Patch by Brendon Cahoon.

llvm-svn: 328537

6 years ago[X86][Btver2] Account for the "+i" integer pipe transfer costs (1cy use of JALU0...
Simon Pilgrim [Mon, 26 Mar 2018 16:10:08 +0000 (16:10 +0000)]
[X86][Btver2] Account for the "+i" integer pipe transfer costs (1cy use of JALU0 for GPR PRF write)

llvm-svn: 328536

6 years ago[Pipeliner] Fix check for order dependences when finalizing instructions
Krzysztof Parzyszek [Mon, 26 Mar 2018 16:05:55 +0000 (16:05 +0000)]
[Pipeliner] Fix check for order dependences when finalizing instructions

The code in orderDepdences that looks at the order dependences between
instructions was processing all the successor and predecessor order
dependences. However, we really only want to check for an order dependence
for instructions scheduled in the same cycle.

Also, fixed how the pipeliner handles output dependences. An output
dependence is also a potential loop carried dependence. The pipeliner
didn't handle this case properly so an invalid schedule could be created
that allowed an output dependence to be scheduled in the next iteration
at the same cycle.

Patch by Brendon Cahoon.

llvm-svn: 328516

6 years ago[Pipeliner] Fix in the pipeliner phi reuse code
Krzysztof Parzyszek [Mon, 26 Mar 2018 15:58:16 +0000 (15:58 +0000)]
[Pipeliner] Fix in the pipeliner phi reuse code

When the definition of a phi is used by a phi in the next iteration,
the pipeliner was assuming that the definition is processed first.
Because of the assumption, an incorrect phi name was used. This patch
has a check to see if the phi definition has been processed already.

Patch by Brendon Cahoon.

llvm-svn: 328510

6 years ago[Pipeliner] Pipeliner should mark physical registers as used
Krzysztof Parzyszek [Mon, 26 Mar 2018 15:53:23 +0000 (15:53 +0000)]
[Pipeliner] Pipeliner should mark physical registers as used

The software pipeliner attempts to delete dead instructions after
generating the pipelined loop. The code looks for uses of each
instruction. Physical registers should be treated differently because
the use chains do not exist. The code that checks for dead
instructions should assume that definitions of physical registers
are used if the operand doesn't contain the dead flag.

Patch by Brendon Cahoon.

llvm-svn: 328509

6 years ago[Pipeliner] Correctly update memoperands in the epilog
Krzysztof Parzyszek [Mon, 26 Mar 2018 15:45:55 +0000 (15:45 +0000)]
[Pipeliner] Correctly update memoperands in the epilog

The pipeliner needs to be conservative when updating the memoperands
of instructions in the epilog. Previously, the pipeliner was changing
the offset of the memoperand based upon the scheduling stage. However,
that is incorrect when control flow branches around the kernel code.
The bug enabled a load and store to the same stack offset to be swapped.

This patch fixes the bug by updating the size of the memoperands to be
UINT_MAX. This conservative value means that dependences will be created
between other loads and stores.

Patch by Brendon Cahoon.

llvm-svn: 328508

6 years ago[demangler] Fix a bug in r328464 found by oss-fuzz.
Erik Pilkington [Mon, 26 Mar 2018 15:34:36 +0000 (15:34 +0000)]
[demangler] Fix a bug in r328464 found by oss-fuzz.

llvm-svn: 328507

6 years ago[Hexagon] Give priority to post-incremementing memory accesses in LSR
Krzysztof Parzyszek [Mon, 26 Mar 2018 15:32:03 +0000 (15:32 +0000)]
[Hexagon] Give priority to post-incremementing memory accesses in LSR

llvm-svn: 328506

6 years ago[X86][Btver2] Add CVTSD2SI/CVTSS2SI scheduler costs
Simon Pilgrim [Mon, 26 Mar 2018 15:30:47 +0000 (15:30 +0000)]
[X86][Btver2] Add CVTSD2SI/CVTSS2SI scheduler costs

Account for the "+i" integer pipe transfer cost (1cy use of JALU0 for GPR PRF write)

This also adds missing vcvttss2si tests

llvm-svn: 328505

6 years agoFix TestDisassembleBreakpoint broken by r328488
Pavel Labath [Mon, 26 Mar 2018 15:17:58 +0000 (15:17 +0000)]
Fix TestDisassembleBreakpoint broken by r328488

The first issue was that the test was capturing the "before" disassembly
before launching, and the "after" after. This is a problem because some
of the disassembly will change after we know the load address (e.g. PCs
in call instructions). I fix this by capturing both disassemblies with
the process running.

The second issue was that the refactor in r328488 accidentaly changed
the meaning of the test, as it was no longer disassembling the function
which contained the breakpoint.

While inside, I also modernize the test to use
lldbutil.run_to_source_breakpoint and prevent debug-info replication.

llvm-svn: 328504

6 years agoMigrate dockerfiles to use multi-stage builds.
Ilya Biryukov [Mon, 26 Mar 2018 15:12:30 +0000 (15:12 +0000)]
Migrate dockerfiles to use multi-stage builds.

Summary:
We previously emulated multi-staged builds using two dockerfiles,
native support from Docker allows us to merge them into one,
simplifying our scripts.

For more details about multi-stage builds, see:
https://docs.docker.com/develop/develop-images/multistage-build/

Reviewers: mehdi_amini, klimek, sammccall

Reviewed By: sammccall

Subscribers: llvm-commits, ioeric, cfe-commits

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

llvm-svn: 328503

6 years ago[InstCombine] distribute fmul over fadd/fsub
Sanjay Patel [Mon, 26 Mar 2018 15:03:57 +0000 (15:03 +0000)]
[InstCombine] distribute fmul over fadd/fsub

This replaces a large chunk of code that was looking for compound
patterns that include these sub-patterns. Existing tests ensure that
all of the previous examples are still folded as expected.

We still need to loosen the FMF check.

llvm-svn: 328502

6 years ago[X86][Btver2] Fix YMM BLENDPD/BLENDPS + UNPCKPD/UNPCKP instructions costs
Simon Pilgrim [Mon, 26 Mar 2018 14:44:24 +0000 (14:44 +0000)]
[X86][Btver2] Fix YMM BLENDPD/BLENDPS + UNPCKPD/UNPCKP instructions costs

These should match the YMM MOVDUP/ PERMILPD/PERMILPS + SHUFPD/SHUFPS shuffles instead of using the WriteFShuffle defaults.

llvm-svn: 328501

6 years ago[clangd] Support incremental document syncing
Simon Marchi [Mon, 26 Mar 2018 14:41:40 +0000 (14:41 +0000)]
[clangd] Support incremental document syncing

Summary:
This patch adds support for incremental document syncing, as described
in the LSP spec.  The protocol specifies ranges in terms of Position (a
line and a character), and our drafts are stored as plain strings.  So I
see two things that may not be super efficient for very large files:

- Converting a Position to an offset (the positionToOffset function)
  requires searching for end of lines until we reach the desired line.
- When we update a range, we construct a new string, which implies
  copying the whole document.

However, for the typical size of a C++ document and the frequency of
update (at which a user types), it may not be an issue.  This patch aims
at getting the basic feature in, and we can always improve it later if
we find it's too slow.

Signed-off-by: Simon Marchi <simon.marchi@ericsson.com>
Reviewers: malaperle, ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: MaskRay, klimek, mgorny, ilya-biryukov, jkorous-apple, ioeric, cfe-commits

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

llvm-svn: 328500

6 years ago[llvm-mca] Fix how views are added to the InstructionTables.
Andrea Di Biagio [Mon, 26 Mar 2018 14:25:52 +0000 (14:25 +0000)]
[llvm-mca] Fix how views are added to the InstructionTables.

This should fix the stack-use-after-scope reported by the asan buildbots after
revision 328493.

llvm-svn: 328499

6 years ago[InstCombine] check uses before creating instructions for fmul distribution
Sanjay Patel [Mon, 26 Mar 2018 14:25:43 +0000 (14:25 +0000)]
[InstCombine] check uses before creating instructions for fmul distribution

As the tests show, we could create extra instructions without any obvious benefit.

llvm-svn: 328498

6 years ago[X86][Btver2] Add (V)SQRTPD/(V)SQRTSD costs
Simon Pilgrim [Mon, 26 Mar 2018 14:03:40 +0000 (14:03 +0000)]
[X86][Btver2] Add (V)SQRTPD/(V)SQRTSD costs

The xmm sd/pd versions were using the WriteFSQRT default which is modelled on sqrtss/sqrtps

llvm-svn: 328497

6 years agoAMDGPU: Introduce common SOP_Pseudo and VOP_Pseudo TableGen base classes
Nicolai Haehnle [Mon, 26 Mar 2018 13:56:53 +0000 (13:56 +0000)]
AMDGPU: Introduce common SOP_Pseudo and VOP_Pseudo TableGen base classes

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

Change-Id: I732979e2964006aa15d78a333d8886e6855f319a
llvm-svn: 328496

6 years ago[clang-format] Wildcard expansion on Windows.
Alexander Kornienko [Mon, 26 Mar 2018 13:54:17 +0000 (13:54 +0000)]
[clang-format] Wildcard expansion on Windows.

Summary:
Add support for wildcard expansion in command line arguments on Windows.
See https://docs.microsoft.com/en-us/cpp/c-language/expanding-wildcard-arguments

Fixes https://bugs.llvm.org/show_bug.cgi?id=17217

Reviewers: klimek, djasper, rnk

Reviewed By: rnk

Subscribers: rnk, smeenai, zturner, alexfh, mgorny, cfe-commits

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

llvm-svn: 328495

6 years ago[SemaCXX] _Pragma("clang optimize off") not affecting lambda.
Carlos Alberto Enciso [Mon, 26 Mar 2018 13:48:03 +0000 (13:48 +0000)]
[SemaCXX] _Pragma("clang optimize off") not affecting lambda.

Declaring "_Pragma("clang optimize off")" before the body of a
function with a lambda leads to the lambda functions in the body
not being affected.

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

llvm-svn: 328494

6 years ago[llvm-mca] Add a flag -instruction-info to enable/disable the instruction info view.
Andrea Di Biagio [Mon, 26 Mar 2018 13:44:54 +0000 (13:44 +0000)]
[llvm-mca] Add a flag -instruction-info to enable/disable the instruction info view.

llvm-svn: 328493

6 years ago[llvm-mca] Update the commandline docs after r328305.
Andrea Di Biagio [Mon, 26 Mar 2018 13:21:48 +0000 (13:21 +0000)]
[llvm-mca] Update the commandline docs after r328305.

Document that flag -resource-pressure can be used to enable/disable the resource
pressure view. This change should have been part of r328305.

llvm-svn: 328492

6 years ago[X86][Btver2] Double the AGU and schedule pipe resources for YMM
Simon Pilgrim [Mon, 26 Mar 2018 13:15:20 +0000 (13:15 +0000)]
[X86][Btver2] Double the AGU and schedule pipe resources for YMM

Both the AGUs and schedule pipes are double pumped for 256-bit instructions as well as the functional units which we already model.

llvm-svn: 328491

6 years ago[LSR] Allow giving priority to post-incrementing addressing modes
Krzysztof Parzyszek [Mon, 26 Mar 2018 13:10:09 +0000 (13:10 +0000)]
[LSR] Allow giving priority to post-incrementing addressing modes

Implement TTI interface for targets to indicate that the LSR should give
priority to post-incrementing addressing modes.

Combination of patches by Sebastian Pop and Brendon Cahoon.

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

llvm-svn: 328490

6 years agoMake @skipUnlessSupportedTypeAttribute windows-compatible
Pavel Labath [Mon, 26 Mar 2018 12:47:40 +0000 (12:47 +0000)]
Make @skipUnlessSupportedTypeAttribute windows-compatible

- close_fds is not compatible with stdin/out redirection on windows. I
  just remove it, as this is not required for correct operation.
- the command string was assuming a posix shell. I rewrite the Popen
  invocation to avoid the need for passing the arguments through a shell.

llvm-svn: 328489

6 years agoAdd and fix some tests for PPC64
Pavel Labath [Mon, 26 Mar 2018 12:42:07 +0000 (12:42 +0000)]
Add and fix some tests for PPC64

Summary:
TestExprsChar.py
Char is unsigned char by default in PowerPC.

TestDisassembleBreakpoint.py
Modify disassemble testcase to consider multiple architectures.

TestThreadJump.py
Jumping directly to the return line on PowerPC architecture dos not
means returning the value that is seen on the code. The last test fails,
because it needs the execution of some assembly in the beginning of the
function. Avoiding this test for this architecture.

TestEhFrameUnwind.py
Implement func for ppc64le test case.

TestWatchLocation.py
TestStepOverWatchpoint.py
PowerPC currently supports only one H/W watchpoint.

TestDisassembleRawData.py
Add PowerPC opcode and instruction for disassemble testcase.

Reviewers: labath

Reviewed By: labath

Subscribers: davide, labath, alexandreyy, lldb-commits, luporl, lbianc

Differential Revision: https://reviews.llvm.org/D44472
Patch by Alexandre Yukio Yamashita <alexandre.yamashita@eldorado.org.br>.

llvm-svn: 328488

6 years ago[llvm-mca] Add flag -instruction-tables to print the theoretical resource pressure...
Andrea Di Biagio [Mon, 26 Mar 2018 12:04:53 +0000 (12:04 +0000)]
[llvm-mca] Add flag -instruction-tables to print the theoretical resource pressure distribution for instructions (PR36874)

The goal of this patch is to address most of PR36874.  To fully fix PR36874 we
need to split the "InstructionInfo" view from the "SummaryView". That would make
easy to check the latency and rthroughput as well.

The patch reuses all the logic from ResourcePressureView to print out the
"instruction tables".

We have an entry for every instruction in the input sequence. Each entry reports
the theoretical resource pressure distribution. Resource pressure is uniformly
distributed across all the processor resource units of a group.

At the moment, the backend pipeline is not configurable, so the only way to fix
this is by creating a different driver that simply sends instruction events to
the resource pressure view.  That means, we don't use the Backend interface.
Instead, it is simpler to just have a different code-path for when flag
-instruction-tables is specified.

Once Clement addresses bug 36663, then we can port the "instruction tables"
logic into a stage of our configurable pipeline.

Updated the BtVer2 test cases (thanks Simon for the help). Now we pass flag
-instruction-tables to each modified test.

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

llvm-svn: 328487

6 years ago[LLDB][PPC64] Fix TestGdbRemoteAuxvSupport
Pavel Labath [Mon, 26 Mar 2018 12:00:52 +0000 (12:00 +0000)]
[LLDB][PPC64] Fix TestGdbRemoteAuxvSupport

Summary: PPC64's auxvec has a special key that must be ignored.

Reviewers: clayborg, labath

Reviewed By: clayborg, labath

Subscribers: alexandreyy, lbianc

Differential Revision: https://reviews.llvm.org/D43771
Patch by Leandro Lupori <leandro.lupori@gmail.com>.

llvm-svn: 328486

6 years agoAdd a test for setting the load address of a module with differing physical/virtual...
Pavel Labath [Mon, 26 Mar 2018 11:45:32 +0000 (11:45 +0000)]
Add a test for setting the load address of a module with differing physical/virtual addresses

Summary:
First attempt at landing D42145 was reverted because it caused test
failures on some android devices. It turned out this was because these
devices had vdso modules with differing physical and virtual addresses.
This was not caught earlier because all of the modules in our tests
either lack physical addresses or have them identical to virtual ones.

In the discussion on the patch, we came to the conclusion that in the
scenario where we are merely setting a load address of a module (for
example from a dynamic loader plugin), we should always use virtual
addresses (i.e., preserve status quo). This patch adds a test to make
sure we don't regress in that direction.

Reviewers: owenpshaw

Subscribers: lldb-commits

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

llvm-svn: 328485

6 years agoTest commit - adding a new line.
Carlos Alberto Enciso [Mon, 26 Mar 2018 11:38:01 +0000 (11:38 +0000)]
Test commit - adding a new line.

llvm-svn: 328484

6 years ago[LoopUnroll] Fix dangling pointers in SCEV
Max Kazantsev [Mon, 26 Mar 2018 11:31:46 +0000 (11:31 +0000)]
[LoopUnroll] Fix dangling pointers in SCEV

Current logic of loop SCEV invalidation in Loop Unroller implicitly relies on
fact that exit count of outer loops cannot rely on exiting blocks of
inner loops, which is true in current implementation of backedge taken count
calculation but is wrong in general. As result, when we only forget the loop that
we have just unrolled, we may still have cached data for its outer loops (in particular,
exit counts) which keeps references on blocks of inner loop that could have been
changed or even deleted.

The attached test demonstrates a situaton when after unrolling of innermost loop
the outermost loop contains a dangling pointer on non-existant block. The problem
shows up when we apply patch https://reviews.llvm.org/D44677 that makes SCEV
smarter about exit count calculation. I am not sure if the bug exists without this patch,
it appears that now it is accidentally correct just because in practice exact backedge
taken count for outer loops with complex control flow inside is never calculated.
But when SCEV learns to do so, this problem shows up.

This patch replaces existing logic of SCEV loop invalidation with a correct one, which
happens to be invalidation of outermost loop (which also leads to invalidation of all
loops inside of it). It is the only way to ensure that no outer loop keeps dangling pointers
on removed blocks, or just outdated information that has changed after unrolling.

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

llvm-svn: 328483

6 years agoRevert r328386 "[X86] Fix Windows `i1 zeroext` conventions to use i8 instead of i32"
Hans Wennborg [Mon, 26 Mar 2018 10:07:51 +0000 (10:07 +0000)]
Revert r328386 "[X86] Fix Windows `i1 zeroext` conventions to use i8 instead of i32"

This broke Chromium (see crbug.com/825748). It looks like mstorsjo's follow-up
patch at D44876 fixes this, but let's revert back to green for now until that's
ready to land.

(Also reverts r328443.)

> Both GCC and MSVC only look at the low byte of a boolean when it is
> passed.

llvm-svn: 328482

6 years ago[DeadArgElim] Strip allocsize attributes when deleting an argument.
Benjamin Kramer [Mon, 26 Mar 2018 09:44:24 +0000 (09:44 +0000)]
[DeadArgElim] Strip allocsize attributes when deleting an argument.

Since allocsize refers to the argument number it gets invalidated when
an argument is removed and the numbers shift.

llvm-svn: 328481

6 years ago[IRCE] Enable increasing loops of variable bounds
Sam Parker [Mon, 26 Mar 2018 09:29:42 +0000 (09:29 +0000)]
[IRCE] Enable increasing loops of variable bounds

CanBeMin is currently used which will report true for any unknown
values, but often a check is performed outside the loop which covers
this situation:

for (int i = 0; i < N; ++i)
  ...

if (N > 0)
  for (int i = 0; i < N; ++i)
    ...

So I've add 'LoopGuardedAgainstMin' which reports whether N is
greater than the minimum value which then allows loop with a variable
loop count to be optimised. I've also moved the increasing bound
checking into its own function and replaced SumCanReachMax is another
isLoopEntryGuardedByCond function.

llvm-svn: 328480

6 years agoThis is PR36799.
George Rimar [Mon, 26 Mar 2018 08:58:16 +0000 (08:58 +0000)]
This is PR36799.

Currently, we might have a bug with scripts like below:

.foo : ALIGN(8)
{
  *(.foo)
} > ram
because do not expand the memory region when doing ALIGN.

This might result in file range overlaps. The patch fixes the issue.

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

llvm-svn: 328479

6 years ago[ARM] Simplify constructing the ARMArchFeature string. NFC.
Martin Storsjo [Mon, 26 Mar 2018 08:41:10 +0000 (08:41 +0000)]
[ARM] Simplify constructing the ARMArchFeature string. NFC.

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

llvm-svn: 328478

6 years agoFix test case initialization issues in permissions test
Eric Fiselier [Mon, 26 Mar 2018 07:06:25 +0000 (07:06 +0000)]
Fix test case initialization issues in permissions test

llvm-svn: 328477

6 years agoImplement filesystem::perm_options specified in NB comments.
Eric Fiselier [Mon, 26 Mar 2018 06:23:55 +0000 (06:23 +0000)]
Implement filesystem::perm_options specified in NB comments.

The NB comments for filesystem changed permissions and added
a new enum `perm_options` which control how the permissions
are applied.

This implements than NB resolution

llvm-svn: 328476

6 years agoMake filesystem tests generic between experimental and std versions.
Eric Fiselier [Mon, 26 Mar 2018 05:46:57 +0000 (05:46 +0000)]
Make filesystem tests generic between experimental and std versions.

As I move towards implementing std::filesystem, there is a need to
make the existing tests run against both the std and experimental versions.
Additionally, it's helpful to allow running the tests against other
implementations of filesystem.

This patch converts the test to easily target either. First, it
adds a filesystem_include.hpp header which is soley responsible
for selecting and including the correct implementation. Second,
it converts existing tests to use this header instead of including
filesystem directly.

llvm-svn: 328475

6 years ago[X86] Fix the SchedRW for intrinsic register form of SQRT/RCP/RSQRT.
Craig Topper [Mon, 26 Mar 2018 05:05:12 +0000 (05:05 +0000)]
[X86] Fix the SchedRW for intrinsic register form of SQRT/RCP/RSQRT.

llvm-svn: 328474

6 years ago[X86] Merge the SSE and AVX versions of fp divs and sqrts in the SandyBridge/Haswell...
Craig Topper [Mon, 26 Mar 2018 05:05:10 +0000 (05:05 +0000)]
[X86] Merge the SSE and AVX versions of fp divs and sqrts in the SandyBridge/Haswell/Broadwell/Skylake scheduler models.

I've used Agner's data as best I could to get the values to converge on.

llvm-svn: 328473

6 years ago[X86] Add itinerary to intrinsic version of sqrtss, rcpss, and rsqrtss instructions.
Craig Topper [Mon, 26 Mar 2018 04:20:36 +0000 (04:20 +0000)]
[X86] Add itinerary to intrinsic version of sqrtss, rcpss, and rsqrtss instructions.

llvm-svn: 328472

6 years ago[X86] Correct the itineraries for the dot production instructions.
Craig Topper [Mon, 26 Mar 2018 02:17:15 +0000 (02:17 +0000)]
[X86] Correct the itineraries for the dot production instructions.

llvm-svn: 328471

6 years ago[X86] Use the same itinerary for VCVTDQ2PD as the SSE version so that the generated...
Craig Topper [Mon, 26 Mar 2018 02:17:14 +0000 (02:17 +0000)]
[X86] Use the same itinerary for VCVTDQ2PD as the SSE version so that the generated scheduler classes will merge.

llvm-svn: 328470

6 years ago[X86] Swap the itineraries on the memory and register forms of CVTDQ2PD.
Craig Topper [Mon, 26 Mar 2018 02:17:13 +0000 (02:17 +0000)]
[X86] Swap the itineraries on the memory and register forms of CVTDQ2PD.

They were backwards.

llvm-svn: 328469

6 years ago[X86] Give VMOVSX/ZX the same itinerary as the SSE version so they'll reuse the same...
Craig Topper [Mon, 26 Mar 2018 02:17:12 +0000 (02:17 +0000)]
[X86] Give VMOVSX/ZX the same itinerary as the SSE version so they'll reuse the same generated scheduler class.

llvm-svn: 328468

6 years ago[sanitizer] Make test compatible with Darwin
Vitaly Buka [Mon, 26 Mar 2018 01:29:48 +0000 (01:29 +0000)]
[sanitizer] Make test compatible with Darwin

llvm-svn: 328467

6 years ago[X86] Give vpmsadbw the same itinerary as the SSE version so they'll be able to share...
Craig Topper [Sun, 25 Mar 2018 23:52:06 +0000 (23:52 +0000)]
[X86] Give vpmsadbw the same itinerary as the SSE version so they'll be able to share the same generated scheduler class.

llvm-svn: 328466

6 years ago[X86] Move (v)movss to port 5 only for Skylake. Move (v)movups/d to port 015 for...
Craig Topper [Sun, 25 Mar 2018 23:40:56 +0000 (23:40 +0000)]
[X86] Move (v)movss to port 5 only for Skylake. Move (v)movups/d to port 015 for Skylake.

This matches Agner's data and is consistent with what the EVEX instructions were doing on SKX.

llvm-svn: 328465

6 years ago[demangler] Use a back-patching scheme to resolve forward references.
Erik Pilkington [Sun, 25 Mar 2018 22:50:33 +0000 (22:50 +0000)]
[demangler] Use a back-patching scheme to resolve forward references.

Strictly in a conversion operator's type, a <template-param> refers to a
<template-arg> that is further ahead in the mangled name. Instead of
doing a second parse to resolve these, introduce a
ForwardTemplateReference Node and back-patch the referenced
<template-arg> when we're in the right context.

This is also a correctness fix, previously we would only do a second
parse if the <template-param> was out of bounds in the current set of
<template-args>. This lead to misdemangles (gasp!) when the conversion
operator was a member of a templated struct, for instance.

llvm-svn: 328464

6 years ago[demangler] Tweak how parameter pack sizes are determined.
Erik Pilkington [Sun, 25 Mar 2018 22:49:57 +0000 (22:49 +0000)]
[demangler] Tweak how parameter pack sizes are determined.

Rather than eagerly propagating up parameter pack sizes in Node ctors,
find the parameter pack size during printing. This is being done to
support back-patching forward referencing <template-param>s.

llvm-svn: 328463

6 years ago[demangler] Support for clang's enable_if attribute.
Erik Pilkington [Sun, 25 Mar 2018 22:49:16 +0000 (22:49 +0000)]
[demangler] Support for clang's enable_if attribute.

Fixes PR33569.

llvm-svn: 328462

6 years ago[PatternMatch] allow undef elements when matching vector FP +0.0
Sanjay Patel [Sun, 25 Mar 2018 21:16:33 +0000 (21:16 +0000)]
[PatternMatch] allow undef elements when matching vector FP +0.0

This continues the FP constant pattern matching improvements from:
https://reviews.llvm.org/rL327627
https://reviews.llvm.org/rL327339
https://reviews.llvm.org/rL327307

Several integer constant matchers also have this ability. I'm
separating matching of integer/pointer null from FP positive zero
and renaming/commenting to make the functionality clearer.

llvm-svn: 328461

6 years ago[X86] Use WriteResPair for WriteIDiv to cleanup sched defs. NFCI.
Simon Pilgrim [Sun, 25 Mar 2018 20:16:53 +0000 (20:16 +0000)]
[X86] Use WriteResPair for WriteIDiv to cleanup sched defs. NFCI.

llvm-svn: 328460

6 years ago[SchedModel] Remove instregex entries that don't match any instructions
Simon Pilgrim [Sun, 25 Mar 2018 19:20:08 +0000 (19:20 +0000)]
[SchedModel] Remove instregex entries that don't match any instructions

This patch throws a fatal error if an instregex entry doesn't actually match any instructions. This is part of the work to reduce the compile time impact of increased instregex usage (PR35955), although the x86 models seem to be relatively clean.

All the cases I encountered have now been fixed in trunk and this will ensure they don't get reintroduced.

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

llvm-svn: 328459

6 years ago[X86][SkylakeClient] Fix missing comma
Simon Pilgrim [Sun, 25 Mar 2018 19:17:17 +0000 (19:17 +0000)]
[X86][SkylakeClient] Fix missing comma

llvm-svn: 328458

6 years ago[ARM] Remove sched model instregex entries that don't match any instructions (D44687)
Simon Pilgrim [Sun, 25 Mar 2018 19:07:17 +0000 (19:07 +0000)]
[ARM] Remove sched model instregex entries that don't match any instructions (D44687)

Reviewed by @javed.absar

llvm-svn: 328457

6 years ago[X86] Add missing full stop to comment. NFCI.
Simon Pilgrim [Sun, 25 Mar 2018 18:49:48 +0000 (18:49 +0000)]
[X86] Add missing full stop to comment. NFCI.

llvm-svn: 328456

6 years ago[InstSimplify, InstCombine] add/update tests with FP +0.0 vector with undef; NFC
Sanjay Patel [Sun, 25 Mar 2018 17:48:20 +0000 (17:48 +0000)]
[InstSimplify, InstCombine] add/update tests with FP +0.0 vector with undef; NFC

llvm-svn: 328455

6 years ago[X86][SkylakeClient] Fix a set of regular expressions that were checking for optional...
Craig Topper [Sun, 25 Mar 2018 17:33:14 +0000 (17:33 +0000)]
[X86][SkylakeClient] Fix a set of regular expressions that were checking for optionally starting with 'Y' instead of 'V'

These bad regexs were introduced by r328435

llvm-svn: 328454

6 years ago[X86][MMX] MOVQ2DQ/MOVDQ2Q are better described as WriteVecMove than WriteMove
Simon Pilgrim [Sun, 25 Mar 2018 17:28:06 +0000 (17:28 +0000)]
[X86][MMX] MOVQ2DQ/MOVDQ2Q are better described as WriteVecMove than WriteMove

Not that it makes a difference to current cost values, but will when we try to better model GPR-SIMD transfer costs

llvm-svn: 328453

6 years ago[X86][SkylakeServer] Merge multiple instregex. NFCI
Simon Pilgrim [Sun, 25 Mar 2018 17:25:37 +0000 (17:25 +0000)]
[X86][SkylakeServer] Merge multiple instregex. NFCI

llvm-svn: 328452

6 years ago[X86] Update cost model for Goldmont. Add fsqrt costs for Silvermont
Craig Topper [Sun, 25 Mar 2018 15:58:12 +0000 (15:58 +0000)]
[X86] Update cost model for Goldmont. Add fsqrt costs for Silvermont

Add fdiv costs for Goldmont using table 16-17 of the Intel Optimization Manual. Also add overrides for FSQRT for Goldmont and Silvermont.

Reviewers: RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 328451

6 years ago[InstCombine] adjust test comments; NFC
Sanjay Patel [Sun, 25 Mar 2018 14:24:32 +0000 (14:24 +0000)]
[InstCombine] adjust test comments; NFC

llvm-svn: 328450

6 years ago[InstCombine] consolidate casted icmp vector tests
Sanjay Patel [Sun, 25 Mar 2018 14:19:25 +0000 (14:19 +0000)]
[InstCombine] consolidate casted icmp vector tests

We have thorough coverage of predicates and scalar types,
so we just need a sampling of vector tests to show that
things are working or not with vectors types.

llvm-svn: 328449

6 years ago[InstCombine] peek through more icmp of FP cast + bitcast
Sanjay Patel [Sun, 25 Mar 2018 14:01:42 +0000 (14:01 +0000)]
[InstCombine] peek through more icmp of FP cast + bitcast

This is an extension of rL328426 as noted in D44367.

llvm-svn: 328448

6 years agoRemove reference to stale (2009) python version.
Yaron Keren [Sun, 25 Mar 2018 13:12:05 +0000 (13:12 +0000)]
Remove reference to stale (2009) python version.

llvm-svn: 328447

6 years ago[X86] Add the ability to override memory folding latency to schedules and add 1uop...
Simon Pilgrim [Sun, 25 Mar 2018 10:21:19 +0000 (10:21 +0000)]
[X86] Add the ability to override memory folding latency to schedules and add 1uop for memory folds for Intel models

The Intel models need an extra 1uop for memory folded instructions, plus a lot of instructions take a non-default memory latency which should allow us to use the multiclass a lot more to tidy things up.

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

llvm-svn: 328446

6 years agoavoid new/delete ellision in construct.pass.cpp
Eric Fiselier [Sun, 25 Mar 2018 03:00:42 +0000 (03:00 +0000)]
avoid new/delete ellision in construct.pass.cpp

llvm-svn: 328445

6 years ago[X86] Consistently prefix all defs in X86ScheduleSLM.td with 'SLM'.
Craig Topper [Sun, 25 Mar 2018 01:28:43 +0000 (01:28 +0000)]
[X86] Consistently prefix all defs in X86ScheduleSLM.td with 'SLM'.

llvm-svn: 328444

6 years ago[X86] Update a partially stale comment, since SVN r328386. NFC.
Martin Storsjo [Sat, 24 Mar 2018 23:00:00 +0000 (23:00 +0000)]
[X86] Update a partially stale comment, since SVN r328386. NFC.

llvm-svn: 328443

6 years ago[SchedModel] Remove an unneeded temporary vector.
Craig Topper [Sat, 24 Mar 2018 22:58:03 +0000 (22:58 +0000)]
[SchedModel] Remove an unneeded temporary vector.

llvm-svn: 328442

6 years ago[SchedModel] Use std::move in a couple places to reduce copying
Craig Topper [Sat, 24 Mar 2018 22:58:02 +0000 (22:58 +0000)]
[SchedModel] Use std::move in a couple places to reduce copying

llvm-svn: 328441

6 years ago[SchedModel] Use std::move to replace a vector instead of vector::swap
Craig Topper [Sat, 24 Mar 2018 22:58:00 +0000 (22:58 +0000)]
[SchedModel] Use std::move to replace a vector instead of vector::swap

We don't really care about the old vector value so we don't care to swap it.

llvm-svn: 328440

6 years agoFix module.modulemap after r328395
Eric Fiselier [Sat, 24 Mar 2018 22:14:02 +0000 (22:14 +0000)]
Fix module.modulemap after r328395

This patch removes the MachineValueType module since the
header was removed in r328395.

llvm-svn: 328439

6 years ago[SchedModel] Remove std::vectors that were created with 1 element and then passed...
Craig Topper [Sat, 24 Mar 2018 21:57:35 +0000 (21:57 +0000)]
[SchedModel] Remove std::vectors that were created with 1 element and then passed to an ArrayRef parameter.

ArrayRef can capture a single element. We don't need a vector for that.

llvm-svn: 328438

6 years ago[SchedModel] Record::getName() returns StringRef - avoid std::string creation. NFCI.
Simon Pilgrim [Sat, 24 Mar 2018 21:22:32 +0000 (21:22 +0000)]
[SchedModel] Record::getName() returns StringRef - avoid std::string creation. NFCI.

llvm-svn: 328437

6 years ago[SchedModel] Avoid std::string creation for instregex patterns that don't contain...
Simon Pilgrim [Sat, 24 Mar 2018 21:04:20 +0000 (21:04 +0000)]
[SchedModel] Avoid std::string creation for instregex patterns that don't contain regex metas. NFCI.

llvm-svn: 328436

6 years ago[X86][SkylakeClient] Merge xmm/ymm instructions instregex entries to reduce regex...
Simon Pilgrim [Sat, 24 Mar 2018 20:40:14 +0000 (20:40 +0000)]
[X86][SkylakeClient] Merge xmm/ymm instructions instregex entries to reduce regex matches to reduce compile time

llvm-svn: 328435

6 years ago[X86][Broadwell] Merge xmm/ymm instructions instregex entries to reduce regex matches...
Simon Pilgrim [Sat, 24 Mar 2018 19:37:28 +0000 (19:37 +0000)]
[X86][Broadwell] Merge xmm/ymm instructions instregex entries to reduce regex matches to reduce compile time

llvm-svn: 328434

6 years ago[RISCV] Use init_array instead of ctors for RISCV target, by default
Mandeep Singh Grang [Sat, 24 Mar 2018 18:37:19 +0000 (18:37 +0000)]
[RISCV] Use init_array instead of ctors for RISCV target, by default

Summary:
LLVM defaults to the newer .init_array/.fini_array scheme for static
constructors rather than the less desirable .ctors/.dtors (the UseCtors
flag defaults to false). This wasn't being respected in the RISC-V
backend because it fails to call TargetLoweringObjectFileELF::InitializeELF with the the appropriate
flag for UseInitArray.
This patch fixes this by implementing RISCVELFTargetObjectFile and overriding its Initialize method to call
InitializeELF(TM.Options.UseInitArray).

Reviewers: asb, apazos

Reviewed By: asb

Subscribers: mgorny, rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD, kito-cheng, shiva0217, llvm-commits

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

llvm-svn: 328433

6 years ago[X86][Haswell] Merge xmm/ymm instructions instregex entries to reduce regex matches...
Simon Pilgrim [Sat, 24 Mar 2018 18:36:01 +0000 (18:36 +0000)]
[X86][Haswell] Merge xmm/ymm instructions instregex entries to reduce regex matches to reduce compile time

llvm-svn: 328432

6 years ago[X86][SandyBridge] Merge xmm/ymm instructions instregex entries to reduce regex match...
Simon Pilgrim [Sat, 24 Mar 2018 18:12:59 +0000 (18:12 +0000)]
[X86][SandyBridge] Merge xmm/ymm instructions instregex entries to reduce regex matches to reduce compile time

llvm-svn: 328431

6 years ago[Hexagon] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Sat, 24 Mar 2018 17:34:37 +0000 (17:34 +0000)]
[Hexagon] Change std::sort to llvm::sort in response to r327219

Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort. Refer the comments section in D44363 for a list of all the required patches.

Reviewers: kparzysz

Reviewed By: kparzysz

Subscribers: llvm-commits

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

llvm-svn: 328430

6 years ago[AMDGPU] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Sat, 24 Mar 2018 17:15:04 +0000 (17:15 +0000)]
[AMDGPU] Change std::sort to llvm::sort in response to r327219

Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Reviewers: tstellar, RKSimon, arsenm

Reviewed By: arsenm

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, llvm-commits, t-tye

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

llvm-svn: 328429

6 years ago[llvm-mca] run clang-format on all files.
Andrea Di Biagio [Sat, 24 Mar 2018 16:05:36 +0000 (16:05 +0000)]
[llvm-mca] run clang-format on all files.

This also addresses Simon's review comment in D44839.

llvm-svn: 328428

6 years ago[llvm-mca] Remove unused field in InstrBuilder. NFC
Andrea Di Biagio [Sat, 24 Mar 2018 15:48:25 +0000 (15:48 +0000)]
[llvm-mca] Remove unused field in InstrBuilder. NFC

llvm-svn: 328427

6 years ago[InstCombine] peek through FP casts for sign-bit compares (PR36682)
Sanjay Patel [Sat, 24 Mar 2018 15:45:02 +0000 (15:45 +0000)]
[InstCombine] peek through FP casts for sign-bit compares (PR36682)

This pattern came up in PR36682:
https://bugs.llvm.org/show_bug.cgi?id=36682
https://godbolt.org/g/LhuD9A

Equality checks are planned as a follow-up enhancement.

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

llvm-svn: 328426

6 years ago[InstCombine] fix formatting; NFC
Sanjay Patel [Sat, 24 Mar 2018 15:41:59 +0000 (15:41 +0000)]
[InstCombine] fix formatting; NFC

llvm-svn: 328425

6 years ago[X86][AES] Ensure we're testing both non-VEX/VEX variants of AES instructions on...
Simon Pilgrim [Sat, 24 Mar 2018 15:05:12 +0000 (15:05 +0000)]
[X86][AES] Ensure we're testing both non-VEX/VEX variants of AES instructions on AVX targets

Add skylake server tests as well

llvm-svn: 328424

6 years ago[X86][SSE] Ensure we're testing both non-VEX/VEX variants of SSE instructions on...
Simon Pilgrim [Sat, 24 Mar 2018 14:51:52 +0000 (14:51 +0000)]
[X86][SSE] Ensure we're testing both non-VEX/VEX variants of SSE instructions on AVX targets

And ensure we don't use later instruction sets in SSE schedule tests

llvm-svn: 328423

6 years ago[InstCombine] add multi-use/vector tests for intrinsic shrinking; NFC
Sanjay Patel [Sat, 24 Mar 2018 14:45:41 +0000 (14:45 +0000)]
[InstCombine] add multi-use/vector tests for intrinsic shrinking; NFC

llvm-svn: 328422

6 years ago[X86][AVX1] Ensure we don't use later instruction sets in AVX1 schedule tests
Simon Pilgrim [Sat, 24 Mar 2018 13:47:48 +0000 (13:47 +0000)]
[X86][AVX1] Ensure we don't use later instruction sets in AVX1 schedule tests

llvm-svn: 328421

6 years ago[X86][AVX2] Ensure we don't use later instruction sets in AVX2 schedule tests
Simon Pilgrim [Sat, 24 Mar 2018 13:47:01 +0000 (13:47 +0000)]
[X86][AVX2] Ensure we don't use later instruction sets in AVX2 schedule tests

llvm-svn: 328420

6 years ago[ELF] - Do not ignore discarding of .rela.plt/.rela.dyn, allow doing custom layout...
George Rimar [Sat, 24 Mar 2018 13:10:19 +0000 (13:10 +0000)]
[ELF] - Do not ignore discarding of .rela.plt/.rela.dyn, allow doing custom layout for them.

Currently when we build input sections list in linker script
we ignore all rel[a] sections. That was done to support
scripts like .rela.dyn : { *(.rela.data) } for emit relocs.

Though as a result following scripts were also silently ignored:

/DISCARD/ : { *(.rela.plt)
/DISCARD/ : { *(.rela.dyn)

and we produced output with this sections. That is not ideal.
The solution this patch suggests is simple: do not ignore synthetic
rel[a] sections. That way we can enable common discarding logic
for them and report a proper error.

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

llvm-svn: 328419

6 years ago[clang-tidy] Enable Python 3 support for add_new_check.py
Jonathan Coe [Sat, 24 Mar 2018 10:49:17 +0000 (10:49 +0000)]
[clang-tidy] Enable Python 3 support for add_new_check.py

Summary: In Python 3, filters are lazily evaluated and strings are not bytes.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: xazax.hun, cfe-commits

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

llvm-svn: 328418

6 years ago[sanitizer] Fix Darwin build
Vitaly Buka [Sat, 24 Mar 2018 08:13:18 +0000 (08:13 +0000)]
[sanitizer] Fix Darwin build

llvm-svn: 328417

6 years ago[X86] Add a new disassembler opcode map for 3DNow. Stop treating 3DNow as an attribute.
Craig Topper [Sat, 24 Mar 2018 07:48:54 +0000 (07:48 +0000)]
[X86] Add a new disassembler opcode map for 3DNow. Stop treating 3DNow as an attribute.

This reduces the size of llvm-mc by at least 150k since we no longer have to multiply the attribute across 7 tables.

llvm-svn: 328416

6 years agoMmap interceptor providing mprotect support
Vitaly Buka [Sat, 24 Mar 2018 07:45:24 +0000 (07:45 +0000)]
Mmap interceptor providing mprotect support

Summary:
- Intercepting mprotect calls.
- Fixing forgotten flag check.

Patch by David CARLIER

Reviewers: vitalybuka, vsk

Subscribers: delcypher, srhines, kubamracek, llvm-commits, #sanitizers

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

llvm-svn: 328415

6 years ago[sanitizer] Fix strlcpy and strlcat interceptors on Darwin
Vitaly Buka [Sat, 24 Mar 2018 07:31:59 +0000 (07:31 +0000)]
[sanitizer] Fix strlcpy and strlcat interceptors on Darwin

llvm-svn: 328414