platform/upstream/llvm.git
5 years ago[LIBOMPTARGET]Fix build, NFC.
Alexey Bataev [Mon, 28 Oct 2019 14:39:49 +0000 (10:39 -0400)]
[LIBOMPTARGET]Fix build, NFC.

Need to include nvptx_interface.h in target_impl.h, otherwise the build
is failed because of missing __kmpc_impl_lanemask_t type.

5 years agolld/COFF: Simplify getOutputPath() using sys::path functions.
Nico Weber [Mon, 28 Oct 2019 14:35:56 +0000 (10:35 -0400)]
lld/COFF: Simplify getOutputPath() using sys::path functions.

Also mention "basename" and "dirname" in Path.h since I tried
to find these functions by looking for these strings. It might
help others find them faster if the comments contain these strings.

No behavior change.

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

5 years ago[DebugInfo] MachineSink: find more DBG_VALUEs to sink
Jeremy Morse [Mon, 28 Oct 2019 14:23:50 +0000 (14:23 +0000)]
[DebugInfo] MachineSink: find more DBG_VALUEs to sink

In the Pre-RA machine sinker, previously we were relying on all DBG_VALUEs
being immediately after the instruction that defined their operands. This
isn't a valid assumption, as a variable location change doesn't
necessarily correspond to where the value is computed. In this patch, we
collect DBG_VALUEs that might need sinking as we walk through a block,
and sink all of them if their defining instruction is sunk.

This patch adds some copy propagation too, so that if we sink a copy inst,
the now non-dominated paths can use the copy source for the variable
location.

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

5 years ago[DAGCombiner] widen any_ext of popcount based on target support
Sanjay Patel [Mon, 28 Oct 2019 14:04:30 +0000 (10:04 -0400)]
[DAGCombiner] widen any_ext of popcount based on target support

This enhances D69127 (rGe6c145e0548e3b3de6eab27e44e1504387cf6b53)
to handle the looser "any_extend" cast in addition to zext.

This is a prerequisite step for canonicalizing in the other direction
(narrow the popcount) in IR - PR43688:
https://bugs.llvm.org/show_bug.cgi?id=43688

5 years ago[AArch64][Builtins] Avoid unnecessary cache cleaning
Bryan Chan [Mon, 28 Oct 2019 13:52:28 +0000 (09:52 -0400)]
[AArch64][Builtins] Avoid unnecessary cache cleaning

Use new control bits CTR_EL0.DIC and CTR_EL0.IDC to discover the d-cache
cleaning and i-cache invalidation requirements for instruction-to-data
coherence. This matches the behavior in the latest libgcc.

Author: Shaokun Zhang <zhangshaokun@hisilicon.com>

Reviewed By: peter.smith

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

5 years ago[InstCombine][NFC] Tests for uadd.sat and sadd.sat canonicalisation.
David Green [Mon, 21 Oct 2019 08:11:29 +0000 (09:11 +0100)]
[InstCombine][NFC] Tests for uadd.sat and sadd.sat canonicalisation.

5 years ago[clangd] Do not report anonymous entities in findExplicitReferences
Ilya Biryukov [Mon, 28 Oct 2019 13:41:06 +0000 (14:41 +0100)]
[clangd] Do not report anonymous entities in findExplicitReferences

Summary:
Otherwise every client dealing with name location should handle
anonymous names in a special manner.

This seems too error-prone, clients can probably handle anonymous
entities they care about differently.

Reviewers: hokein

Reviewed By: hokein

Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

5 years ago[CVP] prevent propagating poison when substituting edge values into a phi (PR43802)
Sanjay Patel [Mon, 28 Oct 2019 12:56:23 +0000 (08:56 -0400)]
[CVP] prevent propagating poison when substituting edge values into a phi (PR43802)

This phi simplification transform was added with:
D45448

However as shown in PR43802:
https://bugs.llvm.org/show_bug.cgi?id=43802

...we must be careful not to propagate poison when we do the substitution.
There might be some more complicated analysis possible to retain the overflow flag,
but it should always be safe and easy to drop flags (we have similar behavior in
instcombine and other passes).

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

5 years ago[DebugInfo] MachineSink: Insert undef DBG_VALUEs when sinking instructions
Jeremy Morse [Mon, 28 Oct 2019 12:11:03 +0000 (12:11 +0000)]
[DebugInfo] MachineSink: Insert undef DBG_VALUEs when sinking instructions

When we sink DBG_VALUEs between blocks, we simply move the DBG_VALUE
instruction to below the sunk instruction. However, we should also mark
the variable as being undef at the original location, to terminate any
earlier variable location. This patch does that -- plus, if the
instruction being sunk is a copy, it attempts to propagate the copy
through the DBG_VALUE, replacing the destination with the source.

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

5 years ago[AMDGPU][MC][GFX10] Added v_interp_[p1/p2/mov]_f32_e64
Dmitry Preobrazhensky [Mon, 28 Oct 2019 12:03:43 +0000 (15:03 +0300)]
[AMDGPU][MC][GFX10] Added v_interp_[p1/p2/mov]_f32_e64

See https://bugs.llvm.org/show_bug.cgi?id=43747

Reviewers: arsenm, rampitec

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

5 years ago[Codegen][ARM] Add float softening for cbrt
David Green [Wed, 23 Oct 2019 16:08:21 +0000 (17:08 +0100)]
[Codegen][ARM] Add float softening for cbrt

We would previously have no soft-float softening for cbrt, so could hit
a crash failing to select. This fills in what appears to be missing.

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

5 years agominor doc typo fix / testing github commit
Rafael Stahl [Mon, 28 Oct 2019 11:07:00 +0000 (12:07 +0100)]
minor doc typo fix / testing github commit

5 years ago[ARM][AArch64] Implement __cls, __clsl and __clsll intrinsics from ACLE
vhscampos [Thu, 17 Oct 2019 13:10:30 +0000 (14:10 +0100)]
[ARM][AArch64] Implement __cls,  __clsl and __clsll intrinsics from ACLE

Summary:
Writing support for three ACLE functions:
  unsigned int __cls(uint32_t x)
  unsigned int __clsl(unsigned long x)
  unsigned int __clsll(uint64_t x)

CLS stands for "Count number of leading sign bits".

In AArch64, these two intrinsics can be translated into the 'cls'
instruction directly. In AArch32, on the other hand, this functionality
is achieved by implementing it in terms of clz (count number of leading
zeros).

Reviewers: compnerd

Reviewed By: compnerd

Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

5 years ago[clangd] Flush streams when printing HoverInfo Name and Definition
Kadir Cetinkaya [Mon, 28 Oct 2019 11:04:47 +0000 (12:04 +0100)]
[clangd] Flush streams when printing HoverInfo Name and Definition

Summary: Fixes some windows breakages when compiled via msvc.

5 years ago[clangd] Do not highlight keywords in semantic highlighting
Ilya Biryukov [Mon, 28 Oct 2019 10:31:06 +0000 (11:31 +0100)]
[clangd] Do not highlight keywords in semantic highlighting

Summary:
Editors are good at highlightings the keywords themselves.
Note that this only affects highlightings of builtin types spelled out
as keywords in the source code. Highlightings of typedefs to builtin
types are unchanged.

Reviewers: hokein

Reviewed By: hokein

Subscribers: merge_guards_bot, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

5 years ago[ARM][AArch64] Implement __arm_rsrf, __arm_rsrf64, __arm_wsrf & __arm_wsrf64
vhscampos [Tue, 22 Oct 2019 10:43:51 +0000 (11:43 +0100)]
[ARM][AArch64] Implement __arm_rsrf, __arm_rsrf64, __arm_wsrf & __arm_wsrf64

Summary:
Adding support for ACLE intrinsics.

Patch by Michael Platings.

Reviewers: chill, t.p.northover, efriedma

Reviewed By: chill

Subscribers: kristof.beyls, cfe-commits

Tags: #clang

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

5 years ago[AArch64][SVE] Implement masked load intrinsics
Kerry McLaughlin [Mon, 28 Oct 2019 10:00:57 +0000 (10:00 +0000)]
[AArch64][SVE] Implement masked load intrinsics

Summary:
Adds support for codegen of masked loads, with non-extending,
zero-extending and sign-extending variants.

Reviewers: huntergr, rovka, greened, dmgreen

Reviewed By: dmgreen

Subscribers: dmgreen, samparker, tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, cfe-commits, llvm-commits

Tags: #llvm

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

5 years ago[RISCV] Lower llvm.trap and llvm.debugtrap
Sam Elliott [Mon, 28 Oct 2019 09:52:21 +0000 (09:52 +0000)]
[RISCV] Lower llvm.trap and llvm.debugtrap

Summary:
Until this commit, these have lowered to a call to abort().

`llvm.trap()` now lowers to `unimp`, which should trap on all systems.

`llvm.debugtrap()` now lowers to `ebreak`, which is exactly what this
instruction is for.

Reviewers: asb, luismarques

Reviewed By: asb

Subscribers: hiraditya, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, s.egerton, pzheng, llvm-commits

Tags: #llvm

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

5 years agoFix https://bugs.llvm.org/show_bug.cgi?id=43791
Guillaume Chatelet [Mon, 28 Oct 2019 09:40:35 +0000 (10:40 +0100)]
Fix https://bugs.llvm.org/show_bug.cgi?id=43791

5 years ago[clangd] Do not insert parentheses when completing a using declaration
Ilya Biryukov [Mon, 28 Oct 2019 08:34:21 +0000 (09:34 +0100)]
[clangd] Do not insert parentheses when completing a using declaration

Summary:
Would be nice to also fix this in clang, but that looks like more work
if we want to preserve signatures in informative chunks.

Fixes https://github.com/clangd/clangd/issues/118

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: merge_guards_bot, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

5 years ago[llvm-objcopy][MachO] Implement --only-section
Seiya Nuta [Mon, 28 Oct 2019 06:40:37 +0000 (15:40 +0900)]
[llvm-objcopy][MachO] Implement --only-section

Reviewers: alexshap, rupprecht, jdoerfert, jhenderson

Reviewed By: alexshap, rupprecht, jhenderson

Subscribers: mgorny, jakehehrlich, abrachet, llvm-commits

Tags: #llvm

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

5 years ago[clangd] Reland Store Index in Tweak::Selection
Kadir Cetinkaya [Fri, 18 Oct 2019 12:57:11 +0000 (14:57 +0200)]
[clangd] Reland Store Index in Tweak::Selection

Summary:
Incoming define out-of-line tweak requires access to index.

This patch simply propogates the index in ClangdServer to Tweak::Selection while
passing the AST. Also updates TweakTest to accommodate this change.

Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

5 years ago[clangd] Reland DefineInline action apply logic with fully qualified names
Kadir Cetinkaya [Fri, 6 Sep 2019 07:49:40 +0000 (09:49 +0200)]
[clangd] Reland DefineInline action apply logic with fully qualified names

Summary:
Initial version of DefineInline action that will fully qualify every
name inside function body.

Reviewers: sammccall, ilya-biryukov, hokein

Tags: #clang

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

5 years ago[X86] Fix 48/96 byte memcmp code gen
David Zarzycki [Sat, 26 Oct 2019 18:34:43 +0000 (21:34 +0300)]
[X86] Fix 48/96 byte memcmp code gen

Detect scalar ISD::ZERO_EXTEND generated by memcmp lowering and convert
it to ISD::INSERT_SUBVECTOR.

https://reviews.llvm.org/D69464

5 years agogn build: Merge 5ab9a850f6b
LLVM GN Syncbot [Mon, 28 Oct 2019 06:32:06 +0000 (06:32 +0000)]
gn build: Merge 5ab9a850f6b

5 years ago[clangd] Reland DefineInline action availability checks
Kadir Cetinkaya [Mon, 28 Oct 2019 06:21:04 +0000 (07:21 +0100)]
[clangd] Reland DefineInline action availability checks

Summary:
Introduces DefineInline action and initial version of availability
checks.

Reviewers: sammccall, ilya-biryukov, hokein

Reviewed By: hokein

Subscribers: thakis, usaxena95, mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

5 years ago[c++20] Enforce rule that a union-like class or class with reference
Richard Smith [Mon, 28 Oct 2019 06:10:50 +0000 (23:10 -0700)]
[c++20] Enforce rule that a union-like class or class with reference
members cannot have defaulted comparisons.

5 years ago[clangd] Pass ExtraArgs to TestTU in TweakIsAvailable matcher
Kadir Cetinkaya [Mon, 28 Oct 2019 06:18:07 +0000 (07:18 +0100)]
[clangd] Pass ExtraArgs to TestTU in TweakIsAvailable matcher

5 years agoPR43775: don't produce a bogus 'auto' -Wc++98-compat warning for CTAD
Richard Smith [Sun, 27 Oct 2019 20:18:16 +0000 (13:18 -0700)]
PR43775: don't produce a bogus 'auto' -Wc++98-compat warning for CTAD

5 years agoTableGen: Use enum names in composeSubRegIndices table
Matt Arsenault [Sat, 5 Oct 2019 17:09:46 +0000 (10:09 -0700)]
TableGen: Use enum names in composeSubRegIndices table

I'm not sure why this is using the raw enum value. This makes reading
the generated table comprehensible.

5 years agoOpenMP: Add convergent to more runtime functions
Matt Arsenault [Sun, 27 Oct 2019 22:09:49 +0000 (15:09 -0700)]
OpenMP: Add convergent to more runtime functions

Several of these other functions are probably also convergent, but
these two seem obviously convergent.

5 years agoOpenMP: Add helper function for convergent runtime calls
Matt Arsenault [Sun, 27 Oct 2019 21:17:40 +0000 (14:17 -0700)]
OpenMP: Add helper function for convergent runtime calls

Most of the functions emitted here should probably be convergent, but
only barriers are currently marked. Introduce this helper before
adding convergent to more functions.

5 years ago[X86] Use 64-bit version of source register in LowerPATCHABLE_EVENT_CALL and LowerPAT...
Craig Topper [Mon, 28 Oct 2019 00:13:50 +0000 (17:13 -0700)]
[X86] Use 64-bit version of source register in LowerPATCHABLE_EVENT_CALL and LowerPATCHABLE_TYPED_EVENT_CALL

Summary:
The PATCHABLE_EVENT_CALL uses i32 in the intrinsic. This
results in the register allocator picking a 32-bit register. We
need to use the 64-bit register when forming the MOV64rr
instructions. Otherwise we print illegal assembly in the text
output.

I think prior to this it was impossible for SrcReg to be equal
to DstReg so the NOP code was not reachable.

While there use Register instead of unsigned.

Also add a FIXME for what looks like a bug.

Reviewers: dberris

Reviewed By: dberris

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

5 years agoUse isConvergent helper instead of directly checking attribute
Matt Arsenault [Mon, 28 Oct 2019 02:37:45 +0000 (19:37 -0700)]
Use isConvergent helper instead of directly checking attribute

5 years ago[LLDB][formatters] ArgInfo::count -> ArgInfo::max_positional_args
Lawrence D'Anna [Sun, 27 Oct 2019 21:30:56 +0000 (14:30 -0700)]
[LLDB][formatters] ArgInfo::count -> ArgInfo::max_positional_args

Summary:
Move breakpoints from the old, bad ArgInfo::count to the new, better
ArgInfo::max_positional_args.   Soon ArgInfo::count will be no more.

This functionality is tested in `TestFormatters.py`, `TestDataFormatterSynthVal.py`,
`TestDataFormatterSynthType.py`.

You may notice that the old code was passing 0 arguments when count was 1, and passing
1 argument when count is 2.

This is no longer necessary because max_positional_args counts the self pointer
correctly.

Reviewers: labath, jingham, JDevlieghere

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

5 years agoPM: silence `-Wpessimizing-move` from GCC 9.2.1 (NFC)
Saleem Abdulrasool [Sun, 27 Oct 2019 22:29:58 +0000 (18:29 -0400)]
PM: silence `-Wpessimizing-move` from GCC 9.2.1 (NFC)

Remove the explicit move enabling NVRO.

5 years ago[lit] Drop the user-site packages directory from search paths when running tests
Alex Lorenz [Sun, 27 Oct 2019 20:28:59 +0000 (13:28 -0700)]
[lit] Drop the user-site packages directory from search paths when running tests

Do not add user-site packages directory to the python search path.
This avoids test failures if there's an incompatible lit module installed
inside the user-site packages directory, as it gets prioritized over the lit
from the PYTHONPATH.

5 years agoPR43400: Add test that we can instantiate a friend function that is
Richard Smith [Sun, 27 Oct 2019 19:41:53 +0000 (12:41 -0700)]
PR43400: Add test that we can instantiate a friend function that is
defined as deleted.

The actual bug was fixed in commit d052a578.

5 years agoPR43762: when implicitly changing the active union member for an
Richard Smith [Sun, 27 Oct 2019 19:26:36 +0000 (12:26 -0700)]
PR43762: when implicitly changing the active union member for an
assignment during constant evaluation, only start the lifetime of
trivially-default-constructible union members.

5 years ago[SDAG] fold insert_vector_elt with undef index
Sanjay Patel [Sun, 27 Oct 2019 19:26:46 +0000 (15:26 -0400)]
[SDAG] fold insert_vector_elt with undef index

Similar to:
rG4c47617627fb

This makes the DAG behavior consistent with IR's insertelement.

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

I've tried to maintain test intent for AArch64 and WebAssembly
by replacing undef index operands with something else.

5 years ago[LegalizeTypes] When promoting BITREVERSE/BSWAP don't take the shift amount into...
Craig Topper [Sun, 27 Oct 2019 18:49:24 +0000 (11:49 -0700)]
[LegalizeTypes] When promoting BITREVERSE/BSWAP don't take the shift amount into account when determining the shift amount VT.

If the target's preferred shift amount VT can't hold any shift
amount for the promoted VT, we should use i32. The specific shift
amount shouldn't matter. The type will be adjusted later when the
shift itself is type legalized. This avoids an assert in getNode.

Fixes PR43820.

5 years ago[TargetLowering] Add getBooleanContents contents check to "SETCC (SETCC), [0|1],...
Craig Topper [Sun, 27 Oct 2019 07:41:00 +0000 (00:41 -0700)]
[TargetLowering] Add getBooleanContents contents check to "SETCC (SETCC), [0|1], [EQ|NE]  -> SETCC" combine.

This combine is only valid if the inner setcc produces a 0/1 result
or the inner type is MVT::i1.

I haven't seen this cause any issues, just happened to notice it
while reviewing combines in this function.

While there also fix another call to use the value type from the
SDValue for the operand instead of calling SDNode::getValueType(0).
Though its likely the use is result 0, its not guaranteed.

5 years ago[nfc][libomptarget] Decrease coupling between files
Jon Chesterfield [Sun, 27 Oct 2019 05:01:24 +0000 (05:01 +0000)]
[nfc][libomptarget] Decrease coupling between files

Summary:
[nfc][libomptarget] Decrease coupling between files

debug.h used the symbol omptarget_device_environment so implicitly required
an include of omptarget-nvptx.h to compile. Similarly interface.h uses size_t.

Moving this declaration to a new header means cancel, critical can now build
without omptarget-nvptx.h. After this change, debug.h, cancel.cu, critical.cu
could move under a common source directory.

Reviewers: ABataev, jdoerfert, grokos

Subscribers: openmp-commits

Tags: #openmp

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

5 years ago[nfc][libomptarget] Inline option into target_impl
Jon Chesterfield [Sun, 27 Oct 2019 03:32:36 +0000 (03:32 +0000)]
[nfc][libomptarget] Inline option into target_impl

Summary:
[nfc][libomptarget] Inline option into target_impl

Subset of D69423. The macros that were in option.h are all target dependent.
Inlining the header simplifies the dependency graph when looking to move code
into a common subdir.

Reviewers: ABataev, jdoerfert, grokos

Subscribers: openmp-commits

Tags: #openmp

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

5 years ago[MCA] Fix a spelling mistake in a comment. NFC
Greg Bedwell [Sun, 27 Oct 2019 10:06:22 +0000 (10:06 +0000)]
[MCA] Fix a spelling mistake in a comment. NFC

5 years agoFix a spelling mistake in a couple of intrinsic description comments. NFC
Greg Bedwell [Sun, 27 Oct 2019 09:39:45 +0000 (09:39 +0000)]
Fix a spelling mistake in a couple of intrinsic description comments. NFC

5 years ago[NFC][libomptarget]Remove TRUE,FALSE macros from option.h
Jon Chesterfield [Sat, 26 Oct 2019 18:19:50 +0000 (19:19 +0100)]
[NFC][libomptarget]Remove TRUE,FALSE macros from option.h

Summary:
[NFC][libomptarget]Remove TRUE,FALSE macros from option.h
Subset of D69423. Patch series ends with removing option.h.

Reviewers: ABataev, jdoerfert, grokos

Subscribers: openmp-commits

Tags: #openmp

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

5 years ago[X86] Only look up boolean reduction cost tables if the reduction is not pairwise.
Craig Topper [Sat, 26 Oct 2019 17:26:04 +0000 (10:26 -0700)]
[X86] Only look up boolean reduction cost tables if the reduction is not pairwise.

Summary:
We don't pattern match pairwise shuffles in SelectionDAG. So we
should only return the optimized costs if its not a pairwise
shuffle.

I think SLP vectorizer gives priority to non pairwise shuffle if
the cost is the same. And the look up for reduction intrinsics
passes false for the pairwise flag. So this probably has no real
effect today.

Reviewers: RKSimon

Reviewed By: RKSimon

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

5 years ago[APInt] Introduce APIntOps::GetMostSignificantDifferentBit()
Roman Lebedev [Sat, 26 Oct 2019 19:46:09 +0000 (22:46 +0300)]
[APInt] Introduce APIntOps::GetMostSignificantDifferentBit()

Summary:
Compare two values, and if they are different, return the position of the
most significant bit that is different in the values.

Needed for D69387.

Reviewers: nikic, spatel, sanjoy, RKSimon

Reviewed By: nikic

Subscribers: xbolva00, hiraditya, dexonsmith, llvm-commits

Tags: #llvm

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

5 years ago[X86] Prefer KORTEST on Knights Landing or later for memcmp()
David Zarzycki [Thu, 17 Oct 2019 09:38:15 +0000 (12:38 +0300)]
[X86] Prefer KORTEST on Knights Landing or later for memcmp()

PTEST and especially the MOVMSK instructions are slow on Knights Landing
or later. As a bonus, this patch increases instruction parallelism by
emitting:
    KORTEST(PCMPNEQ(a, b), PCMPNEQ(c, d)) == 0
Instead of:
    KORTEST(AND(PCMPEQ(a, b), PCMPEQ(c, d))) == ~0

https://reviews.llvm.org/D69157

5 years ago[X86] NFC: expand inline memcmp test coverage
David Zarzycki [Sun, 20 Oct 2019 09:21:11 +0000 (12:21 +0300)]
[X86] NFC: expand inline memcmp test coverage

1) Adds SSE4.1 coverage.
2) Adds prefer-256-bit or not coverage.
3) Adds more power-of-two tests up to 512 bytes.
4) Adds power-of-two-minus-one tests to verify overlapping loads.
5) Adds power-of-two-plus-one-half tests (48, 96, 192, and 384).
6) Adds greater-than/less-than tests from 16 to 512 bytes.

https://reviews.llvm.org/D69222

5 years agoAdd all the issues to be voted upon in Belfast
marshall [Tue, 22 Oct 2019 23:57:02 +0000 (16:57 -0700)]
Add all the issues to be voted upon in Belfast

5 years agofix lldb build with -DLLVM_ENABLE_MODULES=On (missing #include)
Luboš Luňák [Sat, 26 Oct 2019 13:34:45 +0000 (15:34 +0200)]
fix lldb build with -DLLVM_ENABLE_MODULES=On (missing #include)

The error message says to add the #include.

5 years ago[ObjectYAML] - Do not use auto. NFC.
Georgii Rymar [Sat, 26 Oct 2019 12:08:49 +0000 (15:08 +0300)]
[ObjectYAML] - Do not use auto. NFC.

Using 'auto' when the type is not obvious is undesired.

(it is just a test commit actually)

5 years ago[YAMLTraits] - Revert a change committed by a mistake in D68983
georgerim [Sat, 26 Oct 2019 11:52:12 +0000 (14:52 +0300)]
[YAMLTraits] - Revert a change committed by a mistake in D68983

I've accidentally reverted one of my previous patches.
It was not catched by bots because (I guess) they do not
build in debug (we have a test case which triggers an assert
in MSVS when runs without this change).
More info: https://reviews.llvm.org/D68983#inline-624235

Reported by Jordan Rupprecht.

5 years ago[AMDGPU] Fix Vreg_1 PHI lowering in SILowerI1Copies.
cdevadas [Sat, 26 Oct 2019 09:03:36 +0000 (14:33 +0530)]
[AMDGPU] Fix Vreg_1 PHI lowering in SILowerI1Copies.

There is a minor flaw in the implementation of function lowerPhis.
This function replaces values of regclass Vreg_1 (boolean values)
involved in PHIs into an SGPR. Currently it iterates over the MBBs
and performs an inplace lowering of PHIs and fails to lower any
incoming value that itself is another PHI of Vreg_1 regclass.
The failure occurs only when the MBB where the incoming PHI value
belongs is not visited/lowered yet.

To fix this problem, collect all Vreg_1 PHIs upfront and then
perform the lowering.

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

5 years agoCorrect size_t format specifier
Shu-Chun Weng [Sat, 26 Oct 2019 08:36:50 +0000 (10:36 +0200)]
Correct size_t format specifier

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

5 years ago[X86][GISel] Fix typo in comment. NFC
Craig Topper [Fri, 25 Oct 2019 07:13:52 +0000 (00:13 -0700)]
[X86][GISel] Fix typo in comment. NFC

5 years agoReland "[Clang][Bundler] Error reporting improvements"
Sergey Dmitriev [Sat, 31 Aug 2019 02:46:15 +0000 (19:46 -0700)]
Reland "[Clang][Bundler] Error reporting improvements"

- Changed FileHandler read/write methods to return llvm::Error
- Using unified way of reporting errors
- Removed trailing '.' from the error messages

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

5 years ago[ORC] Avoid SymbolStringPtr copies in DynamicLibrarySearchGenerator predicate.
Lang Hames [Sat, 26 Oct 2019 00:59:17 +0000 (17:59 -0700)]
[ORC] Avoid SymbolStringPtr copies in DynamicLibrarySearchGenerator predicate.

Pass SymbolStringPtr by const-ref to avoid copies (which require atomic
ref-count operations).

5 years agoRevert "[Clang][Bundler] Error reporting improvements"
Sergey Dmitriev [Sat, 26 Oct 2019 00:54:27 +0000 (17:54 -0700)]
Revert "[Clang][Bundler] Error reporting improvements"

This reverts commit dd501045cdea1c80b6788f0266d2a79f8b412eea.

5 years ago[NFC] Add a tablegen node for the root of the AST node hierarchies.
John McCall [Fri, 25 Oct 2019 23:28:03 +0000 (16:28 -0700)]
[NFC] Add a tablegen node for the root of the AST node hierarchies.

This is useful for the property databases we want to add for abstract
serialization, since root classes can have interesting properties.

5 years agoAdd Record::getValueAsOptionalDef().
John McCall [Fri, 25 Oct 2019 23:23:17 +0000 (16:23 -0700)]
Add Record::getValueAsOptionalDef().

Using `?` as an optional marker is very useful in Clang's AST-node
emitters because otherwise we need a separate class just to encode
the presence or absence of a base node reference.

5 years ago[Clang][Bundler] Error reporting improvements
Sergey Dmitriev [Sat, 31 Aug 2019 02:46:15 +0000 (19:46 -0700)]
[Clang][Bundler] Error reporting improvements

- Changed FileHandler read/write methods to return llvm::Error
- Using unified way of reporting errors
- Removed trailing '.' from the error messages

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

5 years ago[SDAG] fold extract_vector_elt with undef index
Sanjay Patel [Fri, 25 Oct 2019 23:21:44 +0000 (19:21 -0400)]
[SDAG] fold extract_vector_elt with undef index

This makes the DAG behavior consistent with IR's extractelement after:
rGb32e4664a715

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

I've tried to maintain test intent for WebAssembly.
The AMDGPU test is trying to test for crashing or other bad behavior,
but I'm not sure if that's possible after this change.

5 years ago[lit] Move sharding logic into separate function
Julian Lettner [Thu, 21 Feb 2019 05:09:19 +0000 (21:09 -0800)]
[lit] Move sharding logic into separate function

5 years ago[libFuzzer] Enable extra counters for Fuchsia.
Matt Morehouse [Fri, 25 Oct 2019 23:12:59 +0000 (16:12 -0700)]
[libFuzzer] Enable extra counters for Fuchsia.

5 years agoFix after 738af7a6241c98164625b9cd1ba9f8af4e36f197
Adrian McCarthy [Fri, 25 Oct 2019 22:50:42 +0000 (15:50 -0700)]
Fix after 738af7a6241c98164625b9cd1ba9f8af4e36f197

Default implementation of a new virtual method wasn't returning a value.

5 years agoUse __builtin_strlen in constexpr StringRef ctor with MSVC
Reid Kleckner [Fri, 25 Oct 2019 22:43:26 +0000 (15:43 -0700)]
Use __builtin_strlen in constexpr StringRef ctor with MSVC

MSVC supports it. Fixes the major MSVC compile time regression
introduced in r369961. Now
clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp compiles in 18s
instead of 7+ minutes.

Fixes PR43369

5 years ago[globalisel] Restructure the GlobalISel documentation
Daniel Sanders [Fri, 25 Oct 2019 22:50:36 +0000 (15:50 -0700)]
[globalisel] Restructure the GlobalISel documentation

There's a couple minor deletions amongst this but 99% of it is just moving
the documentation around to prepare the way for more meaningful changes.

5 years ago[LLDB] Fix inline variable only used in assertion. (NFC)
Jonas Devlieghere [Fri, 25 Oct 2019 22:46:24 +0000 (15:46 -0700)]
[LLDB] Fix inline variable only used in assertion. (NFC)

This prevents unused variable warning/error in -DNDEBUG builds. The
variable was introduced in 5934cd11ea3e.

Patch by: Shu-Chun Weng

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

5 years ago[clang][DependencyScanning] 80-col.
Michael Spencer [Fri, 25 Oct 2019 22:43:57 +0000 (15:43 -0700)]
[clang][DependencyScanning] 80-col.

5 years agolldb/minidump: Refactor memory region computation code
Pavel Labath [Fri, 25 Oct 2019 22:18:51 +0000 (22:18 +0000)]
lldb/minidump: Refactor memory region computation code

The goal of this refactor is to enable ProcessMinidump to take into
account the loaded modules and their sections when computing the
permissions of various ranges of memory, as discussed in D66638.

This patch moves some of the responsibility for computing the ranges
from MinidumpParser into ProcessMinidump. MinidumpParser still does the
parsing, but ProcessMinidump becomes responsible for answering the
actual queries about memory ranges. This will enable it (in a follow-up
patch) to augment the information obtained from the parser with data
obtained from actual object files.

The changes in the actual code are fairly straight-forward and just
involve moving code around. MinidumpParser::GetMemoryRegions is renamed
to BuildMemoryRegions to emphasize that it does no caching. The only new
thing is the additional bool flag returned from this function. This
indicates whether the returned regions describe all memory mapped into
the target process. Data obtained from /proc/maps and the MemoryInfoList
stream is considered to be exhaustive. Data obtained from Memory(64)List
is not. This will be used to determine whether we need to augment the
data or not.

This reshuffle means that it is no longer possible/easy to test some of
this code via unit tests, as constructing a ProcessMinidump instance is
hard. Instead, I update the unit tests to only test the parsing of the
actual data, and test the answering of queries through a lit test using
the "memory region" command. The patch also includes some tweaks to the
MemoryRegion class to make the unit tests easier to write.

Reviewers: amccarth, clayborg

Subscribers: lldb-commits

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

5 years ago[lit] Don't fail when printing test output with special chars
Joel E. Denny [Fri, 18 Oct 2019 16:53:45 +0000 (12:53 -0400)]
[lit] Don't fail when printing test output with special chars

This addresses a UnicodeEncodeError when using Python 3.6.5 in Windows
10.

Reviewed By: rnk

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

5 years agolldb/COFF: Create a separate "section" for the file header
Pavel Labath [Fri, 25 Oct 2019 21:44:46 +0000 (21:44 +0000)]
lldb/COFF: Create a separate "section" for the file header

In an attempt to ensure that every part of the module's memory image is
accounted for, D56537 created a special "container section" spanning the
entire image. While that seemed reasonable at the time (and it still
mostly does), it did create a problem of what to put as the "file size"
of the section, because the image is not continuous on disk, as we
generally assume (which is why I put zero there). Additionally, this
arrangement makes it unclear what kind of permissions should be assigned
to that section (which is what my next patch does).

To get around these, this patch partially reverts D56537, and goes back
to top-level sections. Instead, what I do is create a new "section" for
the object file header, which is also being loaded into memory, though
its not considered to be a section in the strictest sense. This makes it
possible to correctly assign file size section, and we can later assign
permissions to it as well.

Reviewers: amccarth, mstorsjo

Subscribers: lldb-commits

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

5 years ago[AMDGPU] Enable SGPR copy folding
Stanislav Mekhanoshin [Fri, 25 Oct 2019 19:40:16 +0000 (12:40 -0700)]
[AMDGPU] Enable SGPR copy folding

That used to fail in the last testcase function because after
%0:sreg_64.sub0 was folded into %3:sreg_32_xm0_xexec COPY, it
was further folded into S_STORE_DWORD_IMM. Its legal effective
subreg class is SReg_32 while instruction expects more restricted
SReg_32_XM0_EXEC. However, SIInstrInfo::isLegalRegOperand()
passed the legality check and it was caught in the verifier.

Borrowed code from the verifier to check for RC legality.

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

5 years ago[globalisel] Fix typo in 'Add LLVMDev 2019 talks and links for the 2017 talks'
Daniel Sanders [Fri, 25 Oct 2019 22:01:14 +0000 (15:01 -0700)]
[globalisel] Fix typo in 'Add LLVMDev 2019 talks and links for the 2017 talks'

5 years ago[globalisel] Add LLVMDev 2019 talks and links for the 2017 talks
Daniel Sanders [Fri, 25 Oct 2019 21:52:14 +0000 (14:52 -0700)]
[globalisel] Add LLVMDev 2019 talks and links for the 2017 talks

5 years ago[BPF] fix a CO-RE issue with -mattr=+alu32
Yonghong Song [Fri, 25 Oct 2019 05:57:06 +0000 (22:57 -0700)]
[BPF] fix a CO-RE issue with -mattr=+alu32

Ilya Leoshkevich (<iii@linux.ibm.com>) reported an issue that
with -mattr=+alu32 CO-RE has a segfault in BPF MISimplifyPatchable
pass.

The pattern will be transformed by MISimplifyPatchable
pass looks like below:
  r5 = ld_imm64 @"b:0:0$0:0"
  r2 = ldw r5, 0
  ... r2 ... // use r2
The pass will remove the intermediate 'ldw' instruction
and replacing all r2 with r5 likes below:
  r5 = ld_imm64 @"b:0:0$0:0"
  ... r5 ... // use r5
Later, the ld_imm64 insn will be replaced with
  r5 = <patched immediate>
for field relocation purpose.

With -mattr=+alu32, the input code may become
  r5 = ld_imm64 @"b:0:0$0:0"
  w2 = ldw32 r5, 0
  ... w2 ... // use w2
Replacing "w2" with "r5" is incorrect and will
trigger compiler internal errors.

To fix the problem, if the register class of ldw* dest
register is sub_32, we just replace the original ldw*
register with:
  w2 = w5
Directly replacing all uses of w2 with in-place
constructed w5 for the use operand seems not working in all cases.

The latest kernel will have -mattr=+alu32 on by default,
so added this flag to all CORE tests.
Tested with latest kernel bpf-next branch as well with this patch.

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

5 years ago[x86] add tests for extractelement with undef index (PR42689); NFC
Sanjay Patel [Fri, 25 Oct 2019 19:58:35 +0000 (15:58 -0400)]
[x86] add tests for extractelement with undef index (PR42689); NFC

5 years agoUpdate version number in llvm python bindings
David Tenty [Fri, 25 Oct 2019 17:54:29 +0000 (13:54 -0400)]
Update version number in llvm python bindings

Summary:
The version number has come out of sync with what is in CMakeLists.txt,
causing loading the bindings to fail.

Reviewers: AustinWells, abhina.sree

Reviewed By: AustinWells

Subscribers: llvm-commits

Tags: #llvm

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

5 years ago Add the ability to pass extra args to a Python breakpoint callback.
Jim Ingham [Fri, 25 Oct 2019 21:05:07 +0000 (14:05 -0700)]
Add the ability to pass extra args to a Python breakpoint callback.

    For example, it is pretty easy to write a breakpoint command that implements "stop when my caller is Foo", and
    it is pretty easy to write a breakpoint command that implements "stop when my caller is Bar". But there's no
    way to write a generic "stop when my caller is..." function, and then specify the caller when you add the
    command to a breakpoint.

    With this patch, you can pass this data in a SBStructuredData dictionary. That will get stored in
    the PythonCommandBaton for the breakpoint, and passed to the implementation function (if it has the right
    signature) when the breakpoint is hit. Then in lldb, you can say:

    (lldb) break com add -F caller_is -k caller_name -v Foo

    More generally this will allow us to write reusable Python breakpoint commands.

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

5 years agoRevert "[ARM] Uses "Sun Style" syntax for section switching"
Jian Cai [Fri, 25 Oct 2019 21:03:07 +0000 (14:03 -0700)]
Revert "[ARM] Uses "Sun Style" syntax for section switching"

This reverts commit 03de2f84fc4acf06c719cd007b5459c9d4d0a20c.

5 years ago[AMDGPU] Fixed asan failure in SIFoldOperands
Stanislav Mekhanoshin [Fri, 25 Oct 2019 20:33:40 +0000 (13:33 -0700)]
[AMDGPU] Fixed asan failure in SIFoldOperands

Both tryFoldOMod() and tryFoldClamp() remove original instruction,
so the check MI.modifiesRegister() may use a deleted MI.

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

5 years agoGlobalISel: Implement widenScalar for G_INSERT_VECTOR_ELT
Matt Arsenault [Tue, 1 Oct 2019 19:51:37 +0000 (15:51 -0400)]
GlobalISel: Implement widenScalar for G_INSERT_VECTOR_ELT

5 years ago[Alignment][NFC] Convert AllocaInst to MaybeAlign
Guillaume Chatelet [Fri, 25 Oct 2019 20:26:23 +0000 (22:26 +0200)]
[Alignment][NFC] Convert AllocaInst to MaybeAlign

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Reviewed By: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

5 years ago[ARM] Uses "Sun Style" syntax for section switching
Jian Cai [Fri, 25 Oct 2019 18:05:31 +0000 (11:05 -0700)]
[ARM] Uses "Sun Style" syntax for section switching

Summary:
Support "Sun Style" syntax for section switching ("#alloc,#write" etc).
https://bugs.llvm.org/show_bug.cgi?id=43759

Reviewers: peter.smith, eli.friedman, kristof.beyls, t.p.northover

Reviewed By: peter.smith

Subscribers: MaskRay, llozano, manojgupta, nickdesaulniers, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

5 years agoAMDGPU/GlobalISel: Handle flat/global G_ATOMIC_CMPXCHG
Matt Arsenault [Tue, 8 Oct 2019 17:04:41 +0000 (10:04 -0700)]
AMDGPU/GlobalISel: Handle flat/global G_ATOMIC_CMPXCHG

Custom lower this to a target instruction with the merge operands. I
think it might be better to directly select this and emit a
REG_SEQUENCE, but this would be more work since it would require
splitting the tablegen patterns for these cases from the other
atomics.

5 years agoAMDGPU: Fix the broken dominator tree when creating waterfall loop for resource descr...
Changpeng Fang [Fri, 25 Oct 2019 20:08:04 +0000 (13:08 -0700)]
AMDGPU: Fix the broken dominator tree when creating waterfall loop for resource descriptor

Summary:
  In loadSRsrcFromVGPR, if MBB is the same as Succ, Remiander is not the immediate dominator of Succ.

Reviewer:
  arsenm

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

5 years ago[gicombiner] Add parse failure tests for defs/match
Daniel Sanders [Fri, 4 Oct 2019 01:49:27 +0000 (18:49 -0700)]
[gicombiner] Add parse failure tests for defs/match

5 years agoRevert "Add an instruction marker field to the ExtraInfo in MachineInstrs."
Amy Huang [Fri, 25 Oct 2019 19:40:38 +0000 (12:40 -0700)]
Revert "Add an instruction marker field to the ExtraInfo in MachineInstrs."

Reverting commit b85b4e5a6f8579c137fecb59a4d75d7bfb111f79 due to some
buildbot failures/ out of memory errors.

5 years ago[LLD][ThinLTO] Handle GUID collision in import global processing
Teresa Johnson [Fri, 25 Oct 2019 15:40:24 +0000 (08:40 -0700)]
[LLD][ThinLTO] Handle GUID collision in import global processing

Summary:
If there are a GUID collision between two globals checking the
summarylist from the import index to make assumption can be dangerous.

Do not assume that a GlobalValue that has a GlobalVarSummary
actually is a GlobalVariable as it can be another GlobalValue with
the same GUID that the summary is connected to.

Patch by Joel Klinghed (the_jk@opera.com)

Reviewers: evgeny777, tejohnson

Reviewed By: tejohnson

Subscribers: tejohnson, dblaikie, MaskRay, mehdi_amini, inglorion, hiraditya, steven_wu, dexonsmith, llvm-commits

Tags: #llvm

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

5 years ago[Alignment][NFC] getMemoryOpCost uses MaybeAlign
Guillaume Chatelet [Tue, 22 Oct 2019 15:16:52 +0000 (17:16 +0200)]
[Alignment][NFC] getMemoryOpCost uses MaybeAlign

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: nemanjai, hiraditya, kbarton, MaskRay, jsji, llvm-commits

Tags: #llvm

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

5 years ago[CVP] add test for poison propagation bug (PR43802); NFC
Sanjay Patel [Fri, 25 Oct 2019 18:51:31 +0000 (14:51 -0400)]
[CVP] add test for poison propagation bug (PR43802); NFC

5 years agobuild: remove `LLVM_CXX_STD` extension point
Saleem Abdulrasool [Fri, 25 Oct 2019 17:57:52 +0000 (10:57 -0700)]
build: remove `LLVM_CXX_STD` extension point

This extension point is not needed. Provide the equivalent option
through `CMAKE_CXX_STANDARD` which mirrors the previous extension point. Rely on
CMake to provide the check for the compiler instead.

5 years ago[llvm-objcopy][MachO] Add support for min os version load commands
Alexander Shaposhnikov [Fri, 25 Oct 2019 00:35:10 +0000 (17:35 -0700)]
[llvm-objcopy][MachO] Add support for min os version load commands

Add support for min os version load commands.

Test plan: make check-all

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

5 years ago[AMDGPU] Fold AGPR reg_sequence initializers
Stanislav Mekhanoshin [Thu, 24 Oct 2019 19:36:24 +0000 (12:36 -0700)]
[AMDGPU] Fold AGPR reg_sequence initializers

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

5 years ago[AMDGPU] Disallow dpp combining for dpp instructions without Src2 operand (when Src2...
vpykhtin [Fri, 25 Oct 2019 17:42:52 +0000 (20:42 +0300)]
[AMDGPU] Disallow dpp combining for dpp instructions without Src2 operand (when Src2 is required)

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

5 years ago[Driver] Force llvm to install its handlers before lldb's
Vedant Kumar [Thu, 24 Oct 2019 20:15:37 +0000 (13:15 -0700)]
[Driver] Force llvm to install its handlers before lldb's

Install llvm's signal handlers up front to prevent lldb's handlers from being
ignored. This is (hopefully) a stopgap workaround.

When lldb invokes an llvm API that installs signal handlers (e.g.
llvm::sys::RemoveFileOnSignal, possibly via a compiler embedded within lldb),
lldb's signal handlers are overriden if llvm is installing its handlers for the
first time.

To work around llvm's behavior, force it to install its handlers up front, and
*then* install lldb's handlers. In practice this is used to prevent lldb test
processes from exiting due to IO_ERR when SIGPIPE is received.

Note that when llvm installs its handlers, it 1) records the old handlers it
replaces and 2) re-installs the old handlers when its new handler is invoked.
That means that a signal not explicitly handled by lldb can fall back to being
handled by llvm's handler the first time it is received, and then by the
default handler the second time it is received.

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

5 years agoFix compilation error in ObjectFileMachO::ParseSymtab
Vedant Kumar [Fri, 25 Oct 2019 18:16:51 +0000 (11:16 -0700)]
Fix compilation error in ObjectFileMachO::ParseSymtab