platform/upstream/llvm.git
5 years ago[X86] Disable custom type legalization for v2i32/v4i16/v8i8->i64.
Craig Topper [Thu, 15 Aug 2019 05:51:58 +0000 (05:51 +0000)]
[X86] Disable custom type legalization for v2i32/v4i16/v8i8->i64.

The default legalization can take care of this.

llvm-svn: 368967

5 years ago[X86] Disable custom type legalization for v2i32/v4i16/v8i8->f64 bitcast.
Craig Topper [Thu, 15 Aug 2019 05:51:54 +0000 (05:51 +0000)]
[X86] Disable custom type legalization for v2i32/v4i16/v8i8->f64 bitcast.

The generic legalization handles this in the same way so just use
that.

llvm-svn: 368966

5 years ago[X86] Remove some unreachable code from LowerBITCAST.
Craig Topper [Thu, 15 Aug 2019 05:51:50 +0000 (05:51 +0000)]
[X86] Remove some unreachable code from LowerBITCAST.

llvm-svn: 368965

5 years ago[ELF][PPC] Improve error message for unknown relocations
Fangrui Song [Thu, 15 Aug 2019 05:22:23 +0000 (05:22 +0000)]
[ELF][PPC] Improve error message for unknown relocations

Like rLLD354040.

Previously, for unrecognized relocation types, in -no-pie mode:

  foo.o: unrecognized reloc 256

In -pie/-shared mode:

  error: can't create dynamic relocation R_PPC_xxx against symbol: yyy in readonly segment

llvm-svn: 368964

5 years ago[llvm-objdump] Add warning messages if disassembly + source for problematic inputs
Michael Pozulp [Thu, 15 Aug 2019 05:15:22 +0000 (05:15 +0000)]
[llvm-objdump] Add warning messages if disassembly + source for problematic inputs

Summary: Addresses https://bugs.llvm.org/show_bug.cgi?id=41905

Reviewers: jhenderson, rupprecht, grimar

Reviewed By: jhenderson, grimar

Subscribers: RKSimon, MaskRay, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 368963

5 years agoFix variable mismatch between signature and body
Jonas Devlieghere [Thu, 15 Aug 2019 05:09:09 +0000 (05:09 +0000)]
Fix variable mismatch between signature and body

I updated the signature to conform to the LLDB coding style but
accidentally forgot to update the function body.

llvm-svn: 368962

5 years ago[llvm-objcopy] Move duplicate tablegen from objcopy and strip into one file
Michael Pozulp [Thu, 15 Aug 2019 04:45:41 +0000 (04:45 +0000)]
[llvm-objcopy] Move duplicate tablegen from objcopy and strip into one file

Summary: This avoids maintaining the same options in two different places.

Reviewers: jhenderson, alexshap, rupprecht, MaskRay

Reviewed By: jhenderson, rupprecht, MaskRay

Subscribers: MaskRay, wolfgangp, jakehehrlich, abrachet, llvm-commits

Tags: #llvm

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

llvm-svn: 368961

5 years ago[CMake] Check for C++14 instead of C++11
Jonas Devlieghere [Thu, 15 Aug 2019 04:42:15 +0000 (04:42 +0000)]
[CMake] Check for C++14 instead of C++11

Now that LLVM moved to C++14, `COMPILER_RT_HAS_STD_CXX11_FLAG` should
become `COMPILER_RT_HAS_STD_CXX14_FLAG`.

I ran into this issue when replacing llvm::make_unique with
std::make_unique in an X-ray unit test. We are correctly passing
`-std=c++14`, but this got overwritten further down the invocation by
the compiler-rt flags. Given that this unit test is using LLVM headers,
this is bound to break sooner than later, regardless of my change.

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

llvm-svn: 368960

5 years ago[NFC] Fix documentation for some utility classes.
Jonas Devlieghere [Thu, 15 Aug 2019 04:35:46 +0000 (04:35 +0000)]
[NFC] Fix documentation for some utility classes.

This fixes a few warnings emitted when compiling with -Wdocumentation.

llvm-svn: 368959

5 years ago[Tooling] Add a hack to work around issues with matcher binding in r368681.
David L. Jones [Thu, 15 Aug 2019 04:10:11 +0000 (04:10 +0000)]
[Tooling] Add a hack to work around issues with matcher binding in r368681.

The change in r368681 contains a (probably unintentional) behavioral change for
rewrite rules with a single matcher. Previously, the single matcher would not
need to be bound (`joinCaseMatchers` returned it directly), even though a final
DynTypeMatcher was created and bound by `buildMatcher`. With the new change, a
single matcher will be bound, in addition to the final binding (which is now in
`buildMatchers`, but happens roughly at the same point in the overall flow).

This patch simply duplicates the "final matcher" trick: it creates an extra
DynTypedMatcher for each rewrite rule case matcher, and unconditionally makes it
bindable. This is probably not the right long-term fix, but it does allow
existing code to continue to work with this interface.

Subscribers: cfe-commits, gribozavr, ymandel

Tags: #clang

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

llvm-svn: 368958

5 years ago[NFC] Remove documentation comment to fix warning.
Jonas Devlieghere [Thu, 15 Aug 2019 04:09:00 +0000 (04:09 +0000)]
[NFC] Remove documentation comment to fix warning.

Remove the @return to fix the warning: '@returns' command used in a
comment that is attached to a function returning void [-Wdocumentation]

llvm-svn: 368957

5 years ago[X86] Remove some dead code and combine some repeated code that's left.
Craig Topper [Thu, 15 Aug 2019 04:07:43 +0000 (04:07 +0000)]
[X86] Remove some dead code and combine some repeated code that's left.

If the width is 256 bits, then we must have AVX so the else here
was unnecessary. Once that's removed then the >= 256 bit code is
identical to the 128 bit code with a different VT so combine them.

llvm-svn: 368956

5 years ago[NFC] Update doc comment to fix warning.
Jonas Devlieghere [Thu, 15 Aug 2019 03:59:30 +0000 (03:59 +0000)]
[NFC] Update doc comment to fix warning.

This fixes the warning: parameter 'EnableNullFPSuppression' not found in
the function declaration [-Wdocumentation]

llvm-svn: 368954

5 years agoRevert "Expose TailCallKind via the LLVM C API"
Jonas Devlieghere [Thu, 15 Aug 2019 03:49:51 +0000 (03:49 +0000)]
Revert "Expose TailCallKind via the LLVM C API"

This is failing on several build bots. Reverting as discussed in
https://reviews.llvm.org/D66061.

llvm-svn: 368953

5 years agoRevert "[compiler-rt] Migrate llvm::make_unique to std::make_unique"
Jonas Devlieghere [Thu, 15 Aug 2019 03:02:57 +0000 (03:02 +0000)]
Revert "[compiler-rt] Migrate llvm::make_unique to std::make_unique"

The X-ray unit tests in compiler-rt are overriding the C++ version by
explicitly passing -std=c++11 in the compiler invocation. This poses a
problem as these tests are including LLVM headers that can now use C++14
features. I'm temporarily reverting this as I investigate the correct
solution.

llvm-svn: 368952

5 years agogn build: Merge r368918
Vitaly Buka [Thu, 15 Aug 2019 01:38:30 +0000 (01:38 +0000)]
gn build: Merge r368918

llvm-svn: 368951

5 years ago[NFCI] Always initialize BugReport const fields
Alex Langford [Thu, 15 Aug 2019 00:58:51 +0000 (00:58 +0000)]
[NFCI] Always initialize BugReport const fields

Summary:
Some compilers require that const fields of an object must be explicitly
initialized by the constructor. I ran into this issue building with clang
3.8 on Ubuntu 16.04.

Reviewers: compnerd, Szelethus, NoQ

Subscribers: cfe-commits, llvm-commits

Tags: #clang

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

llvm-svn: 368950

5 years ago[coroutine] Fixes "cannot move instruction since its users are not dominated by CoroB...
Gor Nishanov [Thu, 15 Aug 2019 00:48:51 +0000 (00:48 +0000)]
[coroutine] Fixes "cannot move instruction since its users are not dominated by CoroBegin" problem.

Summary:
Fixes https://bugs.llvm.org/show_bug.cgi?id=36578 and https://bugs.llvm.org/show_bug.cgi?id=36296.
Supersedes: https://reviews.llvm.org/D55966

One of the fundamental transformation that CoroSplit pass performs before splitting the coroutine is to find which values need to survive between suspend and resume and provide a slot for them in the coroutine frame to spill and restore the value as needed.

Coroutine frame becomes available once the storage for it was allocated and that point is marked in the pre-split coroutine with a llvm.coro.begin intrinsic.

FE normally puts all of the user-authored code that would be accessing those values after llvm.coro.begin, however, sometimes instructions accessing those values would end up prior to coro.begin. For example, writing out a value of the parameter into the alloca done by the FE or instructions that are added by the optimization passes such as SROA when it rewrites allocas.

Prior to this change, CoroSplit pass would try to move instructions that may end up accessing the values in the coroutine frame after CoroBegin. However it would run into problems (report_fatal_error) if some of the values would be used both in the allocation function (for example allocator is passed as a parameter to a coroutine) and in the use-authored body of the coroutine.

To handle this case and to simplify the instruction moving logic, this change removes all of the instruction moving. Instead, we only change the uses of the spilled values that are dominated by coro.begin and leave other instructions intact.

Before:

```
%var = alloca i32
%1 = getelementptr .. %var; ; will move this one after coro.begin
%f = call i8* @llvm.coro.begin(
```

After:

```
%var = alloca i32
%1 = getelementptr .. %var; stays put
%f = call i8* @llvm.coro.begin(
```
If we discover that there is a potential write into an alloca, prior to coro.begin we would copy its value from the alloca into the spill slot in the coroutine frame.

Before:

```
%var = alloca i32
store .. %var ; will move this one after coro.begin
%f = call i8* @llvm.coro.begin(
```

After:

```
%var = alloca i32
store .. %var ;stays put
%f = call i8* @llvm.coro.begin(
%tmp = load %var
store %tmp, %spill.slot.for.var
```

Note: This change does not handle array allocas as that is something that C++ FE does not produce, but, it can be added in the future if need arises

Reviewers: llvm-commits, modocache, ben-clayton, tks2103, rjmccall

Reviewed By: modocache

Subscribers: bartdesmet

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

llvm-svn: 368949

5 years ago[sanitizer_common] Replace forkpty with posix_spawn on Darwin
Julian Lettner [Thu, 15 Aug 2019 00:18:55 +0000 (00:18 +0000)]
[sanitizer_common] Replace forkpty with posix_spawn on Darwin

On Darwin, we currently use forkpty to communicate with the "atos"
symbolizer. There are several problems that fork[pty] has, e.g. that
after fork, interceptors are still active and this sometimes causes
crashes or hangs. This is especially problematic for TSan, which uses
interceptors for OS-provided locks and mutexes, and even Libc functions
use those.

This patch replaces forkpty with posix_spawn on Darwin. Since
posix_spawn doesn't fork (at least on Darwin), the interceptors are not
a problem. Another benefit is that we'll handle post-fork failures (e.g.
sandbox disallows "exec") gracefully now.

Related revisions and previous attempts that were blocked by or had to
be revered due to test failures:
https://reviews.llvm.org/D48451
https://reviews.llvm.org/D40032

Reviewed By: kubamracek

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

llvm-svn: 368947

5 years ago[compiler-rt] Migrate llvm::make_unique to std::make_unique
Jonas Devlieghere [Thu, 15 Aug 2019 00:06:49 +0000 (00:06 +0000)]
[compiler-rt] Migrate llvm::make_unique to std::make_unique

Now that we've moved to C++14, we no longer need the llvm::make_unique
implementation from STLExtras.h. This patch is a mechanical replacement
of (hopefully) all the llvm::make_unique instances across the monorepo.

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

llvm-svn: 368946

5 years agoExpose TailCallKind via the LLVM C API
Robert Widmann [Wed, 14 Aug 2019 23:54:35 +0000 (23:54 +0000)]
Expose TailCallKind via the LLVM C API

Summary: This exposes `CallInst`'s tail call kind via new `LLVMGetTailCallKind` and `LLVMSetTailCallKind` functions. The motivation for this is to be able to see `musttail` for languages that require mandatory tail calls for correctness. Today only the weaker `LLVMSetTail` is exposed and there is no way to set `GuaranteedTailCallOpt` via the C API.

Reviewers: CodaFi, jyknight, deadalnix, rnk

Reviewed By: CodaFi

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 368945

5 years ago[clang-tools-extra] Migrate llvm::make_unique to std::make_unique
Jonas Devlieghere [Wed, 14 Aug 2019 23:52:23 +0000 (23:52 +0000)]
[clang-tools-extra] Migrate llvm::make_unique to std::make_unique

Now that we've moved to C++14, we no longer need the llvm::make_unique
implementation from STLExtras.h. This patch is a mechanical replacement
of (hopefully) all the llvm::make_unique instances across the monorepo.

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

llvm-svn: 368944

5 years ago[Clang] Migrate llvm::make_unique to std::make_unique
Jonas Devlieghere [Wed, 14 Aug 2019 23:04:18 +0000 (23:04 +0000)]
[Clang] Migrate llvm::make_unique to std::make_unique

Now that we've moved to C++14, we no longer need the llvm::make_unique
implementation from STLExtras.h. This patch is a mechanical replacement
of (hopefully) all the llvm::make_unique instances across the monorepo.

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

llvm-svn: 368942

5 years ago[www] Update DR status page to match latest version of CWG issues list.
Richard Smith [Wed, 14 Aug 2019 22:57:51 +0000 (22:57 +0000)]
[www] Update DR status page to match latest version of CWG issues list.

llvm-svn: 368941

5 years agoFix handling of class member access into a vector type.
Richard Smith [Wed, 14 Aug 2019 22:57:50 +0000 (22:57 +0000)]
Fix handling of class member access into a vector type.

When handling a member access into a non-class, non-ObjC-object type, we
would perform a lookup into the surrounding scope as if for an
unqualified lookup. If the member access was followed by a '<' and this
lookup (or the typo-correction for it) found a template name, we'd treat
the member access as naming that template.

Now we treat such accesses as never naming a template if the type of the
object expression is of vector type, so that vector component accesses
are never misinterpreted as naming something else. This is not entirely
correct, since it is in fact valid to name a template from the enclosing
scope in this context, when invoking a pseudo-destructor for the vector
type via an alias template, but that's very much a corner case, and this
change leaves that case only as broken as the corresponding case for
Objective-C types is.

This incidentally adds support for dr2292, which permits a 'template'
keyword at the start of a member access naming a pseudo-destructor.

llvm-svn: 368940

5 years agoRemove LVALUE / RVALUE workarounds
JF Bastien [Wed, 14 Aug 2019 22:48:12 +0000 (22:48 +0000)]
Remove LVALUE / RVALUE workarounds

Summary: LLVM_HAS_RVALUE_REFERENCE_THIS and LLVM_LVALUE_FUNCTION shouldn't be needed anymore because the minimum compiler versions support them.

Subscribers: jkorous, dexonsmith, cfe-commits, llvm-commits, hans, thakis, chandlerc, rnk

Tags: #clang, #llvm

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

llvm-svn: 368939

5 years ago[Attributor] Try to fix "missing field 'RetInsts' initializer" warning
Johannes Doerfert [Wed, 14 Aug 2019 22:32:29 +0000 (22:32 +0000)]
[Attributor] Try to fix "missing field 'RetInsts' initializer" warning

http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/35674/steps/build_Lld/logs/stdio

llvm-svn: 368938

5 years agoImprove anonymous class heuristic in ClangASTContext::CreateRecordType
Shafik Yaghmour [Wed, 14 Aug 2019 22:30:29 +0000 (22:30 +0000)]
Improve anonymous class heuristic in ClangASTContext::CreateRecordType

Summary:
Currently the heuristic used in ClangASTContext::CreateRecordType to identify an anonymous class is that there is that name is a nullptr or simply a null terminator. This heuristic is not accurate since it will also sweep up unnamed classes and lambdas. The improved heuristic relies on the requirement that an anonymous class must be contained within a class.

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

llvm-svn: 368937

5 years ago[LLD] Migrate llvm::make_unique to std::make_unique
Jonas Devlieghere [Wed, 14 Aug 2019 22:28:17 +0000 (22:28 +0000)]
[LLD] Migrate llvm::make_unique to std::make_unique

Now that we've moved to C++14, we no longer need the llvm::make_unique
implementation from STLExtras.h. This patch is a mechanical replacement
of (hopefully) all the llvm::make_unique instances across the monorepo.

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

llvm-svn: 368936

5 years ago[Polly] Migrate llvm::make_unique to std::make_unique
Jonas Devlieghere [Wed, 14 Aug 2019 22:28:12 +0000 (22:28 +0000)]
[Polly] Migrate llvm::make_unique to std::make_unique

Now that we've moved to C++14, we no longer need the llvm::make_unique
implementation from STLExtras.h. This patch is a mechanical replacement
of (hopefully) all the llvm::make_unique instances across the monorepo.

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

llvm-svn: 368935

5 years ago[Bugpoint redesign] Modified Functions pass to consider declarations
Diego Trevino Ferrer [Wed, 14 Aug 2019 22:22:37 +0000 (22:22 +0000)]
[Bugpoint redesign] Modified Functions pass to consider declarations

Summary: This modification was put in place so the `ReduceMetadata` pass doesn't have to consider debug functions

Reviewers: dblaikie

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 368934

5 years ago[LLDB] Migrate llvm::make_unique to std::make_unique
Jonas Devlieghere [Wed, 14 Aug 2019 22:19:23 +0000 (22:19 +0000)]
[LLDB] Migrate llvm::make_unique to std::make_unique

Now that we've moved to C++14, we no longer need the llvm::make_unique
implementation from STLExtras.h. This patch is a mechanical replacement
of (hopefully) all the llvm::make_unique instances across the monorepo.

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

llvm-svn: 368933

5 years ago[docs] Fix sphinx doc generation errors
Jordan Rupprecht [Wed, 14 Aug 2019 22:18:01 +0000 (22:18 +0000)]
[docs] Fix sphinx doc generation errors

Summary:
Errors fixed:
 - GettingStarted: Duplicate explicit target name: "cmake"
 - GlobalISel: Unexpected indentation
 - LoopTerminology: Explicit markup ends without a blank line; unexpected unindent
 - ORCv2: Definition list ends without a blank line; unexpected unindent
 - Misc: document isn't included in any toctree

Verified that a clean docs build (`rm -rf docs/ && ninja docs-llvm-html`) passes with no errors. Spot checked the individual pages to make sure they look OK.

Reviewers: thakis, dsanders

Reviewed By: dsanders

Subscribers: arphaman, llvm-commits, lhames, rovka, dsanders, reames

Tags: #llvm

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

llvm-svn: 368932

5 years ago[Attributor][NFC] Make debug output consistent
Johannes Doerfert [Wed, 14 Aug 2019 22:04:28 +0000 (22:04 +0000)]
[Attributor][NFC] Make debug output consistent

llvm-svn: 368931

5 years ago[SCEV] Rename getMaxBackedgeTakenCount to getConstantMaxBackedgeTakenCount [NFC]
Philip Reames [Wed, 14 Aug 2019 21:58:13 +0000 (21:58 +0000)]
[SCEV] Rename getMaxBackedgeTakenCount to getConstantMaxBackedgeTakenCount [NFC]

llvm-svn: 368930

5 years ago[LifetimeAnalysis] Support std::stack::top() and std::optional::value()
Matthias Gehre [Wed, 14 Aug 2019 21:55:57 +0000 (21:55 +0000)]
[LifetimeAnalysis] Support std::stack::top() and std::optional::value()

Summary: Diagnose dangling pointers that come from std::stack::top() and std::optional::value().

Reviewers: gribozavr

Subscribers: cfe-commits, xazax.hun

Tags: #clang

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

llvm-svn: 368929

5 years ago[Attributor][NFC] Try to eliminate warnings (debug build + fall through)
Johannes Doerfert [Wed, 14 Aug 2019 21:46:28 +0000 (21:46 +0000)]
[Attributor][NFC] Try to eliminate warnings (debug build + fall through)

llvm-svn: 368928

5 years ago[Attributor][NFC] Introduce statistics macros for new positions
Johannes Doerfert [Wed, 14 Aug 2019 21:46:25 +0000 (21:46 +0000)]
[Attributor][NFC] Introduce statistics macros for new positions

llvm-svn: 368927

5 years ago[SelectionDAGBuilder] Teach gather/scatter getUniformBase to look through vector...
Craig Topper [Wed, 14 Aug 2019 21:38:56 +0000 (21:38 +0000)]
[SelectionDAGBuilder] Teach gather/scatter getUniformBase to look through vector zeroinitializer indices in addition to scalar zeroes.

llvm-svn: 368926

5 years ago[Attributor][NFC] Add merge/join/clamp operators to the IntegerState
Johannes Doerfert [Wed, 14 Aug 2019 21:35:20 +0000 (21:35 +0000)]
[Attributor][NFC] Add merge/join/clamp operators to the IntegerState

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

llvm-svn: 368925

5 years ago[Attributor] Use the AANoNull attribute directly in AADereferenceable
Johannes Doerfert [Wed, 14 Aug 2019 21:31:32 +0000 (21:31 +0000)]
[Attributor] Use the AANoNull attribute directly in AADereferenceable

Summary:
Instead of constantly keeping track of the nonnull status with the
dereferenceable information we can simply query the nonnull attribute
whenever we need the information (debug + manifest).

Reviewers: sstefan1, uenoku

Subscribers: hiraditya, bollu, jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 368924

5 years ago[AArch64][GlobalISel] Custom selection for s8 load acquire.
Amara Emerson [Wed, 14 Aug 2019 21:30:30 +0000 (21:30 +0000)]
[AArch64][GlobalISel] Custom selection for s8 load acquire.

Implement this single atomic load instruction so that we can compile stack
protector code.

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

llvm-svn: 368923

5 years ago[Attributor] Use liveness during the creation of AAReturnedValues
Johannes Doerfert [Wed, 14 Aug 2019 21:29:37 +0000 (21:29 +0000)]
[Attributor] Use liveness during the creation of AAReturnedValues

Summary:
As one of the first attributes, and one of the complex ones,
AAReturnedValues was not using liveness but we filtered the result after
the fact. This change adds liveness usage during the creation. The
algorithm is also improved and shorter.

The new algorithm will collect returned values over time using the
generic facilities that work with liveness already, e.g.,
genericValueTraversal which does not look at dead PHI node predecessors.
A test to show how this leads to better results is included.

Note: Unresolved calls and resolved calls are now tracked explicitly.

Reviewers: uenoku, sstefan1

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

llvm-svn: 368922

5 years ago[Attributor] Do not update or manifest dead attributes
Johannes Doerfert [Wed, 14 Aug 2019 21:25:08 +0000 (21:25 +0000)]
[Attributor] Do not update or manifest dead attributes

Summary:
If the associated context instruction is assumed dead we do not need to
update or manifest the state.

Reviewers: sstefan1, uenoku

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

llvm-svn: 368921

5 years agoRevert "[lldb] Reinstate original guard variable check"
Raphael Isemann [Wed, 14 Aug 2019 21:21:14 +0000 (21:21 +0000)]
Revert "[lldb] Reinstate original guard variable check"

It seems this breaks the following tests:
    lldb-Suite :: expression_command/call-function/TestCallUserDefinedFunction.py
    lldb-Suite :: expression_command/rdar42038760/TestScalarURem.py

Let's revert this patch and wait until we find an actual issue that could be
fixed by also doing the guard variable check on Windows.

llvm-svn: 368920

5 years ago[Attributor] Use IRPosition consistently
Johannes Doerfert [Wed, 14 Aug 2019 21:18:01 +0000 (21:18 +0000)]
[Attributor] Use IRPosition consistently

Summary:
The next attempt to clean up the Attributor interface before we grow it
further.

Before, we used a combination of two values (associated + anchor) and an
argument number (or -1) to determine a location. This was very fragile.
The new system uses exclusively IR positions and we restrict the
generation of IR positions to special constructor methods that verify
internal constraints we have. This will catch misuse early.

The auto-conversion, e.g., in getAAFor, is now performed through the
SubsumingPositionIterator. This iterator takes an IR position and allows
to visit all IR positions that "subsume" the given one, e.g., function
attributes "subsume" argument attributes of that function. For a
detailed breakdown see the class comment of SubsumingPositionIterator.

This patch also introduces the IRPosition::getAttrs() to extract IR
attributes at a certain position. The method knows how to look up in
different positions that are equivalent, e.g., the argument position for
call site arguments. We also introduce three new positions kinds such
that we have all IR positions where attributes can be placed and one for
"floating" values.

Reviewers: sstefan1, uenoku

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

llvm-svn: 368919

5 years ago[Bugpoint redesign] Added Pass to Remove Global Variables
Diego Trevino Ferrer [Wed, 14 Aug 2019 21:01:19 +0000 (21:01 +0000)]
[Bugpoint redesign] Added Pass to Remove Global Variables

Summary:
This pass tries to remove Global Variables, as well as their derived uses. For example if a variable `@x` is used by `%call1` and `%call2`, both these uses and the definition of `@x` are deleted. Moreover if `%call1` or `%call2` are used elsewhere those uses are also deleted, and so on recursively.

I'm still uncertain if this pass should remove derived uses, I'm open to suggestions.

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 368918

5 years ago[AMDGPU] Do not assume a default GCN target
Stanislav Mekhanoshin [Wed, 14 Aug 2019 20:55:15 +0000 (20:55 +0000)]
[AMDGPU] Do not assume a default GCN target

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

llvm-svn: 368917

5 years agoFix thread comparison by making sure we never pass our special 'not a thread' value...
Marshall Clow [Wed, 14 Aug 2019 20:54:56 +0000 (20:54 +0000)]
Fix thread comparison by making sure we never pass our special 'not a thread' value to the underlying implementation. Fixes PR#42918.

llvm-svn: 368916

5 years ago[Bugpoint redesign] Reduced scope of variables in Delta implementation
Diego Trevino Ferrer [Wed, 14 Aug 2019 20:34:12 +0000 (20:34 +0000)]
[Bugpoint redesign] Reduced scope of variables in Delta implementation

Summary: This diff also changed the check in `Delta.cpp` to verify interesting-ness, so it exits when the input isn't interesting

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 368915

5 years ago[libc++] Mark <chrono> test as unsupported on AppleClang 9
Louis Dionne [Wed, 14 Aug 2019 20:27:56 +0000 (20:27 +0000)]
[libc++] Mark <chrono> test as unsupported on AppleClang 9

llvm-svn: 368914

5 years ago[x86] add tests for fadd reduction; NFC
Sanjay Patel [Wed, 14 Aug 2019 20:21:30 +0000 (20:21 +0000)]
[x86] add tests for fadd reduction; NFC

More coverage for D66236.

llvm-svn: 368913

5 years ago[clang-doc] Add missing check in tests
Diego Astiazaran [Wed, 14 Aug 2019 20:19:33 +0000 (20:19 +0000)]
[clang-doc] Add missing check in tests

Path is now checked when comparing two Infos in the unit tests.

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

llvm-svn: 368912

5 years ago[libc++] Mark std::tuple CTAD test as failing on AppleClang 9
Louis Dionne [Wed, 14 Aug 2019 20:17:18 +0000 (20:17 +0000)]
[libc++] Mark std::tuple CTAD test as failing on AppleClang 9

Like CTAD for std::unordered_set, AppleClang 9's support for CTAD is
insufficient. I suspect the corresponding LLVM Clang is broken too,
but we don't seem to have testers using that Clang.

llvm-svn: 368911

5 years agoUse std::is_final directly
JF Bastien [Wed, 14 Aug 2019 20:13:49 +0000 (20:13 +0000)]
Use std::is_final directly

The workaround isn't needed anymore because all toolchains should support it.

llvm-svn: 368910

5 years agoSwapByteOrder.h: don't check for unsupported GCC versions
JF Bastien [Wed, 14 Aug 2019 19:59:05 +0000 (19:59 +0000)]
SwapByteOrder.h: don't check for unsupported GCC versions

llvm-svn: 368909

5 years agoMathExtras.h: don't check for unsupported GCC versions
JF Bastien [Wed, 14 Aug 2019 19:57:21 +0000 (19:57 +0000)]
MathExtras.h: don't check for unsupported GCC versions

llvm-svn: 368908

5 years agoAdd support in CMake to statically link the C++ standard library.
Erich Keane [Wed, 14 Aug 2019 19:55:59 +0000 (19:55 +0000)]
Add support in CMake to statically link the C++ standard library.

It is sometimes useful to have the C++ standard library linked into the
assembly when compiling clang, particularly when distributing a compiler
onto systems that don't have a copy of stdlibc++ or libc++ installed.

This functionality should work with either GCC or Clang as the host
compiler, though statically linking libc++ (as may be required for
licensing purposes) is only possible if the host compiler is Clang with
a copy of libc++ available.

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

llvm-svn: 368907

5 years ago[SLP][NFC] Use pointers to address to ScalarToTreeEntry elements, instead of indexes.
Dinar Temirbulatov [Wed, 14 Aug 2019 19:46:50 +0000 (19:46 +0000)]
[SLP][NFC] Use pointers to address to ScalarToTreeEntry elements, instead of indexes.

llvm-svn: 368906

5 years ago[SDAG] move variable closer to use; NFC
Sanjay Patel [Wed, 14 Aug 2019 19:46:15 +0000 (19:46 +0000)]
[SDAG] move variable closer to use; NFC

llvm-svn: 368905

5 years ago[lldb][NFC] Remove unused function
Jordan Rupprecht [Wed, 14 Aug 2019 19:31:56 +0000 (19:31 +0000)]
[lldb][NFC] Remove unused function

llvm-svn: 368904

5 years ago[OPENMP]Support for non-rectangular loops.
Alexey Bataev [Wed, 14 Aug 2019 19:30:06 +0000 (19:30 +0000)]
[OPENMP]Support for non-rectangular loops.

Added basic support for non-rectangular loops. It requires an additional
analysis of min/max boundaries for non-rectangular loops. Since only
linear dependency is allowed, we can do this analysis.

llvm-svn: 368903

5 years agoRevert "Un-break the bots"
JF Bastien [Wed, 14 Aug 2019 19:19:41 +0000 (19:19 +0000)]
Revert "Un-break the bots"

Looks like the problem was due to the cmake cache, Chris fixed in r368897.

llvm-svn: 368902

5 years agoAMDGPU: Reduce number of registers in test
Matt Arsenault [Wed, 14 Aug 2019 19:09:48 +0000 (19:09 +0000)]
AMDGPU: Reduce number of registers in test

Once the failure this is testing is fixed, this would fail due to
using too many registers.

llvm-svn: 368901

5 years ago[PowerPC][NFC] Remove duplicate tests in build-vector-test.ll
Jinsong Ji [Wed, 14 Aug 2019 19:06:59 +0000 (19:06 +0000)]
[PowerPC][NFC] Remove duplicate tests in build-vector-test.ll

AllOnes has been split into build-vector-allones.ll.

llvm-svn: 368900

5 years ago[Support][NFC] Fix error message for posix_spawn_file_actions_addopen failed call
Jan Korous [Wed, 14 Aug 2019 18:30:18 +0000 (18:30 +0000)]
[Support][NFC] Fix error message for posix_spawn_file_actions_addopen failed call

Seems like a copy-paste from couple lines above.

llvm-svn: 368899

5 years ago[RLEV] Rewrite loop exit values for multiple exit loops w/o overall loop exit count
Philip Reames [Wed, 14 Aug 2019 18:27:57 +0000 (18:27 +0000)]
[RLEV] Rewrite loop exit values for multiple exit loops w/o overall loop exit count

We already supported rewriting loop exit values for multiple exit loops, but if any of the loop exits were not computable, we gave up on all loop exit values. This patch generalizes the existing code to handle individual computable loop exits where possible.

As discussed in the review, this is a starting point for figuring out a better API.  The code is a bit ugly, but getting it in lets us test as we go.

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

llvm-svn: 368898

5 years ago[CMake] Fix cache invalidation of LLVM_CXX_STD
Chris Bieneman [Wed, 14 Aug 2019 18:26:37 +0000 (18:26 +0000)]
[CMake] Fix cache invalidation of LLVM_CXX_STD

This cleans up fallout from https://reviews.llvm.org/D66195.

llvm-svn: 368897

5 years agoUn-break the bots
JF Bastien [Wed, 14 Aug 2019 18:17:06 +0000 (18:17 +0000)]
Un-break the bots

Some bots can't find is_final despite it being in C++14. Leave the code as it was for now, fix it later when the bots are happy.

llvm-svn: 368896

5 years agoInferAddressSpaces: Move target intrinsic handling to TTI
Matt Arsenault [Wed, 14 Aug 2019 18:13:00 +0000 (18:13 +0000)]
InferAddressSpaces: Move target intrinsic handling to TTI

I'm planning on handling intrinsics that will benefit from checking
the address space enums. Don't bother moving the address collection
for now, since those won't need th enums.

llvm-svn: 368895

5 years agoInferAddressSpaces: Remove unnecessary check for ConstantInt
Matt Arsenault [Wed, 14 Aug 2019 18:01:42 +0000 (18:01 +0000)]
InferAddressSpaces: Remove unnecessary check for ConstantInt

The IR is invalid if this isn't a constant since immarg was added.

llvm-svn: 368893

5 years agoMatch if / elseif properly
JF Bastien [Wed, 14 Aug 2019 18:01:11 +0000 (18:01 +0000)]
Match if / elseif properly

My last commit fumbled it.

llvm-svn: 368892

5 years ago[DebugInfo] Consider debug label scope has an extra lexical block file
Taewook Oh [Wed, 14 Aug 2019 17:58:45 +0000 (17:58 +0000)]
[DebugInfo] Consider debug label scope has an extra lexical block file

Summary: There are places where a case that debug label scope has an extra lexical block file is not considered properly. The modified test won't pass without this patch.

Reviewers: aprantl, HsiangKai

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 368891

5 years agoRemove now useless C++1y flag
JF Bastien [Wed, 14 Aug 2019 17:57:20 +0000 (17:57 +0000)]
Remove now useless C++1y flag

As of D66195 we support C++14 by default.

llvm-svn: 368890

5 years agoDon't explicitly check for C++14
JF Bastien [Wed, 14 Aug 2019 17:48:36 +0000 (17:48 +0000)]
Don't explicitly check for C++14

MSVC is weird about __cplusplus. The check I added in D66195 confuses it.

llvm-svn: 368889

5 years agoFix cppcheck + MSVC analyzer uninitialized member variable warning. NFCI.
Simon Pilgrim [Wed, 14 Aug 2019 17:41:37 +0000 (17:41 +0000)]
Fix cppcheck + MSVC analyzer uninitialized member variable warning. NFCI.

llvm-svn: 368888

5 years agoMove to C++14
JF Bastien [Wed, 14 Aug 2019 17:39:07 +0000 (17:39 +0000)]
Move to C++14

Summary:
I just bumped the minimum compiler versions to support C++14 in D66188.

Following [our process](http://llvm.org/docs/DeveloperPolicy.html#toolchain) and [our previous agreement](http://lists.llvm.org/pipermail/llvm-dev/2019-January/129452.html), I'm now officially bumping the C++ version to 14 and updating the documentation.

Subscribers: mgorny, jkorous, dexonsmith, llvm-commits, chandlerc, thakis, EricWF, jyknight, lhames, JDevlieghere

Tags: #llvm

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

llvm-svn: 368887

5 years ago[InstCombine][NFC] Tests for 'try to reuse constant from select in comparison'
Roman Lebedev [Wed, 14 Aug 2019 17:27:50 +0000 (17:27 +0000)]
[InstCombine][NFC] Tests for 'try to reuse constant from select in comparison'

https://rise4fun.com/Alive/THl

llvm-svn: 368886

5 years agoThis commit removes std::shared_ptr::make_shared and std::shared_ptr::allocate_shared...
Zoe Carver [Wed, 14 Aug 2019 17:19:25 +0000 (17:19 +0000)]
This commit removes std::shared_ptr::make_shared and std::shared_ptr::allocate_shared as they are not part of the standard. This commit also adds the helper function "__create_with_cntrl_block" which std::allocate_shared and std::make_shared have been updated to use.

llvm-svn: 368885

5 years ago[SLC] Dereferenceable annonation - handle valid null pointers
David Bolvansky [Wed, 14 Aug 2019 17:15:20 +0000 (17:15 +0000)]
[SLC] Dereferenceable annonation - handle valid null pointers

Reviewers: jdoerfert, reames

Reviewed By: jdoerfert

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 368884

5 years ago[CFG] Introduce CFGElementRef, a wrapper that knows it's position in a CFGBlock
Kristof Umann [Wed, 14 Aug 2019 17:05:55 +0000 (17:05 +0000)]
[CFG] Introduce CFGElementRef, a wrapper that knows it's position in a CFGBlock

Previously, collecting CFGElements in a set was practially impossible, because
both CFGBlock::operator[] and both the iterators returned it by value. One
workaround would be to collect the iterators instead, but they don't really
capture the concept of an element, and elements from different iterator types are incomparable.

This patch introduces CFGElementRef, a wrapper around a (CFGBlock, Index) pair,
and a variety of new iterators and iterator ranges to solve this problem.

I guess you could say that this patch took a couple iterations to get right :^)

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

llvm-svn: 368883

5 years ago[libc++] Enable <chrono> ""d and ""y literals for AppleClang 10 and up
Louis Dionne [Wed, 14 Aug 2019 17:04:31 +0000 (17:04 +0000)]
[libc++] Enable <chrono> ""d and ""y literals for AppleClang 10 and up

AppleClang supports those literals starting in version 10.0.1.

llvm-svn: 368882

5 years ago[NFC][clang] Moving argument handling: Driver::BuildActions -> handleArguments
Puyan Lotfi [Wed, 14 Aug 2019 17:02:21 +0000 (17:02 +0000)]
[NFC][clang] Moving argument handling: Driver::BuildActions -> handleArguments

This patch simply moves code that already exists into a new function.
Specifically I think it will make the BuildActions code for building a clang
job pipeline easier to read and work with.

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

llvm-svn: 368881

5 years ago[libc++] Do not define _LIBCPP_CLANG_VER for non-LLVM Clang
Louis Dionne [Wed, 14 Aug 2019 17:01:08 +0000 (17:01 +0000)]
[libc++] Do not define _LIBCPP_CLANG_VER for non-LLVM Clang

In r292833, we started defining _LIBCPP_CLANG_VER to 0 for Apple Clang.
The result is that AppleClang is detected as being a very old version
of LLVM Clang (version 0), which is obviously incorrect.

I believe this was added so that we don't have to check whether
_LIBCPP_CLANG_VER is defined prior to comparing it with a number
(which can trigger a warning). This commit also fixes the two
places that use the macro correspondingly.

llvm-svn: 368880

5 years ago[DebugLine] Improve path handling.
Jonas Devlieghere [Wed, 14 Aug 2019 17:00:10 +0000 (17:00 +0000)]
[DebugLine] Improve path handling.

After switching over LLDB's line table parser to libDebugInfo, we
noticed two regressions on the Windows bot. The problem is that when
obtaining a file from the line table prologue, we append paths without
specifying a path style. This leads to incorrect results on Windows for
debug info containing Posix paths:

  0x0000000000201000: /tmp\b.c, is_start_of_statement = TRUE

This patch is an attempt to fix that by guessing the path style whenever
possible.

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

llvm-svn: 368879

5 years ago[Sema][ObjC] Fix a -Wformat false positive with localizedStringForKey
Erik Pilkington [Wed, 14 Aug 2019 16:57:11 +0000 (16:57 +0000)]
[Sema][ObjC] Fix a -Wformat false positive with localizedStringForKey

Only honour format_arg attributes on -[NSBundle localizedStringForKey] when its
argument has a format specifier in it, otherwise its likely to just be a key to
fetch localized strings.

Fixes rdar://23622446

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

llvm-svn: 368878

5 years agoFix cppcheck + MSVC analyzer uninitialized member variable warning. NFCI.
Simon Pilgrim [Wed, 14 Aug 2019 16:55:34 +0000 (16:55 +0000)]
Fix cppcheck + MSVC analyzer uninitialized member variable warning. NFCI.

llvm-svn: 368877

5 years ago[NFC] Updated tests after r368875
David Bolvansky [Wed, 14 Aug 2019 16:50:34 +0000 (16:50 +0000)]
[NFC] Updated tests after r368875

llvm-svn: 368876

5 years ago[BuildLibCalls] Noalias annotation
David Bolvansky [Wed, 14 Aug 2019 16:50:06 +0000 (16:50 +0000)]
[BuildLibCalls] Noalias annotation

Summary: I think this is better solution than annotating callsites in IC/SLC.

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: MaskRay, llvm-commits

Tags: #llvm

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

llvm-svn: 368875

5 years agoDocument clang-cpp in the release notes for clang
Chris Bieneman [Wed, 14 Aug 2019 16:49:52 +0000 (16:49 +0000)]
Document clang-cpp in the release notes for clang

This patch adds a line in the release notes about the new clang-cpp library and the CMake option to force clang to link against it.

llvm-svn: 368874

5 years agoIgnore indirect branches from callbr.
Bill Wendling [Wed, 14 Aug 2019 16:44:07 +0000 (16:44 +0000)]
Ignore indirect branches from callbr.

Summary:
We can't speculate around indirect branches: indirectbr and invoke. The
callbr instruction needs to be included here.

Reviewers: nickdesaulniers, manojgupta, chandlerc

Reviewed By: chandlerc

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 368873

5 years agoAdd missing NativeProcessFactory for lldb-server on Windows
Aaron Smith [Wed, 14 Aug 2019 16:39:41 +0000 (16:39 +0000)]
Add missing NativeProcessFactory for lldb-server on Windows

llvm-svn: 368872

5 years ago[LifetimeAnalysis] Fix false negatives of statement local lifetime analysis for some...
Gabor Horvath [Wed, 14 Aug 2019 16:34:56 +0000 (16:34 +0000)]
[LifetimeAnalysis] Fix false negatives of statement local lifetime analysis for some STL implementation

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

llvm-svn: 368871

5 years ago[mips] Remove redundant case in the test. NFC
Simon Atanasyan [Wed, 14 Aug 2019 16:27:07 +0000 (16:27 +0000)]
[mips] Remove redundant case in the test. NFC

llvm-svn: 368870

5 years ago[mips] Split long lines in the test case file. NFC
Simon Atanasyan [Wed, 14 Aug 2019 16:27:00 +0000 (16:27 +0000)]
[mips] Split long lines in the test case file. NFC

llvm-svn: 368869

5 years ago[WebAssembly] Stop unrolling SIMD shifts since they are fixed in V8
Thomas Lively [Wed, 14 Aug 2019 16:24:37 +0000 (16:24 +0000)]
[WebAssembly] Stop unrolling SIMD shifts since they are fixed in V8

Summary:
Fixes PR42973. Tests don't change because simd-arith.ll tests behavior
on unimplemented-simd128, which does not include any temporary
workarounds such as the one removed in this revision.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, dmgreen, llvm-commits

Tags: #llvm

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

llvm-svn: 368868

5 years agoRework recursive_timed_mutex so that it uses __thread_id instead of using the lower...
Marshall Clow [Wed, 14 Aug 2019 16:21:27 +0000 (16:21 +0000)]
Rework recursive_timed_mutex so that it uses __thread_id instead of using the lower-level __libcpp_thread_id. This is prep for fixing PR42918. Reviewed as https://reviews.llvm.org/D65895

llvm-svn: 368867

5 years ago[scudo][standalone] Add more stats to mallinfo
Kostya Kortchinsky [Wed, 14 Aug 2019 16:04:01 +0000 (16:04 +0000)]
[scudo][standalone] Add more stats to mallinfo

Summary:
Android requires additional stats in mallinfo. While we can provide
right away the number of bytes mapped (Primary+Secondary), there was
no way to get the number of free bytes (only makes sense for the
Primary since the Secondary unmaps everything on deallocation).

An approximation could be `StatMapped - StatAllocated`, but since we
are mapping in `1<<17` increments for the 64-bit Primary, it's fairly
inaccurate.

So we introduce `StatFree` (note it's `Free`, not `Freed`!), which
keeps track of the amount of Primary blocks currently unallocated.

Reviewers: cferris, eugenis, vitalybuka, hctim, morehouse

Reviewed By: morehouse

Subscribers: delcypher, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 368866

5 years agoFix cppcheck + MSVC analyzer uninitialized member variable warning. NFCI.
Simon Pilgrim [Wed, 14 Aug 2019 16:03:37 +0000 (16:03 +0000)]
Fix cppcheck + MSVC analyzer uninitialized member variable warning. NFCI.

llvm-svn: 368865

5 years ago[X86] Use PSADBW for v8i8 addition reductions.
Craig Topper [Wed, 14 Aug 2019 15:57:29 +0000 (15:57 +0000)]
[X86] Use PSADBW for v8i8 addition reductions.

Improves the 8 byte case from PR42674.

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

llvm-svn: 368864