platform/upstream/llvm.git
5 years ago[Analysis] More LocationSize cleanup; NFC
George Burgess IV [Sat, 22 Dec 2018 18:23:21 +0000 (18:23 +0000)]
[Analysis] More LocationSize cleanup; NFC

Keeping these patches super small so they're easily post-commit
verifiable, as requested in D44748.

llvm-svn: 350008

5 years ago[Analysis] s/uint64_t/LocationSize; NFC
George Burgess IV [Sat, 22 Dec 2018 17:42:08 +0000 (17:42 +0000)]
[Analysis] s/uint64_t/LocationSize; NFC

Let the gradual cleanup from D44748 continue. :)

llvm-svn: 350007

5 years ago[DAGCombiner] allow narrowing of add followed by truncate
Sanjay Patel [Sat, 22 Dec 2018 17:10:31 +0000 (17:10 +0000)]
[DAGCombiner] allow narrowing of add followed by truncate

trunc (add X, C ) --> add (trunc X), C'

If we're throwing away the top bits of an 'add' instruction, do it in the narrow destination type.
This makes the truncate-able opcode list identical to the sibling transform done in IR (in instcombine).

This change used to show regressions for x86, but those are gone after D55494.
This gets us closer to deleting the x86 custom function (combineTruncatedArithmetic)
that does almost the same thing.

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

llvm-svn: 350006

5 years ago[x86] add load fold patterns for movddup with vzext_load
Sanjay Patel [Sat, 22 Dec 2018 16:59:02 +0000 (16:59 +0000)]
[x86] add load fold patterns for movddup with vzext_load

The missed load folding noticed in D55898 is visible independent of that change
either with an adjusted IR pattern to start or with AVX2/AVX512 (where the build
vector becomes a broadcast first; movddup is not produced until we get into isel
via tablegen patterns).

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

llvm-svn: 350005

5 years agoImproving this fatal diagnostic to help checker developers figure out what's actually...
Aaron Ballman [Sat, 22 Dec 2018 15:31:57 +0000 (15:31 +0000)]
Improving this fatal diagnostic to help checker developers figure out what's actually gone wrong when they hit it.

llvm-svn: 350004

5 years ago[AST] Store the arguments of CXXConstructExpr in a trailing array
Bruno Ricci [Sat, 22 Dec 2018 14:39:30 +0000 (14:39 +0000)]
[AST] Store the arguments of CXXConstructExpr in a trailing array

Store the arguments of CXXConstructExpr in a trailing array. This is very
similar to the CallExpr case in D55771, with the exception that there is
only one derived class (CXXTemporaryObjectExpr) and that we compute the
offset to the trailing array instead of storing it.

This saves one pointer per CXXConstructExpr and CXXTemporaryObjectExpr.

Reviewed By: rjmccall

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

llvm-svn: 350003

5 years ago[Sanitizer] Enable POSIX regex api on FreeBSD.
David Carlier [Sat, 22 Dec 2018 11:17:27 +0000 (11:17 +0000)]
[Sanitizer] Enable POSIX regex api on FreeBSD.

Reviewers: krytarowski

Reviewed By: krytarowski

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

M    lib/sanitizer_common/sanitizer_common_interceptors.inc
M    lib/sanitizer_common/sanitizer_platform_interceptors.h
M    lib/sanitizer_common/sanitizer_platform_limits_freebsd.cc
M    lib/sanitizer_common/sanitizer_platform_limits_freebsd.h
D    test/sanitizer_common/TestCases/NetBSD/regex.cc
A  + test/sanitizer_common/TestCases/Posix/regex.cc

llvm-svn: 350002

5 years ago[runtime] [test] Fix using %python path
Michal Gorny [Sat, 22 Dec 2018 10:51:53 +0000 (10:51 +0000)]
[runtime] [test] Fix using %python path

Fix the newly-added tests to use %python substitution in order to use
the correct path to Python interpreter.  Otherwise, they fail on NetBSD
where there is no 'python', just 'pythonX.Y'.

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

llvm-svn: 350001

5 years agoNFC][CodeGen][X86][AArch64] Tests for bit extract (pat. a/c/d) with trunc (PR36419)
Roman Lebedev [Sat, 22 Dec 2018 10:38:05 +0000 (10:38 +0000)]
NFC][CodeGen][X86][AArch64] Tests for bit extract (pat. a/c/d) with trunc (PR36419)

llvm-svn: 350000

5 years ago[NFC][CodeGen][X86][AArch64] Bit extract: add nounwind attr to drop .cfi noise
Roman Lebedev [Sat, 22 Dec 2018 09:58:13 +0000 (09:58 +0000)]
[NFC][CodeGen][X86][AArch64] Bit extract: add nounwind attr to drop .cfi noise

Forgot about that.

llvm-svn: 349999

5 years ago[NFC][CodeGen][X86][AArch64] Tests for bit extract (pat. b) with trunc (PR36419)
Roman Lebedev [Sat, 22 Dec 2018 09:40:14 +0000 (09:40 +0000)]
[NFC][CodeGen][X86][AArch64] Tests for bit extract (pat. b) with trunc (PR36419)

@bextr64_32_b1 is extracted from hotpath of real-world code
(RawSpeed BitStream<>::peekBitsNoFill()) after `clang -O3`.

@bextr64_32_b2/@bextr64_32_b0 is the same pattern,
but with trunc done last, showing how i think it can be handled:
https://rise4fun.com/Alive/K4B
https://rise4fun.com/Alive/qC9

It is possible that middle-end should do some of this, too.

https://bugs.llvm.org/show_bug.cgi?id=36419

llvm-svn: 349998

5 years agollvm-dwarfdump: Remove extraneous space between '(' and 'indexed'
David Blaikie [Sat, 22 Dec 2018 08:43:08 +0000 (08:43 +0000)]
llvm-dwarfdump: Remove extraneous space between '(' and 'indexed'

When dumping string or address indexes

llvm-svn: 349997

5 years agollvm-dwarfdump: Print the section name/number for addr_index attributes
David Blaikie [Sat, 22 Dec 2018 08:33:55 +0000 (08:33 +0000)]
llvm-dwarfdump: Print the section name/number for addr_index attributes

(addr attributes coming shortly)

llvm-svn: 349996

5 years agoDebugInfo: Refactor named section dumping into a reusable helper
David Blaikie [Sat, 22 Dec 2018 08:23:10 +0000 (08:23 +0000)]
DebugInfo: Refactor named section dumping into a reusable helper

Currently the section name (& possibly number) is only printed on
addresses in ranges - but no reason it couldn't also be displayed on
other addresses (like low/high PC).

Refactor in that direction by pulling out the section lookup and name
ambiguity dumping logic into a reusable helper.

llvm-svn: 349995

5 years agoAdd support for LLVM profile for NetBSD
Kamil Rytarowski [Sat, 22 Dec 2018 06:56:19 +0000 (06:56 +0000)]
Add support for LLVM profile for NetBSD

Summary:
NetBSD uses typical UNIX interfaces.

All tests pass except instrprof-dlopen-dlclose-gcov.test, as there
is not supported semantics of atexit(3) in dlopen(3)ed+dlclose(3)d
DSO.

NetBSD also ships an older version of LLVM profile (ABI v.2 predating
ABI v.4 in upstream version) inside libc. That copy has been manually
removed during the porting and testing process of the upstream version
to NetBSD. Otherwise there were conflicts between them two.

Reviewers: joerg, vitalybuka, vsk

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

Tags: #sanitizers

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

llvm-svn: 349994

5 years ago[gn build] Embed __TEXT __info_plist section into clang binary on macOS
Nico Weber [Sat, 22 Dec 2018 03:51:10 +0000 (03:51 +0000)]
[gn build] Embed __TEXT __info_plist section into clang binary on macOS

Verified by comparing the output of `otool -P bin/clang` between the GN and the
CMake build.

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

llvm-svn: 349992

5 years ago[gn build] Add build files for clang, clang-offload-bundler, and clang/lib/Headers
Nico Weber [Sat, 22 Dec 2018 03:49:44 +0000 (03:49 +0000)]
[gn build] Add build files for clang, clang-offload-bundler, and clang/lib/Headers

With this, the GN build can build clang!

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

llvm-svn: 349991

5 years agoFix mingw build failures caused by r349839
Tom Stellard [Sat, 22 Dec 2018 03:43:08 +0000 (03:43 +0000)]
Fix mingw build failures caused by r349839

Reviewers: mstorsjo

Subscribers: mgorny, llvm-commits

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

llvm-svn: 349990

5 years ago[gn build] Add build files for llvm-cat, llvm-lto, llvm-lto2, llvm-modextract, llvm...
Nico Weber [Sat, 22 Dec 2018 03:40:35 +0000 (03:40 +0000)]
[gn build] Add build files for llvm-cat, llvm-lto, llvm-lto2, llvm-modextract, llvm-profdata, llvm-symbolizer

These are the llvm/tools needed by check-clang.

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

llvm-svn: 349989

5 years ago[gn build] Add build file for clang/lib/FrontendTool
Nico Weber [Sat, 22 Dec 2018 03:15:56 +0000 (03:15 +0000)]
[gn build] Add build file for clang/lib/FrontendTool

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

llvm-svn: 349988

5 years ago[gn build] Add build file for clang/lib/ARCMigrate
Nico Weber [Sat, 22 Dec 2018 03:15:08 +0000 (03:15 +0000)]
[gn build] Add build file for clang/lib/ARCMigrate

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

llvm-svn: 349987

5 years ago[gn build] Add build files for clang/lib/{ASTMatchers,CrossTU}, clang/lib/StaticAnaly...
Nico Weber [Sat, 22 Dec 2018 03:14:05 +0000 (03:14 +0000)]
[gn build] Add build files for clang/lib/{ASTMatchers,CrossTU}, clang/lib/StaticAnalyzer/{Checkers,Core,Frontend}

The intent is to add the build file for clang/lib/StaticAnalyzer/Frontend; everything else is pulled in by that.

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

llvm-svn: 349986

5 years agoDebugInfo: Remove extra attribute lookup
David Blaikie [Sat, 22 Dec 2018 02:24:13 +0000 (02:24 +0000)]
DebugInfo: Remove extra attribute lookup

llvm-svn: 349985

5 years ago[analyzer] pr38668: Do not attempt to cast loaded integers to floats.
Artem Dergachev [Sat, 22 Dec 2018 02:06:51 +0000 (02:06 +0000)]
[analyzer] pr38668: Do not attempt to cast loaded integers to floats.

This patch is a different approach to landing the reverted r349701.

It is expected to have the same object (memory region) treated as if it has
different types in different program points. The correct behavior for
RegionStore when an object is stored as an object of type T1 but loaded as
an object of type T2 is to store the object as if it has type T1 but cast it
to T2 during load.

Note that the cast here is some sort of a "reinterpret_cast" (even in C). For
instance, if you store an integer and load a float, you won't get your integer
represented as a float; instead, you will get garbage.

Admit that we cannot perform the cast and return an unknown value.

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

rdar://problem/45062567

llvm-svn: 349984

5 years ago[X86] FixupLEAs, reduce number of calls to getOperand and use X86::AddrBaseReg/AddrIn...
Craig Topper [Sat, 22 Dec 2018 01:34:47 +0000 (01:34 +0000)]
[X86] FixupLEAs, reduce number of calls to getOperand and use X86::AddrBaseReg/AddrIndexReg, etc. instead of hardcoded constants.

Makes the code a little more readable.

llvm-svn: 349983

5 years ago[NVPTX] Reduce stack size in NVPTXAsmPrinter::doInitialization().
Justin Lebar [Sat, 22 Dec 2018 01:30:37 +0000 (01:30 +0000)]
[NVPTX] Reduce stack size in NVPTXAsmPrinter::doInitialization().

NVPTXAsmPrinter::doInitialization() was creating an NVPTXSubtarget on
the stack.  This object is huge, about 80kb.  Also it's slow to create.
And it's all redundant; we have one in NVPTXTargetMachine anyway!

llvm-svn: 349982

5 years ago[CUDA] Treat extern global variable shadows same as regular extern vars.
Artem Belevich [Sat, 22 Dec 2018 01:11:09 +0000 (01:11 +0000)]
[CUDA] Treat extern global variable shadows same as regular extern vars.

This fixes compiler crash when we attempted to compile this code:

extern __device__ int data;
__device__ int data = 1;

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

llvm-svn: 349981

5 years agogdb-index: Handle errors when parsing ranges
David Blaikie [Sat, 22 Dec 2018 00:31:05 +0000 (00:31 +0000)]
gdb-index: Handle errors when parsing ranges

When parsing CU ranges for gdb-index, handle the error (now propagated
up though the API lld is calling here - previously the error was
printed within the libDebugInfo API, not allowing lld to format or
handle the message at all) - including information about the object and
archive name, as well as failing the link.

llvm-svn: 349979

5 years agolibDebugInfo: Refactor error handling in range list parsing
David Blaikie [Sat, 22 Dec 2018 00:31:02 +0000 (00:31 +0000)]
libDebugInfo: Refactor error handling in range list parsing

Propagate the llvm::Error a little further up. This is NFC for
llvm-dwarfdump in this change, but allows ld.lld to emit more precise
error messages about which object and archive the erroneous DWARF is in.

llvm-svn: 349978

5 years ago[cmake] Suppress 'warning C4201: nonstandard extension used: nameless struct/union...
Stella Stamenova [Fri, 21 Dec 2018 23:59:24 +0000 (23:59 +0000)]
[cmake]  Suppress 'warning C4201: nonstandard extension used: nameless struct/union' on Windows

This warning comes up in the ObjC language plugin because of the use of nameless structs. This change suppresses the warning.

llvm-svn: 349977

5 years ago[MC] Enable .file support on COFF and diagnose it on unsupported targets
Reid Kleckner [Fri, 21 Dec 2018 23:35:48 +0000 (23:35 +0000)]
[MC] Enable .file support on COFF and diagnose it on unsupported targets

Summary:
The "single parameter" .file directive appears to be an ELF-only feature
that is intended to insert the main source filename into the string
table table.

I noticed that if you assemble an ELF .s file for COFF, typically it
will assert right away on a .file directive near the top of the file. My
first change was to make this emit a proper error in the asm parser so
that we don't assert so easily.

However, COFF actually does have some support for this directive, and if
you emit an object file, llvm-mc does not assert. When emitting a COFF
object, MC will take those file names and create "debug" symbol table
entries for them. I'm not familiar with these kinds of symbol table
entries, and I'm not aware of any users of them, but @compnerd added
them a while ago. They don't introduce absolute paths, and most main
source file paths are short enough that this extra entry shouldn't cause
any problems, so I enabled the flag in MCAsmInfoCOFF that indicates that
it's supported.

This has the side effect of adding an extra debug symbol to every object
produced by clang, which is a pretty big functional change. My question
is, should we keep the functionality or remove it in the name of symbol
table minimalism?

Reviewers: mstorsjo, compnerd

Subscribers: hiraditya, compnerd, llvm-commits

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

llvm-svn: 349976

5 years agoSilence warning in assert introduced in rL349973.
Mircea Trofin [Fri, 21 Dec 2018 23:02:10 +0000 (23:02 +0000)]
Silence warning in assert introduced in rL349973.

Subscribers: llvm-commits

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

llvm-svn: 349975

5 years agokeymethod -> keyfunction
Fangrui Song [Fri, 21 Dec 2018 22:57:11 +0000 (22:57 +0000)]
keymethod -> keyfunction

Pointed out by ruiu in rLLD349969

llvm-svn: 349974

5 years ago[llvm] API for encoding/decoding DWARF discriminators.
Mircea Trofin [Fri, 21 Dec 2018 22:48:50 +0000 (22:48 +0000)]
[llvm] API for encoding/decoding DWARF discriminators.

Summary:
Added a pair of APIs for encoding/decoding the 3 components of a DWARF discriminator described in http://lists.llvm.org/pipermail/llvm-dev/2016-October/106532.html: the base discriminator, the duplication factor (useful in profile-guided optimization) and the copy index (used to identify copies of code in cases like loop unrolling)

The encoding packs 3 unsigned values in 32 bits. This CL addresses 2 issues:
- communicates overflow back to the user
- supports encoding all 3 components together. Current APIs assume a sequencing of events. For example, creating a new discriminator based on an existing one by changing the base discriminator was not supported.

Reviewers: davidxl, danielcdh, wmi, dblaikie

Reviewed By: dblaikie

Subscribers: zzheng, dmgreen, aprantl, JDevlieghere, llvm-commits

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

llvm-svn: 349973

5 years ago[NFC] Replace `compare` with (in)equality operator where applicable.
Jonas Devlieghere [Fri, 21 Dec 2018 22:46:10 +0000 (22:46 +0000)]
[NFC] Replace `compare` with (in)equality operator where applicable.

Using compare is verbose, bug prone and potentially inefficient (because
of early termination). Replace relevant call sites with the (in)equality
operator.

llvm-svn: 349972

5 years ago[Scalar] Simplify as Jonas suggested. NFCI.
Davide Italiano [Fri, 21 Dec 2018 22:45:07 +0000 (22:45 +0000)]
[Scalar] Simplify as Jonas suggested. NFCI.

llvm-svn: 349971

5 years ago[Scalar] Implement operator!= using operator==.
Davide Italiano [Fri, 21 Dec 2018 22:42:00 +0000 (22:42 +0000)]
[Scalar] Implement operator!= using operator==.

Summary: Adding some test coverage while I'm around.

Reviewers: JDevlieghere, aprantl, zturner, clayborg, jingham

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

llvm-svn: 349970

5 years agokey method -> key function
Fangrui Song [Fri, 21 Dec 2018 22:40:10 +0000 (22:40 +0000)]
key method -> key function

The latter is what is actually called in the ABI http://itanium-cxx-abi.github.io/cxx-abi/abi.html#vague-vtable

Pointed out by rsmith

llvm-svn: 349969

5 years agoReapply: DebugInfo: Assume an absence of ranges or high_pc on a CU means the CU is...
David Blaikie [Fri, 21 Dec 2018 22:25:01 +0000 (22:25 +0000)]
Reapply: DebugInfo: Assume an absence of ranges or high_pc on a CU means the CU is empty (devoid of code addresses)

Originally committed in r349333, reverted in r349353.

GCC emitted these unconditionally on/before 4.4/March 2012
Clang emitted these unconditionally on/before 3.5/March 2014

This improves performance when parsing CUs (especially those using split
DWARF) that contain no code ranges (such as the mini CUs that may be
created by ThinLTO importing - though generally they should be/are
avoided, especially for Split DWARF because it produces a lot of very
small CUs, which don't scale well in a bunch of other ways too
(including size)).

The revert was due to a (Google internal) test that had some checked in old
object files missing DW_AT_ranges. That's since been fixed.

llvm-svn: 349968

5 years ago[ExpressionParser] Reserve size before copying over args
Jonas Devlieghere [Fri, 21 Dec 2018 22:16:10 +0000 (22:16 +0000)]
[ExpressionParser] Reserve size before copying over args

We already know the final size here so we might as well reserve it so we
don't have to re-allocate during the loop.

llvm-svn: 349967

5 years ago[ELF] .gnu.hash bloom filter: use Shift2 = 26 instead of 6
Fangrui Song [Fri, 21 Dec 2018 21:59:34 +0000 (21:59 +0000)]
[ELF] .gnu.hash bloom filter: use Shift2 = 26 instead of 6

Summary:
For the 2-bit bloom filter, we currently pick the bits Hash%64 and Hash>>6%64 (Shift2=6), but bits [6:...] are also used to select a word, causing a loss of precision.

In this patch, we choose Shift2=26, with is suggested by Ambrose Feinstein.

Note, Shift2 is computed as maskbitslog2 in bfd/elflink.c and gold/dynobj.cc
It is varying with the number of dynamic symbols but we don't
necessarily copy its rule.

Reviewers: ruiu, espindola

Reviewed By: ruiu

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 349966

5 years ago[IR] Add Instruction::isLifetimeStartOrEnd, NFC
Vedant Kumar [Fri, 21 Dec 2018 21:49:40 +0000 (21:49 +0000)]
[IR] Add Instruction::isLifetimeStartOrEnd, NFC

Instruction::isLifetimeStartOrEnd() checks whether an Instruction is an
llvm.lifetime.start or an llvm.lifetime.end intrinsic.

This was suggested as a cleanup in D55967.

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

llvm-svn: 349964

5 years ago[TextAPI][elfabi] Fix failing tests from D56020
Armando Montanez [Fri, 21 Dec 2018 21:44:09 +0000 (21:44 +0000)]
[TextAPI][elfabi] Fix failing tests from D56020

llvm-svn: 349963

5 years ago[X86] Add isel patterns to match BMI/TBMI instructions when lowering has turned the...
Craig Topper [Fri, 21 Dec 2018 21:42:43 +0000 (21:42 +0000)]
[X86] Add isel patterns to match BMI/TBMI instructions when lowering has turned the root nodes into one of the flag producing binops.

This fixes the patterns that have or/and as a root. 'and' is handled differently since thy usually have a CMP wrapped around them.

I had to look for uses of the CF flag because all these nodes have non-standard CF flag behavior. A real or/xor would always clear CF. In practice we shouldn't be using the CF flag from these nodes as far as I know.

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

llvm-svn: 349962

5 years agoFix comment typo.
Dan Liew [Fri, 21 Dec 2018 21:41:43 +0000 (21:41 +0000)]
Fix comment typo.

llvm-svn: 349961

5 years agoFix `static_assert()` scope in `CombinedAllocator`.
Dan Liew [Fri, 21 Dec 2018 21:41:37 +0000 (21:41 +0000)]
Fix `static_assert()` scope in `CombinedAllocator`.

It should be at the class scope and not inside the `Init(...)` function
because we want to error out as soon as the wrong type is constructed.
At the function scope the `static_assert` is only checked if the
function might be called.

This is a follow up to r349957.

rdar://problem/45284065

llvm-svn: 349960

5 years agoFix `static_assert()` scope in `SizeClassAllocator32`.
Dan Liew [Fri, 21 Dec 2018 21:41:31 +0000 (21:41 +0000)]
Fix `static_assert()` scope in `SizeClassAllocator32`.

It should be at the class scope and not inside the `Init(...)` function
because we want to error out as soon as the wrong type is constructed.
At the function scope the `static_assert` is only checked if the
function might be called.

This is a follow up to r349138.

rdar://problem/45284065

llvm-svn: 349959

5 years ago[DAGCombiner] simplify code leading to scalarizeExtractedVectorLoad; NFC
Sanjay Patel [Fri, 21 Dec 2018 21:26:30 +0000 (21:26 +0000)]
[DAGCombiner] simplify code leading to scalarizeExtractedVectorLoad; NFC

llvm-svn: 349958

5 years agoIntroduce `AddressSpaceView` template parameter to `CombinedAllocator`.
Dan Liew [Fri, 21 Dec 2018 21:22:27 +0000 (21:22 +0000)]
Introduce `AddressSpaceView` template parameter to `CombinedAllocator`.

Summary:
This is a follow up to https://reviews.llvm.org/D55764 .

For the ASan and LSan allocatorsthe type declarations have been modified
so that it's possible to create a combined allocator type that
consistently uses a different type of `AddressSpaceView`. We intend to
use this in future patches. For the other sanitizers they just use
`LocalAddressSpaceView` by default because we have no plans to use these
allocators in an out-of-process manner.

rdar://problem/45284065

Reviewers: kcc, dvyukov, vitalybuka, cryptoad, eugenis, kubamracek, george.karpenkov, yln

Subscribers: #sanitizers, llvm-commits

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

llvm-svn: 349957

5 years ago[X86] Don't allow optimizeCompareInstr to replace a CMP with BEXTR if the sign flag...
Craig Topper [Fri, 21 Dec 2018 21:16:26 +0000 (21:16 +0000)]
[X86] Don't allow optimizeCompareInstr to replace a CMP with BEXTR if the sign flag is used.

The BEXTR instruction documents the SF bit as undefined.

The TBM BEXTR instruction has the same issue, but I'm not sure how to test it. With the control being an immediate we can determine the sign bit is 0 or the BEXTR would have been removed.

Fixes PR40060

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

llvm-svn: 349956

5 years agoSwitch from static_cast<> to cast<>, update identifier for coding conventions; NFC.
Aaron Ballman [Fri, 21 Dec 2018 21:11:36 +0000 (21:11 +0000)]
Switch from static_cast<> to cast<>, update identifier for coding conventions; NFC.

llvm-svn: 349955

5 years agoIntroduce `AddressSpaceView` template parameter to `SizeClassAllocator64`.
Dan Liew [Fri, 21 Dec 2018 21:09:31 +0000 (21:09 +0000)]
Introduce `AddressSpaceView` template parameter to `SizeClassAllocator64`.

Summary:
This is a follow up patch to r349138.

This patch makes a `AddressSpaceView` a type declaration in the
allocator parameters used by `SizeClassAllocator64`. For ASan, LSan, and
the unit tests the AP64 declarations have been made templated so that
`AddressSpaceView` can be changed at compile time. For the other
sanitizers we just hard-code `LocalAddressSpaceView` because we have no
plans to use these allocators in an out-of-process manner.

rdar://problem/45284065

Reviewers: kcc, dvyukov, vitalybuka, cryptoad, eugenis, kubamracek, george.karpenkov

Subscribers: #sanitizers, llvm-commits

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

llvm-svn: 349954

5 years ago[clang-tidy] Be more liberal about literal zeroes in abseil checks
Hyrum Wright [Fri, 21 Dec 2018 21:07:11 +0000 (21:07 +0000)]
[clang-tidy] Be more liberal about literal zeroes in abseil checks

Summary:
Previously, we'd only match on literal floating or integral zeroes, but I've now also learned that some users spell that value as int{0} or float{0}, which also need to be matched.

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

llvm-svn: 349953

5 years agoConvert some ObjC retain/release msgSends to runtime calls.
Pete Cooper [Fri, 21 Dec 2018 21:00:32 +0000 (21:00 +0000)]
Convert some ObjC retain/release msgSends to runtime calls.

It is faster to directly call the ObjC runtime for methods such as retain/release instead of sending a message to those functions.

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

Reviewed By: rjmccall

llvm-svn: 349952

5 years agoAMDGPU: Don't peel of the offset if the resulting base could possibly be negative...
Changpeng Fang [Fri, 21 Dec 2018 20:57:34 +0000 (20:57 +0000)]
AMDGPU: Don't peel of the offset if the resulting base could possibly be negative in Indirect addressing.

Summary:
  Don't peel of the offset if the resulting base could possibly be negative in Indirect addressing.
This is because the M0 field is of unsigned.

This patch achieves the similar goal as https://reviews.llvm.org/D55241, but keeps the optimization
if the base is known unsigned.

Reviewers:
  arsemn

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

llvm-svn: 349951

5 years ago[TextAPI][elfabi] Fix YAML support for weak symbols
Armando Montanez [Fri, 21 Dec 2018 20:45:58 +0000 (20:45 +0000)]
[TextAPI][elfabi] Fix YAML support for weak symbols

Weak symbols are supposed to be supported in the ELF TextAPI
implementation, but the YAML handler didn't read or write the `Weak`
member of ELFSymbol. This change adds the YAML mapping and updates tests
to ensure correct behavior.

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

llvm-svn: 349950

5 years ago[Sema][NFC] Fix a Wimplicit-fallthrough warning in CheckSpecializationInstantiationRedecl
Bruno Ricci [Fri, 21 Dec 2018 20:38:06 +0000 (20:38 +0000)]
[Sema][NFC] Fix a Wimplicit-fallthrough warning in CheckSpecializationInstantiationRedecl

All cases are covered so add an llvm_unreachable. NFC.

llvm-svn: 349949

5 years ago[AST][NFC] Remove stale comment in CXXRecordDecl::is(Virtually)DerivedFrom.
Bruno Ricci [Fri, 21 Dec 2018 20:23:07 +0000 (20:23 +0000)]
[AST][NFC] Remove stale comment in CXXRecordDecl::is(Virtually)DerivedFrom.

The "this" capture was removed in r291939.

llvm-svn: 349948

5 years ago[libcxx] Remove unused macro _LIBCPP_HAS_UNIQUE_TYPEINFO
Louis Dionne [Fri, 21 Dec 2018 20:14:43 +0000 (20:14 +0000)]
[libcxx] Remove unused macro _LIBCPP_HAS_UNIQUE_TYPEINFO

Summary:
We already have the negation of that as _LIBCPP_HAS_NONUNIQUE_TYPEINFO.
Having both defined is confusing, since only one of them is used.

Reviewers: EricWF, mclow.lists

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 349947

5 years ago[lldbsuite] Skip flakey Windows tests
Stella Stamenova [Fri, 21 Dec 2018 20:10:45 +0000 (20:10 +0000)]
[lldbsuite] Skip flakey Windows tests

Skip a number of tests on Windows that are flakey and will pass/fail unexpectedly every dozen or so runs.

llvm-svn: 349946

5 years ago[BasicAA] Fix AA bug on dynamic allocas and stackrestore
Reid Kleckner [Fri, 21 Dec 2018 19:59:03 +0000 (19:59 +0000)]
[BasicAA] Fix AA bug on dynamic allocas and stackrestore

Summary:
BasicAA has special logic for unescaped allocas, which normally applies
equally well to dynamic and static allocas. However, llvm.stackrestore
has the power to end the lifetime of dynamic allocas, without referring
to them directly.

stackrestore is already marked with the most conservative memory
modification attributes, but because the alloca is not escaped, the
normal logic produces incorrect results. I think BasicAA needs a special
case here to teach it about the relationship between dynamic allocas and
stackrestore.

Fixes PR40118

Reviewers: gbiv, efriedma, george.burgess.iv

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 349945

5 years ago[RuntimeUnrolling] NFC: Add TODO and comments in connectProlog
Anna Thomas [Fri, 21 Dec 2018 19:45:05 +0000 (19:45 +0000)]
[RuntimeUnrolling] NFC: Add TODO and comments in connectProlog

Currently, runtime unrolling does not support loops where multiple
exiting blocks exit to the latchExit. Added TODO and other code
clarifications for ConnectProlog code.

llvm-svn: 349944

5 years ago[analyzer] Tests quickfix.
George Karpenkov [Fri, 21 Dec 2018 19:40:44 +0000 (19:40 +0000)]
[analyzer] Tests quickfix.

llvm-svn: 349943

5 years agoRemove stat cache chaining as it's no longer needed after PTH support has been
Alex Lorenz [Fri, 21 Dec 2018 19:33:09 +0000 (19:33 +0000)]
Remove stat cache chaining as it's no longer needed after PTH support has been
removed

Stat cache chaining was implemented for a StatListener in the PTH writer so that
it could write out the stat information to PTH. r348266 removed support for PTH,
and it doesn't seem like there are other uses of stat cache chaining. We can
remove the chaining support.

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

llvm-svn: 349942

5 years agoAdd a doc for missing key function and an error message referencing the doc.
Rui Ueyama [Fri, 21 Dec 2018 19:28:49 +0000 (19:28 +0000)]
Add a doc for missing key function and an error message referencing the doc.

Summary:
This is a common error, and because many people don't know what the key
function is, it is sometimes very confusing.

The doc was originally written by Brooks Moses and slightly edited by me.

Reviewers: MaskRay, espindola

Subscribers: emaste, llvm-commits, arichardson

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

llvm-svn: 349941

5 years agoSwitch from cast<> to dyn_cast<>.
Aaron Ballman [Fri, 21 Dec 2018 19:16:38 +0000 (19:16 +0000)]
Switch from cast<> to dyn_cast<>.

This avoids a potential failed assertion that is happening on someone's out-of-tree build.

llvm-svn: 349940

5 years agoRevert "Revert rL349876 from cfe/trunk: [analyzer] Perform escaping in RetainCountChe...
George Karpenkov [Fri, 21 Dec 2018 19:13:40 +0000 (19:13 +0000)]
Revert "Revert rL349876 from cfe/trunk: [analyzer] Perform escaping in RetainCountChecker on type mismatch even for inlined functions"

This reverts commit b44b33f6e020a2c369da2b0c1d53cd52975f2526.

Revert the revert with the fix.

llvm-svn: 349939

5 years ago[analyzer] Correct the summary violation diagnostics for the retain count checker
George Karpenkov [Fri, 21 Dec 2018 19:13:28 +0000 (19:13 +0000)]
[analyzer] Correct the summary violation diagnostics for the retain count checker

It should be in the past tense.

llvm-svn: 349938

5 years ago[x86] add movddup specialization for build vector lowering (PR37502)
Sanjay Patel [Fri, 21 Dec 2018 18:48:32 +0000 (18:48 +0000)]
[x86] add movddup specialization for build vector lowering (PR37502)

This is admittedly a narrow fix for the problem:
https://bugs.llvm.org/show_bug.cgi?id=37502
...but as the XOP restriction shows, it's a maze to get this right.
In the motivating example, note that we have movddup before SSE4.1 and
again with AVX2. That's because insertps isn't available pre-SSE41 and
vbroadcast is (more generally) available with AVX2 (and the splat is
reduced to movddup via isel pattern).

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

llvm-svn: 349937

5 years ago[ARM] Set Defs = [CPSR] for COPY_STRUCT_BYVAL, as it clobbers CPSR.
Florian Hahn [Fri, 21 Dec 2018 18:07:10 +0000 (18:07 +0000)]
[ARM] Set Defs = [CPSR] for COPY_STRUCT_BYVAL, as it clobbers CPSR.

Fixes PR35023.

Reviewers: MatzeB, t.p.northover, sunfish, qcolombet, efriedma

Reviewed By: efriedma

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

llvm-svn: 349935

5 years ago[AST][NFC] Fix Wsign-compare warning introduced in CXXOperatorCallExpr
Bruno Ricci [Fri, 21 Dec 2018 17:54:51 +0000 (17:54 +0000)]
[AST][NFC] Fix Wsign-compare warning introduced in CXXOperatorCallExpr

llvm-svn: 349934

5 years ago[Sema][NFC] Fix Wimplicit-fallthrough warning in getCursorKindForDecl
Bruno Ricci [Fri, 21 Dec 2018 17:52:13 +0000 (17:52 +0000)]
[Sema][NFC] Fix Wimplicit-fallthrough warning in getCursorKindForDecl

All cases are covered so add an llvm_unreachable. NFC.

llvm-svn: 349933

5 years ago[NFC] Fix typo in comment
Louis Dionne [Fri, 21 Dec 2018 17:32:23 +0000 (17:32 +0000)]
[NFC] Fix typo in comment

llvm-svn: 349932

5 years ago[SelectionDAG] Remove KnownBits output paramater version.
Simon Pilgrim [Fri, 21 Dec 2018 17:29:38 +0000 (17:29 +0000)]
[SelectionDAG] Remove KnownBits output paramater version.

Completes the work started by @bogner in rL340594.

llvm-svn: 349931

5 years ago[clang-tidy] Add export-fixes flag to clang-tidy-diff
Julie Hockett [Fri, 21 Dec 2018 17:25:27 +0000 (17:25 +0000)]
[clang-tidy] Add export-fixes flag to clang-tidy-diff

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

llvm-svn: 349930

5 years ago[x86] remove excess check lines; NFC
Sanjay Patel [Fri, 21 Dec 2018 17:19:43 +0000 (17:19 +0000)]
[x86] remove excess check lines; NFC

Forgot that the integer variants have an extra 's'.

llvm-svn: 349929

5 years ago[x86] move misplaced tests; NFC
Sanjay Patel [Fri, 21 Dec 2018 17:06:43 +0000 (17:06 +0000)]
[x86] move misplaced tests; NFC

Mixed up integer and FP in rL349923.

llvm-svn: 349928

5 years ago[GlobalISel][AArch64] Add support for widening G_FCEIL
Jessica Paquette [Fri, 21 Dec 2018 17:05:26 +0000 (17:05 +0000)]
[GlobalISel][AArch64] Add support for widening G_FCEIL

This adds support for widening G_FCEIL in LegalizerHelper and
AArch64LegalizerInfo. More specifically, it teaches the AArch64 legalizer to
widen G_FCEIL from a 16-bit float to a 32-bit float when the subtarget doesn't
support full FP 16.

This also updates AArch64/f16-instructions.ll to show that we perform the
correct transformation.

llvm-svn: 349927

5 years agoDon't duplicate the logic that detects if a section can/should be loaded (NFC)
Greg Clayton [Fri, 21 Dec 2018 17:04:18 +0000 (17:04 +0000)]
Don't duplicate the logic that detects if a section can/should be loaded (NFC)

Prior to this there were 3 places that were duplicating the logic to detect if a section can/should be loaded and some were doing things a bit differently. Now it is all centralized in one place and it is done correctly.

llvm-svn: 349926

5 years ago[AST][NFC] Pack CXXOperatorCallExpr
Bruno Ricci [Fri, 21 Dec 2018 16:51:57 +0000 (16:51 +0000)]
[AST][NFC] Pack CXXOperatorCallExpr

Use the space available in the bit-fields of Stmt.
This saves 8 bytes per CXXOperatorCallExpr. NFC.

llvm-svn: 349924

5 years ago[x86] add tests for possible horizontal op transform; NFC
Sanjay Patel [Fri, 21 Dec 2018 16:49:41 +0000 (16:49 +0000)]
[x86] add tests for possible horizontal op transform; NFC

llvm-svn: 349923

5 years agoReleaseNotes: Document removal of add_llvm_loadable_module CMake macro
Tom Stellard [Fri, 21 Dec 2018 16:20:37 +0000 (16:20 +0000)]
ReleaseNotes: Document removal of add_llvm_loadable_module CMake macro

This was removed in r349839.

llvm-svn: 349921

5 years ago[x86] move test for movddup; NFC
Sanjay Patel [Fri, 21 Dec 2018 16:08:27 +0000 (16:08 +0000)]
[x86] move test for movddup; NFC

This adds an AVX512 run as suggested in D55936.
The test didn't really belong with other build vector tests
because that's not the pattern here. I don't see much value
in adding 64-bit RUNs because they wouldn't exercise the
isel patterns that we're aiming to expose.

llvm-svn: 349920

5 years ago[pstl] Initial integration with LLVM's CMake
Louis Dionne [Fri, 21 Dec 2018 15:59:04 +0000 (15:59 +0000)]
[pstl] Initial integration with LLVM's CMake

Summary:
This commit adds a check-pstl CMake target that will run the tests
we currently have for pstl. Those tests are not using LLVM lit yet,
but switching them over should be a transparent change. With this
change, we can start relying on the `check-pstl` target for workflows
and CI.

Note that this commit purposefully does not support the pre-monorepo
layout (with subprojects in projects/), since LLVM is moving towards
the monorepo layout anyway.

Reviewers: jfb

Subscribers: mgorny, jkorous, dexonsmith, libcxx-commits, mclow.lists, rodgert

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

llvm-svn: 349919

5 years ago[AArch64] Refactor Exynos predicate (NFC)
Evandro Menezes [Fri, 21 Dec 2018 15:51:34 +0000 (15:51 +0000)]
[AArch64] Refactor Exynos predicate (NFC)

Change order of conditions in predicate.

llvm-svn: 349918

5 years ago[Sanitizer] Move the unit test in the right place.
David Carlier [Fri, 21 Dec 2018 15:43:32 +0000 (15:43 +0000)]
[Sanitizer] Move the unit test in the right place.

llvm-svn: 349917

5 years ago[Sanitizer] Enable strtonum in FreeBSD
David Carlier [Fri, 21 Dec 2018 15:42:24 +0000 (15:42 +0000)]
[Sanitizer] Enable strtonum in FreeBSD

Reviewers: krytarowski, vitalybuka

Reviewed By: krytarowski

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

llvm-svn: 349916

5 years ago[XCore] Always use the version of computeKnownBits that returns a value. NFCI.
Simon Pilgrim [Fri, 21 Dec 2018 15:35:32 +0000 (15:35 +0000)]
[XCore] Always use the version of computeKnownBits that returns a value. NFCI.

Continues the work started by @bogner in rL340594 to remove uses of the KnownBits output paramater version.

llvm-svn: 349915

5 years ago[Sparc] Always use the version of computeKnownBits that returns a value. NFCI.
Simon Pilgrim [Fri, 21 Dec 2018 15:32:36 +0000 (15:32 +0000)]
[Sparc] Always use the version of computeKnownBits that returns a value. NFCI.

Continues the work started by @bogner in rL340594 to remove uses of the KnownBits output paramater version.

llvm-svn: 349914

5 years ago[AMDGPU] Always use the version of computeKnownBits that returns a value. NFCI.
Simon Pilgrim [Fri, 21 Dec 2018 15:29:47 +0000 (15:29 +0000)]
[AMDGPU] Always use the version of computeKnownBits that returns a value. NFCI.

Continues the work started by @bogner in rL340594 to remove uses of the KnownBits output paramater version.

llvm-svn: 349912

5 years ago[WebAssembly] Always use the version of computeKnownBits that returns a value. NFCI.
Simon Pilgrim [Fri, 21 Dec 2018 15:25:37 +0000 (15:25 +0000)]
[WebAssembly] Always use the version of computeKnownBits that returns a value. NFCI.

Continues the work started by @bogner in rL340594 to remove uses of the KnownBits output paramater version.

llvm-svn: 349911

5 years ago[AST] Store the callee and argument expressions of CallExpr in a trailing array.
Bruno Ricci [Fri, 21 Dec 2018 15:20:32 +0000 (15:20 +0000)]
[AST] Store the callee and argument expressions of CallExpr in a trailing array.

Since CallExpr::setNumArgs has been removed, it is now possible to store the
callee expression and the argument expressions of CallExpr in a trailing array.
This saves one pointer per CallExpr, CXXOperatorCallExpr, CXXMemberCallExpr,
CUDAKernelCallExpr and UserDefinedLiteral.

Given that CallExpr is used as a base of the above classes we cannot use
llvm::TrailingObjects. Instead we store the offset in bytes from the this pointer
to the start of the trailing objects and manually do the casts + arithmetic.

Some notes:

1.) I did not try to fit the number of arguments in the bit-fields of Stmt.
    This leaves some space for future additions and avoid the discussion about
    whether x bits are sufficient to hold the number of arguments.

2.) It would be perfectly possible to recompute the offset to the trailing
    objects before accessing the trailing objects. However the trailing objects
    are frequently accessed and benchmarks show that it is slightly faster to
    just load the offset from the bit-fields. Additionally, because of 1),
    we have plenty of space in the bit-fields of Stmt.

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

Reviewed By: rjmccall

llvm-svn: 349910

5 years ago[ARM] Always use the version of computeKnownBits that returns a value. NFCI.
Simon Pilgrim [Fri, 21 Dec 2018 15:15:38 +0000 (15:15 +0000)]
[ARM] Always use the version of computeKnownBits that returns a value. NFCI.

Continues the work started by @bogner in rL340594 to remove uses of the KnownBits output paramater version.

llvm-svn: 349909

5 years ago[AArch64] Always use the version of computeKnownBits that returns a value. NFCI.
Simon Pilgrim [Fri, 21 Dec 2018 15:05:10 +0000 (15:05 +0000)]
[AArch64] Always use the version of computeKnownBits that returns a value. NFCI.

Continues the work started by @bogner in rL340594 to remove uses of the KnownBits output paramater version.

llvm-svn: 349908

5 years ago[SelectionDAG] Always use the version of computeKnownBits that returns a value. NFCI.
Simon Pilgrim [Fri, 21 Dec 2018 14:56:18 +0000 (14:56 +0000)]
[SelectionDAG] Always use the version of computeKnownBits that returns a value. NFCI.

Continues the work started by @bogner in rL340594 to remove uses of the KnownBits output paramater version.

llvm-svn: 349907

5 years ago[SystemZ] Always use the version of computeKnownBits that returns a value. NFCI.
Simon Pilgrim [Fri, 21 Dec 2018 14:50:54 +0000 (14:50 +0000)]
[SystemZ] Always use the version of computeKnownBits that returns a value. NFCI.

Continues the work started by @bogner in rL340594 to remove uses of the KnownBits output paramater version.

llvm-svn: 349906

5 years ago[Lanai] Always use the version of computeKnownBits that returns a value. NFCI.
Simon Pilgrim [Fri, 21 Dec 2018 14:48:35 +0000 (14:48 +0000)]
[Lanai] Always use the version of computeKnownBits that returns a value. NFCI.

Continues the work started by @bogner in rL340594 to remove uses of the KnownBits output paramater version.

llvm-svn: 349905

5 years ago[Sema][NFC] Remove some unnecessary calls to getASTContext.
Bruno Ricci [Fri, 21 Dec 2018 14:35:24 +0000 (14:35 +0000)]
[Sema][NFC] Remove some unnecessary calls to getASTContext.

The AST context is already easily available. NFC.

llvm-svn: 349904

5 years ago[PPC] Always use the version of computeKnownBits that returns a value. NFCI.
Simon Pilgrim [Fri, 21 Dec 2018 14:32:39 +0000 (14:32 +0000)]
[PPC] Always use the version of computeKnownBits that returns a value. NFCI.

Continues the work started by @bogner in rL340594 to remove uses of the KnownBits output paramater version.

llvm-svn: 349903

5 years ago[X86] Always use the version of computeKnownBits that returns a value. NFCI.
Simon Pilgrim [Fri, 21 Dec 2018 14:25:14 +0000 (14:25 +0000)]
[X86] Always use the version of computeKnownBits that returns a value. NFCI.

Continues the work started by @bogner in rL340594 to remove uses of the old KnownBits output paramater version.

llvm-svn: 349902