OSDN Git Service

android-x86/external-llvm.git
5 years ago[DAG] SelectionDAGLegalize::ExpandLegalINT_TO_FP - use getFPExtendOrRound helper...
Simon Pilgrim [Wed, 26 Sep 2018 16:24:07 +0000 (16:24 +0000)]
[DAG] SelectionDAGLegalize::ExpandLegalINT_TO_FP - use getFPExtendOrRound helper. NFCI.

Handles SrcVT == DstVT as well.

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

5 years ago[AArch64] Extend single-operand FP insns to match Arm ARM (NFCI)
Oliver Stannard [Wed, 26 Sep 2018 15:42:47 +0000 (15:42 +0000)]
[AArch64] Extend single-operand FP insns to match Arm ARM (NFCI)

The Armv8.3-A reference manual defines floating-point data-processing
instructions with one source operand to have an opcode of 6 bits
[20:15]. The current class in tablegen, BaseSingleOperandFPData, only
allows [18:15]. This was ok because [20:19] could only be '00', with
other encodings unallocated. Armv8.5-A brings in the FRINT group of
instructions which use other values for these bits.

This patch refactors the existing class a bit to allow using the full 6
bits of the opcode, as defined in the Arm ARM.

Patch by Pablo Barrio!

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

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

5 years agolit: Make sure the builtin_commands directory is packaged by setup.py
Tom Stellard [Wed, 26 Sep 2018 14:56:11 +0000 (14:56 +0000)]
lit: Make sure the builtin_commands directory is packaged by setup.py

Summary: This directory was missing from the lit package on pypi.org.

Reviewers: ddunbar

Subscribers: delcypher, llvm-commits

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

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

5 years agoRevert r343112 as CallFrameString API change has broken lldb builds
Luke Cheeseman [Wed, 26 Sep 2018 14:48:03 +0000 (14:48 +0000)]
Revert r343112 as CallFrameString API change has broken lldb builds

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

5 years ago[AArch64] Refactor instructions that write PSTATE (NFCI)
Oliver Stannard [Wed, 26 Sep 2018 14:42:59 +0000 (14:42 +0000)]
[AArch64] Refactor instructions that write PSTATE (NFCI)

Reuse some code in preparation for the v8.5A XAFlag/AXFlag instructions,
which shares part of the encoding of the MSR-immediate.

Patch by Pablo Barrio!

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

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

5 years ago[AArch64] - Return address signing dwarf support
Luke Cheeseman [Wed, 26 Sep 2018 14:30:29 +0000 (14:30 +0000)]
[AArch64] - Return address signing dwarf support

- Reapply r343089 with a fix for DebugInfo/Sparc/gnu-window-save.ll

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

5 years ago[llvm-exgesis][NFC] Do not pollute buildbots with messages when
Clement Courbet [Wed, 26 Sep 2018 13:58:26 +0000 (13:58 +0000)]
[llvm-exgesis][NFC] Do not pollute buildbots with messages when
the exegesis lit tests cannot run.

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

5 years ago[AArch64][AsmParser] Show name of missing feature for system instructions
Oliver Stannard [Wed, 26 Sep 2018 13:52:27 +0000 (13:52 +0000)]
[AArch64][AsmParser] Show name of missing feature for system instructions

Parsing of the system instructions (IC, DC, AT and TLBI) uses this
function to show the required architecture when the operand is valid,
but the architecture is not enabled. Armv8.5A adds a few different
system instructions as part of optional features, so we need to extend
it to show individual features, not just base architectures.

This is NFC for now, but will be used by three different features added
in v8.5A, and will be tested by them.

Patch by David Spickett!

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

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

5 years ago[llvm-exegesis] Get rid of debug_string.
Clement Courbet [Wed, 26 Sep 2018 13:35:10 +0000 (13:35 +0000)]
[llvm-exegesis] Get rid of debug_string.

Summary:
THis is a backwards-compatible change (existing files will work as
expected).

See PR39082.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

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

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

5 years ago[CodeGen] Always print register ties in MI::dump()
Francis Visoiu Mistrih [Wed, 26 Sep 2018 13:33:09 +0000 (13:33 +0000)]
[CodeGen] Always print register ties in MI::dump()

It was the case when calling MO::dump(), but MI::dump() was still
depending on hasComplexRegisterTies().

The MIR output is not affected.

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

5 years ago[ARM/AArch64] Add target parser unit tests for Armv8.4-A
Oliver Stannard [Wed, 26 Sep 2018 13:09:15 +0000 (13:09 +0000)]
[ARM/AArch64] Add target parser unit tests for Armv8.4-A

These were missed when adding Armv8.4-A support.

Patch by Pablo Barrio!

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

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

5 years ago[PassTiming] cleaning up legacy PassTimingInfo interface. NFCI.
Fedor Sergeev [Wed, 26 Sep 2018 13:01:43 +0000 (13:01 +0000)]
[PassTiming] cleaning up legacy PassTimingInfo interface. NFCI.

During D51276 discussion it was decided that legacy PassTimingInfo
interface can not be reused for new pass manager's implementation
of -time-passes.

This is a cleanup in preparation for D51276 to make legacy interface
as concise as possible, moving the PassTimingInfo from the header
into the anonymous legacy namespace in .cpp.

It is rather close to a revert of rL340872 in a sense that it hides
the interface and gets rid of templates. However as compared to
a complete revert it resides in a different translation unit and has
an additional pass-instance counting funcitonality (PassIDCountMap).

Reviewers: philip.pfaffe
Differential Revision: https://reviews.llvm.org/D52356

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

5 years agoRevert r343089 "[AArch64] - Return address signing dwarf support"
Hans Wennborg [Wed, 26 Sep 2018 12:57:45 +0000 (12:57 +0000)]
Revert r343089 "[AArch64] - Return address signing dwarf support"

This caused the DebugInfo/Sparc/gnu-window-save.ll test to fail.

> Functions that have signed return addresses need additional dwarf support:
> - After signing the LR, and before authenticating it, the LR register is in a
>   state the is unusable by a debugger or unwinder
> - To account for this a new directive, .cfi_negate_ra_state, is added
> - This directive says the signed state of the LR register has now changed,
>   i.e. unsigned -> signed or signed -> unsigned
> - This directive has the same CFA code as the SPARC directive GNU_window_save
>   (0x2d), adding a macro to account for multiply defined codes
> - This patch matches the gcc implementation of this support:
>   https://patchwork.ozlabs.org/patch/800271/
>
> Differential Revision: https://reviews.llvm.org/D50136

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

5 years ago[ARM/AArch64][v8.5A] Add Armv8.5-A target
Oliver Stannard [Wed, 26 Sep 2018 12:48:21 +0000 (12:48 +0000)]
[ARM/AArch64][v8.5A] Add Armv8.5-A target

This patch allows targeting Armv8.5-A, adding the architecture to
tablegen and setting the options to be identical to Armv8.4-A for the
time being. Subsequent patches will add support for the different
features included in the Armv8.5-A Reference Manual.

Patch by Pablo Barrio!

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

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

5 years ago[DAG] ExpandLegalINT_TO_FP - pull out repeated getValueType() call. NFCI.
Simon Pilgrim [Wed, 26 Sep 2018 12:42:19 +0000 (12:42 +0000)]
[DAG] ExpandLegalINT_TO_FP - pull out repeated getValueType() call. NFCI.

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

5 years ago[PowerPC] optimize conditional branch on CRSET/CRUNSET
Hiroshi Inoue [Wed, 26 Sep 2018 12:32:45 +0000 (12:32 +0000)]
[PowerPC] optimize conditional branch on CRSET/CRUNSET

This patch adds a check to optimize conditional branch (BC and BCn) based on a constant set by CRSET or CRUNSET.
Other optimizers, such as block placement, may generate such code and hence
I do this at the very end of the optimization in pre-emit peephole pass.

A conditional branch based on a constant is eliminated or converted into unconditional branch.
Also CRSET/CRUNSET is eliminated if the condition code register is not used
by instruction other than the branch to be optimized.

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

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

5 years agoRevert r343058 "[ORC] Add support for multithreaded compiles to LLJIT and LLLazyJIT."
Hans Wennborg [Wed, 26 Sep 2018 12:15:23 +0000 (12:15 +0000)]
Revert r343058 "[ORC] Add support for multithreaded compiles to LLJIT and LLLazyJIT."

This doesn't work well in builds configured with LLVM_ENABLE_THREADS=OFF,
causing the following assert when running
ExecutionEngine/OrcLazy/multiple-compile-threads-basic.ll:

  lib/ExecutionEngine/Orc/Core.cpp:1748: Expected<llvm::JITEvaluatedSymbol>
  llvm::orc::lookup(const llvm::orc::JITDylibList &, llvm::orc::SymbolStringPtr):
  Assertion `ResultMap->size() == 1 && "Unexpected number of results"' failed.

> LLJIT and LLLazyJIT can now be constructed with an optional NumCompileThreads
> arguments. If this is non-zero then a thread-pool will be created with the
> given number of threads, and compile tasks will be dispatched to the thread
> pool.
>
> To enable testing of this feature, two new flags are added to lli:
>
> (1) -compile-threads=N (N = 0 by default) controls the number of compile threads
> to use.
>
> (2) -thread-entry can be used to execute code on additional threads. For each
> -thread-entry argument supplied (multiple are allowed) a new thread will be
> created and the given symbol called. These additional thread entry points are
> called after static constructors are run, but before main.

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

5 years ago[llvm-exegesis][NFC] Move CodeTemplate to it's own file.
Guillaume Chatelet [Wed, 26 Sep 2018 11:57:24 +0000 (11:57 +0000)]
[llvm-exegesis][NFC] Move CodeTemplate to it's own file.

Summary: This is is preparation of exploring value ranges.

Reviewers: courbet

Reviewed By: courbet

Subscribers: mgorny, tschuett, llvm-commits

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

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

5 years ago[X86][SSE] Refresh PR34947 test code to handle D52504
Simon Pilgrim [Wed, 26 Sep 2018 11:53:51 +0000 (11:53 +0000)]
[X86][SSE] Refresh PR34947 test code to handle D52504

The previously reduced version used urem <9 x i32> zeroinitializer, %tmp which D52504 will simplify.

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

5 years ago[X86][SSE] canReduceVMulWidth - use ComputeNumSignBits/SignBitIsZero directly
Simon Pilgrim [Wed, 26 Sep 2018 11:48:52 +0000 (11:48 +0000)]
[X86][SSE] canReduceVMulWidth - use ComputeNumSignBits/SignBitIsZero directly

Don't reinvent the wheel for BUILD_VECTOR/ZERO_EXTEND - its only the ANY_EXTEND special case that needs handling.

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

5 years ago[llvm-exegesis] Add support for measuring NumMicroOps.
Clement Courbet [Wed, 26 Sep 2018 11:22:56 +0000 (11:22 +0000)]
[llvm-exegesis] Add support for measuring NumMicroOps.

Summary:
Example output for vzeroall:

---
mode:            uops
key:
  instructions:
    - 'VZEROALL'
  config:          ''
  register_initial_values:
cpu_name:        haswell
llvm_triple:     x86_64-unknown-linux-gnu
num_repetitions: 10000
measurements:
  - { debug_string: HWPort0, value: 0.0006, per_snippet_value: 0.0006,
      key: '3' }
  - { debug_string: HWPort1, value: 0.0011, per_snippet_value: 0.0011,
      key: '4' }
  - { debug_string: HWPort2, value: 0.0004, per_snippet_value: 0.0004,
      key: '5' }
  - { debug_string: HWPort3, value: 0.0018, per_snippet_value: 0.0018,
      key: '6' }
  - { debug_string: HWPort4, value: 0.0002, per_snippet_value: 0.0002,
      key: '7' }
  - { debug_string: HWPort5, value: 1.0019, per_snippet_value: 1.0019,
      key: '8' }
  - { debug_string: HWPort6, value: 1.0033, per_snippet_value: 1.0033,
      key: '9' }
  - { debug_string: HWPort7, value: 0.0001, per_snippet_value: 0.0001,
      key: '10' }
  - { debug_string: NumMicroOps, value: 20.0069, per_snippet_value: 20.0069,
      key: NumMicroOps }
error:           ''
info:            ''
assembled_snippet: C5FC77C5FC77C5FC77C5FC77C5FC77C5FC77C5FC77C5FC77C5FC77C5FC77C5FC77C5FC77C5FC77C5FC77C5FC77C5FC77C3
...

Reviewers: gchatelet

Subscribers: tschuett, RKSimon, andreadb, llvm-commits

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

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

5 years ago[X86][SSE] Use ISD::MULHS for constant vXi16 ISD::SRA lowering (PR38151)
Simon Pilgrim [Wed, 26 Sep 2018 10:57:05 +0000 (10:57 +0000)]
[X86][SSE] Use ISD::MULHS for constant vXi16 ISD::SRA lowering (PR38151)

Similar to the existing ISD::SRL constant vector shifts from D49562, this patch adds ISD::SRA support with ISD::MULHS.

As we're dealing with signed values, we have to handle shift by zero and shift by one special cases, so XOP+AVX2/AVX512 splitting/extension is still a better solution - really we should still use ISD::MULHS if one of the special cases are used but for now I've just left a TODO and filtered by isKnownNeverZero.

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

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

5 years ago[ARM] Fix for PR39060
Sam Parker [Wed, 26 Sep 2018 10:56:00 +0000 (10:56 +0000)]
[ARM] Fix for PR39060

When calculating whether a value can safely overflow for use by an
icmp, we weren't checking that the value couldn't wrap around. To do
this we need the icmp to be using a constant, as well as the incoming
add or sub.

bugzilla report: https://bugs.llvm.org/show_bug.cgi?id=39060

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

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

5 years ago[CodeGen] Enable tail calls for functions with NonNull attributes.
David Green [Wed, 26 Sep 2018 10:46:18 +0000 (10:46 +0000)]
[CodeGen] Enable tail calls for functions with NonNull attributes.

Adding NonNull as attributes to returned pointers has the unfortunate side
effect of disabling tail calls. This patch ignores the NonNull attribute when
we decide whether to tail merge, in the same way that we ignore the NoAlias
attribute, as it has no affect on the call sequence.

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

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

5 years agoFixes removal of dead elements from PressureDiff (PR37252).
Yury Gribov [Wed, 26 Sep 2018 10:42:41 +0000 (10:42 +0000)]
Fixes removal of dead elements from PressureDiff (PR37252).

Reviewed By: MatzeB

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

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

5 years ago[AArch64] - Return address signing dwarf support
Luke Cheeseman [Wed, 26 Sep 2018 10:14:15 +0000 (10:14 +0000)]
[AArch64] - Return address signing dwarf support

Functions that have signed return addresses need additional dwarf support:
- After signing the LR, and before authenticating it, the LR register is in a
  state the is unusable by a debugger or unwinder
- To account for this a new directive, .cfi_negate_ra_state, is added
- This directive says the signed state of the LR register has now changed,
  i.e. unsigned -> signed or signed -> unsigned
- This directive has the same CFA code as the SPARC directive GNU_window_save
  (0x2d), adding a macro to account for multiply defined codes
- This patch matches the gcc implementation of this support:
  https://patchwork.ozlabs.org/patch/800271/

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

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

5 years ago[CMake] Avoid REVERSE on unset variable
Sven van Haastregt [Wed, 26 Sep 2018 10:14:10 +0000 (10:14 +0000)]
[CMake] Avoid REVERSE on unset variable

If required_libs happens to remain unset, CMake would fail with:

  list sub-command REVERSE requires list to be present.

Fix by ensuring we do not attempt to reverse an unset variable.

Reported by Tu Vuong.

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

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

5 years agoRun VerifyDAGDiverence in debug only
Mikael Nilsson [Wed, 26 Sep 2018 09:25:45 +0000 (09:25 +0000)]
Run VerifyDAGDiverence in debug only

VerifyDAGDiverence costs compilation time, avoid running it in non-debug
builds.

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

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

5 years agoRevert r342870 "[ARM] bottom-top mul support ARMParallelDSP"
Hans Wennborg [Wed, 26 Sep 2018 08:41:50 +0000 (08:41 +0000)]
Revert r342870 "[ARM] bottom-top mul support ARMParallelDSP"

This broke Chromium's Android build (https://crbug.com/889390) and the
polly-aosp buildbot
(http://lab.llvm.org:8011/builders/aosp-O3-polly-before-vectorizer-unprofitable).

> Originally committed in rL342210 but was reverted in rL342260 because
> it was causing issues in vectorized code, because I had forgotten to
> ensure that we're operating on scalar values.
>
> Original commit message:
>
> On failing to find sequences that can be converted into dual macs,
> try to find sequential 16-bit loads that are used by muls which we
> can then use smultb, smulbt, smultt with a wide load.
>
> Differential Revision: https://reviews.llvm.org/D51983

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

5 years ago[llvm-exegesis] Output the unscaled value as well as the scaled one.
Clement Courbet [Wed, 26 Sep 2018 08:37:21 +0000 (08:37 +0000)]
[llvm-exegesis] Output the unscaled value as well as the scaled one.

Summary: See PR38936 for context.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

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

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

5 years agoSilence compiler warning about unused variable introduced in r343018
Mikael Holmen [Wed, 26 Sep 2018 06:19:08 +0000 (06:19 +0000)]
Silence compiler warning about unused variable introduced in r343018

Since the body of the "else if" contains
 // TODO
I suppose someone will need the variable again at some point, but with
-Werror the warning made it not compile at all.

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

5 years ago[ORC] Remove a superfluous semicolon, fixing warnings. NFC.
Martin Storsjo [Wed, 26 Sep 2018 06:13:03 +0000 (06:13 +0000)]
[ORC] Remove a superfluous semicolon, fixing warnings. NFC.

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

5 years ago[ORC] Update CompileOnDemandLayer2 to use the new lazyReexports mechanism
Lang Hames [Wed, 26 Sep 2018 05:08:29 +0000 (05:08 +0000)]
[ORC] Update CompileOnDemandLayer2 to use the new lazyReexports mechanism
for lazy compilation, rather than a callback manager.

The new mechanism does not block compile threads, and does not require
function bodies to be renamed.

Future modifications should allow laziness on a per-module basis to work
without any modification of the input module.

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

5 years ago[DebugInfo] Do not generate address info for removed debug labels.
Hsiangkai Wang [Wed, 26 Sep 2018 04:19:23 +0000 (04:19 +0000)]
[DebugInfo] Do not generate address info for removed debug labels.

In some senario, LLVM will remove llvm.dbg.labels in IR. For example,
when the labels are in unreachable blocks, these labels will not
be generated in LLVM IR. In the case, these debug labels will have
address zero as their address. It is not legal address for debugger to
set breakpoints or query sources. So, the patch inhibits the address info
(DW_AT_low_pc) of removed labels.

Fix build failed in BuildBot, clang-stage1-cmake-RA-incremental, on macOS.

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

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

5 years ago[ORC] Add a "lazy call-through" utility based on the same underlying trampoline
Lang Hames [Wed, 26 Sep 2018 04:18:30 +0000 (04:18 +0000)]
[ORC] Add a "lazy call-through" utility based on the same underlying trampoline
implementation as lazy compile callbacks, and a "lazy re-exports" utility that
builds lazy call-throughs.

Lazy call-throughs are similar to lazy compile callbacks (and are based on the
same underlying state saving/restoring trampolines) but resolve their targets
by performing a standard ORC lookup rather than invoking a user supplied
compiler callback. This allows them to inherit the thread-safety of ORC lookups
while blocking only the calling thread (whereas compile callbacks also block one
compile thread).

Lazy re-exports provide a simple way of building lazy call-throughs. Unlike a
regular re-export, a lazy re-export generates a new address (a stub entry point)
that will act like the re-exported symbol when called. The first call via a
lazy re-export will trigger compilation of the re-exported symbol before calling
through to it.

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

5 years ago[ORC] Fix BuildingAJIT tutorial examples that were broken by r343059.
Lang Hames [Wed, 26 Sep 2018 04:00:58 +0000 (04:00 +0000)]
[ORC] Fix BuildingAJIT tutorial examples that were broken by r343059.

createLocalCompileCallbackManager now returns an Expected value. This commit
wraps the call with cantFail to unwrap it.

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

5 years ago[ORC] Refactor trampoline pool management out of JITCompileCallbackManager.
Lang Hames [Wed, 26 Sep 2018 03:32:12 +0000 (03:32 +0000)]
[ORC] Refactor trampoline pool management out of JITCompileCallbackManager.

This will allow trampoline pools to be re-used for a new lazy-reexport utility
that generates looks up function bodies using the standard symbol lookup process
(rather than using a user provided compile function). This new utility provides
the same capabilities (since MaterializationUnits already allow user supplied
compile functions to be run) as JITCompileCallbackManager, but can use the new
asynchronous lookup functions to avoid blocking a compile thread.

This patch also updates createLocalCompileCallbackManager to return an error if
a callback manager can not be created, and updates clients of that API to
account for the change. Finally, the OrcCBindingsStack is updates so that if
a callback manager is not available for the target platform a valid stack
(without support for lazy compilation) can still be constructed.

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

5 years ago[ORC] Add support for multithreaded compiles to LLJIT and LLLazyJIT.
Lang Hames [Wed, 26 Sep 2018 02:39:42 +0000 (02:39 +0000)]
[ORC] Add support for multithreaded compiles to LLJIT and LLLazyJIT.

LLJIT and LLLazyJIT can now be constructed with an optional NumCompileThreads
arguments. If this is non-zero then a thread-pool will be created with the
given number of threads, and compile tasks will be dispatched to the thread
pool.

To enable testing of this feature, two new flags are added to lli:

(1) -compile-threads=N (N = 0 by default) controls the number of compile threads
to use.

(2) -thread-entry can be used to execute code on additional threads. For each
-thread-entry argument supplied (multiple are allowed) a new thread will be
created and the given symbol called. These additional thread entry points are
called after static constructors are run, but before main.

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

5 years ago[ORC] Include-what-you-use fixes.
Lang Hames [Wed, 26 Sep 2018 02:01:39 +0000 (02:01 +0000)]
[ORC] Include-what-you-use fixes.

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

5 years ago[ORC] Fix a missing include in r343055.
Lang Hames [Wed, 26 Sep 2018 01:54:13 +0000 (01:54 +0000)]
[ORC] Fix a missing include in r343055.

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

5 years ago[ORC] Add ThreadSafeModule and ThreadSafeContext wrappers to support concurrent
Lang Hames [Wed, 26 Sep 2018 01:24:12 +0000 (01:24 +0000)]
[ORC] Add ThreadSafeModule and ThreadSafeContext wrappers to support concurrent
compilation of IR in the JIT.

ThreadSafeContext is a pair of an LLVMContext and a mutex that can be used to
lock that context when it needs to be accessed from multiple threads.

ThreadSafeModule is a pair of a unique_ptr<Module> and a
shared_ptr<ThreadSafeContext>. This allows the lifetime of a ThreadSafeContext
to be managed automatically in terms of the ThreadSafeModules that refer to it:
Once all modules using a ThreadSafeContext are destructed, and providing the
client has not held on to a copy of shared context pointer, the context will be
automatically destructed.

This scheme is necessary due to the following constraits: (1) We need multiple
contexts for multithreaded compilation (at least one per compile thread plus
one to store any IR not currently being compiled, though one context per module
is simpler). (2) We need to free contexts that are no longer being used so that
the JIT does not leak memory over time. (3) Module lifetimes are not
predictable (modules are compiled as needed depending on the flow of JIT'd
code) so there is no single point where contexts could be reclaimed.

JIT clients not using concurrency can safely use one ThreadSafeContext for all
ThreadSafeModules.

JIT clients who want to be able to compile concurrently should use a different
ThreadSafeContext for each module, or call setCloneToNewContextOnEmit on their
top-level IRLayer. The former reduces compile latency (since no clone step is
needed) at the cost of additional memory overhead for uncompiled modules (as
every uncompiled module will duplicate the LLVM types, constants and metadata
that have been shared).

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

5 years agoRemove LoopID metadata from the branch instruction
Vyacheslav Zakharin [Wed, 26 Sep 2018 01:03:21 +0000 (01:03 +0000)]
Remove LoopID metadata from the branch instruction
that follows the peeled iterations.

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

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

5 years agoRevert "Revert "[ConstHoist] Do not rebase single (or few) dependent constant""
Zhaoshi Zheng [Wed, 26 Sep 2018 00:59:09 +0000 (00:59 +0000)]
Revert "Revert "[ConstHoist] Do not rebase single (or few) dependent constant""

This reverts commit bd7b44f35ee9fbe365eb25ce55437ea793b39346.

Reland r342994: disabled the optimization and explicitly enable it in test.

-mllvm -consthoist-min-num-to-rebase<unsigned>=0

[ConstHoist] Do not rebase single (or few) dependent constant

If an instance (InsertionPoint or IP) of Base constant A has only one or few
rebased constants depending on it, do NOT rebase. One extra ADD instruction is
required to materialize each rebased constant, assuming A and the rebased have
the same materialization cost.

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

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

5 years ago[WebAssembly] SIMD conversions
Thomas Lively [Wed, 26 Sep 2018 00:34:36 +0000 (00:34 +0000)]
[WebAssembly] SIMD conversions

Summary:
Lowers (s|u)itofp and fpto(s|u)i instructions for vectors. The fp to
int conversions produce poison values if their arguments are out of
the convertible range, so a future CL will have to add an LLVM
intrinsic to make the saturating behavior of this conversion usable.

Reviewers: aheejin, dschuff

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

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

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

5 years ago[DAGCombiner] Remove unnecessary check for visitSDIVLike/visitUDIVLike returning...
Craig Topper [Tue, 25 Sep 2018 23:52:07 +0000 (23:52 +0000)]
[DAGCombiner] Remove unnecessary check for visitSDIVLike/visitUDIVLike returning a UDIVREM or SDIVREM node.

This shouldn't be possible and is a leftover from when we used to recursively call combine here.

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

5 years ago[AMDGPU] Fix ds combine with subregs
Stanislav Mekhanoshin [Tue, 25 Sep 2018 23:33:18 +0000 (23:33 +0000)]
[AMDGPU] Fix ds combine with subregs

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

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

5 years ago[X86] Allow movmskpd/ps ISD nodes to be created and selected with integer input types.
Craig Topper [Tue, 25 Sep 2018 23:28:27 +0000 (23:28 +0000)]
[X86] Allow movmskpd/ps ISD nodes to be created and selected with integer input types.

This removes an int->fp bitcast between the surrounding code and the movmsk. I had already added a hack to combineMOVMSK to try to look through this bitcast to improve the SimplifyDemandedBits there.

But I found an additional issue where the bitcast was preventing combineMOVMSK from being called again after earlier nodes in the DAG are optimized. The bitcast gets revisted, but not the user of the bitcast. By using integer types throughout, the bitcast doesn't get in the way.

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

5 years ago[X86] Add some more movmsk test cases. NFC
Craig Topper [Tue, 25 Sep 2018 23:28:24 +0000 (23:28 +0000)]
[X86] Add some more movmsk test cases. NFC

These IR patterns represent the exact behavior of a movmsk instruction using (zext (bitcast (icmp slt X, 0))).

For the v4i32/v8i32/v2i64/v4i64 we currently emit a PCMPGT for the icmp slt which is unnecessary since we only care about the sign bit of the result. This is because of the int->fp bitcast we put on the input to the movmsk nodes for these cases. I'll be fixing this in a future patch.

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

5 years ago[ORC] Add an asynchronous jit-link function, jitLinkForORC, to RuntimeDyld and
Lang Hames [Tue, 25 Sep 2018 22:57:44 +0000 (22:57 +0000)]
[ORC] Add an asynchronous jit-link function, jitLinkForORC, to RuntimeDyld and
switch RTDyldObjectLinkingLayer2 to use it.

RuntimeDyld::loadObject is currently a blocking operation. This means that any
JIT'd code whose call-graph contains an embedded complete K graph will require
at least K threads to link, which precludes the use of a fixed sized thread
pool for concurrent JITing of arbitrary code (whatever K the thread-pool is set
at, any code with a K+1 complete subgraph will deadlock at JIT-link time).

To address this issue, this commmit introduces a function called jitLinkForORC
that uses continuation-passing style to pass the fix-up and finalization steps
to the asynchronous symbol resolver interface so that linking can be performed
without blocking.

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

5 years ago[InstCombine] add fneg variation of shuffle-binop fold; NFC
Sanjay Patel [Tue, 25 Sep 2018 22:48:58 +0000 (22:48 +0000)]
[InstCombine] add fneg variation of shuffle-binop fold; NFC

If the fsub in this pattern was replaced by an actual fneg
instruction, we would need to add a fold to recognize that
because fneg would not be a binop.

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

5 years agoAMDGPU: Add Selection patterns to support add of one bit.
Changpeng Fang [Tue, 25 Sep 2018 21:21:18 +0000 (21:21 +0000)]
AMDGPU: Add Selection patterns to support add of one bit.

Summary:
  We generate s_xor to lower add of i1s in general cases, and s_not to
lower add with a one-bit imm of -1 (true).

Reviewers:
  rampitec

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

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

5 years ago[LV][LAA] Vectorize loop invariant values stored into loop invariant address
Anna Thomas [Tue, 25 Sep 2018 20:57:20 +0000 (20:57 +0000)]
[LV][LAA] Vectorize loop invariant values stored into loop invariant address

Summary:
We are overly conservative in loop vectorizer with respect to stores to loop
invariant addresses.
More details in https://bugs.llvm.org/show_bug.cgi?id=38546
This is the first part of the fix where we start with vectorizing loop invariant
values to loop invariant addresses.

This also includes changes to ORE for stores to invariant address.

Reviewers: anemet, Ayal, mkuper, mssimpso

Subscribers: llvm-commits

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

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

5 years ago[MCAsmParser] Move AltMacroMode tracking out of MCAsmLexer
Craig Topper [Tue, 25 Sep 2018 20:55:55 +0000 (20:55 +0000)]
[MCAsmParser] Move AltMacroMode tracking out of MCAsmLexer

The Lexer doesn't use this state itself. It is only set and used by AsmParser so it seems like it should just be part of AsmParser.

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

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

5 years ago[X86] combineUIntToFP - Fix UINT_TO_FP(vXi1) comment (PR39078)
Simon Pilgrim [Tue, 25 Sep 2018 20:52:08 +0000 (20:52 +0000)]
[X86] combineUIntToFP - Fix UINT_TO_FP(vXi1) comment (PR39078)

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

5 years agoRemove 'orc' namespace from MSVCErrorWorkarounds.h, fix some typos that were
Lang Hames [Tue, 25 Sep 2018 20:48:57 +0000 (20:48 +0000)]
Remove 'orc' namespace from MSVCErrorWorkarounds.h, fix some typos that were
breaking windows builds.

The 'orc' namespace was accidentally left in when the workarounds were moved
out of orc in r343011.

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

5 years agoFix a missing includes and a use of the MSVC promise/future workaround that
Lang Hames [Tue, 25 Sep 2018 20:16:06 +0000 (20:16 +0000)]
Fix a missing includes and a use of the MSVC promise/future workaround that
were left out of r343011/r343012.

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

5 years ago[ThinLTO] Efficiency fix for writing type id records in per-module indexes
Teresa Johnson [Tue, 25 Sep 2018 20:14:40 +0000 (20:14 +0000)]
[ThinLTO] Efficiency fix for writing type id records in per-module indexes

Summary:
In D49565/r337503, the type id record writing was fixed so that only
referenced type ids were emitted into each per-module index for ThinLTO
distributed builds. However, this still left an efficiency issue: each
per-module index checked all type ids for membership in the referenced
set, yielding O(M*N) performance (M indexes and N type ids).

Change the TypeIdMap in the summary to be indexed by GUID, to facilitate
correlating with type identifier GUIDs referenced in the function
summary TypeIdInfo structures. This allowed simplifying other
places where a map from type id GUID to type id map entry was previously
being used to aid this correlation.

Also fix AsmWriter code to handle the rare case of type id GUID
collision.

For a large internal application, this reduced the thin link time by
almost 15%.

Reviewers: pcc, vitalybuka

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

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

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

5 years ago[MC] Return a std::string instead of taking it as an out parameter. Make two parser...
Craig Topper [Tue, 25 Sep 2018 20:13:55 +0000 (20:13 +0000)]
[MC] Return a std::string instead of taking it as an out parameter. Make two parser methods into static functions at file scope. NFC

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

5 years agoUnify landing pad information adding routines (NFC)
Heejin Ahn [Tue, 25 Sep 2018 19:56:44 +0000 (19:56 +0000)]
Unify landing pad information adding routines (NFC)

Summary:
We have `llvm::addLandingPadInfo` and `MachineFunction::addLandingPad`,
both of which add landing pad information to populate `LandingPadInfo`
but are called from different locations, which was confusing. This patch
unifies them with one `MachineFunction::addLandingPad` function, which
now has functionlities of both functions.

Reviewers: rnk

Subscribers: llvm-commits

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

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

5 years ago[ORC] Reapply r342939 with a fix for MSVC's promise/future restrictions.
Lang Hames [Tue, 25 Sep 2018 19:48:46 +0000 (19:48 +0000)]
[ORC] Reapply r342939 with a fix for MSVC's promise/future restrictions.

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

5 years agoMove MSVC workarounds for future<Error>/future<Expected<T>> out of ORC and into
Lang Hames [Tue, 25 Sep 2018 19:48:44 +0000 (19:48 +0000)]
Move MSVC workarounds for future<Error>/future<Expected<T>> out of ORC and into
a header in support.

MSVC's std::future implementation requires types to be default constructible,
but Error and Expected are not. This issue came up once before in ORC's
RPCUtils.h header and was worked around there but came up again in r342939, so
I am moving the workaround to Support to make it available to other clients.

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

5 years ago[MC] Fix bad indentation and 80 column violations. Use StringRef::front instead of...
Craig Topper [Tue, 25 Sep 2018 19:37:35 +0000 (19:37 +0000)]
[MC] Fix bad indentation and 80 column violations. Use StringRef::front instead of dereferencing StringRef::begin. NFC

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

5 years ago[x86] avoid 256-bit andnp that requires insert/extract with AVX1 (PR37449)
Sanjay Patel [Tue, 25 Sep 2018 19:09:34 +0000 (19:09 +0000)]
[x86] avoid 256-bit andnp that requires insert/extract with AVX1 (PR37449)

This is the final (I hope!) problem pattern mentioned in PR37749:
https://bugs.llvm.org/show_bug.cgi?id=37749

We are trying to avoid an AVX1 sinkhole caused by having 256-bit bitwise logic ops but no other 256-bit integer ops.
We've already solved the simple logic ops, but 'andn' is an x86 special. I looked at alternative solutions like
extending the generic DAG combine or trying to wait until the ANDNP node is created, but those are bigger patches
that can over-reach. Ie, splitting to 128-bit does not look like a win in most cases with >1 256-bit op.

The pattern matching is cluttered with bitcasts because of our i64 element canonicalization. For the affected test,
we have this vector-type-legalized sequence:

        t29: v8i32 = concat_vectors t27, t28
      t30: v4i64 = bitcast t29
        t18: v8i32 = BUILD_VECTOR Constant:i32<-1>, Constant:i32<-1>, ...
      t31: v4i64 = bitcast t18
    t32: v4i64 = xor t30, t31
      t9: v8i32 = BUILD_VECTOR Constant:i32<255>, Constant:i32<255>, ...
    t34: v4i64 = bitcast t9
  t35: v4i64 = and t32, t34
t36: v8i32 = bitcast t35
      t37: v4i32 = extract_subvector t36, Constant:i64<0>
      t38: v4i32 = extract_subvector t36, Constant:i64<4>

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

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

5 years ago[WebAssembly] Move/clone DBG_VALUE during WebAssemblyRegStackify pass
Yury Delendik [Tue, 25 Sep 2018 18:59:34 +0000 (18:59 +0000)]
[WebAssembly] Move/clone DBG_VALUE during WebAssemblyRegStackify pass

Summary:
The MoveForSingleUse or MoveAndTeeForMultiUse functions move wasm instructions,
however DBG_VALUE stay unchanged -- moving or cloning these.

Reviewers: dschuff

Reviewed By: dschuff

Subscribers: mattd, MatzeB, dschuff, sbc100, jgravelle-google, aheejin, sunfish, llvm-commits, aardappel

Tags: #debug-info

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

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

5 years agoRevert "[ConstHoist] Do not rebase single (or few) dependent constant"
Jessica Paquette [Tue, 25 Sep 2018 18:41:40 +0000 (18:41 +0000)]
Revert "[ConstHoist] Do not rebase single (or few) dependent constant"

This caused a couple test failures on a bot:

CodeGen/X86/constant-hoisting-bfi.ll
Transforms/ConstantHoisting/X86/ehpad.ll

Example:

http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/53575/

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

5 years ago[RegAllocGreedy] avoid using physreg candidates that cannot be correctly spilled
Daniil Fukalov [Tue, 25 Sep 2018 18:37:38 +0000 (18:37 +0000)]
[RegAllocGreedy] avoid using physreg candidates that cannot be correctly spilled

For the AMDGPU target if a MBB contains exec mask restore preamble, SplitEditor may get state when it cannot insert a spill instruction.

E.g. for a MIR

bb.100:
    %1 = S_OR_SAVEEXEC_B64 %2, implicit-def $exec, implicit-def $scc, implicit $exec
and if the regalloc will try to allocate a virtreg to the physreg already assigned to virtreg %1, it should insert spill instruction before the S_OR_SAVEEXEC_B64 instruction.
But it is not possible since can generate incorrect code in terms of exec mask.

The change makes regalloc to ignore such physreg candidates.

Reviewed By: rampitec

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

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

5 years ago[MC] Replace NULL constant in code with nullptr.
Craig Topper [Tue, 25 Sep 2018 18:33:00 +0000 (18:33 +0000)]
[MC] Replace NULL constant in code with nullptr.

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

5 years ago[globalisel][tblgen] Table optimization should consider the C++ code in C++ predicates
Daniel Sanders [Tue, 25 Sep 2018 17:59:02 +0000 (17:59 +0000)]
[globalisel][tblgen] Table optimization should consider the C++ code in C++ predicates

This fixes PR39045

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

5 years ago[ConstHoist] Do not rebase single (or few) dependent constant
Zhaoshi Zheng [Tue, 25 Sep 2018 17:45:37 +0000 (17:45 +0000)]
[ConstHoist] Do not rebase single (or few) dependent constant

If an instance (InsertionPoint or IP) of Base constant A has only one or few
rebased constants depending on it, do NOT rebase. One extra ADD instruction is
required to materialize each rebased constant, assuming A and the rebased have
the same materialization cost.

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

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

5 years agoRevert "[DebugInfo] Do not generate address info for removed debug labels."
Justin Bogner [Tue, 25 Sep 2018 17:29:30 +0000 (17:29 +0000)]
Revert "[DebugInfo] Do not generate address info for removed debug labels."

The added test is failing on macOS:

  http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/53550/

This reverts r342943.

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

5 years ago[X86] Add AVX512 support to combineVectorSizedSetCCEquality.
Craig Topper [Tue, 25 Sep 2018 16:27:12 +0000 (16:27 +0000)]
[X86] Add AVX512 support to combineVectorSizedSetCCEquality.

Reviewers: spatel, RKSimon

Reviewed By: spatel

Subscribers: llvm-commits

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

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

5 years ago[InstCombine] narrow binops on concatenated vectors (PR33026)
Sanjay Patel [Tue, 25 Sep 2018 15:57:37 +0000 (15:57 +0000)]
[InstCombine] narrow binops on concatenated vectors (PR33026)

The motivating case from:
https://bugs.llvm.org/show_bug.cgi?id=33026
...has no shuffles now. This kind of pattern may occur during
vectorization when targets have lumpy ISAs like SSE/AVX.

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

5 years ago[ARM] Share predecessor bookkeeping in CombineBaseUpdate. NFCI.
Nirav Dave [Tue, 25 Sep 2018 15:30:47 +0000 (15:30 +0000)]
[ARM] Share predecessor bookkeeping in CombineBaseUpdate. NFCI.

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

5 years ago[AArch64] Share search bookkeeping in combines. NFCI.
Nirav Dave [Tue, 25 Sep 2018 15:30:22 +0000 (15:30 +0000)]
[AArch64] Share search bookkeeping in combines. NFCI.

Share predecessor search bookkeeping in both perform PostLD1Combine
and performNEONPostLDSTCombine. This should be approximately a 4x and
2x performance improvement.

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

5 years ago[LegalizeDAG] Prune Predecessor check in ExpandExtractFromVectorThroughStack. NFCI.
Nirav Dave [Tue, 25 Sep 2018 15:29:57 +0000 (15:29 +0000)]
[LegalizeDAG] Prune Predecessor check in ExpandExtractFromVectorThroughStack. NFCI.

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

5 years ago[DAGCombine] Improve Predecessor check in SimplifySelectOps. NFCI.
Nirav Dave [Tue, 25 Sep 2018 15:29:30 +0000 (15:29 +0000)]
[DAGCombine] Improve Predecessor check in SimplifySelectOps. NFCI.

Reuse search space bookkeeping across multiple predecessor checks
qdone to avoid redundancy. This should cut search cost by ~4x.

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

5 years ago[DAGCombine] Share predecessor bookkeeping in CombineToPostIndexedLoadStore. NFCI.
Nirav Dave [Tue, 25 Sep 2018 15:29:04 +0000 (15:29 +0000)]
[DAGCombine] Share predecessor bookkeeping in CombineToPostIndexedLoadStore. NFCI.

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

5 years ago[llvm-exegesis] Serializes registers initial values.
Guillaume Chatelet [Tue, 25 Sep 2018 15:15:54 +0000 (15:15 +0000)]
[llvm-exegesis] Serializes registers initial values.

Summary: Adds the registers initial values to the YAML output of llvm-exegesis.

Reviewers: courbet

Subscribers: tschuett, llvm-commits

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

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

5 years ago[llvm-exegesis] Fix missing document separator in YAML output.
Guillaume Chatelet [Tue, 25 Sep 2018 14:48:24 +0000 (14:48 +0000)]
[llvm-exegesis] Fix missing document separator in YAML output.

Reviewers: courbet

Subscribers: tschuett, llvm-commits

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

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

5 years ago[DAGCombine] Don't fold dependent loads across SELECT_CC.
Nirav Dave [Tue, 25 Sep 2018 14:43:05 +0000 (14:43 +0000)]
[DAGCombine] Don't fold dependent loads across SELECT_CC.

DAGCombine will try to fold two loads that feed a SELECT or SELECT_CC
after the select, resulting in a select of an address and a single
load after.

If either of the loads depend on the other, this is not legal as it
could introduce cycles. However, it only checked this if the opcode
was a SELECT, and not for a SELECT_CC.

Unfortunately, the only reproducer I have for this is for our
downstream target. I've tried getting it to trigger on an upstream one
but haven't been successful.

Patch thanks to Bevin Hansson.

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

5 years ago[llvm-exegesis] Add lit tests (v2).
Clement Courbet [Tue, 25 Sep 2018 13:59:35 +0000 (13:59 +0000)]
[llvm-exegesis] Add lit tests (v2).

Summary: This revisits rL342953 by adding detection of host support.

Reviewers: gchatelet, lebedev.ri, alexshap

Subscribers: mgorny, tschuett, llvm-commits

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

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

5 years ago[llvm-exegesis] Fix broken test.
Guillaume Chatelet [Tue, 25 Sep 2018 13:18:10 +0000 (13:18 +0000)]
[llvm-exegesis] Fix broken test.

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

5 years agoRevert rL342916: [X86] Remove shift/rotate by CL memory (RMW) overrides
Simon Pilgrim [Tue, 25 Sep 2018 13:01:26 +0000 (13:01 +0000)]
Revert rL342916: [X86] Remove shift/rotate by CL memory (RMW) overrides

As suggested by Craig Topper - I'm going to look at cleaning up the RMW sequences instead.

The uops are slightly different to the register variant, so requires a +1uop tweak

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

5 years ago[llvm-exegesis][NFC] Rewrite of the YAML serialization.
Guillaume Chatelet [Tue, 25 Sep 2018 12:18:08 +0000 (12:18 +0000)]
[llvm-exegesis][NFC] Rewrite of the YAML serialization.

Summary: This is a NFC in preparation of exporting the initial registers as part of the YAML dump

Reviewers: courbet

Reviewed By: courbet

Subscribers: mgorny, tschuett, llvm-commits

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

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

5 years agoRevert r342637 "[ADT] Try again to use the same version of llvm::Optional on all...
Hans Wennborg [Tue, 25 Sep 2018 12:08:56 +0000 (12:08 +0000)]
Revert r342637 "[ADT] Try again to use the same version of llvm::Optional on all compilers"

and also revert follow-ups r342643 and r342723.

This caused Clang to be miscompiled by GCC 4.8.4 (Unbuntu 14.04's
default compiler) and break the Chromium build (see
https://crbug.com/888061).

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

5 years ago[LoopUnroll] Add check to Latch's terminator in UnrollRuntimeLoopRemainder
David Green [Tue, 25 Sep 2018 10:08:47 +0000 (10:08 +0000)]
[LoopUnroll] Add check to Latch's terminator in UnrollRuntimeLoopRemainder

In this patch, I'm adding an extra check to the Latch's terminator in llvm::UnrollRuntimeLoopRemainder,
similar to how it is already done in the llvm::UnrollLoop.

The compiler would crash if this function is called with a malformed loop.

Patch by Rodrigo Caetano Rocha!

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

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

5 years ago[AMDGPU] restore r342722 which was reverted with r342743
Sameer Sahasrabuddhe [Tue, 25 Sep 2018 09:39:21 +0000 (09:39 +0000)]
[AMDGPU] restore r342722 which was reverted with r342743

[AMDGPU] lower-switch in preISel as a workaround for legacy DA

Summary:
The default target of the switch instruction may sometimes be an
"unreachable" block, when it is guaranteed that one of the cases is
always taken. The dominator tree concludes that such a switch
instruction does not have an immediate post dominator. This confuses
divergence analysis, which is unable to propagate sync dependence to
the targets of the switch instruction.

As a workaround, the AMDGPU target now invokes lower-switch as a
preISel pass. LowerSwitch is designed to handle the unreachable
default target correctly, allowing the divergence analysis to locate
the correct immediate dominator of the now-lowered switch.

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

5 years agoRevert rL342953 "[llvm-exegesis] Add lit tests."
Clement Courbet [Tue, 25 Sep 2018 09:36:44 +0000 (09:36 +0000)]
Revert rL342953 "[llvm-exegesis] Add lit tests."

We also need to make sure that we're on the right subtarget.

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

5 years ago[llvm-exegesis] Add lit tests.
Clement Courbet [Tue, 25 Sep 2018 09:27:43 +0000 (09:27 +0000)]
[llvm-exegesis] Add lit tests.

Summary:
Right now we only have unit tests. This will allow testing the whole
tool. Even though We can't really check actual values, this will avoid
regressions such as PR39055.

Reviewers: gchatelet, alexshap

Subscribers: mgorny, tschuett, llvm-commits

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

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

5 years ago[llvm-exegesis] Add MCParser to LLVM_LINK_COMPONENTS
Heejin Ahn [Tue, 25 Sep 2018 08:25:29 +0000 (08:25 +0000)]
[llvm-exegesis] Add MCParser to LLVM_LINK_COMPONENTS

We need this to make builds with `-DBUILD_SHARED_LIBS=ON` work.

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

5 years agoAdd macro LLVM_ATTRIBUTE_REINITIALIZES
Fangrui Song [Tue, 25 Sep 2018 08:06:32 +0000 (08:06 +0000)]
Add macro LLVM_ATTRIBUTE_REINITIALIZES

Summary:
This marks legitimate use-after-move (e.g. `Found.clear()` in rC342925)
which would otherwise be caught by bugprone-use-after-move.

bugprone-use-after-move recognizes this attribute after rCTE339571.

Reviewers: aaron.ballman, rsmith, mboehme, hokein

Reviewed By: mboehme

Subscribers: kristina, llvm-commits

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

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

5 years ago[llvm-exegesis] Fix doc in r342947.
Clement Courbet [Tue, 25 Sep 2018 07:48:38 +0000 (07:48 +0000)]
[llvm-exegesis] Fix doc in r342947.

llvm-exegesis.rst was using invalid indentation for bullet points.

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

5 years ago[llvm-exegesis] Allow benchmarking arbitrary code snippets.
Clement Courbet [Tue, 25 Sep 2018 07:31:44 +0000 (07:31 +0000)]
[llvm-exegesis] Allow benchmarking arbitrary code snippets.

Summary:

This is a step towards fixing PR38048.

Note that right now the measurements are given per instruction. We'll
need to give measurements a per code snippet and update the analysis (PR38731).

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

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

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

5 years ago[mips] Correct MUL pattern for mips64
Stefan Maksimovic [Tue, 25 Sep 2018 06:27:49 +0000 (06:27 +0000)]
[mips] Correct MUL pattern for mips64

Guard existing pattern with a predicate, introduce a new one for revision 6.

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

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

5 years agoUse unique_ptr to hold AsmInfo,MRI,MII,STI
Fangrui Song [Tue, 25 Sep 2018 06:19:31 +0000 (06:19 +0000)]
Use unique_ptr to hold AsmInfo,MRI,MII,STI

Reviewers: pcc, dblaikie

Reviewed By: dblaikie

Subscribers: llvm-commits

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

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

5 years agoUse TRI->regsOverlap() in MachineBasicBlock::computeRegisterLiveness
Mikael Holmen [Tue, 25 Sep 2018 06:10:04 +0000 (06:10 +0000)]
Use TRI->regsOverlap() in MachineBasicBlock::computeRegisterLiveness

Summary:
For the loop that used MCRegAliasIterator this should be NFC.

For the loop that previously used MCSubRegIterator we should
now detect more cases where the register is actually live out that
we previously missed.

Reviewers: MatzeB, arsenm

Reviewed By: MatzeB

Subscribers: wdng, llvm-commits

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

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

5 years ago[DebugInfo] Do not generate address info for removed debug labels.
Hsiangkai Wang [Tue, 25 Sep 2018 06:09:50 +0000 (06:09 +0000)]
[DebugInfo] Do not generate address info for removed debug labels.

In some senario, LLVM will remove llvm.dbg.labels in IR. For example,
when the labels are in unreachable blocks, these labels will not
be generated in LLVM IR. In the case, these debug labels will have
address zero as their address. It is not legal address for debugger to
set breakpoints or query sources. So, the patch inhibits the address info
(DW_AT_low_pc) of removed labels.

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

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

5 years ago[MachineCopyPropagation] Reimplement CopyTracker in terms of register units
Justin Bogner [Tue, 25 Sep 2018 05:16:44 +0000 (05:16 +0000)]
[MachineCopyPropagation] Reimplement CopyTracker in terms of register units

Change the copy tracker to keep a single map of register units instead
of 3 maps of registers. This gives a very significant compile time
performance improvement to the pass. I measured a 30-40% decrease in
time spent in MCP on x86 and AArch64 and much more significant
improvements on out of tree targets with more registers.

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

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

5 years agoRevert "[ORC] Switch to asynchronous resolution in JITSymbolResolver."
Lang Hames [Tue, 25 Sep 2018 04:54:03 +0000 (04:54 +0000)]
Revert "[ORC] Switch to asynchronous resolution in JITSymbolResolver."

This reverts commit r342939.

MSVC's promise/future implementation does not like types that are not default
constructible. Reverting while I figure out a solution.

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

5 years ago[MachineCopyPropagation] Rework how we manage RegMask clobbers
Justin Bogner [Tue, 25 Sep 2018 04:45:25 +0000 (04:45 +0000)]
[MachineCopyPropagation] Rework how we manage RegMask clobbers

Instead of updating the CopyTracker's maps each time we come across a
RegMask, defer checking for this kind of interference until we're
actually trying to propagate a copy. This avoids the need to
repeatedly iterate over maps in the cases where we don't end up doing
any work.

This is a slight compile time improvement for MachineCopyPropagation
as is, but it also enables a much bigger improvement that I'll follow
up with soon.

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

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