platform/upstream/llvm.git
6 years ago[X86] Remove unneeded code for handling the old kunpck intrinsics.
Craig Topper [Sat, 16 Dec 2017 06:58:30 +0000 (06:58 +0000)]
[X86] Remove unneeded code for handling the old kunpck intrinsics.

llvm-svn: 320917

6 years ago[X86] Add the two files I forgot to commit in r320915.
Craig Topper [Sat, 16 Dec 2017 06:10:24 +0000 (06:10 +0000)]
[X86] Add the two files I forgot to commit in r320915.

llvm-svn: 320916

6 years ago[X86] Add builtins and tests for 128 and 256 bit vpopcntdq.
Craig Topper [Sat, 16 Dec 2017 06:02:31 +0000 (06:02 +0000)]
[X86] Add builtins and tests for 128 and 256 bit vpopcntdq.

llvm-svn: 320915

6 years agoMove Transforms/LoopVectorize/consecutive-ptr-cg-bug.ll into the X86 subdirectory
Hal Finkel [Sat, 16 Dec 2017 05:10:20 +0000 (05:10 +0000)]
Move Transforms/LoopVectorize/consecutive-ptr-cg-bug.ll into the X86 subdirectory

This test depends on X86's TTI; move into the X86 subdirectory.

llvm-svn: 320914

6 years ago[LV] Extend InstWidening with CM_Widen_Recursive
Hal Finkel [Sat, 16 Dec 2017 02:55:24 +0000 (02:55 +0000)]
[LV] Extend InstWidening with CM_Widen_Recursive

Changes to the original scalar loop during LV code gen cause the return value
of Legal->isConsecutivePtr() to be inconsistent with the return value during
legal/cost phases (further analysis and information of the bug is in D39346).
This patch is an alternative fix to PR34965 following the CM_Widen approach
proposed by Ayal and Gil in D39346. It extends InstWidening enum with
CM_Widen_Reverse to properly record the widening decision for consecutive
reverse memory accesses and, consequently, get rid of the
Legal->isConsetuviePtr() call in LV code gen. I think this is a simpler/cleaner
solution to PR34965 than the one in D39346.

Fixes PR34965.

Patch by Diego Caballero, thanks!

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

llvm-svn: 320913

6 years agoFixed warning 'function declaration isn’t a prototype [-Werror=strict-prototypes]'
Galina Kistanova [Sat, 16 Dec 2017 02:54:17 +0000 (02:54 +0000)]
Fixed warning 'function declaration isn’t a prototype [-Werror=strict-prototypes]'

llvm-svn: 320912

6 years ago[PowerPC, AsmParser] Enable the mnemonic spell corrector
Hal Finkel [Sat, 16 Dec 2017 02:42:18 +0000 (02:42 +0000)]
[PowerPC, AsmParser] Enable the mnemonic spell corrector

r307148 added an assembly mnemonic spelling correction support and enabled it
on ARM. This enables that support on PowerPC as well.

Patch by Dmitry Venikov, thanks!

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

llvm-svn: 320911

6 years ago[X86] Add 128 and 256-bit VPOPCNTDQ instructions. Adjust some tablegen classes LZCNT...
Craig Topper [Sat, 16 Dec 2017 02:40:28 +0000 (02:40 +0000)]
[X86] Add 128 and 256-bit VPOPCNTDQ instructions. Adjust some tablegen classes LZCNT/POPCNT.

I think when this instruction was first published it was only for a Knights CPU and thus VLX version was missing.

llvm-svn: 320910

6 years ago[LTO] Update tests for r320905
Vitaly Buka [Sat, 16 Dec 2017 02:40:20 +0000 (02:40 +0000)]
[LTO] Update tests for r320905

llvm-svn: 320909

6 years ago[VerifyDiagnosticConsumer] support -verify=<prefixes>
Hal Finkel [Sat, 16 Dec 2017 02:23:22 +0000 (02:23 +0000)]
[VerifyDiagnosticConsumer] support -verify=<prefixes>

This mimics FileCheck's --check-prefixes option.

The default prefix is "expected". That is, "-verify" is equivalent to
"-verify=expected".

The goal is to permit exercising a single test suite source file with different
compiler options producing different sets of diagnostics.  While cpp can be
combined with the existing -verify to accomplish the same goal, source is often
easier to maintain when it's not cluttered with preprocessor directives or
duplicate passages of code. For example, this patch also rewrites some existing
clang tests to demonstrate the benefit of this feature.

Patch by Joel E. Denny, thanks!

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

llvm-svn: 320908

6 years agoRemove trailing whitespace
Vitaly Buka [Sat, 16 Dec 2017 02:12:35 +0000 (02:12 +0000)]
Remove trailing whitespace

llvm-svn: 320907

6 years ago[WebAssembly] Return ArrayRef's rather than const std::vector&
Sam Clegg [Sat, 16 Dec 2017 02:10:16 +0000 (02:10 +0000)]
[WebAssembly] Return ArrayRef's rather than const std::vector&

From working on lld I've learned this is generally the
preferred way for several reasons (e.g. more concise, improves
encapsulation).

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

llvm-svn: 320906

6 years ago[LTO] Make processing of combined module more consistent
Vitaly Buka [Sat, 16 Dec 2017 02:10:00 +0000 (02:10 +0000)]
[LTO] Make processing of combined module more consistent

Summary:
1. Use stream 0 only for combined module. Previously if combined module was not
processes ThinLTO used the stream for own output. However small changes in input,
could trigger combined module  and shuffle outputs making life of llvm::LTO harder.

2. Always process combined module and write output to stream 0. Processing empty
combined module is cheap and allows llvm::LTO users to avoid implementing processing
which is already done in llvm::LTO.

Subscribers: mehdi_amini, inglorion, eraman, hiraditya

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

llvm-svn: 320905

6 years ago[TextDiagnosticBuffer] Fix diagnostic note emission order
Hal Finkel [Sat, 16 Dec 2017 01:40:19 +0000 (01:40 +0000)]
[TextDiagnosticBuffer] Fix diagnostic note emission order

The frontend currently groups diagnostics from the command line according to
diagnostic level, but that places all notes last. Fix that by emitting such
diagnostics in the order they were generated.

Patch by Joel E. Denny, thanks!

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

llvm-svn: 320904

6 years agoAdd another missing -enable-import-metadata to test
Teresa Johnson [Sat, 16 Dec 2017 01:35:36 +0000 (01:35 +0000)]
Add another missing -enable-import-metadata to test

r320895 modified a test so that it needs -enable-import-metadata which
is false by default for NDEBUG, found another place that needs this
added.

llvm-svn: 320903

6 years ago[CodeGen] Specialize mixed-sign mul-with-overflow (fix PR34920)
Vedant Kumar [Sat, 16 Dec 2017 01:28:25 +0000 (01:28 +0000)]
[CodeGen] Specialize mixed-sign mul-with-overflow (fix PR34920)

This patch introduces a specialized way to lower overflow-checked
multiplications with mixed-sign operands. This fixes link failures and
ICEs on code like this:

  void mul(int64_t a, uint64_t b) {
    int64_t res;
    __builtin_mul_overflow(a, b, &res);
  }

The generic checked-binop irgen would use a 65-bit multiplication
intrinsic here, which requires runtime support for _muloti4 (128-bit
multiplication), and therefore fails to link on i386. To get an ICE
on x86_64, change the example to use __int128_t / __uint128_t.

Adding runtime and backend support for 65-bit or 129-bit checked
multiplication on all of our supported targets is infeasible.

This patch solves the problem by using simpler, specialized irgen for
the mixed-sign case.

llvm.org/PR34920, rdar://34963321

Testing: Apart from check-clang, I compared the output from this fairly
comprehensive test driver using unpatched & patched clangs:
https://gist.github.com/vedantk/3eb9c88f82e5c32f2e590555b4af5081

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

llvm-svn: 320902

6 years ago[SimplifyLibCalls] Inline calls to cabs when it's safe to do so
Hal Finkel [Sat, 16 Dec 2017 01:26:25 +0000 (01:26 +0000)]
[SimplifyLibCalls] Inline calls to cabs when it's safe to do so

When unsafe algerbra is allowed calls to cabs(r) can be replaced by:

  sqrt(creal(r)*creal(r) + cimag(r)*cimag(r))

Patch by Paul Walker, thanks!

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

llvm-svn: 320901

6 years ago[LV] NFC patch for moving VP*Recipe class definitions from LoopVectorize.cpp to VPlan.h
Hal Finkel [Sat, 16 Dec 2017 01:12:50 +0000 (01:12 +0000)]
[LV] NFC patch for moving VP*Recipe class definitions from LoopVectorize.cpp to VPlan.h

This is a small step forward to move VPlan stuff to where it should belong (i.e., VPlan.*):

  1. VP*Recipe classes in LoopVectorize.cpp are moved to VPlan.h.
  2. Many of VP*Recipe::print() and execute() definitions are still left in
     LoopVectorize.cpp since they refer to things declared in LoopVectorize.cpp. To
     be moved to VPlan.cpp at a later time.
  3. InterleaveGroup class is moved from anonymous namespace to llvm namespace.
     Referencing it in anonymous namespace from VPlan.h ended up in warning.

Patch by Hideki Saito, thanks!

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

llvm-svn: 320900

6 years agoAdd -enable-import-metadata to test
Teresa Johnson [Sat, 16 Dec 2017 01:00:48 +0000 (01:00 +0000)]
Add -enable-import-metadata to test

r320895 modified a test so that it needs -enable-import-metadata which
is false by default for NDEBUG.

llvm-svn: 320899

6 years ago[X86] Add back the assert from r320830 that was reverted in r320850
Craig Topper [Sat, 16 Dec 2017 00:33:16 +0000 (00:33 +0000)]
[X86] Add back the assert from r320830 that was reverted in r320850

Hopefully r320864 has fixed the offending case that failed the assert.

llvm-svn: 320898

6 years agoFix NDEBUG build problem in r320895
Teresa Johnson [Sat, 16 Dec 2017 00:29:31 +0000 (00:29 +0000)]
Fix NDEBUG build problem in r320895

Fix incorrect placement of #endif causing NDEBUG build failures.

llvm-svn: 320897

6 years ago[COFF] Clean up debug option handling
Shoaib Meenai [Sat, 16 Dec 2017 00:23:24 +0000 (00:23 +0000)]
[COFF] Clean up debug option handling

/debug and /debug:dwarf are orthogonal. An object file can contain both
CodeView and DWARF debug info, so the combination of /debug:dwarf and
/debug should generate both DWARF and a PDB, rather than /debug:dwarf
always suppressing PDB creation.

/nopdb is now redundant and can be removed. /debug /nopdb was previously
used to support DWARF, but specifying /debug:dwarf is entirely
equivalent to that combination now.

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

llvm-svn: 320896

6 years ago[ThinLTO] Enable importing of aliases as copy of aliasee
Teresa Johnson [Sat, 16 Dec 2017 00:18:12 +0000 (00:18 +0000)]
[ThinLTO] Enable importing of aliases as copy of aliasee

Summary:
This implements a missing feature to allow importing of aliases, which
was previously disabled because alias cannot be available_externally.
We instead import an alias as a copy of its aliasee.

Some additional work was required in the IndexBitcodeWriter for the
distributed build case, to ensure that the aliasee has a value id
in the distributed index file (i.e. even when it is not being
imported directly).

This is a performance win in codes that have many aliases, e.g. C++
applications that have many constructor and destructor aliases.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, eraman, llvm-commits

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

llvm-svn: 320895

6 years ago[COFF] Update an outdated comment. NFC
Shoaib Meenai [Fri, 15 Dec 2017 23:52:46 +0000 (23:52 +0000)]
[COFF] Update an outdated comment. NFC

This comment dates from when LLD didn't produce actual PDBs, and is very
outdated now.

llvm-svn: 320894

6 years agoFix WebAssembly backend for some LLVM API changes
David Blaikie [Fri, 15 Dec 2017 23:52:06 +0000 (23:52 +0000)]
Fix WebAssembly backend for some LLVM API changes

llvm-svn: 320893

6 years ago[COFF] Simplify hasArgs calls. NFC
Shoaib Meenai [Fri, 15 Dec 2017 23:51:14 +0000 (23:51 +0000)]
[COFF] Simplify hasArgs calls. NFC

We can just pass multiple options to hasArgs (which will check for any
of those options being present) instead of calling it multiple times.

llvm-svn: 320892

6 years ago[CMake] darwin-debug is an hard dependency for tests on macOS.
Davide Italiano [Fri, 15 Dec 2017 23:27:10 +0000 (23:27 +0000)]
[CMake] darwin-debug is an hard dependency for tests on macOS.

Fixes a few failured on the testsuite with CMake.

llvm-svn: 320891

6 years ago[TableGen][GlobalISel] Make the different Matcher comparable
Quentin Colombet [Fri, 15 Dec 2017 23:24:39 +0000 (23:24 +0000)]
[TableGen][GlobalISel] Make the different Matcher comparable

This opens refactoring opportunities in the match table now that we can
check that two predicates are the same.

NFC.

llvm-svn: 320890

6 years ago[TableGen][GlobalISel] Fix unused variable warning in release mode
Quentin Colombet [Fri, 15 Dec 2017 23:24:36 +0000 (23:24 +0000)]
[TableGen][GlobalISel] Fix unused variable warning in release mode

Introduced in r320887.

NFC.

llvm-svn: 320889

6 years agoRevert "Recommit "[DWARFv5] Dump an MD5 checksum in the line-table header.""
Paul Robinson [Fri, 15 Dec 2017 23:21:52 +0000 (23:21 +0000)]
Revert "Recommit "[DWARFv5] Dump an MD5 checksum in the line-table header.""

This reverts commit 0afef672f63f0e4e91938656bc73424a8c058bfc.
Still failing at runtime on bots.

llvm-svn: 320888

6 years ago[TableGen][GlobalISel] Have the predicate directly know which data they are dealing...
Quentin Colombet [Fri, 15 Dec 2017 23:07:42 +0000 (23:07 +0000)]
[TableGen][GlobalISel] Have the predicate directly know which data they are dealing with

Prior to this patch, a predicate wouldn't make sense outside of its
rule. Indeed, it was only during emitting a rule that a predicate would
be made aware of the IDs of the data it is checking. Because of that,
predicates could not be moved around or compared between each other.

NFC.

llvm-svn: 320887

6 years agoRecommit "[DWARFv5] Dump an MD5 checksum in the line-table header."
Paul Robinson [Fri, 15 Dec 2017 22:57:17 +0000 (22:57 +0000)]
Recommit "[DWARFv5] Dump an MD5 checksum in the line-table header."
Adds missing support for DW_FORM_data16.

Update of r320852, fixing the unittest to use a hand-coded struct
instead of std::array to guarantee data layout.

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

llvm-svn: 320886

6 years agoFix unused variable in non-assert builds
Matthias Braun [Fri, 15 Dec 2017 22:53:33 +0000 (22:53 +0000)]
Fix unused variable in non-assert builds

llvm-svn: 320885

6 years agoMachineFunction: Return reference from getFunction(); NFC
Matthias Braun [Fri, 15 Dec 2017 22:22:58 +0000 (22:22 +0000)]
MachineFunction: Return reference from getFunction(); NFC

The Function can never be nullptr so we can return a reference.

llvm-svn: 320884

6 years ago[MacOSX/Queues] Relax an overly aggressive assertion in a test.
Davide Italiano [Fri, 15 Dec 2017 22:22:51 +0000 (22:22 +0000)]
[MacOSX/Queues] Relax an overly aggressive assertion in a test.

"Default" is a valid QoS for a thread on older versions of macOS,
like the one installed in the bot.
Thanks to Jason Molenda for helping me figuring out the problem.

<rdar://problem/28346273>

llvm-svn: 320883

6 years agoMachineFunction: Slight refactoring; NFC
Matthias Braun [Fri, 15 Dec 2017 22:22:46 +0000 (22:22 +0000)]
MachineFunction: Slight refactoring; NFC

Slight cleanup/refactor in preparation for upcoming commit.

llvm-svn: 320882

6 years agoMachineModuleInfo: Remove unused function; NFC
Matthias Braun [Fri, 15 Dec 2017 22:22:42 +0000 (22:22 +0000)]
MachineModuleInfo: Remove unused function; NFC

Remove the unused setModule() function; it would be dangerous if someone
actually used it as it wouldn't reset/recompute various other module
related data.

llvm-svn: 320881

6 years ago[WebAssembly] Don't include lazy symbols in import table
Sam Clegg [Fri, 15 Dec 2017 22:17:15 +0000 (22:17 +0000)]
[WebAssembly] Don't include lazy symbols in import table

This bug was introduced in: https://reviews.llvm.org/D41304.
Add a test for this case.

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

llvm-svn: 320872

6 years agoFixed the gcc 'enumeral and non-enumeral type in conditional expression [-Werror...
Galina Kistanova [Fri, 15 Dec 2017 22:15:29 +0000 (22:15 +0000)]
Fixed the gcc 'enumeral and non-enumeral type in conditional expression [-Werror=extra]' warning introduced by r320750

llvm-svn: 320868

6 years ago[Hexagon] Remove recursion in visitUsesOf, replace with use queue
Krzysztof Parzyszek [Fri, 15 Dec 2017 21:34:05 +0000 (21:34 +0000)]
[Hexagon] Remove recursion in visitUsesOf, replace with use queue

This is primarily to reduce stack usage, but ordering the use queue
according to the position in the code (earlier instructions visited
before later ones) reduces the number of unnecessary bottoms due to
visiting instructions out of order, e.g.
  %reg1 = copy %reg0
  %reg2 = copy %reg0
  %reg3 = and %reg1, %reg2
Here, reg3 should be known to be same as reg0-2, but if reg3 is
evaluated after reg1 is updated, but before reg2 is updated, the two
inputs to the and will appear different, causing reg3 to become
bottom.

llvm-svn: 320866

6 years ago[Hexagon] Handle concat_vectors of all allowed HVX types
Krzysztof Parzyszek [Fri, 15 Dec 2017 21:23:12 +0000 (21:23 +0000)]
[Hexagon] Handle concat_vectors of all allowed HVX types

llvm-svn: 320865

6 years ago[X86] Use AND32ri8 instead of AND64ri8 in Asan code in EmitCallAsanReport for 32...
Craig Topper [Fri, 15 Dec 2017 21:18:06 +0000 (21:18 +0000)]
[X86] Use AND32ri8 instead of AND64ri8 in Asan code in EmitCallAsanReport for 32-bit mode.

This seemed to work due to a quirk in the X86 MC encoder that didn't emit a REX byte that the AND64ri8 implies when in 32-bit mode. This made the encoding the same as AND32ri8. I tried to add an assert to catch the dropped REX prefix that caught this.

llvm-svn: 320864

6 years ago[X86] In LowerVectorCTPOP use ISD::ZERO_EXTEND/ISD::TRUNCATE instead of the target...
Craig Topper [Fri, 15 Dec 2017 21:18:05 +0000 (21:18 +0000)]
[X86] In LowerVectorCTPOP use ISD::ZERO_EXTEND/ISD::TRUNCATE instead of the target specific nodes.

The target independent nodes will get legalized to the target specific nodes by their own legalization process. Someday I'd like to stop using a target specific for zero extends and truncates of legal types so the less places we reference the target specific opcode the better.

llvm-svn: 320863

6 years ago[X86] Remove unnecessary TODO.
Craig Topper [Fri, 15 Dec 2017 20:57:18 +0000 (20:57 +0000)]
[X86] Remove unnecessary TODO.

When I wrote it I thought we were missing a potential optimization for KNL. But investigating further shows that for KNL we still do the optimal thing by widening to v4f32 and then using special isel patterns to widen again to zmm a register.

llvm-svn: 320862

6 years ago[MinGW] Ignore the --no-seh flag
Martin Storsjo [Fri, 15 Dec 2017 20:53:10 +0000 (20:53 +0000)]
[MinGW] Ignore the --no-seh flag

The COFF linker automatically sets the IMAGE_DLL_CHARACTERISTICS_NO_SEH
when suitable, similarly to link.exe.

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

llvm-svn: 320861

6 years ago[COFF] Set the IMAGE_DLL_CHARACTERISTICS_NO_SEH flag automatically
Martin Storsjo [Fri, 15 Dec 2017 20:53:03 +0000 (20:53 +0000)]
[COFF] Set the IMAGE_DLL_CHARACTERISTICS_NO_SEH flag automatically

This seems to match how link.exe sets it.

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

llvm-svn: 320860

6 years ago[LTO] Remove unused RegularLTOState::HasModule
Vitaly Buka [Fri, 15 Dec 2017 20:50:25 +0000 (20:50 +0000)]
[LTO] Remove unused RegularLTOState::HasModule

llvm-svn: 320859

6 years agoRe-commit : [LICM] Allow sinking when foldable in loop
Jun Bum Lim [Fri, 15 Dec 2017 20:33:24 +0000 (20:33 +0000)]
Re-commit : [LICM] Allow sinking when foldable in loop

This recommits r320823 reverted due to the test failure in sink-foldable.ll and
an unused variable. Added "REQUIRES: aarch64-registered-target" in the test
and removed unused variable.

Original commit message:

  Continue trying to sink an instruction if its users in the loop is foldable.
  This will allow the instruction to be folded in the loop by decoupling it from
  the user outside of the loop.

  Reviewers: hfinkel, majnemer, davidxl, efriedma, danielcdh, bmakam, mcrosier

  Reviewed By: hfinkel

  Subscribers: javed.absar, bmakam, mcrosier, llvm-commits

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

llvm-svn: 320858

6 years agoRevert "[DWARFv5] Dump an MD5 checksum in the line-table header."
Paul Robinson [Fri, 15 Dec 2017 20:29:25 +0000 (20:29 +0000)]
Revert "[DWARFv5] Dump an MD5 checksum in the line-table header."

Unit test fails on some bots.

llvm-svn: 320857

6 years ago[llvm-objcopy] Reformat everything using clang-format -i
Jake Ehrlich [Fri, 15 Dec 2017 20:17:55 +0000 (20:17 +0000)]
[llvm-objcopy] Reformat everything using clang-format -i

Overtime some non-clang formatted code has creeped into llvm-objcopy. This
patch fixes all of that.

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

llvm-svn: 320856

6 years ago[Hexagon] Fix operand-swapping PatFrag for atomic stores
Krzysztof Parzyszek [Fri, 15 Dec 2017 20:13:57 +0000 (20:13 +0000)]
[Hexagon] Fix operand-swapping PatFrag for atomic stores

PatFrag now has the atomicity information stored as bit fields. They
need to be copied to the new PatFrag.

llvm-svn: 320855

6 years ago__is_target_environment: Check the environment after parsing it
Alex Lorenz [Fri, 15 Dec 2017 20:07:53 +0000 (20:07 +0000)]
__is_target_environment: Check the environment after parsing it

This ensures that target triples with environment versions can still work with
__is_target_environment.

llvm-svn: 320854

6 years ago__is_target_arch: Check the arch and subarch instead of the arch name
Alex Lorenz [Fri, 15 Dec 2017 19:58:38 +0000 (19:58 +0000)]
__is_target_arch: Check the arch and subarch instead of the arch name

This ensures that when compiling for "arm64" __is_target_arch will succeed for
both "arm64" and "aarch64".

Thanks to Bob Wilson who pointed this out!

llvm-svn: 320853

6 years ago[DWARFv5] Dump an MD5 checksum in the line-table header.
Paul Robinson [Fri, 15 Dec 2017 19:52:34 +0000 (19:52 +0000)]
[DWARFv5] Dump an MD5 checksum in the line-table header.
Adds missing support for DW_FORM_data16.

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

llvm-svn: 320852

6 years agoDo not add .dynamic entries that don't have to be added early in the ctor. NFC.
Rui Ueyama [Fri, 15 Dec 2017 19:39:59 +0000 (19:39 +0000)]
Do not add .dynamic entries that don't have to be added early in the ctor. NFC.

We add dynamic section entries both in the ctor of the class and
DynamicSection::finalizeContents(). Some entries need to be added early
in the ctor because they add strings to .dynstr. Other entries were
intended to be added in finalizeContents(). However, some entries are
added in the ctor even though they don't add strings. This patch
fix the issue.

llvm-svn: 320851

6 years ago[X86] Remove assert in X86MCCodeEmitter.cpp that was added in r320830.
Craig Topper [Fri, 15 Dec 2017 19:38:14 +0000 (19:38 +0000)]
[X86] Remove assert in X86MCCodeEmitter.cpp that was added in r320830.

It seems to be failing real code which is concerning, but we were silently getting away with it. I'll investigate further.

llvm-svn: 320850

6 years ago[SelectionDAG][X86] Fix insert_vector_elt lowering for v32i1/v64i1 with non-constant...
Craig Topper [Fri, 15 Dec 2017 19:35:22 +0000 (19:35 +0000)]
[SelectionDAG][X86] Fix insert_vector_elt lowering for v32i1/v64i1 with non-constant index

Summary:
Currently we don't handle v32i1/v64i1 insert_vector_elt correctly as we fail to look at the number of elements closely and assume it can only be v16i1 or v8i1.

We also can't type legalize v64i1 insert_vector_elt correctly on KNL due to the type not being byte addressable as required by the legalizing through memory accesses path requires.

For the first issue, the patch now tries to pick a 512-bit register with the correct number of elements and promotes to that.

For the second issue, we now extend the vector to a byte addressable type, do the stores to memory, load the two halves, and then truncate the halves back to the original type. Technically since we changed the type, we may not need two loads, but actually checking that is more work and for the v64i1 case we do need them.

Reviewers: RKSimon, delena, spatel, zvi

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 320849

6 years ago[Memcpy Loop Lowering] Insert loop BB inbetween the split BB.
Sean Fertile [Fri, 15 Dec 2017 19:29:12 +0000 (19:29 +0000)]
[Memcpy Loop Lowering] Insert loop BB inbetween the split BB.

The original memcpy expansion inserted the loop basic block inbetween
the 2 new basic blocks created by splitting the original block the memcpy
call was in. This commit makes the new memcpy expansion do the same to keep the
layout of the IR matching between the old and new implementations.

Differential Review: https://reviews.llvm.org/D41197

llvm-svn: 320848

6 years ago[WebAssembly] Base imports on Symtab. NFC.
Sam Clegg [Fri, 15 Dec 2017 19:23:49 +0000 (19:23 +0000)]
[WebAssembly] Base imports on Symtab. NFC.

Since imports are undefined symbols we know we can
find all of them my looking at the symbol table alone.
(i.e. imports cannot be have local binding).

This will be strictly faster and also allows us
to to remove a method from Symbol class

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

llvm-svn: 320847

6 years ago[X86] Add 'Requires<[In64BitMode]>' to a bunch of instructions that only have memory...
Craig Topper [Fri, 15 Dec 2017 19:01:51 +0000 (19:01 +0000)]
[X86] Add 'Requires<[In64BitMode]>' to a bunch of instructions that only have memory and immediate operands.

The asm parser wasn't preventing these from being accepted in 32-bit mode. Instructions that use a GR64 register are protected by the parser rejecting the register in 32-bit mode.

llvm-svn: 320846

6 years ago[X86] Change BNDLDX to use anymem instead of i64mem for itsmemory operand.
Craig Topper [Fri, 15 Dec 2017 19:01:50 +0000 (19:01 +0000)]
[X86] Change BNDLDX to use anymem instead of i64mem for itsmemory operand.

This instruction doesn't access memory. It juse use a similar looking memory encoding. Don't require Intel syntax to put "qword ptr" in front of it.

llvm-svn: 320845

6 years ago[X86] Remove the 'Requires' In64BitMode/Not64BitMode from the LWP instructions.
Craig Topper [Fri, 15 Dec 2017 19:01:49 +0000 (19:01 +0000)]
[X86] Remove the 'Requires' In64BitMode/Not64BitMode from the LWP instructions.

These aren't doing anything due to a top level "let Predicates =". I think the GR32/GR64 register class protects these anyway.

llvm-svn: 320844

6 years ago[X86] Remove the 'Requires<[In64BitMode]>' from SHSTK instructions.
Craig Topper [Fri, 15 Dec 2017 19:01:48 +0000 (19:01 +0000)]
[X86] Remove the 'Requires<[In64BitMode]>' from SHSTK instructions.

This has no effect due to a top level "let Predicates =" around the instructions. But its also not required because the GR64 usage in the instruction guarantees it can never match.

llvm-svn: 320843

6 years ago[TargetLibraryInfo] fix documentation comment; NFC
Sanjay Patel [Fri, 15 Dec 2017 18:54:29 +0000 (18:54 +0000)]
[TargetLibraryInfo] fix documentation comment; NFC

llvm-svn: 320842

6 years ago[clang-tidy] Adding Fuchsia checker for virtual inheritance
Julie Hockett [Fri, 15 Dec 2017 18:54:28 +0000 (18:54 +0000)]
[clang-tidy] Adding Fuchsia checker for virtual inheritance

Adds a check to the Fuchsia module to warn if classes are defined
with virtual inheritance.

See https://fuchsia.googlesource.com/zircon/+/master/docs/cxx.md for
reference.

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

llvm-svn: 320841

6 years ago[CodeGen] fix documentation comments; NFC
Sanjay Patel [Fri, 15 Dec 2017 18:34:45 +0000 (18:34 +0000)]
[CodeGen] fix documentation comments; NFC

llvm-svn: 320840

6 years ago[AArch64] Fix typo in the ASIMD instruction optimization pass
Evandro Menezes [Fri, 15 Dec 2017 18:26:54 +0000 (18:26 +0000)]
[AArch64] Fix typo in the ASIMD instruction optimization pass

Fix typo in the representative instruction replacement.

Also, fix formatting and reword some comments.

llvm-svn: 320839

6 years agofix typo in comment and remove inaccurate comment; NFC
Sanjay Patel [Fri, 15 Dec 2017 18:25:13 +0000 (18:25 +0000)]
fix typo in comment and remove inaccurate comment; NFC

llvm-svn: 320838

6 years agoFix for bug PR35549 - Repeated schedule comments.
Andrew V. Tischenko [Fri, 15 Dec 2017 18:13:05 +0000 (18:13 +0000)]
Fix for bug PR35549 - Repeated schedule comments.
Differential Revision: https://reviews.llvm.org/D40960

llvm-svn: 320837

6 years agoRevert "Re-commit : [LICM] Allow sinking when foldable in loop"
Jun Bum Lim [Fri, 15 Dec 2017 18:12:49 +0000 (18:12 +0000)]
Revert "Re-commit : [LICM] Allow sinking when foldable in loop"

This reverts commit r320833.

llvm-svn: 320836

6 years ago[CodeGen] fix documentation comments; NFC
Sanjay Patel [Fri, 15 Dec 2017 18:09:33 +0000 (18:09 +0000)]
[CodeGen] fix documentation comments; NFC

llvm-svn: 320835

6 years agoRe-commit : [LICM] Allow sinking when foldable in loop
Jun Bum Lim [Fri, 15 Dec 2017 17:58:59 +0000 (17:58 +0000)]
Re-commit : [LICM] Allow sinking when foldable in loop

 This recommit r320823 after fixing a test failure.

 Original commit message:

    Continue trying to sink an instruction if its users in the loop is foldable.
    This will allow the instruction to be folded in the loop by decoupling it from
    the user outside of the loop.

    Reviewers: hfinkel, majnemer, davidxl, efriedma, danielcdh, bmakam, mcrosier

    Reviewed By: hfinkel

    Subscribers: javed.absar, bmakam, mcrosier, llvm-commits

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

llvm-svn: 320833

6 years agoUpdated llvm-objdump to display local relocations in Mach-O binaries
Michael Trent [Fri, 15 Dec 2017 17:57:40 +0000 (17:57 +0000)]
Updated llvm-objdump to display local relocations in Mach-O binaries

Summary:
llvm-objdump's Mach-O parser was updated in r306037 to display external
relocations for MH_KEXT_BUNDLE file types. This change extends the Macho-O
parser to display local relocations for MH_PRELOAD files. When used with
the -macho option relocations will be displayed in a historical format.

All tests are passing for llvm, clang, and lld. llvm-objdump builds without
compiler warnings.

rdar://35778019

Reviewers: enderby

Reviewed By: enderby

Subscribers: llvm-commits

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

llvm-svn: 320832

6 years ago[ubsan-minimal] Add a path for non-POSIX (and bare-metal) use of the library
Filipe Cabecinhas [Fri, 15 Dec 2017 17:30:50 +0000 (17:30 +0000)]
[ubsan-minimal] Add a path for non-POSIX (and bare-metal) use of the library

Summary:
Hook on -DKERNEL_USE (which is also used in lib/builtins) to not import
strlen and not rely on write() being implemented with the stderr on fd 2.

With this, the only requirements to use this library are:
  - "Good enough" std::atomic<void*> and std::atomic<int>
  - abort() being implemented
  - ubsan_message(const char*) being implemented

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 320831

6 years ago[X86] Fix XSAVE64 and similar instructions to not be allowed by the assembler in...
Craig Topper [Fri, 15 Dec 2017 17:22:58 +0000 (17:22 +0000)]
[X86] Fix XSAVE64 and similar instructions to not be allowed by the assembler in 32-bit mode.

There was a top level "let Predicates =" in the .td file that was overriding the Requires on each instruction.

I've added an assert to the code emitter to catch more cases like this. I'm sure this isn't the only place where the right predicates aren't being applied. This assert already found that we don't block btq/btsq/btrq in 32-bit mode.

llvm-svn: 320830

6 years agoRemove "FunctionName -" from docs on FunctionDecl(NFC)
Erich Keane [Fri, 15 Dec 2017 16:37:14 +0000 (16:37 +0000)]
Remove "FunctionName -" from docs on FunctionDecl(NFC)

Removed the repetative usage of the operator name on the
documentation for FunctionDecl.  Also reflowed some of the
comments since this changes the 80 character rule.

llvm-svn: 320829

6 years agoRevert "[LICM] Allow sinking when foldable in loop"
Jun Bum Lim [Fri, 15 Dec 2017 16:35:09 +0000 (16:35 +0000)]
Revert "[LICM] Allow sinking when foldable in loop"

This reverts commit r320823.

llvm-svn: 320828

6 years ago[CodeGen] Print stack object references as %(fixed-)stack.0 in both MIR and debug...
Francis Visoiu Mistrih [Fri, 15 Dec 2017 16:33:45 +0000 (16:33 +0000)]
[CodeGen] Print stack object references as %(fixed-)stack.0 in both MIR and debug output

Work towards the unification of MIR and debug output by printing
`%stack.0` instead of `<fi#0>`, and `%fixed-stack.0` instead of
`<fi#-4>` (supposing there are 4 fixed stack objects).

Only debug syntax is affected.

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

llvm-svn: 320827

6 years ago[OPENMP] Codegen `declare simd` for function declarations.
Alexey Bataev [Fri, 15 Dec 2017 16:28:31 +0000 (16:28 +0000)]
[OPENMP] Codegen `declare simd` for function declarations.

Previously the attributes were emitted only for function definitions.
Patch adds emission of the attributes for function declarations.

llvm-svn: 320826

6 years ago[ThinLTO] Disallow multiple prevailing defs
Eugene Leviant [Fri, 15 Dec 2017 16:27:33 +0000 (16:27 +0000)]
[ThinLTO] Disallow multiple prevailing defs

https://reviews.llvm.org/D41291

llvm-svn: 320825

6 years ago[X86] Widen (v2i32 (fp_to_uint v2f64)) to (v8i32 (fp_to_uint v8f64)) during legalizat...
Craig Topper [Fri, 15 Dec 2017 16:22:20 +0000 (16:22 +0000)]
[X86] Widen (v2i32 (fp_to_uint v2f64)) to (v8i32 (fp_to_uint v8f64)) during legalization if we have AVX512F, but not VLX. NFC

Previously we widened it using isel patterns.

llvm-svn: 320824

6 years ago[LICM] Allow sinking when foldable in loop
Jun Bum Lim [Fri, 15 Dec 2017 16:09:54 +0000 (16:09 +0000)]
[LICM] Allow sinking when foldable in loop

Summary:
Continue trying to sink an instruction if its users in the loop is foldable.
This will allow the instruction to be folded in the loop by decoupling it from
the user outside of the loop.

Reviewers: hfinkel, majnemer, davidxl, efriedma, danielcdh, bmakam, mcrosier

Reviewed By: hfinkel

Subscribers: javed.absar, bmakam, mcrosier, llvm-commits

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

llvm-svn: 320823

6 years ago[ARM] Some DAG combine tests
Sam Parker [Fri, 15 Dec 2017 15:30:39 +0000 (15:30 +0000)]
[ARM] Some DAG combine tests

Add some more and and shift load combine tests.

llvm-svn: 320822

6 years ago[ELF] Reduce size of ELF file produced by test
Peter Smith [Fri, 15 Dec 2017 15:30:00 +0000 (15:30 +0000)]
[ELF] Reduce size of ELF file produced by test

We only need to exceed 128 Megabytes to provoke the generation of a range
extension thunk. This brings the file size down to just over 128 Megabytes.

llvm-svn: 320821

6 years agollgs-tests: Add support for "exit" stop-reply packets
Pavel Labath [Fri, 15 Dec 2017 15:19:45 +0000 (15:19 +0000)]
llgs-tests: Add support for "exit" stop-reply packets

Summary:
This makes StopReply class abstract, so that we can represent different
types of stop replies such as StopReplyStop and StopReplyExit (there
should also be a StopReplySignal, but I don't need that right now so I
haven't implemented it yet).

This prepares the ground for a new test I'm writing.

Reviewers: eugene, zturner

Subscribers: lldb-commits

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

llvm-svn: 320820

6 years ago[MIR] Add support for missing CFI directives
Francis Visoiu Mistrih [Fri, 15 Dec 2017 15:17:18 +0000 (15:17 +0000)]
[MIR] Add support for missing CFI directives

The following CFI directives are suported by MC but not by MIR:

* .cfi_rel_offset
* .cfi_adjust_cfa_offset
* .cfi_escape
* .cfi_remember_state
* .cfi_restore_state
* .cfi_undefined
* .cfi_register
* .cfi_window_save

Add support for printing, parsing and update tests.

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

llvm-svn: 320819

6 years agoDelete a really large test output.
Rafael Espindola [Fri, 15 Dec 2017 14:56:01 +0000 (14:56 +0000)]
Delete a really large test output.

llvm-svn: 320818

6 years agoHandle a VersymIndex of 0 as an error.
Rafael Espindola [Fri, 15 Dec 2017 14:52:40 +0000 (14:52 +0000)]
Handle a VersymIndex of 0 as an error.

I noticed that the continue this patch deletes was not tested. Trying
to add a test I realized that we never put a VER_NDX_LOCAL symbol in
the dynamic symbol table. There doesn't seem to be any reason for a
linker to use VER_NDX_LOCAL for a defined shared symbol.

llvm-svn: 320817

6 years agoFix 32-bit builds broken by 320813
Pavel Labath [Fri, 15 Dec 2017 14:39:12 +0000 (14:39 +0000)]
Fix 32-bit builds broken by 320813

cast to size_t to avoid narrowing error.

llvm-svn: 320816

6 years ago[X86] Add RTM schedule tests
Simon Pilgrim [Fri, 15 Dec 2017 14:37:28 +0000 (14:37 +0000)]
[X86] Add RTM schedule tests

llvm-svn: 320815

6 years ago[InlineCost] Find repeated loads in the callee
Haicheng Wu [Fri, 15 Dec 2017 14:34:41 +0000 (14:34 +0000)]
[InlineCost] Find repeated loads in the callee

SROA analysis of InlineCost can figure out that some stores can be removed
after inlining and then the repeated loads clobbered by these stores are also
free.  This patch finds these clobbered loads and adjust the inline cost
accordingly.

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

llvm-svn: 320814

6 years agoObjectFileELF: Add support for compressed sections
Pavel Labath [Fri, 15 Dec 2017 14:23:58 +0000 (14:23 +0000)]
ObjectFileELF: Add support for compressed sections

Summary:
We use the llvm decompressor to decompress SHF_COMPRESSED sections. This enables
us to read data from debug info sections, which are sometimes compressed,
particuarly in the split-dwarf case.  This functionality is only available if
llvm is compiled with zlib support.

Reviewers: clayborg, zturner

Subscribers: emaste, mgorny, aprantl, lldb-commits

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

llvm-svn: 320813

6 years ago[X86] Add MWAITX/MONITORX schedule tests
Simon Pilgrim [Fri, 15 Dec 2017 14:22:15 +0000 (14:22 +0000)]
[X86] Add MWAITX/MONITORX schedule tests

llvm-svn: 320812

6 years agoFix the second build bot break introduced by r320791.
Nemanja Ivanovic [Fri, 15 Dec 2017 14:17:45 +0000 (14:17 +0000)]
Fix the second build bot break introduced by r320791.

llvm-svn: 320811

6 years ago[X86] Add XOP schedule tests
Simon Pilgrim [Fri, 15 Dec 2017 14:02:35 +0000 (14:02 +0000)]
[X86] Add XOP schedule tests

llvm-svn: 320810

6 years agollgs-tests: Make addition of new tests easier
Pavel Labath [Fri, 15 Dec 2017 13:56:22 +0000 (13:56 +0000)]
llgs-tests: Make addition of new tests easier

Summary:
Adding a new test would require one to duplicate a significant part of
the existing test that we have. This attempts to reduce that by moving
some part of that code to the test fixture. The StandardStartupTest
fixture automatically starts up the server and connects it to the
client. I also add a more low-level TestBase fixture, which allows one
to start up the client and server in a custom way (I am going to need
this for the test I am writing).

Reviewers: eugene, zturner

Subscribers: lldb-commits, mgorny

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

llvm-svn: 320809

6 years agoAdded a separate install target for compilert-rt-headers
Ilya Biryukov [Fri, 15 Dec 2017 13:20:13 +0000 (13:20 +0000)]
Added a separate install target for compilert-rt-headers

Summary:
This patch adds a new install target `install-compilert-rt-headers`,
that is similar to `install-clang-headers`.

It allows to install the headers without installing all of
compiler-rt.

Reviewers: alekseyshl, beanz

Reviewed By: beanz

Subscribers: smeenai, beanz, mgorny, #sanitizers, kcc, llvm-commits

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

llvm-svn: 320808

6 years ago[clangd] Build in-memory index on symbols in files.
Eric Liu [Fri, 15 Dec 2017 12:25:02 +0000 (12:25 +0000)]
[clangd] Build in-memory index on symbols in files.

Reviewers: sammccall

Reviewed By: sammccall

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

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

llvm-svn: 320807

6 years agoFix code causing fallthrough warnings in the PPC back end.
Nemanja Ivanovic [Fri, 15 Dec 2017 11:47:48 +0000 (11:47 +0000)]
Fix code causing fallthrough warnings in the PPC back end.

llvm-svn: 320806

6 years ago[X86] Add AVX512 VPOPCNTDQ schedule tests
Simon Pilgrim [Fri, 15 Dec 2017 11:32:31 +0000 (11:32 +0000)]
[X86] Add AVX512 VPOPCNTDQ schedule tests

Demonstrates how to perform full coverage avx512 schedule tests

llvm-svn: 320805