platform/upstream/llvm.git
7 years ago[clang] Add PRIVATE to target_link_libraries
Shoaib Meenai [Wed, 6 Dec 2017 23:02:00 +0000 (23:02 +0000)]
[clang] Add PRIVATE to target_link_libraries

Another follow-up to r319840. I'd done a test configure with
LLVM_BUILD_STATIC, so I'm not sure why this didn't show up in that.

llvm-svn: 319983

7 years agoRevert SVN r, 319967
Kamil Rytarowski [Wed, 6 Dec 2017 22:50:12 +0000 (22:50 +0000)]
Revert SVN r, 319967

"Correct atexit(3) support in MSan/NetBSD"

This causes failures on Linux.

llvm-svn: 319981

7 years ago[AArch64] Add patterns to replace fsub fmul with fma fneg.
Florian Hahn [Wed, 6 Dec 2017 22:48:36 +0000 (22:48 +0000)]
[AArch64] Add patterns to replace fsub fmul with fma fneg.

Summary:
This patch adds MachineCombiner patterns for transforming
(fsub (fmul x y) z) into (fma x y (fneg z)). This has a lower
latency on micro architectures where fneg is cheap.

Patch based on work by George Steed.

Reviewers: rengolin, joelkevinjones, joel_k_jones, evandro, efriedma

Reviewed By: evandro

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

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

llvm-svn: 319980

7 years ago[LV] Interleaved access vectorization: fix computing new alias info
Adam Nemet [Wed, 6 Dec 2017 22:42:24 +0000 (22:42 +0000)]
[LV] Interleaved access vectorization: fix computing new alias info

As a new access is generated spanning across multiple fields, we need to
propagate alias info from all the fields to form the most generic alias info.

rdar://35602528

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

llvm-svn: 319979

7 years ago[Hexagon] Recognize vdealb, vdealh, vshuffb and vshuffh specifically
Krzysztof Parzyszek [Wed, 6 Dec 2017 22:41:49 +0000 (22:41 +0000)]
[Hexagon] Recognize vdealb, vdealh, vshuffb and vshuffh specifically

llvm-svn: 319978

7 years agoFix broken windows sanitizer buildbot
Vlad Tsyrklevich [Wed, 6 Dec 2017 22:40:23 +0000 (22:40 +0000)]
Fix broken windows sanitizer buildbot

r319875 caused a sign comparison build failure. Explicitly set the
enum's type to be unsigned.

llvm-svn: 319977

7 years agoAdd a call to std::vector::reserve.
Rafael Espindola [Wed, 6 Dec 2017 22:32:19 +0000 (22:32 +0000)]
Add a call to std::vector::reserve.

This reduces total allocations when linking clang fsds from 263.21MB
to 174.62MB.

This also has some very nice speed improvements on some
benchmarks. Chromium and clang fsds link 6% faster.

llvm-svn: 319976

7 years ago[libFuzzer] fix a minor regression in printing
Kostya Serebryany [Wed, 6 Dec 2017 22:12:24 +0000 (22:12 +0000)]
[libFuzzer] fix a minor regression in printing

llvm-svn: 319975

7 years agoAlways evaluate the second argument for CHECK() lazily.
Rui Ueyama [Wed, 6 Dec 2017 22:08:17 +0000 (22:08 +0000)]
Always evaluate the second argument for CHECK() lazily.

This patch is to rename check CHECK and make it a C macro, so that
we can evaluate the second argument lazily.

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

llvm-svn: 319974

7 years ago[NFC] Fix formatting
Philip Pfaffe [Wed, 6 Dec 2017 22:01:08 +0000 (22:01 +0000)]
[NFC] Fix formatting

llvm-svn: 319973

7 years ago[libomptarget] Split implementation of interface functions
Jonas Hahnfeld [Wed, 6 Dec 2017 21:59:15 +0000 (21:59 +0000)]
[libomptarget] Split implementation of interface functions

This last of four patches adds a new file for the interface
functions that Clang uses during code generation. The only
change except simply moving the current code is renaming the
function CheckDeviceAndCtors() and using the correct type for
64bit device ids.

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

llvm-svn: 319972

7 years ago[libomptarget] Split implementation of API functions
Jonas Hahnfeld [Wed, 6 Dec 2017 21:59:12 +0000 (21:59 +0000)]
[libomptarget] Split implementation of API functions

This third patch moves the implementation of the user-facing
OpenMP API functions into its own file. For now, the code is
only moved, no cleanups applied yet.

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

llvm-svn: 319971

7 years ago[libomptarget] Split device functionality
Jonas Hahnfeld [Wed, 6 Dec 2017 21:59:09 +0000 (21:59 +0000)]
[libomptarget] Split device functionality

This is the second patch to split the current monolithic
implementation into separate files. Note that this change
doesn't cleanup the code yet.

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

llvm-svn: 319970

7 years ago[libomptarget] Split RTL plugin functionality
Jonas Hahnfeld [Wed, 6 Dec 2017 21:59:07 +0000 (21:59 +0000)]
[libomptarget] Split RTL plugin functionality

This is the first of four patches to split the target agnostic
library into multiple (smaller) files. It only moves the code
to separate implementation files and does no cleanup (yet) except
removing unneeded headers.

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

llvm-svn: 319969

7 years ago[libomptarget] Move header files and CMake library definition
Jonas Hahnfeld [Wed, 6 Dec 2017 21:59:04 +0000 (21:59 +0000)]
[libomptarget] Move header files and CMake library definition

Future patches will add (private) header files in src/ that should
not be visible to plugins, so move the "public" ones to a new
include/ directory. This is still internal in a sense that the
contained files won't be installed for the user.
Similarly, the target agnostic offloading library should be built
directly in src/. The parent directory is responsible for finding
dependencies and including all subdirectories.

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

llvm-svn: 319968

7 years agoCorrect atexit(3) support in MSan/NetBSD
Kamil Rytarowski [Wed, 6 Dec 2017 21:57:39 +0000 (21:57 +0000)]
Correct atexit(3) support in MSan/NetBSD

Summary:
The NetBSD specific implementation of cxa_atexit() does not
preserve the 2nd argument if dso is equal to NULL.

Changes:

 - Split paths of handling intercepted __cxa_atexit() and atexit(3).
   This affects all supported Operating Systems.
 - Add a local stack-like structure to hold the __cxa_atexit() context.
   atexit(3) is documented in the C standard as calling callback from the
   earliest to the oldest entry. This path also fixes potential ABI
   problem of passing an argument to a function from the atexit(3)
   callback mechanism.
 - Allow usage of global vars with ctors in interceptors.
   This allows to use Vector without automatic cleaning up the structures.

This code has been modeled after TSan implementation for the same functions.

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/D40714

llvm-svn: 319967

7 years agoHandle NetBSD symbol renaming in msan_interceptors.cc
Kamil Rytarowski [Wed, 6 Dec 2017 21:32:57 +0000 (21:32 +0000)]
Handle NetBSD symbol renaming in msan_interceptors.cc

Summary:
NetBSD renames symbols for historical and compat reasons.

Add required symbol renames in sanitizer_common_interceptors.inc:

 - gettimeofday -> __gettimeofday50
 - getrusage -> __getrusage50
 - shmctl -> __shmctl50

Additionally handle sigaction symbol mangling.
Rename the function symbol in the file to SIGACTION_SYMNAME and define
it as __sigaction14 for NetBSD and sigaction for !NetBSD. We cannot use
simple renaming with the proprocessor, as there are valid fields named
sigaction and they must be left intact.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, eugenis, vitalybuka, dvyukov

Reviewed By: vitalybuka

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 319966

7 years ago[Hexagon] Handle perfect shuffles on single vectors
Krzysztof Parzyszek [Wed, 6 Dec 2017 21:25:03 +0000 (21:25 +0000)]
[Hexagon] Handle perfect shuffles on single vectors

llvm-svn: 319965

7 years ago[InstCombine] canonicalize constant-minus-boolean to select-of-constants
Sanjay Patel [Wed, 6 Dec 2017 21:22:57 +0000 (21:22 +0000)]
[InstCombine] canonicalize constant-minus-boolean to select-of-constants

This restores the half of:
https://reviews.llvm.org/rL75531
that was reverted at:
https://reviews.llvm.org/rL159230

For the x86 case mentioned there, we now produce:
leal 1(%rdi), %eax
subl %esi, %eax

We have target hooks to invert this in DAGCombiner (and x86 is enabled) with:
https://reviews.llvm.org/rL296977
https://reviews.llvm.org/rL311731

AArch64 and possibly other targets would probably benefit from enabling those hooks too.
See PR30327:
https://bugs.llvm.org/show_bug.cgi?id=30327#c2

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

llvm-svn: 319964

7 years ago[PGO] Make indirect call promotion a utility
Matthew Simpson [Wed, 6 Dec 2017 21:22:54 +0000 (21:22 +0000)]
[PGO] Make indirect call promotion a utility

This patch factors out the main code transformation utilities in the pgo-driven
indirect call promotion pass and places them in Transforms/Utils. The change is
intended to be a non-functional change, letting non-pgo-driven passes share a
common implementation with the existing pgo-driven pass.

The common utilities are used to conditionally promote indirect call sites to
direct call sites. They perform the underlying transformation, and do not
consider profile information. The pgo-specific details (e.g., the computation
of branch weight metadata) have been left in the indirect call promotion pass.

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

llvm-svn: 319963

7 years ago[WebAssembly] Commit a file I accidentally omitted from r319956.
Dan Gohman [Wed, 6 Dec 2017 21:16:04 +0000 (21:16 +0000)]
[WebAssembly] Commit a file I accidentally omitted from r319956.

llvm-svn: 319962

7 years ago[OpenMP] Add entry for Intel Compiler 18
Jonathan Peyton [Wed, 6 Dec 2017 21:15:28 +0000 (21:15 +0000)]
[OpenMP] Add entry for Intel Compiler 18

Patch by Simon Convent

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

llvm-svn: 319961

7 years agoEliminate double printing of verbose affinity settings
Jonathan Peyton [Wed, 6 Dec 2017 21:07:41 +0000 (21:07 +0000)]
Eliminate double printing of verbose affinity settings

Redundant extra verbose output of binding to full mask in case
affinity=balanced or OMP_PLACES=<any> or OMP_PROC_BIND=<any>

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

llvm-svn: 319960

7 years ago[libc++] Create install-stripped targets
Shoaib Meenai [Wed, 6 Dec 2017 21:03:42 +0000 (21:03 +0000)]
[libc++] Create install-stripped targets

LLVM is gaining install-*-stripped targets to perform stripped installs,
and in order for this to be useful for install-distribution, all
potential distribution components should have stripped installation
targets. LLVM has a function to create these install targets, but since
we can't use LLVM CMake functions in libc++, let's do it manually.

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

llvm-svn: 319959

7 years agoPort SCEVAffinator to the isl c++ bindings
Philip Pfaffe [Wed, 6 Dec 2017 21:02:22 +0000 (21:02 +0000)]
Port SCEVAffinator to the isl c++ bindings

Summary: Straight forward port of SCEVAffinator

Reviewers: grosser, bollu, Meinersbur

Reviewed By: Meinersbur

Subscribers: pollydev, llvm-commits

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

llvm-svn: 319958

7 years agoTrivial enum fix
Jonathan Peyton [Wed, 6 Dec 2017 21:02:15 +0000 (21:02 +0000)]
Trivial enum fix

This change is a trivial fix for enums that removes specification of "last" or
"upper" values, or other boundary values. This simplifies the code in places,
and results in never needing to update the "upper" values again.

Patch by Terry Wilmarth

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

llvm-svn: 319957

7 years ago[WebAssembly] Remove WASM_STACK_POINTER.
Dan Gohman [Wed, 6 Dec 2017 20:56:40 +0000 (20:56 +0000)]
[WebAssembly] Remove WASM_STACK_POINTER.

WASM_STACK_POINTER and the .stack_pointer directive are no longer needed
now that the stack pointer global is an import.

llvm-svn: 319956

7 years ago[lld] Set up .arcconfig to point to new Diffusion LLD repository
Ben Hamilton [Wed, 6 Dec 2017 20:56:23 +0000 (20:56 +0000)]
[lld] Set up .arcconfig to point to new Diffusion LLD repository

Summary:
We want to automatically copy the appropriate mailing list
for review requests to the LLD repository.

For context, see the proposal and discussion here:

http://lists.llvm.org/pipermail/cfe-dev/2017-November/056032.html

Similar to D40179, I set up a new Diffusion repository with callsign
"LLD" for lld:

https://reviews.llvm.org/source/lld/

This explicitly updates lld's .arcconfig to point to the new C
repository in Diffusion, which will let us use Herald rule H270.

Reviewers: peter.smith, ruiu, rafael, sammccall

Reviewed By: sammccall

Subscribers: dlj, bkramer, sammccall, klimek

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

llvm-svn: 319955

7 years ago[compiler-rt] Set up .arcconfig to point to new Diffusion CRT repository
Ben Hamilton [Wed, 6 Dec 2017 20:55:32 +0000 (20:55 +0000)]
[compiler-rt] Set up .arcconfig to point to new Diffusion CRT repository

Summary:
We want to automatically copy the appropriate mailing list
as well as #sanitizers for review requests to the compiler-rt repository.

For context, see the proposal and discussion here:

http://lists.llvm.org/pipermail/cfe-dev/2017-November/056032.html

Similar to D40179, I set up a new Diffusion repository with callsign
"CRT" for compiler-rt:

https://reviews.llvm.org/source/compiler-rt/

This explicitly updates compiler-rt's .arcconfig to point to the new
CRT repository in Diffusion, which will let us use Herald rules H270
and H271.

Reviewers: krytarowski, joerg, dvyukov, vitalybuka, sammccall

Reviewed By: sammccall

Subscribers: dlj, bkramer, dberris, llvm-commits, sammccall, klimek, #sanitizers

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

llvm-svn: 319954

7 years ago[lldb] Use PRIVATE in target_link_libraries
Shoaib Meenai [Wed, 6 Dec 2017 20:53:03 +0000 (20:53 +0000)]
[lldb] Use PRIVATE in target_link_libraries

This is a follow-up to r319840. I guess none of the systems I'd tested
on before had LLDB_SYSTEM_LIBS set, which is why I didn't see any local
errors, but I'm surprised none of the bots caught it either.

llvm-svn: 319953

7 years ago[MachineCombiner] Add up latencies of all instructions in new pattern.
Florian Hahn [Wed, 6 Dec 2017 20:27:33 +0000 (20:27 +0000)]
[MachineCombiner] Add up latencies of all instructions in new pattern.

Summary:
When calculating the RootLatency, we add up all the latencies of the
deleted instructions. But for NewRootLatency we only add the latency of
the new root instructions, ignoring the latencies of the other
instructions inserted. This leads the combiner to underestimate the cost
of patterns which add multiple instructions. This patch fixes that by
summing up the latencies of all new instructions. For NewRootNode, the
more complex getLatency function is used.

Note that we may be slightly more precise than just summing up
all latencies. For example, consider a pattern like

    r1 = INS1 ..
    r2 = INS2 ..
    r3 = INS3 r1, r2

I think in some other places, the total latency of the pattern would be
estimated as lat(INS3) + max(lat(INS1), lat(INS2)). If you consider
that worth changing, I think it would be best to do in a follow-up
patch.

Reviewers: Gerolf, sebpop, spop, fhahn

Reviewed By: fhahn

Subscribers: evandro, llvm-commits

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

llvm-svn: 319951

7 years ago[clang] Use PRIVATE in target_link_libraries
Shoaib Meenai [Wed, 6 Dec 2017 20:05:42 +0000 (20:05 +0000)]
[clang] Use PRIVATE in target_link_libraries

I'd missed this one in r319840 because I hadn't been configuring with an
order file before.

llvm-svn: 319950

7 years ago[ModRefInfo] Do not use ModRefInfo result in if conditions as this makes
Alina Sbirlea [Wed, 6 Dec 2017 19:56:37 +0000 (19:56 +0000)]
[ModRefInfo] Do not use ModRefInfo result in if conditions as this makes
assumptions about the values in the enum. Replace with wrapper returning
bool [NFC].

llvm-svn: 319949

7 years ago[CMake] Use PRIVATE in target_link_libraries for fuzzers.
Matt Morehouse [Wed, 6 Dec 2017 19:52:40 +0000 (19:52 +0000)]
[CMake] Use PRIVATE in target_link_libraries for fuzzers.

Several fuzzers were missed by r319840.

llvm-svn: 319948

7 years ago[InlineFunction] Only replace call if there are VarArgs to forward.
Florian Hahn [Wed, 6 Dec 2017 19:47:24 +0000 (19:47 +0000)]
[InlineFunction] Only replace call if there are VarArgs to forward.

Summary:
There is no need to replace the original call instruction if no
 VarArgs need to be forwarded.

Reviewers: davide, rnk, majnemer, efriedma

Reviewed By: efriedma

Subscribers: eraman, llvm-commits

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

llvm-svn: 319947

7 years ago[LoopUtils] simplify createTargetReduction(); NFCI
Sanjay Patel [Wed, 6 Dec 2017 19:37:00 +0000 (19:37 +0000)]
[LoopUtils] simplify createTargetReduction(); NFCI

llvm-svn: 319946

7 years ago[X86][AVX512] Tag mask reg op instruction scheduler classes
Simon Pilgrim [Wed, 6 Dec 2017 19:36:00 +0000 (19:36 +0000)]
[X86][AVX512] Tag mask reg op instruction scheduler classes

llvm-svn: 319945

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

llvm-svn: 319944

7 years agoFix the -Wunused-function warning properly (MachProcess.mm)
Vedant Kumar [Wed, 6 Dec 2017 19:27:20 +0000 (19:27 +0000)]
Fix the -Wunused-function warning properly (MachProcess.mm)

r319938 was not NFC, because it got the preprocessor guard wrong. Check
WITH_FBS and WITH_BKS before defining SplitEventData.

llvm-svn: 319943

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