platform/upstream/llvm.git
5 years ago[X86] More aggressive shuffle mask widening in combineExtractWithShuffle
Simon Pilgrim [Sat, 12 Jan 2019 16:38:56 +0000 (16:38 +0000)]
[X86] More aggressive shuffle mask widening in combineExtractWithShuffle

Use demanded extract index to set most of the shuffle mask to undef, making it easier to widen and peek through.

llvm-svn: 351013

5 years agoImplement TemplateArgument dumping in terms of Visitor
Stephen Kelly [Sat, 12 Jan 2019 16:35:37 +0000 (16:35 +0000)]
Implement TemplateArgument dumping in terms of Visitor

Summary: Split the output streaming from the traversal to other AST nodes.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 351012

5 years ago[ASTDump] Change parameter to StringRef
Stephen Kelly [Sat, 12 Jan 2019 15:45:05 +0000 (15:45 +0000)]
[ASTDump] Change parameter to StringRef

llvm-svn: 351011

5 years ago[LoopVectorizer] give more advice in remark about failure to vectorize call
Sanjay Patel [Sat, 12 Jan 2019 15:27:15 +0000 (15:27 +0000)]
[LoopVectorizer] give more advice in remark about failure to vectorize call

Something like this is requested by:
https://bugs.llvm.org/show_bug.cgi?id=40265
...and it seems like a common enough case that we should acknowledge it.

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

llvm-svn: 351010

5 years ago[Algorithm] Add make_const_ref corresponding to make_const_ptr
Stephen Kelly [Sat, 12 Jan 2019 15:23:30 +0000 (15:23 +0000)]
[Algorithm] Add make_const_ref corresponding to make_const_ptr

Reviewers: aaron.ballman

Subscribers: dexonsmith, kristina, llvm-commits

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

llvm-svn: 351009

5 years ago[DAGCombiner] fold insert_subvector of insert_subvector
Sanjay Patel [Sat, 12 Jan 2019 15:12:28 +0000 (15:12 +0000)]
[DAGCombiner] fold insert_subvector of insert_subvector

This pattern:

    t33: v8i32 = insert_subvector undef:v8i32, t35, Constant:i64<0>
  t21: v16i32 = insert_subvector undef:v16i32, t33, Constant:i64<0>

...shows up in PR33758:
https://bugs.llvm.org/show_bug.cgi?id=33758
...although this patch doesn't make any difference to the final result on that yet.

In the affected tests here, it looks like it just makes RA wiggle. But we might
as well squash this to prevent it interfering with other pattern-matching.

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

llvm-svn: 351008

5 years ago[analyzer] Fix unused variable warnings in Release builds
Benjamin Kramer [Sat, 12 Jan 2019 12:43:53 +0000 (12:43 +0000)]
[analyzer] Fix unused variable warnings in Release builds

This was just an inlined version of isa<CXXConstructExpr>. NFC.

llvm-svn: 351007

5 years ago[llvm-objdump] - Change the output for --all-headers.
George Rimar [Sat, 12 Jan 2019 12:17:24 +0000 (12:17 +0000)]
[llvm-objdump] - Change the output for --all-headers.

This is for https://bugs.llvm.org/show_bug.cgi?id=40008,

it starts printing the file headers when --all-headers is given and
do a minor cosmetic change.

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

llvm-svn: 351006

5 years agoUse getShiftAmountTy for shift amounts.
Simon Pilgrim [Sat, 12 Jan 2019 12:00:43 +0000 (12:00 +0000)]
Use getShiftAmountTy for shift amounts.

llvm-svn: 351005

5 years agogn build: Unbreak Windows build
Nico Weber [Sat, 12 Jan 2019 11:56:47 +0000 (11:56 +0000)]
gn build: Unbreak Windows build

I didn't break all that much during upstreaming, just needs two small fixes:

- fix spelling of MCJITTests.def file
- make libLTO a shared_library to put it in bin/ on Windows where it is in the
  CMake build too

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

llvm-svn: 351004

5 years ago[X86] Add more usub.sat vector tests; NFC
Nikita Popov [Sat, 12 Jan 2019 11:43:04 +0000 (11:43 +0000)]
[X86] Add more usub.sat vector tests; NFC

Add additional vXi32 and vXi64 tests.

llvm-svn: 351003

5 years ago[NetBSD] Enable additional sanitizer types
Michal Gorny [Sat, 12 Jan 2019 11:18:35 +0000 (11:18 +0000)]
[NetBSD] Enable additional sanitizer types

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

llvm-svn: 351002

5 years ago[ORC][MIPS] Fill delay-slot after `jr` instruction
Simon Atanasyan [Sat, 12 Jan 2019 11:12:08 +0000 (11:12 +0000)]
[ORC][MIPS] Fill delay-slot after `jr` instruction

MIPS `jr` instruction uses a delay-slot. To escape execution of
arbitrary instruction we should either fill the delay-slot by `nop`
instruction or swap `jr` instruction and logically preceding
instruction. This fix implements the second method to generate a bit
more effective code.

llvm-svn: 351001

5 years ago[ORC][MIPS] Setup t9 register and call function through this register
Simon Atanasyan [Sat, 12 Jan 2019 11:12:04 +0000 (11:12 +0000)]
[ORC][MIPS] Setup t9 register and call function through this register

MIPS ABI states that every function must be called through jalr $t9. In
other words, a function expect that t9 register points to the beginning
of its code. A function uses this register to calculate offset to the
Global Offset Table and save it to the `gp` register.
```
lui   $gp, %hi(_gp_disp)
addiu $gp, %lo(_gp_disp)
addu  $gp, $gp, $t9
```

If `t9` and as a result `$gp` point to the wrong place the following code
loads incorrect value from GOT and passes control to invalid code.
```
lw    $v0,%call16(foo)($gp)
jalr  $t9
```

OrcMips32 and OrcMips64 writeResolverCode methods pass control to the
resolved address, but do not setup `$t9` before the call. The `t9` holds
value of the beginning of `resolver` code so any attempts to call
routines via GOT failed.

This change fixes the problem. The `OrcLazy/hidden-visibility.ll` test
starts to pass correctly. Before the change it fails on MIPS because the
`exitOnLazyCallThroughFailure` called from the resolver code could not
call libc routine `exit` via GOT.

Differential Revision: http://reviews.llvm.org/D56058

llvm-svn: 351000

5 years ago[X86] Improve vXi64 ISD::ABS codegen with SSE41+
Simon Pilgrim [Sat, 12 Jan 2019 10:28:12 +0000 (10:28 +0000)]
[X86] Improve vXi64 ISD::ABS codegen with SSE41+

Make use of vblendvpd to select on the signbit

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

llvm-svn: 350999

5 years ago[X86][AARCH64] Improve ISD::ABS support
Simon Pilgrim [Sat, 12 Jan 2019 09:59:32 +0000 (09:59 +0000)]
[X86][AARCH64] Improve ISD::ABS support

This patch takes some of the code from D49837 to allow us to enable ISD::ABS support for all SSE vector types.

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

llvm-svn: 350998

5 years agoReapply "[DemandedBits] Use SetVector for Worklist"
Nikita Popov [Sat, 12 Jan 2019 09:09:15 +0000 (09:09 +0000)]
Reapply "[DemandedBits] Use SetVector for Worklist"

DemandedBits currently uses a simple vector for the worklist, which
means that instructions may be inserted multiple times into it.
Especially in combination with the deep lattice, this may cause
instructions too be recomputed very often. To avoid this, switch
to a SetVector.

Reapplying with a smaller number of inline elements in the
SmallSetVector, to avoid running into the SmallDenseMap issue
described in D56455.

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

llvm-svn: 350997

5 years ago[llvm-objcopy] [COFF] Remove pointless Reader/Writer base classes. NFC.
Martin Storsjo [Sat, 12 Jan 2019 08:30:09 +0000 (08:30 +0000)]
[llvm-objcopy] [COFF] Remove pointless Reader/Writer base classes. NFC.

These were copied as part of the original design from the ELF
backend, but aren't necessary at the moment.

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

llvm-svn: 350996

5 years ago[X86] Remove X86ISD::SELECT as its no longer used by any of our intrinsic lowering.
Craig Topper [Sat, 12 Jan 2019 08:15:54 +0000 (08:15 +0000)]
[X86] Remove X86ISD::SELECT as its no longer used by any of our intrinsic lowering.

llvm-svn: 350995

5 years ago[X86] Add ISD node for masked version of CVTPS2PH.
Craig Topper [Sat, 12 Jan 2019 08:05:12 +0000 (08:05 +0000)]
[X86] Add ISD node for masked version of CVTPS2PH.

The 128-bit input produces 64-bits of output and fills the upper 64-bits with 0. The mask only applies to the lower elements. But we can't represent this with a vselect like we normally do.

This also avoids the need to have a special X86ISD::SELECT when avx512bw isn't enabled since vselect v8i16 isn't legal there.

Fixes another instruction for PR34877.

llvm-svn: 350994

5 years ago[RISCV] Introduce codegen patterns for RV64M-only instructions
Alex Bradbury [Sat, 12 Jan 2019 07:43:06 +0000 (07:43 +0000)]
[RISCV] Introduce codegen patterns for RV64M-only instructions

As discussed on llvm-dev
<http://lists.llvm.org/pipermail/llvm-dev/2018-December/128497.html>, we have
to be careful when trying to select the *w RV64M instructions. i32 is not a
legal type for RV64 in the RISC-V backend, so operations have been promoted by
the time they reach instruction selection. Information about whether the
operation was originally a 32-bit operations has been lost, and it's easy to
write incorrect patterns.

Similarly to the variable 32-bit shifts, a DAG combine on ANY_EXTEND will
produce a SIGN_EXTEND if this is likely to result in sdiv/udiv/urem being
selected (and so save instructions to sext/zext the input operands).

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

llvm-svn: 350993

5 years ago[RISCV] Add patterns for RV64I SLLW/SRLW/SRAW instructions
Alex Bradbury [Sat, 12 Jan 2019 07:32:31 +0000 (07:32 +0000)]
[RISCV] Add patterns for RV64I SLLW/SRLW/SRAW instructions

This restores support for selecting the SLLW/SRLW/SRAW instructions, which was
removed in rL348067 as the previous patterns made some unsafe assumptions.
Also see the related llvm-dev discussion
<http://lists.llvm.org/pipermail/llvm-dev/2018-December/128497.html>

Ultimately I didn't introduce a custom SelectionDAG node, but instead added a
DAG combine that inserts an AssertZext i5 on the shift amount for an i32
variable-length shift and also added an ANY_EXTEND DAG-combine which will
instead produce a SIGN_EXTEND for an i32 variable-length shift, increasing the
opportunity to safely select SLLW/SRLW/SRAW.

There are obviously different ways of addressing this (a number discussed in
the llvm-dev thread), so I'd welcome further feedback and comments.

Note that there are now some cases in
test/CodeGen/RISCV/rv64i-exhaustive-w-insts.ll where sraw/srlw/sllw is
selected even though sra/srl/sll could be used without any extra instructions.
Given both are semantically equivalent, there doesn't seem a good reason to
prefer one vs the other. Given that would require more logic to still select
sra/srl/sll in those cases, I've left it preferring the *w variants.

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

llvm-svn: 350992

5 years ago[X86] Remove unnecessary code from getMaskNode.
Craig Topper [Sat, 12 Jan 2019 06:13:44 +0000 (06:13 +0000)]
[X86] Remove unnecessary code from getMaskNode.

We no longer need to extend mask scalars before bitcasting them to vXi1. This was only needed for the truncate intrinsics. And was really a bug in our lowering of them.

llvm-svn: 350991

5 years agoAdd SymbolFileBreakpad.
Jason Molenda [Sat, 12 Jan 2019 03:17:39 +0000 (03:17 +0000)]
Add SymbolFileBreakpad.

llvm-svn: 350990

5 years ago[X86] When lowering v1i1/v2i1/v4i1/v8i1 load/store with avx512f, but not avx512dq...
Craig Topper [Sat, 12 Jan 2019 02:22:10 +0000 (02:22 +0000)]
[X86] When lowering v1i1/v2i1/v4i1/v8i1 load/store with avx512f, but not avx512dq, use v16i1 as the intermediate mask type instead of v8i1.

We still use i8 for the load/store type. So we need to convert to/from i16 to around the mask type.

By doing this we get an i8->i16 extload which we can then pattern match to a KMOVW if the access is aligned.

llvm-svn: 350989

5 years ago[X86] Change some patterns that select MOVZX16rm8 to instead select MOVZX32rm8 and...
Craig Topper [Sat, 12 Jan 2019 02:22:06 +0000 (02:22 +0000)]
[X86] Change some patterns that select MOVZX16rm8 to instead select MOVZX32rm8 and extract the subregister.

This should be a shorter encoding and is consistent with what we do for zext i8->i16

llvm-svn: 350988

5 years ago[ARM] Fix typo
Evandro Menezes [Sat, 12 Jan 2019 01:06:43 +0000 (01:06 +0000)]
[ARM] Fix typo

Fix typo in r350952.

llvm-svn: 350986

5 years ago[X86] Add ISD nodes for masked truncate so we can properly represent when the output...
Craig Topper [Sat, 12 Jan 2019 00:55:27 +0000 (00:55 +0000)]
[X86] Add ISD nodes for masked truncate so we can properly represent when the output has more elements than the input due to needing to be 128 bits.

We can't properly represent this with a vselect since the upper elements of the result are supposed to be zeroed regardless of the mask.

This also reuses the new nodes even when the result type fits in 128 bits if the input is q/d and the result is w/b since vselect w/b using k-register condition isn't legal without avx512bw. Currently we're doing this even when avx512bw is enabled, but I might change that.

This fixes some of PR34877

llvm-svn: 350985

5 years agoNFC: Port loop to cxx_range_for
Stephen Kelly [Sat, 12 Jan 2019 00:42:59 +0000 (00:42 +0000)]
NFC: Port loop to cxx_range_for

llvm-svn: 350984

5 years ago[sanitizer] Move android's GetPageSize to a header (NFC)
Evgeniy Stepanov [Sat, 12 Jan 2019 00:09:24 +0000 (00:09 +0000)]
[sanitizer] Move android's GetPageSize to a header (NFC)

No need to pay function call overhead for a function that returns a
constant.

llvm-svn: 350983

5 years ago[analyzer] Support for OSObjects out parameters in RetainCountChecker
George Karpenkov [Fri, 11 Jan 2019 23:35:17 +0000 (23:35 +0000)]
[analyzer] Support for OSObjects out parameters in RetainCountChecker

rdar://46357478
rdar://47121327

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

llvm-svn: 350982

5 years ago[analyzer] Introduce a convenience method for getting a CallEvent from an arbitrary...
George Karpenkov [Fri, 11 Jan 2019 23:35:04 +0000 (23:35 +0000)]
[analyzer] Introduce a convenience method for getting a CallEvent from an arbitrary Stmt

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

llvm-svn: 350981

5 years agosanitizer_common: Change gen_dynamic_list.py to take a -o argument instead of writing...
Peter Collingbourne [Fri, 11 Jan 2019 23:30:24 +0000 (23:30 +0000)]
sanitizer_common: Change gen_dynamic_list.py to take a -o argument instead of writing to stdout.

This makes the script a little more gn friendly; gn does not support
redirecting the output of a script.

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

llvm-svn: 350980

5 years agogn build: Add a stage2 toolchain for Android.
Peter Collingbourne [Fri, 11 Jan 2019 23:18:51 +0000 (23:18 +0000)]
gn build: Add a stage2 toolchain for Android.

This makes it possible to build llvm-symbolizer for Android, which
is one of the prerequisites for running the sanitizer tests on Android.

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

llvm-svn: 350979

5 years ago[lldbsuite] Skip TestExitDuringStep on Windows
Stella Stamenova [Fri, 11 Jan 2019 23:08:35 +0000 (23:08 +0000)]
[lldbsuite] Skip TestExitDuringStep on Windows

This test is flaky on Windows and will occasionally hang or fail.

llvm-svn: 350978

5 years agogn build: Create a template for unix toolchains.
Peter Collingbourne [Fri, 11 Jan 2019 22:57:57 +0000 (22:57 +0000)]
gn build: Create a template for unix toolchains.

Also change the toolchain description to use current_os instead of
host_os so that the template can be used for cross builds, and add
a current_os to the win toolchain to match the unix toolchain.

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

llvm-svn: 350977

5 years ago[AArch64] Improve Exynos predicates
Evandro Menezes [Fri, 11 Jan 2019 22:39:47 +0000 (22:39 +0000)]
[AArch64] Improve Exynos predicates

Expand the predicate using shifted arithmetic and logic instructions to also
consider the respective not shifted instructions.

llvm-svn: 350976

5 years agoAdd a release note about MSP430 support.
Rui Ueyama [Fri, 11 Jan 2019 22:31:35 +0000 (22:31 +0000)]
Add a release note about MSP430 support.

llvm-svn: 350975

5 years agogn build: Merge r350958.
Peter Collingbourne [Fri, 11 Jan 2019 22:15:53 +0000 (22:15 +0000)]
gn build: Merge r350958.

llvm-svn: 350974

5 years ago[CMake] Fix standalone build after LLVM exports utility targets
Stefan Granitz [Fri, 11 Jan 2019 21:59:58 +0000 (21:59 +0000)]
[CMake] Fix standalone build after LLVM exports utility targets

LLVM started exporting targets for utilites with https://reviews.llvm.org/rL350959, which broke compiler-rt standalone builds because it was used to define FileCheck manually.
Changed this, so FileCheck gets imported now.

llvm-svn: 350973

5 years agoChange from a to a . Fixes PR#39871.
Marshall Clow [Fri, 11 Jan 2019 21:57:12 +0000 (21:57 +0000)]
Change  from a  to a . Fixes PR#39871.

llvm-svn: 350972

5 years ago[ConstantFolding] Fold undef for integer intrinsics
Nikita Popov [Fri, 11 Jan 2019 21:18:00 +0000 (21:18 +0000)]
[ConstantFolding] Fold undef for integer intrinsics

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

This implements handling of undef operands for integer intrinsics in
ConstantFolding, in particular for the bitcounting intrinsics (ctpop,
cttz, ctlz), the with.overflow intrinsics, the saturating math
intrinsics and the funnel shift intrinsics.

The undef behavior follows what InstSimplify does for the general cas
e of non-constant operands. For the bitcount intrinsics (where
InstSimplify doesn't do undef handling -- there cannot be a combination
of an undef + non-constant operand) I'm using a 0 result if the intrinsic
is defined for zero and undef otherwise.

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

llvm-svn: 350971

5 years ago[Darwin][Driver] Don't pass a file as object_path_lto during ThinLTO
Steven Wu [Fri, 11 Jan 2019 21:16:04 +0000 (21:16 +0000)]
[Darwin][Driver] Don't pass a file as object_path_lto during ThinLTO

Summary:
After r327851, Driver::GetTemporaryPath will create the file rather than
just create a potientially unqine filename. If clang driver pass the
file as parameter as -object_path_lto, ld64 will pass it back to libLTO
as GeneratedObjectsDirectory, which is going to cause a LLVM ERROR if it
is not a directory.
Now during thinLTO, pass a temp directory path to linker instread.

rdar://problem/47194182

Reviewers: arphaman, dexonsmith

Reviewed By: arphaman

Subscribers: mehdi_amini, inglorion, jkorous, cfe-commits

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

llvm-svn: 350970

5 years ago[SLP]Moved NVPTX test under NVPTX directory, NFC.
Alexey Bataev [Fri, 11 Jan 2019 20:42:48 +0000 (20:42 +0000)]
[SLP]Moved NVPTX test under NVPTX directory, NFC.

llvm-svn: 350969

5 years agoFix unchecked Error introduced in r350956
Alexandre Ganea [Fri, 11 Jan 2019 20:39:38 +0000 (20:39 +0000)]
Fix unchecked Error introduced in r350956

llvm-svn: 350968

5 years ago[SLP]Update test checks for the SPL vectorizer, NFC.
Alexey Bataev [Fri, 11 Jan 2019 20:21:14 +0000 (20:21 +0000)]
[SLP]Update test checks for the SPL vectorizer, NFC.

llvm-svn: 350967

5 years ago[X86] Fix incomplete handling of register-assigned variables in parsing.
Nirav Dave [Fri, 11 Jan 2019 20:17:36 +0000 (20:17 +0000)]
[X86] Fix incomplete handling of register-assigned variables in parsing.

Teach x86 assembly operand parsing to distinguish between assembler
variable assigned to named registers and those assigned to immediate
values.

Reviewers: rnk, nickdesaulniers, void

Subscribers: hiraditya, jyknight, llvm-commits

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

llvm-svn: 350966

5 years ago[Sanitizer] Disable getusershell interception for Android
David Carlier [Fri, 11 Jan 2019 20:09:24 +0000 (20:09 +0000)]
[Sanitizer] Disable getusershell interception for Android

Reviewers: vitalybuka, pcc, eugenis

Reviewed By: eugenis

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

llvm-svn: 350965

5 years agogn build: Create a variable for the host toolchain and start using it in the tblgen...
Peter Collingbourne [Fri, 11 Jan 2019 19:53:06 +0000 (19:53 +0000)]
gn build: Create a variable for the host toolchain and start using it in the tblgen template.

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

llvm-svn: 350964

5 years agogn build: s/root_out_dir/root_build_dir/g in llvm/utils/gn/build/write_cmake_config...
Peter Collingbourne [Fri, 11 Jan 2019 19:51:49 +0000 (19:51 +0000)]
gn build: s/root_out_dir/root_build_dir/g in llvm/utils/gn/build/write_cmake_config.gni.

This makes the generated files go to the right place when using a non-default toolchain.

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

llvm-svn: 350963

5 years ago[RISCV][NFC] Add CHECK lines for atomic operations on RV64I
Alex Bradbury [Fri, 11 Jan 2019 19:46:48 +0000 (19:46 +0000)]
[RISCV][NFC] Add CHECK lines for atomic operations on RV64I

As or RV32I, we include these for completeness. Committing now to make it
easier to review the RV64A patch.

llvm-svn: 350962

5 years ago[llvm-mca] Update tests for Exynos (NFC)
Evandro Menezes [Fri, 11 Jan 2019 19:36:27 +0000 (19:36 +0000)]
[llvm-mca] Update tests for Exynos (NFC)

Update test cases for Exynos M4.

llvm-svn: 350961

5 years ago[AArch64] Add pipeline model for Exynos M4
Evandro Menezes [Fri, 11 Jan 2019 19:36:25 +0000 (19:36 +0000)]
[AArch64] Add pipeline model for Exynos M4

Add the scheduling and cost model for Exynos M4.

llvm-svn: 350960

5 years ago[CMake] Export utility targets to the build/install tree depending on LLVM_BUILD...
Stefan Granitz [Fri, 11 Jan 2019 19:34:34 +0000 (19:34 +0000)]
[CMake] Export utility targets to the build/install tree depending on LLVM_BUILD/INSTALL_UTILS

Summary:
Allow external projects to import test-related targets like FileCheck, count, not etc. and query binary paths, properties, etc.
This would be useful for LLDB, because it reduces the difference between in-tree vs. standalone builds and simplifies CMake logic.

Reviewers: chapuni, gottesmm, beanz

Reviewed By: beanz

Subscribers: mgorny, lldb-commits, llvm-commits, #lldb

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

llvm-svn: 350959

5 years agoImplement Attr dumping in terms of visitors
Stephen Kelly [Fri, 11 Jan 2019 19:16:01 +0000 (19:16 +0000)]
Implement Attr dumping in terms of visitors

Remove now-vestigial dumpType and dumpBareDeclRef methods. The old
tablegen generated code used to expect them to be present, but the new
generated code has no such requirement.

Reviewers: aaron.ballman

Subscribers: mgorny, cfe-commits

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

llvm-svn: 350958

5 years ago[ASTDump] Add utility for dumping a label with child nodes
Stephen Kelly [Fri, 11 Jan 2019 19:11:17 +0000 (19:11 +0000)]
[ASTDump] Add utility for dumping a label with child nodes

Summary:
Use it to add optional label nodes to Stmt dumps.  This preserves
behavior of InitExprList dump:

// CHECK-NEXT: `-InitListExpr {{.+}} <col:13, col:15> 'U [3]'
// CHECK-NEXT:   |-array_filler: InitListExpr {{.+}} <col:15> 'U' field Field {{.+}} 'i' 'int'
// CHECK-NEXT:   `-InitListExpr {{.+}} <col:14> 'U' field Field {{.+}} 'i' 'int'
// CHECK-NEXT:     `-IntegerLiteral {{.+}} <col:14> 'int' 1

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 350957

5 years ago[LLD][COFF] Support /ignore:4099. Support /ignore with comma-separated arguments.
Alexandre Ganea [Fri, 11 Jan 2019 19:10:01 +0000 (19:10 +0000)]
[LLD][COFF] Support /ignore:4099. Support /ignore with comma-separated arguments.

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

llvm-svn: 350956

5 years ago[Bug 39548][Clang] PGO bootstrap fails with python3: errors in perf-helper.py
Serge Guelton [Fri, 11 Jan 2019 19:04:48 +0000 (19:04 +0000)]
[Bug 39548][Clang] PGO bootstrap fails with python3: errors in perf-helper.py

Current clang fail to bootstrap in PGO mode when only python3 is available,
because perf-helper.py is not compatible with python3.

Commited on behalf of  Romain Geissler.

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

llvm-svn: 350955

5 years ago[test] Update support for Exynos M4 (NFC)
Evandro Menezes [Fri, 11 Jan 2019 18:54:41 +0000 (18:54 +0000)]
[test] Update support for Exynos M4 (NFC)

Update test cases for Exynos M4.

llvm-svn: 350954

5 years ago[AArch64] Create feature set for Exynos M4
Evandro Menezes [Fri, 11 Jan 2019 18:54:25 +0000 (18:54 +0000)]
[AArch64] Create feature set for Exynos M4

Complete the feature set for Exynos M4 and update test cases.

llvm-svn: 350953

5 years ago[MergeFunc] Update clang test for r350939
Vedant Kumar [Fri, 11 Jan 2019 18:51:02 +0000 (18:51 +0000)]
[MergeFunc] Update clang test for r350939

In r350939, the MergeFunc pass learned to erase duplicate functions
which are discardable if unused.

llvm-svn: 350952

5 years ago[Legalizer] Use correct ValueType of SELECT_CC node during Float promotion
Pirama Arumuga Nainar [Fri, 11 Jan 2019 18:46:02 +0000 (18:46 +0000)]
[Legalizer] Use correct ValueType of SELECT_CC node during Float promotion

Summary:
When legalizing the result of a SELECT_CC node by promoting the
floating-point type, use the promoted-to type rather than the original
type.

Fix PR40273.

Reviewers: efriedma, majnemer

Subscribers: llvm-commits

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

llvm-svn: 350951

5 years agoFix build breaks after the ParseCompileUnit changes.
Zachary Turner [Fri, 11 Jan 2019 18:35:58 +0000 (18:35 +0000)]
Fix build breaks after the ParseCompileUnit changes.

The addition of SymbolFileBreakpad crossed paths with my change,
so this interface needs to be fixed up as well.

llvm-svn: 350950

5 years ago[LTO] Add option to enable LTOUnit splitting, and disable unless needed
Teresa Johnson [Fri, 11 Jan 2019 18:32:07 +0000 (18:32 +0000)]
[LTO] Add option to enable LTOUnit splitting, and disable unless needed

Summary:
Adds a new -f[no]split-lto-unit flag that is disabled by default to
control module splitting during ThinLTO. It is automatically enabled
for -fsanitize=cfi and -fwhole-program-vtables.

The new EnableSplitLTOUnit codegen flag is passed down to llvm
via a new module flag of the same name.

Depends on D53890.

Reviewers: pcc

Subscribers: ormris, mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, cfe-commits, llvm-commits

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

llvm-svn: 350949

5 years ago[LTO] Record whether LTOUnit splitting is enabled in index
Teresa Johnson [Fri, 11 Jan 2019 18:31:57 +0000 (18:31 +0000)]
[LTO] Record whether LTOUnit splitting is enabled in index

Summary:
Records in the module summary index whether the bitcode was compiled
with the option necessary to enable splitting the LTO unit
(e.g. -fsanitize=cfi, -fwhole-program-vtables, or -fsplit-lto-unit).

The information is passed down to the ModuleSummaryIndex builder via a
new module flag "EnableSplitLTOUnit", which is propagated onto a flag
on the summary index.

This is then used during the LTO link to check whether all linked
summaries were built with the same value of this flag. If not, an error
is issued when we detect a situation requiring whole program visibility
of the class hierarchy. This is the case when both of the following
conditions are met:
1) We are performing LowerTypeTests or Whole Program Devirtualization.
2) There are type tests or type checked loads in the code.

Note I have also changed the ThinLTOBitcodeWriter to also gate the
module splitting on the value of this flag.

Reviewers: pcc

Subscribers: ormris, mehdi_amini, Prazek, inglorion, eraman, steven_wu, dexonsmith, arphaman, dang, llvm-commits

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

llvm-svn: 350948

5 years agoAttempt to fix PDB tests broken by r350924
Pavel Labath [Fri, 11 Jan 2019 18:24:17 +0000 (18:24 +0000)]
Attempt to fix PDB tests broken by r350924

The patch added the symbol plugin name to the lldb-test output. Update
the tests to account for that.

llvm-svn: 350947

5 years ago[analyzer] [NFC] Fix the FIXME in tests
George Karpenkov [Fri, 11 Jan 2019 18:12:49 +0000 (18:12 +0000)]
[analyzer] [NFC] Fix the FIXME in tests

llvm-svn: 350946

5 years ago[CMake] Include tests by default also in standalone builds
Stefan Granitz [Fri, 11 Jan 2019 18:11:04 +0000 (18:11 +0000)]
[CMake] Include tests by default also in standalone builds

In-tree builds include tests by default. Standalone builds should behave the same.

llvm-svn: 350945

5 years ago[llvm-objcopy][NFC] Consistenly use two dashes for flags in tests.
Jordan Rupprecht [Fri, 11 Jan 2019 18:06:31 +0000 (18:06 +0000)]
[llvm-objcopy][NFC] Consistenly use two dashes for flags in tests.

Summary:
As pointed out in D53667, our use of hyphens in flags can be inconsistent, mixing `-` with `--`. This change makes all long style flags use `--`.

Automatically changed via:

```
find test/tools/llvm-objcopy/ELF -type f | xargs sed -i 's/ -\([a-zA-Z]\{3\}\)/ --\1/g'
```

Two false positives were manually fixed/reverted.

Reviewers: jhenderson, espindola, alexshap

Reviewed By: jhenderson

Subscribers: emaste, javed.absar, arichardson, fedor.sergeev, jakehehrlich, llvm-commits

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

llvm-svn: 350944

5 years ago[SymbolFile] Make ParseCompileUnitXXX accept a CompileUnit&.
Zachary Turner [Fri, 11 Jan 2019 18:03:20 +0000 (18:03 +0000)]
[SymbolFile] Make ParseCompileUnitXXX accept a CompileUnit&.

Previously all of these functions accepted a SymbolContext&.
While a CompileUnit is one member of a SymbolContext, there
are also many others, and by passing such a monolithic parameter
in this way it makes the requirements and assumptions of the
API unclear for both callers as well as implementors.

All these methods need is a CompileUnit.  By limiting the
parameter type in this way, we simplify the code as well as
make it self-documenting for both implementers and users.

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

llvm-svn: 350943

5 years ago[attributes] Extend os_returns_(not_?)_retained attributes to parameters
George Karpenkov [Fri, 11 Jan 2019 18:02:08 +0000 (18:02 +0000)]
[attributes] Extend os_returns_(not_?)_retained attributes to parameters

When applied to out-parameters, the attributes specify the expected lifetime of the written-into object.

Additionally, introduce OSReturnsRetainedOn(Non)Zero attributes, which
specify that an ownership transfer happens depending on a return code.

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

llvm-svn: 350942

5 years agoFix a pair of Wfallthrough warnings in ScanfFormatString.
Erich Keane [Fri, 11 Jan 2019 18:01:40 +0000 (18:01 +0000)]
Fix a pair of Wfallthrough warnings in ScanfFormatString.

Change-Id: Ia73a34fdd93fc974224583505f9e6432493cb0da
llvm-svn: 350941

5 years agoProvide storage for `true_type::value` and `false_type::value`.
Dan Liew [Fri, 11 Jan 2019 17:59:52 +0000 (17:59 +0000)]
Provide storage for `true_type::value` and `false_type::value`.

Summary:
This fixes linker errors that occurs when the
`sanitizer_type_traits_test.cc` is built without optimizations.

The error occurs because the test tries to take a reference.
A possible workaround is to give the GTest macros take boolean rvalues
by doing something like:

```
ASSERT_TRUE(bool(is_same<uptr, uptr>::value));
```

However this only hides the problem. Unfortunately Using `constexpr`
won't fix the problem unless we are using C++17.

Reviewers: vitalybuka, kubamracek, george.karpenkov, yln

Subscribers: mgorny, #sanitizers, llvm-commits

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

llvm-svn: 350940

5 years ago[MergeFunc] Erase unused duplicate functions if they are discardable
Vedant Kumar [Fri, 11 Jan 2019 17:56:35 +0000 (17:56 +0000)]
[MergeFunc] Erase unused duplicate functions if they are discardable

MergeFunc only deletes unused duplicate functions if they have local
linkage, but it should be safe to relax this to any "discardable if
unused" linkage type.

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

llvm-svn: 350939

5 years ago[MergeFunc] Use Instruction::getFunction as a cleanup, NFC
Vedant Kumar [Fri, 11 Jan 2019 17:56:21 +0000 (17:56 +0000)]
[MergeFunc] Use Instruction::getFunction as a cleanup, NFC

llvm-svn: 350938

5 years ago[CMake] Remove dead code and outdated comments
Stefan Granitz [Fri, 11 Jan 2019 17:51:33 +0000 (17:51 +0000)]
[CMake] Remove dead code and outdated comments

Summary: All of these changes are NOPs.

Reviewers: stella.stamenova, labath, JDevlieghere

Reviewed By: stella.stamenova

Subscribers: mgorny, lldb-commits, #lldb

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

llvm-svn: 350937

5 years ago[libcxx] Call __count_bool_true for bitset count
Adhemerval Zanella [Fri, 11 Jan 2019 17:31:17 +0000 (17:31 +0000)]
[libcxx] Call __count_bool_true for bitset count

This patch aims to help clang with better information so it can inline
__bit_reference count function usage for both std::biset. Current clang
inliner can not infer that the passed typed will be used only to select
the optimized variant, it evaluates the type argument and type check as
a load plus compare (although later optimization phases correctly
optimized this out).

It is mainly to help llvm inliner to generate better code for std::bitset
count for aarch64. It helps on both runtime and code size, since if inline
decides that _VSTD::count should not be inlined the vectorization will
create both aligned and unaligned variants (which add both code size and
runtime costs)

llvm-svn: 350936

5 years agoXFAIL getusershell.cc on Android.
Matt Morehouse [Fri, 11 Jan 2019 17:26:11 +0000 (17:26 +0000)]
XFAIL getusershell.cc on Android.

Android does not implement [set|get|end]usershell().

llvm-svn: 350935

5 years agoImplementation Feature Test Macros for P0722R3
Chris Kennelly [Fri, 11 Jan 2019 17:09:22 +0000 (17:09 +0000)]
Implementation Feature Test Macros for P0722R3

Summary:
P1353R0, adopted in San Diego, specified an implementation feature test macro for destroying delete (P0722R3).

The implementation of the feature (https://reviews.llvm.org/rL315662) is not guarded behind a flag, so the macro is not conditional on language version.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 350934

5 years agoSilence -Wsign-compare in unittests
Bjorn Pettersson [Fri, 11 Jan 2019 16:53:45 +0000 (16:53 +0000)]
Silence -Wsign-compare in unittests

llvm-svn: 350933

5 years agoAdd an .arcconfig for the top of the git monorepo.
James Y Knight [Fri, 11 Jan 2019 16:27:14 +0000 (16:27 +0000)]
Add an .arcconfig for the top of the git monorepo.

llvm-svn: 350932

5 years ago[Jump Threading] Unfold a select insn that feeds a switch via a phi node
Ehsan Amiri [Fri, 11 Jan 2019 15:52:57 +0000 (15:52 +0000)]
[Jump Threading] Unfold a select insn that feeds a switch via a phi node

Currently when a select has a constant value in one branch and the select feeds
a conditional branch (via a compare/ phi and compare) we unfold the select
statement. This results in threading the conditional branch later on. Similar
opportunity exists when a select (with a constant in one branch) feeds a
switch (via a phi node). The patch unfolds select under this condition.
A testcase is provided.

llvm-svn: 350931

5 years agoDon't use the form '2017y' in tests, since some gcc versions don't allow it
Marshall Clow [Fri, 11 Jan 2019 15:45:56 +0000 (15:45 +0000)]
Don't use the form '2017y' in tests, since some gcc versions don't allow it

llvm-svn: 350930

5 years agoImplement the 'sys_time' portions of the C++20 calendaring stuff. Reviewed as D56494
Marshall Clow [Fri, 11 Jan 2019 15:12:04 +0000 (15:12 +0000)]
Implement the 'sys_time' portions of the C++20 calendaring stuff. Reviewed as D56494

llvm-svn: 350929

5 years ago[x86] allow insert/extract when matching horizontal ops
Sanjay Patel [Fri, 11 Jan 2019 14:27:59 +0000 (14:27 +0000)]
[x86] allow insert/extract when matching horizontal ops

Previously, we limited this transform to cases where the
extraction into the build vector happens from vectors of
the same type as the build vector, but that's not required.

There's a slight potential regression seen in the AVX512
result for phadd -- we're using the 256-bit flavor of the
instruction now even though the 128-bit subset is sufficient.
The same problem could already be seen in the AVX2 result.
Follow-up patches will attempt to narrow that back down.

llvm-svn: 350928

5 years ago[llvm-objcopy] [COFF] Implmement --strip-unneeded and -x/--discard-all for symbols
Martin Storsjo [Fri, 11 Jan 2019 14:13:04 +0000 (14:13 +0000)]
[llvm-objcopy] [COFF] Implmement --strip-unneeded and -x/--discard-all for symbols

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

llvm-svn: 350927

5 years ago[llvm-objcopy] [COFF] Fix writing object files without symbols/string table
Martin Storsjo [Fri, 11 Jan 2019 13:47:37 +0000 (13:47 +0000)]
[llvm-objcopy] [COFF] Fix writing object files without symbols/string table

Previously, this was broken - by setting PointerToSymbolTable to zero
but still actually writing the string table length, the object file
header was corrupted.

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

llvm-svn: 350926

5 years ago[llvm-symbolizer] Add -exe, -e as aliases to -obj
Dmitry Venikov [Fri, 11 Jan 2019 11:51:52 +0000 (11:51 +0000)]
[llvm-symbolizer] Add -exe, -e as aliases to -obj

Summary: Provides -exe, -e as aliases to -obj. Motivation: https://bugs.llvm.org/show_bug.cgi?id=40071

Reviewers: ruiu, rnk, fjricci, jhenderson

Reviewed By: jhenderson

Subscribers: llvm-commits

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

llvm-svn: 350925

5 years agoIntroduce SymbolFileBreakpad and use it to fill symtab
Pavel Labath [Fri, 11 Jan 2019 11:17:51 +0000 (11:17 +0000)]
Introduce SymbolFileBreakpad and use it to fill symtab

Summary:
This commit adds the glue code necessary to integrate the
SymbolFileBreakpad into the plugin system. Most of the methods are
stubbed out. The only method implemented method is AddSymbols, which
parses the PUBLIC "section" of the breakpad "object file", and fills out
the Module's symtab.

To enable testing this, I've made two additional changes:
- dump Symtab from the SymbolVendor class. The symtab was already being
  dumped as a part of the object file dump, but that happened before
  symbol vendor kicked in, so it did not reflect any symbols added
  there.
- add ability to explicitly specify the external symbol file in
  lldb-test (so that the object file could be linked with the breakpad
  symbol file). To make things simpler, I've changed lldb-test from
  consuming multiple inputs (and dumping their symbols) to having it
  just process a single file per invocation. This was not a problem
  since everyone was using it that way already.

Reviewers: clayborg, zturner, lemo, markmentovai, amccarth

Subscribers: mgorny, lldb-commits

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

llvm-svn: 350924

5 years agoELF: Fix base address computation code for files generated by yaml2obj
Pavel Labath [Fri, 11 Jan 2019 10:18:40 +0000 (10:18 +0000)]
ELF: Fix base address computation code for files generated by yaml2obj

The code was assuming that the elf file will have a PT_LOAD segment
starting from the first byte of the file. While this is true for files
generated by most linkers (it's a way of saving space), it is not a
requirement. And files not satisfying this constraint can still be
perfectly executable. yaml2obj is one of the tools which produces files
like this.

This patch relaxes the check in ObjectFileELF to take the address of the
first PT_LOAD segment as the base address of the object (instead of the
one with the offset 0). Since the PT_LOAD segments are supposed to be
sorted according to the VM address, this entry will also be the one with
the lowest VM address.

If we ever run into files which don't have the PT_LOAD segments sorted,
we can easily change this code to return the lowest VM address as the
base address (if that is the correct thing to do for these files).

llvm-svn: 350923

5 years ago[clang-tidy] new check 'readability-redundant-preprocessor'
Miklos Vajna [Fri, 11 Jan 2019 07:59:47 +0000 (07:59 +0000)]
[clang-tidy] new check 'readability-redundant-preprocessor'

Finds potentially redundant preprocessor directives.

Reviewed By: aaron.ballman

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

llvm-svn: 350922

5 years agoRevert "[SelectionDAGBuilder] Refactor GetRegistersForValue. NFCI."
Martin Storsjo [Fri, 11 Jan 2019 07:31:17 +0000 (07:31 +0000)]
Revert "[SelectionDAGBuilder] Refactor GetRegistersForValue. NFCI."

This reverts commit r350841, as it actually had functional changes
and broke compilation. See PR40290.

llvm-svn: 350921

5 years ago[Sema] Make canPassInRegisters return true if the CXXRecordDecl passed
Akira Hatanaka [Fri, 11 Jan 2019 07:06:38 +0000 (07:06 +0000)]
[Sema] Make canPassInRegisters return true if the CXXRecordDecl passed
to it is a trivial_abi class.

A class that has all of its copy and move constructors deleted can still
be passed or returned in registers if the class is annotated with
trivial_abi.

This fixes PR39683.

llvm-svn: 350920

5 years ago[Sanitizer] Intercept getusershell
David Carlier [Fri, 11 Jan 2019 05:53:09 +0000 (05:53 +0000)]
[Sanitizer] Intercept getusershell

- If entries are properly copied (there were a bug in FreeBSD implementation in earlier version), or list properly reset.

Reviewers: vitalybuka, krytarowski

Reviewed By: krytarowski

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

llvm-svn: 350919

5 years ago[X86] Change vXi1 extract_vector_elt lowering to be legal if the index is 0. Add...
Craig Topper [Fri, 11 Jan 2019 05:44:56 +0000 (05:44 +0000)]
[X86] Change vXi1 extract_vector_elt lowering to be legal if the index is 0. Add DAG combine to turn scalar_to_vector+extract_vector_elt into extract_subvector.

We were lowering the last step extract_vector_elt to a bitcast+truncate. Change it to use an extract_vector_elt of index 0 instead. Add isel patterns to do the equivalent of what the bitcast would have done. Plus an isel pattern for an any_extend+extract to prevent some regressions.

Finally add a DAG combine to turn v1i1 scalar_to_vector+extract_vector_elt of 0 into an extract_subvector.

This fixes some of the regressions from D350800.

llvm-svn: 350918

5 years ago[Sema] If CheckPlaceholderExpr rewrites the initializer of an auto
Akira Hatanaka [Fri, 11 Jan 2019 04:57:34 +0000 (04:57 +0000)]
[Sema] If CheckPlaceholderExpr rewrites the initializer of an auto
variable during auto type deduction, use the rewritten initializer when
performing initialization of the variable.

This silences spurious -Warc-repeated-use-of-weak warnings that are
issued when the initializer uses a weak ObjC pointer.

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

llvm-svn: 350917

5 years agoAdapt to CXXMethodDecl::getThisType change (NFC)
Brian Gesiak [Fri, 11 Jan 2019 02:12:31 +0000 (02:12 +0000)]
Adapt to CXXMethodDecl::getThisType change (NFC)

Summary:
https://reviews.llvm.org/D56509 changed the API of the
CXXMethodDecl::getThisType method. Adapt to the change (and re-apply
clang-format) to fix the clang-tidy build.

llvm-svn: 350916

5 years agoRemember to instantiate explicit template argument lists in a friend
Richard Smith [Fri, 11 Jan 2019 01:59:33 +0000 (01:59 +0000)]
Remember to instantiate explicit template argument lists in a friend
function declaration.

We'd previously often just drop these on the floor, and friend
redeclaration matching would usually (but not always) figure out the
right redeclaration anyway.

Also, don't try to match a dependent friend function template
specialization to a template until instantiation, and don't forget to
reject qualified friend declarations in dependent contexts that don't
name an already-declared entity.

llvm-svn: 350915

5 years ago[AST] Remove ASTContext from getThisType (NFC)
Brian Gesiak [Fri, 11 Jan 2019 01:54:53 +0000 (01:54 +0000)]
[AST] Remove ASTContext from getThisType (NFC)

Summary:
https://reviews.llvm.org/D54862 removed the usages of `ASTContext&` from
within the `CXXMethodDecl::getThisType` method. Remove the parameter
altogether, as well as all usages of it. This does not result in any
functional change because the parameter was unused since
https://reviews.llvm.org/D54862.

Test Plan: check-clang

Reviewers: akyrtzi, mikael

Reviewed By: mikael

Subscribers: mehdi_amini, dexonsmith, cfe-commits

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

llvm-svn: 350914

5 years agoFix header issues.
Richard Trieu [Fri, 11 Jan 2019 01:32:35 +0000 (01:32 +0000)]
Fix header issues.

Several headers would fail to compile if other headers were not previously
included.  The usual issue is that a class is forward declared, but the
full definition is needed.  The requirement for the definition is use of
isa/dyn_cast or calling functions of pointer-packed data types such as
DenseMap or PointerIntPair.  Add missing includes to these headers.

SVals.h required an out-of-line method definition in the .cpp file to avoid
circular inclusion of headers with BasicValueFactory.h

llvm-svn: 350913