platform/upstream/llvm.git
5 years ago[AArch64] auto-generate complete test checks; NFC
Sanjay Patel [Wed, 29 May 2019 01:35:10 +0000 (01:35 +0000)]
[AArch64] auto-generate complete test checks; NFC

llvm-svn: 361906

5 years agoFix failure of lit test dependent-libs.cu
Yaxun Liu [Wed, 29 May 2019 01:34:44 +0000 (01:34 +0000)]
Fix failure of lit test dependent-libs.cu

llvm-svn: 361905

5 years ago[WebAssembly] Add signatures for RINT builtins
Thomas Lively [Wed, 29 May 2019 01:06:00 +0000 (01:06 +0000)]
[WebAssembly] Add signatures for RINT builtins

Reviewers: azakai, dschuff

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

Tags: #llvm

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

llvm-svn: 361904

5 years ago[Driver] Search the toolchain dir with -print-file-name
Petr Hosek [Wed, 29 May 2019 00:01:05 +0000 (00:01 +0000)]
[Driver] Search the toolchain dir with -print-file-name

This is useful when looking for directories or files relative to the
toolchain root, e.g. include/c++/v1. This change also adds a test
to make sure this functionality doesn't regress in the future.

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

llvm-svn: 361903

5 years ago[ScopBuilder] Move buildInvariantEquivalenceClasses function from ScopInfo. NFC.
Michael Kruse [Tue, 28 May 2019 23:47:55 +0000 (23:47 +0000)]
[ScopBuilder] Move buildInvariantEquivalenceClasses function from ScopInfo. NFC.

Refactor Scop and ScopBuilder class. Move
buildInvariantEquivalenceClasses function from Scop class to ScopBuilder
class.

Patch by: Dominik Adamski <adamski.dominik@gmail.com>

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

llvm-svn: 361902

5 years ago[RegUsageInfoCollector] Don't mark as saved registers that don't have subregister...
Quentin Colombet [Tue, 28 May 2019 23:43:12 +0000 (23:43 +0000)]
[RegUsageInfoCollector] Don't mark as saved registers that don't have subregister lanes

To determine the list of clobbered registers, the RegUsageInfoCollector pass
uses the list of callee saved registers provided by the target and then augments
it with the list of registers which have all their subregisters saved. It then
basically does the difference between all the registers and the saved registers
to come up with what is clobbered (plus it checks that the register is defined
within that functions).

The patch fixes a bug where when register does not have any subregister lane,
hence when checking if any of its subregister are not saved, we would find none
and think the register is saved as well.

That's obviously wrong.

The code was actually kind of checking for something like that with the
CoveredBySubRegs bit. What this bit says is that a register is completely
covered by its subregisters.
We required that this bit was set, to check that a register was saved by its
subregister lanes, since without this bit, we potentially would miss to check
some part of the register.

However, this bit is used de facto on registers that don't have any
subregisters (e.g., on ARM) and the code was not prepared for that.

This patch fixes this by checking that a register has subregisters before
declaring it saved when none of its lanes are modified.

llvm-svn: 361901

5 years ago[ORC] Track JIT symbol states more explicitly.
Lang Hames [Tue, 28 May 2019 23:35:44 +0000 (23:35 +0000)]
[ORC] Track JIT symbol states more explicitly.

Prior to this patch, JITDylibs inferred symbol states (whether a symbol was
newly added, materializing, resolved, or ready to run) via a combination of (1)
bits in the JITSymbolFlags member, and (2) the state of some internal JITDylib
data structures. This patch explicitly tracks symbol states by adding a new
SymbolState member to the symbol table entries, and removing the 'Lazy' and
'Materializing' bits from JITSymbolFlags. This is a first step towards adding
additional states representing initialization phases (e.g. eh-frame registration,
registration with the language runtime, and static initialization).

llvm-svn: 361899

5 years agoFix IPv6 support on lldb-server platform
Antonio Afonso [Tue, 28 May 2019 23:26:32 +0000 (23:26 +0000)]
Fix IPv6 support on lldb-server platform

Summary:
This is a general fix for the ConnectionFileDescriptor class but my main motivation was to make lldb-server working with IPv6.
The connect URI can use square brackets ([]) to wrap the interface part of the URI (e.g.: <scheme>://[<interface>]:<port>). For IPv6 addresses this is a must since its ip can include colons and it will overlap with the port colon otherwise. The URIParser class parses the square brackets correctly but the ConnectionFileDescriptor doesn't generate them for IPv6 addresses making it impossible to connect to the gdb server when using this protocol.

How to reproduce the issue:
```
$ lldb-server p --server --listen [::1]:8080
...
$ lldb
(lldb) platform select remote-macosx
(lldb) platform connect connect://[::1]:8080
(lldb) platform process -p <pid>
error: unable to launch a GDB server on 'computer'
```

The server was actually launched we were just not able to connect to it. With this fix lldb will correctly connect. I fixed this by wrapping the ip portion with [].

Reviewers: labath

Reviewed By: labath

Subscribers: xiaobai, mgorny, jfb, lldb-commits, labath

Tags: #lldb

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

llvm-svn: 361898

5 years ago[X86] Fix the Sema checks for getmant builtins to only allow 4 and 8 for rounding...
Craig Topper [Tue, 28 May 2019 23:26:22 +0000 (23:26 +0000)]
[X86] Fix the Sema checks for getmant builtins to only allow 4 and 8 for rounding immediates.

These don't support embedded rounding so we shouldn't be setting HasRC. That way we only
allow current direction and suppress all exceptions.

llvm-svn: 361897

5 years ago[tools] Introduce llvm-lipo
Alexander Shaposhnikov [Tue, 28 May 2019 23:22:12 +0000 (23:22 +0000)]
[tools] Introduce llvm-lipo

This diff starts the implementation of llvm-lipo
which is supposed to be a drop-in replacement for the well-known tool lipo.

Test plan: make check-all

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

llvm-svn: 361896

5 years agoFix r361893 to also update a recently-added test.
Richard Smith [Tue, 28 May 2019 23:20:52 +0000 (23:20 +0000)]
Fix r361893 to also update a recently-added test.

llvm-svn: 361895

5 years agoFix test that used raw string literals. Doesn't work in C++03
Marshall Clow [Tue, 28 May 2019 23:13:55 +0000 (23:13 +0000)]
Fix test that used raw string literals. Doesn't work in C++03

llvm-svn: 361894

5 years agoDefer creating fields for captures until we finish building the
Richard Smith [Tue, 28 May 2019 23:09:46 +0000 (23:09 +0000)]
Defer creating fields for captures until we finish building the
capturing expression or statement.

No functionality change yet. The intent is that we will also delay
building the initialization expression until the enclosing context, so
that:
a) we build the initialization expression in the right context, and
b) we can elide captures that are not odr-used, as suggested by P0588R1.

This also consolidates some duplicated code building capture fields into
a single place.

llvm-svn: 361893

5 years agoSimplify clang::Capture. No functionality change intended.
Richard Smith [Tue, 28 May 2019 23:09:45 +0000 (23:09 +0000)]
Simplify clang::Capture. No functionality change intended.

We don't need to pack flags into the bottom bits of pointers here; we
have plenty of trailing bits in this type.

llvm-svn: 361892

5 years agoIf capturing a variable fails, add a capture anyway (and mark it
Richard Smith [Tue, 28 May 2019 23:09:44 +0000 (23:09 +0000)]
If capturing a variable fails, add a capture anyway (and mark it
invalid) so that we can avoid repeated diagnostics for the same capture.

llvm-svn: 361891

5 years agoMove code to mark a variable as odr-used adjacement to all the related
Richard Smith [Tue, 28 May 2019 23:09:42 +0000 (23:09 +0000)]
Move code to mark a variable as odr-used adjacement to all the related
code.

No functional change intended.

llvm-svn: 361890

5 years agoAdd debuginfo-tests that use cdb on Windows
Reid Kleckner [Tue, 28 May 2019 23:03:33 +0000 (23:03 +0000)]
Add debuginfo-tests that use cdb on Windows

This is an initial prototype of how we can run debugger integration
tests on Windows. cdb and windbg share a command language and debugger
engine. Visual Studio has its own, but we should at least be able to use
cdb as the basis for optimized debug info integration tests.

There's a lot of work to do here still. For example:
- Make fewer assumptions about the SDK location
- Don't assume x64 (important, I need x86 testing)
- More environment isolation, have lit setup vcvars instead of passing
  LIB and INCLUDE down.
- Write a .py file to replace the grep+sed RUN line

But, this seemed like a good enough concept to commit as is, since it's
useful to me already.

Reviewers: aprantl, zturner

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

llvm-svn: 361889

5 years ago[AArch64][GlobalISel] Select FCMPSri/FCMPDri when comparing against 0.0
Jessica Paquette [Tue, 28 May 2019 22:52:49 +0000 (22:52 +0000)]
[AArch64][GlobalISel] Select FCMPSri/FCMPDri when comparing against 0.0

Add support for selecting FCMPSri and FCMPDri when comparing against 0.0, and
factor out opcode selection for G_FCMP into its own function.

Add a test to show that we don't do this with other immediates.

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

llvm-svn: 361888

5 years agoFix an incorrect 'Throws' in the regex code. Add a test for the new behavior. Reviewe...
Marshall Clow [Tue, 28 May 2019 22:42:32 +0000 (22:42 +0000)]
Fix an incorrect 'Throws' in the regex code. Add a test for the new behavior. Reviewed as https://reviews.llvm.org/D61828. Thanks to Mark for the catch and the fix.

llvm-svn: 361887

5 years ago[SymbolFileDWARF] Remove unused member (NFC)
Jonas Devlieghere [Tue, 28 May 2019 22:33:30 +0000 (22:33 +0000)]
[SymbolFileDWARF] Remove unused member (NFC)

Removes the unused debug line instance.

llvm-svn: 361886

5 years ago[Driver] Fix -working-directory issues
Michael J. Spencer [Tue, 28 May 2019 22:21:47 +0000 (22:21 +0000)]
[Driver] Fix -working-directory issues

Currently the `-working-directory` option does not actually impact the working
directory for all of the clang driver, it only impacts how files are looked up
to make sure they exist.  This means that that clang passes the wrong paths
to -fdebug-compilation-dir and -coverage-notes-file.

This patch fixes that by changing all the places in the driver where we convert
to absolute paths to use the VFS, and then calling setCurrentWorkingDirectory on
the VFS.  This also changes the default VFS for `Driver` to use a virtualized
working directory, instead of changing the process's working directory.

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

llvm-svn: 361885

5 years ago[WebAssembly] Support for atomic fences
Heejin Ahn [Tue, 28 May 2019 22:09:12 +0000 (22:09 +0000)]
[WebAssembly] Support for atomic fences

Summary:
This adds support for translation of LLVM IR fence instruction. We
convert a singlethread fence to a pseudo compiler barrier which becomes
0 instructions in final binary, and a thread fence to an idempotent
atomicrmw instruction to a memory address.

Reviewers: dschuff, jfb, sunfish, tlively

Subscribers: sbc100, jgravelle-google, llvm-commits

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

llvm-svn: 361884

5 years ago[clangd] Add SourceManager accessor to ParsedAST. NFC
Sam McCall [Tue, 28 May 2019 21:52:34 +0000 (21:52 +0000)]
[clangd] Add SourceManager accessor to ParsedAST. NFC

llvm-svn: 361883

5 years ago[PGO] Handle cases of failing to split critical edges
Rong Xu [Tue, 28 May 2019 21:45:56 +0000 (21:45 +0000)]
[PGO] Handle cases of failing to split critical edges

Fix PR41279 where critical edges to EHPad are not split.
The fix is to not instrument those critical edges. We used to be able to know
the size of counters right after MST is computed. With this, we have to
pre-collect the instrument BBs to know the size, and then instrument them.

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

llvm-svn: 361882

5 years agoRevert "[CorrelatedValuePropagation] Fix prof branch_weights metadata handling for...
Nikita Popov [Tue, 28 May 2019 21:28:24 +0000 (21:28 +0000)]
Revert "[CorrelatedValuePropagation] Fix prof branch_weights metadata handling for SwitchInst"

This reverts commit 53f2f3286572cb879b3861d7c15480e4d830dd3b.

As reported on D62126, this causes assertion failures if the switch
has incorrect branch_weights metadata, which may happen as a result
of other transforms not handling it correctly yet.

llvm-svn: 361881

5 years ago[CUDA][HIP] Emit dependent libs for host only
Yaxun Liu [Tue, 28 May 2019 21:18:59 +0000 (21:18 +0000)]
[CUDA][HIP] Emit dependent libs for host only

Recently D60274 was introduced to allow lld to handle dependent libs. However current
usage of dependent libs (e.g. pragma comment(lib, *) in windows header files) are intended
for host only. Emitting the metadata in device IR causes link error in device path.

Until there is a way to different it dependent libs for device or host, metadata for dependent
libs should be emitted for host only. This patch enforces that.

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

llvm-svn: 361880

5 years agoAMDGPU: Temporary drop s_mul_hi_i/u32 patterns
Konstantin Zhuravlyov [Tue, 28 May 2019 21:18:34 +0000 (21:18 +0000)]
AMDGPU: Temporary drop s_mul_hi_i/u32 patterns

It introduces performance regressions in several applications.

This has already been submitted downstream.

llvm-svn: 361879

5 years ago[clang] Handle lrint/llrint builtins
Adhemerval Zanella [Tue, 28 May 2019 21:16:04 +0000 (21:16 +0000)]
[clang] Handle lrint/llrint builtins

As for other floating-point rounding builtins that can be optimized
when build with -fno-math-errno, this patch adds support for lrint
and llrint.  It currently only optimize for AArch64 backend.

Reviewed By: craig.topper

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

llvm-svn: 361878

5 years ago[AArch64] Handle ISD::LRINT and ISD::LLRINT
Adhemerval Zanella [Tue, 28 May 2019 21:04:29 +0000 (21:04 +0000)]
[AArch64] Handle ISD::LRINT and ISD::LLRINT

This patch optimizes ISD::LRINT and ISD::LLRINT to frintx plus
fcvtzs. It currently only handles the scalar version.

Reviewed By: SjoerdMeijer, mstorsjo

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

llvm-svn: 361877

5 years agoRevert r361842 as it breaks LLDB :: tools/lldb-mi/exec/exec-finish.test
Alexandre Ganea [Tue, 28 May 2019 20:57:56 +0000 (20:57 +0000)]
Revert r361842 as it breaks LLDB :: tools/lldb-mi/exec/exec-finish.test

llvm-svn: 361876

5 years ago[CodeGen] Add lrint/llrint builtins
Adhemerval Zanella [Tue, 28 May 2019 20:47:44 +0000 (20:47 +0000)]
[CodeGen] Add lrint/llrint builtins

This patch add the ISD::LRINT and ISD::LLRINT along with new
intrinsics.  The changes are straightforward as for other
floating-point rounding functions, with just some adjustments
required to handle the return value being an interger.

The idea is to optimize lrint/llrint generation for AArch64
in a subsequent patch.  Current semantic is just route it to libm
symbol.

Reviewed By: craig.topper

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

llvm-svn: 361875

5 years ago[DAGCombine] (x - C) - y -> (x - y) - C fold. Try 2
Roman Lebedev [Tue, 28 May 2019 20:40:10 +0000 (20:40 +0000)]
[DAGCombine] (x - C) - y  ->  (x - y) - C  fold. Try 2

Summary:
Again only vectors affected. Frustrating. Let me take a look into that..

https://rise4fun.com/Alive/AAq

This is a recommit, originally committed in rL361856, but reverted
to investigate test-suite compile-time hangs.

Reviewers: RKSimon, craig.topper, spatel

Reviewed By: RKSimon

Subscribers: javed.absar, JDevlieghere, llvm-commits

Tags: #llvm

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

llvm-svn: 361874

5 years ago[DAGCombine][X86][AArch64][AMDGPU] (x - y) + -1 -> add (xor y, -1), x fold. Try 2
Roman Lebedev [Tue, 28 May 2019 20:40:03 +0000 (20:40 +0000)]
[DAGCombine][X86][AArch64][AMDGPU] (x - y) + -1  ->  add (xor y, -1), x  fold. Try 2

Summary:
This prevents regressions in next patch,
and somewhat recovers from the regression to AMDGPU test in D62223.

It is indeed not great that we leave vector decrement,
don't transform it into vector add all-ones..

https://rise4fun.com/Alive/ZRl

This is a recommit, originally committed in rL361855, but reverted
to investigate test-suite compile-time hangs.

Reviewers: RKSimon, craig.topper, spatel, arsenm

Reviewed By: RKSimon, arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, javed.absar, dstuttard, tpr, t-tye, kristof.beyls, llvm-commits

Tags: #llvm

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

llvm-svn: 361873

5 years ago[DAGCombiner][X86][AArch64][SPARC][SystemZ] y - (x + C) -> (y - x) - C fold. Try 2
Roman Lebedev [Tue, 28 May 2019 20:39:55 +0000 (20:39 +0000)]
[DAGCombiner][X86][AArch64][SPARC][SystemZ] y - (x + C)  ->  (y - x) - C  fold. Try 2

Summary:
Direct sibling of D62223 patch.
While i don't have a direct motivational pattern for this,
it would seem to make sense to handle both patterns (or none),
for symmetry?

The aarch64 changes look neutral;
sparc and systemz look like improvement (one less instruction each);
x86 changes - 32bit case improves, 64bit case shows that LEA no longer
gets constructed, which may be because that whole test is `-mattr=+slow-lea,+slow-3ops-lea`

https://rise4fun.com/Alive/ffh

This is a recommit, originally committed in rL361853, but reverted
to investigate test-suite compile-time hangs.

Reviewers: RKSimon, craig.topper, spatel, t.p.northover

Reviewed By: t.p.northover

Subscribers: t.p.northover, jyknight, javed.absar, kristof.beyls, fedor.sergeev, jrtc27, llvm-commits

Tags: #llvm

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

llvm-svn: 361872

5 years ago[DAGCombiner][X86][AArch64][AMDGPU] (x + C) - y -> (x - y) + C fold. Try 2
Roman Lebedev [Tue, 28 May 2019 20:39:39 +0000 (20:39 +0000)]
[DAGCombiner][X86][AArch64][AMDGPU] (x + C) - y  ->  (x - y) + C  fold. Try 2

Summary:
The main motivation is shown by all these `neg` instructions that are now created.
In particular, the `@reg32_lshr_by_negated_unfolded_sub_b` test.

AArch64 test changes all look good (`neg` created), or neutral.

X86 changes look neutral (vectors), or good (`neg` / `xor eax, eax` created).

I'm not sure about `X86/ragreedy-hoist-spill.ll`, it looks like the spill
is now hoisted into preheader (which should still be good?),
2 4-byte reloads become 1 8-byte reload, and are elsewhere,
but i'm not sure how that affects that loop.

I'm unable to interpret AMDGPU change, looks neutral-ish?

This is hopefully a step towards solving [[ https://bugs.llvm.org/show_bug.cgi?id=41952 | PR41952 ]].

https://rise4fun.com/Alive/pkdq (we are missing more patterns, i'll submit them later)

This is a recommit, originally committed in rL361852, but reverted
to investigate test-suite compile-time hangs.

Reviewers: craig.topper, RKSimon, spatel, arsenm

Reviewed By: RKSimon

Subscribers: bjope, qcolombet, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, javed.absar, dstuttard, tpr, t-tye, kristof.beyls, llvm-commits

Tags: #llvm

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

llvm-svn: 361871

5 years agoFix GDB pretty printer for Optional after r354246
David Blaikie [Tue, 28 May 2019 20:22:16 +0000 (20:22 +0000)]
Fix GDB pretty printer for Optional after r354246

llvm-svn: 361870

5 years agoChange ELF tools to allow multiple sections per file.
Peter Collingbourne [Tue, 28 May 2019 20:01:25 +0000 (20:01 +0000)]
Change ELF tools to allow multiple sections per file.

This is how multi-partition combined output files are going to look. If we
see multiple sections, the tools will just read the first one.

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

llvm-svn: 361869

5 years ago[AMDGPU] Correct the handling of inlineasm output registers.
Michael Liao [Tue, 28 May 2019 19:37:09 +0000 (19:37 +0000)]
[AMDGPU] Correct the handling of inlineasm output registers.

Summary:
- There's a regression due to the cross-block RC assignment. Use the
  proper way to derive the output register RC in inline asm.

Reviewers: rampitec, alex-t

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

Tags: #llvm

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

llvm-svn: 361868

5 years ago[OpenMP] Set pragma start loc to `#pragma` loc
Joel E. Denny [Tue, 28 May 2019 19:27:19 +0000 (19:27 +0000)]
[OpenMP] Set pragma start loc to `#pragma` loc

This patch adjusts `PragmaOpenMPHandler` to set the location of
`tok::annot_pragma_openmp` to the `#pragma` location instead of the
`omp` location so that the former becomes the start location of the
OpenMP AST node.  This can be useful when, for example, rewriting a
directive using Clang's Rewrite facility.  Most of this patch updates
tests for changes to locations in diagnostics and `-ast-dump` output.

Reviewed By: ABataev, lebedev.ri, Meinersbur, aaron.ballman

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

llvm-svn: 361867

5 years ago[compiler-rt] Fix cmake warnings
Shoaib Meenai [Tue, 28 May 2019 19:09:17 +0000 (19:09 +0000)]
[compiler-rt] Fix cmake warnings

 - Fix cmake BOOL misspellings
 - Set cmake policy for CMP0075 to NEW

As requested by smeenai I've compared CMAkeCache.txt in master with and
without this patch and the only changes are to the variable types I fixed:

     $ diff build-b1-master/CMakeCache.txt build-b1-compiler-rt-fix-cmake-warnings/CMakeCache.txt
     503c503
     < COMPILER_RT_BAREMETAL_BUILD:STRING=OFF
     ---
     > COMPILER_RT_BAREMETAL_BUILD:BOOL=OFF
     550c550
     < COMPILER_RT_HWASAN_WITH_INTERCEPTORS:STRING=ON
     ---
     > COMPILER_RT_HWASAN_WITH_INTERCEPTORS:BOOL=ON

Patch by Wink Saville <wink@saville.com>.

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

llvm-svn: 361866

5 years agoRevert DAGCombine "hoist binop with const" folds
Roman Lebedev [Tue, 28 May 2019 19:04:21 +0000 (19:04 +0000)]
Revert DAGCombine "hoist binop with const" folds

Appear to introduce test-suite compile-time hang.

http://lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/22825

This reverts r361852,r361853,r361854,r361855,r361856

llvm-svn: 361865

5 years ago[InstCombine] Add tests for signed saturating always overflow; NFC
Nikita Popov [Tue, 28 May 2019 18:59:28 +0000 (18:59 +0000)]
[InstCombine] Add tests for signed saturating always overflow; NFC

llvm-svn: 361864

5 years ago[InstCombine] Clean up saturing math overflow optimizations; NFC
Nikita Popov [Tue, 28 May 2019 18:59:21 +0000 (18:59 +0000)]
[InstCombine] Clean up saturing math overflow optimizations; NFC

Reduce duplication and make it easier to handle signed
always-overflows conditions in the future.

llvm-svn: 361863

5 years agoFix 'warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else...
Alexandre Ganea [Tue, 28 May 2019 18:36:35 +0000 (18:36 +0000)]
Fix 'warning: suggest explicit braces to avoid ambiguous â€˜else’ [-Wdangling-else]' with GCC 7.3

See: https://github.com/google/googletest/issues/1119
llvm-svn: 361862

5 years agoFix 'warning: format specifies type 'int' but the argument has type 'MIuint' (aka...
Alexandre Ganea [Tue, 28 May 2019 18:36:11 +0000 (18:36 +0000)]
Fix 'warning: format specifies type 'int' but the argument has type 'MIuint' (aka 'unsigned long long') [-Wformat]' with Clang 8.0

llvm-svn: 361861

5 years ago[NFC][MIPS] Autogenerater madd-msub.ll test
Roman Lebedev [Tue, 28 May 2019 18:31:36 +0000 (18:31 +0000)]
[NFC][MIPS] Autogenerater madd-msub.ll test

Being affected by upcoming patch

llvm-svn: 361860

5 years agoDriver: support `/Zc:char8_t` and `/Zc:char8_t-`
Saleem Abdulrasool [Tue, 28 May 2019 18:26:00 +0000 (18:26 +0000)]
Driver: support `/Zc:char8_t` and `/Zc:char8_t-`

Update the `cl` emulation to support the `/Zc:char8_t[-]?` options as per the
MSVC 2019.1 toolset.  These are aliases for `-fchar8_t` and `-fno-char8_t`.

llvm-svn: 361859

5 years ago[ValueTracking][ConstantRange] Distinguish low/high always overflow
Nikita Popov [Tue, 28 May 2019 18:08:31 +0000 (18:08 +0000)]
[ValueTracking][ConstantRange] Distinguish low/high always overflow

In order to fold an always overflowing signed saturating add/sub,
we need to know in which direction the always overflow occurs.
This patch splits up AlwaysOverflows into AlwaysOverflowsLow and
AlwaysOverflowsHigh to pass through this information (but it is
not used yet).

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

llvm-svn: 361858

5 years ago[IR] Add SaturatingInst and BinaryOpIntrinsic classes
Nikita Popov [Tue, 28 May 2019 18:08:06 +0000 (18:08 +0000)]
[IR] Add SaturatingInst and BinaryOpIntrinsic classes

Based on the suggestion in D62447, this adds a SaturatingInst class
that represents the saturating add/sub family of intrinsics. It
exposes the same interface as WithOverflowInst, for this reason I
have also added a common base class BinaryOpIntrinsic that holds the
actual implementation code and will be useful in some places handling
both overflowing and saturating math.

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

llvm-svn: 361857

5 years ago[DAGCombine] (x - C) - y -> (x - y) - C fold
Roman Lebedev [Tue, 28 May 2019 17:54:21 +0000 (17:54 +0000)]
[DAGCombine] (x - C) - y  ->  (x - y) - C  fold

Summary:
Again only vectors affected. Frustrating. Let me take a look into that..

https://rise4fun.com/Alive/AAq

Reviewers: RKSimon, craig.topper, spatel

Reviewed By: RKSimon

Subscribers: javed.absar, JDevlieghere, llvm-commits

Tags: #llvm

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

llvm-svn: 361856

5 years ago[DAGCombine][X86][AArch64][AMDGPU] (x - y) + -1 -> add (xor y, -1), x fold
Roman Lebedev [Tue, 28 May 2019 17:54:13 +0000 (17:54 +0000)]
[DAGCombine][X86][AArch64][AMDGPU] (x - y) + -1  ->  add (xor y, -1), x  fold

Summary:
This prevents regressions in next patch,
and somewhat recovers from the regression to AMDGPU test in D62223.

It is indeed not great that we leave vector decrement,
don't transform it into vector add all-ones..

https://rise4fun.com/Alive/ZRl

Reviewers: RKSimon, craig.topper, spatel, arsenm

Reviewed By: RKSimon, arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, javed.absar, dstuttard, tpr, t-tye, kristof.beyls, llvm-commits

Tags: #llvm

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

llvm-svn: 361855

5 years ago[DAGCombiner][X86][AArch64] (x - C) + y -> (x + y) - C fold
Roman Lebedev [Tue, 28 May 2019 17:54:04 +0000 (17:54 +0000)]
[DAGCombiner][X86][AArch64] (x - C) + y  ->  (x + y) - C  fold

Summary:
Only vector tests are being affected here,
since subtraction by scalar constant is rewritten
as addition by negated constant.

No surprising test changes.

https://rise4fun.com/Alive/pbT

Reviewers: RKSimon, craig.topper, spatel

Reviewed By: RKSimon

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

Tags: #llvm

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

llvm-svn: 361854

5 years ago[DAGCombiner][X86][AArch64][SPARC][SystemZ] y - (x + C) -> (y - x) - C fold
Roman Lebedev [Tue, 28 May 2019 17:53:54 +0000 (17:53 +0000)]
[DAGCombiner][X86][AArch64][SPARC][SystemZ] y - (x + C)  ->  (y - x) - C  fold

Summary:
Direct sibling of D62223 patch.
While i don't have a direct motivational pattern for this,
it would seem to make sense to handle both patterns (or none),
for symmetry?

The aarch64 changes look neutral;
sparc and systemz look like improvement (one less instruction each);
x86 changes - 32bit case improves, 64bit case shows that LEA no longer
gets constructed, which may be because that whole test is `-mattr=+slow-lea,+slow-3ops-lea`

https://rise4fun.com/Alive/ffh

Reviewers: RKSimon, craig.topper, spatel, t.p.northover

Reviewed By: t.p.northover

Subscribers: t.p.northover, jyknight, javed.absar, kristof.beyls, fedor.sergeev, jrtc27, llvm-commits

Tags: #llvm

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

llvm-svn: 361853

5 years ago[DAGCombiner][X86][AArch64][AMDGPU] (x + C) - y -> (x - y) + C fold
Roman Lebedev [Tue, 28 May 2019 17:53:43 +0000 (17:53 +0000)]
[DAGCombiner][X86][AArch64][AMDGPU] (x + C) - y  ->  (x - y) + C  fold

Summary:
The main motivation is shown by all these `neg` instructions that are now created.
In particular, the `@reg32_lshr_by_negated_unfolded_sub_b` test.

AArch64 test changes all look good (`neg` created), or neutral.

X86 changes look neutral (vectors), or good (`neg` / `xor eax, eax` created).

I'm not sure about `X86/ragreedy-hoist-spill.ll`, it looks like the spill
is now hoisted into preheader (which should still be good?),
2 4-byte reloads become 1 8-byte reload, and are elsewhere,
but i'm not sure how that affects that loop.

I'm unable to interpret AMDGPU change, looks neutral-ish?

This is hopefully a step towards solving [[ https://bugs.llvm.org/show_bug.cgi?id=41952 | PR41952 ]].

https://rise4fun.com/Alive/pkdq (we are missing more patterns, i'll submit them later)

Reviewers: craig.topper, RKSimon, spatel, arsenm

Reviewed By: RKSimon

Subscribers: bjope, qcolombet, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, javed.absar, dstuttard, tpr, t-tye, kristof.beyls, llvm-commits

Tags: #llvm

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

llvm-svn: 361852

5 years ago[COFF] Add ImportChunkThunk, simplify, deduplicate
Reid Kleckner [Tue, 28 May 2019 17:38:04 +0000 (17:38 +0000)]
[COFF] Add ImportChunkThunk, simplify, deduplicate

Removes the isHotPatchable faux-virtual and virtual methods.  Follow-up to
D62362.

Reviewers: aganea

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

llvm-svn: 361851

5 years agoRevert "[x86] split 256-bit store of concatenated vectors"
Sanjay Patel [Tue, 28 May 2019 17:37:58 +0000 (17:37 +0000)]
Revert "[x86] split 256-bit store of concatenated vectors"

This reverts commit d5a8637072f4c556b88156bd2f6237a2ead47d31.

Most likely suspect for this bot failure:
http://lab.llvm.org:8011/builders/clang-cmake-x86_64-avx2-linux/builds/9684

llvm-svn: 361850

5 years ago[DWARFExpression] Remove ctor that takes just a compile unit.
Jonas Devlieghere [Tue, 28 May 2019 17:34:05 +0000 (17:34 +0000)]
[DWARFExpression] Remove ctor that takes just a compile unit.

Like many of our DWARF classes, the DWARFExpression can be initialized
in several ways. One such way was through a constructor that takes just
the compile unit. This constructor is used to initialize both empty
DWARFExpressions, and DWARFExpression that will be populated later.

To make the distinction more clear, I changed the constructor to a
default constructor and updated its call sites. Where the
DWARFExpression was being populated later, I replaced that with a call
to the copy assignment constructor.

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

llvm-svn: 361849

5 years agoAMDGPU: Don't enable all lanes with non-CSR VGPR spills
Matt Arsenault [Tue, 28 May 2019 16:46:02 +0000 (16:46 +0000)]
AMDGPU: Don't enable all lanes with non-CSR VGPR spills

If the only VGPRs used for SGPR spilling were not CSRs, this was
enabling all laness and immediately restoring exec. This is the usual
situation in leaf functions.

llvm-svn: 361848

5 years ago[AMDGPU] Fix the mis-handling of `vreg_1` copied from scalar register.
Michael Liao [Tue, 28 May 2019 16:29:39 +0000 (16:29 +0000)]
[AMDGPU] Fix the mis-handling of `vreg_1` copied from scalar register.

Summary:
- Don't treat the use of a scalar register as `vreg_1` an VGPR usage.
  Otherwise, that promotes that scalar register into vector one, which
  breaks the assumption that scalar register holds the lane mask.
- The issue is triggered in a complicated case, where if the uses of
  that (lane mask) scalar register is legalized firstly before its
  definition, e.g., due to the mismatch block placement and its
  topological order or loop. In that cases, the legalization of PHI
  introduces the use of that scalar register as `vreg_1`.

Reviewers: rampitec, nhaehnle, arsenm, alex-t

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

Tags: #llvm

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

llvm-svn: 361847

5 years ago[clangd] Fix test output for r361841
Ilya Biryukov [Tue, 28 May 2019 16:28:27 +0000 (16:28 +0000)]
[clangd] Fix test output for r361841

llvm-svn: 361846

5 years ago[ARM] Replace fp-only-sp and d16 with fp64 and d32.
Simon Tatham [Tue, 28 May 2019 16:13:20 +0000 (16:13 +0000)]
[ARM] Replace fp-only-sp and d16 with fp64 and d32.

Those two subtarget features were awkward because their semantics are
reversed: each one indicates the _lack_ of support for something in
the architecture, rather than the presence. As a consequence, you
don't get the behavior you want if you combine two sets of feature
bits.

Each SubtargetFeature for an FP architecture version now comes in four
versions, one for each combination of those options. So you can still
say (for example) '+vfp2' in a feature string and it will mean what
it's always meant, but there's a new string '+vfp2d16sp' meaning the
version without those extra options.

A lot of this change is just mechanically replacing positive checks
for the old features with negative checks for the new ones. But one
more interesting change is that I've rearranged getFPUFeatures() so
that the main FPU feature is appended to the output list *before*
rather than after the features derived from the Restriction field, so
that -fp64 and -d32 can override defaults added by the main feature.

Reviewers: dmgreen, samparker, SjoerdMeijer

Subscribers: srhines, javed.absar, eraman, kristof.beyls, hiraditya, zzheng, Petar.Avramovic, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 361845

5 years ago[AArch64] Delete unused VariantKind in AArch64MCExpr
Fangrui Song [Tue, 28 May 2019 16:11:56 +0000 (16:11 +0000)]
[AArch64] Delete unused VariantKind in AArch64MCExpr

llvm-svn: 361844

5 years ago[X86-64] Fix 256-bit SET0 lowering for non-VLX targets
David Greene [Tue, 28 May 2019 15:37:01 +0000 (15:37 +0000)]
[X86-64] Fix 256-bit SET0 lowering for non-VLX targets

If we don't have VLX then 256-bit SET0 should be lowered
to VPXOR with ZMM registers.  This restores functionality
accidentally removed by r309926.

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

llvm-svn: 361843

5 years ago[LLD][COFF] Early load PDB type server files
Alexandre Ganea [Tue, 28 May 2019 15:35:23 +0000 (15:35 +0000)]
[LLD][COFF] Early load PDB type server files

We need to have all input files ready before doing debuginfo type merging.
This patch is moving the late PDB type server discovery much earlier in the process, when the explicit inputs (OBJs, LIBs) are loaded.
The short term goal is to parallelize type merging.

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

llvm-svn: 361842

5 years ago[clangd] Place cursor better after completing patterns
Ilya Biryukov [Tue, 28 May 2019 15:33:37 +0000 (15:33 +0000)]
[clangd] Place cursor better after completing patterns

Summary:
By producing the $0 marker in the snippets at the last placeholder.
This produces nicer results in most cases, e.g. for
   namespace <#name#> {
     <#decls#>
   }

we now produce ${0:decls} instead of ${2:decls} and the final cursor
placement is more convenient.

Reviewers: hokein

Reviewed By: hokein

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

Tags: #clang

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

llvm-svn: 361841

5 years agoFix 'warning: comparison is always true due to limited range of data type [-Wtype...
Alexandre Ganea [Tue, 28 May 2019 15:32:11 +0000 (15:32 +0000)]
Fix 'warning: comparison is always true due to limited range of data type [-Wtype-limits]' with GCC 7.3

llvm-svn: 361840

5 years agollvm-undname: Support demangling char8_t
Nico Weber [Tue, 28 May 2019 15:30:04 +0000 (15:30 +0000)]
llvm-undname: Support demangling char8_t

Ports clang's mangling support added in r354633 to llvm-undname.

llvm-svn: 361839

5 years ago[CodeComplete] Set preferred type for qualified-id
Ilya Biryukov [Tue, 28 May 2019 15:21:03 +0000 (15:21 +0000)]
[CodeComplete] Set preferred type for qualified-id

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 361838

5 years agoRevert r361826, as it still breaks LLDB.
Alexandre Ganea [Tue, 28 May 2019 15:04:39 +0000 (15:04 +0000)]
Revert r361826, as it still breaks LLDB.

llvm-svn: 361837

5 years agollvm-undname: Add support for local static thread guards
Nico Weber [Tue, 28 May 2019 14:54:49 +0000 (14:54 +0000)]
llvm-undname: Add support for local static thread guards

llvm-svn: 361835

5 years ago[clang-tidy] Fix description for misc-definitions-in-headers.
Haojian Wu [Tue, 28 May 2019 14:50:42 +0000 (14:50 +0000)]
[clang-tidy] Fix description for misc-definitions-in-headers.

Reviewers: gribozavr

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 361834

5 years ago[clang-tidy] Verify fix description for misc-unused-using-decl.
Haojian Wu [Tue, 28 May 2019 14:47:39 +0000 (14:47 +0000)]
[clang-tidy] Verify fix description for misc-unused-using-decl.

Reviewers: gribozavr

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 361833

5 years ago[XCOFF] Implement parsing symbol table for xcoffobjfile and output as yaml format
Jason Liu [Tue, 28 May 2019 14:37:59 +0000 (14:37 +0000)]
[XCOFF] Implement parsing symbol table for xcoffobjfile and output as yaml format

Summary:
This patch implement parsing symbol table for xcoffobjfile and
output as yaml format. Parsing auxiliary entries of a symbol
will be in a separate patch.

The XCOFF object file (aix_xcoff.o) used in the test comes from
-bash-4.2$ cat test.c
extern int i;
extern int TestforXcoff;
int main()
{
i++;
TestforXcoff--;
}

Patch by DiggerLin

Reviewers: sfertile, hubert.reinterpretcast, MaskRay, daltenty

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

llvm-svn: 361832

5 years agoRevert 361827. It broke the bots.
Kevin P. Neal [Tue, 28 May 2019 14:37:45 +0000 (14:37 +0000)]
Revert 361827. It broke the bots.

llvm-svn: 361831

5 years agoReland D61583 [ELF] Error on relocations to STT_SECTION symbols if the sections were...
Fangrui Song [Tue, 28 May 2019 14:34:28 +0000 (14:34 +0000)]
Reland D61583 [ELF] Error on relocations to STT_SECTION symbols if the sections were discarded

This is implemented by creating Undefined (instead of Defined) for such
local STT_SECTION symbols. It allows us to catch errors when there are
relocations to such discarded sections (e.g. in PR41693, ld.bfd and gold
error but we don't). Updated comdat-discarded-error.s checks we emit
friendly error message.

For relocatable-eh-frame.s, ld.lld -r a.o a.o will now error
"STT_SECTION symbol should be defined" because the section .eh_frame
refers to is now an Undefined instead of a Defined.
So I have to change `error()` to `warn()` to retain the output.

rLLD361144 inadvertently enabled the error for --gdb-index
(in LLDDwarfObj<ELFT>::findAux()).

Relocations from .debug_info (not in comdat) to .text.* (in comdat) for
DW_AT_low_pc are common. If an .text.* was discarded, rLLD361144 would error,
which was unexpected. (Note, if we don't error as this patch does,
InputSection::relocateNonAlloc() will resolve such relocations).

llvm-svn: 361830

5 years ago[CodeComplete] Consistently break after '{' in multi-line patterns
Ilya Biryukov [Tue, 28 May 2019 14:33:16 +0000 (14:33 +0000)]
[CodeComplete] Consistently break after '{' in multi-line patterns

Summary:
Completion can return multi-line patterns in some cases, e.g.

    for (<#init#>; <#cond#>; <#inc#>) {
    <#body#>
    }

However, most patterns break the line only before closing brace,
resulting in code like:

    namespace <#name#> { <#decls#>
    }

While some (e.g. the 'for' example above) are breaking lines after the
opening brace too.

This change ensures all patterns consistently break after the opening
brace, this leads to nicer UX when using those in an actual editor.

Reviewers: gribozavr

Reviewed By: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 361829

5 years agogn build: make clangd depend on clang resource headers
Ilya Biryukov [Tue, 28 May 2019 14:23:00 +0000 (14:23 +0000)]
gn build: make clangd depend on clang resource headers

Summary:
clangd needs them to function properly, even though they are not
strictly required for the build.

Reviewers: thakis

Reviewed By: thakis

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

Tags: #llvm

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

llvm-svn: 361828

5 years agoAdd constrained intrinsic tests for powerpc64 and powerpc64le.
Kevin P. Neal [Tue, 28 May 2019 14:17:48 +0000 (14:17 +0000)]
Add constrained intrinsic tests for powerpc64 and powerpc64le.

Submitted by: Drew Wock
Reviewed by: Hal Finkel
Approved by: Hal Finkel
Differential Revision: https://reviews.llvm.org/D62388

llvm-svn: 361827

5 years ago[CMake] Default options for faster executables on MSVC
Alexandre Ganea [Tue, 28 May 2019 14:14:48 +0000 (14:14 +0000)]
[CMake] Default options for faster executables on MSVC

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

llvm-svn: 361826

5 years ago[openmp] [test] Skip kernel-breaking tests on NetBSD
Michal Gorny [Tue, 28 May 2019 14:10:47 +0000 (14:10 +0000)]
[openmp] [test] Skip kernel-breaking tests on NetBSD

The omp_taskloop_num_tasks and omp_taskwait have deadlooped
on the NetBSD buildbot previously, practically hanging the host running
it.  Disable them until we can find a good solution, or make the kernel
less fragile.

llvm-svn: 361825

5 years agoAdd release note entries for recent typo correction changes
Nico Weber [Tue, 28 May 2019 14:04:48 +0000 (14:04 +0000)]
Add release note entries for recent typo correction changes

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

llvm-svn: 361824

5 years ago[clangd] Compute expected type for templates
Ilya Biryukov [Tue, 28 May 2019 13:56:21 +0000 (13:56 +0000)]
[clangd] Compute expected type for templates

Reviewers: sammccall

Reviewed By: sammccall

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

Tags: #clang

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

llvm-svn: 361823

5 years ago[x86] split 256-bit store of concatenated vectors
Sanjay Patel [Tue, 28 May 2019 13:54:17 +0000 (13:54 +0000)]
[x86] split 256-bit store of concatenated vectors

This shows up as a side issue to the main problem for the AVX target example from PR37428:
https://bugs.llvm.org/show_bug.cgi?id=37428 - https://godbolt.org/z/7tpRa3

But as we can see in the pile of existing test diffs, it's actually a widespread problem
that affects any AVX or later target. Apart from a couple of oddballs, I think these are
all improvements for the reasons stated in the code comment: we do not want to enable YMM
unnecessarily (avoid vzeroupper and frequency throttling) and some cores split 256-bit
stores anyway.

We could say that MergeConsecutiveStores() is going overboard on some of these examples,
but that won't solve the problem completely. But that is the reason I'm proposing this as
a lowering rather than a combine: we will infinite loop fighting the merge code if we try
this earlier.

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

llvm-svn: 361822

5 years ago[DAG] LegalizeVectorTypes - reduce scope of local variables. NFCI.
Simon Pilgrim [Tue, 28 May 2019 13:46:26 +0000 (13:46 +0000)]
[DAG] LegalizeVectorTypes - reduce scope of local variables. NFCI.

Move the element index/count variables into the block where they are actually used - appeases cppcheck and helps avoid shadow variable warnings.

llvm-svn: 361821

5 years agoStop undef fragments from closing non-overlapping fragments
David Stenberg [Tue, 28 May 2019 13:23:25 +0000 (13:23 +0000)]
Stop undef fragments from closing non-overlapping fragments

Summary:
When DwarfDebug::buildLocationList() encountered an undef debug value,
it would truncate all open values, regardless if they were overlapping or
not. This patch fixes so that it only does that for overlapping fragments.

This change unearthed a bug that I had introduced in D57511,
which I have fixed in this patch. The code in DebugHandlerBase that
changes labels for parameter debug values could break DwarfDebug's
assumption that the labels for the entries in the debug value history
are monotonically increasing. Before this patch, that bug could result
in location list entries whose ending address was lower than the
beginning address, and with the changes for undef debug values that this
patch introduces it could trigger an assertion, due to attempting to
emit location list entries with empty ranges. A reproducer for the bug
is added in param-reg-const-mix.mir.

Reviewers: aprantl, jmorse, probinson

Reviewed By: aprantl

Subscribers: javed.absar, llvm-commits

Tags: #debug-info, #llvm

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

llvm-svn: 361820

5 years agoMIR: Fix printer crashing on dead CSR frame indexes
Matt Arsenault [Tue, 28 May 2019 13:08:31 +0000 (13:08 +0000)]
MIR: Fix printer crashing on dead CSR frame indexes

llvm-svn: 361819

5 years ago[Analyzer] Replace `CXXSelfAssignmentBRVisitor` with `NoteTags`
Adam Balogh [Tue, 28 May 2019 13:07:09 +0000 (13:07 +0000)]
[Analyzer] Replace `CXXSelfAssignmentBRVisitor` with `NoteTags`

The `cplusplus.SelfAssignment` checker has a visitor that is added
to every `BugReport` to mark the to branch of the self assignment
operator with e.g. `rhs == *this` and `rhs != *this`. With the new
`NoteTag` feature this visitor is not needed anymore. Instead the
checker itself marks the two branches using the `NoteTag`s.

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

llvm-svn: 361818

5 years agoFollow up of r361810: test case fix attempt for Windows builder
Sjoerd Meijer [Tue, 28 May 2019 13:04:47 +0000 (13:04 +0000)]
Follow up of r361810: test case fix attempt for Windows builder

llvm-svn: 361817

5 years ago[IRBuilder] Add CreateUnOp(...) to the IRBuilder to support unary FNeg
Cameron McInally [Tue, 28 May 2019 13:00:52 +0000 (13:00 +0000)]
[IRBuilder] Add CreateUnOp(...) to the IRBuilder to support unary FNeg

Also update UnaryOperator to support isa, cast, and dyn_cast.

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

llvm-svn: 361816

5 years ago[x86] fix 256-bit vector store splitting to honor 'volatile'
Sanjay Patel [Tue, 28 May 2019 12:58:07 +0000 (12:58 +0000)]
[x86] fix 256-bit vector store splitting to honor 'volatile'

Forking this out of the discussion in D62498
(and assuming that will be committed later, so adding the helper function here).
The LangRef says:
"the backend should never split or merge target-legal volatile load/store instructions."

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

llvm-svn: 361815

5 years ago[X86] Custom lower CONCAT_VECTORS of v2i1
Benjamin Kramer [Tue, 28 May 2019 12:52:57 +0000 (12:52 +0000)]
[X86] Custom lower CONCAT_VECTORS of v2i1

The generic legalizer cannot handle this. Add an assert instead of
silently miscompiling vectors with elements smaller than 8 bits.

llvm-svn: 361814

5 years ago[NFC] Test commit, delete trailing whitespace
Graham Hunter [Tue, 28 May 2019 12:36:39 +0000 (12:36 +0000)]
[NFC] Test commit, delete trailing whitespace

llvm-svn: 361813

5 years agoCleanups for r361807 that I somehow failed to commit
Hans Wennborg [Tue, 28 May 2019 12:30:35 +0000 (12:30 +0000)]
Cleanups for r361807 that I somehow failed to commit

llvm-svn: 361812

5 years agoRe-commit r357452 (take 2): "SimplifyCFG SinkCommonCodeFromPredecessors: Also sink...
Hans Wennborg [Tue, 28 May 2019 12:19:38 +0000 (12:19 +0000)]
Re-commit r357452 (take 2): "SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)"

This was reverted in r360086 as it was supected of causing mysterious test
failures internally. However, it was never concluded that this patch was the
root cause.

> The code was previously checking that candidates for sinking had exactly
> one use or were a store instruction (which can't have uses). This meant
> we could sink call instructions only if they had a use.
>
> That limitation seemed a bit arbitrary, so this patch changes it to
> "instruction has zero or one use" which seems more natural and removes
> the need to special-case stores.
>
> Differential revision: https://reviews.llvm.org/D59936

llvm-svn: 361811

5 years ago[ARM] Use CHECK-NEXT in CodeGen/ARM/O3-pipeline.ll. NFC.
Sjoerd Meijer [Tue, 28 May 2019 12:06:26 +0000 (12:06 +0000)]
[ARM] Use CHECK-NEXT in CodeGen/ARM/O3-pipeline.ll. NFC.

Use CHECK-NEXT, like in other pipeline tests, so that we actually
notice when the pipeline is changed.

llvm-svn: 361810

5 years ago[clang-tidy] Fix null pointer dereference in readability-identifier-naming
Haojian Wu [Tue, 28 May 2019 11:54:01 +0000 (11:54 +0000)]
[clang-tidy] Fix null pointer dereference in readability-identifier-naming

Summary:
readability-identifier-naming causes a null pointer dereference when checking an identifier introduced by a structured binding whose right hand side is an undeclared identifier.

Running the check on a file that is just the following results in a crash:
```
auto [left] = right;
```

Patch by Mark Stegeman!

Reviewers: alexfh, hokein, aaron.ballman, JonasToth

Reviewed By: hokein, aaron.ballman

Subscribers: madsravn, xazax.hun, cfe-commits

Tags: #clang-tools-extra, #clang

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

llvm-svn: 361809

5 years ago[CorrelatedValuePropagation] Fix prof branch_weights metadata handling for SwitchInst
Yevgeny Rouban [Tue, 28 May 2019 11:33:50 +0000 (11:33 +0000)]
[CorrelatedValuePropagation] Fix prof branch_weights metadata handling for SwitchInst

This patch fixes the CorrelatedValuePropagation pass to keep
prof branch_weights metadata of SwitchInst consistent.
It makes use of SwitchInstProfUpdateWrapper.
New tests are added.

Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D62126

llvm-svn: 361808

5 years agoFix some llvm-readelf tests after r361633
Hans Wennborg [Tue, 28 May 2019 11:24:20 +0000 (11:24 +0000)]
Fix some llvm-readelf tests after r361633

They were failing on 32-bit Windows. In the cases where I've changed
test expectations, I've checked that they match the output of GNU
readelf.

llvm-svn: 361807

5 years agoRevert [ELF] Error on relocations to STT_SECTION symbols if the sections were discarded
Haojian Wu [Tue, 28 May 2019 11:21:59 +0000 (11:21 +0000)]
Revert [ELF] Error on relocations to STT_SECTION symbols if the sections were discarded

This reverts r361792 (git commit cfca5095df0209c60109696d6cc368d49e2c5939), the
revision causes link errors internally, will share more details with the
author.

llvm-svn: 361806

5 years ago[SLPVectorizer][X86] Add broadcast test case from D62427
Simon Pilgrim [Tue, 28 May 2019 11:10:56 +0000 (11:10 +0000)]
[SLPVectorizer][X86] Add broadcast test case from D62427

llvm-svn: 361805