platform/upstream/llvm.git
7 years agoInitialize members not by assignment but by the member initializer list.
Rui Ueyama [Sun, 29 Oct 2017 22:26:52 +0000 (22:26 +0000)]
Initialize members not by assignment but by the member initializer list.

llvm-svn: 316876

7 years ago[SelectionDAG] Add SEXT/AND/XOR/Or demanded elts support to ComputeNumSignBits
Simon Pilgrim [Sun, 29 Oct 2017 22:03:37 +0000 (22:03 +0000)]
[SelectionDAG] Add SEXT/AND/XOR/Or demanded elts support to ComputeNumSignBits

llvm-svn: 316875

7 years agoInitial triage
Marshall Clow [Sun, 29 Oct 2017 21:57:58 +0000 (21:57 +0000)]
Initial triage

llvm-svn: 316874

7 years agoUpdate status of 2950
Marshall Clow [Sun, 29 Oct 2017 21:43:30 +0000 (21:43 +0000)]
Update status of 2950

llvm-svn: 316873

7 years ago[Acc] Do not statically dispatch into IslNodeBuilder's createFor
Philip Pfaffe [Sun, 29 Oct 2017 21:36:34 +0000 (21:36 +0000)]
[Acc] Do not statically dispatch into IslNodeBuilder's createFor

Summary:
When GPUNodeBuilder creates loops inside the kernel, it dispatches to
IslNodeBuilder. This however is surprisingly dangerous, since it accesses the
AST Node's user through the wrong type. This patch fixes this problem by
overriding createFor correctly.

This fixes PR35010.

Reviewers: grosser, bollu, Meinersbur

Reviewed By: Meinersbur

Subscribers: Meinersbur, nemanjai, pollydev, llvm-commits, kbarton

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

llvm-svn: 316872

7 years ago[X86][SSE] Split ComputeNumSignBits SEXT/AND/XOR/OR demandedelts test
Simon Pilgrim [Sun, 29 Oct 2017 21:35:28 +0000 (21:35 +0000)]
[X86][SSE] Split ComputeNumSignBits SEXT/AND/XOR/OR demandedelts test

Max depth was being exceeded which could prevent some combines working

llvm-svn: 316871

7 years agoFix two testcases. NFC intended.
Philip Pfaffe [Sun, 29 Oct 2017 21:00:48 +0000 (21:00 +0000)]
Fix two testcases. NFC intended.

Add missing %loadPolly directive to support out of tree builds. One of
the changes is somewhat bigger, because the directive turns on LLVM
names, and the testcase deosn't use those.

llvm-svn: 316870

7 years ago[(new) Pass Manager] instantiate SimplifyCFG with the same options as the old PM
Sanjay Patel [Sun, 29 Oct 2017 20:49:31 +0000 (20:49 +0000)]
[(new) Pass Manager] instantiate SimplifyCFG with the same options as the old PM

The old PM sets the options of what used to be known as "latesimplifycfg" on the
instantiation after the vectorizers have run, so that's what we'redoing here.

FWIW, there's a later SimplifyCFGPass instantiation in both PMs where we do not
set the "late" options. I'm not sure if that's intentional or not.

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

llvm-svn: 316869

7 years ago[X86][SSE] ComputeNumSignBits tests showing missing SEXT/AND/XOR/OR demandedelts...
Simon Pilgrim [Sun, 29 Oct 2017 20:49:27 +0000 (20:49 +0000)]
[X86][SSE] ComputeNumSignBits tests showing missing SEXT/AND/XOR/OR demandedelts support

llvm-svn: 316868

7 years agoIssues to be voted on in ABQ
Marshall Clow [Sun, 29 Oct 2017 19:02:00 +0000 (19:02 +0000)]
Issues to be voted on in ABQ

llvm-svn: 316867

7 years ago[SelectionDAG] Add SRA/SHL demanded elts support to ComputeNumSignBits
Simon Pilgrim [Sun, 29 Oct 2017 18:19:37 +0000 (18:19 +0000)]
[SelectionDAG] Add SRA/SHL demanded elts support to ComputeNumSignBits

Introduce a isConstOrDemandedConstSplat helper function that can recognise a constant splat build vector for at least the demanded elts we care about.

llvm-svn: 316866

7 years ago[X86][SSE] ComputeNumSignBits tests showing missing SHL/SRA demandedelts support
Simon Pilgrim [Sun, 29 Oct 2017 18:01:31 +0000 (18:01 +0000)]
[X86][SSE] ComputeNumSignBits tests showing missing SHL/SRA demandedelts support

llvm-svn: 316865

7 years ago[X86] Add a slow-incdec command line to atomic-eflags-reuse.ll
Craig Topper [Sun, 29 Oct 2017 17:15:09 +0000 (17:15 +0000)]
[X86] Add a slow-incdec command line to atomic-eflags-reuse.ll

I believe the test_sub_1_cmp_1_setcc_ugt test case is being miscompiled in the fast inc/dec case.

llvm-svn: 316864

7 years agoFix ubsan error that shift amount 64 is too large.
Rui Ueyama [Sun, 29 Oct 2017 16:49:42 +0000 (16:49 +0000)]
Fix ubsan error that shift amount 64 is too large.

llvm-svn: 316863

7 years agoRemove a redundant temporary variable.
Rui Ueyama [Sun, 29 Oct 2017 16:46:39 +0000 (16:46 +0000)]
Remove a redundant temporary variable.

llvm-svn: 316862

7 years ago[X86] Remove combine that turns X86ISD::LSUB into X86ISD::LADD. Update patterns that...
Craig Topper [Sun, 29 Oct 2017 06:51:04 +0000 (06:51 +0000)]
[X86] Remove combine that turns X86ISD::LSUB into X86ISD::LADD. Update patterns that depended on this.

If the carry flag is being used, this transformation isn't safe.

This does prevent some test cases from using DEC now, but I'll try to look into that separately.

Fixes PR35068.

llvm-svn: 316860

7 years ago[X86] Fix typo in comment. NFC
Craig Topper [Sun, 29 Oct 2017 06:51:02 +0000 (06:51 +0000)]
[X86] Fix typo in comment. NFC

llvm-svn: 316859

7 years agoDriver: default to `unsigned int` `wchar_t` for ARM
Saleem Abdulrasool [Sun, 29 Oct 2017 06:01:14 +0000 (06:01 +0000)]
Driver: default to `unsigned int` `wchar_t` for ARM

AAPCS and AAPCS64 mandate that `wchar_t` with `-fno-short-wchar` is an
`unsigned int` rather than a `signed int`.  Ensure that the driver does
not flip the signedness of `wchar_t` for those targets.

Add additional tests to ensure that this does not regress.

llvm-svn: 316858

7 years ago[X86] Use the extended vector register classes in fast isel with AVX512F/VL.
Craig Topper [Sun, 29 Oct 2017 05:14:26 +0000 (05:14 +0000)]
[X86] Use the extended vector register classes in fast isel with AVX512F/VL.

llvm-svn: 316857

7 years ago[X86] Add AVX512 support to X86FastISel::X86SelectFPExt and X86FastISel::X86SelectFPT...
Craig Topper [Sun, 29 Oct 2017 02:50:31 +0000 (02:50 +0000)]
[X86] Add AVX512 support to X86FastISel::X86SelectFPExt and X86FastISel::X86SelectFPTrunc.

llvm-svn: 316856

7 years ago[X86] Use update_llc_test_checks.py to regenerate fast-isel-int-float-conversion.ll
Craig Topper [Sun, 29 Oct 2017 02:25:48 +0000 (02:25 +0000)]
[X86] Use update_llc_test_checks.py to regenerate fast-isel-int-float-conversion.ll

llvm-svn: 316855

7 years ago[X86] Use update_llc_test_checks.py to regenerate fast-isel-fptrunc-fpext.ll
Craig Topper [Sun, 29 Oct 2017 02:18:43 +0000 (02:18 +0000)]
[X86] Use update_llc_test_checks.py to regenerate fast-isel-fptrunc-fpext.ll

llvm-svn: 316854

7 years ago[X86] Add AVX512 support to X86FastISel::X86MaterializeFP
Craig Topper [Sun, 29 Oct 2017 02:18:41 +0000 (02:18 +0000)]
[X86] Add AVX512 support to X86FastISel::X86MaterializeFP

llvm-svn: 316853

7 years ago[analyzer] MisusedMovedObjectChecker: More precise warning message
Peter Szecsi [Sat, 28 Oct 2017 23:24:00 +0000 (23:24 +0000)]
[analyzer] MisusedMovedObjectChecker: More precise warning message

Added new enum in order to differentiate the warning messages on "misusing" into
3 categories: function calls, moving an object, copying an object. (At the
moment the checker gives the same message in case of copying and moving.)

Additional test cases added as well.

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

llvm-svn: 316852

7 years ago[X86] Remove invalid code from LowerVSELECT.
Craig Topper [Sat, 28 Oct 2017 23:10:13 +0000 (23:10 +0000)]
[X86] Remove invalid code from LowerVSELECT.

This code attempted to say that v8i16/v16i16 VSELECT is legal if BWI and VLX are enabled, but the only way we could reach this point is if the condition was not a vXi1 type. Which means it really wasn't legal.

We don't have any tests that exercise this code. So I'm hoping it wasn't really reachable.

llvm-svn: 316851

7 years ago[analyzer] MisusedMovedObjectChecker: Fix false positive on state-resetting, handling...
Peter Szecsi [Sat, 28 Oct 2017 23:09:37 +0000 (23:09 +0000)]
[analyzer] MisusedMovedObjectChecker: Fix false positive on state-resetting, handling method calls on base-class sub-objects

An earlier solution from Artem r315301 solves the reset problem, however, the
reports should be handled the same way in case of method calls. We should not
just report the base class of the object where the method was defined but the
whole object.

Fixed false positive which came from not removing the subobjects in case of a
state-resetting function. (Just replaced the State->remove(...) call to
removeFromState(..) which was defined exactly for that purpose.)

Some minor typos fixed in this patch as well which did not worth a whole new
patch in my opinion, so included them here.

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

llvm-svn: 316850

7 years agoFix ubsan error.
Rui Ueyama [Sat, 28 Oct 2017 22:18:29 +0000 (22:18 +0000)]
Fix ubsan error.

This patch fixes ubsan's "shift exponent 64 is too large for 32-bit type
'int'" error.

llvm-svn: 316849

7 years agoReduce sizeof(Symbol) from 104 bytes to 88 bytes.
Rui Ueyama [Sat, 28 Oct 2017 22:18:17 +0000 (22:18 +0000)]
Reduce sizeof(Symbol) from 104 bytes to 88 bytes.

Finding aliases for shared symbols doesn't need st_shndx because
we can just compare st_value.

llvm-svn: 316848

7 years ago[SelectionDAG] Add support for INSERT_SUBVECTOR to computeKnownBits
Simon Pilgrim [Sat, 28 Oct 2017 22:10:40 +0000 (22:10 +0000)]
[SelectionDAG] Add support for INSERT_SUBVECTOR to computeKnownBits

llvm-svn: 316847

7 years agoDo not handle DefinedCommon symbols in the MapFile writer.
Rui Ueyama [Sat, 28 Oct 2017 21:11:38 +0000 (21:11 +0000)]
Do not handle DefinedCommon symbols in the MapFile writer.

Because of r314495 which converts DefinedCommon symbols to DefinedRegular
symbols, common symbols are no longer reachable to the MapFile writer.
So the code to handle common symbols is now dead.

llvm-svn: 316846

7 years ago[X86][SSE] Combine 128-bit target shuffles to PACKSS/PACKUS.
Simon Pilgrim [Sat, 28 Oct 2017 20:51:27 +0000 (20:51 +0000)]
[X86][SSE] Combine 128-bit target shuffles to PACKSS/PACKUS.

llvm-svn: 316845

7 years ago[X86][SSE] Split off matchVectorShuffleWithPACK. NFCI.
Simon Pilgrim [Sat, 28 Oct 2017 20:27:22 +0000 (20:27 +0000)]
[X86][SSE] Split off matchVectorShuffleWithPACK. NFCI.

Split matchVectorShuffleWithPACK from lowerVectorShuffleWithPACK so that we can reuse it for target shuffle combines

llvm-svn: 316844

7 years agoRestore arch specific lastDwarfRegNum in builds without _LIBUNWIND_IS_NATIVE_ONLY
Martin Storsjo [Sat, 28 Oct 2017 20:19:49 +0000 (20:19 +0000)]
Restore arch specific lastDwarfRegNum in builds without _LIBUNWIND_IS_NATIVE_ONLY

This restores the previous behaviour of the Registers_* classes
after SVN r316745.

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

llvm-svn: 316843

7 years agoRename V -> Ver for readability.
Rui Ueyama [Sat, 28 Oct 2017 20:16:11 +0000 (20:16 +0000)]
Rename V -> Ver for readability.

llvm-svn: 316842

7 years agoPass symbol attributes instead of ElfSym to Shared symbol ctor.
Rui Ueyama [Sat, 28 Oct 2017 20:15:56 +0000 (20:15 +0000)]
Pass symbol attributes instead of ElfSym to Shared symbol ctor.

This change allows us to use less templates for Shared symbol and
the functions that deals with shared symbols.

llvm-svn: 316841

7 years ago[X86] Fix a mistake in the X86ISelDAGToDAG.cpp code for MUL8r/IMUL8r.
Craig Topper [Sat, 28 Oct 2017 19:56:57 +0000 (19:56 +0000)]
[X86] Fix a mistake in the X86ISelDAGToDAG.cpp code for MUL8r/IMUL8r.

I think this code is unreachable due to some promotions that occur elsewhere. I'll look into that to be sure, but for now I thought I should at least fix the obvious typo.

llvm-svn: 316840

7 years ago[X86] Replace some default cases in X86SelectShift with llvm_unreachable.
Craig Topper [Sat, 28 Oct 2017 19:56:56 +0000 (19:56 +0000)]
[X86] Replace some default cases in X86SelectShift with llvm_unreachable.

llvm-svn: 316839

7 years agoADT: add a helper to check if the Triple is ARM64
Saleem Abdulrasool [Sat, 28 Oct 2017 19:15:05 +0000 (19:15 +0000)]
ADT: add a helper to check if the Triple is ARM64

Add a trivial helper for checking if the architecture is AArch64 Little
Endian or Big Endian.

llvm-svn: 316837

7 years agoPR35039: Materialize temporary objects before wrapping them in an
Richard Smith [Sat, 28 Oct 2017 18:59:51 +0000 (18:59 +0000)]
PR35039: Materialize temporary objects before wrapping them in an
OpaqueValueExpr in a GNU binary conditional expression.

It's not meaningful for a non-materialized temporary object to be used as a
common subexpression of multiple expressions.

llvm-svn: 316836

7 years ago[SimplifyCFG] use pass options and remove the latesimplifycfg pass
Sanjay Patel [Sat, 28 Oct 2017 18:43:07 +0000 (18:43 +0000)]
[SimplifyCFG] use pass options and remove the latesimplifycfg pass

This is no-functional-change-intended.

This is repackaging the functionality of D30333 (defer switch-to-lookup-tables) and
D35411 (defer folding unconditional branches) with pass parameters rather than a named
"latesimplifycfg" pass. Now that we have individual options to control the functionality,
we could decouple when these fire (but that's an independent patch if desired).

The next planned step would be to add another option bit to disable the sinking transform
mentioned in D38566. This should also make it clear that the new pass manager needs to
be updated to limit simplifycfg in the same way as the old pass manager.

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

llvm-svn: 316835

7 years ago[X86][SSE] Rename truncateVectorCompareWithPACKSS to truncateVectorWithPACKSS. NFC.
Simon Pilgrim [Sat, 28 Oct 2017 17:59:56 +0000 (17:59 +0000)]
[X86][SSE] Rename truncateVectorCompareWithPACKSS to truncateVectorWithPACKSS. NFC.

We no longer rely on the vector source being a comparison result, just have sufficient sign bits.

llvm-svn: 316834

7 years ago[X86] Correct the alignments on the aligned test cases in fast-isel-vecload.ll to...
Craig Topper [Sat, 28 Oct 2017 17:37:51 +0000 (17:37 +0000)]
[X86] Correct the alignments on the aligned test cases in fast-isel-vecload.ll to make sure they test selection of aligned loads.

llvm-svn: 316833

7 years ago[clangd] Fix clang-tidy warnings.
Benjamin Kramer [Sat, 28 Oct 2017 17:32:56 +0000 (17:32 +0000)]
[clangd] Fix clang-tidy warnings.

No functionality change intended.

llvm-svn: 316832

7 years ago[SelectionDAG] Support 'bit preserving' floating points bitcasts on computeKnownBits...
Simon Pilgrim [Sat, 28 Oct 2017 14:27:53 +0000 (14:27 +0000)]
[SelectionDAG] Support 'bit preserving' floating points bitcasts on computeKnownBits/ComputeNumSignBits

For cases where we know the floating point representations match the bitcasted integer equivalent, allow bitcasting to these types.

This is especially useful for the X86 floating point compare results which return all/zero bits but as a floating point type.

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

llvm-svn: 316831

7 years ago[analyzer] LoopUnrolling: check the bitwidth of the used numbers (pr34943)
Peter Szecsi [Sat, 28 Oct 2017 12:19:08 +0000 (12:19 +0000)]
[analyzer] LoopUnrolling: check the bitwidth of the used numbers (pr34943)

The loop unrolling feature aims to track the maximum possible steps a loop can
make. In order to implement this, it investigates the initial value of the
counter variable and the bound number. (It has to be known.)
These numbers are used as llvm::APInts, however, it was not checked if their
bitwidths are the same which lead to some crashes.
This revision solves this problem by extending the "shorter" one (to the length
of the "longer" one).
For the detailed bug report, see: https://bugs.llvm.org/show_bug.cgi?id=34943

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

llvm-svn: 316830

7 years ago[X86] Add avx command lines to fast-isel-constpool.ll to improve coverage.
Craig Topper [Sat, 28 Oct 2017 06:31:48 +0000 (06:31 +0000)]
[X86] Add avx command lines to fast-isel-constpool.ll to improve coverage.

llvm-svn: 316829

7 years ago[X86] Use update_llc_test_checks.py to regenerate fast-isel-constpool.ll
Craig Topper [Sat, 28 Oct 2017 06:31:46 +0000 (06:31 +0000)]
[X86] Use update_llc_test_checks.py to regenerate fast-isel-constpool.ll

llvm-svn: 316828

7 years ago[X86] Add a fast-isel test for the i8 pseudo cmov.
Craig Topper [Sat, 28 Oct 2017 06:10:03 +0000 (06:10 +0000)]
[X86] Add a fast-isel test for the i8 pseudo cmov.

llvm-svn: 316827

7 years agoBasic: improve coverage for Darwin targets and fix ABI
Saleem Abdulrasool [Sat, 28 Oct 2017 06:00:43 +0000 (06:00 +0000)]
Basic: improve coverage for Darwin targets and fix ABI

The existing coverage for the Darwin targets wasn't enough to catch all
the variations.  Improve the coverage a bit further and fix a few cases
for Darwin targets.

llvm-svn: 316826

7 years ago[X86] Remove unneeded MVT::i1 related code from fast isel.
Craig Topper [Sat, 28 Oct 2017 05:52:23 +0000 (05:52 +0000)]
[X86] Remove unneeded MVT::i1 related code from fast isel.

llvm-svn: 316825

7 years ago[ConstantFold] Fix a crash when folding a GEP that has vector index
Haicheng Wu [Sat, 28 Oct 2017 02:27:14 +0000 (02:27 +0000)]
[ConstantFold] Fix a crash when folding a GEP that has vector index

LLVM crashes when factoring out an out-of-bound index into preceding dimension
and the preceding dimension uses vector index.  Simply bail out now when this
case happens.

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

llvm-svn: 316824

7 years ago[X86] Add avx command lines to two fast-isel tests to get coverage of selecting vucom...
Craig Topper [Sat, 28 Oct 2017 02:03:59 +0000 (02:03 +0000)]
[X86] Add avx command lines to two fast-isel tests to get coverage of selecting vucomiss/vucomisd.

The selection of these shows up as a code coverage hole when looking at the llvm-cov link on llvm.org

llvm-svn: 316823

7 years ago[X86] Use update_llc_test_checks.py to regenerate fast-isel-select-cmov2.ll
Craig Topper [Sat, 28 Oct 2017 02:03:58 +0000 (02:03 +0000)]
[X86] Use update_llc_test_checks.py to regenerate fast-isel-select-cmov2.ll

llvm-svn: 316822

7 years ago[XRay] [compiler-rt] fix build by including errno.h into FDR mode
Martin Pelikan [Sat, 28 Oct 2017 01:35:07 +0000 (01:35 +0000)]
[XRay] [compiler-rt] fix build by including errno.h into FDR mode

The build got broken after D39277 (and rL316816) deleted <cerrno>.

llvm-svn: 316821

7 years agoNever try to instantiate a deduction guide's "definition". Fixes bogus warning when...
Richard Smith [Sat, 28 Oct 2017 01:15:00 +0000 (01:15 +0000)]
Never try to instantiate a deduction guide's "definition". Fixes bogus warning when there inevitably isn't one.

llvm-svn: 316820

7 years ago[PartialInlineLibCalls] Teach PartialInlineLibCalls to honor nobuiltin, properly...
Craig Topper [Sat, 28 Oct 2017 00:36:58 +0000 (00:36 +0000)]
[PartialInlineLibCalls] Teach PartialInlineLibCalls to honor nobuiltin, properly check the function signature, and check TLI::has

Summary:
We shouldn't do this transformation if the function is marked nobuitlin.

We were only checking that the return type is floating point, we really should be checking the argument types and argument count as well. This can be accomplished by using the other version of getLibFunc that takes the Function and not just the name.

We should also be checking TLI::has since sqrtf is a macro on Windows.

Fixes PR32559.

Reviewers: hfinkel, spatel, davide, efriedma

Reviewed By: davide, efriedma

Subscribers: efriedma, llvm-commits, eraman

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

llvm-svn: 316819

7 years ago[ADT] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Sat, 28 Oct 2017 00:24:26 +0000 (00:24 +0000)]
[ADT] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 316818

7 years agoSimplify error handling.
Rui Ueyama [Sat, 28 Oct 2017 00:05:12 +0000 (00:05 +0000)]
Simplify error handling.

I don't think we have to aim for precise bug compatibility.
We can return a nullptr if a section is consumed by the linker, and
the rest should naturally work.

llvm-svn: 316817

7 years ago[XRay][compiler-rt] Remove more STL dependenices from FDR mode
Dean Michael Berris [Fri, 27 Oct 2017 23:59:41 +0000 (23:59 +0000)]
[XRay][compiler-rt] Remove more STL dependenices from FDR mode

Summary:
This change removes dependencies on STL types:

  - std::aligned_storage -- we're using manually-aligned character
    buffers instead for metadata and function records.

  - std::tuple -- use a plain old struct instead.

This is an incremental step in removing all STL references from the
compiler-rt implementation of XRay (llvm.org/PR32274).

Reviewers: dblaikie, pelikan, kpw

Subscribers: llvm-commits

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

llvm-svn: 316816

7 years agoAMDGPU/GlobalISel: Mark 32-bit G_FADD as legal
Tom Stellard [Fri, 27 Oct 2017 23:57:41 +0000 (23:57 +0000)]
AMDGPU/GlobalISel: Mark 32-bit G_FADD as legal

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, igorb, dstuttard, tpr, t-tye, llvm-commits

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

llvm-svn: 316815

7 years ago[support] remove tautological comparison in Support/Windows/Path.inc
Bob Haarman [Fri, 27 Oct 2017 23:41:17 +0000 (23:41 +0000)]
[support] remove tautological comparison in Support/Windows/Path.inc

Summary:
The removed code checks that we are able to handle a 64-bit number, but
the code we're calling takes two dwords (for a total of 64 bits), so this
is always true.

Reviewers: zturner, rnk, majnemer, compnerd

Reviewed By: zturner

Subscribers: amccarth, hiraditya, lebedev.ri, llvm-commits

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

llvm-svn: 316814

7 years agoRevert "Add support for writing 64-bit symbol tables for archives when offsets become...
Jake Ehrlich [Fri, 27 Oct 2017 23:39:31 +0000 (23:39 +0000)]
Revert "Add support for writing 64-bit symbol tables for archives when offsets become too large for 32-bit"

This reverts commit r316805.

llvm-svn: 316813

7 years agoRemove unnecessary namespace specifiers.
Rui Ueyama [Fri, 27 Oct 2017 23:29:58 +0000 (23:29 +0000)]
Remove unnecessary namespace specifiers.

llvm-svn: 316812

7 years agoInline trivial symbol constructors.
Rui Ueyama [Fri, 27 Oct 2017 23:26:46 +0000 (23:26 +0000)]
Inline trivial symbol constructors.

llvm-svn: 316811

7 years agoARM: centralise SizeType, PtrDiffType, and IntPtrType
Saleem Abdulrasool [Fri, 27 Oct 2017 23:04:27 +0000 (23:04 +0000)]
ARM: centralise SizeType, PtrDiffType, and IntPtrType

Centralise the definitions of these compiler vended types to aid
inspection to ensure that they are defined similarly.  The one case that
stands out is the Darwin case where the types do not match up.  This
fixes the API conformance for APCS-GNU as well.

llvm-svn: 316810

7 years agoRename isInCurrentDSO -> isInCurrentOutput.
Rui Ueyama [Fri, 27 Oct 2017 22:54:16 +0000 (22:54 +0000)]
Rename isInCurrentDSO -> isInCurrentOutput.

DSO is short for dynamic shared object, so the function name was a
little confusing because it sounded like it didn't work when we were
a creating statically-linked executable or something.

What we mean by "DSO" here is the current output file that we are
creating. Thus the new name. Alternatively, we could call it the current
ELF module, but "module" is a overloaded word, so I avoided that.

llvm-svn: 316809

7 years ago[Analyzer] [Tests] Fixing typo from the previous commit.
George Karpenkov [Fri, 27 Oct 2017 22:52:36 +0000 (22:52 +0000)]
[Analyzer] [Tests] Fixing typo from the previous commit.

Can not open a non-existent file with r+.

llvm-svn: 316808

7 years ago[MS] Allow access to ambiguous, inaccessible direct bases
Reid Kleckner [Fri, 27 Oct 2017 22:48:41 +0000 (22:48 +0000)]
[MS] Allow access to ambiguous, inaccessible direct bases

Summary:
Clang typically warns that in the following class hierarchy, 'A' is
inaccessible because there is no series of casts that the user can
write to access it unambiguously:
  struct A { };
  struct B : A { };
  struct C : A, B { };

MSVC allows the user to convert from C* to A*, though, and we've
encountered this issue in the latest Windows SDK headers.

This patch allows this conversion when -fms-compatibility is set and
adds a warning for it under -Wmicrosoft-inaccessible-base.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 316807

7 years ago[Analyzer] [Tests] Dump the output of scan-build to stdout on failure.
George Karpenkov [Fri, 27 Oct 2017 22:39:54 +0000 (22:39 +0000)]
[Analyzer] [Tests] Dump the output of scan-build to stdout on failure.

Eliminates extra lookup step during debugging.

llvm-svn: 316806

7 years agoAdd support for writing 64-bit symbol tables for archives when offsets become too...
Jake Ehrlich [Fri, 27 Oct 2017 22:26:37 +0000 (22:26 +0000)]
Add support for writing 64-bit symbol tables for archives when offsets become too large for 32-bit

This should fix https://bugs.llvm.org//show_bug.cgi?id=34189

This change makes it so that if writing a K_GNU style archive, you need
to output a > 32-bit offset it should output in K_GNU64 style instead.

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

llvm-svn: 316805

7 years ago[Hexagon] Adjust patterns to reflect instruction selection preferences
Krzysztof Parzyszek [Fri, 27 Oct 2017 22:24:49 +0000 (22:24 +0000)]
[Hexagon] Adjust patterns to reflect instruction selection preferences

llvm-svn: 316804

7 years agoAdd a few missing headers for modularization/IWYU/etc
David Blaikie [Fri, 27 Oct 2017 22:12:46 +0000 (22:12 +0000)]
Add a few missing headers for modularization/IWYU/etc

Several cases where class definitions are required for DenseMap pointer
traits handling.

llvm-svn: 316803

7 years ago[DAGCombine] Don't combine sext with extload if sextload is not supported and extload...
Guozhi Wei [Fri, 27 Oct 2017 21:54:24 +0000 (21:54 +0000)]
[DAGCombine] Don't combine sext with extload if sextload is not supported and extload has multi users

In function DAGCombiner::visitSIGN_EXTEND_INREG, sext can be combined with extload even if sextload is not supported by target, then

  if sext is the only user of extload, there is no big difference, no harm no benefit.
  if extload has more than one user, the combined sextload may block extload from combining with other zext, causes extra zext instructions generated. As demonstrated by the attached test case.

This patch add the constraint that when sextload is not supported by target, sext can only be combined with extload if it is the only user of extload.

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

llvm-svn: 316802

7 years agoMake 32-bit member offset in Archive::Symbol::getMember 64-bit
Jake Ehrlich [Fri, 27 Oct 2017 21:47:38 +0000 (21:47 +0000)]
Make 32-bit member offset in Archive::Symbol::getMember 64-bit

When accessing a member for a symbol with an offset greater than 2^32 -
1 the current Archive::Symbol::getMember implementation will overflow
and cause unexpected behavior. This change simply fixes that. In
particular if you call "llvm-nm --print-armap" on an archive that has
this behavior you'll get an error.

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

llvm-svn: 316801

7 years ago[CMake] Build clang as dependency when using in-tree clang for tests.
Davide Italiano [Fri, 27 Oct 2017 21:22:57 +0000 (21:22 +0000)]
[CMake] Build clang as dependency when using in-tree clang for tests.

Discussed with Zachary Turner and Pavel Labath on lldb-dev.
Let's hope this doesn't break anything :)

llvm-svn: 316800

7 years agoHandle undefined weak hidden symbols on all architectures.
Rafael Espindola [Fri, 27 Oct 2017 21:18:48 +0000 (21:18 +0000)]
Handle undefined weak hidden symbols on all architectures.

We were handling the non-hidden case in lib/Target/TargetMachine.cpp,
but the hidden case was handled in architecture dependent code and
only X86_64 and AArch64 were covered.

While it is true that some code sequences in some ABIs might be able
to produce the correct value at runtime, that doesn't seem to be the
common case.

I left the AArch64 code in place since it also forces a got access for
non-pic code. It is not clear if that is needed, but it is probably
better to change that in another commit.

llvm-svn: 316799

7 years agoForce #define GTEST_LANG_CXX11.
Zachary Turner [Fri, 27 Oct 2017 21:12:28 +0000 (21:12 +0000)]
Force #define GTEST_LANG_CXX11.

gtest depends on this #define to determine whether it can
use various classes like std::tuple, or whether it has to fall
back to experimental classes in the std::tr1 namespace.  The
check in the current version of gtest relies on the value of
the `__cplusplus` macro, but MSVC provides a non-conformant
value of this macro, making it effectively impossible to detect
C++11.  In short, LLVM compiled with MSVC has been silently
using the tr1 versions of several classes since the beginning of
time.

This would normally be pretty benign, except that in the latest
preview of MSVC they have marked all of the tr1 classes
deprecated, so it spews thousands of warnings.

llvm-svn: 316798

7 years ago[X86] Remove fast-isel code for handling i8 shifts. This is handled by auto generated...
Craig Topper [Fri, 27 Oct 2017 21:00:59 +0000 (21:00 +0000)]
[X86] Remove fast-isel code for handling i8 shifts. This is handled by auto generated code.

llvm-svn: 316797

7 years ago[X86] Add fast-isel tests for integer shifts. We definitely had no coverage of i16...
Craig Topper [Fri, 27 Oct 2017 21:00:56 +0000 (21:00 +0000)]
[X86] Add fast-isel tests for integer shifts. We definitely had no coverage of i16 and i32/i64 are only tested by larger tests.

llvm-svn: 316796

7 years agoImprove clamp recognition in ValueTracking.
Artur Gainullin [Fri, 27 Oct 2017 20:53:41 +0000 (20:53 +0000)]
Improve clamp recognition in ValueTracking.

Summary:
ValueTracking was recognizing not all variations of clamp. Swapping of
true value and false value of select was added to fix this problem. The
first patch was reverted because it caused miscompile in NVPTX target.
Added corresponding test cases.

Reviewers: spatel, majnemer, efriedma, reames

Subscribers: llvm-commits, jholewinski

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

llvm-svn: 316795

7 years agoStaticAnalyzer: Modularize/fix ODR violations making functions inline but non-static...
David Blaikie [Fri, 27 Oct 2017 20:40:46 +0000 (20:40 +0000)]
StaticAnalyzer: Modularize/fix ODR violations making functions inline but non-static in headers

Also move these out of the llvm namespace & rely on ADL as is
appropriate for these op<< overloads.

llvm-svn: 316794

7 years agoSanitizers.h: Modularize/Fix ODR violations by making inline functions non-static
David Blaikie [Fri, 27 Oct 2017 20:40:45 +0000 (20:40 +0000)]
Sanitizers.h: Modularize/Fix ODR violations by making inline functions non-static

llvm-svn: 316793

7 years agoCharInfo.h: Modularize/fix ODR violations by making inline functions in header not...
David Blaikie [Fri, 27 Oct 2017 20:40:45 +0000 (20:40 +0000)]
CharInfo.h: Modularize/fix ODR violations by making inline functions in header not static

llvm-svn: 316792

7 years agoASTContext.h: Modularize/fix ODR violations by removing 'static' from inline function...
David Blaikie [Fri, 27 Oct 2017 20:40:44 +0000 (20:40 +0000)]
ASTContext.h: Modularize/fix ODR violations by removing 'static' from inline functions in headers

llvm-svn: 316791

7 years ago[X86] Teach fastisel to use VLX VMOVNTDQA for v4f64 and 256-bit integers when available.
Craig Topper [Fri, 27 Oct 2017 20:13:10 +0000 (20:13 +0000)]
[X86] Teach fastisel to use VLX VMOVNTDQA for v4f64 and 256-bit integers when available.

This looks to have been missed from r280682.

llvm-svn: 316790

7 years ago[X86] Add avx512vl command line to fast-isel-nontemporal.ll
Craig Topper [Fri, 27 Oct 2017 20:13:06 +0000 (20:13 +0000)]
[X86] Add avx512vl command line to fast-isel-nontemporal.ll

llvm-svn: 316789

7 years ago[scudo] Allow to specify the maximum number of TSDs at compile time
Kostya Kortchinsky [Fri, 27 Oct 2017 20:10:14 +0000 (20:10 +0000)]
[scudo] Allow to specify the maximum number of TSDs at compile time

Summary:
This introduces `SCUDO_MAX_CACHES` allowing to define an upper bound to the
number of `ScudoTSD` created in the Shared TSD model (by default 32U).
This name felt clearer than `SCUDO_MAX_TSDS` which is technically what it really
is. I am opened to suggestions if that doesn't feel right.

Additionally change `getNumberOfCPUs` to return a `u32` to be more consistent.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 316788

7 years agoRemove trailing whitespace.
Rui Ueyama [Fri, 27 Oct 2017 19:23:12 +0000 (19:23 +0000)]
Remove trailing whitespace.

llvm-svn: 316787

7 years agoFix llvm-special-case-list-fuzzer regexp exception
Vlad Tsyrklevich [Fri, 27 Oct 2017 19:15:13 +0000 (19:15 +0000)]
Fix llvm-special-case-list-fuzzer regexp exception

Summary:
Original oss-fuzz report:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3727#c2

The minimized test case that causes this failure:
5b 5b 5b 3d 47 53 00 5b  3d 5d 5b 5d 0a     [[[=GS.[=][].

Note the string "=GS\x00". The failure happens because the code is
searching the string against an array of known collated names. "GS\x00"
is a hit, but since len takes into account an extra NUL byte, indexing
into cp->name[len] goes one byte past it's allocated memory. Fix this to
use a strlen(cp->name) comparison to account for NUL bytes in the input.

Reviewers: pcc

Reviewed By: pcc

Subscribers: hctim, kcc

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

llvm-svn: 316786

7 years ago[Hexagon] Fix an incorrect assertion in HexagonConstExtenders.cpp
Krzysztof Parzyszek [Fri, 27 Oct 2017 18:52:28 +0000 (18:52 +0000)]
[Hexagon] Fix an incorrect assertion in HexagonConstExtenders.cpp

Making sure that an instruction has fewer operands than required, then
attempting to access one out of range is going to fail.

llvm-svn: 316785

7 years agoReplace a few usages of llvm::join with range-version[NFC]
Erich Keane [Fri, 27 Oct 2017 18:45:06 +0000 (18:45 +0000)]
Replace a few usages of llvm::join with range-version[NFC]

I noticed a few usages of llvm::join that were using
begin/end rather than just the range version.  This patch
just replaces those.

llvm-svn: 316784

7 years agoFilter out invalid 'target' items from being passed to LLVM
Erich Keane [Fri, 27 Oct 2017 18:32:23 +0000 (18:32 +0000)]
Filter out invalid 'target' items from being passed to LLVM

Craig noticed that CodeGen wasn't properly ignoring the
values sent to the target attribute. This patch ignores
them.

This patch also sets the 'default' for this checking to
'supported', since only X86 has implemented the support
for checking valid CPU names and Feature Names.

One test was changed to i686, since it uses a lakemont,
which would otherwise be prohibited in x86_64.

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

llvm-svn: 316783

7 years agoHandle all symbol types in --trace.
Rafael Espindola [Fri, 27 Oct 2017 18:30:11 +0000 (18:30 +0000)]
Handle all symbol types in --trace.

One case I was not sure was lazy symbols. bfd skips them completely,
but that is probably an artifact of how they implement archives.

llvm-svn: 316782

7 years agoRemove x86,x86_32/64 from isValidFeatureName
Erich Keane [Fri, 27 Oct 2017 18:29:02 +0000 (18:29 +0000)]
Remove x86,x86_32/64 from isValidFeatureName

These are not valid values for this, and are pretty
non-sensical, since LLVM doesn't understand them.

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

llvm-svn: 316781

7 years ago[refactor] Describe refactorings in the operation classes
Alex Lorenz [Fri, 27 Oct 2017 18:19:11 +0000 (18:19 +0000)]
[refactor] Describe refactorings in the operation classes

This commit changes the way that the refactoring operation classes are
structured:
- Users have to call `initiate` instead of constructing an instance of the
  class. The `initiate` is now supposed to have custom initiation logic, and
  you don't need to subclass the builtin requirements.
- A new `describe` function returns a structure with the id, title and the
  description of the refactoring operation.

The refactoring action classes are now placed into one common place in
RefactoringActions.cpp instead of being separate.

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

llvm-svn: 316780

7 years ago[X86][SSE] Add tests for inserting all-bits (-1) into a vector
Simon Pilgrim [Fri, 27 Oct 2017 18:14:12 +0000 (18:14 +0000)]
[X86][SSE] Add tests for inserting all-bits (-1) into a vector

We should be able to do this by re-materializing an all-bits vector and then blending with it

llvm-svn: 316779

7 years ago[Sema] Fix an assert-on-invalid by avoiding function template specialisation
Alex Lorenz [Fri, 27 Oct 2017 18:13:31 +0000 (18:13 +0000)]
[Sema] Fix an assert-on-invalid by avoiding function template specialisation
deduction for invalid functions

The fabricated template parameters cause an assertion because their depth
is invalid.

rdar://34109988

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

llvm-svn: 316778

7 years ago[WebAssembly] Add crt1.o with calling lld
Sam Clegg [Fri, 27 Oct 2017 18:10:19 +0000 (18:10 +0000)]
[WebAssembly] Add crt1.o with calling lld

Also, for OS unknown targets like wasm, don't include
'unknown' in the library path. This is a fix for rL316719.

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

llvm-svn: 316777

7 years agoInstead of enclosing an entire file, add lld:: specifier for public functions.
Rui Ueyama [Fri, 27 Oct 2017 18:04:49 +0000 (18:04 +0000)]
Instead of enclosing an entire file, add lld:: specifier for public functions.

llvm-svn: 316776

7 years agoELF: Add support for emitting dynamic relocations in the Android relocation packing...
Peter Collingbourne [Fri, 27 Oct 2017 17:49:40 +0000 (17:49 +0000)]
ELF: Add support for emitting dynamic relocations in the Android relocation packing format.

The Android relocation packing format is a more compact
format for dynamic relocations in executables and DSOs
that is based on delta encoding and SLEBs. An overview
of the format can be found in the Android source code:
https://android.googlesource.com/platform/bionic/+/refs/heads/master/tools/relocation_packer/src/delta_encoder.h

This patch implements relocation packing using that format.

This implementation uses a more intelligent algorithm for compressing
relative relocations than Android's own relocation packer. As a
result it can generally create smaller relocation sections than
that packer. If I link Chromium for Android targeting ARM32 I get a
.rel.dyn of size 174693 bytes, as compared to 371832 bytes with gold
and the Android packer.

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

llvm-svn: 316775