platform/upstream/llvm.git
7 years agoDelete special-case "out-of-range" handling for bools, and just use the normal
Richard Smith [Wed, 6 Dec 2017 19:23:19 +0000 (19:23 +0000)]
Delete special-case "out-of-range" handling for bools, and just use the normal
codepath plus the new "minimum / maximum value of type" diagnostic to get the
same effect.

Move the warning for an in-range but tautological comparison of a constant (0
or 1) against a bool out of -Wtautological-constant-out-of-range-compare into
the more-appropriate -Wtautological-constant-compare.

llvm-svn: 319942

7 years ago[ModRefInfo] Use createModRefInfo wrapper to create a ModRefInfo from FunctionModRefB...
Alina Sbirlea [Wed, 6 Dec 2017 19:23:03 +0000 (19:23 +0000)]
[ModRefInfo] Use createModRefInfo wrapper to create a ModRefInfo from FunctionModRefBehavior.

llvm-svn: 319941

7 years ago[Hexagon] Suppress warnings on unused variables defind for asserts.
Tim Shen [Wed, 6 Dec 2017 19:22:19 +0000 (19:22 +0000)]
[Hexagon] Suppress warnings on unused variables defind for asserts.

llvm-svn: 319940

7 years agoFix const-correctness in RegisterContext methods, NFC
Vedant Kumar [Wed, 6 Dec 2017 19:21:12 +0000 (19:21 +0000)]
Fix const-correctness in RegisterContext methods, NFC

A few methods in RegisterContext classes accept const objects which are
cast to a non-const thread_state_t. Drop const-ness more explicitly
where we mean to do so. This fixes a slew of warnings.

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

llvm-svn: 319939

7 years agoFix an -Wunused-function warning, NFC
Vedant Kumar [Wed, 6 Dec 2017 19:21:11 +0000 (19:21 +0000)]
Fix an -Wunused-function warning, NFC

llvm-svn: 319938

7 years agoFix misc -Wcast-qual warnings, NFC
Vedant Kumar [Wed, 6 Dec 2017 19:21:11 +0000 (19:21 +0000)]
Fix misc -Wcast-qual warnings, NFC

llvm-svn: 319937

7 years agoRemove no-op function pointer null checks, NFC
Vedant Kumar [Wed, 6 Dec 2017 19:21:10 +0000 (19:21 +0000)]
Remove no-op function pointer null checks, NFC

Null-checking functions which aren't marked weak_import is a no-op
(the compiler rewrites the check to 'true'), regardless of whether a
library providing its definition is weak-linked. If the deployment
target is greater than the minimum requirement, the availability markup
on APIs does not lower to weak_import.

Remove no-op null checks to clean up the code and silence warnings.

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

llvm-svn: 319936

7 years agoUse a static_cast instead of a C cast, NFC
Vedant Kumar [Wed, 6 Dec 2017 19:21:09 +0000 (19:21 +0000)]
Use a static_cast instead of a C cast, NFC

Pointed out by Davide Italiano in post-commit review.

llvm-svn: 319935

7 years ago[MappedHash] Fix alignment violations
Vedant Kumar [Wed, 6 Dec 2017 19:21:08 +0000 (19:21 +0000)]
[MappedHash] Fix alignment violations

This fixes a few alignment problems pointed out by UBSan, and is
otherwise NFC.

llvm-svn: 319934

7 years ago[COFF] Ignore semicolons in module definition identifiers
Rui Ueyama [Wed, 6 Dec 2017 19:18:24 +0000 (19:18 +0000)]
[COFF] Ignore semicolons in module definition identifiers

Patch by David Major.

The NSS project's .def files make heavy use of semicolons in a
frightening attempt at portability:
https://hg.mozilla.org/projects/nss/raw-file/tip/lib/ckfw/capi/nsscapi.def

lld-link was treating the semicolon as part of the export name,
resulting in unresolved symbols. This patch includes ';' in the list of
characters to split on.

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

llvm-svn: 319933

7 years agoConvert a check to checkLazy.
Rafael Espindola [Wed, 6 Dec 2017 19:17:20 +0000 (19:17 +0000)]
Convert a check to checkLazy.

This brings memory allocations when linking clang from 270.96MB to
267.80MB.

llvm-svn: 319932

7 years agoFix PR35542: Correct adjusting of private reduction variable
Jonas Hahnfeld [Wed, 6 Dec 2017 19:15:28 +0000 (19:15 +0000)]
Fix PR35542: Correct adjusting of private reduction variable

The adjustment is calculated with CreatePtrDiff() which returns
the difference in (base) elements. This is passed to CreateGEP()
so make sure that the GEP base has the correct pointer type:
It needs to be a pointer to the base type, not a pointer to a
constant sized array.

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

llvm-svn: 319931

7 years agoAdd an early return.
Rafael Espindola [Wed, 6 Dec 2017 19:13:23 +0000 (19:13 +0000)]
Add an early return.

Total memory allocation when linking clang goes from 281.80MB to
270.96MB.

llvm-svn: 319930

7 years ago[TSan] Make more TSan interceptors symbolizer-aware.
Alex Shlyapnikov [Wed, 6 Dec 2017 19:12:57 +0000 (19:12 +0000)]
[TSan] Make more TSan interceptors symbolizer-aware.

Summary:
Switching the rest of intercepted allocs to InternalAlloc (well, except
__libc_memalign) when current thread is 'in_symbolizer'. Symbolizer
might (and does) use allocation functions other than malloc/calloc/realloc.

posix_memalign is the one actually used, others switched just in case
(since the failure is obscure and not obvious to diagnose).

Reviewers: dvyukov

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 319929

7 years ago[LoopUtils] fix variable name to match FMF vocabulary; NFC
Sanjay Patel [Wed, 6 Dec 2017 19:11:23 +0000 (19:11 +0000)]
[LoopUtils] fix variable name to match FMF vocabulary; NFC

llvm-svn: 319928

7 years agoConvert a few uses of check to checkLazy.
Rafael Espindola [Wed, 6 Dec 2017 19:08:10 +0000 (19:08 +0000)]
Convert a few uses of check to checkLazy.

Linking clang goes from 292.68MB to 281.80MB allocated.

llvm-svn: 319927

7 years agoConvert a call to check to checkLazy.
Rafael Espindola [Wed, 6 Dec 2017 19:02:12 +0000 (19:02 +0000)]
Convert a call to check to checkLazy.

Linking clang goes from 300.82MB to 292.68MB allocated.

llvm-svn: 319926

7 years agoUpdate obj2yaml and yaml2obj for .debug$H section.
Zachary Turner [Wed, 6 Dec 2017 18:58:48 +0000 (18:58 +0000)]
Update obj2yaml and yaml2obj for .debug$H section.

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

llvm-svn: 319925

7 years agoReplace one use of check with checkLazy.
Rafael Espindola [Wed, 6 Dec 2017 18:56:22 +0000 (18:56 +0000)]
Replace one use of check with checkLazy.

Reduce total allocation when linking clang from 320.04MB to 300.82MB.

llvm-svn: 319924

7 years ago[Target] dumpr() is defined only in debug builds.
Davide Italiano [Wed, 6 Dec 2017 18:54:17 +0000 (18:54 +0000)]
[Target] dumpr() is defined only in debug builds.

This fixes the clang build on macOS.

llvm-svn: 319923

7 years agoAdd a checkLazy error checking variant.
Rafael Espindola [Wed, 6 Dec 2017 18:52:13 +0000 (18:52 +0000)]
Add a checkLazy error checking variant.

This avoids allocating the error message when there is no error that
check requires.

It avoids the code duplication of inlining check.

llvm-svn: 319922

7 years ago[X86][SSE] Regenerate vpmovm2*/vpmov*2m avx512 schedule tests
Simon Pilgrim [Wed, 6 Dec 2017 18:47:37 +0000 (18:47 +0000)]
[X86][SSE] Regenerate vpmovm2*/vpmov*2m avx512 schedule tests

llvm-svn: 319921

7 years ago[X86][AVX512] Tag scalar insert/extract instruction scheduler classes
Simon Pilgrim [Wed, 6 Dec 2017 18:46:06 +0000 (18:46 +0000)]
[X86][AVX512] Tag scalar insert/extract instruction scheduler classes

Classes don't look great but match what we're doing on SSE/AVX

llvm-svn: 319920

7 years ago[X86] Simplify the TTI code for getInterleavedMemoryOpCost around for AVX512BW. NFCI
Craig Topper [Wed, 6 Dec 2017 18:40:46 +0000 (18:40 +0000)]
[X86] Simplify the TTI code for getInterleavedMemoryOpCost around for AVX512BW. NFCI

Previously the lambda for AVX512 passed out a flag that indicated whether AVX512BW was required and that was checked against the AVX512BW subtarget flag outside.

This patch changes the interface to pass the AVX512BW subtarget bit in and return its value if we detect 16 or 8 bit types.

llvm-svn: 319919

7 years agoDon't allocate memory for an error message on success.
Rafael Espindola [Wed, 6 Dec 2017 18:39:22 +0000 (18:39 +0000)]
Don't allocate memory for an error message on success.

This takes memory allocations when linking clang-fsds from 342.08MB to
320.04MB.

llvm-svn: 319918

7 years ago[cmake] Remove unnecessary header include in atomics check
Shoaib Meenai [Wed, 6 Dec 2017 18:33:07 +0000 (18:33 +0000)]
[cmake] Remove unnecessary header include in atomics check

The header include was required to work around PR19898, as noted in that
comment. That PR has since been marked resolved fixed, and the
configuration check passes without the header inclusion both when
compiling on Windows with cl and when cross-compiling on Linux using
clang-cl.

I noticed this because the inclusion was cased incorrectly (Intrin.h
instead of intrin.h), which when cross-compiling on a case sensitive
file system would cause the intrin.h from the Windows SDK to be included
(which LLVM can't handle) instead of the one from clang's resource
directory, making the check fail. This is the same issue as r309980.
Correcting the case of the inclusion makes the check pass when cross
compiling, but it seems better to get rid of the inclusion entirely,
since it appears to be unnecessary now.

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

llvm-svn: 319917

7 years agoDon't allocate an error message when there is no error.
Rafael Espindola [Wed, 6 Dec 2017 18:31:11 +0000 (18:31 +0000)]
Don't allocate an error message when there is no error.

According to heaptrack this takes "bytes allocated in total" when
linking clang-fsds from 405.69MB to 342.08MB.

llvm-svn: 319916

7 years ago[X86][AVX2] Tag MASKMOV instruction scheduler classes
Simon Pilgrim [Wed, 6 Dec 2017 18:24:48 +0000 (18:24 +0000)]
[X86][AVX2] Tag MASKMOV instruction scheduler classes

llvm-svn: 319915

7 years ago[X86] Regenerate test for r319778
Craig Topper [Wed, 6 Dec 2017 18:04:39 +0000 (18:04 +0000)]
[X86] Regenerate test for r319778

llvm-svn: 319914

7 years ago[X86][AVX512] Tag aligned/unaligned move instruction scheduler classes
Simon Pilgrim [Wed, 6 Dec 2017 17:59:26 +0000 (17:59 +0000)]
[X86][AVX512] Tag aligned/unaligned move instruction scheduler classes

llvm-svn: 319913

7 years ago[X86][AVX] Regenerate vpmovm2*/vpmov*2m avx512 schedule tests
Simon Pilgrim [Wed, 6 Dec 2017 17:57:18 +0000 (17:57 +0000)]
[X86][AVX] Regenerate vpmovm2*/vpmov*2m avx512 schedule tests

llvm-svn: 319912

7 years ago[X86] Attempt to fix a ubsan failure in the autoupgrade of kunpck intrinsics.
Craig Topper [Wed, 6 Dec 2017 17:54:07 +0000 (17:54 +0000)]
[X86] Attempt to fix a ubsan failure in the autoupgrade of kunpck intrinsics.

llvm-svn: 319911

7 years agoInstructionSimplify: 'extractelement' with an undef index is undef
Zvi Rackover [Wed, 6 Dec 2017 17:51:46 +0000 (17:51 +0000)]
InstructionSimplify: 'extractelement' with an undef index is undef

Summary:
An undef extract index can be arbitrarily chosen to be an
out-of-range index value, which would result in the instruction being undef.

This change closes a gap identified while working on lowering vector permute intrinsics
with variable index vectors to pure LLVM IR.

Reviewers: arsenm, spatel, majnemer

Reviewed By: arsenm, spatel

Subscribers: fhahn, nhaehnle, wdng, llvm-commits

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

llvm-svn: 319910

7 years ago[NVPTX,CUDA] Added llvm.nvvm.fns intrinsic and matching __nvvm_fns builtin in clang.
Artem Belevich [Wed, 6 Dec 2017 17:50:05 +0000 (17:50 +0000)]
[NVPTX,CUDA] Added llvm.nvvm.fns intrinsic and matching __nvvm_fns builtin in clang.

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

llvm-svn: 319909

7 years ago[CUDA] Added overloads for '[unsigned] long' variants of shfl builtins.
Artem Belevich [Wed, 6 Dec 2017 17:40:35 +0000 (17:40 +0000)]
[CUDA] Added overloads for '[unsigned] long' variants of shfl builtins.

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

llvm-svn: 319908

7 years agoAMDGPU Tests: Change a case to be run with -O0
Zvi Rackover [Wed, 6 Dec 2017 17:40:09 +0000 (17:40 +0000)]
AMDGPU Tests: Change a case to be run with -O0

D40231 requires to run case with -O0 to prevent InstructionSimplify from
transforming an extractelement with undef index.

llvm-svn: 319907

7 years ago[Sanitizers] Use SANITIZER_* macros in lib/interception
Kamil Rytarowski [Wed, 6 Dec 2017 17:02:00 +0000 (17:02 +0000)]
[Sanitizers] Use SANITIZER_* macros in lib/interception

Summary:
Unlike the rest of the sanitizer code, lib/interception uses native macros like __linux__
to check for specific targets instead of the common ones like SANITIZER_LINUX.

When working on the Solaris port of the sanitizers, the current style was found to not
only be inconsistent, but clumsy to use because the canonical way to check for Solaris
is to check for __sun__ && __svr4__ which is a mouthful.

Therefore, this patch switches to use SANITIZER_* macros instead.

Tested on x86_64-pc-linux-gnu.

Reviewers: kcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: #sanitizers, srhines, krytarowski, llvm-commits, fedor.sergeev

Tags: #sanitizers

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

llvm-svn: 319906

7 years ago[SystemZ] Add IntrWriteMem flag to int_s390_tabort intrinsic
Jonas Paulsson [Wed, 6 Dec 2017 17:01:08 +0000 (17:01 +0000)]
[SystemZ]  Add IntrWriteMem flag to int_s390_tabort intrinsic

Tabort (transaction abort) does not load from memory.

mayLoad flag removed from corresponding TABORT machine instruction.

Review: Ulrich Weigand
llvm-svn: 319905

7 years agoStringizing raw string literals containing newline
Taewook Oh [Wed, 6 Dec 2017 17:00:53 +0000 (17:00 +0000)]
Stringizing raw string literals containing newline

Summary: This patch implements 4.3 of http://open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4220.pdf. If a raw string contains a newline character, replace each newline character with the \n escape code. Without this patch, included test case (macro_raw_string.cpp) results compilation failure.

Reviewers: rsmith, doug.gregor, jkorous-apple

Reviewed By: jkorous-apple

Subscribers: jkorous-apple, vsapsai, cfe-commits

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

llvm-svn: 319904

7 years ago[scudo] Correct performance regression in Secondary
Kostya Kortchinsky [Wed, 6 Dec 2017 16:53:24 +0000 (16:53 +0000)]
[scudo] Correct performance regression in Secondary

Summary:
This wasn't noticed: `RoundUpTo` doesn't produce a constant expression, so the
sizes were not constant either. Enforce them to be static const, replace
`RoundUpTo` by its expression. The compiler can now optimize the associated
computations accordingly.

Also looking at the produced assembly, `PageSize` was fetched multiple times
during `Allocate`, so keep a local value of it. As a result it's fetched once
and kept in a register.

Reviewers: alekseyshl, flowerhack

Reviewed By: alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 319903

7 years ago[opt-viewer] Suppress noisy Swift remarks
Adam Nemet [Wed, 6 Dec 2017 16:50:50 +0000 (16:50 +0000)]
[opt-viewer] Suppress noisy Swift remarks

Most likely, this is not how we want to handle this in the long term.  This
code should probably be in the Swift repo and somehow plugged into the
opt-viewer.  This is still however very experimental at this point so I don't
want to over-engineer it at this point.

llvm-svn: 319902

7 years ago[Hexagon] Generate HVX code for vector construction and access
Krzysztof Parzyszek [Wed, 6 Dec 2017 16:40:37 +0000 (16:40 +0000)]
[Hexagon] Generate HVX code for vector construction and access

Support for:
  - build vector,
  - extract vector element, subvector,
  - insert vector element, subvector,
  - shuffle.

llvm-svn: 319901

7 years ago[X86][AVX512] Tag BROADCAST instruction scheduler classes
Simon Pilgrim [Wed, 6 Dec 2017 15:48:40 +0000 (15:48 +0000)]
[X86][AVX512] Tag BROADCAST instruction scheduler classes

llvm-svn: 319900

7 years ago[ARM][AArch64][DAG] Reenable post-legalize store merge
Nirav Dave [Wed, 6 Dec 2017 15:30:13 +0000 (15:30 +0000)]
[ARM][AArch64][DAG] Reenable post-legalize store merge

Reenable post-legalize stores with constant merging computation and
corresponding test case.

 * Properly truncate store merge constants
 * Disable merging of truncated stores floating points
 * Ensure merges of constant stores into a single vector are
   constructed from legal elements.

Reviewers: eastig, efriedma

Reviewed By: eastig

Subscribers: spatel, rengolin, aemerson, javed.absar, kristof.beyls, hiraditya, llvm-commits

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

llvm-svn: 319899

7 years ago[cmake] Move CMAKE_(C|CXX)_COMPILER variables before CROSS_TOOLCHAIN_FLAGS so
Don Hinton [Wed, 6 Dec 2017 15:25:14 +0000 (15:25 +0000)]
[cmake] Move CMAKE_(C|CXX)_COMPILER variables before CROSS_TOOLCHAIN_FLAGS so
they can be overridden when cross compiling.

Summary:
Since CROSS_TOOLCHAN_FLAGS can set CMAKE_(C|CXX)_COMPILER
variables, move the compiler variables up front so they can be
overridden.

This is a followup to https://reviews.llvm.org/D40229 committed in rL319620.

Thanks to Pavel Labath for reporting this issue.

Reviewers: labath, beanz

Subscribers: mgorny, llvm-commits

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

llvm-svn: 319898

7 years ago[OPENMP] Improve error message for mapping union members.
Alexey Bataev [Wed, 6 Dec 2017 15:04:36 +0000 (15:04 +0000)]
[OPENMP] Improve error message for mapping union members.

llvm-svn: 319897

7 years ago[OPENMP] Initial codegen for `teams distribute simd` directive.
Alexey Bataev [Wed, 6 Dec 2017 14:31:09 +0000 (14:31 +0000)]
[OPENMP] Initial codegen for `teams distribute simd` directive.

Host + default devices codegen for `teams distribute simd` directive.

llvm-svn: 319896

7 years ago[X86][AVX512] Regenerate vpmovm2*/vpmov*2m avx512 schedule tests
Simon Pilgrim [Wed, 6 Dec 2017 14:07:38 +0000 (14:07 +0000)]
[X86][AVX512] Regenerate vpmovm2*/vpmov*2m avx512 schedule tests

llvm-svn: 319895

7 years ago[InstSimplify] Fold insertelement into undef if index is out of bounds
Igor Laevsky [Wed, 6 Dec 2017 14:04:45 +0000 (14:04 +0000)]
[InstSimplify] Fold insertelement into undef if index is out of bounds

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

llvm-svn: 319894

7 years ago[compiler-rt][xray][cmake] Fix a build issue caused by set/item mixup
Simon Dardis [Wed, 6 Dec 2017 14:03:41 +0000 (14:03 +0000)]
[compiler-rt][xray][cmake] Fix a build issue caused by set/item mixup

r319165 introduced a change to CMakeLists.txt for xray where the set of supported
architectures for XRay was iterated over, tested if they could be targeted then
passed to add_compiler_rt_object_libraries. However all targets were passed,
rather than the architecture that was just tested. For cases such as MIPS, where
mips and mips64 are supported, cmake would then test if mips64 could be targetted
resulting in an attempt to produce multiple identical logical target names, falling
afowl of CMP0002.

Reviewers: dberris

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

llvm-svn: 319893

7 years ago[SystemZ] Bugfix in expandRxSBG()
Jonas Paulsson [Wed, 6 Dec 2017 13:53:24 +0000 (13:53 +0000)]
[SystemZ]  Bugfix in expandRxSBG()

Csmith discovered a program that caused wrong code generation with -O0:

When handling a SIGN_EXTEND in expandRxSBG(), RxSBG.BitSize may be less than
the Input width (if a truncate was previously traversed), so maskMatters()
should be called with a masked based on the width of the sign extend result
instead.

Review: Ulrich Weigand
llvm-svn: 319892

7 years ago[X86] Avoid unused variable warning in Release builds. NFCI.
Benjamin Kramer [Wed, 6 Dec 2017 13:32:36 +0000 (13:32 +0000)]
[X86] Avoid unused variable warning in Release builds. NFCI.

llvm-svn: 319891

7 years ago[X86][AVX512] Drop default NoItinerary arguments that aren't needed
Simon Pilgrim [Wed, 6 Dec 2017 13:14:44 +0000 (13:14 +0000)]
[X86][AVX512] Drop default NoItinerary arguments that aren't needed

Requires reordering of AVX512_maskable_common arguments, but helps track what is still missing itinerary tags

llvm-svn: 319890

7 years ago[SCEV][NFC] Check NoWrap flags before lexicographical comparison of SCEVs
Max Kazantsev [Wed, 6 Dec 2017 12:44:56 +0000 (12:44 +0000)]
[SCEV][NFC] Check NoWrap flags before lexicographical comparison of SCEVs

Lexicographical comparison of SCEV trees is potentially expensive for big
expression trees. We can define ordering between them for AddRecs and
N-ary operations by SCEV NoWrap flags to make non-equality check
cheaper.

This change does not prevent grouping eqivalent SCEVs together and is
not supposed to have any meaningful impact on behavior of any transforms.

Reviewed By: sanjoy
Differential Revision: https://reviews.llvm.org/D40645

llvm-svn: 319889

7 years ago[mips] Fix definition of 'bc' instruction
Simon Dardis [Wed, 6 Dec 2017 12:42:49 +0000 (12:42 +0000)]
[mips] Fix definition of 'bc' instruction

llvm-svn: 319888

7 years ago[X86][AVX512] Tag Mask<->Vector instructions scheduler classes
Simon Pilgrim [Wed, 6 Dec 2017 11:59:05 +0000 (11:59 +0000)]
[X86][AVX512] Tag Mask<->Vector instructions scheduler classes

llvm-svn: 319887

7 years ago[CodeGen] Fix formatting error from r319885
Francis Visoiu Mistrih [Wed, 6 Dec 2017 11:57:53 +0000 (11:57 +0000)]
[CodeGen] Fix formatting error from r319885

llvm-svn: 319886

7 years ago[CodeGen] Better handling of detached MachineOperands
Francis Visoiu Mistrih [Wed, 6 Dec 2017 11:55:42 +0000 (11:55 +0000)]
[CodeGen] Better handling of detached MachineOperands

Basically use getMFIfAvailable to check if we can crawl up to the
function.

llvm-svn: 319885

7 years ago[X86][AVX512] Cleanup scalar move scheduler classes
Simon Pilgrim [Wed, 6 Dec 2017 11:23:13 +0000 (11:23 +0000)]
[X86][AVX512] Cleanup scalar move scheduler classes

llvm-svn: 319884

7 years ago[OpenCL] Fix layering violation by getOpenCLTypeAddrSpace
Sven van Haastregt [Wed, 6 Dec 2017 10:11:28 +0000 (10:11 +0000)]
[OpenCL] Fix layering violation by getOpenCLTypeAddrSpace

Commit 7ac28eb0a5 / r310911 ("[OpenCL] Allow targets to select address
space per type", 2017-08-15) made Basic depend on AST, introducing a
circular dependency.  Break this dependency by adding the
OpenCLTypeKind enum in Basic and map from AST types to this enum in
ASTContext.

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

llvm-svn: 319883

7 years ago[[Machine]Dominators] Improved printout when verifyDomTree fails [NFC]
Mikael Holmen [Wed, 6 Dec 2017 09:27:48 +0000 (09:27 +0000)]
[[Machine]Dominators] Improved printout when verifyDomTree fails [NFC]

Include the function name in the printout.

llvm-svn: 319882

7 years ago[libclang] Add function to get the buffer for a file
Erik Verbruggen [Wed, 6 Dec 2017 09:02:52 +0000 (09:02 +0000)]
[libclang] Add function to get the buffer for a file

This can be used by clients in conjunction with an offset returned by
e.g. clang_getFileLocation. Now those clients do not need to also
open/read the file.

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

llvm-svn: 319881

7 years ago[SCEV][NFC] Share value cache between SCEVs in GroupByComplexity
Max Kazantsev [Wed, 6 Dec 2017 08:58:16 +0000 (08:58 +0000)]
[SCEV][NFC] Share value cache between SCEVs in GroupByComplexity

Current implementation of `compareSCEVComplexity` is being unreasonable with `SCEVUnknown`s:
every time it sees one, it creates a new value cache and tries to prove equality of two values using it.
This cache reallocates and gets lost from SCEV to SCEV.

This patch changes this behavior: now we create one cache for all values and share it between SCEVs.

Reviewed By: sanjoy
Differential Revision: https://reviews.llvm.org/D40597

llvm-svn: 319880

7 years ago[ELF] - Show .plt symbols in -Map output.
George Rimar [Wed, 6 Dec 2017 08:36:21 +0000 (08:36 +0000)]
[ELF] - Show .plt symbols in -Map output.

As mentioned in PR35471, shared functions for which
.plt entry address is used shows up in bfd's map files.
Patch teaches LLD to do the same.

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

llvm-svn: 319879

7 years ago[X86] Split 512-bit vector extends from types other than vXi1 out of LowerZERO_EXTEND...
Craig Topper [Wed, 6 Dec 2017 07:37:20 +0000 (07:37 +0000)]
[X86] Split 512-bit vector extends from types other than vXi1 out of LowerZERO_EXTEND_AVX512/LowerSIGN_EXTEND_AVX512. NFCI

Most of the code in these routines is for handling extends from vXi1 types. The 512-bit handling for other extends is very much like the AVX2 code. So make the special routines just do vXi1 types and move the other 512-bit handling to the place that handles AVX2.

llvm-svn: 319878

7 years agoMake this test a bit less confusing.
Rafael Espindola [Wed, 6 Dec 2017 03:35:40 +0000 (03:35 +0000)]
Make this test a bit less confusing.

Before this patch foo and bar have the same address as .text is empty.

llvm-svn: 319877

7 years ago[WebAssembly] Remove wasm/Strings.cpp+h
Sam Clegg [Wed, 6 Dec 2017 03:10:39 +0000 (03:10 +0000)]
[WebAssembly] Remove wasm/Strings.cpp+h

This file contained only a single function that was only
really needed in one place, so just inline it.

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

llvm-svn: 319876

7 years agoFix a bunch of wrong "tautological unsigned enum compare" diagnostics in C++.
Richard Smith [Wed, 6 Dec 2017 03:00:51 +0000 (03:00 +0000)]
Fix a bunch of wrong "tautological unsigned enum compare" diagnostics in C++.

An enumeration with a fixed underlying type can have any value in its
underlying type, not just those spanned by the values of its enumerators.

llvm-svn: 319875

7 years agoFix a crash.
Rafael Espindola [Wed, 6 Dec 2017 02:53:43 +0000 (02:53 +0000)]
Fix a crash.

This is a constructed testcase I noticed while working on another
patch.

llvm-svn: 319874

7 years agoRevert r319482 and r319483 "[memcpyopt] Teach memcpyopt to optimize across basic...
Hans Wennborg [Wed, 6 Dec 2017 01:47:55 +0000 (01:47 +0000)]
Revert r319482 and r319483 "[memcpyopt] Teach memcpyopt to optimize across basic blocks"

This caused PR35519.

> [memcpyopt] Teach memcpyopt to optimize across basic blocks
>
> This teaches memcpyopt to make a non-local memdep query when a local query
> indicates that the dependency is non-local. This notably allows it to
> eliminate many more llvm.memcpy calls in common Rust code, often by 20-30%.
>
> Fixes PR28958.
>
> Differential Revision: https://reviews.llvm.org/D38374
>

> [memcpyopt] Commit file missed in r319482.
>
> This change was meant to be included with r319482 but was accidentally
> omitted.

llvm-svn: 319873

7 years agoFix typo fcvr -> fcvt and attempt to unbreak MSan/!NetBSD
Kamil Rytarowski [Wed, 6 Dec 2017 01:44:41 +0000 (01:44 +0000)]
Fix typo fcvr -> fcvt and attempt to unbreak MSan/!NetBSD

llvm-svn: 319872

7 years agoFix typo gcvr -> gcvt and attempt to unbreak MSan/!NetBSD
Kamil Rytarowski [Wed, 6 Dec 2017 01:43:38 +0000 (01:43 +0000)]
Fix typo gcvr -> gcvt and attempt to unbreak MSan/!NetBSD

llvm-svn: 319871

7 years ago[WebAssembly] Only emit stack pointer delcaration in BinFormatWasm assembly
Derek Schuff [Wed, 6 Dec 2017 01:38:29 +0000 (01:38 +0000)]
[WebAssembly] Only emit stack pointer delcaration in BinFormatWasm assembly

llvm-svn: 319870

7 years agoDo not use default arguments of DataLayout::getPointer*. NFC
Fangrui Song [Wed, 6 Dec 2017 01:32:06 +0000 (01:32 +0000)]
Do not use default arguments of DataLayout::getPointer*. NFC

Summary: There are "FIXME"s in include/llvm/IR/DataLayout.h to remove the default arguments.

Reviewers: zturner, clayborg

Reviewed By: zturner

Subscribers: bjope

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

llvm-svn: 319869

7 years agoSupport pthread_key_create symbol alias in MSan/NetBSD
Kamil Rytarowski [Wed, 6 Dec 2017 01:16:49 +0000 (01:16 +0000)]
Support pthread_key_create symbol alias in MSan/NetBSD

Summary:
NetBSD uses indirection symbol for a set of threading functions.

Add alias to handle __libc_thr_keycreate the same way as pthread_key_create.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, dvyukov, eugenis, vitalybuka

Reviewed By: vitalybuka

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 319868

7 years agoRevert "[DAGCombine] Move AND nodes to multiple load leaves"
Vlad Tsyrklevich [Wed, 6 Dec 2017 01:16:08 +0000 (01:16 +0000)]
Revert "[DAGCombine] Move AND nodes to multiple load leaves"

This reverts commit r319773. It was causing some buildbots to hang, e.g.
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-android/builds/5589

llvm-svn: 319867

7 years agoDisable absent functions in MSan/NetBSD interceptors
Kamil Rytarowski [Wed, 6 Dec 2017 01:03:11 +0000 (01:03 +0000)]
Disable absent functions in MSan/NetBSD interceptors

Summary:
Disable for NetBSD missing functions missing in this OS:

 - mempcpy,
 - __libc_memalign,
 - malloc_usable_size,
 - stpcpy,
 - gcvt,
 - wmempcpy,
 - fcvt.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, dvyukov, eugenis, vitalybuka, kcc

Reviewed By: vitalybuka

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 319866

7 years ago[WebAssembly] Fix test breakage from r319810
Derek Schuff [Wed, 6 Dec 2017 01:02:44 +0000 (01:02 +0000)]
[WebAssembly] Fix test breakage from r319810

llvm-svn: 319865

7 years agoRegex out the local hash comparison test.
Zachary Turner [Wed, 6 Dec 2017 00:58:12 +0000 (00:58 +0000)]
Regex out the local hash comparison test.

Since the local hash is a different number of bytes depending
on host architecture, we don't have a consistent value.  I
will need to re-do this test for both x86 and x64.  For now
it accepts any value for the local hash.

llvm-svn: 319864

7 years agoFix broken .gnu.hash section if -no-rosegment is given.
Rui Ueyama [Wed, 6 Dec 2017 00:49:48 +0000 (00:49 +0000)]
Fix broken .gnu.hash section if -no-rosegment is given.

We fill executable sections with trap instructions (0xcc or equivalent).
If a .gnu.hash section was put into an executable segment, we created
corrupted .gnu.hash section. This patch fixes the issue.

llvm-svn: 319863

7 years agoFix error in llvm-pdbutil.
Zachary Turner [Wed, 6 Dec 2017 00:26:43 +0000 (00:26 +0000)]
Fix error in llvm-pdbutil.

A recent change made this print the wrong value, breaking some
tests.  This is now fixed.

llvm-svn: 319862

7 years ago[X86] Update to getSetCCResultType to be more robust to EVT types.
Craig Topper [Wed, 6 Dec 2017 00:15:17 +0000 (00:15 +0000)]
[X86] Update to getSetCCResultType to be more robust to EVT types.

Attempt to determine what the type will be legalized to and then analyze that to see if we will be able to use a vXi1 compare.

llvm-svn: 319861

7 years ago[lld] Fix handling of wildcards in dynamic lists.
Evgeniy Stepanov [Wed, 6 Dec 2017 00:14:04 +0000 (00:14 +0000)]
[lld] Fix handling of wildcards in dynamic lists.

Reviewers: pcc, ruiu

Subscribers: llvm-commits, emaste

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

llvm-svn: 319860

7 years agoTeach llvm-pdbutil to dump types from object files.
Zachary Turner [Tue, 5 Dec 2017 23:58:18 +0000 (23:58 +0000)]
Teach llvm-pdbutil to dump types from object files.

llvm-svn: 319859

7 years agoP0722R2: The first parameter in an implicit call to a destroying operator
Richard Smith [Tue, 5 Dec 2017 23:54:25 +0000 (23:54 +0000)]
P0722R2: The first parameter in an implicit call to a destroying operator
delete should be a cv-unqualified pointer to the deleted object.

llvm-svn: 319858

7 years ago[docs] Update doc building instructions
Sam Clegg [Tue, 5 Dec 2017 23:31:26 +0000 (23:31 +0000)]
[docs] Update doc building instructions

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

llvm-svn: 319857

7 years ago[docs] Formatting-only change
Sam Clegg [Tue, 5 Dec 2017 23:28:04 +0000 (23:28 +0000)]
[docs] Formatting-only change

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

llvm-svn: 319856

7 years agoFix -Wmissing-braces error.
Zachary Turner [Tue, 5 Dec 2017 23:19:33 +0000 (23:19 +0000)]
Fix -Wmissing-braces error.

llvm-svn: 319855

7 years ago[CodeView] Add support for content hashing CodeView type records.
Zachary Turner [Tue, 5 Dec 2017 23:08:58 +0000 (23:08 +0000)]
[CodeView] Add support for content hashing CodeView type records.

Currently nothing uses this, but this at least gets the core
algorithm in, and adds some test to demonstrate correctness.

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

llvm-svn: 319854

7 years ago[SelectionDAG] Don't promote the condition operand of VSELECT when promoting the...
Craig Topper [Tue, 5 Dec 2017 23:08:32 +0000 (23:08 +0000)]
[SelectionDAG] Don't promote the condition operand of VSELECT when promoting the result.

The condition operand should be promoted during operand promotion.

llvm-svn: 319853

7 years ago[SelectionDAG] Don't promote mask operand when widening mstore and mscatter.
Craig Topper [Tue, 5 Dec 2017 23:08:30 +0000 (23:08 +0000)]
[SelectionDAG] Don't promote mask operand when widening mstore and mscatter.

If the mask needs to be promoted that should occur by the legalizer detecting the mask operand needs to be promoted not as a side effect of another action.

llvm-svn: 319852

7 years ago[SelectionDAG] Don't promote mask when splitting mstore.
Craig Topper [Tue, 5 Dec 2017 23:08:28 +0000 (23:08 +0000)]
[SelectionDAG] Don't promote mask when splitting mstore.

If the mask needs to be promoted it should be handled by operand promotion after the result is legalized.

llvm-svn: 319851

7 years ago[SelectionDAG] Don't promote mask operands of MGATHER and MLOAD to setcc result type...
Craig Topper [Tue, 5 Dec 2017 23:08:27 +0000 (23:08 +0000)]
[SelectionDAG] Don't promote mask operands of MGATHER and MLOAD to setcc result type while widening the result. Just widen the mask.

The mask will be promoted if necessary when operands are promoted. It's possible the mask type is legal, but the setcc result type is a different. We shouldn't promote to the setcc result type unless the mask needs to be promoted.

llvm-svn: 319850

7 years ago[SelectionDAG] Don't call GetWidenedVector for mask operands of MLOAD/MSTORE.
Craig Topper [Tue, 5 Dec 2017 23:08:25 +0000 (23:08 +0000)]
[SelectionDAG] Don't call GetWidenedVector for mask operands of MLOAD/MSTORE.

GetWidenedVector does't guarantee the widened elements are zero which would break the intended behavior of the operation.

llvm-svn: 319849

7 years agoFix another record-parsing-invocation.c test issue on Windows
Douglas Yung [Tue, 5 Dec 2017 23:04:12 +0000 (23:04 +0000)]
Fix another record-parsing-invocation.c test issue on Windows

Lit's env should be used before not. (Another case missed by the previous commit)

llvm-svn: 319848

7 years ago[Orc] (Hopefully) Fix a missing typedef.
Lang Hames [Tue, 5 Dec 2017 22:14:35 +0000 (22:14 +0000)]
[Orc] (Hopefully) Fix a missing typedef.

llvm-svn: 319845

7 years ago[msan] Fix formatting
Vitaly Buka [Tue, 5 Dec 2017 22:10:01 +0000 (22:10 +0000)]
[msan] Fix formatting

llvm-svn: 319844

7 years ago[msan] add strtouq msan interceptor
Vitaly Buka [Tue, 5 Dec 2017 22:07:26 +0000 (22:07 +0000)]
[msan] add strtouq msan interceptor

Summary: Fixes https://github.com/google/sanitizers/issues/892

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 319843

7 years agoRevert test case change for r319794
Xinliang David Li [Tue, 5 Dec 2017 21:54:20 +0000 (21:54 +0000)]
Revert  test case change for r319794

llvm-svn: 319842

7 years agoRevert r319794: [PGO] detect infinite loop and form MST properly: memory leak problem
Xinliang David Li [Tue, 5 Dec 2017 21:54:01 +0000 (21:54 +0000)]
Revert r319794: [PGO] detect  infinite loop and form MST properly: memory leak problem

llvm-svn: 319841