platform/upstream/llvm.git
6 years agoAvoid Wparentheses warning.
Simon Pilgrim [Mon, 15 Jan 2018 22:40:06 +0000 (22:40 +0000)]
Avoid Wparentheses warning.

llvm-svn: 322526

6 years ago[X86][MMX] Add support for MMX zero vector creation
Simon Pilgrim [Mon, 15 Jan 2018 22:32:40 +0000 (22:32 +0000)]
[X86][MMX] Add support for MMX zero vector creation

As mentioned on PR35869, (and came up recently on D41517) we don't create a MMX zero register via the PXOR but instead perform a spill to stack from a XMM zero register.

This patch adds support for direct MMX zero vector creation and should make it easier to add better constant vector creation in the future as well.

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

llvm-svn: 322525

6 years ago[X86][SSE] Add custom execution domain fixing for BLENDPD/BLENDPS/PBLENDD/PBLENDW...
Simon Pilgrim [Mon, 15 Jan 2018 22:18:45 +0000 (22:18 +0000)]
[X86][SSE] Add custom execution domain fixing for BLENDPD/BLENDPS/PBLENDD/PBLENDW (PR34873)

Add support for custom execution domain fixing and implement support for BLENDPD/BLENDPS/PBLENDD/PBLENDW.

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

llvm-svn: 322524

6 years ago[x86] add tests to show missed constant shrinking (PR35907); NFC
Sanjay Patel [Mon, 15 Jan 2018 21:57:41 +0000 (21:57 +0000)]
[x86] add tests to show missed constant shrinking (PR35907); NFC

llvm-svn: 322523

6 years ago[x86] regenerate test checks; NFC
Sanjay Patel [Mon, 15 Jan 2018 21:32:39 +0000 (21:32 +0000)]
[x86] regenerate test checks; NFC

llvm-svn: 322522

6 years ago[x86] regenerate test checks; NFC
Sanjay Patel [Mon, 15 Jan 2018 21:28:52 +0000 (21:28 +0000)]
[x86] regenerate test checks; NFC

llvm-svn: 322521

6 years ago[docs] Only LLVM IR bitstreams begin with 'BC'
Brian Gesiak [Mon, 15 Jan 2018 21:23:32 +0000 (21:23 +0000)]
[docs] Only LLVM IR bitstreams begin with 'BC'

Summary:
The LLVM Bitcode File Format documentation states that all bitstreams
begin with the magic number 'BC', and that generic bitstream analyzer
tools may check for this number in order to determine whether the
stream is a bitstream.

However, in practice:

* Only LLVM IR bitcode begins with 'BC'. Other bitstreams -- Clang
  AST files and precompiled headers, Clang serialized diagnostics,
  Swift modules -- do not start with 'BC'. A tool that actually checked
  for 'BC' would only be able to recognize LLVM IR.
* The `llvm-bcanalyzer`, arguably the most used generic bitstream
  analyzer tool, does not check for a magic number 'BC' (except to
  determine whether the file is LLVM IR).

Update the bitcode format documentation to make it clear that not all
bitstreams begin with 'BC', and that tools should not rely on that
particular magic number value.

Test Plan:
Build the `docs-llvm-html` target and confirm the changes render in
a Safari web browser.

Reviewers: harlanhaskins, eugenis, mehdi_amini, pcc, angerman

Reviewed By: angerman

Subscribers: angerman, llvm-commits

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

llvm-svn: 322520

6 years ago[x86] regenerate test checks; NFC
Sanjay Patel [Mon, 15 Jan 2018 21:22:46 +0000 (21:22 +0000)]
[x86] regenerate test checks; NFC

llvm-svn: 322519

6 years agoRevert 319303: Add _Float128 as alias to __float128 to enable compilations on Fedora2...
Erich Keane [Mon, 15 Jan 2018 21:16:25 +0000 (21:16 +0000)]
Revert 319303: Add _Float128 as alias to __float128 to enable compilations on Fedora27/glibc2

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

llvm-svn: 322518

6 years ago[Driver] Suggest valid integrated tools
Brian Gesiak [Mon, 15 Jan 2018 21:05:40 +0000 (21:05 +0000)]
[Driver] Suggest valid integrated tools

Summary:
There are only two valid integrated Clang driver tools: `-cc1` and
`-cc1as`. If a user asks for an unknown tool, such as `-cc1asphalt`,
an error message is displayed to indicate that there is no such tool,
but the message doesn't indicate what the valid options are.

Include the valid options in the error message.

Test Plan: `check-clang`

Reviewers: sepavloff, bkramer, phosek

Reviewed By: bkramer

Subscribers: cfe-commits

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

llvm-svn: 322517

6 years ago[OPENMP] Update status of OpenMP support, NFC.
Alexey Bataev [Mon, 15 Jan 2018 21:01:29 +0000 (21:01 +0000)]
[OPENMP] Update status of OpenMP support, NFC.

llvm-svn: 322516

6 years ago[OPENMP] Initial codegen for `target teams distribute parallel for
Alexey Bataev [Mon, 15 Jan 2018 20:59:40 +0000 (20:59 +0000)]
[OPENMP] Initial codegen for `target teams distribute parallel for
simd`.

Added host codegen + codegen for devices with default codegen for
`#pragma omp target teams distribute parallel for simd` directive.

llvm-svn: 322515

6 years ago[RISCV] Fix test failures on non-assert builds introduced in r322494
Alex Bradbury [Mon, 15 Jan 2018 20:45:15 +0000 (20:45 +0000)]
[RISCV] Fix test failures on non-assert builds introduced in r322494

Thanks to Eli Friedman, who suggested the reason these tests failed on a few
buildbots yet works fine locally is because non-assert builds don't emit value
labels.

llvm-svn: 322514

6 years agoFixed memory leak in unit test introduced in my previous commit r322503
Cameron Desrochers [Mon, 15 Jan 2018 20:37:35 +0000 (20:37 +0000)]
Fixed memory leak in unit test introduced in my previous commit r322503

llvm-svn: 322513

6 years ago[X86] Use MVT::getVectorVT instead of EVT::getVectorVT when splitting 256/512 bit...
Craig Topper [Mon, 15 Jan 2018 20:33:53 +0000 (20:33 +0000)]
[X86] Use MVT::getVectorVT instead of EVT::getVectorVT when splitting 256/512 bit build_vectors. NFC

We must be creating a legal type here which means it can be an MVT.

llvm-svn: 322512

6 years ago[X86] Generalize some code in LowerBUILD_VECTOR. NFC
Craig Topper [Mon, 15 Jan 2018 20:33:52 +0000 (20:33 +0000)]
[X86] Generalize some code in LowerBUILD_VECTOR. NFC

llvm-svn: 322511

6 years ago[X86] Remove unnecessary if statement from LowerBUILD_VECTOR. NFCI
Craig Topper [Mon, 15 Jan 2018 20:33:50 +0000 (20:33 +0000)]
[X86] Remove unnecessary if statement from LowerBUILD_VECTOR. NFCI

We were checking for 128, 256, or 512 bit vectors, but those are the only types that can get here.

llvm-svn: 322510

6 years ago[clangd] Improve const-correctness of Symbol->Detail. NFC
Sam McCall [Mon, 15 Jan 2018 20:09:09 +0000 (20:09 +0000)]
[clangd] Improve const-correctness of Symbol->Detail. NFC

Summary:
This would have caught a bug I wrote in an early version of D42049, where
an index user could overwrite data internal to the index because the Symbol is
not deep-const.

The YAML traits are now a bit more verbose, but separate concerns a bit more
nicely: ArenaPtr can be reused for other similarly-allocated objects, including
scalars etc.

Reviewers: hokein

Subscribers: klimek, ilya-biryukov, cfe-commits, ioeric

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

llvm-svn: 322509

6 years ago[WebAssembly] Update README.txt.
Dan Gohman [Mon, 15 Jan 2018 20:08:14 +0000 (20:08 +0000)]
[WebAssembly] Update README.txt.

Describe more of the current status, mention Rust as another easy
way to use this backend, and add more documentation links.

llvm-svn: 322508

6 years agoFix constexpr failure on C++11-based buildbots.
Marshall Clow [Mon, 15 Jan 2018 19:59:09 +0000 (19:59 +0000)]
Fix constexpr failure on C++11-based buildbots.

llvm-svn: 322507

6 years agoMore constexpr from P0202. count and count_if. Also fix a comment that Morwenn noted.
Marshall Clow [Mon, 15 Jan 2018 19:40:34 +0000 (19:40 +0000)]
More constexpr from P0202. count and count_if. Also fix a comment that Morwenn noted.

llvm-svn: 322506

6 years agoSome of the tests from earlier today had 'int' as the return type when it should...
Marshall Clow [Mon, 15 Jan 2018 19:32:32 +0000 (19:32 +0000)]
Some of the tests from earlier today had 'int' as the return type when it should have been 'bool'. Fix that. It doesn't change the behavior of any of the tests, but it's more accurate.

llvm-svn: 322505

6 years agoMore P0202 constexpr-ifying. All the find_XXX algorithms in this commit.
Marshall Clow [Mon, 15 Jan 2018 19:26:05 +0000 (19:26 +0000)]
More P0202 constexpr-ifying. All the find_XXX algorithms in this commit.

llvm-svn: 322504

6 years ago[PCH] Serialize skipped preprocessor ranges
Cameron Desrochers [Mon, 15 Jan 2018 19:14:16 +0000 (19:14 +0000)]
[PCH] Serialize skipped preprocessor ranges

The skipped preprocessor ranges are now serialized in the AST PCH file. This fixes, for example, libclang's clang_getSkippedRanges() returning zero ranges after reparsing a translation unit.

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

llvm-svn: 322503

6 years ago[OPENMP] Update docs for OpenMP status, NFC.
Alexey Bataev [Mon, 15 Jan 2018 19:08:36 +0000 (19:08 +0000)]
[OPENMP] Update docs for OpenMP status, NFC.

llvm-svn: 322502

6 years ago[OPENMP] Add codegen for `depend` clauses on `target` directive.
Alexey Bataev [Mon, 15 Jan 2018 19:06:12 +0000 (19:06 +0000)]
[OPENMP] Add codegen for `depend` clauses on `target` directive.

Added basic support for codegen of `depend` clauses on `target`
directive.

llvm-svn: 322501

6 years ago[AMDGPU] Add HW_REG_SH_MEM_BASES symbolic name for s_getreg_b32
Stanislav Mekhanoshin [Mon, 15 Jan 2018 18:49:15 +0000 (18:49 +0000)]
[AMDGPU] Add HW_REG_SH_MEM_BASES symbolic name for s_getreg_b32

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

llvm-svn: 322500

6 years ago[Hexagon] Implement signed and unsigned multiply-high for vectors
Krzysztof Parzyszek [Mon, 15 Jan 2018 18:43:55 +0000 (18:43 +0000)]
[Hexagon] Implement signed and unsigned multiply-high for vectors

llvm-svn: 322499

6 years ago[Hexagon] Rewrite LowerVECTOR_SHUFFLE for 32-/64-bit vectors
Krzysztof Parzyszek [Mon, 15 Jan 2018 18:33:33 +0000 (18:33 +0000)]
[Hexagon] Rewrite LowerVECTOR_SHUFFLE for 32-/64-bit vectors

The old implementation was not always correct. The new one recognizes
more shuffles that match specific instructions.

llvm-svn: 322498

6 years ago[clang-tidy] Expand readability-redundant-smartptr-get to understand implicit converi...
Samuel Benzaquen [Mon, 15 Jan 2018 18:03:20 +0000 (18:03 +0000)]
[clang-tidy] Expand readability-redundant-smartptr-get to understand implicit converions to bool in more contexts.

Summary: Expand readability-redundant-smartptr-get to understand implicit converions to bool in more contexts.

Reviewers: hokein

Subscribers: klimek, xazax.hun, cfe-commits

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

llvm-svn: 322497

6 years ago[AMDGPU] Copy impdefs from pseudo to real instructions
Stanislav Mekhanoshin [Mon, 15 Jan 2018 17:55:35 +0000 (17:55 +0000)]
[AMDGPU] Copy impdefs from pseudo to real instructions

In some cases we do not copy implicit defs from pseudo to real
VOP instructions. It has no visible impact at the moment thus no
tests are affected or added.

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

llvm-svn: 322496

6 years ago[X86] Fix typos in WriteVMOVNTDQSt and WriteVMOVNTPYSt pattern names. NFCI.
Simon Pilgrim [Mon, 15 Jan 2018 17:55:21 +0000 (17:55 +0000)]
[X86] Fix typos in WriteVMOVNTDQSt and WriteVMOVNTPYSt pattern names. NFCI.

llvm-svn: 322495

6 years ago[RISCV] Implement RISCV ABI lowering
Alex Bradbury [Mon, 15 Jan 2018 17:54:52 +0000 (17:54 +0000)]
[RISCV] Implement RISCV ABI lowering

RISCVABIInfo is implemented in terms of XLen, supporting both RV32 and RV64.
Unfortunately we need to count argument registers in the frontend in order to
determine when to emit signext and zeroext attributes. Integer scalars are
extended according to their type up to 32-bits and then sign-extended to XLen
when passed in registers, but are anyext when passed on the stack. This patch
only implements the base integer (soft float) ABIs.

For more information on the RISC-V ABI, see [the ABI
doc](https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md),
my [golden model](https://github.com/lowRISC/riscv-calling-conv-model), and
the [LLVM RISC-V calling convention
patch](https://reviews.llvm.org/D39898#2d1595b4) (specifically the comment
documenting frontend expectations).

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

llvm-svn: 322494

6 years agopartition_point gets the P0202 treatment
Marshall Clow [Mon, 15 Jan 2018 17:53:34 +0000 (17:53 +0000)]
partition_point gets the P0202 treatment

llvm-svn: 322493

6 years agoMore constexpr algorithms from P0202. any_of/all_of/none_of.
Marshall Clow [Mon, 15 Jan 2018 17:20:36 +0000 (17:20 +0000)]
More constexpr algorithms from P0202. any_of/all_of/none_of.

llvm-svn: 322492

6 years ago[docs] Fix mention of GCC frontend
Jan Korous [Mon, 15 Jan 2018 17:11:22 +0000 (17:11 +0000)]
[docs] Fix mention of GCC frontend

llvm-svn: 322491

6 years ago[WebAssembly] Make WasmObjectWriter's destructor public; NFC
Dan Gohman [Mon, 15 Jan 2018 17:06:23 +0000 (17:06 +0000)]
[WebAssembly] Make WasmObjectWriter's destructor public; NFC

This fixes the FIXME introduced in r315327.

llvm-svn: 322490

6 years agoFirst part of P0202: Adding constexpr modifiers to functions in <algorithm> and ...
Marshall Clow [Mon, 15 Jan 2018 16:16:32 +0000 (16:16 +0000)]
First part of P0202: Adding constexpr modifiers to functions in <algorithm> and <utility>. This commit is all the is_XXX algorithms.

llvm-svn: 322489

6 years ago[SystemZ] Check for legality before doing LOAD AND TEST transformations.
Jonas Paulsson [Mon, 15 Jan 2018 15:41:26 +0000 (15:41 +0000)]
[SystemZ]  Check for legality before doing LOAD AND TEST transformations.

Since a load and test instruction treat its operands as signed, it can only
replace a logical compare for EQ/NE uses.

Review: Ulrich Weigand
https://bugs.llvm.org/show_bug.cgi?id=35662

llvm-svn: 322488

6 years agoAllow function_ref(nullptr) like std::function, since it's nullable already
Sam McCall [Mon, 15 Jan 2018 14:43:04 +0000 (14:43 +0000)]
Allow function_ref(nullptr) like std::function, since it's nullable already

llvm-svn: 322487

6 years ago[X86] Add missing predicates for VRNDSCALES{D,S}{m,r}
Clement Courbet [Mon, 15 Jan 2018 14:24:07 +0000 (14:24 +0000)]
[X86] Add missing predicates for VRNDSCALES{D,S}{m,r}

Summary: This is similar to https://reviews.llvm.org/D41983.

Reviewers: gchatelet

Subscribers: llvm-commits

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

llvm-svn: 322486

6 years ago Update BTVER2 sched numbers for some AVX instructions (xmm version).
Andrew V. Tischenko [Mon, 15 Jan 2018 14:21:11 +0000 (14:21 +0000)]
 Update BTVER2 sched numbers for some AVX instructions (xmm version).
Differential Revision: https://reviews.llvm.org/D40067

llvm-svn: 322485

6 years ago[X86]Add missing predicates for VMOVDQUYrm,VMOVDQUYmr.
Clement Courbet [Mon, 15 Jan 2018 13:37:05 +0000 (13:37 +0000)]
[X86]Add missing predicates for VMOVDQUYrm,VMOVDQUYmr.

Summary:
Due to missing parentheses.

This is similar to https://reviews.llvm.org/D41983.

Reviewers: gchatelet

Subscribers: llvm-commits

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

llvm-svn: 322483

6 years ago[AArch64][AsmParser] Cleanup isSImm7s4, isSImm7s8, (etc) functions.
Sander de Smalen [Mon, 15 Jan 2018 12:47:17 +0000 (12:47 +0000)]
[AArch64][AsmParser] Cleanup isSImm7s4, isSImm7s8, (etc) functions.

Reviewers: fhahn, rengolin, t.p.northover, echristo, olista01, samparker

Reviewed By: fhahn, samparker

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

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

llvm-svn: 322481

6 years ago[clangd] Merge results from static/dynamic index.
Sam McCall [Mon, 15 Jan 2018 12:33:00 +0000 (12:33 +0000)]
[clangd] Merge results from static/dynamic index.

Summary:
We now hide the static/dynamic split from the code completion, behind a
new implementation of the SymbolIndex interface. This will reduce the
complexity of the sema/index merging that needs to be done by
CodeComplete, at a fairly small cost in flexibility.

Reviewers: hokein

Subscribers: klimek, mgorny, ilya-biryukov, cfe-commits

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

llvm-svn: 322480

6 years ago[clang-format] Adds a FormatStyleSet
Krasimir Georgiev [Mon, 15 Jan 2018 12:06:16 +0000 (12:06 +0000)]
[clang-format] Adds a FormatStyleSet

Summary:
This patch adds a FormatStyleSet for storing per-language FormatStyles for the
purposes of formatting code blocks inside the main code.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: klimek, djasper, bkramer, cfe-commits

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

llvm-svn: 322479

6 years ago[X86] Fix missing predicates HasAVX512 Predicates in avx512_sqrt_scalar.
Clement Courbet [Mon, 15 Jan 2018 12:05:33 +0000 (12:05 +0000)]
[X86] Fix missing predicates HasAVX512 Predicates in avx512_sqrt_scalar.

Summary:
For example, VSQRTSDZr and VSQRTSSZr were missing the predicate.
Also fix braces indentation and braces for consistency.

Reviewers: craig.topper, RKSimon

Suscribers: llvm-commits

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

llvm-svn: 322478

6 years agoOne more attempt to fix NetBSD build
Pavel Labath [Mon, 15 Jan 2018 11:50:05 +0000 (11:50 +0000)]
One more attempt to fix NetBSD build

llvm-svn: 322477

6 years agoFix NetBSD build for llvm r322475
Pavel Labath [Mon, 15 Jan 2018 11:32:43 +0000 (11:32 +0000)]
Fix NetBSD build for llvm r322475

llvm-svn: 322476

6 years ago[Support] Remove MemoryBuffer::getNewMemBuffer
Pavel Labath [Mon, 15 Jan 2018 11:03:30 +0000 (11:03 +0000)]
[Support] Remove MemoryBuffer::getNewMemBuffer

all callers have been switched the the Writable version (which does not
require const_casting to be useful).

llvm-svn: 322475

6 years agoRevert "[DAG] Elide overlapping stores"
Benjamin Kramer [Mon, 15 Jan 2018 10:57:24 +0000 (10:57 +0000)]
Revert "[DAG] Elide overlapping stores"

This reverts commit r322085. Internal PPC testing is still showing the
same symptoms as when this patch landed the last time.

llvm-svn: 322474

6 years ago[LV] Don't call recordVectorLoopValueForInductionCast for newly-created IV from a...
Andrei Elovikov [Mon, 15 Jan 2018 10:56:07 +0000 (10:56 +0000)]
[LV] Don't call recordVectorLoopValueForInductionCast for newly-created IV from a trunc.

Summary:
This method is supposed to be called for IVs that have casts in their use-def
chains that are completely ignored after vectorization under PSE. However, for
truncates of such IVs the same InductionDescriptor is used during
creation/widening of both original IV based on PHINode and new IV based on
TruncInst.

This leads to unintended second call to recordVectorLoopValueForInductionCast
with a VectorLoopVal set to the newly created IV for a trunc and causes an
assert due to attempt to store new information for already existing entry in the
map. This is wrong and should not be done.

Fixes PR35773.

Reviewers: dorit, Ayal, mssimpso

Reviewed By: dorit

Subscribers: RKSimon, dim, dcaballe, hsaito, llvm-commits, hiraditya

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

llvm-svn: 322473

6 years agoFix HostInfoBase::ComputeSharedLibraryDirectory comment
Pavel Labath [Mon, 15 Jan 2018 09:56:00 +0000 (09:56 +0000)]
Fix HostInfoBase::ComputeSharedLibraryDirectory comment

The comment seems to indicate that this function would return the "bin"
directory on linux. I've verified that this is not the case, so I'm
updating the comment to match.

llvm-svn: 322472

6 years ago[X86][AVX512F_512]: Adding full coverage of MC encoding for the AVX512F 512 bits...
Gadi Haber [Mon, 15 Jan 2018 09:39:08 +0000 (09:39 +0000)]
[X86][AVX512F_512]: Adding full coverage of MC encoding for the AVX512F 512 bits isa sets.<NFC>

NFC.
 Adding MC regressions tests to cover the AVX512F_512 isa sets both 32 and 64 bit.
 This patch is part of a larger task to cover MC encoding of all X86 ISA Sets.
 started in revision: https://reviews.llvm.org/D39952

Reviewers: zvi, craig.topper, RKSimon, AndreiGrischenko
Differential Revision: https://reviews.llvm.org/D41172

Change-Id: I46aa33dd967d63d33f67d1988ad42d8df2081e39
llvm-svn: 322471

6 years ago[GlobalsAA] Don't let dbg intrinsics affect analysis result
Mikael Holmen [Mon, 15 Jan 2018 07:05:51 +0000 (07:05 +0000)]
[GlobalsAA] Don't let dbg intrinsics affect analysis result

Summary:
This fixes PR35899.

Debug info intrinsics shouldn't affect code generation so ignore them
in GlobalsAA.

Reviewers: hfinkel, aprantl

Reviewed By: aprantl

Subscribers: aprantl, llvm-commits

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

llvm-svn: 322470

6 years agoClang counterpart change for fuzzer FreeBSD support
Kamil Rytarowski [Mon, 15 Jan 2018 05:56:44 +0000 (05:56 +0000)]
Clang counterpart change for fuzzer FreeBSD support

Summary: Providing fuzzer sanitizer support for FreeBSD (but only for X86/64 architectures).

Reviewers: kimgr, EricWF, martell

Reviewed By: martell

Patch by David CARLIER.

Subscribers: krytarowski, kimgr, emaste, cfe-commits

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

llvm-svn: 322469

6 years ago[NFC] Fix comment to adjust to reality
Max Kazantsev [Mon, 15 Jan 2018 05:44:43 +0000 (05:44 +0000)]
[NFC] Fix comment to adjust to reality

llvm-svn: 322468

6 years ago[BasicAA] Stop crashing when dealing with pointers > 64 bits.
Davide Italiano [Mon, 15 Jan 2018 01:40:18 +0000 (01:40 +0000)]
[BasicAA] Stop crashing when dealing with pointers > 64 bits.

An alternative (and probably better) fix would be that of
making `Scale` an APInt, and there's a patch floating around
to do this. As we're still discussing it, at least stop crashing
in the meanwhile (added bonus, we now have a regression test for
this situation).

Fixes PR35843.

Thanks to Eli for suggesting the fix and Simon for reporting and
reducing the bug.

llvm-svn: 322467

6 years ago[GlobalISel][Legalizer] Convert some typedefs to using. NFC.
Amara Emerson [Mon, 15 Jan 2018 00:44:20 +0000 (00:44 +0000)]
[GlobalISel][Legalizer] Convert some typedefs to using. NFC.

llvm-svn: 322466

6 years ago[X86][SSE] Tag PR21137 test case
Simon Pilgrim [Sun, 14 Jan 2018 21:59:43 +0000 (21:59 +0000)]
[X86][SSE] Tag PR21137 test case

The test was added ages ago, but we didn't comment where it came from.

llvm-svn: 322465

6 years ago[X86] Add test cases for D41794.
Craig Topper [Sun, 14 Jan 2018 20:53:49 +0000 (20:53 +0000)]
[X86] Add test cases for D41794.

llvm-svn: 322464

6 years ago[X86][SSE] Add PR22391 test case
Simon Pilgrim [Sun, 14 Jan 2018 19:57:50 +0000 (19:57 +0000)]
[X86][SSE] Add PR22391 test case

llvm-svn: 322463

6 years ago[X86] Autoupgrade kunpck intrinsics using vector operations instead of scalar operations
Craig Topper [Sun, 14 Jan 2018 19:24:10 +0000 (19:24 +0000)]
[X86] Autoupgrade kunpck intrinsics using vector operations instead of scalar operations

Summary: This patch changes the kunpck intrinsic autoupgrade to use vXi1 shufflevector operations to perform vector extracts and concats. This more closely matches the definition of the kunpck instructions. Currently we rely on a DAG combine to turn the scalar shift/and/or code into a concat vectors operation. By doing it in the IR we get this for free.

Reviewers: spatel, RKSimon, zvi, jina.nahias

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 322462

6 years ago[X86] Implement old kunpck intrinsics using vector ops on vXi1 instead of integer...
Craig Topper [Sun, 14 Jan 2018 19:23:50 +0000 (19:23 +0000)]
[X86] Implement old kunpck intrinsics using vector ops on vXi1 instead of integer shift/and/or

Summary:
kunpck intrinsics were removed in favor of native IR a few months ago. The implementation lowers them as by operation on the integer types passed to the intrinsic and then just shifting, masking, and oring them together. A special X86 DAG combine was added to recognize this patter and turn it into a concat_vector operation.

I think it makes more sense to keep the IR implementation closer to vector operations on vXi1. Given that we expect these builtins to be used around other builtins that operate on k-registers which we try to represent in IR with vXi1. InstCombine should be able to get rid of the bitcasts between integers and vXi1 leaving only the vector operations.

Reviewers: RKSimon, spatel, zvi, jina.nahias

Reviewed By: RKSimon

Subscribers: cfe-commits

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

llvm-svn: 322461

6 years ago[X86] Regenerate fp128 test
Simon Pilgrim [Sun, 14 Jan 2018 19:07:41 +0000 (19:07 +0000)]
[X86] Regenerate fp128 test

llvm-svn: 322460

6 years ago[X86][SSE] Support combining MOVLHPS undef inputs
Simon Pilgrim [Sun, 14 Jan 2018 18:50:34 +0000 (18:50 +0000)]
[X86][SSE] Support combining MOVLHPS undef inputs

llvm-svn: 322459

6 years ago[X86][SSE] Add v2f64 3u shuffle test
Simon Pilgrim [Sun, 14 Jan 2018 18:38:21 +0000 (18:38 +0000)]
[X86][SSE] Add v2f64 3u shuffle test

Shows a missed opportunity to remove a unnecessary move compared to 31 shuffle mask.

llvm-svn: 322458

6 years ago[x86] auto-generate complete checks; NFC
Sanjay Patel [Sun, 14 Jan 2018 17:47:40 +0000 (17:47 +0000)]
[x86] auto-generate complete checks; NFC

llvm-svn: 322457

6 years ago[InstSimplify] fix code comments; NFC
Sanjay Patel [Sun, 14 Jan 2018 15:58:18 +0000 (15:58 +0000)]
[InstSimplify] fix code comments; NFC

llvm-svn: 322456

6 years ago[X86] Use ISD::TRUNCATE instead of X86ISD::VTRUNC when input and output types have...
Craig Topper [Sun, 14 Jan 2018 08:11:36 +0000 (08:11 +0000)]
[X86] Use ISD::TRUNCATE instead of X86ISD::VTRUNC when input and output types have the same number of elements.

llvm-svn: 322455

6 years ago[X86] Add X86ISD::VTRUNC to computeKnownBitsForTargetNode.
Craig Topper [Sun, 14 Jan 2018 08:11:33 +0000 (08:11 +0000)]
[X86] Add X86ISD::VTRUNC to computeKnownBitsForTargetNode.

We have to take special care to avoid the cases where the result of the truncate would be padded with zero elements.

Ideally we'd just use ISD::TRUNCATE for these cases instead.

llvm-svn: 322454

6 years agoRemove dead code.
Rui Ueyama [Sun, 14 Jan 2018 04:44:21 +0000 (04:44 +0000)]
Remove dead code.

parseInt assumed that it could take a negative number literal (e.g.
"-123"). However, such number is in reality already handled as a
unary operator '-' followed by a number literal, so the number
literal is always non-negative. Thus, this code is dead.

llvm-svn: 322453

6 years agoReland "[Driver] Update default sanitizer blacklist location"
Petr Hosek [Sun, 14 Jan 2018 03:43:17 +0000 (03:43 +0000)]
Reland "[Driver] Update default sanitizer blacklist location"

This is related to moving the sanitizer blacklists to share/
subdirectory.

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

llvm-svn: 322452

6 years agoReland "Install resource files into a share/ directory"
Petr Hosek [Sun, 14 Jan 2018 03:43:14 +0000 (03:43 +0000)]
Reland "Install resource files into a share/ directory"

Currently these files are being installed into a root installation
directory, but this triggers an error when the installation directory
is set to an empty string which is often the case when DESTDIR is
used to control the installation destination.

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

llvm-svn: 322451

6 years ago[X86] Improve legalization of vXi16/vXi8 selects.
Craig Topper [Sun, 14 Jan 2018 02:05:51 +0000 (02:05 +0000)]
[X86] Improve legalization of vXi16/vXi8 selects.

Extend vXi1 conditions of vXi8/vXi16 selects even before type legalization gets a chance to split wide vectors. Previously we would only extend 128 and 256 bit vectors. But if we start with a 512 bit vector or wider that needs to be split we wouldn't extend until after the split had taken place. By extending early we improve the results of type legalization.

Don't widen condition of 128/256 bit vXi16/vXi8 selects when we have BWI but not VLX. We can still use a mask register by widening the select to 512-bits instead. This is similar to what we do for compares already.

llvm-svn: 322450

6 years ago[X86] Add an avx512bw command line to the avx512-vec-cmp.ll test. Add some additional...
Craig Topper [Sun, 14 Jan 2018 02:05:49 +0000 (02:05 +0000)]
[X86] Add an avx512bw command line to the avx512-vec-cmp.ll test. Add some additional test cases.

Additional test cases cover selects with i16/i8 conditions that are only 128/256-bits wide, but the compares are 512-bits wide and can only produce k-registers. We should be able to artificially widen the selects to avoid moving the k-register to an xmm/ymm register.

llvm-svn: 322449

6 years ago[clang-format] [NFC] Remove comment
Mark Zeren [Sat, 13 Jan 2018 22:52:34 +0000 (22:52 +0000)]
[clang-format] [NFC] Remove comment

Remove inaccurate comment that came in with  r312125.

llvm-svn: 322448

6 years ago[docs] Use monospace for PCH option flags
Brian Gesiak [Sat, 13 Jan 2018 18:34:07 +0000 (18:34 +0000)]
[docs] Use monospace for PCH option flags

Summary:
Use monospace for option flags in the PCH section, instead of the
italics that were being used previously.

I believe these used to be links, for which single backticks would
have been appropriate, but since they were un-link-ified in
https://reviews.llvm.org/rL275560, I believe monospace is now more
appropriate, and so two backticks are needed.

Test Plan:
Build the `docs-clang-html` target and confirm the options are rendered
using monospace font.

Reviewers: sepavloff, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 322447

6 years agoX86: Add pattern matching for PMADDWD
Zvi Rackover [Sat, 13 Jan 2018 17:42:19 +0000 (17:42 +0000)]
X86: Add pattern matching for PMADDWD

In addition to the existing match as part of a loop-reduction, add a
straightforward pattern match for DAG-contained patterns.

Reviewers: RKSimon, craig.topper

Subscribers: llvm-commits

Reviewed By: RKSimon

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

llvm-svn: 322446

6 years ago[Driver] Add "did you mean?" suggestions to -cc1as
Brian Gesiak [Sat, 13 Jan 2018 17:09:11 +0000 (17:09 +0000)]
[Driver] Add "did you mean?" suggestions to -cc1as

Summary:
In https://reviews.llvm.org/D41733, the driver was modified such that,
when a user provided a mispelled option such as `-hel`, it would
suggest a valid option with a nearby edit distance: "did you mean
'-help'?".

Add these suggestions to invocations of `clang -cc1as` as well.

Test Plan: `check-clang`

Reviewers: v.g.vassilev, bruno

Reviewed By: v.g.vassilev

Subscribers: cfe-commits

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

llvm-svn: 322445

6 years ago[X86] Regenerate double shift tests
Simon Pilgrim [Sat, 13 Jan 2018 16:55:28 +0000 (16:55 +0000)]
[X86] Regenerate double shift tests

llvm-svn: 322444

6 years ago[clangd] Fix uninitialized-read found by asan
Sam McCall [Sat, 13 Jan 2018 16:46:26 +0000 (16:46 +0000)]
[clangd] Fix uninitialized-read found by asan

llvm-svn: 322443

6 years ago[WebAssembly] Fix build failures due to warning
Sam Clegg [Sat, 13 Jan 2018 15:59:53 +0000 (15:59 +0000)]
[WebAssembly] Fix build failures due to warning

Oops, the waterfall tests with `-Werror -Wunused-variable`.

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

llvm-svn: 322442

6 years agoRevert "[WebAssembly] Move checking of InputSegment comdat group earlier"
Sam Clegg [Sat, 13 Jan 2018 15:57:48 +0000 (15:57 +0000)]
Revert "[WebAssembly] Move checking of InputSegment comdat group earlier"

This reverts commit 7421eab7ccf2e14518f4526a084a5afc76ac9c6a.

llvm-svn: 322441

6 years ago[WebAssembly] Move checking of InputSegment comdat group earlier
Sam Clegg [Sat, 13 Jan 2018 15:44:54 +0000 (15:44 +0000)]
[WebAssembly] Move checking of InputSegment comdat group earlier

This should also fixe an unused varaible warning in the realeae
build.

llvm-svn: 322440

6 years ago[InstSimplify] fold implied null ptr check (PR35790)
Sanjay Patel [Sat, 13 Jan 2018 15:44:44 +0000 (15:44 +0000)]
[InstSimplify] fold implied null ptr check (PR35790)

This extends rL322327 to handle the pointer cast and should solve:
https://bugs.llvm.org/show_bug.cgi?id=35790

Name: or_eq_zero
  %isnull = icmp eq i64* %p, null
  %x = ptrtoint i64* %p to i64
  %somebits = and i64 %x, %y
  %somebits_are_zero = icmp eq i64 %somebits, 0
  %or = or i1 %somebits_are_zero, %isnull
  =>
  %or = %somebits_are_zero

Name: and_ne_zero
  %isnotnull = icmp ne i64* %p, null
  %x = ptrtoint i64* %p to i64
  %somebits = and i64 %x, %y
  %somebits_are_not_zero = icmp ne i64 %somebits, 0
  %and = and i1 %somebits_are_not_zero, %isnotnull
  =>
  %and = %somebits_are_not_zero

https://rise4fun.com/Alive/CQ3

llvm-svn: 322439

6 years ago[Sema] Fix crash for type-dependent base classes
Jan Korous [Sat, 13 Jan 2018 15:24:16 +0000 (15:24 +0000)]
[Sema] Fix crash for type-dependent base classes

llvm-svn: 322438

6 years ago[Sanitizers, LSan, Darwin] Allow for lack of VM_MEMORY_OS_ALLOC_ONCE
Francis Ricci [Sat, 13 Jan 2018 14:43:49 +0000 (14:43 +0000)]
[Sanitizers, LSan, Darwin] Allow for lack of VM_MEMORY_OS_ALLOC_ONCE

Summary:
Some time ago, the sanitizers as of r315899 were imported into gcc mainline.  This broke
bootstrap on Darwin 10 and 11, as reported in GCC PR sanitizer/82824
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82824) due to the unconditional use
of VM_MEMORY_OS_ALLOC_ONCE.  This was only introduced in Darwin 13/Mac OS X 10.9.

The use of the macro was introduced in r300450.

I couldn't find any statement which Darwin versions are supposed to be supported by
LLVM, but the trivial patch to use the macro only if present allowed the gcc bootstrap
to finish.

So far, I haven't tried building llvm/compiler-rt  on Darwin 11.  Maybe the patch is
simple enough to go in nonetheless.

Committing on behalf of ro.

Reviewers: glider, fjricci, kcc, kuba, kubamracek, george.karpenkov

Reviewed By: fjricci

Subscribers: #sanitizers, zaks.anna, srhines, dberris, kubamracek, llvm-commits

Tags: #sanitizers

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

llvm-svn: 322437

6 years ago[X86][MMX] Add test for MMX zero folding
Simon Pilgrim [Sat, 13 Jan 2018 12:29:06 +0000 (12:29 +0000)]
[X86][MMX] Add test for MMX zero folding

As discussed in D41908

llvm-svn: 322436

6 years agoFix test/Driver/riscv32-toolchain.c for builds setting CLANG_DEFAULT_LINKER
Alex Bradbury [Sat, 13 Jan 2018 09:21:11 +0000 (09:21 +0000)]
Fix test/Driver/riscv32-toolchain.c for builds setting CLANG_DEFAULT_LINKER

Petr Hosek reported an external buildbot was failing on riscv32-toolchain.c,
seemingly as it set CLANG_DEFAULT_LINKER to lld. Address this by explicitly
setting -fuse-ld=ld in the tests.

llvm-svn: 322435

6 years agoX86 Tests: add more pamddwd cases. NFC
Zvi Rackover [Sat, 13 Jan 2018 08:21:29 +0000 (08:21 +0000)]
X86 Tests: add more pamddwd cases. NFC

Improve coverage of D41811

llvm-svn: 322434

6 years ago[lldb] Add support to cache a PDB's global scope and fix a bug in getting the source...
Aaron Smith [Sat, 13 Jan 2018 06:58:18 +0000 (06:58 +0000)]
[lldb] Add support to cache a PDB's global scope and fix a bug in getting the source file name for a compiland

Summary:
This commit is a combination of the following changes:

- Cache PDB's global scope (executable) in SymbolFilePDB

- Change naming of `cu` to `compiland` which is PDB specific

- Change ParseCompileUnitForSymIndex to ParseCompileUnitForUID.
   Prefer using a common name `UID` instead of PDB's `System Index`
   Adding one more argument `index` to this method, which is used to
   specify the index of the compile unit in a cached compile unit array

- Add GetPDBCompilandByUID method to simply code

- Fix a bug in getting the source file name for a PDB compiland.
   For some reason, PDBSymbolCompiland::getSourceFileName() could
   return an empty name, so if that is true, we have to walk through all
   source files of this compiland and determine the right source file
   used to generate this compiland based on language indicated.

   The previous implementation called PDBSession::findOneSourceFile
   method to get its name for the compiland. This is not accurate since
   the `one source file` found could be a header other than source file.

Reviewers: zturner, lldb-commits

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 322433

6 years ago[X86] Add DAG combine to promote vXi1 result of a vXi8/vXi16 setcc when we have AVX51...
Craig Topper [Sat, 13 Jan 2018 06:24:46 +0000 (06:24 +0000)]
[X86] Add DAG combine to promote vXi1 result of a vXi8/vXi16 setcc when we have AVX512 but not BWI.

This avoids having the result type stick around until lowering where we have to extend the setcc and insert a truncate. If we get the types converted early we can do more to optimize it.

llvm-svn: 322432

6 years agoDR126: partially implement the const-correct rules for exception handler matching.
Richard Smith [Sat, 13 Jan 2018 05:05:45 +0000 (05:05 +0000)]
DR126: partially implement the const-correct rules for exception handler matching.

While here, fix up the myriad other ways in which Sema's two "can this handler
catch that exception?" implementations get things wrong and unify them.

llvm-svn: 322431

6 years agoXFAIL a test on Darwin, line-table stuck on DWARF 2
Paul Robinson [Sat, 13 Jan 2018 01:39:30 +0000 (01:39 +0000)]
XFAIL a test on Darwin, line-table stuck on DWARF 2

llvm-svn: 322430

6 years ago[hwasan] An LLVM flag to disable stack tag randomization.
Evgeniy Stepanov [Sat, 13 Jan 2018 01:32:15 +0000 (01:32 +0000)]
[hwasan] An LLVM flag to disable stack tag randomization.

Summary: Necessary to achieve consistent test results.

Reviewers: kcc, alekseyshl

Subscribers: kubamracek, llvm-commits, hiraditya

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

llvm-svn: 322429

6 years agoRevert "[SanitizerCoverage][Fuchsia] Make TracePcGuardController linker-initialized"
Petr Hosek [Sat, 13 Jan 2018 00:56:28 +0000 (00:56 +0000)]
Revert "[SanitizerCoverage][Fuchsia] Make TracePcGuardController linker-initialized"

This reverts commit r322424: this broke the tsan lint check.

llvm-svn: 322428

6 years agoRemove unused addIfPresent function.
Eric Christopher [Sat, 13 Jan 2018 00:46:47 +0000 (00:46 +0000)]
Remove unused addIfPresent function.

llvm-svn: 322427

6 years agoRemove extraneous semicolon.
Eric Christopher [Sat, 13 Jan 2018 00:44:45 +0000 (00:44 +0000)]
Remove extraneous semicolon.

llvm-svn: 322426

6 years ago[MachineOutliner] Move hasAddressTaken check to MachineOutliner.cpp
Jessica Paquette [Sat, 13 Jan 2018 00:42:28 +0000 (00:42 +0000)]
[MachineOutliner] Move hasAddressTaken check to MachineOutliner.cpp

*Mostly* NFC. Still updating the test though just for completeness.

This moves the hasAddressTaken check to MachineOutliner.cpp and replaces it
with a per-basic block test rather than a per-function test. The old test was
too conservative and was preventing functions in C programs from being
outlined even though they were safe to outline.

This was mostly a problem in C sources.

llvm-svn: 322425