platform/upstream/llvm.git
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

5 years ago[AST][NFC] Pass the AST context to one of the ctor of DeclRefExpr.
Bruno Ricci [Fri, 21 Dec 2018 14:10:18 +0000 (14:10 +0000)]
[AST][NFC] Pass the AST context to one of the ctor of DeclRefExpr.

All of the other constructors already take a reference to the AST context.
This avoids calling Decl::getASTContext in most cases. Additionally move
the definition of the constructor from Expr.h to Expr.cpp since it is calling
DeclRefExpr::computeDependence. NFC.

llvm-svn: 349901

5 years ago[AArch64] Adding missing REQUIRES in aarch64 dwarf test
Luke Cheeseman [Fri, 21 Dec 2018 13:39:13 +0000 (13:39 +0000)]
[AArch64] Adding missing REQUIRES in aarch64 dwarf test

llvm-svn: 349900

5 years ago[xray] [tests] Detect and handle missing LLVMTestingSupport gracefully
Michal Gorny [Fri, 21 Dec 2018 13:37:30 +0000 (13:37 +0000)]
[xray] [tests] Detect and handle missing LLVMTestingSupport gracefully

Add a code to properly test for presence of LLVMTestingSupport library
when performing a stand-alone build, and skip tests requiring it when
it is not present.  Since the library is not installed, llvm-config
reported empty --libs for it and the tests failed to link with undefined
references.  Skipping the two fdr_* test files is better than failing to
build, and should be good enough until we find a better solution.

NB: both installing LLVMTestingSupport and building it automatically
from within compiler-rt sources are non-trivial.  The former due to
dependency on gtest, the latter due to tight integration with LLVM
source tree.

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

llvm-svn: 349899

5 years ago[ADT] IntervalMap: add overlaps(a, b) method
Pavel Labath [Fri, 21 Dec 2018 13:04:34 +0000 (13:04 +0000)]
[ADT] IntervalMap: add overlaps(a, b) method

Summary:
This function checks whether the mappings in the interval map overlap
with the given range [a;b]. The motivation is to enable checking for
overlap before inserting a new interval into the map.

Reviewers: vsk, dblaikie

Subscribers: dexonsmith, kristina, llvm-commits

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

llvm-svn: 349898

5 years ago[CMake] Print out the list of sanitizers that the sanitizer_common tests will run...
Dan Liew [Fri, 21 Dec 2018 11:57:31 +0000 (11:57 +0000)]
[CMake] Print out the list of sanitizers that the sanitizer_common tests will run against.

Summary:
This is a change requested by Vitaly Buka as prerequisite to landing
https://reviews.llvm.org/D55740.

Reviewers: vitalybuka, kubamracek

Subscribers: mgorny, #sanitizers, llvm-commits

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

llvm-svn: 349897

5 years ago[NewPM] -print-module-scope -print-after now prints module even after invalidated...
Fedor Sergeev [Fri, 21 Dec 2018 11:49:05 +0000 (11:49 +0000)]
[NewPM] -print-module-scope -print-after now prints module even after invalidated Loop/SCC

-print-after IR printing generally can not print the IR unit (Loop or SCC)
which has just been invalidated by the pass. However, when working in -print-module-scope
mode even if Loop was invalidated there is still a valid module that we can print.

Since we can not access invalidated IR unit from AfterPassInvalidated instrumentation
point we can remember the module to be printed *before* pass. This change introduces
BeforePass instrumentation that stores all the information required for module printing
into the stack and then after pass (in AfterPassInvalidated) just print whatever
has been placed on stack.

Reviewed By: philip.pfaffe
Differential Revision: https://reviews.llvm.org/D55278

llvm-svn: 349896

5 years ago[Dwarf/AArch64] Return address signing B key dwarf support
Luke Cheeseman [Fri, 21 Dec 2018 10:45:08 +0000 (10:45 +0000)]
[Dwarf/AArch64] Return address signing B key dwarf support

- When signing return addresses with -msign-return-address=<scope>{+<key>},
  either the A key instructions or the B key instructions can be used. To
  correctly authenticate the return address, the unwinder/debugger must know
  which key was used to sign the return address.
- When and exception is thrown or a break point reached, it may be necessary to
  unwind the stack. To accomplish this, the unwinder/debugger must be able to
  first authenticate an the return address if it has been signed.
- To enable this, the augmentation string of CIEs has been extended to allow
  inclusion of a 'B' character. Functions that are signed using the B key
  variant of the instructions should have and FDE whose associated CIE has a 'B'
  in the augmentation string.
- One must also be able to preserve these semantics when first stepping from a
  high level language into assembly and then, as a second step, into an object
  file. To achieve this, I have introduced a new assembly directive
  '.cfi_b_key_frame ', that tells the assembler the current frame uses return
  address signing with the B key.
- This ensures that the FDE is associated with a CIE that has 'B' in the
  augmentation string.

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

llvm-svn: 349895

5 years agoRevert rL349876 from cfe/trunk: [analyzer] Perform escaping in RetainCountChecker...
Simon Pilgrim [Fri, 21 Dec 2018 10:11:23 +0000 (10:11 +0000)]
Revert rL349876 from cfe/trunk: [analyzer] Perform escaping in RetainCountChecker on type mismatch even for inlined functions

The fix done in D55465 did not previously apply when the function was inlined.

rdar://46889541

Differential Revision: https://reviews.llvm.org/D55976
........
Fixes broken buildbot: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/14764

llvm-svn: 349894

5 years ago[clangd] Cleanup syntax errors in the test, NFC.
Haojian Wu [Fri, 21 Dec 2018 09:32:49 +0000 (09:32 +0000)]
[clangd] Cleanup syntax errors in the test, NFC.

llvm-svn: 349893

5 years ago[X86][SSE] Auto upgrade PADDS/PSUBS intrinsics to SADD_SAT/SSUB_SAT generic intrinsic...
Simon Pilgrim [Fri, 21 Dec 2018 09:04:14 +0000 (09:04 +0000)]
[X86][SSE] Auto upgrade PADDS/PSUBS intrinsics to SADD_SAT/SSUB_SAT generic intrinsics (llvm)

This auto upgrades the signed SSE saturated math intrinsics to SADD_SAT/SSUB_SAT generic intrinsics.

Clang counterpart: https://reviews.llvm.org/D55890

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

llvm-svn: 349892

5 years agoFix warning about unused variable [NFC]
Bjorn Pettersson [Fri, 21 Dec 2018 08:51:04 +0000 (08:51 +0000)]
Fix warning about unused variable [NFC]

llvm-svn: 349891

5 years ago[Sema] Produce diagnostics when C++17 aligned allocation/deallocation
Akira Hatanaka [Fri, 21 Dec 2018 07:05:36 +0000 (07:05 +0000)]
[Sema] Produce diagnostics when C++17 aligned allocation/deallocation
functions that are unavailable on Darwin are explicitly called or called
from deleting destructors.

rdar://problem/40736230

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

llvm-svn: 349890

5 years ago[WebAssembly] Fix invalid machine instrs in -O0, verify in tests
Thomas Lively [Fri, 21 Dec 2018 06:58:15 +0000 (06:58 +0000)]
[WebAssembly] Fix invalid machine instrs in -O0, verify in tests

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 349889

5 years agoFix test case breakages caused by lexically_relative change
Eric Fiselier [Fri, 21 Dec 2018 04:38:22 +0000 (04:38 +0000)]
Fix test case breakages caused by lexically_relative change

llvm-svn: 349888

5 years agoDon't forward declare _FilesystemClock in C++03
Eric Fiselier [Fri, 21 Dec 2018 04:30:04 +0000 (04:30 +0000)]
Don't forward declare _FilesystemClock in C++03

llvm-svn: 349887