platform/upstream/llvm.git
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

5 years ago[lldb][NFC] Remove unused return value from HandleOptionArgumentCompletion
Raphael Isemann [Thu, 22 Aug 2019 09:14:42 +0000 (09:14 +0000)]
[lldb][NFC] Remove unused return value from HandleOptionArgumentCompletion

llvm-svn: 369635

5 years ago[llvm-objdump] - Remove an outdated "FIXME". NFC.
George Rimar [Thu, 22 Aug 2019 09:10:17 +0000 (09:10 +0000)]
[llvm-objdump] - Remove an outdated "FIXME". NFC.

The bug mentioned in this test case was fixed in D63779 (r364955),
which also provides a test case.

llvm-svn: 369634

5 years agoRevert r369458 "[DebugInfo] Add debug location to dynamic atexit destructor"
Hans Wennborg [Thu, 22 Aug 2019 09:07:25 +0000 (09:07 +0000)]
Revert r369458 "[DebugInfo] Add debug location to dynamic atexit destructor"

It causes the build to fail with

"inlinable function call in a function with debug info must have a !dbg location"

in Chromium. See llvm-commits thread for more info.

(This also reverts the follow-up in r369474.)

> Fixes PR43012
>
> Differential Revision: https://reviews.llvm.org/D66328

llvm-svn: 369633

5 years ago[lldb][NFC] NFC cleanup for the completion code
Raphael Isemann [Thu, 22 Aug 2019 09:02:54 +0000 (09:02 +0000)]
[lldb][NFC] NFC cleanup for the completion code

llvm-svn: 369632

5 years ago[clangd] The ClangdServer::EnableHiddenFeatures is not used any more.
Haojian Wu [Thu, 22 Aug 2019 09:01:04 +0000 (09:01 +0000)]
[clangd] The ClangdServer::EnableHiddenFeatures is not used any more.

Remove it.

llvm-svn: 369631

5 years ago[llvm-readobj] - Remove `reportError(std::error_code EC, StringRef Input)` helper.
George Rimar [Thu, 22 Aug 2019 08:56:24 +0000 (08:56 +0000)]
[llvm-readobj] - Remove `reportError(std::error_code EC, StringRef Input)` helper.

We do not need it, std::error_code is used mostly for COFF and
this patch rewrites the calls to use a different overload.

Having reportError(std::error_code EC, ... is excessive by itself,
because API that use error codes actually needs refactoring to
use Error/Expected<> instead.

DIfferential revision: https://reviews.llvm.org/D66521

llvm-svn: 369630

5 years agoRemove an unused function, suppress -Wunused-function warning.
Haojian Wu [Thu, 22 Aug 2019 08:49:41 +0000 (08:49 +0000)]
Remove an unused function, suppress -Wunused-function warning.

llvm-svn: 369629

5 years ago[X86] Lower the cost of v2i32->v2f64 sint_to_fp under vector widening legalization.
Craig Topper [Thu, 22 Aug 2019 08:18:45 +0000 (08:18 +0000)]
[X86] Lower the cost of v2i32->v2f64 sint_to_fp under vector widening legalization.

I don't really understand the costs we're using for fp_to_sint,
but prior to widening legalization we used 20 as the cost for this
via the v2i64->v2f64 entry. That number seems better than the 40
we got with widening legalization. So now we need either a
v2i32->v2f64 entry or a v4i32->v2f64 entry depending on whether
AVX is enabled or not since we skip the first SSE2 table look up
under AVX.

llvm-svn: 369628

5 years ago[Support] Improve readNativeFile(Slice) interface
Pavel Labath [Thu, 22 Aug 2019 08:13:30 +0000 (08:13 +0000)]
[Support] Improve readNativeFile(Slice) interface

Summary:
There was a subtle, but pretty important difference between the Slice
and regular versions of this function. The Slice function was
zero-initializing the rest of the buffer when the read syscall returned
less bytes than expected, while the regular function did not.

This patch removes the inconsistency by making both functions *not*
zero-initialize the buffer. The zeroing code is moved to the
MemoryBuffer class, which is currently the only user of this code. This
makes the API more consistent, and the code shorter.

While in there, I also refactor the functions to return the number of
bytes through the regular return value (via Expected<size_t>) instead of
a separate by-ref argument.

Reviewers: aganea, rnk

Subscribers: kristina, Bigcheese, llvm-commits

Tags: #llvm

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

llvm-svn: 369627

5 years ago[ARM] Fix lsrl with a 128/256 bit shift amount or a shift of 32
Sam Tebbs [Thu, 22 Aug 2019 08:12:06 +0000 (08:12 +0000)]
[ARM] Fix lsrl with a 128/256 bit shift amount or a shift of 32

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

5 years ago[lldb][NFC] Remove dead code that is supposed to handle invalid command options
Raphael Isemann [Thu, 22 Aug 2019 08:08:05 +0000 (08:08 +0000)]
[lldb][NFC] Remove dead code that is supposed to handle invalid command options

Summary:
We currently have a bunch of code that is supposed to handle invalid command options, but
all this code is unreachable because invalid options are already handled in `Options::Parse`.
The only way we can reach this code is when we declare but then not implement an option
(which will be made impossible with D65386, which is also when we can completely remove
the `default` cases).

This patch replaces all this code with `llvm_unreachable` to make clear this is dead code
that can't be reached.

Reviewers: JDevlieghere

Reviewed By: JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 369625

5 years ago[lldb][NFC] Remove WordComplete mode, make result array indexed from 0 and remove...
Raphael Isemann [Thu, 22 Aug 2019 07:41:23 +0000 (07:41 +0000)]
[lldb][NFC] Remove WordComplete mode, make result array indexed from 0 and remove any undocumented/redundant return values

Summary:
We still have some leftovers of the old completion API in the internals of
LLDB that haven't been replaced by the new CompletionRequest. These leftovers
are:

* The return values (int/size_t) in all completion functions.
* Our result array that starts indexing at 1.
* `WordComplete` mode.

I didn't replace them back then because it's tricky to figure out what exactly they
are used for and the completion code is relatively untested. I finally got around
to writing more tests for the API and understanding the semantics, so I think it's
a good time to get rid of them.

A few words why those things should be removed/replaced:

* The return values are really cryptic, partly redundant and rarely documented.
  They are also completely ignored by Xcode, so whatever information they contain will end up
  breaking Xcode's completion mechanism. They are also partly impossible to even implement
  as we assign negative values special meaning and our completion API sometimes returns size_t.

  Completion functions are supposed to return -2 to rewrite the current line. We seem to use this
  in some untested code path to expand the history repeat character to the full command, but
  I haven't figured out why that doesn't work at the moment.
  Completion functions return -1 to 'insert the completion character', but that isn't implemented
  (even though we seem to activate this feature in LLDB sometimes).
  All positive values have to match the number of results. This is obviously just redundant information
  as the user can just look at the result list to get that information (which is what Xcode does).

* The result array that starts indexing at 1 is obviously unexpected. The first element of the array is
  reserved for the common prefix of all completions (e.g. "foobar" and "footar" -> "foo"). The idea is
  that we calculate this to make the life of the API caller easier, but obviously forcing people to have
  1-based indices is not helpful (or even worse, forces them to manually copy the results to make it
  0-based like Xcode has to do).

* The `WordComplete` mode indicates that LLDB should enter a space behind the completion. The
  idea is that we let the top-level API know that we just provided a full completion. Interestingly we
  `WordComplete` is just a single bool that somehow represents all N completions. And we always
  provide full completions in LLDB, so in theory it should always be true.
  The only use it currently serves is providing redundant information about whether we have a single
  definitive completion or not (which we already know from the number of results we get).

This patch essentially removes `WordComplete` mode and makes the result array indexed from 0.
It also removes all return values from all internal completion functions. The only non-redundant information
they contain is about rewriting the current line (which is broken), so that functionality was moved
to the CompletionRequest API. So you can now do `addCompletion("blub", "description", CompletionMode::RewriteLine)`
to do the same.

For the SB API we emulate the old behaviour by making the array indexed from 1 again with the common
prefix at index 0. I didn't keep the special negative return codes as we either never sent them before (e.g. -2) or we
didn't even implement them in the Editline handler (e.g. -1).

I tried to keep this patch minimal and I'm aware we can probably now even further simplify a bunch of related code,
but I would prefer doing this in follow-up NFC commits

Reviewers: JDevlieghere

Reviewed By: JDevlieghere

Subscribers: arphaman, abidh, lldb-commits

Tags: #lldb

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

llvm-svn: 369624

5 years agoRevert "[GWP-ASan] Remove c++ standard lib dependency."
Petr Hosek [Thu, 22 Aug 2019 07:03:38 +0000 (07:03 +0000)]
Revert "[GWP-ASan] Remove c++ standard lib dependency."

This reverts commit r369606: this doesn't addressed the underlying
problem and it's not the correct solution.

llvm-svn: 369623

5 years ago[TargetLowering] Remove optional arguments passing to makeLibCall
Shiva Chen [Thu, 22 Aug 2019 04:59:43 +0000 (04:59 +0000)]
[TargetLowering] Remove optional arguments passing to makeLibCall

The patch introduces MakeLibCallOptions struct as suggested by @efriedma on D65497.
The struct contain argument flags which will pass to makeLibCall function.
The patch should not has any functionality changes.

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

llvm-svn: 369622

5 years ago[debugserver] Switch back to std::once_flag
Jonas Devlieghere [Thu, 22 Aug 2019 03:48:19 +0000 (03:48 +0000)]
[debugserver] Switch back to std::once_flag

We cannot use llvm::once_flag in debugserver because doesn't link
against llvm.

llvm-svn: 369621

5 years ago[lit] Diagnose insufficient args to internal env
Joel E. Denny [Thu, 22 Aug 2019 03:42:01 +0000 (03:42 +0000)]
[lit] Diagnose insufficient args to internal env

Without this patch, failing to provide a subcommand to lit's internal
`env` results in either a python `IndexError` or an attempt to execute
the final `env` argument, such as `FOO=1`, as a command.  This patch
diagnoses those cases with a more helpful message.

Reviewed By: stella.stamenova

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

llvm-svn: 369620

5 years ago[OpenMP] Permit map with DSA on combined directive
Joel E. Denny [Thu, 22 Aug 2019 03:34:30 +0000 (03:34 +0000)]
[OpenMP] Permit map with DSA on combined directive

For `map`, the following restriction changed in OpenMP 5.0:

* OpenMP 4.5 [2.15.5.1, Restrictions]: "A list item cannot appear in
  both a map clause and a data-sharing attribute clause on the same
  construct.

* OpenMP 5.0 [2.19.7.1, Restrictions]: "A list item cannot appear in
  both a map clause and a data-sharing attribute clause on the same
  construct unless the construct is a combined construct."

This patch removes this restriction in the case of combined constructs
and OpenMP 5.0, and it updates Sema not to capture a scalar by copy in
the target region when `firstprivate` and `map` appear for that scalar
on a combined target construct.

This patch also adds a fixme to a test that now reveals that a
diagnostic about loop iteration variables is dropped in the case of
OpenMP 5.0.  That bug exists regardless of this patch's changes.

Reviewed By: ABataev, jdoerfert, hfinkel, kkwli0

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

llvm-svn: 369619

5 years ago[lldb] Replace std::once_flag with llvm::once_flag.
Davide Italiano [Thu, 22 Aug 2019 03:12:49 +0000 (03:12 +0000)]
[lldb] Replace std::once_flag with llvm::once_flag.

Summary:
The former seems like it's not working on some platforms.
All the other uses use `llvm::`, so, let's change for consistency.

Reviewers: jasonmolenda, friss

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 369618