platform/upstream/llvm.git
5 years agoUse DiagRuntimeBehavior for -Wunsequenced to weed out false positives
Richard Smith [Sat, 4 May 2019 05:20:14 +0000 (05:20 +0000)]
Use DiagRuntimeBehavior for -Wunsequenced to weed out false positives
where either the modification or the other access is unreachable.

llvm-svn: 359962

5 years agoAMDGPU] gfx1010 hazard recognizer
Stanislav Mekhanoshin [Sat, 4 May 2019 04:30:57 +0000 (04:30 +0000)]
AMDGPU] gfx1010 hazard recognizer

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

llvm-svn: 359961

5 years agoReduce amount of work ODR hashing does.
Richard Trieu [Sat, 4 May 2019 04:22:33 +0000 (04:22 +0000)]
Reduce amount of work ODR hashing does.

When a FunctionProtoType is in the original type in a DecayedType, the decayed
type is a PointerType which points back the original FunctionProtoType.  The
visitor for ODRHashing will attempt to process both Type's, doing double work.
By chaining together multiple DecayedType's and FunctionProtoType's, this would
result in 2^N Type's visited only N DecayedType's and N FunctionProtoType's
exsit.  Another bug where VisitDecayedType and VisitAdjustedType did
redundant work doubled the work at each level, giving 4^N Type's visited.  This
patch removed the double work and detects when a FunctionProtoType decays to
itself to only check the Type once.  This lowers the exponential runtime to
linear runtime.  Fixes https://bugs.llvm.org/show_bug.cgi?id=41625

llvm-svn: 359960

5 years ago[AMDGPU] gfx1010: use fmac instructions
Stanislav Mekhanoshin [Sat, 4 May 2019 04:20:37 +0000 (04:20 +0000)]
[AMDGPU] gfx1010: use fmac instructions

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

llvm-svn: 359959

5 years agoDisallow the operand of __builtin_constant_p from modifying enclosing
Richard Smith [Sat, 4 May 2019 04:00:45 +0000 (04:00 +0000)]
Disallow the operand of __builtin_constant_p from modifying enclosing
state when it's encountered while evaluating a constexpr function.

We attempt to follow GCC trunk's behavior here, but it is somewhat
inscrutible, so our behavior is only approximately the same for now.
Specifically, we only permit modification of objects whose lifetime
began within the operand of the __builtin_constant_p. GCC appears to
have effectively the same restriction, but also some unknown restriction
based on where and how the local state of the constexpr function is
mentioned within the operand (see added testcases).

llvm-svn: 359958

5 years ago[Driver] Create non-existent directory for -fcrash-diagnostics-dir
Petr Hosek [Sat, 4 May 2019 00:55:14 +0000 (00:55 +0000)]
[Driver] Create non-existent directory for -fcrash-diagnostics-dir

When user specifies non-existent directory to -fcrash-diagnostics-dir,
create it rather than failing with an error as would be the case before.

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

llvm-svn: 359954

5 years ago[cxx_status] Don't list -fmodules / -fmodules-ts against C++ modules
Richard Smith [Sat, 4 May 2019 00:27:21 +0000 (00:27 +0000)]
[cxx_status] Don't list -fmodules / -fmodules-ts against C++ modules
support; those turn on different modules modes. The real C++ modules
support is behind -std=c++2a like the rest of C++20.

llvm-svn: 359953

5 years ago[cxx_status] Replace "SVN" entries with Clang 8 as appropriate.
Richard Smith [Sat, 4 May 2019 00:23:18 +0000 (00:23 +0000)]
[cxx_status] Replace "SVN" entries with Clang 8 as appropriate.

Also: use the "svn" color for "explicit(bool)" rather than the "full" color.
llvm-svn: 359951

5 years ago[JITLink] Add two useful Section operations: find by name, get address range.
Lang Hames [Sat, 4 May 2019 00:23:09 +0000 (00:23 +0000)]
[JITLink] Add two useful Section operations: find by name, get address range.

These operations were already used in eh-frame registration, and are likely to
be used in other runtime registrations, so this commit moves them into a header
where they can be re-used.

llvm-svn: 359950

5 years ago[clang] adding explicit(bool) from c++2a
Nicolas Lesser [Sat, 4 May 2019 00:09:00 +0000 (00:09 +0000)]
[clang] adding explicit(bool) from c++2a

this patch adds support for the explicit bool specifier.

Changes:
- The parsing for the explicit(bool) specifier was added in ParseDecl.cpp.
- The storage of the explicit specifier was changed. the explicit specifier was stored as a boolean value in the FunctionDeclBitfields and in the DeclSpec class. now it is stored as a PointerIntPair<Expr*, 2> with a flag and a potential expression in CXXConstructorDecl, CXXDeductionGuideDecl, CXXConversionDecl and in the DeclSpec class.
- Following the AST change, Serialization, ASTMatchers, ASTComparator and ASTPrinter were adapted.
- Template instantiation was adapted to instantiate the potential expressions of the explicit(bool) specifier When instantiating their associated declaration.
- The Add*Candidate functions were adapted, they now take a Boolean indicating if the context allowing explicit constructor or conversion function and this boolean is used to remove invalid overloads that required template instantiation to be detected.
- Test for Semantic and Serialization were added.

This patch is not yet complete. I still need to check that interaction with CTAD and deduction guides is correct. and add more tests for AST operations. But I wanted first feedback.
Perhaps this patch should be spited in smaller patches, but making each patch testable as a standalone may be tricky.

Patch by Tyker

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

llvm-svn: 359949

5 years agoCWG issue 727: Fix numerous bugs in support for class-scope explicit
Richard Smith [Fri, 3 May 2019 23:51:38 +0000 (23:51 +0000)]
CWG issue 727: Fix numerous bugs in support for class-scope explicit
specializations for variable templates.

llvm-svn: 359947

5 years agoExpressionParser: only force link MCJIT when needed
Saleem Abdulrasool [Fri, 3 May 2019 23:19:27 +0000 (23:19 +0000)]
ExpressionParser: only force link MCJIT when needed

This was added to support FreeBSD.  The inclusion of this header increases the
size of `lldb-server` due to MCJIT being forcefully preserved.  Conditionalise
the inclusion to shared builds of LLVM which will allow for MCJIT to be stripped
if unnecessary when performing static linking of tools.  This shaves off ~28% of
the binary size for lldb-server when linked with gold using
`-ffunction-sections` and `-fdata-sections`.

llvm-svn: 359944

5 years ago[clang-format] Fix bug in block comment reflow that joins * and /
Owen Pan [Fri, 3 May 2019 23:15:40 +0000 (23:15 +0000)]
[clang-format] Fix bug in block comment reflow that joins * and /

Fixes PR41213

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

llvm-svn: 359943

5 years ago[lld] Specify output file explicitly
Alexander Kornienko [Fri, 3 May 2019 23:11:32 +0000 (23:11 +0000)]
[lld] Specify output file explicitly

The test shouldn't try to create `a.out` in the current directory, which can be
read-only (and it is in our test setup).

llvm-svn: 359942

5 years ago[x86] add tests for fneg IR with undef; NFC
Sanjay Patel [Fri, 3 May 2019 22:47:29 +0000 (22:47 +0000)]
[x86] add tests for fneg IR with undef; NFC

llvm-svn: 359941

5 years ago[AArch64][GlobalISel] Use fcsel instead of csel for G_SELECT on FPRs
Jessica Paquette [Fri, 3 May 2019 22:37:46 +0000 (22:37 +0000)]
[AArch64][GlobalISel] Use fcsel instead of csel for G_SELECT on FPRs

This saves us some unnecessary copies.

If the inputs to a G_SELECT are floating point, we should use fcsel rather than
csel.

Changes here are...

- Teach selectCopy about s1-to-s1 copies across register banks.
- AArch64RegisterBankInfo about G_SELECT in general.
- Teach the instruction selector about the FCSEL instructions.

Also add two tests:

- select-select.mir to show that we get the expected FCSEL
- regbank-select.mir (unfortunately named) to show the register banks on
G_SELECT are properly preserved

And update fast-isel-select.ll to show that we do the same thing as other
instruction selectors in these cases.

llvm-svn: 359940

5 years agoMake the git-llvm script work on older git versions that don't support git rev-parse...
Craig Topper [Fri, 3 May 2019 22:03:29 +0000 (22:03 +0000)]
Make the git-llvm script work on older git versions that don't support git rev-parse --git-common-dir.

Not all versions of git support git rev-parse --git-common-dir. Rather than erorr or print any kind of
useful error, they just print back '--git-common-dir' instead of a directory. The git-llvm script
ends up taking this '--git-common-dir' as a diretory name to use.

Not sure exactly what happens after that, but the end result is that the 'git llvm push' ends up
looking like it pushed your commits, but really did nothing.

This patch makes the script detect the bogus directory name for --git-common-dir and falls back to using --git-dir instead.

llvm-svn: 359939

5 years ago[AMDGPU] gfx1010 wait count insertion
Stanislav Mekhanoshin [Fri, 3 May 2019 21:53:53 +0000 (21:53 +0000)]
[AMDGPU] gfx1010 wait count insertion

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

llvm-svn: 359938

5 years ago[AMDGPU] gfx1010 s_code_end generation
Stanislav Mekhanoshin [Fri, 3 May 2019 21:26:39 +0000 (21:26 +0000)]
[AMDGPU] gfx1010 s_code_end generation

Also add some missing metadata in the streamer.

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

llvm-svn: 359937

5 years agoUpdate PatternMatcher for FNeg
Cameron McInally [Fri, 3 May 2019 21:19:12 +0000 (21:19 +0000)]
Update PatternMatcher for FNeg

Match both FNeg(X) and FSub(+-0.0, X) in FNeg_match

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

llvm-svn: 359936

5 years ago[AMDGPU] gfx1010 loop alignment
Stanislav Mekhanoshin [Fri, 3 May 2019 21:17:29 +0000 (21:17 +0000)]
[AMDGPU] gfx1010 loop alignment

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

llvm-svn: 359935

5 years ago[COFF, ARM64] Fix ABI implementation of struct returns
Mandeep Singh Grang [Fri, 3 May 2019 21:12:36 +0000 (21:12 +0000)]
[COFF, ARM64] Fix ABI implementation of struct returns

Summary:
Refer the ABI doc at: https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=vs-2019#return-values

Related clang patch: D60349

Reviewers: rnk, efriedma, TomTan, ssijaric

Reviewed By: rnk, efriedma

Subscribers: mstorsjo, javed.absar, kristof.beyls, llvm-commits

Tags: #llvm

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

llvm-svn: 359934

5 years ago[COFF, ARM64] Fix ABI implementation of struct returns
Mandeep Singh Grang [Fri, 3 May 2019 21:12:24 +0000 (21:12 +0000)]
[COFF, ARM64] Fix ABI implementation of struct returns

Summary:
Related llvm patch: D60348.
Patch co-authored by Sanjin Sijaric.

Reviewers: rnk, efriedma, TomTan, ssijaric, ostannard

Reviewed By: efriedma

Subscribers: dmajor, richard.townsend.arm, ostannard, javed.absar, kristof.beyls, cfe-commits

Tags: #clang

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

llvm-svn: 359932

5 years agoFixed some minor style issues in rLLDB359921 [NFC]
Raphael Isemann [Fri, 3 May 2019 21:01:45 +0000 (21:01 +0000)]
Fixed some minor style issues in rLLDB359921 [NFC]

Ran clang-format on the added test file and use the new StringRef
comparison over the temporary ConstStrings. Also aligned the
end of one of the code string literals.

llvm-svn: 359931

5 years ago[test] Make check more strict
Jonas Devlieghere [Fri, 3 May 2019 20:58:56 +0000 (20:58 +0000)]
[test] Make check more strict

Before this change the test would always pass if the path to the test
contained the number 11 in it. Thanks to Ted for pointing this out.

llvm-svn: 359930

5 years ago[lldb] Remove the 'www' folder.
Jonas Devlieghere [Fri, 3 May 2019 20:42:45 +0000 (20:42 +0000)]
[lldb] Remove the 'www' folder.

Now that the new website is live and everything is generated from the
repository, we don't need the www folder anymore.

llvm-svn: 359929

5 years ago[Alias] Add 're' alias for register
Jonas Devlieghere [Fri, 3 May 2019 20:37:09 +0000 (20:37 +0000)]
[Alias] Add 're' alias for register

This patch makes `re` an alias for `register`. Currently `re<TAB>` gives
you the choice between `register` and `reproducer`. Given that you use
`register` a lot more often, it should win for the common substring.

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

llvm-svn: 359927

5 years agoMake lldb-mi optional and change how we deal with missing tools in lit
Jonas Devlieghere [Fri, 3 May 2019 20:33:58 +0000 (20:33 +0000)]
Make lldb-mi optional and change how we deal with missing tools in lit

We don't need the variables in lit, we can use the capabilities to check
if the utility exists.

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

llvm-svn: 359926

5 years agoSupply a default implementation of IsRuntimeSupportValue.
Adrian Prantl [Fri, 3 May 2019 20:28:19 +0000 (20:28 +0000)]
Supply a default implementation of IsRuntimeSupportValue.

Thanks to Pavel for pointing this out.

llvm-svn: 359925

5 years agoShrink SectionChunk by combining Relocs and SectionName sizes
Reid Kleckner [Fri, 3 May 2019 20:17:14 +0000 (20:17 +0000)]
Shrink SectionChunk by combining Relocs and SectionName sizes

SectionChunk is one of the most frequently allocated data structures in
LLD, since there are about four per function when optimizations and
debug info are enabled (.text, .pdata, .xdata, .debug$S).

A PE COFF file cannot be larger than 2GB, so there is an inherent limit
on the length of the section name and the number of relocations.
Decompose the ArrayRef and StringRef into pointer and size, and put them
back together in the accessors for section name and relocation list.

I plan to gather complete performance numbers later by padding
SectionChunk with dead data and measuring performance after all the size
optimizations are done.

llvm-svn: 359923

5 years ago[OPENMP][NVPTX]Improve thread limit counter, NFC.
Alexey Bataev [Fri, 3 May 2019 20:00:38 +0000 (20:00 +0000)]
[OPENMP][NVPTX]Improve thread limit counter, NFC.

Summary:
Patch improves performance of the full runtime mode by moving
thread-limit counter to the shared memory. It also allows to save
global memory.

Reviewers: grokos, gtbercea, kkwli0

Subscribers: guansong, jdoerfert, caomhin, openmp-commits

Tags: #openmp

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

llvm-svn: 359922

5 years agoFix for ambiguous lookup in expressions between local variable and namespace
Shafik Yaghmour [Fri, 3 May 2019 19:59:22 +0000 (19:59 +0000)]
Fix for ambiguous lookup in expressions between local variable and namespace

Summary:
In an Objective-C context a local variable and namespace can cause an ambiguous name lookup when used in an expression. The solution involves mimicking the existing C++ solution which is to add local using declarations for local variables. This causes a different type of lookup to be used which eliminates the namespace during acceptable results filtering.

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

llvm-svn: 359921

5 years ago[Lsan] Disabling explicitally FreeBSD
David Carlier [Fri, 3 May 2019 19:46:55 +0000 (19:46 +0000)]
[Lsan] Disabling explicitally FreeBSD

As it is not implemented upon usage, it just provokes numerous linkage issues so better switch off clearly.

Reviewers: vitalybuka, morehouse

Reviewed By: morehouse

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

llvm-svn: 359920

5 years agoReapply r359906, "RegAllocFast: Add heuristic to detect values not live-out of a...
Matt Arsenault [Fri, 3 May 2019 19:06:57 +0000 (19:06 +0000)]
Reapply r359906, "RegAllocFast: Add heuristic to detect values not live-out of a block"

This reverts commit r359912.

This should pass now, since the clang test was made less fragile in
r359918.

llvm-svn: 359919

5 years agoEnsure there is stack usage in stack size warning test
Matt Arsenault [Fri, 3 May 2019 19:04:14 +0000 (19:04 +0000)]
Ensure there is stack usage in stack size warning test

r359906 broke this because the only stack usage was from a spill which
can be avoided since the only block is a return.

llvm-svn: 359918

5 years ago[CommandLine] Enable Grouping for short options by default. Part 4 of 5
Don Hinton [Fri, 3 May 2019 18:56:25 +0000 (18:56 +0000)]
[CommandLine] Enable Grouping for short options by default.  Part 4 of 5

Summary:
This change enables `cl::Grouping` for short options --
options with names of a single character.  This is consistent with GNU
getopt behavior.

Reviewers: rnk, MaskRay

Reviewed By: MaskRay

Subscribers: thopre, cfe-commits, MaskRay, rupprecht, hiraditya, llvm-commits

Tags: #llvm, #clang

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

llvm-svn: 359917

5 years agoAttempt to fix the clang-sphinx-docs bot after r358797
Nico Weber [Fri, 3 May 2019 18:54:18 +0000 (18:54 +0000)]
Attempt to fix the clang-sphinx-docs bot after r358797

llvm-svn: 359916

5 years ago[DAGCombine] Remove repeated variables. NFCI.
Simon Pilgrim [Fri, 3 May 2019 18:20:28 +0000 (18:20 +0000)]
[DAGCombine] Remove repeated variables. NFCI.

llvm-svn: 359915

5 years ago[hwasan] Fix HWASAN_WITH_INTERCEPTORS=OFF build on not-android.
Evgeniy Stepanov [Fri, 3 May 2019 18:20:16 +0000 (18:20 +0000)]
[hwasan] Fix HWASAN_WITH_INTERCEPTORS=OFF build on not-android.

Summary:
I'm not aware of any platforms where this will work, but the code should at least compile.
HWASAN_WITH_INTERCEPTORS=OFF means there is magic in libc that would call __hwasan_thread_enter /
__hwasan_thread_exit as appropriate.

Reviewers: pcc, winksaville

Subscribers: srhines, kubamracek, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 359914

5 years agoRemove else-after-return
David Blaikie [Fri, 3 May 2019 18:11:31 +0000 (18:11 +0000)]
Remove else-after-return

llvm-svn: 359913

5 years agoRevert r359906, "RegAllocFast: Add heuristic to detect values not live-out of a block"
Nico Weber [Fri, 3 May 2019 18:08:03 +0000 (18:08 +0000)]
Revert r359906, "RegAllocFast: Add heuristic to detect values not live-out of a block"

Makes clang/test/Misc/backend-stack-frame-diagnostics-fallback.cpp fail.

llvm-svn: 359912

5 years ago[TargetLowering] SimplifySetCC - remove repeated variable. NFCI.
Simon Pilgrim [Fri, 3 May 2019 18:02:33 +0000 (18:02 +0000)]
[TargetLowering] SimplifySetCC - remove repeated variable. NFCI.

Also reduce scope of Temp variable.

llvm-svn: 359911

5 years ago[CUDA][Clang][Bugfix] Add missing CUDA 9.2 case
Gheorghe-Teodor Bercea [Fri, 3 May 2019 17:59:18 +0000 (17:59 +0000)]
[CUDA][Clang][Bugfix] Add missing CUDA 9.2 case

Summary:
The bug was reported on the OpenMP-dev list:

.../obj-release/lib/clang/9.0.0/include/__clang_cuda_intrinsics.h:173:35: error: '__nvvm_shfl_sync_idx_i32' needs target feature ptx60|ptx61|ptx63|ptx64
__MAKE_SYNC_SHUFFLES(__shfl_sync, __nvvm_shfl_sync_idx_i32,

This problem occurs when trying to compile a .cu file that requires a newer ptx version (>ptx60 in this case) than ptx42.

Reviewers: tra, ABataev, caomhin

Reviewed By: tra

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 359910

5 years ago[CommandLine] Change help output to prefix long options with `--` instead of `-`...
Don Hinton [Fri, 3 May 2019 17:47:29 +0000 (17:47 +0000)]
[CommandLine] Change help output to prefix long options with `--` instead of `-`. NFC . Part 3 of 5

Summary:
By default, `parseCommandLineOptions()` will accept either a
`-` or `--` prefix for long options -- options with names longer than
a single character.

While this change does not affect behavior, it will be helpful with a
subsequent change that requires long options use the `--` prefix.

Reviewers: rnk, thopre

Reviewed By: thopre

Subscribers: thopre, cfe-commits, hiraditya, llvm-commits

Tags: #llvm, #clang

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

llvm-svn: 359909

5 years agoRevert "[CodeGenPrepare] limit overflow intrinsic matching to a single basic block"
Evgeniy Stepanov [Fri, 3 May 2019 17:31:49 +0000 (17:31 +0000)]
Revert "[CodeGenPrepare] limit overflow intrinsic matching to a single basic block"

This reverts commit r359879, which introduced a compiler crash.

llvm-svn: 359908

5 years agoMark is_trivially_destructible as unsupported with apple-clang-9
Nico Weber [Fri, 3 May 2019 17:26:17 +0000 (17:26 +0000)]
Mark is_trivially_destructible as unsupported with apple-clang-9

See discussion on https://reviews.llvm.org/D48292

llvm-svn: 359907

5 years agoRegAllocFast: Add heuristic to detect values not live-out of a block
Matt Arsenault [Fri, 3 May 2019 17:03:24 +0000 (17:03 +0000)]
RegAllocFast: Add heuristic to detect values not live-out of a block

Add an improved/new heuristic to catch more cases when values are not
live out of a basic block.

Patch by Matthias Braun

llvm-svn: 359906

5 years ago[hexagon] change AsmParser assertion to error
Brian Cain [Fri, 3 May 2019 16:50:38 +0000 (16:50 +0000)]
[hexagon] change AsmParser assertion to error

For immediates that can't be evaluated in assembler-mapped instructions, we
should return 'invalid operand' instead of assert.

llvm-svn: 359905

5 years ago[Docs][CodeGenerator][eBPF] Correct the values for BPF_X and BPF_K
Yonghong Song [Fri, 3 May 2019 16:40:16 +0000 (16:40 +0000)]
[Docs][CodeGenerator][eBPF] Correct the values for BPF_X and BPF_K

Fix the values of BPF_X and BPF_K according to BPFInstrFormats.td:
"
def BPF_K : BPFSrcType<0x0>;
def BPF_X : BPFSrcType<0x1>;
"

The right value for BPF_X is 0x1, and the right value for BPF_K is 0x0.

Signed-off-by: Wang YanQing <udknight@gmail.com>
Differential Revision: https://reviews.llvm.org/D61512

llvm-svn: 359904

5 years ago[X86] Allow assembly parser to accept x/y/z suffixes on non-memory vfpclassps/pd...
Craig Topper [Fri, 3 May 2019 16:15:15 +0000 (16:15 +0000)]
[X86] Allow assembly parser to accept x/y/z suffixes on non-memory vfpclassps/pd and on memory forms in intel syntax

The x/y/z suffix is needed to disambiguate the memory form in at&t syntax since no xmm/ymm/zmm register is mentioned.

But we should also allow it for the register and broadcast forms where its not needed for consistency. This matches gas.

The printing code will still only use the suffix for the memory form where it is needed.

llvm-svn: 359903

5 years ago[llvm] Revert r231274: "Devirtualize ~parser<T> by making it protected in base classe...
Don Hinton [Fri, 3 May 2019 16:15:13 +0000 (16:15 +0000)]
[llvm] Revert r231274: "Devirtualize ~parser<T> by making it protected in base classes and making derived classes final"

Summary: This patch was previously applied in r231221, and reverted in
r231254 because it broke self-hosting.  It was subsequently fixed and
reapplied in r231274.  Unfortunately, making the `parser<T>` classes
final prevents inheritance which makes it impossible to implement
custom parsers.

Reverting r231221 restores the ability to customize parsers.

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: craig.topper, llvm-commits

Tags: #llvm

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

llvm-svn: 359902

5 years ago[X86] LowerToHorizontalOp - Tidyup calls to getHopForBuildVector. NFCI.
Simon Pilgrim [Fri, 3 May 2019 15:56:06 +0000 (15:56 +0000)]
[X86] LowerToHorizontalOp - Tidyup calls to getHopForBuildVector. NFCI.

Merge the if() tests for the various HADD/SUB + Subtarget tests

llvm-svn: 359901

5 years ago[SelectionDAG] CreateTopologicalOrder - don't use iterator
Simon Pilgrim [Fri, 3 May 2019 15:50:37 +0000 (15:50 +0000)]
[SelectionDAG] CreateTopologicalOrder - don't use iterator

We shouldn't use an iterator to loop across a std::vector when the same loop is adding elements to that std::vector

Found by cppcheck

llvm-svn: 359900

5 years agoAMDGPU: Select VOP3 form of sub
Matt Arsenault [Fri, 3 May 2019 15:37:07 +0000 (15:37 +0000)]
AMDGPU: Select VOP3 form of sub

The VOP3 form should always be the preferred selection form to be
shrunk later.

The r600 sub test needs to be split out because it asserts on the
arguments in the new test during the calling convention lowering.

llvm-svn: 359899

5 years agoAMDGPU: Support shrinking add with FI in SIFoldOperands
Matt Arsenault [Fri, 3 May 2019 15:21:53 +0000 (15:21 +0000)]
AMDGPU: Support shrinking add with FI in SIFoldOperands

Avoids test regression in a future patch

llvm-svn: 359898

5 years agoRevert r359549 - incorrect update of test checks. NFC
Robert Lougher [Fri, 3 May 2019 15:14:19 +0000 (15:14 +0000)]
Revert r359549 - incorrect update of test checks. NFC

llvm-svn: 359897

5 years ago[x86] add tests for fneg with undefs; NFC
Sanjay Patel [Fri, 3 May 2019 15:09:53 +0000 (15:09 +0000)]
[x86] add tests for fneg with undefs; NFC

This was originally part of D61419.

llvm-svn: 359896

5 years agoAMDGPU: Remove redundant patterns for shifts
Matt Arsenault [Fri, 3 May 2019 15:08:36 +0000 (15:08 +0000)]
AMDGPU: Remove redundant patterns for shifts

llvm-svn: 359895

5 years agoAMDGPU: Remove redundant patterns for sub
Matt Arsenault [Fri, 3 May 2019 15:08:35 +0000 (15:08 +0000)]
AMDGPU: Remove redundant patterns for sub

There were 2 patterns for sub, one selecting to sub and one to
subrev. Only one of these will succeed, so remove the reversed one.

llvm-svn: 359894

5 years agoAMDGPU: Add baseline test for future patch
Matt Arsenault [Fri, 3 May 2019 14:54:38 +0000 (14:54 +0000)]
AMDGPU: Add baseline test for future patch

llvm-svn: 359893

5 years ago[OPENMP][NVPTX]Improved several standard OpenMP functions, NFC.
Alexey Bataev [Fri, 3 May 2019 14:47:20 +0000 (14:47 +0000)]
[OPENMP][NVPTX]Improved several standard OpenMP functions, NFC.

Summary:
Used parallelLevel[] counter to simplify and improve implementation of
the existing standard OpenMP functions. Functions are tested already in
several tests, the patch is NFC.

Reviewers: grokos, gtbercea, kkwli0

Subscribers: guansong, jdoerfert, caomhin, openmp-commits

Tags: #openmp

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

llvm-svn: 359892

5 years agoAMDGPU: Replace shrunk instruction with dummy implicit_def
Matt Arsenault [Fri, 3 May 2019 14:40:10 +0000 (14:40 +0000)]
AMDGPU: Replace shrunk instruction with dummy implicit_def

This was broken if the original operand was killed. The kill flag
would appear on both instructions, and fail the verifier. Keep the
kill flag, but remove the operands from the old instruction. This has
an added benefit of really reducing the use count for future folds.

Ideally the pass would be structured more like what PeepholeOptimizer
does to avoid this hack to avoid breaking instruction iterators.

llvm-svn: 359891

5 years ago[TargetLowering] ShrinkDemandedConstant - reduce scope of TLO.DAG variable. NFCI.
Simon Pilgrim [Fri, 3 May 2019 14:38:24 +0000 (14:38 +0000)]
[TargetLowering] ShrinkDemandedConstant - reduce scope of TLO.DAG variable. NFCI.

Only ever used in one block

llvm-svn: 359890

5 years ago[X86] Remove repeated variables. NFCI.
Simon Pilgrim [Fri, 3 May 2019 14:37:00 +0000 (14:37 +0000)]
[X86] Remove repeated variables. NFCI.

llvm-svn: 359889

5 years agogn build: Merge r359878
Nico Weber [Fri, 3 May 2019 14:27:12 +0000 (14:27 +0000)]
gn build: Merge r359878

llvm-svn: 359888

5 years agoLet --discard-all imply --strip-debug.
Sid Manning [Fri, 3 May 2019 14:14:01 +0000 (14:14 +0000)]
Let --discard-all imply --strip-debug.

This will match gnu strip's behavior.

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

llvm-svn: 359887

5 years ago[X86] Add X64 common prefixes and regenerate mul i64 tests
Simon Pilgrim [Fri, 3 May 2019 14:07:38 +0000 (14:07 +0000)]
[X86] Add X64 common prefixes and regenerate mul i64 tests

Noticed while reviewing D61472

llvm-svn: 359886

5 years agoAMDGPU: Forgot to commit test file for r358890
Matt Arsenault [Fri, 3 May 2019 13:55:40 +0000 (13:55 +0000)]
AMDGPU: Forgot to commit test file for r358890

llvm-svn: 359885

5 years agoAvoid cppcheck operator precedence warnings. NFCI.
Simon Pilgrim [Fri, 3 May 2019 13:50:38 +0000 (13:50 +0000)]
Avoid cppcheck operator precedence warnings. NFCI.

Prefer ((X & Y) ? A : B) to (X & Y ? A : B)

llvm-svn: 359884

5 years agoAMDGPU: Fix incorrect commute with sub when folding immediates
Matt Arsenault [Fri, 3 May 2019 13:42:56 +0000 (13:42 +0000)]
AMDGPU: Fix incorrect commute with sub when folding immediates

When a fold of an immediate into a sub/subrev required shrinking the
instruction, the wrong VOP2 opcode was used. This was using the VOP2
equivalent of the original instruction, not the commuted instruction
with the inverted opcode.

llvm-svn: 359883

5 years agoAMDGPU: Fix test verification
Matt Arsenault [Fri, 3 May 2019 13:42:55 +0000 (13:42 +0000)]
AMDGPU: Fix test verification

This should run the verifier, and needs to enable trackRegLiveness.

llvm-svn: 359882

5 years ago[LICM] auto-generate complete test checks; NFC
Sanjay Patel [Fri, 3 May 2019 13:25:06 +0000 (13:25 +0000)]
[LICM] auto-generate complete test checks; NFC

llvm-svn: 359881

5 years ago[clangd] Fix header-guard check for include insertion, and don't index header guards.
Sam McCall [Fri, 3 May 2019 13:17:29 +0000 (13:17 +0000)]
[clangd] Fix header-guard check for include insertion, and don't index header guards.

Summary:
Both of these attempt to check whether a header guard exists while parsing the
file. However the file is only marked as guarded once clang finishes processing
it. We defer the checks and work until SymbolCollector::finish().

This is ugly and ad-hoc, deferring *all* work might be cleaner.

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, mgrang, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 359880

5 years ago[CodeGenPrepare] limit overflow intrinsic matching to a single basic block
Sanjay Patel [Fri, 3 May 2019 13:09:18 +0000 (13:09 +0000)]
[CodeGenPrepare] limit overflow intrinsic matching to a single basic block

Using/updating a dominator tree to match math overflow patterns may be very
expensive in compile-time (because of the way CGP uses a DT), so just handle
the single-block case.

Also, we were restarting the iterator loops when doing the overflow intrinsic
transforms by marking the dominator tree for update. That was done to prevent
iterating over a removed instruction. But we can postpone the deletion using
the existing "RemovedInsts" structure, and that means we don't need to update
the DT.

See post-commit thread for rL354298 for more details:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190422/646276.html

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

llvm-svn: 359879

5 years ago[Object][XCOFF] Add an XCOFF dumper for llvm-readobj.
Sean Fertile [Fri, 3 May 2019 12:57:07 +0000 (12:57 +0000)]
[Object][XCOFF] Add an XCOFF dumper for llvm-readobj.

Patch adds support for dumping of file headers with llvm-readobj. XCOFF
object files are added to test dumping a well formed file, and dumping
both negative timestamps and negative symbol counts, both of which are
allowed in the XCOFF definition.

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

llvm-svn: 359878

5 years ago[TargetLowering] expandUnalignedStore - cleanup EVT variables. NFCI.
Simon Pilgrim [Fri, 3 May 2019 12:55:25 +0000 (12:55 +0000)]
[TargetLowering] expandUnalignedStore - cleanup EVT variables. NFCI.

Avoid duplicated EVTs and rename Store/Load VTs to avoid -Wshadow warnings.

llvm-svn: 359877

5 years agoAdded an AST matcher for declarations that are in the `std` namespace
Dmitri Gribenko [Fri, 3 May 2019 12:50:00 +0000 (12:50 +0000)]
Added an AST matcher for declarations that are in the `std` namespace

Reviewers: alexfh

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 359876

5 years agoRevert "[MIR] Add simple PRE pass to MachineCSE"
Anton Afanasyev [Fri, 3 May 2019 12:36:22 +0000 (12:36 +0000)]
Revert "[MIR] Add simple PRE pass to MachineCSE"

This reverts commit 9c20156de39b377190d7a91783d61877b303fe35.
It breaks stage 2 of clang-ppc64be-linux-multistage.

llvm-svn: 359875

5 years ago[clangd] Also perform merging for symbol definitions
Kadir Cetinkaya [Fri, 3 May 2019 12:11:14 +0000 (12:11 +0000)]
[clangd] Also perform merging for symbol definitions

Summary:
clangd currently prefers declarations from codegen files. This patch
implements that behavior for definition locations. If we have definiton
locations both coming from AST and index, clangd will perform a merging to show
the codegen file if that's the case.

Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 359874

5 years ago[SelectionDAG] Use INT_MIN as (1 << 31) is UB for signed integers. NFCI.
Simon Pilgrim [Fri, 3 May 2019 11:32:00 +0000 (11:32 +0000)]
[SelectionDAG] Use INT_MIN as (1 << 31) is UB for signed integers. NFCI.

llvm-svn: 359873

5 years ago[SelectionDAG] computeKnownBits - remove some duplicate/shadow variables. NFCI.
Simon Pilgrim [Fri, 3 May 2019 11:11:03 +0000 (11:11 +0000)]
[SelectionDAG] computeKnownBits - remove some duplicate/shadow variables. NFCI.

llvm-svn: 359872

5 years ago[X86] LowerMULH - remove unused Lo/Hi vector indices. NFCI.
Simon Pilgrim [Fri, 3 May 2019 10:32:07 +0000 (10:32 +0000)]
[X86] LowerMULH - remove unused Lo/Hi vector indices. NFCI.

Leftover from before we had the extract128BitVector helpers.

llvm-svn: 359871

5 years ago[MIR] Add simple PRE pass to MachineCSE
Anton Afanasyev [Fri, 3 May 2019 10:30:59 +0000 (10:30 +0000)]
[MIR] Add simple PRE pass to MachineCSE

This is the second part of the commit fixing PR38917 (hoisting
partitially redundant machine instruction). Most of PRE (partitial
redundancy elimination) and CSE work is done on LLVM IR, but some of
redundancy arises during DAG legalization. Machine CSE is not enough
to deal with it. This simple PRE implementation works a little bit
intricately: it passes before CSE, looking for partitial redundancy
and transforming it to fully redundancy, anticipating that the next
CSE step will eliminate this created redundancy. If CSE doesn't
eliminate this, than created instruction will remain dead and eliminated
later by Remove Dead Machine Instructions pass.

The third part of the commit is supposed to refactor MachineCSE,
to make it more clear and to merge MachinePRE with MachineCSE,
so one need no rely on further Remove Dead pass to clear instrs
not eliminated by CSE.

First step: https://reviews.llvm.org/D54839

Fixes llvm.org/PR38917

Reviewers: RKSimon

Subscribers: hfinkel, llvm-commits

Tags: #llvm

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

llvm-svn: 359870

5 years agoReduce variable scope to just the if() block its actually used in. NFCI.
Simon Pilgrim [Fri, 3 May 2019 10:13:41 +0000 (10:13 +0000)]
Reduce variable scope to just the if() block its actually used in. NFCI.

llvm-svn: 359869

5 years agoC.128 override, virtual keyword handling
Raphael Isemann [Fri, 3 May 2019 10:03:28 +0000 (10:03 +0000)]
C.128 override, virtual keyword handling

Summary:
According to [C128] "Virtual functions should specify exactly one
of `virtual`, `override`, or `final`", I've added override where a
virtual function is overriden but the explicit `override` keyword
was missing. Whenever both `virtual` and `override` were specified,
I removed `virtual`. As C.128 puts it:

> [...] writing more than one of these three is both redundant and
> a potential source of errors.

I anticipate a discussion about whether or not to add `override` to
destructors but I went for it because of an example in [ISOCPP1000].
Let me repeat the comment for you here:

Consider this code:

```
    struct Base {
      virtual ~Base(){}
    };

    struct SubClass : Base {
      ~SubClass() {
        std::cout << "It works!\n";
      }
    };

    int main() {
      std::unique_ptr<Base> ptr = std::make_unique<SubClass>();
    }
```

If for some odd reason somebody removes the `virtual` keyword from the
`Base` struct, the code will no longer print `It works!`. So adding
`override` to destructors actively protects us from accidentally
breaking our code at runtime.

[C128]: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#c128-virtual-functions-should-specify-exactly-one-of-virtual-override-or-final
[ISOCPP1000]: https://github.com/isocpp/CppCoreGuidelines/issues/1000#issuecomment-476951555

Reviewers: teemperor, JDevlieghere, davide, shafik

Reviewed By: teemperor

Subscribers: kwk, arphaman, kadircet, lldb-commits

Tags: #lldb

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

llvm-svn: 359868

5 years agoSplit TestVLA into two and XFAIL one part
Pavel Labath [Fri, 3 May 2019 08:06:28 +0000 (08:06 +0000)]
Split TestVLA into two and XFAIL one part

The part which checks whether vla_expr shows up in the variable list
does not pass on non-darwin platforms. Add the appropriate decorator.

llvm-svn: 359867

5 years ago[clangd] Minor code style cleanups in Protocol.h. NFC
Ilya Biryukov [Fri, 3 May 2019 08:03:21 +0000 (08:03 +0000)]
[clangd] Minor code style cleanups in Protocol.h. NFC

- Remove a parameter name that was misspelled (OS used for non-stream
  parameter)
- Declare operator == (TextEdit, TextEdit) outside the struct, for
  consistency with other user-declared ops in our code.
- Fix naming style of a parameter.

llvm-svn: 359866

5 years agoAvoid duplicate function aliases on MinGW after SVN r359835
Martin Storsjo [Fri, 3 May 2019 07:43:23 +0000 (07:43 +0000)]
Avoid duplicate function aliases on MinGW after SVN r359835

On MinGW, the same alias mechanism as for ELF, using
__attribute__((__alias__())), is used.

llvm-svn: 359865

5 years ago[Sema][ObjC] Disable -Wunused-parameter for ObjC methods
Akira Hatanaka [Fri, 3 May 2019 07:19:46 +0000 (07:19 +0000)]
[Sema][ObjC] Disable -Wunused-parameter for ObjC methods

The warning isn't very useful when the function is an ObjC method.

rdar://problem/41561853

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

llvm-svn: 359864

5 years ago[X86] Add more one checks to masked compare patterns that were missed in r358358.
Craig Topper [Fri, 3 May 2019 07:14:05 +0000 (07:14 +0000)]
[X86] Add more one checks to masked compare patterns that were missed in r358358.

This covers the patterns we use for widening 128/256 comparisons to 512-bit when
AVX512VL isn't supported.

llvm-svn: 359863

5 years agoRevert "Initialization: move InstructionEmulation to full initialization"
Pavel Labath [Fri, 3 May 2019 07:11:43 +0000 (07:11 +0000)]
Revert "Initialization: move InstructionEmulation to full initialization"

This change is bogus. lldb-server definitely uses instruction emulation
on some architectures.

llvm-svn: 359862

5 years ago[docs] Add support for Markdown documentation when creating man pages
Igor Kudrin [Fri, 3 May 2019 05:11:48 +0000 (05:11 +0000)]
[docs] Add support for Markdown documentation when creating man pages

rL358749 added a documentation page in the Markdown format. Currently,
such pages are ignored in the configuration script for manual pages.
This patch fixes that.

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

llvm-svn: 359860

5 years agoRevert "[Attribute/Diagnostics] Print macro if definition is an attribute declaration"
Leonard Chan [Fri, 3 May 2019 03:28:06 +0000 (03:28 +0000)]
Revert "[Attribute/Diagnostics] Print macro if definition is an attribute declaration"

This reverts commit fc40cbd9d8c63e65eed3590ba925321afe782e1d.

llvm-svn: 359859

5 years agoRevert r359814 "[Sema] Emit warning for visibility attribute on internal-linkage...
Nico Weber [Fri, 3 May 2019 03:16:07 +0000 (03:16 +0000)]
Revert r359814 "[Sema] Emit warning for visibility attribute on internal-linkage declaration"

See cfe-commits thread for r359814.

llvm-svn: 359858

5 years ago[IRTranslator] Use the alloc size instead of the store size when translating allocas
Quentin Colombet [Fri, 3 May 2019 01:23:56 +0000 (01:23 +0000)]
[IRTranslator] Use the alloc size instead of the store size when translating allocas

We use to incorrectly use the store size instead of the alloc size when
creating the stack slot for allocas.
On aarch64 this can be demonstrated by allocating weirdly sized types.

For instance, in the added test case, we use an alloca for i19. We used
to allocate a slot of size 24-bit (19 rounded up to the next byte),
whereas we really want to use a full 32-bit slot for this type.

llvm-svn: 359856

5 years ago[AArch64][MC] Reject "add x0, x1, w2, lsl #1" etc.
Eli Friedman [Fri, 3 May 2019 00:59:52 +0000 (00:59 +0000)]
[AArch64][MC] Reject "add x0, x1, w2, lsl #1" etc.

Looks like just a minor oversight in the parsing code.

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

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

llvm-svn: 359855

5 years agoSemaOverload: Complete candidates before emitting the error, to ensure diagnostics...
David Blaikie [Fri, 3 May 2019 00:44:50 +0000 (00:44 +0000)]
SemaOverload: Complete candidates before emitting the error, to ensure diagnostics emitted (or suppressed) during completion don't interfere with the overload notes

Because diagnostics and their notes are not connected at the API level,
if the error message for an overload is emitted, then the overload
candidates are completed - if a diagnostic is emitted during that work,
the notes related to overload candidates would be attached to the latter
diagnostic, not the original error. Sort of worse, if the latter
diagnostic was disabled, the notes are disabled.

Reviewers: rsmith

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

llvm-svn: 359854

5 years ago[ELF] Place SHT_NOTE sections with the same alignment into one PT_NOTE
Fangrui Song [Fri, 3 May 2019 00:35:49 +0000 (00:35 +0000)]
[ELF] Place SHT_NOTE sections with the same alignment into one PT_NOTE

Summary:
While the generic ABI requires notes to be 8-byte aligned in ELF64, many
vendor-specific notes (from Linux, NetBSD, Solaris, etc) use 4-byte
alignment.

In a PT_NOTE segment, if 4-byte aligned notes are followed by an 8-byte
aligned note, the possible 4-byte padding may make consumers fail to
parse the 8-byte aligned note. See PR41000 for a recent report about
.note.gnu.property (NT_GNU_PROPERTY_TYPE_0).
(Note, for NT_GNU_PROPERTY_TYPE_0, the consumers should probably migrate
to PT_GNU_PROPERTY, but the alignment issue affects other notes as well.)

To fix the issue, don't mix notes with different alignments in one
PT_NOTE. If compilers emit 4-byte aligned notes before 8-byte aligned
notes, we'll create at most 2 segments.

sh_size%sh_addralign=0 is actually implied by the rule for linking
unrecognized sections (in generic ABI), so we don't have to check that.
Notes that match in name, type and attribute flags are concatenated into
a single output section. The compilers have to ensure
sh_size%sh_addralign=0 to make concatenated notes parsable.

An alternative approach is to create a PT_NOTE for each SHT_NOTE, but
we'll have to incur the sizeof(Elf64_Phdr)=56 overhead every time a new
note section is introduced.

Reviewers: ruiu, jakehehrlich, phosek, jhenderson, pcc, espindola

Subscribers: emaste, arichardson, krytarowski, fedor.sergeev, llvm-commits

Tags: #llvm

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

llvm-svn: 359853

5 years agoTidy up a comment, fix a typo, remove a comment that's obsolete.
Eric Christopher [Fri, 3 May 2019 00:15:23 +0000 (00:15 +0000)]
Tidy up a comment, fix a typo, remove a comment that's obsolete.

llvm-svn: 359852

5 years ago[crtbegin] Fix an off-by-1 bug in __do_fini
Fangrui Song [Fri, 3 May 2019 00:11:53 +0000 (00:11 +0000)]
[crtbegin] Fix an off-by-1 bug in __do_fini

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

llvm-svn: 359850