platform/upstream/llvm.git
6 years ago[XRay][compiler-rt] FDR Mode: Add extents metadata to buffer
Dean Michael Berris [Thu, 19 Jul 2018 05:17:32 +0000 (05:17 +0000)]
[XRay][compiler-rt] FDR Mode: Add extents metadata to buffer

When providing raw access to the FDR mode buffers, we used to not
include the extents metadata record. This oversight means that
processing the buffers in-memory will lose important information that
would have been written in files.

This change exposes the metadata record by serializing the data
similarly to how we would do it when flushing to files.

llvm-svn: 337441

6 years ago[Xray] Fix allocator build, MAP_NORESERVE flag is not always supported
David Carlier [Thu, 19 Jul 2018 05:08:59 +0000 (05:08 +0000)]
[Xray] Fix allocator build, MAP_NORESERVE flag is not always supported

MAP_NORESERVE is not supported or a no-op on BSD.

Reviewers: dberris

Reviewed By: dberris

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

llvm-svn: 337440

6 years ago[PDB] Add PDBSourcePath flag to support absolutize source file path
Takuto Ikuta [Thu, 19 Jul 2018 04:56:22 +0000 (04:56 +0000)]
[PDB] Add PDBSourcePath flag to support absolutize source file path

This patch changes relative path for source files in obj files to
absolute path in PDB when linking with added flag.

I will make obj file generated by clang-cl independent from build
directory for chromium build. But I don't want to confuse visual studio
debugger or require additional configuration. To attain this goal, I
added flag to convert relative source file path in obj to absolute path
when emitting PDB.

By removing absolute path from obj files, we can share build cache
between chromium developers even when they are doing debug build.
That will make build time faster.

More context:
https://bugs.chromium.org/p/chromium/issues/detail?id=712796
https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/5HXSVX-7fPc

llvm-svn: 337439

6 years ago[COFF] Don't produce base relocs for discardable sections
Martin Storsjo [Thu, 19 Jul 2018 04:25:22 +0000 (04:25 +0000)]
[COFF] Don't produce base relocs for discardable sections

Dwarf debug info contains some data that contains absolute addresses.
Since these sections are discardable and aren't loaded at runtime,
there's no point in adding base relocations for them.

This makes sure that after stripping out dwarf debug info, there are no
base relocations that point to nonexistent sections.

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

llvm-svn: 337438

6 years ago[libFuzzer] fix the bot (the no-assert build)
Kostya Serebryany [Thu, 19 Jul 2018 03:16:12 +0000 (03:16 +0000)]
[libFuzzer] fix the bot (the no-assert build)

llvm-svn: 337437

6 years ago[libFuzzer] quick hack to fix the bot
Kostya Serebryany [Thu, 19 Jul 2018 01:54:28 +0000 (01:54 +0000)]
[libFuzzer] quick hack to fix the bot

llvm-svn: 337436

6 years ago[SCEV] Fix buggy behavior in getAddExpr with truncs
Max Kazantsev [Thu, 19 Jul 2018 01:46:21 +0000 (01:46 +0000)]
[SCEV] Fix buggy behavior in getAddExpr with truncs

SCEV tries to constant-fold arguments of trunc operands in SCEVAddExpr, and when it does
that, it passes wrong flags into the recursion. It is only valid to pass flags that are proved for
narrow type into a computation in wider type if we can prove that trunc instruction doesn't
actually change the value. If it did lose some meaningful bits, we may end up proving wrong
no-wrap flags for sum of arguments of trunc.

In the provided test we end up with `nuw` where it shouldn't be because of this bug.

The solution is to conservatively pass `SCEV::FlagAnyWrap` which is always a valid thing to do.

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

llvm-svn: 337435

6 years ago[libFuzzer] first experimental attempt at DFT-based mutations (DFT=data-flow-trace)
Kostya Serebryany [Thu, 19 Jul 2018 01:23:32 +0000 (01:23 +0000)]
[libFuzzer] first experimental attempt at DFT-based mutations (DFT=data-flow-trace)

llvm-svn: 337434

6 years ago[clang]: Add support for "-fno-delete-null-pointer-checks"
Manoj Gupta [Thu, 19 Jul 2018 00:44:52 +0000 (00:44 +0000)]
[clang]: Add support for "-fno-delete-null-pointer-checks"

Summary:
Support for this option is needed for building Linux kernel.
This is a very frequently requested feature by kernel developers.

More details : https://lkml.org/lkml/2018/4/4/601

GCC option description for -fdelete-null-pointer-checks:
This Assume that programs cannot safely dereference null pointers,
and that no code or data element resides at address zero.

-fno-delete-null-pointer-checks is the inverse of this implying that
null pointer dereferencing is not undefined.

This feature is implemented in as the function attribute
"null-pointer-is-valid"="true".
This CL only adds the attribute on the function.
It also strips "nonnull" attributes from function arguments but
keeps the related warnings unchanged.

Corresponding LLVM change rL336613 already updated the
optimizations to not treat null pointer dereferencing
as undefined if the attribute is present.

Reviewers: t.p.northover, efriedma, jyknight, chandlerc, rnk, srhines, void, george.burgess.iv

Reviewed By: jyknight

Subscribers: drinkcat, xbolva00, cfe-commits

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

llvm-svn: 337433

6 years agoRemove scheduling dependency from XRay :: Posix/fork_basic_logging.cc
Matthew Voss [Thu, 19 Jul 2018 00:25:00 +0000 (00:25 +0000)]
Remove scheduling dependency from XRay :: Posix/fork_basic_logging.cc

Summary:
We've been seeing intermittent failures on our internal bots and we suspect
this may be due to the OS scheduling the child process to run before the parent
process.

This version ensures that the parent and child can be run in either order.

Reviewers: Maknee, dberris

Reviewed By: dberris

Subscribers: delcypher, #sanitizers, Maknee, llvm-commits

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

llvm-svn: 337432

6 years agoDocumentation: fix a typo in the AST Matcher Reference docs.
James Dennett [Wed, 18 Jul 2018 23:21:31 +0000 (23:21 +0000)]
Documentation: fix a typo in the AST Matcher Reference docs.

llvm-svn: 337431

6 years agoReapply r336660: [Modules] Autoload subdirectory modulemaps with specific LangOpts
Bruno Cardoso Lopes [Wed, 18 Jul 2018 23:21:19 +0000 (23:21 +0000)]
Reapply r336660: [Modules] Autoload subdirectory modulemaps with specific LangOpts

Summary:
Reproducer and errors:
https://bugs.llvm.org/show_bug.cgi?id=37878

lookupModule was falling back to loadSubdirectoryModuleMaps when it couldn't
find ModuleName in (proper) search paths. This was causing iteration over all
files in the search path subdirectories for example "/usr/include/foobar" in
bugzilla case.

Users don't expect Clang to load modulemaps in subdirectories implicitly, and
also the disk access is not cheap.

if (AllowExtraModuleMapSearch) true with ObjC with @import ModuleName.

Reviewers: rsmith, aprantl, bruno

Subscribers: cfe-commits, teemperor, v.g.vassilev

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

llvm-svn: 337430

6 years agoELF: Implement --icf=safe using address-significance tables.
Peter Collingbourne [Wed, 18 Jul 2018 22:49:31 +0000 (22:49 +0000)]
ELF: Implement --icf=safe using address-significance tables.

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

llvm-svn: 337429

6 years agoRename __asan_gen_* symbols to ___asan_gen_*.
Peter Collingbourne [Wed, 18 Jul 2018 22:23:14 +0000 (22:23 +0000)]
Rename __asan_gen_* symbols to ___asan_gen_*.

This prevents gold from printing a warning when trying to export
these symbols via the asan dynamic list after ThinLTO promotes them
from private symbols to external symbols with hidden visibility.

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

llvm-svn: 337428

6 years ago[ELF] Error if -r --gdb-index are used together
Fangrui Song [Wed, 18 Jul 2018 22:02:48 +0000 (22:02 +0000)]
[ELF] Error if -r --gdb-index are used together

Reviewers: ruiu, espindola

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 337427

6 years ago[WebAssembly] Fix archive member display in error messages
Sam Clegg [Wed, 18 Jul 2018 21:46:09 +0000 (21:46 +0000)]
[WebAssembly] Fix archive member display in error messages

Add a test for this by causing a symbol collision
between archive members.

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

llvm-svn: 337426

6 years ago[WebAssembly] Add missing -mattr=+exception-handling guards
Heejin Ahn [Wed, 18 Jul 2018 21:42:22 +0000 (21:42 +0000)]
[WebAssembly] Add missing -mattr=+exception-handling guards

Summary:
The use of exception handling instructions should only be enabled with
`-mattr=+exception-handling` option.

Reviewers: jgravelle-google

Subscribers: dschuff, sbc100, sunfish, llvm-commits

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

llvm-svn: 337425

6 years agoRevert "ARM: switch armv7em triple to hard-float defaults and libcalls."
Tim Northover [Wed, 18 Jul 2018 21:32:49 +0000 (21:32 +0000)]
Revert "ARM: switch armv7em triple to hard-float defaults and libcalls."

This reverts commit r337385 until it can be targeted at MachO only.

llvm-svn: 337424

6 years agoFix some tests that had (implied) duplicate mtriple
David Blaikie [Wed, 18 Jul 2018 20:37:01 +0000 (20:37 +0000)]
Fix some tests that had (implied) duplicate mtriple

I 'fixed' one of these to use %llc_dwarf unnecessarily, so switch them
both back to using llc directly.

llvm-svn: 337423

6 years agoDR330: when determining whether a cast casts away constness, consider
Richard Smith [Wed, 18 Jul 2018 20:13:36 +0000 (20:13 +0000)]
DR330: when determining whether a cast casts away constness, consider
qualifiers from all levels matching a multidimensional array.

For example, this allows casting from
  pointer to       array of            array of   const volatile int
to
  pointer to const pointer to volatile pointer to                int
because the multidimensional array part of the source type corresponds
to a part of the destination type that contains both 'const' and
'volatile'.

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

llvm-svn: 337422

6 years agoRevert "[CMake] Sort dependency list and add safestack to it"
Vedant Kumar [Wed, 18 Jul 2018 20:10:43 +0000 (20:10 +0000)]
Revert "[CMake] Sort dependency list and add safestack to it"

This reverts commit r337412.

An Apple-internal bot cannot find the safestack dependency, and fails to
configure with this change.

llvm-svn: 337421

6 years agoAdd support for __declspec(code_seg("segname"))
Erich Keane [Wed, 18 Jul 2018 20:04:48 +0000 (20:04 +0000)]
Add support for __declspec(code_seg("segname"))

This patch uses CodeSegAttr to represent __declspec(code_seg) rather than
building on the existing support for #pragma code_seg.
The code_seg declspec is applied on functions and classes. This attribute
enables the placement of code into separate named segments, including compiler-
generated codes and template instantiations.

For more information, please see the following:
https://msdn.microsoft.com/en-us/library/dn636922.aspx

This patch fixes the regression for the support for attribute ((section).
https://github.com/llvm-mirror/clang/commit/746b78de7812bc785fbb5207b788348040b23fa7

Patch by Soumi Manna (Manna)
Differential Revision: https://reviews.llvm.org/D48841

llvm-svn: 337420

6 years ago[X86][SSE] Canonicalize scalar fp arithmetic shuffle patterns
Simon Pilgrim [Wed, 18 Jul 2018 19:55:19 +0000 (19:55 +0000)]
[X86][SSE] Canonicalize scalar fp arithmetic shuffle patterns

As discussed on PR38197, this canonicalizes MOVS*(N0, OP(N0, N1)) --> MOVS*(N0, SCALAR_TO_VECTOR(OP(N0[0], N1[0])))

This returns the scalar-fp codegen lost by rL336971.

Additionally it handles the OP(N1, N0)) case for commutable (FADD/FMUL) ops.

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

llvm-svn: 337419

6 years ago[Fuzzer] Improve crash unwinding on Fuchsia
Petr Hosek [Wed, 18 Jul 2018 19:20:47 +0000 (19:20 +0000)]
[Fuzzer] Improve crash unwinding on Fuchsia

Fuchsia doesn't have signals; instead it expects processes to have a
dedicated exception thread that binds to the process' exception port and
waits for exception packets to be delivered. On the other hand,
libFuzzer and sanitizer_common use expect to collect crash information
via libunwind from the same thread that caused the exception.

The long term fix is to improve support for remote unwinding in
libunbwind, plumb this through sanitizer_common and libFuzzer, and
handle the exception exclusively on the exception thread. In the
meantime, this revision has the exception thread "resurrect" the
crashing thread by:

* saving its general purpose register state onto the crashing thread's
  stack,
* setting the crashing thread's program counter to an assembly trampoline
  with the CFI information needed by libunwind, and
* resuming the crashed thread.

Patch By: aarongreen

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

llvm-svn: 337418

6 years ago[analyzer] Remove a debug print that was accidentally left around.
Artem Dergachev [Wed, 18 Jul 2018 18:44:40 +0000 (18:44 +0000)]
[analyzer] Remove a debug print that was accidentally left around.

No functional change intended.

llvm-svn: 337417

6 years agoSkip debuginfo intrinsic in markLiveBlocks.
Xin Tong [Wed, 18 Jul 2018 18:40:45 +0000 (18:40 +0000)]
Skip debuginfo intrinsic in markLiveBlocks.

Summary:
The optimizer is 10%+ slower with vs without debuginfo. I started checking where
the difference is coming from.

I compiled sqlite3.c with and without debug info from CTMark and compare the time difference.

I use Xcode Instrument to find where time is spent. This brings about 20ms, out of ~20s.

Reviewers: davide, hfinkel

Reviewed By: hfinkel

Subscribers: hfinkel, aprantl, JDevlieghere, llvm-commits

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

llvm-svn: 337416

6 years agoAdd (very partial) Kate syntax highlighting definition for TableGen
Roman Lebedev [Wed, 18 Jul 2018 18:35:27 +0000 (18:35 +0000)]
Add (very partial) Kate syntax highlighting definition for TableGen

This is very clearly not very good, and is very partial.
But this is better than nothing at all, and shouldn't
hurt those who don't need it.

If there are others interested in this functionality,
it will be great to further improve this.

{F6253091}

Reviewed By: Bigcheese

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

llvm-svn: 337415

6 years ago[DAG] Add testcase.
Nirav Dave [Wed, 18 Jul 2018 18:34:52 +0000 (18:34 +0000)]
[DAG] Add testcase.

llvm-svn: 337414

6 years agoRevert r336609: Fix direct calls to __wrap_sym when it is relocated.
Rui Ueyama [Wed, 18 Jul 2018 18:24:46 +0000 (18:24 +0000)]
Revert r336609: Fix direct calls to __wrap_sym when it is relocated.

This reverts commit r336609 as it doesn't seem to work with AArch64
thunk creation when used with ASan.

llvm-svn: 337413

6 years ago[CMake] Sort dependency list and add safestack to it
Vedant Kumar [Wed, 18 Jul 2018 18:17:39 +0000 (18:17 +0000)]
[CMake] Sort dependency list and add safestack to it

The 'safestack.c' test requires safestack as a dependency.

llvm-svn: 337412

6 years ago[DebugInfo] Dwarfv5: Avoid unnecessary base_address specifiers in rnglists
David Blaikie [Wed, 18 Jul 2018 18:04:42 +0000 (18:04 +0000)]
[DebugInfo] Dwarfv5: Avoid unnecessary base_address specifiers in rnglists

Since DWARFv5 rnglists are self descriptive and have distinct encodings
for base-relative (offset_pair) and absolute (start_length) entries,
there's no need to use a base address specifier when describing a lone
address range in a section.

Use that, and improve the test coverage a bit here to include cases like
this and others.

llvm-svn: 337411

6 years agoSupport implicit _Atomic struct load / store
JF Bastien [Wed, 18 Jul 2018 18:01:41 +0000 (18:01 +0000)]
Support implicit _Atomic struct load / store

Summary:
Using _Atomic to do implicit load / store is just a seq_cst atomic_load / atomic_store. Stores currently assert in Sema::ImpCastExprToType with 'can't implicitly cast lvalue to rvalue with this cast kind', but that's erroneous. The codegen is fine as the test shows.

While investigating I found that Richard had found the problem here: https://reviews.llvm.org/D46112#1113557

<rdar://problem/40347123>

Reviewers: dexonsmith

Subscribers: cfe-commits, efriedma, rsmith, aaron.ballman

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

llvm-svn: 337410

6 years ago[ScheduleDAG] Fix unfolding of SUnits to already existent nodes.
Nirav Dave [Wed, 18 Jul 2018 18:01:03 +0000 (18:01 +0000)]
[ScheduleDAG] Fix unfolding of SUnits to already existent nodes.

Summary:
If unfolding an SUnit results in both load or the operation using it which
already exist in the DAG, abort the unfold if they are already scheduled.
If not, make sure we don't add duplicate dependencies.

This fixes PR37916.

Reviewers: davide, eli.friedman, fhahn, bogner

Subscribers: MatzeB, hiraditya, llvm-commits

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

llvm-svn: 337409

6 years ago[llvm-readobj] Generic -string-dump option
Paul Semel [Wed, 18 Jul 2018 18:00:41 +0000 (18:00 +0000)]
[llvm-readobj] Generic -string-dump option

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

llvm-svn: 337408

6 years agoLook for an entry point function if /nodefaultlib is given.
Rui Ueyama [Wed, 18 Jul 2018 17:48:14 +0000 (17:48 +0000)]
Look for an entry point function if /nodefaultlib is given.

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

Reviewers: thakis

Subscribers: llvm-commits

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

llvm-svn: 337407

6 years agoUpdate the synopsis for <chrono> for C++20. No functional change.
Marshall Clow [Wed, 18 Jul 2018 17:37:51 +0000 (17:37 +0000)]
Update the synopsis for <chrono> for C++20. No functional change.

llvm-svn: 337406

6 years agoFix `ld.lld --help` message.
Rui Ueyama [Wed, 18 Jul 2018 17:19:17 +0000 (17:19 +0000)]
Fix `ld.lld --help` message.

llvm-svn: 337405

6 years ago[docs] Update GoldPlugin documentation
Teresa Johnson [Wed, 18 Jul 2018 17:10:17 +0000 (17:10 +0000)]
[docs] Update GoldPlugin documentation

Summary:
Updated and reorganized. Made the following additions:
1) How to see if ld.gold is installed, and whether it is the current
default.
2) How to install ld.gold as the default or alternatively use
-fuse-ld=gold.
3) Move the part about installing the newly built ld-new as the default
to the prior section and how to use --enable-gold=default to do it
automatically on install.
4) Add a note about ld.bfd supporting plugins but indicate that it is
not tested by the LLVM project and gold is the recommended linker for
use with the gold plugin.

Fixes PR32760.

Reviewers: davide

Subscribers: llvm-commits

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

llvm-svn: 337404

6 years ago[libFuzzer] Create single template for visiting Inline8bitCounters
Max Moroz [Wed, 18 Jul 2018 17:03:27 +0000 (17:03 +0000)]
[libFuzzer] Create single template for visiting Inline8bitCounters

Summary:
Created IterateInline8bitCounters, a single template for visiting  Inline8bitCounters (nested for loop)
Made InitializeUnstableCounters and UpdateUnstableCounters both send a lambda to IterateInline8bitCounters.

Patch by Kyungtak Woo (@kevinwkt).

Reviewers: Dor1s, metzman, kcc, morehouse

Reviewed By: metzman, morehouse

Subscribers: delcypher, llvm-commits, #sanitizers

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

llvm-svn: 337403

6 years ago[RegAlloc][NFC] Fix the help string of the option "huge-size-for-split".
Wei Mi [Wed, 18 Jul 2018 16:56:33 +0000 (16:56 +0000)]
[RegAlloc][NFC] Fix the help string of the option "huge-size-for-split".

llvm-svn: 337402

6 years ago[llvm-objdump] Add -demangle (-C) option
Paul Semel [Wed, 18 Jul 2018 16:39:21 +0000 (16:39 +0000)]
[llvm-objdump] Add -demangle (-C) option

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

llvm-svn: 337401

6 years ago[NFC][X86][AArch64][DAGCombine] More tests for optimizeSetCCOfSignedTruncationCheck()
Roman Lebedev [Wed, 18 Jul 2018 16:19:06 +0000 (16:19 +0000)]
[NFC][X86][AArch64][DAGCombine] More tests for optimizeSetCCOfSignedTruncationCheck()

At least one of these cases is more canonical,
so we really do have to handle it.
https://godbolt.org/g/pkzP3X
https://rise4fun.com/Alive/pQyh

llvm-svn: 337400

6 years ago[llvm-objcopy] %python wants to be in quotes, because it might contain spaces
Benjamin Kramer [Wed, 18 Jul 2018 16:17:53 +0000 (16:17 +0000)]
[llvm-objcopy] %python wants to be in quotes, because it might contain spaces

llvm-svn: 337399

6 years ago[MC] Fix nested macro body parsing
Nirav Dave [Wed, 18 Jul 2018 16:17:03 +0000 (16:17 +0000)]
[MC] Fix nested macro body parsing

Add missing .rep case in nestlevel checking for macro body parsing.

llvm-svn: 337398

6 years agoFix variables.test after D49018
Stella Stamenova [Wed, 18 Jul 2018 15:50:24 +0000 (15:50 +0000)]
Fix variables.test after D49018

Summary: This one fixes variables.test after D49018. The test was broken because D49018 adds a location information to variables, but I hadn't noticed that, because I used 32-bit build to run tests, so the test looked to me already broken before that commit (the test relies on mangled names, but the mangling schemes are different for 32-bit and 64-bit).

Reviewers: stella.stamenova, lldb-commits

Reviewed By: stella.stamenova

Patch By: Aleksandr Urakov

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

llvm-svn: 337397

6 years ago[clangd] Also get scope for RK_pattern completion results.
Eric Liu [Wed, 18 Jul 2018 15:31:14 +0000 (15:31 +0000)]
[clangd] Also get scope for RK_pattern completion results.

For exmaple, clas field candidates in constructor initializers can be
RK_Pattern, but they can still have scopes.

llvm-svn: 337396

6 years ago[windows] Use a well-known path for ComSpec if we fail to retrieve it
Stella Stamenova [Wed, 18 Jul 2018 15:21:54 +0000 (15:21 +0000)]
[windows] Use a well-known path for ComSpec if we fail to retrieve it

Summary: Right now we always try to retrieve ComSpec and if we fail, we give up. This rarely fails, but we can update the logic so that we fail even less frequently. Since there is a well-known path (albeit not always correct), try the path when we failed to retrieve it. Note that on other platforms, we generally just return a well-known path without any checking.

Reviewers: asmith, zturner, labath

Reviewed By: zturner, labath

Subscribers: llvm-commits

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

llvm-svn: 337395

6 years ago[CodeComplete] Allow getDeclaration on RK_Pattern result.
Eric Liu [Wed, 18 Jul 2018 15:17:52 +0000 (15:17 +0000)]
[CodeComplete] Allow getDeclaration on RK_Pattern result.

Summary:
RK_Pattern results can also have associated declarations e.g. field
decls in constructor initializers.

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 337394

6 years ago[lit, lldbsuite] Remove tests that are duplicated between lit and lldb-suite
Stella Stamenova [Wed, 18 Jul 2018 15:16:54 +0000 (15:16 +0000)]
[lit, lldbsuite] Remove tests that are duplicated between lit and lldb-suite

Summary: Several tests exist in both lit and lldbsuite. This removes the lit version of the duplicated tests.

Reviewers: asmith, zturner

Subscribers: llvm-commits

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

llvm-svn: 337393

6 years ago[mips] Fix predicate for the MipsTruncIntFP pattern
Simon Atanasyan [Wed, 18 Jul 2018 14:11:22 +0000 (14:11 +0000)]
[mips] Fix predicate for the MipsTruncIntFP pattern

This is a follow-up to the rL337171. This patch fixes regression
introduced by the r337171 and enables MipsTruncIntFP pattern.

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

llvm-svn: 337392

6 years ago[x86/SLH] Add the design document for Speculative Load Hardening,
Chandler Carruth [Wed, 18 Jul 2018 14:05:14 +0000 (14:05 +0000)]
[x86/SLH] Add the design document for Speculative Load Hardening,
a Spectre v1 mitigation.

This was initially posted w/ the patch implementing this, got some basic
review there. Also, it is generated from a the Google doc that I shared
as part of the Speculative Load Hardening RFC and which has seen pretty
widespread review at this point.

However, as the patches are landing in LLVM, I wanted to land the docs
as well. But it seemed like a bad idea to have them in the same commit
in case of reverts or other things. So the docs are split out here.

Thanks for all the review so far, and further review and improvements to
the documentation here welcome. Please feel free to keep hammering on
the code review or Google document.

Note that this is a markdown document which Sphinx doesn't yet process.
But we can add support for that after and this should get picked up
(and I'm preparing patches for that). Also, this gets the document
itself into a nice shared place where we can iterate on it.

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

llvm-svn: 337391

6 years ago[SLPVectorizer] Avoid duplicate scalar cost calculations in BoUpSLP::getEntryCost...
Simon Pilgrim [Wed, 18 Jul 2018 13:53:55 +0000 (13:53 +0000)]
[SLPVectorizer] Avoid duplicate scalar cost calculations in BoUpSLP::getEntryCost. NFCI.

Pulled out from D49225, we have a lot of repeated scalar cost calculations, often with arguments that don't look the same but turn out to be.

llvm-svn: 337390

6 years ago[Support] Build fix for Haiku when checking for a local filesystem
Tim Northover [Wed, 18 Jul 2018 13:42:18 +0000 (13:42 +0000)]
[Support] Build fix for Haiku when checking for a local filesystem

Haiku does not expose information about local versus remote mounts, so just
return false, like Cygwin.

Patch by Niels Sascha Reedijk.

llvm-svn: 337389

6 years agoClear properties inadvertantly added to tests in R336379
Erich Keane [Wed, 18 Jul 2018 13:07:13 +0000 (13:07 +0000)]
Clear properties inadvertantly added to tests in R336379

llvm-svn: 337388

6 years ago[X86][SSE] Remove BLENDPD canonicalization from combineTargetShuffle
Simon Pilgrim [Wed, 18 Jul 2018 13:01:20 +0000 (13:01 +0000)]
[X86][SSE] Remove BLENDPD canonicalization from combineTargetShuffle

When rL336971 removed the scalar-fp isel patterns, we lost the need for this canonicalization - commutation/folding can handle everything else.

llvm-svn: 337387

6 years agoARM: stop explicitly marking armv7k libcalls as hard-float. NFC.
Tim Northover [Wed, 18 Jul 2018 12:37:43 +0000 (12:37 +0000)]
ARM: stop explicitly marking armv7k libcalls as hard-float. NFC.

Since the triple's default is hard float, the libcalls will already use VFP
registers.

llvm-svn: 337386

6 years agoARM: switch armv7em triple to hard-float defaults and libcalls.
Tim Northover [Wed, 18 Jul 2018 12:37:04 +0000 (12:37 +0000)]
ARM: switch armv7em triple to hard-float defaults and libcalls.

We were emitting incorrect calls to libm functions that LLVM had decided it
knew about because the default is soft-float.

llvm-svn: 337385

6 years agoARM: deduplicate hard-float detection code. NFC.
Tim Northover [Wed, 18 Jul 2018 12:36:25 +0000 (12:36 +0000)]
ARM: deduplicate hard-float detection code. NFC.

ARMSubtarget had a copy/pasted block to determine whether the target was
hard-float, but it just delegated to triple features anyway so it's better at
the TargetMachine level.

llvm-svn: 337384

6 years ago[AArch64][SVE] Asm: Support for unpredicated FP operations.
Sander de Smalen [Wed, 18 Jul 2018 11:59:12 +0000 (11:59 +0000)]
[AArch64][SVE] Asm: Support for unpredicated FP operations.

This patch adds support for the following unpredicated
floating-point instructions:

  FADD      Floating point add
  FSUB      Floating point subtract
  FMUL      Floating point multiplication
  FTSMUL    Floating point trigonometric starting value
  FRECPS    Floating point reciprocal step
  FRSQRTS   Floating point reciprocal square root step

The instructions have the following assembly format:
  fadd z0.h, z1.h, z2.h
and have variants for 16, 32 and 64-bit FP elements.

llvm-svn: 337383

6 years ago[ELF] - Stop silently producing a broken .eh_frame_hdr.
George Rimar [Wed, 18 Jul 2018 11:56:53 +0000 (11:56 +0000)]
[ELF] - Stop silently producing a broken .eh_frame_hdr.

Currently, getFdePC() returns uint64_t. Its because the following
encodings might use 8 bytes: DW_EH_PE_absptr and DW_EH_PE_udata8.

But caller assigns returned value to uint32_t field:
https://github.com/llvm-mirror/lld/blob/master/ELF/SyntheticSections.cpp#L508

Value is used for building .eh_frame_hdr section.
We use DW_EH_PE_sdata4 encoding for building it at this moment:
https://github.com/llvm-mirror/lld/blob/master/ELF/SyntheticSections.cpp#L2545

And that means that an overflow issue might happen if
DW_EH_PE_absptr/DW_EH_PE_udata8 address encodings are present
in .eh_frame. In that case, before this patch, we silently would
truncate the address and produced broken .eh_frame_hdr section.

It would be not hard to support real 64-bit values for
DW_EH_PE_absptr/DW_EH_PE_udata8 encodings, but it is
unclear if it is usefull and if we should do it.

Since nobody faced/reported it, int this patch I only implement
a check to stop producing broken output silently for now.

llvm-svn: 337382

6 years agoMention clang-cl improvements from r335466 and r336379 in ReleaseNotes.rst
Nico Weber [Wed, 18 Jul 2018 11:55:03 +0000 (11:55 +0000)]
Mention clang-cl improvements from r335466 and r336379 in ReleaseNotes.rst

llvm-svn: 337381

6 years ago[TargetInstPredicate] Add definition of CheckInvalidRegisterOperand.
Andrea Di Biagio [Wed, 18 Jul 2018 11:16:31 +0000 (11:16 +0000)]
[TargetInstPredicate] Add definition of CheckInvalidRegisterOperand.

This should have been part of r337378. I forgot to svn add it before committing
the change.

llvm-svn: 337380

6 years ago[NFC] Make a test more neat
Max Kazantsev [Wed, 18 Jul 2018 11:03:40 +0000 (11:03 +0000)]
[NFC] Make a test more neat

llvm-svn: 337379

6 years ago[Tablegen][PredicateExpander] Add the ability to define checks for invalid registers.
Andrea Di Biagio [Wed, 18 Jul 2018 11:03:22 +0000 (11:03 +0000)]
[Tablegen][PredicateExpander] Add the ability to define checks for invalid registers.

This was discussed in review D49436.

llvm-svn: 337378

6 years ago[ELF] - Add a test case to check DW_EH_PE_absptr address encoding.
George Rimar [Wed, 18 Jul 2018 11:02:37 +0000 (11:02 +0000)]
[ELF] - Add a test case to check DW_EH_PE_absptr address encoding.

This covers the following line of the code:
https://github.com/llvm-mirror/lld/blob/master/ELF/SyntheticSections.cpp#L525

llvm-svn: 337377

6 years ago[InstCombine] Re-commit: Fold 'check for [no] signed truncation' pattern
Roman Lebedev [Wed, 18 Jul 2018 10:55:17 +0000 (10:55 +0000)]
[InstCombine] Re-commit: Fold 'check for [no] signed truncation' pattern

Summary:
[[ https://bugs.llvm.org/show_bug.cgi?id=38149 | PR38149 ]]

As discussed in https://reviews.llvm.org/D49179#1158957 and later,
the IR for 'check for [no] signed truncation' pattern can be improved:
https://rise4fun.com/Alive/gBf
^ that pattern will be produced by Implicit Integer Truncation sanitizer,
https://reviews.llvm.org/D48958 https://bugs.llvm.org/show_bug.cgi?id=21530
in signed case, therefore it is probably a good idea to improve it.

The DAGCombine will reverse this transform, see
https://reviews.llvm.org/D49266

This transform is surprisingly frustrating.
This does not deal with non-splat shift amounts, or with undef shift amounts.
I've outlined what i think the solution should be:
```
  // Potential handling of non-splats: for each element:
  //  * if both are undef, replace with constant 0.
  //    Because (1<<0) is OK and is 1, and ((1<<0)>>1) is also OK and is 0.
  //  * if both are not undef, and are different, bailout.
  //  * else, only one is undef, then pick the non-undef one.
```

This is a re-commit, as the original patch, committed in rL337190
was reverted in rL337344 as it broke chromium build:
https://bugs.llvm.org/show_bug.cgi?id=38204 and
https://crbug.com/864832
Proofs that the fixed folds are ok: https://rise4fun.com/Alive/VYM

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

llvm-svn: 337376

6 years ago[X86][SSE] Add extra scalar fop + blend tests for commuted inputs
Simon Pilgrim [Wed, 18 Jul 2018 10:54:13 +0000 (10:54 +0000)]
[X86][SSE] Add extra scalar fop + blend tests for commuted inputs

While working on PR38197, I noticed that we don't make use of FADD/FMUL being able to commute the inputs to support the addps+movss -> addss style combine

llvm-svn: 337375

6 years ago[ELF] - Improve eh-frame-value-format7.s test case.
George Rimar [Wed, 18 Jul 2018 10:42:10 +0000 (10:42 +0000)]
[ELF] - Improve eh-frame-value-format7.s test case.

This adds .eh_frame_hdr content checking to test
that DW_EH_PE_udata2 address was decoded correctly.

llvm-svn: 337374

6 years agoRevert "[Sparc] Use the IntPair reg class for r constraints with value type f64"
Daniel Cederman [Wed, 18 Jul 2018 10:05:30 +0000 (10:05 +0000)]
Revert "[Sparc] Use the IntPair reg class for r constraints with value type f64"

This reverts commit 55222c9183c6e07f53a54c4061677734f54feac1.

I missed that this patch has a dependency on https://reviews.llvm.org/D49219
that has not been approved yet.

llvm-svn: 337373

6 years ago[AArch64][SVE] Asm: Support for UDOT/SDOT instructions.
Sander de Smalen [Wed, 18 Jul 2018 09:37:51 +0000 (09:37 +0000)]
[AArch64][SVE] Asm: Support for UDOT/SDOT instructions.

The signed/unsigned DOT instructions perform a dot-product on
quadtuplets from two source vectors and accumulate the result in
the destination register. The instructions come in two forms:

Vector form, e.g.
  sdot  z0.s, z1.b, z2.b     - signed dot product on four 8-bit quad-tuplets,
                               accumulating results in 32-bit elements.

  udot  z0.d, z1.h, z2.h     - unsigned dot product on four 16-bit quad-tuplets,
                               accumulating results in 64-bit elements.

Indexed form, e.g.
  sdot  z0.s, z1.b, z2.b[3]  - signed dot product on four 8-bit quad-tuplets
                               with specified quadtuplet from second
                               source vector, accumulating results in 32-bit
                               elements.
  udot  z0.d, z1.h, z2.h[1]  - dot product on four 16-bit quad-tuplets
                               with specified quadtuplet from second
                               source vector, accumulating results in 64-bit
                               elements.

llvm-svn: 337372

6 years ago[llvm-objdump] - An attempt to fix BB after r337361.
George Rimar [Wed, 18 Jul 2018 09:25:36 +0000 (09:25 +0000)]
[llvm-objdump] - An attempt to fix BB after r337361.

Seems r337361 is the reason of the following ARM BB failures:
http://lab.llvm.org:8011/builders/clang-cmake-armv8-quick
http://lab.llvm.org:8011/builders/clang-cmake-armv8-full/builds/4633

Reason is unclear to me, other bots are OK.
If this will not help, I'll revert r337361.

llvm-svn: 337371

6 years ago[Sparc] Use the IntPair reg class for r constraints with value type f64
Daniel Cederman [Wed, 18 Jul 2018 09:25:33 +0000 (09:25 +0000)]
[Sparc] Use the IntPair reg class for r constraints with value type f64

Summary: This is how it appears to be handled in GCC and it prevents a
"Unknown mismatch" error in the SelectionDAGBuilder.

Reviewers: venkatra, jyknight, jrtc27

Reviewed By: jyknight, jrtc27

Subscribers: eraman, fedor.sergeev, jrtc27, llvm-commits

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

llvm-svn: 337370

6 years ago[AArch64][SVE] Asm: Integer divide instructions.
Sander de Smalen [Wed, 18 Jul 2018 09:17:29 +0000 (09:17 +0000)]
[AArch64][SVE] Asm: Integer divide instructions.

This patch adds the following predicated instructions:

  UDIV    Unsigned divide active elements
  UDIVR   Unsigned divide active elements, reverse form.
  SDIV    Signed divide active elements
  SDIVR   Signed divide active elements, reverse form.

e.g.
  udiv  z0.s, p0/m, z0.s, z1.s
    (unsigned divide active elements in z0 by z1, store result in z0)

  sdivr z0.s, p0/m, z0.s, z1.s
    (signed divide active elements in z1 by z0, store result in z0)

llvm-svn: 337369

6 years agoFix -Wdocumentation warning. NFCI.
Simon Pilgrim [Wed, 18 Jul 2018 09:10:18 +0000 (09:10 +0000)]
Fix -Wdocumentation warning. NFCI.

llvm-svn: 337368

6 years agoFix -Wdocumentation warning. NFCI.
Simon Pilgrim [Wed, 18 Jul 2018 09:07:54 +0000 (09:07 +0000)]
Fix -Wdocumentation warning. NFCI.

llvm-svn: 337367

6 years ago[CMake] Export the LLVM_LINK_LLVM_DYLIB setting
Philip Pfaffe [Wed, 18 Jul 2018 08:53:31 +0000 (08:53 +0000)]
[CMake] Export the LLVM_LINK_LLVM_DYLIB setting

Summary:
When building out-of-tree tools, there are several macros available to
automate linking against llvm. An examples is `add_llvm_executable`, or
the clang variant of this.

These macros use the LLVM_LINK_LLVM_DYLIB option to decide whether to
link against libraries defined by setting LLVM_LINK_COMPONENTS or to
link against libLLVM instead. Currently this is problematic in
out-of-tree targets, because they cannot identify whether this option is
required or even available. If the option was enabled in LLVM's own
build, the clang libraries are built against libLLVM, so a client
linking against those must link against it too. On the other hand the
client can't just always link against it, because it might not be
available.

This is related to D44391, but that change assumed the client knew
whether they wanted the dylib or not.

Reviewers: mgorny, beanz, labath

Reviewed By: mgorny

Subscribers: bollu, llvm-commits

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

llvm-svn: 337366

6 years ago[ELF] - Improve relocatable-many-sections.s test case. NFC.
George Rimar [Wed, 18 Jul 2018 08:52:09 +0000 (08:52 +0000)]
[ELF] - Improve relocatable-many-sections.s test case. NFC.

This adds a check for .shstrtab section index.

llvm-svn: 337365

6 years ago[NFC][InstCombine] i65 tests for 'check for [no] signed truncation' pattern
Roman Lebedev [Wed, 18 Jul 2018 08:49:51 +0000 (08:49 +0000)]
[NFC][InstCombine] i65 tests for 'check for [no] signed truncation' pattern

Those initially broke chromium build:
https://bugs.llvm.org/show_bug.cgi?id=38204 and
https://crbug.com/864832

llvm-svn: 337364

6 years ago[ELF] - Do not produce broken output when amount of sections is > ~65k
George Rimar [Wed, 18 Jul 2018 08:44:38 +0000 (08:44 +0000)]
[ELF] - Do not produce broken output when amount of sections is > ~65k

This is a part of ttps://bugs.llvm.org//show_bug.cgi?id=38119

We produce broken ELF header now when the number of output sections is >= SHN_LORESERVE (0xff00).

ELF spec says (http://www.sco.com/developers/gabi/2003-12-17/ch4.eheader.html):

e_shnum:
If the number of sections is greater than or equal to SHN_LORESERVE (0xff00), this member has the value zero
and the actual number of section header table entries is contained in the sh_size field of the section header at index 0.
(Otherwise, the sh_size member of the initial entry contains 0.)

e_shstrndx
If the section name string table section index is greater than or equal to SHN_LORESERVE (0xff00), this member has the
value SHN_XINDEX (0xffff) and the actual index of the section name string table section is contained in the sh_link field of
the section header at index 0. (Otherwise, the sh_link member of the initial entry contains 0.)

We did not set these fields correctly earlier. The patch fixes the issue.

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

llvm-svn: 337363

6 years ago[ELF] — Add a test case for DW_EH_PE_udata2 encoding.
George Rimar [Wed, 18 Jul 2018 08:39:31 +0000 (08:39 +0000)]
[ELF] — Add a test case for DW_EH_PE_udata2 encoding.

This adds a test to check LLD can handle such address format correctly.
Test case covers the following line:
https://github.com/llvm-mirror/lld/blob/master/ELF/SyntheticSections.cpp#L519

llvm-svn: 337362

6 years ago[llvm-objdump] - Stop reporting bogus section IDs.
George Rimar [Wed, 18 Jul 2018 08:34:35 +0000 (08:34 +0000)]
[llvm-objdump] - Stop reporting bogus section IDs.

Imagine we have a file with few sections, and one of them is .foo
with index N != 0.

Problem is that when llvm-objdump is given a -section=.foo parameter
it lists .foo as a section at index 0. That makes impossible to write
test cases which needs to find the index of the particular section,
while ignoring dumping of others.

The patch fixes that.

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

llvm-svn: 337361

6 years ago[llvm-readobj] - Teach tool to dump objects with >= SHN_LORESERVE of sections.
George Rimar [Wed, 18 Jul 2018 08:19:58 +0000 (08:19 +0000)]
[llvm-readobj] - Teach tool to dump objects with >= SHN_LORESERVE of sections.

http://www.sco.com/developers/gabi/2003-12-17/ch4.eheader.html

says that e_shnum and/or e_shstrndx may have special values if
"the number of sections is greater than or equal to SHN_LORESERVE" or
"the section name string table section index is greater than or equal to SHN_LORESERVE (0xff00)"

Previously llvm-readobj was unable to dump such files, patch changes that.

I had to add a precompiled test case because it does not seem possible to
prepare a test using yaml2obj or llvm-mc (not clear how to make .shstrtab
to have index >= SHN_LORESERVE).

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

llvm-svn: 337360

6 years agoRevert test changes part of "Revert "[InstCombine] Fold 'check for [no] signed trunca...
Roman Lebedev [Wed, 18 Jul 2018 08:15:13 +0000 (08:15 +0000)]
Revert test changes part of "Revert "[InstCombine] Fold 'check for [no] signed truncation' pattern""

We want the test to remain good anyway.
I think the fix is incoming.

This reverts part of commit rL337344.

llvm-svn: 337359

6 years ago[AArch64][SVE] Asm: Support for integer MUL instructions.
Sander de Smalen [Wed, 18 Jul 2018 08:10:03 +0000 (08:10 +0000)]
[AArch64][SVE] Asm: Support for integer MUL instructions.

This patch adds the following instructions:
  MUL   - multiply vectors, e.g.
    mul z0.h, p0/m, z0.h, z1.h
        - multiply with immediate, e.g.
    mul z0.h, z0.h, #127

  SMULH - signed multiply returning high half, e.g.
    smulh z0.h, p0/m, z0.h, z1.h

  UMULH - unsigned multiply returning high half, e.g.
    umulh z0.h, p0/m, z0.h, z1.h

llvm-svn: 337358

6 years ago[X86] Enable commuting of VUNPCKHPD to VMOVLHPS to enable load folding by using VMOVL...
Craig Topper [Wed, 18 Jul 2018 07:31:32 +0000 (07:31 +0000)]
[X86] Enable commuting of VUNPCKHPD to VMOVLHPS to enable load folding by using VMOVLPS with a modified address.

This required an annoying amount of tablegen multiclass changes to make only VUNPCKHPDZ128rr commutable.

llvm-svn: 337357

6 years ago[X86] Add test case for missed opportunity to commute vunpckhpd to enable use of...
Craig Topper [Wed, 18 Jul 2018 07:31:30 +0000 (07:31 +0000)]
[X86] Add test case for missed opportunity to commute vunpckhpd to enable use of vmovlps to fold a load.

We do this transform for SSE, but not AVX or AVX512VL.

llvm-svn: 337356

6 years ago[libomptarget] Also support several images for elf
Joachim Protze [Wed, 18 Jul 2018 07:23:46 +0000 (07:23 +0000)]
[libomptarget] Also support several images for elf

In revision r336569 (D49036) libomptarget support for multiple nvidia images
has been fixed in case a target region resides inside one or multiple
libraries and in the compiled application. But the issues is still present
for elf images.
This fix will also support multiple images for elf.

Patch by Jannis Klinkenberg

Reviewers: protze.joachim, ABataev, grokos

Reviewed By: protze.joachim, ABataev, grokos

Subscribers: openmp-commits

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

llvm-svn: 337355

6 years ago[X86] Regenerate fma.ll checks using current version of the script which produces...
Craig Topper [Wed, 18 Jul 2018 07:08:28 +0000 (07:08 +0000)]
[X86] Regenerate fma.ll checks using current version of the script which produces different regular expressions on spills and reloads. NFC

llvm-svn: 337354

6 years ago[modules] Print input files when -module-file-info file switch is passed.
Vassil Vassilev [Wed, 18 Jul 2018 06:49:33 +0000 (06:49 +0000)]
[modules] Print input files when -module-file-info file switch is passed.

This patch improves traceability of duplicated header files which end
up in multiple pcms.

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

llvm-svn: 337353

6 years ago[AArch64] Define TARGET_HEADER_BUILTIN
Martin Storsjo [Wed, 18 Jul 2018 06:15:09 +0000 (06:15 +0000)]
[AArch64] Define TARGET_HEADER_BUILTIN

Without it, the new intrinsics became available for all language
variants. This was missed in SVN r337327.

llvm-svn: 337352

6 years ago[NFC] fix trivial typos in comments
Hiroshi Inoue [Wed, 18 Jul 2018 06:04:43 +0000 (06:04 +0000)]
[NFC] fix trivial typos in comments

llvm-svn: 337351

6 years agoFix build failures from r337347, found by clang
Justin Hibbits [Wed, 18 Jul 2018 05:19:25 +0000 (05:19 +0000)]
Fix build failures from r337347, found by clang

* Delete a no-longer-used override, and mark the other
getRegisterTypeForCallingConv() as override.
* SPE only supports i32, not i64, as the internal type, so simply remove
the type check, so that DestReg and Opc are provably always set.

GCC 6.4 did not warn about either of the above.

llvm-svn: 337350

6 years ago[X86] Remove patterns that mix X86ISD::MOVLHPS/MOVHLPS with v2i64/v2f64 types.
Craig Topper [Wed, 18 Jul 2018 05:10:53 +0000 (05:10 +0000)]
[X86] Remove patterns that mix X86ISD::MOVLHPS/MOVHLPS with v2i64/v2f64 types.

The X86ISD::MOVLHPS/MOVHLPS should now only be emitted in SSE1 only. This means that the v2i64/v2f64 types would be illegal thus we don't need these patterns.

llvm-svn: 337349

6 years ago[X86] Generate v2f64 X86ISD::UNPCKL/UNPCKH instead of X86ISD::MOVLHPS/MOVHLPS for...
Craig Topper [Wed, 18 Jul 2018 05:10:51 +0000 (05:10 +0000)]
[X86] Generate v2f64 X86ISD::UNPCKL/UNPCKH instead of X86ISD::MOVLHPS/MOVHLPS for unary v2f64 {0,0} and {1,1} shuffles with SSE2.

I'm trying to restrict the MOVLHPS/MOVHLPS ISD nodes to SSE1 only. With SSE2 we can use unpcks. I believe this will allow some patterns to be cleaned up to require fewer bitcasts.

I've put in an odd isel hack to still select MOVHLPS instruction from the unpckh node to avoid changing tests and because movhlps is a shorter encoding. Ideally we'd do execution domain switching on this, but the operands are in the wrong order and are tied. We might be able to try a commute in the domain switching using custom code.

We already support domain switching for UNPCKLPD and MOVLHPS.

llvm-svn: 337348

6 years agoIntroduce codegen for the Signal Processing Engine
Justin Hibbits [Wed, 18 Jul 2018 04:25:10 +0000 (04:25 +0000)]
Introduce codegen for the Signal Processing Engine

Summary:
The Signal Processing Engine (SPE) is found on NXP/Freescale e500v1,
e500v2, and several e200 cores.  This adds support targeting the e500v2,
as this is more common than the e500v1, and is in SoCs still on the
market.

This patch is very intrusive because the SPE is binary incompatible with
the traditional FPU.  After discussing with others, the cleanest
solution was to make both SPE and FPU features on top of a base PowerPC
subset, so all FPU instructions are now wrapped with HasFPU predicates.

Supported by this are:
* Code generation following the SPE ABI at the LLVM IR level (calling
conventions)
* Single- and Double-precision math at the level supported by the APU.

Still to do:
* Vector operations
* SPE intrinsics

As this changes the Callee-saved register list order, one test, which
tests the precise generated code, was updated to account for the new
register order.

Reviewed by: nemanjai
Differential Revision: https://reviews.llvm.org/D44830

llvm-svn: 337347

6 years agoComplete the SPE instruction set patterns
Justin Hibbits [Wed, 18 Jul 2018 04:24:57 +0000 (04:24 +0000)]
Complete the SPE instruction set patterns

This is the lead-up to having SPE codegen.  Add the rest of the
instructions, along with MC tests.

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

llvm-svn: 337346

6 years agoAdd PowerPC e500(v2) core scheduler and directives.
Justin Hibbits [Wed, 18 Jul 2018 04:24:49 +0000 (04:24 +0000)]
Add PowerPC e500(v2) core scheduler and directives.

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

llvm-svn: 337345

6 years agoRevert "[InstCombine] Fold 'check for [no] signed truncation' pattern"
Bob Haarman [Wed, 18 Jul 2018 02:18:28 +0000 (02:18 +0000)]
Revert "[InstCombine] Fold 'check for [no] signed truncation' pattern"

This reverts r337190 (and a few follow-up commits), which caused the
Chromium build to fail. See
https://bugs.llvm.org/show_bug.cgi?id=38204 and
https://crbug.com/864832

llvm-svn: 337344

6 years ago[XRay][compiler-rt] Segmented Array: Simplify and Optimise
Dean Michael Berris [Wed, 18 Jul 2018 02:08:39 +0000 (02:08 +0000)]
[XRay][compiler-rt] Segmented Array: Simplify and Optimise

Summary:
This is a follow-on to D49217 which simplifies and optimises the
implementation of the segmented array. In this patch we co-locate the
book-keeping for segments in the `__xray::Array<T>` with the data it's
managing. We take the chance in this patch to actually rename `Chunk` to
`Segment` to better align with the high-level description of the
segmented array.

With measurements using benchmarks landed in D48879, we've identified
that calls to `pthread_getspecific` started dominating the cycles, which
led us to revert the change made in D49217 to use C++ thread_local
initialisation instead (it reduces the cost by a huge margin, since we
save one PLT-based call to pthread functions in the hot path). In
particular, this is in `__xray::getThreadLocalData()`.

We also took the opportunity to remove the least-common-multiple based
calculation and instead pack as much data into segments of the array.
This greatly simplifies the API of the container which hides as much of
the implementation details as possible. For instance, we calculate the
number of elements we need for the each segment internally in the Array
instead of making it part of the type.

With the changes here, we're able to get a measurable improvement on the
performance of profiling mode on top of what D48879 already provides.

Depends on D48879.

Reviewers: kpw, eizan

Subscribers: llvm-commits

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

llvm-svn: 337343

6 years ago[XRay][compiler-rt] Simplify Allocator Implementation
Dean Michael Berris [Wed, 18 Jul 2018 01:53:39 +0000 (01:53 +0000)]
[XRay][compiler-rt] Simplify Allocator Implementation

Summary:
This change simplifies the XRay Allocator implementation to self-manage
an mmap'ed memory segment instead of using the internal allocator
implementation in sanitizer_common.

We've found through benchmarks and profiling these benchmarks in D48879
that using the internal allocator in sanitizer_common introduces a
bottleneck on allocating memory through a central spinlock. This change
allows thread-local allocators to eliminate contention on the
centralized allocator.

To get the most benefit from this approach, we also use a managed
allocator for the chunk elements used by the segmented array
implementation. This gives us the chance to amortize the cost of
allocating memory when creating these internal segmented array data
structures.

We also took the opportunity to remove the preallocation argument from
the allocator API, simplifying the usage of the allocator throughout the
profiling implementation.

In this change we also tweak some of the flag values to reduce the
amount of maximum memory we use/need for each thread, when requesting
memory through mmap.

Depends on D48956.

Reviewers: kpw, eizan

Subscribers: llvm-commits

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

llvm-svn: 337342