platform/upstream/llvm.git
5 years ago[DAGCombine] GetNegatedExpression - add FMA\FMAD support
Simon Pilgrim [Fri, 23 Aug 2019 10:49:46 +0000 (10:49 +0000)]
[DAGCombine] GetNegatedExpression - add FMA\FMAD support

If the accumulator and either of the multiply operands are negatable then we can we negate the entire expression.

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

llvm-svn: 369746

5 years ago[AMDGPU] gfx10 atomic optimizer changes.
Jay Foad [Fri, 23 Aug 2019 10:07:43 +0000 (10:07 +0000)]
[AMDGPU] gfx10 atomic optimizer changes.

Summary:
Add support for gfx10, where all DPP operations are confined to work
within a single row of 16 lanes, and wave32.

Reviewers: arsenm, sheredom, critson, rampitec

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, t-tye, hiraditya, jfb, dstuttard, tpr, llvm-commits

Tags: #llvm

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

llvm-svn: 369745

5 years ago[yaml2obj] - Allow setting the symbol st_other field to any integer.
George Rimar [Fri, 23 Aug 2019 09:31:07 +0000 (09:31 +0000)]
[yaml2obj] - Allow setting the symbol st_other field to any integer.

st_other field of a symbol usually contains its visibility.
Other bits are usually 0, though some targets, like
MIPS can set them using the named bit field values.

Problem is that there is no way to set an arbitrary value now,
though that might be useful for our test cases.

In this patch I introduced a way to set st_other to any numeric
value using the new StOther field.
I added a test and simplified the existent one to show the effect/benefit

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

llvm-svn: 369742

5 years ago[clangd] Link more clang-tidy modules to clangd
Haojian Wu [Fri, 23 Aug 2019 09:13:23 +0000 (09:13 +0000)]
[clangd] Link more clang-tidy modules to clangd

Summary: There are two new clang-tidy modules being added recently.

Reviewers: sammccall, jdoerfert

Subscribers: srhines, mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 369741

5 years agoExplain --reproduce option
Rui Ueyama [Fri, 23 Aug 2019 08:52:55 +0000 (08:52 +0000)]
Explain --reproduce option

I think --reproduce is no longer a debug-only option but a useful
option that a common user may want to use. So, this patch updates
the description of the option in the manual page.

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

llvm-svn: 369740

5 years ago[clang-tidy] Don't emit google-runtime-references warning for functions defined in...
Haojian Wu [Fri, 23 Aug 2019 08:47:27 +0000 (08:47 +0000)]
[clang-tidy] Don't emit google-runtime-references warning for functions defined in macros.

Summary:
The macro are usually defined in the common/base headers which are hard
for normal users to modify it.

Reviewers: gribozavr, alexfh

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 369739

5 years agoAdd a description about multiple linker scripts
Rui Ueyama [Fri, 23 Aug 2019 07:50:09 +0000 (07:50 +0000)]
Add a description about multiple linker scripts

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

llvm-svn: 369737

5 years ago[X86] Add a further unrolled madd reduction test case that shows several deficiencies.
Craig Topper [Fri, 23 Aug 2019 07:38:25 +0000 (07:38 +0000)]
[X86] Add a further unrolled madd reduction test case that shows several deficiencies.

The AVX2 check lines show two issues. An ADD that became an OR
because we knew the input was disjoint, but really it was zero
so we should have just removed the ADD/OR all together.

Relatedly we use 128-bit VPMADDWD instructions followed by
256-bit VPADDD operations. We should be able to narrow these
VPADDDs.

llvm-svn: 369736

5 years ago[Symbol] Decouple clang from DeclVendor
Alex Langford [Fri, 23 Aug 2019 06:11:32 +0000 (06:11 +0000)]
[Symbol] Decouple clang from DeclVendor

Summary:
This removes DeclVendor's dependency on clang (and ClangASTContext).
DeclVendor has no need to know about specific TypeSystems.

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

llvm-svn: 369735

5 years ago[X86] Make combineLoopSADPattern use CONCAT_VECTORS instead of INSERT_SUBVECTORS...
Craig Topper [Fri, 23 Aug 2019 06:08:33 +0000 (06:08 +0000)]
[X86] Make combineLoopSADPattern use CONCAT_VECTORS instead of INSERT_SUBVECTORS for widening with zeros.

CONCAT_VECTORS is more canonical for the early DAG combine runs
until we start getting into the op legalization phases.

llvm-svn: 369734

5 years ago[X86] Improve lowering of v2i32 SAD handling in combineLoopSADPattern.
Craig Topper [Fri, 23 Aug 2019 05:33:27 +0000 (05:33 +0000)]
[X86] Improve lowering of v2i32 SAD handling in combineLoopSADPattern.

For v2i32 we only feed 2 i8 elements into the psadbw instructions
with 0s in the other 14 bytes. The resulting psadbw instruction
will produce zeros in bits [127:16] of the output. We need to take
the result and feed it to a v2i32 add where the first element
includes bits [15:0] of the sad result. The other element should
be zero.

Prior to this patch we were using a truncate to take 0 from
bits 95:64 of the psadbw. This results in a pshufd to move those
bits to 63:32. But since we also have zeroes in bits 63:32 of
the psadbw output, we should just take those bits.

The previous code probably worked better with promoting legalization,
but now we use widening legalization. I've preserved the old
behavior if -x86-experimental-vector-widening-legalization=false
until we get that option removed.

llvm-svn: 369733

5 years ago[clang-format] Recognize ECMAScript module .mjs as JavaScript
Fangrui Song [Fri, 23 Aug 2019 04:46:01 +0000 (04:46 +0000)]
[clang-format] Recognize ECMAScript module .mjs as JavaScript

PR43085.

Recognize .mjs files as JavaScript. .mjs is the extension for ECMAScript modules.
A specific extension (and associated content type javascript/esm) is
introduced to differentiate it from CommonJS modules and solve some
interoperability problems.

Differential Revision: https://reviews.llvm.org/D66584
Patch by Fergal Daly

llvm-svn: 369732

5 years ago[LLDB] Address post-commit code review feedback.
Jonas Devlieghere [Fri, 23 Aug 2019 04:11:38 +0000 (04:11 +0000)]
[LLDB] Address post-commit code review feedback.

This patch addresses Adrian McCarthy's code review feedback in
https://reviews.llvm.org/D66447

llvm-svn: 369731

5 years ago[IndVars] Fix a bug noticed by inspection
Philip Reames [Fri, 23 Aug 2019 04:03:23 +0000 (04:03 +0000)]
[IndVars] Fix a bug noticed by inspection

We were computing the loop exit value, but not ensuring the addrec belonged to the loop whose exit value we were computing.  I couldn't actually trip this; the test case shows the basic setup which *might* trip this, but none of the variations I've tried actually do.

llvm-svn: 369730

5 years ago[analyzer] CastValueChecker: Correctly model results of based-to-derived casts.
Artem Dergachev [Fri, 23 Aug 2019 03:24:04 +0000 (03:24 +0000)]
[analyzer] CastValueChecker: Correctly model results of based-to-derived casts.

Our SVal hierarchy doesn't allow modeling pointer casts as no-op. The
pointer type is instead encoded into the pointer object. Defer to our
usual pointer casting facility, SValBuilder::evalBinOp().

Fixes a crash.

llvm-svn: 369729

5 years ago[analyzer] CastValueChecker: Provide DynamicTypeMap with pointer types only.
Artem Dergachev [Fri, 23 Aug 2019 03:24:01 +0000 (03:24 +0000)]
[analyzer] CastValueChecker: Provide DynamicTypeMap with pointer types only.

The idea to drop this requirement is good, but for now every other user
of DynamicTypeInfo expects pointer types.

Fixes a crash.

llvm-svn: 369728

5 years ago[analyzer] CastValueChecker: Avoid modeling casts between objects.
Artem Dergachev [Fri, 23 Aug 2019 03:23:58 +0000 (03:23 +0000)]
[analyzer] CastValueChecker: Avoid modeling casts between objects.

Our method only works correctly when casting a pointer to a pointer
or a reference to a reference.

Fixes a crash.

llvm-svn: 369727

5 years ago[analyzer] DynamicTypeInfo: Avoid putting null regions into dynamic typemap.
Artem Dergachev [Fri, 23 Aug 2019 03:23:55 +0000 (03:23 +0000)]
[analyzer] DynamicTypeInfo: Avoid putting null regions into dynamic typemap.

Fixes a crash.

llvm-svn: 369726

5 years agoRevert "PR42587: diagnose unexpanded uses of a pack parameter of a generic" due to...
Richard Smith [Fri, 23 Aug 2019 02:33:46 +0000 (02:33 +0000)]
Revert "PR42587: diagnose unexpanded uses of a pack parameter of a generic" due to buildbot breakage.

This reverts commit r369722.

llvm-svn: 369725

5 years ago[AlignmentFromAssumptions] getNewAlignmentDiff(): use getURemExpr()
Fangrui Song [Fri, 23 Aug 2019 02:17:04 +0000 (02:17 +0000)]
[AlignmentFromAssumptions] getNewAlignmentDiff(): use getURemExpr()

The alignment is calculated incorrectly, thus sometimes it doesn't generate aligned mov instructions, as shown by the example below:

```
// b.cc
typedef long long index;

extern "C" index g_tid;
extern "C" index g_num;

void add3(float* __restrict__ a, float* __restrict__ b, float* __restrict__ c) {
    index n = 64*1024;
    index m = 16*1024;
    index k = 4*1024;
    index tid = g_tid;
    index num = g_num;
    __builtin_assume_aligned(a, 32);
    __builtin_assume_aligned(b, 32);
    __builtin_assume_aligned(c, 32);
    for (index i0=tid*k; i0<m; i0+=num*k)
        for (index i1=0; i1<n*m; i1+=m)
            for (index i2=0; i2<k; i2++)
                c[i1+i0+i2] = b[i0+i2] + a[i1+i0+i2];
}
```

Compile with `clang b.cc -Ofast -march=skylake -mavx2 -S`

```
vmovaps -224(%rdi,%rbx,4), %ymm0
vmovups -192(%rdi,%rbx,4), %ymm1         # should be movaps
vmovups -160(%rdi,%rbx,4), %ymm2         # should be movaps
vmovups -128(%rdi,%rbx,4), %ymm3         # should be movaps
vaddps  -224(%rsi,%rbx,4), %ymm0, %ymm0
vaddps  -192(%rsi,%rbx,4), %ymm1, %ymm1
vaddps  -160(%rsi,%rbx,4), %ymm2, %ymm2
vaddps  -128(%rsi,%rbx,4), %ymm3, %ymm3
vmovaps %ymm0, -224(%rdx,%rbx,4)
vmovups %ymm1, -192(%rdx,%rbx,4)         # should be movaps
vmovups %ymm2, -160(%rdx,%rbx,4)         # should be movaps
vmovups %ymm3, -128(%rdx,%rbx,4)         # should be movaps
```

Differential Revision: https://reviews.llvm.org/D66575
Patch by Dun Liang

llvm-svn: 369723

5 years agoPR42587: diagnose unexpanded uses of a pack parameter of a generic
Richard Smith [Fri, 23 Aug 2019 01:41:48 +0000 (01:41 +0000)]
PR42587: diagnose unexpanded uses of a pack parameter of a generic
lambda from within the lambda-declarator.

llvm-svn: 369722

5 years agohwasan: Untag unwound stack frames by wrapping personality functions.
Peter Collingbourne [Fri, 23 Aug 2019 01:28:44 +0000 (01:28 +0000)]
hwasan: Untag unwound stack frames by wrapping personality functions.

One problem with untagging memory in landing pads is that it only works
correctly if the function that catches the exception is instrumented.
If the function is uninstrumented, we have no opportunity to untag the
memory.

To address this, replace landing pad instrumentation with personality function
wrapping. Each function with an instrumented stack has its personality function
replaced with a wrapper provided by the runtime. Functions that did not have
a personality function to begin with also get wrappers if they may be unwound
past. As the unwinder calls personality functions during stack unwinding,
the original personality function is called and the function's stack frame is
untagged by the wrapper if the personality function instructs the unwinder
to keep unwinding. If unwinding stops at a landing pad, the function is
still responsible for untagging its stack frame if it resumes unwinding.

The old landing pad mechanism is preserved for compatibility with old runtimes.

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

llvm-svn: 369721

5 years ago[MC] Minor cleanup to MCFixup::Kind handling. NFC.
Sam Clegg [Fri, 23 Aug 2019 01:00:55 +0000 (01:00 +0000)]
[MC] Minor cleanup to MCFixup::Kind handling. NFC.

Prefer `MCFixupKind` where possible and add getTargetKind() to
convert to `unsigned` when needed rather than scattering cast
operators around the place.

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

llvm-svn: 369720

5 years ago[clang][ifs] Dropping older experimental interface stub formats.
Puyan Lotfi [Thu, 22 Aug 2019 23:44:34 +0000 (23:44 +0000)]
[clang][ifs] Dropping older experimental interface stub formats.

I've been working on a new tool, llvm-ifs, for merging interface stub files
generated by clang and I've iterated on my derivative format of TBE to a newer
format. llvm-ifs will only support the new format, so I am going to drop the
older experimental interface stubs formats in this commit to make things
simpler.

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

llvm-svn: 369719

5 years ago[ARM] Automatically generate dsp-mlal.ll . NFC
Amaury Sechet [Thu, 22 Aug 2019 23:43:48 +0000 (23:43 +0000)]
[ARM] Automatically generate dsp-mlal.ll . NFC

llvm-svn: 369718

5 years ago[utils] Update shebang to use the environment.
Jonas Devlieghere [Thu, 22 Aug 2019 23:42:31 +0000 (23:42 +0000)]
[utils] Update shebang to use the environment.

This changes the shebang to launch bash through /usr/bin/env.

llvm-svn: 369717

5 years ago[sanitizer] Resubmit D66620 from monorepo
Taewook Oh [Thu, 22 Aug 2019 23:34:08 +0000 (23:34 +0000)]
[sanitizer] Resubmit D66620 from monorepo

Summary: https://reviews.llvm.org/D66620 is accepted but was based on the multi-repo setup, so I was not able to `arc patch` it. Resubmit the diff under monorepo

Committed on behalf of @sugak (Igor Sugak)

Reviewers: sugak

Subscribers: #sanitizers, llvm-commits, vitalybuka

Tags: #sanitizers, #llvm

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

llvm-svn: 369716

5 years ago[clang][ifs] New interface stubs format (llvm triple based).
Puyan Lotfi [Thu, 22 Aug 2019 23:29:22 +0000 (23:29 +0000)]
[clang][ifs] New interface stubs format (llvm triple based).

After posting llvm-ifs on phabricator, I made some progress in hardening up how
I think the format for Interface Stubs should look. There are a number of
things I think the TBE format was missing (no endianness, no info about the
Object Format because it assumes ELF), so I have added those and broken off
from being as similar to the TBE schema. In a subsequent commit I can drop the
other formats.

An example of how The format will look is as follows:

--- !experimental-ifs-v1
IfsVersion: 1.0
Triple: x86_64-unknown-linux-gnu
ObjectFileFormat: ELF
Symbols:
  _Z9nothiddenv: { Type: Func }
  _Z10cmdVisiblev: { Type: Func }
...

The format is still marked experimental.

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

llvm-svn: 369715

5 years ago[libclang][NFC] Remove debug comment
Jan Korous [Thu, 22 Aug 2019 23:29:10 +0000 (23:29 +0000)]
[libclang][NFC] Remove debug comment

llvm-svn: 369714

5 years ago[Bugfix] fix r369705 unit test
Nick Desaulniers [Thu, 22 Aug 2019 23:18:46 +0000 (23:18 +0000)]
[Bugfix] fix r369705 unit test

Summary:
Aliases aren't supported on OSX.  Add a GNU target triple.

Reported-by: leonardchan
Reported-by: erik.pilkington
Reviewers: leonardchan, erik.pilkington

Reviewed By: leonardchan, erik.pilkington

Subscribers: dexonsmith, cfe-commits

Tags: #clang

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

llvm-svn: 369713

5 years agoAdd missing dot.
Adrian Prantl [Thu, 22 Aug 2019 22:28:18 +0000 (22:28 +0000)]
Add missing dot.

llvm-svn: 369712

5 years agoFixing buildbot due to style.
David Carlier [Thu, 22 Aug 2019 21:53:21 +0000 (21:53 +0000)]
Fixing buildbot due to style.

llvm-svn: 369711

5 years agoExtend FindTypes with CompilerContext to allow filtering by language.
Adrian Prantl [Thu, 22 Aug 2019 21:45:58 +0000 (21:45 +0000)]
Extend FindTypes with CompilerContext to allow filtering by language.

This patch is also motivated by the Swift branch and is effectively NFC for the single-TypeSystem llvm.org branch.

In multi-language projects it is extremely common to have, e.g., a
Clang type and a similarly-named rendition of that same type in
another language. When searching for a type It is much cheaper to pass
a set of supported languages to the SymbolFile than having it
materialize every result and then rejecting the materialized types
that have the wrong language.

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

<rdar://problem/54471165>

This reapplies r369690 with a previously missing constructor for LanguageSet.

llvm-svn: 369710

5 years agoTestAppleSimulatorOSType: Pass the --standalone argument to simctl
Frederic Riss [Thu, 22 Aug 2019 21:44:10 +0000 (21:44 +0000)]
TestAppleSimulatorOSType: Pass the --standalone argument to simctl

It looks like running without this argument was supported
for legacy reasons, but a Xcode 11 beta made the argument
mandatory for our usecase.

llvm-svn: 369709

5 years ago[Sanitizer] checks ASLR on FreeBSD
David Carlier [Thu, 22 Aug 2019 21:36:35 +0000 (21:36 +0000)]
[Sanitizer] checks ASLR on FreeBSD

- Especially MemorySanitizer fails if those sysctl configs are enabled.

Reviewers: vitalybuka, emaste, dim

Reviewed By: dim

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

llvm-svn: 369708

5 years agoRevert [heap.py] Add missing declaration for malloc_get_all_zones
Vedant Kumar [Thu, 22 Aug 2019 21:01:45 +0000 (21:01 +0000)]
Revert [heap.py] Add missing declaration for malloc_get_all_zones

This reverts r369684 (git commit cc62e38d258f414c196b566374c606e83a85a034)

Adding a declaration doesn't appear to be a sufficient fix.

llvm-svn: 369706

5 years ago[Clang][CodeGen] set alias linkage on QualType
Nick Desaulniers [Thu, 22 Aug 2019 20:47:12 +0000 (20:47 +0000)]
[Clang][CodeGen] set alias linkage on QualType

Summary:
It seems that CodeGen was always using ExternalLinkage when emitting a
GlobalDecl with __attribute__((alias)). This leads to symbol
redefinitions (ODR) that cause failures at link time for static aliases.
This is readily attempting to link an ARM (32b) allyesconfig Linux
kernel built with Clang.

Reported-by: nathanchance
Suggested-by: ihalip
Link: https://bugs.llvm.org/show_bug.cgi?id=42377
Link: https://github.com/ClangBuiltLinux/linux/issues/631
Reviewers: rsmith, aaron.ballman, erichkeane

Reviewed By: aaron.ballman

Subscribers: javed.absar, kristof.beyls, cfe-commits, srhines, ihalip, nathanchance

Tags: #clang

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

llvm-svn: 369705

5 years agoLibFuzzer support for 32bit MSVC
Matthew G McGovern [Thu, 22 Aug 2019 20:44:34 +0000 (20:44 +0000)]
LibFuzzer support for 32bit MSVC

This fixes the two build errors when trying to compile LibFuzzer for
32bit with MSVC.

    - authored by Max Shavrick (mxms at microsoft)

llvm-svn: 369704

5 years ago[PowerPC] Automatically generate vec_buildvector_loadstore.ll . NFC
Amaury Sechet [Thu, 22 Aug 2019 20:42:50 +0000 (20:42 +0000)]
[PowerPC] Automatically generate vec_buildvector_loadstore.ll . NFC

llvm-svn: 369703

5 years agoRevert Extend FindTypes with CompilerContext to allow filtering by language.
Adrian Prantl [Thu, 22 Aug 2019 20:41:16 +0000 (20:41 +0000)]
Revert Extend FindTypes with CompilerContext to allow filtering by language.

This reverts r369690 (git commit aa3a564efa6b5fff2129f81a4041069a0233168f)

llvm-svn: 369702

5 years ago[NFC][InstCombine] Fixup few new tests in unrecognized_three-way-comparison.ll
Roman Lebedev [Thu, 22 Aug 2019 20:34:56 +0000 (20:34 +0000)]
[NFC][InstCombine] Fixup few new tests in unrecognized_three-way-comparison.ll

llvm-svn: 369701

5 years ago[PowerPC] Automatically generate various tests. NFC
Amaury Sechet [Thu, 22 Aug 2019 20:26:56 +0000 (20:26 +0000)]
[PowerPC] Automatically generate various tests. NFC

llvm-svn: 369700

5 years agoRename lldb/source/Interpreter/OptionValueFileSpecListTmp.cpp to
Adrian Prantl [Thu, 22 Aug 2019 20:10:24 +0000 (20:10 +0000)]
Rename lldb/source/Interpreter/OptionValueFileSpecListTmp.cpp to
       lldb/source/Interpreter/OptionValueFileSpecList.cpp (NFC)

llvm-svn: 369699

5 years agoRename lldb/source/Interpreter/OptionValueFileSpecLIst.cpp to
Adrian Prantl [Thu, 22 Aug 2019 20:08:46 +0000 (20:08 +0000)]
Rename lldb/source/Interpreter/OptionValueFileSpecLIst.cpp to
       lldb/source/Interpreter/OptionValueFileSpecListTmp.cpp (NFC)

llvm-svn: 369698

5 years agoIR. Change strip* family of functions to not look through aliases.
Peter Collingbourne [Thu, 22 Aug 2019 19:56:14 +0000 (19:56 +0000)]
IR. Change strip* family of functions to not look through aliases.

I noticed another instance of the issue where references to aliases were
being replaced with aliasees, this time in InstCombine. In the instance that
I saw it turned out to be only a QoI issue (a symbol ended up being missing
from the symbol table due to the last reference to the alias being removed,
preventing HWASAN from symbolizing a global reference), but it could easily
have manifested as incorrect behaviour.

Since this is the third such issue encountered (previously: D65118, D65314)
it seems to be time to address this common error/QoI issue once and for all
and make the strip* family of functions not look through aliases.

Includes a test for the specific issue that I saw, but no doubt there are
other similar bugs fixed here.

As with D65118 this has been tested to make sure that the optimization isn't
load bearing. I built Clang, Chromium for Linux, Android and Windows as well
as the test-suite and there were no size regressions.

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

llvm-svn: 369697

5 years ago[NFC][InstCombine] New tests: unrecognized_three-way-comparison.ll is ignorant about...
Roman Lebedev [Thu, 22 Aug 2019 19:53:23 +0000 (19:53 +0000)]
[NFC][InstCombine] New tests: unrecognized_three-way-comparison.ll is ignorant about commutative variants part 2

llvm-svn: 369696

5 years agoFight a bit against global initializers. NFC.
Benjamin Kramer [Thu, 22 Aug 2019 19:43:27 +0000 (19:43 +0000)]
Fight a bit against global initializers. NFC.

llvm-svn: 369695

5 years ago[COFF] Add libcall symbols to the link when LTO is being used
Amy Huang [Thu, 22 Aug 2019 19:40:07 +0000 (19:40 +0000)]
[COFF] Add libcall symbols to the link when LTO is being used

llvm-svn: 369694

5 years ago[libc++] Fix broken <random> test
Louis Dionne [Thu, 22 Aug 2019 19:35:46 +0000 (19:35 +0000)]
[libc++] Fix broken <random> test

In r369429, I hoisted a floating point computation to a variable in order
to remove a warning. However, it turns out this doesn't play well with
floating point arithmetic. This commit reverts r369429 and instead casts
the result of the floating point computation to remove the warning.

Whether hoisting the computaiton to a variable should give the same
result can be investigated independently.

llvm-svn: 369693

5 years agoAdd missing include
Adrian Prantl [Thu, 22 Aug 2019 19:32:24 +0000 (19:32 +0000)]
Add missing include

llvm-svn: 369692

5 years agoAdd missing include
Adrian Prantl [Thu, 22 Aug 2019 19:30:10 +0000 (19:30 +0000)]
Add missing include

llvm-svn: 369691

5 years agoExtend FindTypes with CompilerContext to allow filtering by language.
Adrian Prantl [Thu, 22 Aug 2019 19:24:55 +0000 (19:24 +0000)]
Extend FindTypes with CompilerContext to allow filtering by language.

This patch is also motivated by the Swift branch and is effectively NFC for the single-TypeSystem llvm.org branch.

In multi-language projects it is extremely common to have, e.g., a
Clang type and a similarly-named rendition of that same type in
another language. When searching for a type It is much cheaper to pass
a set of supported languages to the SymbolFile than having it
materialize every result and then rejecting the materialized types
that have the wrong language.

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

<rdar://problem/54471165>

llvm-svn: 369690

5 years ago[llvm-objcopy][NFC] Refactor symbol/section matching
Jordan Rupprecht [Thu, 22 Aug 2019 19:17:50 +0000 (19:17 +0000)]
[llvm-objcopy][NFC] Refactor symbol/section matching

Summary:
The matchers for section/symbol related flags (e.g. `--keep-symbol=Name` or `--regex --keep-symbol=foo.*`) are currently just vectors that are matched linearlly. However, adding wildcard support would require negative matching too, e.g. a symbol should be removed if it matches a wildcard *but* doesn't match some other wildcard.

To make the next patch simpler, consolidate matching logic to a class defined in CopyConfig that takes care of matching.

Reviewers: jhenderson, seiya, MaskRay, espindola, alexshap

Reviewed By: jhenderson, MaskRay

Subscribers: emaste, arichardson, jakehehrlich, abrachet, llvm-commits

Tags: #llvm

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

llvm-svn: 369689

5 years agoDisable the ScanDepsReuseFilemanager test on Windows
Alex Lorenz [Thu, 22 Aug 2019 19:00:08 +0000 (19:00 +0000)]
Disable the ScanDepsReuseFilemanager test on Windows

Right now it fails.
I'm going to investigate it and fix it in follow-up commits.

llvm-svn: 369688

5 years agoImprove the documentation for OpenCL vector types.
Aaron Ballman [Thu, 22 Aug 2019 18:57:46 +0000 (18:57 +0000)]
Improve the documentation for OpenCL vector types.

This fixes some minor grammatical issues I noticed when reading the docs, and changes the recommended feature testing approach to use __has_attribute instead of __has_extension.

llvm-svn: 369687

5 years agoFix the nullPointerConstant() test to get bots back to green.
Aaron Ballman [Thu, 22 Aug 2019 18:56:18 +0000 (18:56 +0000)]
Fix the nullPointerConstant() test to get bots back to green.

llvm-svn: 369686

5 years ago[AArch64] autogenerate some tests. NFC
Amaury Sechet [Thu, 22 Aug 2019 18:53:41 +0000 (18:53 +0000)]
[AArch64] autogenerate some tests. NFC

llvm-svn: 369685

5 years ago[heap.py] Add missing declaration for malloc_get_all_zones
Vedant Kumar [Thu, 22 Aug 2019 18:51:03 +0000 (18:51 +0000)]
[heap.py] Add missing declaration for malloc_get_all_zones

The evaluation context isn't guaranteed to have this declaration.

Fixes "error: use of undeclared identifier 'malloc_get_all_zones'" bugs.

llvm-svn: 369684

5 years agoImplement nullPointerConstant() using a better API.
Aaron Ballman [Thu, 22 Aug 2019 18:26:44 +0000 (18:26 +0000)]
Implement nullPointerConstant() using a better API.

Instead of manually attempting to identify whether something is a null pointer constant, use Expr::isNullPointerConstant().

llvm-svn: 369683

5 years agogn build: Merge r369680
Nico Weber [Thu, 22 Aug 2019 18:22:05 +0000 (18:22 +0000)]
gn build: Merge r369680

llvm-svn: 369682

5 years agoIntroduce FileEntryRef and use it when handling includes to report correct dependencies
Alex Lorenz [Thu, 22 Aug 2019 18:15:50 +0000 (18:15 +0000)]
Introduce FileEntryRef and use it when handling includes to report correct dependencies
when the FileManager is reused across invocations

This commit introduces a parallel API to FileManager's getFile: getFileEntryRef, which returns
a reference to the FileEntry, and the name that was used to access the file. In the case of
a VFS with 'use-external-names', the FileEntyRef contains the external name of the file,
not the filename that was used to access it.

The new API is adopted only in the HeaderSearch and Preprocessor for include file lookup, so that the
accessed path can be propagated to SourceManager's FileInfo. SourceManager's FileInfo now can report this accessed path, using
the new getName method. This API is then adopted in the dependency collector, which now correctly reports dependencies when a file
is included both using a symlink and a real path in the case when the FileManager is reused across multiple Preprocessor invocations.

Note that this patch does not fix all dependency collector issues, as the same problem is still present in other cases when dependencies
are obtained using FileSkipped, InclusionDirective, and HasInclude. This will be fixed in follow-up commits.

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

llvm-svn: 369680

5 years ago[clangd] Fold string copy into lambda capture. NFC.
Benjamin Kramer [Thu, 22 Aug 2019 18:09:46 +0000 (18:09 +0000)]
[clangd] Fold string copy into lambda capture. NFC.

llvm-svn: 369679

5 years agogn build: Merge r369677
Nico Weber [Thu, 22 Aug 2019 17:53:18 +0000 (17:53 +0000)]
gn build: Merge r369677

llvm-svn: 369678

5 years agoRevert "[LifetimeAnalysis] Support more STL idioms (template forward declaration...
Richard Smith [Thu, 22 Aug 2019 17:48:11 +0000 (17:48 +0000)]
Revert "[LifetimeAnalysis] Support more STL idioms (template forward declaration and DependentNameType)"

This reverts commit r369591, because it causes the formerly-reliable
-Wreturn-stack-address warning to start issuing false positives.
Testcase provided on the commit thread.

llvm-svn: 369677

5 years ago[Clangd] Tweaktesting replace toString with consumeError
Shaurya Gupta [Thu, 22 Aug 2019 17:36:31 +0000 (17:36 +0000)]
[Clangd] Tweaktesting replace toString with consumeError

llvm-svn: 369676

5 years agoRetire llvm::less_ptr. llvm::deref is much more flexible.
Benjamin Kramer [Thu, 22 Aug 2019 17:32:16 +0000 (17:32 +0000)]
Retire llvm::less_ptr. llvm::deref is much more flexible.

llvm-svn: 369675

5 years agoRetire llvm::less/equal in favor of C++14 std::less<>/equal_to<>.
Benjamin Kramer [Thu, 22 Aug 2019 17:31:59 +0000 (17:31 +0000)]
Retire llvm::less/equal in favor of C++14 std::less<>/equal_to<>.

llvm-svn: 369674

5 years agoGlobalISel: Don't create G_UADDE with constant false carry in
Matt Arsenault [Thu, 22 Aug 2019 17:29:17 +0000 (17:29 +0000)]
GlobalISel: Don't create G_UADDE with constant false carry in

The x86 tests are now broken (in paticular add-scalar.ll now hits the
DAG fallback) due to not handling G_UADDO. The DAG x86 backend has a
custom lowering for this, so that will need to be implemented.

llvm-svn: 369673

5 years ago[libc++] Mark lock_guard nodiscard test as unsupported in C++03
Louis Dionne [Thu, 22 Aug 2019 17:24:24 +0000 (17:24 +0000)]
[libc++] Mark lock_guard nodiscard test as unsupported in C++03

llvm-svn: 369672

5 years ago[MachO][TLOF] Use hasLocalLinkage to determine if indirect symbol is local
Francis Visoiu Mistrih [Thu, 22 Aug 2019 16:59:00 +0000 (16:59 +0000)]
[MachO][TLOF] Use hasLocalLinkage to determine if indirect symbol is local

Local symbols in the indirect symbol table contain the value
`INDIRECT_SYMBOL_LOCAL` and the corresponding __pointers entry must
contain the address of the target.

In r349060, I added support for local symbols in the indirect symbol
table, which was checking if the symbol `isDefined` && `!isExternal` to
determine if the symbol is local or not.

It turns out that `isDefined` will return false if the user of the
symbol comes before its definition, and we'll again generate .long 0
which will be the symbol at the adress 0x0.

Instead of doing that, use GlobalValue::hasLocalLinkage() to check if
the symbol is local.

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

llvm-svn: 369671

5 years agoRemove redundant curly braces.
Adrian Prantl [Thu, 22 Aug 2019 16:58:56 +0000 (16:58 +0000)]
Remove redundant curly braces.

llvm-svn: 369670

5 years agoDoxygenify comments.
Adrian Prantl [Thu, 22 Aug 2019 16:52:37 +0000 (16:52 +0000)]
Doxygenify comments.

llvm-svn: 369669

5 years ago[OPENMP]Generalization of handling of declare target attribute.
Alexey Bataev [Thu, 22 Aug 2019 16:48:26 +0000 (16:48 +0000)]
[OPENMP]Generalization of handling of declare target attribute.

Used OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration instead of
direct checking of the OMPDeclareTargetDeclAttr attribute.

llvm-svn: 369668

5 years ago[NFC][InstCombine] New tests: unrecognized_three-way-comparison.ll is ignorant about...
Roman Lebedev [Thu, 22 Aug 2019 16:46:16 +0000 (16:46 +0000)]
[NFC][InstCombine] New tests: unrecognized_three-way-comparison.ll is ignorant about commutative variants

D66232 "exposes" the problem.

llvm-svn: 369667

5 years agoFixed Missing Expected error handling
Shaurya Gupta [Thu, 22 Aug 2019 16:42:42 +0000 (16:42 +0000)]
Fixed Missing Expected error handling

llvm-svn: 369666

5 years ago[X86] Remove MCInstLower code that drops operands from some CALL and TAILJMP instruct...
Craig Topper [Thu, 22 Aug 2019 16:23:35 +0000 (16:23 +0000)]
[X86] Remove MCInstLower code that drops operands from some CALL and TAILJMP instructions. Add asserts to verify operand count

It appears the FIXME here was handled at some point. r159728 from 2012 seems to be at least aportion of fixing it.

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

llvm-svn: 369665

5 years ago[MBP] Disable aggressive loop rotate in plain mode
Guozhi Wei [Thu, 22 Aug 2019 16:21:32 +0000 (16:21 +0000)]
[MBP] Disable aggressive loop rotate in plain mode

Patch https://reviews.llvm.org/D43256 introduced more aggressive loop layout optimization which depends on profile information. If profile information is not available, the statically estimated profile information(generated by BranchProbabilityInfo.cpp) is used. If user program doesn't behave as BranchProbabilityInfo.cpp expected, the layout may be worse.

To be conservative this patch restores the original layout algorithm in plain mode. But user can still try the aggressive layout optimization with -force-precise-rotation-cost=true.

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

llvm-svn: 369664

5 years ago[DAGCombiner] Remove explicit call to AddToWorklist in sqrt and reciprocal computations
Amaury Sechet [Thu, 22 Aug 2019 15:35:45 +0000 (15:35 +0000)]
[DAGCombiner] Remove explicit call to AddToWorklist in sqrt and reciprocal computations

Summary: These nodes end up being processed regardless due to DAGCombiner ensuring arguments are processed. This changes the order in which nodes are processed, which fixes an issue on PowerPC.

Reviewers: craig.topper, efriedma, RKSimon, lebedev.ri, mcberg2017, stefanp, hfinkel

Subscribers: nemanjai, MaskRay, jsji, steven.zhang, llvm-commits

Tags: #llvm

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

llvm-svn: 369662

5 years ago[X86][BtVer2] Fix latency/throughput of scalar integer MUL instructions.
Andrea Di Biagio [Thu, 22 Aug 2019 15:20:16 +0000 (15:20 +0000)]
[X86][BtVer2] Fix latency/throughput of scalar integer MUL instructions.

Single operand MUL instructions that implicitly set EAX have the following
latency/throughput profile (see below):

imul %cl              # latency: 3cy - uOPs: 1 - 1 JMul
imul %cx              # latency: 3cy - uOPs: 3 - 3 JMul
imul %ecx             # latency: 3cy - uOPs: 2 - 2 JMul
imul %rcx             # latency: 6cy - uOPs: 2 - 4 JMul

mul %cl               # latency: 3cy - uOPs: 1 - 1 JMul
mul %cx               # latency: 3cy - uOPs: 3 - 3 JMul
mul %ecx              # latency: 3cy - uOPs: 2 - 2 JMul
mul %rcx              # latency: 6cy - uOPs: 2 - 4 JMul

Excluding the 64bit variant, which has a latency of 6cy, every other instruction
has a latency of 3cy. However, the number of decoded macro-opcodes (as well as
the resource cyles) depend on the MUL size.

The two operand MULs have a more predictable profile (see below):

imul %dx, %dx         # latency: 3cy - uOPs: 1 - 1 JMul
imul %edx, %edx       # latency: 3cy - uOPs: 1 - 1 JMul
imul %rdx, %rdx       # latency: 6cy - uOPs: 1 - 4 JMul

imul $3, %dx, %dx     # latency: 4cy - uOPs: 2 - 2 JMul
imul $3, %ecx, %ecx   # latency: 3cy - uOPs: 1 - 1 JMul
imul $3, %rdx, %rdx   # latency: 6cy - uOPs: 1 - 4 JMul

This patch updates the values in the Jaguar scheduling model and regenerates
llvm-mca tests.

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

llvm-svn: 369661

5 years ago[lldb] Remove ')' to fix the build
Raphael Isemann [Thu, 22 Aug 2019 15:18:40 +0000 (15:18 +0000)]
[lldb] Remove ')' to fix the build

That ')' slipped in by accident in the reformatting commit.

llvm-svn: 369660

5 years ago[PowerPC] Regenerate reciprocal tests, as discussed on D66548
Simon Pilgrim [Thu, 22 Aug 2019 15:14:52 +0000 (15:14 +0000)]
[PowerPC] Regenerate reciprocal tests, as discussed on D66548

llvm-svn: 369659

5 years ago[PowerPC] Add combined ELF ABI and 32/64 bit queries to the subtarget. [NFC]
Sean Fertile [Thu, 22 Aug 2019 15:11:28 +0000 (15:11 +0000)]
[PowerPC] Add combined ELF ABI and 32/64 bit queries to the subtarget. [NFC]

A lot of places in the code combine checks for both ABI (SVR4/Darwin/AIX) and
addressing mode (64-bit vs 32-bit). In an attempt to make some of the code more
readable I've added a couple functions that combine checking for the ELF abi and
64-bit/32-bit code at once. As we add more AIX support I intend to add similar
functions for the AIX ABI.

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

llvm-svn: 369658

5 years ago[PowerPC][XCOFF][MC] Explicitly set containing csect on symbols. [NFC]
Sean Fertile [Thu, 22 Aug 2019 15:11:23 +0000 (15:11 +0000)]
[PowerPC][XCOFF][MC] Explicitly set containing csect on symbols. [NFC]

Previously we would get the csect a symbol was contained in through its
fragment. This works only if we are writing an object file, and only for
defined symbols. To fix this we set the contating csect explicitly on the
MCSymbolXCOFF object.

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

llvm-svn: 369657

5 years ago[clangd] Send suppported codeActionKinds to the client.
Haojian Wu [Thu, 22 Aug 2019 14:53:45 +0000 (14:53 +0000)]
[clangd] Send suppported codeActionKinds to the client.

Summary:
This would make client know which codeActionKinds that clangd may
return.

VSCode will add a new entry "Refactor..." (which shows all
refactoring-kind code actions) in the right-click menu.

Reviewers: ilya-biryukov

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

Tags: #clang

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

llvm-svn: 369656

5 years ago[lldb] Fix `TestDataFormatterStdList` regression
Jan Kratochvil [Thu, 22 Aug 2019 14:29:52 +0000 (14:29 +0000)]
[lldb] Fix `TestDataFormatterStdList` regression

Since D66174 I see failures of TestDataFormatterStdList in about 50% of runs on
Fedora 30 x86_64 libstdc++. I have found out that LLDB internally expects these
RegularExpressions to be matched in their alphabetical order:
^std::(__cxx11::)?list<.+>(( )?&)?$
^std::__[[:alnum:]]+::list<.+>(( )?&)?$

But since D66174 they are sometimes matched in reverse order. In fact it was
only some luck it worked before as there is internally
std::map<lldb::RegularExpressionSP, FormatterImpl> (FormattersContainer).

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

llvm-svn: 369655

5 years ago[Attributor][NFC] Move DerefState to header and use StateWrapper
Hideto Ueno [Thu, 22 Aug 2019 14:18:29 +0000 (14:18 +0000)]
[Attributor][NFC] Move DerefState to header and use StateWrapper

Summary: In D65402, I want to get DerefState from AADereferenceable but it was not allowed. This patch moves DerefState definition into Attributor.h and makes AADerefenceable inherit StateWrapper.

Reviewers: jdoerfert, sstefan1

Reviewed By: jdoerfert

Subscribers: hiraditya, jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 369653

5 years ago[lldb][NFC] Fix indentation in CommandObjectProcess
Raphael Isemann [Thu, 22 Aug 2019 13:50:54 +0000 (13:50 +0000)]
[lldb][NFC] Fix indentation in CommandObjectProcess

llvm-svn: 369652

5 years ago[SlotIndexes] Add print-slotindexes to disable printing slotindexes
Jinsong Ji [Thu, 22 Aug 2019 13:44:47 +0000 (13:44 +0000)]
[SlotIndexes] Add print-slotindexes to disable printing slotindexes

Summary:
When we print the IR with --print-after/before-*,
SlotIndexes will be printed whenever available (We haven't freed it).

This introduces some noises when we try to compare the IR
among different optimizations.

eg:
-print-before=machine-cp will print SlotIndexes for 1st machine-cp
pass, but NOT for 2nd machine-cp;
-print-after=machine-cp will NOT print SlotIndexes for both
machine-cp passes.
So SlotIndexes in 1st pass introduce noises when differing these IRs.

This patch introduces an option to hide indexes.

Reviewers: stoklund, thegameg, qcolombet

Reviewed By: thegameg

Subscribers: hiraditya, arphaman, llvm-commits

Tags: #llvm

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

llvm-svn: 369650

5 years ago[MCA] consistently use MCPhysReg instead of unsigned as register type. NFCI
Andrea Di Biagio [Thu, 22 Aug 2019 13:32:17 +0000 (13:32 +0000)]
[MCA] consistently use MCPhysReg instead of unsigned as register type. NFCI

llvm-svn: 369648

5 years agoRevert r369402 "win: Enable /Zc:twoPhase by default if targeting MSVC 2017 update...
Hans Wennborg [Thu, 22 Aug 2019 13:15:36 +0000 (13:15 +0000)]
Revert r369402 "win: Enable /Zc:twoPhase by default if targeting MSVC 2017 update 3 or newer"

This broke compiling some ASan tests with never versions of MSVC/the Win
SDK, see https://crbug.com/996675

> MSVC 2017 update 3 (_MSC_VER 1911) enables /Zc:twoPhase by default, and
> so should clang-cl:
> https://docs.microsoft.com/en-us/cpp/build/reference/zc-twophase
>
> clang-cl takes the MSVC version it emulates from the -fmsc-version flag,
> or if that's not passed it tries to check what the installed version of
> MSVC is and uses that, and failing that it uses a default version that's
> currently 1911. So this changes the default if no -fmsc-version flag is
> passed and no installed MSVC is detected. (It also changes the default
> if -fmsc-version is passed or MSVC is detected, and either indicates
> _MSC_VER >= 1911.)
>
> As mentioned in the MSDN article, the Windows SDK header files in
> version 10.0.15063.0 (Creators Update or Redstone 2) and earlier
> versions do not work correctly with /Zc:twoPhase. If you need to use
> these old SDKs with a new clang-cl, explicitly pass /Zc:twoPhase- to get
> the old behavior.
>
> Fixes PR43032.
>
> Differential Revision: https://reviews.llvm.org/D66394

llvm-svn: 369647

5 years ago[lldb][NFC] Add test for target stop-hook disable/enable/delete
Raphael Isemann [Thu, 22 Aug 2019 13:09:02 +0000 (13:09 +0000)]
[lldb][NFC] Add test for target stop-hook disable/enable/delete

llvm-svn: 369646

5 years ago[yaml2obj] - Lookup relocation symbols in dynamic symbol when .dynsym referenced.
George Rimar [Thu, 22 Aug 2019 12:39:56 +0000 (12:39 +0000)]
[yaml2obj] - Lookup relocation symbols in dynamic symbol when .dynsym referenced.

This fixes https://bugs.llvm.org/show_bug.cgi?id=40337.

Previously, it was always assumed that relocations referenced symbols in the static symbol table.
Now, if the Link field references a section called ".dynsym" it will look up these symbols
in the dynamic symbol table.

This patch is heavily based on D59097 by James Henderson

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

llvm-svn: 369645

5 years agoFix some regressions caused by r369553 on old versions of Debian and Ubuntu
Sylvestre Ledru [Thu, 22 Aug 2019 12:16:08 +0000 (12:16 +0000)]
Fix some regressions caused by r369553 on old versions of Debian and Ubuntu
It was causing some errors like:

Encoding error:
'ascii' codec can't decode byte 0xe2 in position 341: ordinal not in range(128)
The full traceback has been saved in /tmp/sphinx-err-y2fq4dtb.log, if you want to report the issue to the developers.

llvm-svn: 369644

5 years agoRemove \brief commands from doxygen comments.
Dmitri Gribenko [Thu, 22 Aug 2019 11:32:57 +0000 (11:32 +0000)]
Remove \brief commands from doxygen comments.

Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

  for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done

[This is analogous to LLVM r331272 and CFE r331834]

Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits

Tags: #clang

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

llvm-svn: 369643

5 years ago[X86][BtVer2] Fix latency and throughput of XCHG and XADD.
Andrea Di Biagio [Thu, 22 Aug 2019 11:32:47 +0000 (11:32 +0000)]
[X86][BtVer2] Fix latency and throughput of XCHG and XADD.

On Jaguar, XCHG has a latency of 1cy and decodes to 2 macro-opcodes. Maximum
throughput for XCHG is 1 IPC. The byte exchange has worse latency and decodes to
1 extra uOP; maximum observed throughput is 0.5 IPC.

```
xchgb %cl, %dl           # Latency: 2cy  -  uOPs: 3  -  2 ALU
xchgw %cx, %dx           # Latency: 1cy  -  uOPs: 2  -  2 ALU
xchgl %ecx, %edx         # Latency: 1cy  -  uOPs: 2  -  2 ALU
xchgq %rcx, %rdx         # Latency: 1cy  -  uOPs: 2  -  2 ALU
```

The reg-mem forms of XCHG are atomic operations with an observed latency of
16cy.  The resource usage is similar to the XCHGrr variants. The biggest
difference is obviously the bus-locking, which prevents the LS to issue other
memory uOPs in parallel until the unlocking store uOP is executed.

```
xchgb %cl, (%rsp)        # Latency: 16cy  -  uOPs: 3 - ECX latency: 11cy
xchgw %cx, (%rsp)        # Latency: 16cy  -  uOPs: 3 - ECX latency: 11cy
xchgl %ecx, (%rsp)       # Latency: 16cy  -  uOPs: 3 - ECX latency: 11cy
xchgq %rcx, (%rsp)       # Latency: 16cy  -  uOPs: 3 - ECX latency: 11cy
```

The exchanged in/out register operand becomes available after 11cy from the
start of execution. Added test xchg.s to verify that we correctly see that
register write committed in 11cy (and not 16cy).

Reg-reg XADD instructions have the same latency/throughput than the byte
exchange (register-register variant).

```
xaddb %cl, %dl           # latency: 2cy  -  uOPs: 3  -  3 ALU
xaddw %cx, %dx           # latency: 2cy  -  uOPs: 3  -  3 ALU
xaddl %ecx, %edx         # latency: 2cy  -  uOPs: 3  -  3 ALU
xaddq %rcx, %rdx         # latency: 2cy  -  uOPs: 3  -  3 ALU
```

The non-atomic RM variants have a latency of 11cy, and decode to 4
macro-opcodes. They still consume 2 ALU pipes, and the exchange in/out register
operand becomes available in 3cy (it matches the 'load-to-use latency').

```
xaddb %cl, (%rsp)        # latency: 11cy  -  uOPs: 4  -  3 ALU
xaddw %cx, (%rsp)        # latency: 11cy  -  uOPs: 4  -  3 ALU
xaddl %ecx, (%rsp)       # latency: 11cy  -  uOPs: 4  -  3 ALU
xaddq %rcx, (%rsp)       # latency: 11cy  -  uOPs: 4  -  3 ALU
```

The atomic XADD variants execute in 16cy. The in/out register operand is
available after 11cy from the start of execution.

```
lock xaddb %cl, (%rsp)   # latency: 16cy - uOPs: 4 - 3 ALU -- ECX latency: 11cy
lock xaddw %cx, (%rsp)   # latency: 16cy - uOPs: 4 - 3 ALU -- ECX latency: 11cy
lock xaddl %ecx, (%rsp)  # latency: 16cy - uOPs: 4 - 3 ALU -- ECX latency: 11cy
lock xaddq %rcx, (%rsp)  # latency: 16cy - uOPs: 4 - 3 ALU -- ECX latency: 11cy
```

Added test xadd.s to verify those latencies as well as read-advance values.

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

llvm-svn: 369642

5 years ago[OpenCL] Fix declaration of enqueue_marker
Yaxun Liu [Thu, 22 Aug 2019 11:18:59 +0000 (11:18 +0000)]
[OpenCL] Fix declaration of enqueue_marker

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

llvm-svn: 369641

5 years ago[MVT] Add MVT equivalent to EVT::getHalfNumVectorElementsVT() helper. NFCI.
Simon Pilgrim [Thu, 22 Aug 2019 11:14:30 +0000 (11:14 +0000)]
[MVT] Add MVT equivalent to EVT::getHalfNumVectorElementsVT() helper. NFCI.

Allows for some cleanup in a lot of SSE/AVX vector splitting code

llvm-svn: 369640

5 years agoReapply: [ARM] Fix lsrl with a 128/256 bit shift amount or a shift of 32
Sam Tebbs [Thu, 22 Aug 2019 10:29:20 +0000 (10:29 +0000)]
Reapply: [ARM] Fix lsrl with a 128/256 bit shift amount or a shift of 32

The CodeGen/Thumb2/mve-vaddv.ll test needed to be amended to reflect the
changes from the above patch.

This reverts commit cd53ff6, reapplying 7c6b229.

llvm-svn: 369638

5 years ago[Loop Peeling] Fix silly bug in metadata update.
Serguei Katkov [Thu, 22 Aug 2019 10:06:46 +0000 (10:06 +0000)]
[Loop Peeling] Fix silly bug in metadata update.

We must update loop metedata before we moved to parent loop if
it is present.

llvm-svn: 369637

5 years agoRevert r369626 "[ARM] Fix lsrl with a 128/256 bit shift amount or a shift of 32"
Hans Wennborg [Thu, 22 Aug 2019 09:16:53 +0000 (09:16 +0000)]
Revert r369626 "[ARM] Fix lsrl with a 128/256 bit shift amount or a shift of 32"

It broke the bots, see e.g. http://lab.llvm.org:8011/builders/clang-cuda-build/builds/36275/

> This patch fixes shifts by a 128/256 bit shift amount. It also fixes
> codegen for shifts of 32 by delegating to LLVM's default optimisation
> instead of emitting a long shift.
>
> Tests that used to generate long shifts of 32 are updated to check for the
> more optimised codegen.
>
> Differential revision: https://reviews.llvm.org/D66519
>
> llvm-svn: 369626

llvm-svn: 369636