platform/upstream/llvm.git
4 years ago[WebAssembly][MC] Fix leak of std::string members in MCSymbolWasm
Sam Clegg [Tue, 7 Apr 2020 03:46:11 +0000 (20:46 -0700)]
[WebAssembly][MC] Fix leak of std::string members in MCSymbolWasm

Summary: Fixes: https://bugs.llvm.org/show_bug.cgi?id=45452

Subscribers: dschuff, jgravelle-google, hiraditya, aheejin, sunfish, llvm-commits

Tags: #llvm

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

4 years ago[AMDGPU] Limit endcf-collapase to simple if
Stanislav Mekhanoshin [Tue, 7 Apr 2020 00:03:40 +0000 (17:03 -0700)]
[AMDGPU] Limit endcf-collapase to simple if

We can only collapse adjacent SI_END_CF if outer statement
belongs to a simple SI_IF, otherwise correct mask is not in the
register we expect, but is an argument of an S_XOR instruction.

Even if SI_IF is simple it might be lowered using S_XOR because
lowering is dependent on a basic block layout. It is not
considered simple if instruction consuming its output is
not an SI_END_CF. Since that SI_END_CF might have already been
lowered to an S_OR isSimpleIf() check may return false.

This situation is an opportunity for a further optimization
of SI_IF lowering, but that is a separate optimization. In the
meanwhile move SI_END_CF post the lowering when we already know
how the rest of the CFG was lowered since a non-simple SI_IF
case still needs to be handled.

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

4 years ago[ELF] --warn-backrefs: don't warn for linking sandwich problems
Fangrui Song [Mon, 6 Apr 2020 05:27:46 +0000 (22:27 -0700)]
[ELF] --warn-backrefs: don't warn for linking sandwich problems

This is an alternative design to D77512.

D45195 added --warn-backrefs to detect

* A. certain input orders which GNU ld either errors ("undefined reference")
  or has different resolution semantics
* B. (byproduct) some latent multiple definition problems (-ldef1 -lref -ldef2) which I
  call "linking sandwich problems". def2 may or may not be the same as def1.

When an archive appears more than once (-ldef -lref -ldef), lld and GNU
ld may have the same resolution but --warn-backrefs may warn. This is
not uncommon. For example, currently lld itself has such a problem:

```
liblldCommon.a liblldCOFF.a ... liblldCommon.a
  _ZN3lld10DWARFCache13getDILineInfoEmm in liblldCOFF.a refers to liblldCommon.a(DWARF.cpp.o)
libLLVMSupport.a also appears twice and has a similar warning
```

glibc has such problems. It is somewhat destined because of its separate
libc/libpthread/... and arbitrary grouping. The situation is getting
improved over time but I have seen:
```
-lc __isnanl references -lm
-lc _IO_funlockfile references -lpthread
```

There are also various issues in interaction with other runtime
libraries such as libgcc_eh and libunwind:
```
-lc __gcc_personality_v0 references -lgcc_eh
-lpthread __gcc_personality_v0 references -lgcc_eh
-lpthread _Unwind_GetCFA references -lunwind
```

These problems are actually benign. We want --warn-backrefs to focus on
its main task A and defer task B (which is also useful) to a more
specific future feature (see gold --detect-odr-violations and
https://bugs.llvm.org/show_bug.cgi?id=43110).

Instead of warning immediately, we store the message and only report it
if no subsequent lazy definition exists.

The use of the static variable `backrefDiags` is similar to `undefs` in
Relocations.cpp

Reviewed By: grimar

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

4 years ago[ELF] -M/-Map: fix VMA/LMA/Size columns of symbol assignments when address/size>...
Fangrui Song [Sat, 4 Apr 2020 00:07:01 +0000 (17:07 -0700)]
[ELF] -M/-Map: fix VMA/LMA/Size columns of symbol assignments when address/size>=2**32

SymbolAssignment::addr stores the location counter. The type should be
uint64_t instead of unsigned. The upper half of the address space is
commonly used by operating system kernels.

Similarly, SymbolAssignment::size should be an uint64_t. A kernel linker
script can move the location counter from 0 to the upper half of the
address space.

Reviewed By: grimar

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

4 years agoCheck LLVM_BUILD_LLVM_C_DYLIB before building the C DLL with MSVC.
Aaron Ballman [Tue, 7 Apr 2020 17:13:08 +0000 (13:13 -0400)]
Check LLVM_BUILD_LLVM_C_DYLIB before building the C DLL with MSVC.

4 years ago[X86][SSE] Add PTEST(AND(X,Y),AND(X,Y)) tests derived from PR42035 examples
Simon Pilgrim [Tue, 7 Apr 2020 16:10:46 +0000 (17:10 +0100)]
[X86][SSE] Add PTEST(AND(X,Y),AND(X,Y)) tests derived from PR42035 examples

4 years ago[mlir][spirv] Fix wrong Phi parent block for back-to-back loops
Lei Zhang [Sat, 4 Apr 2020 22:07:45 +0000 (18:07 -0400)]
[mlir][spirv] Fix wrong Phi parent block for back-to-back loops

If we have two back-to-back loops with block arguments, the OpPhi
instructions generated for the second loop's block arguments should
have use the merge block of the first SPIR-V loop structure as
their incoming parent block.

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

4 years ago[mlir][vulkan-runner] Fix createLowerToLLVMPass interface
Lei Zhang [Tue, 7 Apr 2020 16:53:11 +0000 (12:53 -0400)]
[mlir][vulkan-runner] Fix createLowerToLLVMPass interface

createLowerToLLVMPass() now requires a struct for passing in arguments
after 7023f4b4cb0157d95d98f32ace247acd9fc7b80a.

4 years agoDAG: Use the correct getPointerTy in a few places
Matt Arsenault [Fri, 21 Jun 2019 14:06:44 +0000 (10:06 -0400)]
DAG: Use the correct getPointerTy in a few places

These should not be assuming address space 0. Calling getPointerTy is
generally the wrong thing to do, since you should already know the
type from the incoming IR.

4 years agoSlightly modify some tests as follow up to bcf66084, which breaks tests.
Amy Huang [Tue, 7 Apr 2020 16:24:18 +0000 (09:24 -0700)]
Slightly modify some tests as follow up to bcf66084, which breaks tests.

The change in bcf6604 added a debug info flag, which caused some tests
to fail; I removed some commas so that the test matching still works.

4 years ago[DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.
Amy Huang [Tue, 4 Feb 2020 21:20:13 +0000 (13:20 -0800)]
[DebugInfo] Fix for adding "returns cxx udt" option to functions in CodeView.

Summary:
This change adds DIFlagNonTrivial to forward declarations of
DICompositeType. It adds the flag to nontrivial types and types with
unknown triviality.

It fixes adding the "CxxReturnUdt" flag to functions inconsistently,
since it is added based on whether the return type is marked NonTrivial, and
that changes if the return type was a forward declaration.

continues the discussion at https://reviews.llvm.org/D75215

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

Reviewers: rnk, dblaikie, aprantl

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[RDA] Avoid full reprocessing of blocks in loops (NFCI)
Nikita Popov [Sat, 4 Apr 2020 22:22:54 +0000 (00:22 +0200)]
[RDA] Avoid full reprocessing of blocks in loops (NFCI)

RDA sometimes needs to visit blocks twice, to take into account
reaching defs coming in along loop back edges. Currently it handles
repeated visitation the same way as usual, which means that it will
scan through all instructions and their reg unit defs again. Not
only is this very inefficient, it also means that all reaching defs
in loops are going to be inserted twice.

We can do much better than this. The only thing we need to handle
is a new reaching def from a predecessor, which either needs to be
prepended to the reaching definitions (if there was no reaching def
from a predecessor), or needs to replace an existing predecessor
reaching def, if it is more recent. Since D77508 we only store the
most recent predecessor reaching def, so that's the only one that
may need updating.

This also has the nice side-effect that reaching definitions are
now automatically sorted and unique, so drop the llvm::sort() call
in favor of an assertion.

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

4 years ago[RDA] Don't pass down TraversedMBB (NFC)
Nikita Popov [Sun, 5 Apr 2020 19:14:59 +0000 (21:14 +0200)]
[RDA] Don't pass down TraversedMBB (NFC)

Only pass the MachineBasicBlock itself down to helper methods,
they don't need to know about traversal. Move the debug print
into the main method.

4 years ago[RDA] Avoid inserting duplicate reaching defs (NFCI)
Nikita Popov [Sun, 5 Apr 2020 19:09:49 +0000 (21:09 +0200)]
[RDA] Avoid inserting duplicate reaching defs (NFCI)

An instruction may define the same reg unit multiple times,
avoid inserting the same reaching def multiple times in that case.

Also print the reg unit, rather than the super-register, in the
debug code.

4 years ago[NFC][PowerPC] Cleanup 64-bit and Darwin CalleeSavedRegs
David Tenty [Tue, 7 Apr 2020 13:57:56 +0000 (09:57 -0400)]
[NFC][PowerPC] Cleanup 64-bit and Darwin CalleeSavedRegs

Summary:
- Remove the no longer used Darwin CalleeSavedRegs
- Combine the SVR464 callee saved regs and AIX64 since the two are (and should be) identical into PPC64
- Update tests for 64-bit CSR change

Reviewers: sfertile, ZarkoCA, cebowleratibm, jasonliu, #powerpc

Reviewed By: sfertile

Subscribers: wuzish, nemanjai, hiraditya, kbarton, shchenz, llvm-commits

Tags: #llvm

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

4 years ago[NFC][XCOFF] refactor readobj/XCOFFDumper.cpp
diggerlin [Tue, 7 Apr 2020 15:33:31 +0000 (11:33 -0400)]
[NFC][XCOFF] refactor readobj/XCOFFDumper.cpp

SUMMARY:

refactor readobj/XCOFFDumper.cpp with helper function getAlignmentLog2() , getSymbolType(), isLabel().

Reviewers: Hubert Tong, James Henderson
Subscribers: rupprecht, seiyai,hiradityu

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

4 years agotsan: fix Go/ppc build
Dmitry Vyukov [Tue, 7 Apr 2020 09:51:07 +0000 (11:51 +0200)]
tsan: fix Go/ppc build

PPC now requires ReExec due to ASLR.
Pull in more functions for Go build.

Suggested-by: Keith Randall (khr)
4 years ago[lldb][NFC] Fix typo in 'watchpoint delete' error message
Raphael Isemann [Tue, 7 Apr 2020 14:11:16 +0000 (16:11 +0200)]
[lldb][NFC] Fix typo in 'watchpoint delete' error message

4 years agoLLD Support for Basic Block Sections
Sriraman Tallam [Tue, 7 Apr 2020 13:48:18 +0000 (06:48 -0700)]
LLD Support for Basic Block Sections

This is part of the Propeller framework to do post link code layout
optimizations. Please see the RFC here:
https://groups.google.com/forum/#!msg/llvm-dev/ef3mKzAdJ7U/1shV64BYBAAJ and the
detailed RFC doc here:
https://github.com/google/llvm-propeller/blob/plo-dev/Propeller_RFC.pdf

This patch adds lld support for basic block sections and performs relaxations
after the basic blocks have been reordered.

After the linker has reordered the basic block sections according to the
desired sequence, it runs a relaxation pass to optimize jump instructions.
Currently, the compiler emits the long form of all jump instructions. AMD64 ISA
supports variants of jump instructions with one byte offset or a four byte
offset. The compiler generates jump instructions with R_X86_64 32-bit PC
relative relocations. We would like to use a new relocation type for these jump
instructions as it makes it easy and accurate while relaxing these instructions.

The relaxation pass does two things:

First, it deletes all explicit fall-through direct jump instructions between
adjacent basic blocks. This is done by discarding the tail of the basic block
section.

Second, If there are consecutive jump instructions, it checks if the first
conditional jump can be inverted to convert the second into a fall through and
delete the second.

The jump instructions are relaxed by using jump instruction mods, something
like relocations. These are used to modify the opcode of the jump instruction.
Jump instruction mods contain three values, instruction offset, jump type and
size. While writing this jump instruction out to the final binary, the linker
uses the jump instruction mod to determine the opcode and the size of the
modified jump instruction. These mods are required because the input object
files are memory-mapped without write permissions and directly modifying the
object files requires copying these sections. Copying a large number of basic
block sections significantly bloats memory.

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

4 years ago[hip] Remove `hip_pinned_shadow`.
Michael Liao [Thu, 26 Mar 2020 15:21:45 +0000 (11:21 -0400)]
[hip] Remove `hip_pinned_shadow`.

Summary:
- Use `device_builtin_surface` and `device_builtin_texture` for
  surface/texture reference support. So far, both the host and device
  use the same reference type, which could be revised later when
  interface/implementation is stablized.

Reviewers: yaxunl

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[X86][SSE] combineX86ShufflesConstants - early out for zeroable vectors (PR45443)
Simon Pilgrim [Tue, 7 Apr 2020 13:45:16 +0000 (14:45 +0100)]
[X86][SSE] combineX86ShufflesConstants - early out for zeroable vectors (PR45443)

Shuffle combining can insert zero byte sized elements into the shuffle mask, which combineX86ShufflesConstants will attempt to fold without taking into account whether the byte-sized type is legal (e.g. AVX512F only targets).

If we have a full-zeroable vector then we should just return a zero version of the root type, otherwise if the type isn't valid we should bail.

Fixes PR45443

4 years agoRevert "[analyzer] Try to lift 'REQUIRES: shell' for scan-build tests."
Artem Dergachev [Tue, 7 Apr 2020 13:37:20 +0000 (16:37 +0300)]
Revert "[analyzer] Try to lift 'REQUIRES: shell' for scan-build tests."

This reverts commit cfd388d344ab29ad5e311ac96e382d96bd85d994.

4 years ago[libc++abi] Enable the new libc++ testing format by default
Louis Dionne [Tue, 7 Apr 2020 13:16:06 +0000 (09:16 -0400)]
[libc++abi] Enable the new libc++ testing format by default

The new format should be equivalent to the old format, and it is now the
default format when running the libc++ tests. This commit changes the
libc++abi tests to use the new format by default too. If unexpected failures
are discovered, it should be fine to revert this commit until they are
addressed.

Also note that it is still possible to use the old format by passing
`--param=use_old_format=True` when running Lit for the time being.

4 years ago[libc++] Support .sh.s tests in the new format
Louis Dionne [Tue, 7 Apr 2020 13:12:44 +0000 (09:12 -0400)]
[libc++] Support .sh.s tests in the new format

libc++abi has two of these tests.

4 years ago[Syntax] Add mapping from spelled to expanded tokens for TokenBuffer
Marcel Hlopko [Tue, 7 Apr 2020 12:58:10 +0000 (14:58 +0200)]
[Syntax] Add mapping from spelled to expanded tokens for TokenBuffer

Summary:
Same restrictions apply as in the other direction: macro arguments are
not supported yet, only full macro expansions can be mapped.

Taking over from https://reviews.llvm.org/D72581.

Reviewers: gribozavr2, sammccall

Reviewed By: gribozavr2

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[Syntax] Merge overlapping top-level macros in TokenBuffer
Sam McCall [Tue, 7 Apr 2020 00:49:51 +0000 (02:49 +0200)]
[Syntax] Merge overlapping top-level macros in TokenBuffer

Summary:
Our previous definition of "top-level" was too informal, and didn't
allow for overlapping macros that each directly produce expanded tokens.
See D77507 for previous discussion.

Fixes http://bugs.llvm.org/show_bug.cgi?id=45428

Reviewers: kadircet, vabridgers

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[Clang] Add llvm.loop.unroll.disable to loops with -fno-unroll-loops.
Florian Hahn [Tue, 7 Apr 2020 12:43:48 +0000 (13:43 +0100)]
[Clang] Add llvm.loop.unroll.disable to loops with -fno-unroll-loops.

Currently Clang does not respect -fno-unroll-loops during LTO. During
D76916 it was suggested to respect -fno-unroll-loops on a TU basis.

This patch uses the existing llvm.loop.unroll.disable metadata to
disable loop unrolling explicitly for each loop in the TU if
unrolling is disabled. This should ensure that loops from TUs compiled
with -fno-unroll-loops are skipped by the unroller during LTO.

This also means that if a loop from a TU with -fno-unroll-loops
gets inlined into a TU without this option, the loop won't be
unrolled.

Due to the fact that some transforms might drop loop metadata, there
potentially are cases in which we still unroll loops from TUs with
-fno-unroll-loops. I think we should fix those issues rather than
introducing a function attribute to disable loop unrolling during LTO.
Improving the metadata handling will benefit other use cases, like
various loop pragmas, too. And it is an improvement to clang completely
ignoring -fno-unroll-loops during LTO.

If that direction looks good, we can use a similar approach to also
respect -fno-vectorize during LTO, at least for LoopVectorize.

In the future, this might also allow us to remove the UnrollLoops option
LLVM's PassManagerBuilder.

Reviewers: Meinersbur, hfinkel, dexonsmith, tejohnson

Reviewed By: Meinersbur, tejohnson

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

4 years ago[Syntax] Simplify TokenCollector::Builder, use captured expansion bounds. NFC
Sam McCall [Tue, 7 Apr 2020 00:46:16 +0000 (02:46 +0200)]
[Syntax] Simplify TokenCollector::Builder, use captured expansion bounds. NFC

Summary:
The motivation here is fixing https://bugs.llvm.org/show_bug.cgi?id=45428, see
D77507. The fundamental problem is that a "top-level" expansion wasn't precisely
defined. Repairing this concept means that TokenBuffer's "top-level expansion"
may not correspond to a single macro expansion. Example:

```
M(2); // expands to 1+2
```

The expansions overlap, but neither expansion alone yields all the tokens.
We need a TokenBuffer::Mapping that corresponds to their union.

This is fairly easy to fix in CollectPPExpansions, but the current design of
TokenCollector::Builder needs a fix too as it relies on the macro's expansion
range rather than the captured expansion bounds. This fix is hard to make due
to the way code is reused within Builder. And honestly, I found that code pretty
hard to reason about too.

The new approach doesn't use the expansion range, but only the expansion
location: it assumes an expansion is the contiguous set of expanded tokens with
the same expansion location, which seems like a reasonable formalization of
the "top-level" notion.

And hopefully the control flow is easier to follow too, it's considerably
shorter even with more documentation.

Reviewers: kadircet

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[libc++] Make sure the source file appears before link libraries when compiling tests
Louis Dionne [Tue, 7 Apr 2020 12:56:30 +0000 (08:56 -0400)]
[libc++] Make sure the source file appears before link libraries when compiling tests

Otherwise, files don't link when using a GNU linker, which is more
sensitive on the order of the source file relative to the various
linked libraries. See http://c-faq.com/lib/libsearch.html for an
explanation of the problem.

4 years ago[analyzer] Try to lift 'REQUIRES: shell' for scan-build tests.
Denys Petrov [Tue, 7 Apr 2020 12:51:57 +0000 (15:51 +0300)]
[analyzer] Try to lift 'REQUIRES: shell' for scan-build tests.

This is the second part of Denys's patch, committed separately
due to being more risky.

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

4 years ago[AST] Fix a crash on invalid constexpr Ctorinitializer when building RecoveryExpr.
Haojian Wu [Tue, 7 Apr 2020 11:48:18 +0000 (13:48 +0200)]
[AST] Fix a crash on invalid constexpr Ctorinitializer when building RecoveryExpr.

Summary:
crash stack:

```

lang:  workspace/llvm-project/clang/lib/AST/ExprConstant.cpp:13704: bool EvaluateInPlace(clang::APValue &, (anonymous namespace)::EvalInfo &, const (anonymous namespace)::LValue &, const clang::Expr *, bool): Assertion `!E->isValueDependent()' failed.
 #8  EvaluateInPlace(clang::APValue&, (anonymous namespace)::EvalInfo&, (anonymous namespace)::LValue const&, clang::Expr const*, bool)  workspace/llvm-project/clang/lib/AST/ExprConstant.cpp:0:0
 #9  HandleConstructorCall(clang::Expr const*, (anonymous namespace)::LValue const&, clang::APValue*, clang::CXXConstructorDecl const*, (anonymous namespace)::EvalInfo&, clang::APValue&)  workspace/llvm-project/clang/lib/AST/ExprConstant.cpp:5779:57
#10  HandleConstructorCall(clang::Expr const*, (anonymous namespace)::LValue const&, llvm::ArrayRef<clang::Expr const*>, clang::CXXConstructorDecl const*, (anonymous namespace)::EvalInfo&, clang::APValue&)  workspace/llvm-project/clang/lib/AST/ExprConstant.cpp:5819:10
#11  clang::Expr::isPotentialConstantExpr(clang::FunctionDecl const*, llvm::SmallVectorImpl<std::pair<clang::SourceLocation, clang::PartialDiagnostic> >&) workspace/llvm-project/clang/lib/AST/ExprConstant.cpp:14746:5
#12  CheckConstexprFunctionBody(clang::Sema&, clang::FunctionDecl const*, clang::Stmt*, clang::Sema::CheckConstexprKind)  workspace/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:2306:7
#13  clang::Sema::CheckConstexprFunctionDefinition(clang::FunctionDecl const*, clang::Sema::CheckConstexprKind)  workspace/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:1766:0
#14  clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool)  workspace/llvm-project/clang/lib/Sema/SemaDecl.cpp:14357:9
#15  clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&)  workspace/llvm-project/clang/lib/Parse/ParseStmt.cpp:2213:18
```

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: rsmith, cfe-commits

Tags: #clang

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

4 years agoStop passing site cfg files via --param to llvm-lit.
Nico Weber [Mon, 6 Apr 2020 20:45:00 +0000 (16:45 -0400)]
Stop passing site cfg files via --param to llvm-lit.

This has been unnecessary since https://reviews.llvm.org/D37756.

https://reviews.llvm.org/D37838 removed it for llvm.

This removes it from clang, lld, clang-tools-extra (and the GN build).

No intended behavior change.

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

4 years agoRevert "[lldb-server] jThreadsInfo returns stack memory"
Muhammad Omair Javaid [Tue, 7 Apr 2020 11:05:36 +0000 (16:05 +0500)]
Revert "[lldb-server] jThreadsInfo returns stack memory"

This reverts commit a53bf9b7c8f1ca950226a55c0e99fd706a7b6ad2.

4 years agoMark TestFixIts.py xfail for LLDB AArch64/Linux
Muhammad Omair Javaid [Tue, 7 Apr 2020 10:59:05 +0000 (15:59 +0500)]
Mark TestFixIts.py xfail for LLDB AArch64/Linux

4 years ago[clangd] Fix printing for Inclusion
Kadir Cetinkaya [Tue, 7 Apr 2020 11:47:51 +0000 (13:47 +0200)]
[clangd] Fix printing for Inclusion

4 years ago[clangd] Get rid of ASTWorker::getCurrentFileInputs
Kadir Cetinkaya [Thu, 2 Apr 2020 14:35:15 +0000 (16:35 +0200)]
[clangd] Get rid of ASTWorker::getCurrentFileInputs

Summary:
FileInputs are only written by ASTWorker thread, therefore it is safe
to read them without the lock inside that thread. It can still be read by other
threads through ASTWorker::getCurrentCompileCommand though.

This patch also gets rid of the smart pointer wrapping FileInputs as there is
never mutliple owners.

Reviewers: sammccall

Subscribers: ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[llvm-readobj] - Introduce warnings for cases when unable to read strings from string...
Georgii Rymar [Thu, 2 Apr 2020 11:40:07 +0000 (14:40 +0300)]
[llvm-readobj] - Introduce warnings for cases when unable to read strings from string tables.

Currently we have no dedicated warnings, but we return error message instead of a result.
It is generally not consistent with another warnings we have.

This change was suggested and discussed here:
https://reviews.llvm.org/D77216#1954873

This change refines error messages we report and also I had to update the API
to implement it.

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

4 years ago[InstCombine] add icmp+cast tests for ppc_fp128; NFC
Sanjay Patel [Tue, 7 Apr 2020 11:32:52 +0000 (07:32 -0400)]
[InstCombine] add icmp+cast tests for ppc_fp128; NFC

See post-commit comments for rG0f56bbc.

4 years agoAdd map-type check for target and target data directive, by Chi Chun
cchen [Tue, 7 Apr 2020 09:18:44 +0000 (05:18 -0400)]
Add map-type check for target and target data directive, by Chi Chun
Chen

Reviewers: ABataev, jdoerfert

Reviewed By: ABataev

Subscribers: cfe-commits, dreachem, sandoval

Tags: #clang

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

4 years agoFixed licenses in dynamic ast matchers
Nathan James [Tue, 7 Apr 2020 11:08:06 +0000 (12:08 +0100)]
Fixed licenses in dynamic ast matchers

4 years ago[clangd] DefineOutline: removes static token from static CXXMethodDecl
Nathan James [Tue, 7 Apr 2020 10:57:12 +0000 (11:57 +0100)]
[clangd] DefineOutline: removes static token from static CXXMethodDecl

Summary: Removes the `static` token when defining a function out of line if the function is a `CXXMethodDecl`

Reviewers: sammccall, kadircet, hokein

Reviewed By: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang, #clang-tools-extra

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

4 years ago[ARM] unwinding .pad instructions missing in execute-only prologue
Keith Walker [Thu, 26 Mar 2020 09:40:28 +0000 (09:40 +0000)]
[ARM] unwinding .pad instructions missing in execute-only prologue

If the stack pointer is altered for local variables and we are generating
Thumb2 execute-only code the .pad directive is missing.

Usually the size of the adjustment is stored in a PC-relative location
and loaded into a register which is then added to the stack pointer.
However when we are generating execute-only code code the size of the
adjustment is instead generated using the MOVW/MOVT instruction pair.

As a by product of handling the execute-only case this also fixes an
existing issue that in the none execute-only case the .pad directive was
generated against the load of the constant to a register instruction,
instead of the instruction which adds the register to the stack pointer.

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

4 years ago[X86] Fix implicit sign conversion warnings in X86 headers.
Pierre Gousseau [Fri, 3 Apr 2020 13:43:38 +0000 (14:43 +0100)]
[X86] Fix implicit sign conversion warnings in X86 headers.

Warnings in emmintrin.h and xmmintrin.h are reported by
-fsanitize=implicit-integer-sign-change.

Reviewed By: RKSimon, craig.topper

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

4 years ago[MLIR] Introduce std.alloca op
Uday Bondhugula [Sun, 22 Mar 2020 15:50:21 +0000 (21:20 +0530)]
[MLIR] Introduce std.alloca op

Introduce the alloca op for stack memory allocation. When converting to the
LLVM dialect, this is lowered to an llvm.alloca. Refactor the std to
llvm conversion for alloc op to reuse with alloca. Drop useAlloca option
with alloc op lowering.

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

4 years ago[SCCP] Use ranges for predicate info conditions.
Florian Hahn [Tue, 7 Apr 2020 09:03:46 +0000 (10:03 +0100)]
[SCCP] Use ranges for predicate info conditions.

This patch updates the code that deals with conditions from predicate
info to make use of constant ranges.

For ssa_copy instructions inserted by PredicateInfo, we have 2 ranges:
1. The range of the original value.
2. The range imposed by the linked condition.

1. is known, 2. can be determined using makeAllowedICmpRegion. The
intersection of those ranges is the range for the copy.

With this patch, we get a nice increase in the number of instructions
eliminated by both SCCP and IPSCCP for some benchmarks:

For MultiSource, SPEC2000 & SPEC2006:

Tests: 237
Same hash: 170 (filtered out)
Remaining: 67
Metric: sccp.NumInstRemoved
Program                                        base    patch   diff
 test-suite...Source/Benchmarks/sim/sim.test    10.00   71.00  610.0%
 test-suite...CFP2000/177.mesa/177.mesa.test   361.00  1626.00 350.4%
 test-suite...encode/alacconvert-encode.test   141.00  602.00  327.0%
 test-suite...decode/alacconvert-decode.test   141.00  602.00  327.0%
 test-suite...CI_Purple/SMG2000/smg2000.test   1639.00 4093.00 149.7%
 test-suite...peg2/mpeg2dec/mpeg2decode.test    75.00  163.00  117.3%
 test-suite...T2006/401.bzip2/401.bzip2.test   358.00  513.00  43.3%
 test-suite...rks/FreeBench/pifft/pifft.test    11.00   15.00  36.4%
 test-suite...langs-C/unix-tbl/unix-tbl.test     4.00    5.00  25.0%
 test-suite...lications/sqlite3/sqlite3.test   541.00  667.00  23.3%
 test-suite.../CINT2000/254.gap/254.gap.test   243.00  299.00  23.0%
 test-suite...ks/Prolangs-C/agrep/agrep.test    25.00   29.00  16.0%
 test-suite...marks/7zip/7zip-benchmark.test   1135.00 1304.00 14.9%
 test-suite...lications/ClamAV/clamscan.test   1105.00 1268.00 14.8%
 test-suite...urce/Applications/lua/lua.test   398.00  436.00   9.5%

Metric: sccp.IPNumInstRemoved
Program                                        base   patch   diff
 test-suite...C/CFP2000/179.art/179.art.test     1.00   3.00  200.0%
 test-suite...006/447.dealII/447.dealII.test   429.00 1056.00 146.2%
 test-suite...nch/fourinarow/fourinarow.test     3.00   7.00  133.3%
 test-suite...CI_Purple/SMG2000/smg2000.test   818.00 1748.00 113.7%
 test-suite...ks/McCat/04-bisect/bisect.test     3.00   5.00  66.7%
 test-suite...CFP2000/177.mesa/177.mesa.test   165.00 255.00  54.5%
 test-suite...ediabench/gsm/toast/toast.test    18.00  27.00  50.0%
 test-suite...telecomm-gsm/telecomm-gsm.test    18.00  27.00  50.0%
 test-suite...ks/Prolangs-C/agrep/agrep.test    24.00  35.00  45.8%
 test-suite...TimberWolfMC/timberwolfmc.test    43.00  62.00  44.2%
 test-suite...encode/alacconvert-encode.test    46.00  66.00  43.5%
 test-suite...decode/alacconvert-decode.test    46.00  66.00  43.5%
 test-suite...langs-C/unix-tbl/unix-tbl.test    12.00  17.00  41.7%
 test-suite...peg2/mpeg2dec/mpeg2decode.test    31.00  41.00  32.3%
 test-suite.../CINT2000/254.gap/254.gap.test   117.00 154.00  31.6%

Reviewers: efriedma, davide

Reviewed By: efriedma

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

4 years ago[docs] Add the release notes about Debug Entry Values
Djordje Todorovic [Tue, 7 Apr 2020 10:05:22 +0000 (12:05 +0200)]
[docs] Add the release notes about Debug Entry Values

Note that x86, arm and aarch64 targets support the Debug Entry Values
feature by default.

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

4 years ago[DAG] Consolidate require spill slot logic in lambda. NFC.
Serguei Katkov [Tue, 7 Apr 2020 04:04:19 +0000 (11:04 +0700)]
[DAG] Consolidate require spill slot logic in lambda. NFC.

Move the logic whether lowering of deopt value requires a spill slot in
a separate lambda.

Reviewers: reames, dantrushin
Reviewed By: dantrushin
Subscribers: hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D77629

4 years ago[ARM] Remove condition that could never be true
Peter Smith [Wed, 1 Apr 2020 07:43:07 +0000 (08:43 +0100)]
[ARM] Remove condition that could never be true

From Arm v8 Architecture Reference Manual F5.1.84 LDREXD
The ldrexd instruction in Arm state has the following conditions:

t = UInt(Rt); t2 = t + 1; n = UInt(Rn);
if Rt<0> == '1' || t2 == 15 || n == 15 then UNPREDICTABLE;

In when Rt is odd or if Rt is 14 (making t2 15).

In the implementation when the pair is the UNPREDICTABLE R14_R15 we
would ideally return SOFT_FAIL. We can't because there is no R14_R15
value for us to return so we fail early returning FAIL.

The early return for registers outside the bounds of the table means
the check for Rt == 14 (0xE) redundant which causes a static analyzer
to flag the condition as never being true.

To fix the warning I've removed the check and replaced with a comment
explaining the difference with the specification.

Fixes pr41660

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

4 years ago[MLIR] fix/update affine data copy utility for max/min bounds
Uday Bondhugula [Wed, 1 Apr 2020 06:30:26 +0000 (12:00 +0530)]
[MLIR] fix/update affine data copy utility for max/min bounds

Fix point-wise copy generation to work with bounds that have max/min.
Change structure of copy loop nest to use absolute loop indices and
subtracting base from the indexes of the fast buffers. Update supporting
utilities: Fix FlatAffineConstraints::getLowerAndUpperBound to look at
equalities as well and for a missing division. Update unionBoundingBox
to not discard common constraints (leads to a tighter system). Update
MemRefRegion::getConstantBoundingSizeAndShape to add memref dimension
constraints. Run removeTrivialRedundancy at the end of
MemRefRegion::compute.  Run single iteration loop promotion and
load/store canonicalization after affine data copy (in its test pass as
well).

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

4 years ago[Support,Windows] Tolerate failure of CryptGenRandom
Simon Tatham [Tue, 7 Apr 2020 08:18:09 +0000 (09:18 +0100)]
[Support,Windows] Tolerate failure of CryptGenRandom

Summary:
In `Unix/Process.inc`, we seed a random number generator from
`/dev/urandom` if possible, but if not, we're happy to fall back to
ordinary pseudorandom strategies, like the current time and PID.

The corresponding function on Windows calls `CryptGenRandom`, but it
//doesn't// have a fallback if that strategy fails. But `CryptGenRandom`
//can// fail, if a cryptography provider isn't properly initialized, or
occasionally (by our observation) simply intermittently.

If it's reasonable on Unix to implement traditional pseudorandom-number
seeding as a fallback, then it's surely reasonable to do the same on
Windows. So this patch adds a last-ditch use of ordinary rand(), using
much the same strategy as the Unix fallback code.

Reviewers: hans, sammccall

Reviewed By: hans

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoRevert "[CodeGen][SelectionDAG] Flip Booleans More Often"
Pierre-vh [Tue, 7 Apr 2020 08:09:10 +0000 (09:09 +0100)]
Revert "[CodeGen][SelectionDAG] Flip Booleans More Often"

This reverts commit 23342bdcc888835e744f38a2fcd0a5c651e33a31.

4 years agoDrop the number of thinlto jobs in some tests to avoid crashing on 32-bit windows
Hans Wennborg [Tue, 7 Apr 2020 07:52:12 +0000 (09:52 +0200)]
Drop the number of thinlto jobs in some tests to avoid crashing on 32-bit windows

4 years ago[CodeGen][SelectionDAG] Flip Booleans More Often
Pierre-vh [Tue, 31 Mar 2020 13:29:36 +0000 (14:29 +0100)]
[CodeGen][SelectionDAG] Flip Booleans More Often

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

4 years agoFix unused variable warning in Protocol.cpp, NFCI
Karl-Johan Karlsson [Tue, 7 Apr 2020 06:16:35 +0000 (08:16 +0200)]
Fix unused variable warning in Protocol.cpp, NFCI

Fixed gcc warning:
clang-tools-extra/clangd/Protocol.cpp:300:16: warning: unused variable 'SemanticHighlighting' [-Wunused-variable]

4 years ago[DWARF5]: Added a left over test case from D73462
Awanish Pandey [Tue, 7 Apr 2020 04:55:27 +0000 (10:25 +0530)]
[DWARF5]: Added a left over test case from D73462

Unfortunately this test case never made it to the trunk. This
was part of https://reviews.llvm.org/D73462 revision.

4 years ago[WebAssembly] EmscriptenEHSjLj: Mark more functions as imported
Sam Clegg [Fri, 3 Apr 2020 02:44:00 +0000 (19:44 -0700)]
[WebAssembly] EmscriptenEHSjLj: Mark more functions as imported

These should have been part of https://reviews.llvm.org/D77192

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

4 years ago[lit] Improve handling of parallelism group semaphores
Julian Lettner [Tue, 7 Apr 2020 03:03:36 +0000 (20:03 -0700)]
[lit] Improve handling of parallelism group semaphores

4 years ago[lldb/test] Fix TestDSYMSourcePathRemapping in the presence of symlnks
Fred Riss [Mon, 6 Apr 2020 15:40:17 +0000 (08:40 -0700)]
[lldb/test] Fix TestDSYMSourcePathRemapping in the presence of symlnks

My main work directory is on a separate partition, but I usually access
it through a symlink in my home directory. When running the tests,
either Clang or make resolves the symlink, and the real path of the
test directory ends up in the debug information.

This confuses this test as LLDB is trying to remap the real path, but
the remapping description uses the path with the symlink in
it. Calling realpath on the source path when constructing the
remapping description fixes it.

4 years agoFix template instantiation of a non-dependent call to an inherited
Richard Smith [Tue, 7 Apr 2020 02:17:55 +0000 (19:17 -0700)]
Fix template instantiation of a non-dependent call to an inherited
constructor with default arguments.

We used to try to rebuild the call as a call to the faked-up inherited
constructor, which is only a placeholder and lacks (for example) default
arguments. Instead, build the call by reference to the original
constructor.

In passing, add a note to say where a call that recursively uses a
default argument from within itself occurs. This is usually pretty
obvious, but still at least somewhat useful, and would have saved
significant debugging time for this particular bug.

4 years ago[PowerPC] Pre-commit test case of float rounding in kernel build. NFC.
Kai Luo [Tue, 7 Apr 2020 02:07:58 +0000 (02:07 +0000)]
[PowerPC] Pre-commit test case of float rounding in kernel build. NFC.

4 years agoEnable IBT(Indirect Branch Tracking) in JIT with CET(Control-flow Enforcement Technology)
Xiang1 Zhang [Tue, 7 Apr 2020 00:59:13 +0000 (08:59 +0800)]
Enable IBT(Indirect Branch Tracking) in JIT with CET(Control-flow Enforcement Technology)

Do not commit the llvm/test/ExecutionEngine/MCJIT/cet-code-model-lager.ll because it will
cause build bot fail(not suitable for window 32 target).

Summary:
This patch comes from H.J.'s https://github.com/hjl-tools/llvm-project/commit/2bd54ce7fa9e94fcd1118b948e14d1b6fc54dfd2

**This patch fix the failed llvm unit tests which running on CET machine. **(e.g. ExecutionEngine/MCJIT/MCJITTests)

The reason we enable IBT at "JIT compiled with CET" is mainly that:  the JIT don't know the its caller program is CET enable or not.
If JIT's caller program is non-CET, it is no problem JIT generate CET code or not.
But if JIT's caller program is CET enabled,  JIT must generate CET code or it will cause Control protection exceptions.

I have test the patch at llvm-unit-test and llvm-test-suite at CET machine. It passed.
and H.J. also test it at building and running VNCserver(Virtual Network Console), it works too.
(if not apply this patch, VNCserver will crash at CET machine.)

Reviewers: hjl.tools, craig.topper, LuoYuanke, annita.zhang, pengfei

Reviewed By: LuoYuanke

Subscribers: tstellar, efriedma, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Coroutines] Remove alignment check in shouldBeMustTail
Jun Ma [Fri, 3 Apr 2020 03:45:10 +0000 (11:45 +0800)]
[Coroutines] Remove alignment check in shouldBeMustTail

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

4 years ago[NFC] Modernize misc. uses of Align/MaybeAlign APIs.
Eli Friedman [Tue, 7 Apr 2020 00:29:25 +0000 (17:29 -0700)]
[NFC] Modernize misc. uses of Align/MaybeAlign APIs.

Use the current getAlign() APIs where it makes sense, and use Align
instead of MaybeAlign when we know the value is non-zero.

4 years agoReland "Make llvm_source_root in llvm-lit relative too."
Nico Weber [Tue, 7 Apr 2020 00:38:26 +0000 (20:38 -0400)]
Reland "Make llvm_source_root in llvm-lit relative too."

This reverts commit 3185881d69022e03b300e189838b0599ed417be5
and adds a missing "include(AddLLVM)" (similar lines already
exist elsewhere in compiler-rt).

4 years agoTarget: correct the return value for `GetImageAddrFromToken`
Saleem Abdulrasool [Tue, 7 Apr 2020 00:33:38 +0000 (17:33 -0700)]
Target: correct the return value for `GetImageAddrFromToken`

We would return `LLDB_INVALID_IMAGE_TOKEN` for the address rather than
the correct value of `LLDB_IMAGE_ADDRESS`.  This would result in the
check for the return value to silently pass on x64 as the invalid
address and invalid token are of different sizes (`size_t` vs
`uintprr_t`).  This corrects the return value to `LLDB_INVALID_ADDRESS`
and addresses the rest to reset the mapped address to the invalid value.

This was found by inspection when trying to implement module support for
Windows.

4 years agoAdd missing include
Adrian Prantl [Tue, 7 Apr 2020 00:28:53 +0000 (17:28 -0700)]
Add missing include

4 years agoRemove SequentialType from the type heirarchy.
Eli Friedman [Tue, 7 Apr 2020 00:03:49 +0000 (17:03 -0700)]
Remove SequentialType from the type heirarchy.

Now that we have scalable vectors, there's a distinction that isn't
getting captured in the original SequentialType: some vectors don't have
a known element count, so counting the number of elements doesn't make
sense.

In some cases, there's a better way to express the commonality using
other methods. If we're dealing with GEPs, there's GEP methods; if we're
dealing with a ConstantDataSequential, we can query its element type
directly.

In the relatively few remaining cases, I just decided to write out
the type checks. We're talking about relatively few places, and I think
the abstraction doesn't really carry its weight. (See thread "[RFC]
Refactor class hierarchy of VectorType in the IR" on llvmdev.)

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

4 years agoFor PR45333: Move AnalyzeImplicitConversions to using data recursion
Richard Smith [Mon, 6 Apr 2020 23:47:37 +0000 (16:47 -0700)]
For PR45333: Move AnalyzeImplicitConversions to using data recursion
instead of recursing on the stack.

This doesn't actually resolve PR45333, because we now hit stack overflow
somewhere else, but it does get us further. I've not found any way of
testing this that doesn't still crash elsewhere.

4 years ago[MachineCSE] Don't carry the wrong location when hoisting
Davide Italiano [Mon, 6 Apr 2020 23:35:30 +0000 (16:35 -0700)]
[MachineCSE] Don't carry the wrong location when hoisting

PR: 45425
<rdar://problem/61359768>

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

4 years ago[AMDGPU] Remove clutter from endcf test. NFC.
Stanislav Mekhanoshin [Mon, 6 Apr 2020 23:20:39 +0000 (16:20 -0700)]
[AMDGPU] Remove clutter from endcf test. NFC.

4 years agoAdd way to omit debug-location from MIR output
Daniel Sanders [Mon, 6 Apr 2020 17:57:21 +0000 (10:57 -0700)]
Add way to omit debug-location from MIR output

Summary:
In lieu of a proper pass that strips debug info, add a way
to omit debug-locations from the MIR output so that
instructions with MMO's continue to match CHECK's when
mir-debugify is used

Reviewers: aprantl, bogner, vsk

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[CallSite Removal] a CallBase is never an IndirectCall for isInlineAsm
Nick Desaulniers [Mon, 6 Apr 2020 23:14:40 +0000 (16:14 -0700)]
[CallSite Removal] a CallBase is never an IndirectCall for isInlineAsm

Summary:
Thanks to Bill Wendling (void) for the report and steps to reproduce.  It looks
like this was missed during r350508's cleanup of the CallSite split into
CallBase, CallInst, and CallBrInst.

This was exposed by running pgo on a callbr, which was creating a ptrtoint to
the inline asm thinking it was an indirect call. The relevant callchain looks
like:

    IndirectCallPromotionPlugin::run()
    -> PGOIndirectCallVisitor::findIndirectCalls()
      -> PGOIndirectCallVisitor::visitCallBase()
        -> CallBase::isIndirectCall()

Reviewers: void, chandlerc

Reviewed By: void

Subscribers: hiraditya, llvm-commits, craig.topper, srhines

Tags: #llvm

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

4 years ago[lldb/API] Add missing LLDB_REGISTER_METHOD macros
Jonas Devlieghere [Mon, 6 Apr 2020 23:09:09 +0000 (16:09 -0700)]
[lldb/API] Add missing LLDB_REGISTER_METHOD macros

Add LLDB_REGISTER_METHOD macros for GetRetriesWithFixIts and
SetRetriesWithFixIts.

4 years agoRemove case in rewritergen unmatched opdefgen side
Jacques Pienaar [Mon, 6 Apr 2020 22:55:25 +0000 (15:55 -0700)]
Remove case in rewritergen unmatched opdefgen side

The rewriter generates a call to build that is not handled by opdef generator
and so will fail to compile. Also if this is a root node being replaced
(depth 0) then using the more generic build method in the rewrite suffices.

4 years ago[AddressSanitizer] Fix for wrong argument values appearing in backtraces
Vedant Kumar [Tue, 31 Mar 2020 22:27:06 +0000 (15:27 -0700)]
[AddressSanitizer] Fix for wrong argument values appearing in backtraces

Summary:
In some cases, ASan may insert instrumentation before function arguments
have been stored into their allocas. This causes two issues:

1) The argument value must be spilled until it can be stored into the
   reserved alloca, wasting a stack slot.

2) Until the store occurs in a later basic block, the debug location
   will point to the wrong frame offset, and backtraces will show an
   uninitialized value.

The proposed solution is to move instructions which initialize allocas
for arguments up into the entry block, before the position where ASan
starts inserting its instrumentation.

For the motivating test case, before the patch we see:

```
 | 0033: movq %rdi, 0x68(%rbx)  |   | DW_TAG_formal_parameter     |
 | ...                          |   |   DW_AT_name ("a")          |
 | 00d1: movq 0x68(%rbx), %rsi  |   |   DW_AT_location (RBX+0x90) |
 | 00d5: movq %rsi, 0x90(%rbx)  |   |       ^ not correct ...     |
```

and after the patch we see:

```
 | 002f: movq %rdi, 0x70(%rbx)  |   | DW_TAG_formal_parameter     |
 |                              |   |   DW_AT_name ("a")          |
 |                              |   |   DW_AT_location (RBX+0x70) |
```

rdar://61122691

Reviewers: aprantl, eugenis

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agofix comment typo to cycle bots
Nico Weber [Mon, 6 Apr 2020 22:58:16 +0000 (18:58 -0400)]
fix comment typo to cycle bots

4 years agoRemap the target (Xcode) SDK directory to the host SDK directory.
Adrian Prantl [Fri, 20 Mar 2020 01:51:36 +0000 (18:51 -0700)]
Remap the target (Xcode) SDK directory to the host SDK directory.

This is mostly useful for Swift support; it allows LLDB to substitute
a matching SDK it shipped with instead of the sysroot path that was
used at compile time.

The goal of this is to make the Xcode SDK something that behaves more
like the compiler's resource directory, as in that it ships with LLDB
rather than with the debugged program. This important primarily for
importing Swift and Clang modules in the expression evaluator, and
getting at the APINotes from the SDK in Swift.

For a cross-debugging scenario, this means you have to have an SDK for
your target installed alongside LLDB. In Xcode this will always be the
case.

rdar://problem/60640017

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

4 years ago[libc++] 2/N: Enable the new libc++ testing format by default
Louis Dionne [Mon, 6 Apr 2020 22:30:19 +0000 (18:30 -0400)]
[libc++] 2/N: Enable the new libc++ testing format by default

Both test formats are equivalent, so this *should* not be a problem.
We've fixed a couple of failures uncovered by the first time we tried
making the switch, so this new attempt should go even farther.

If failures are noticed, it should be fine to revert this commit, but
please give a heads up afterwards so we know to address the issues!

Also note that it is still possible to use the old format by passing
`--param=use_old_format=True` when running Lit for the time being.

4 years agoSupport bfdname "elf32-hexagon".
Sid Manning [Mon, 6 Apr 2020 17:40:19 +0000 (12:40 -0500)]
Support bfdname "elf32-hexagon".

Add support and update testcases.

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

4 years agoAllow MachineFunction to obtain non-const Function (to enable MIR-level debugify)
Daniel Sanders [Fri, 3 Apr 2020 22:55:15 +0000 (15:55 -0700)]
Allow MachineFunction to obtain non-const Function (to enable MIR-level debugify)

Summary:
To debugify MIR, we need to be able to create metadata and to do that, we
need a non-const Module. However, MachineFunction only had a const reference
to the Function preventing this.

Reviewers: aprantl, bogner

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[libc++] Only support std::to_chars availability test when back-deploying
Louis Dionne [Mon, 6 Apr 2020 22:09:34 +0000 (18:09 -0400)]
[libc++] Only support std::to_chars availability test when back-deploying

4 years ago[libc++] Add availability markup for the C++20 Synchronization Library on Apple
Louis Dionne [Mon, 24 Feb 2020 15:09:29 +0000 (10:09 -0500)]
[libc++] Add availability markup for the C++20 Synchronization Library on Apple

4 years agoAdd option to limit Debugify to locations (omitting variables)
Daniel Sanders [Fri, 3 Apr 2020 22:50:11 +0000 (15:50 -0700)]
Add option to limit Debugify to locations (omitting variables)

Summary:
It can be helpful to test behaviour w.r.t locations without having DEBUG_VALUE
around. In particular, because DEBUG_VALUE has the potential to change CodeGen
behaviour (e.g. hasOneUse() vs hasOneNonDbgUse()) while locations generally
don't.

Reviewers: aprantl, bogner

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[gdb-remote] Moving prevents copy elision. Found by clang.
Davide Italiano [Mon, 6 Apr 2020 21:59:01 +0000 (14:59 -0700)]
[gdb-remote] Moving prevents copy elision. Found by clang.

4 years agoRevert "Make llvm_source_root in llvm-lit relative too."
Hubert Tong [Mon, 6 Apr 2020 21:29:10 +0000 (17:29 -0400)]
Revert "Make llvm_source_root in llvm-lit relative too."

This reverts commit 6c1a9fb174ac3cf66bfdbab5a327957a0a35ad85.

Commit causes failures:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/49206

4 years ago[lldb/Test] Enable TestGdbRemoteThreadsInfoMemory.py on Windows.
Jonas Devlieghere [Mon, 6 Apr 2020 21:28:27 +0000 (14:28 -0700)]
[lldb/Test] Enable TestGdbRemoteThreadsInfoMemory.py on Windows.

This test is currently XFAILed but is passing on the Windows bot.

4 years agoX86ISelLowering: Minor refactor to avoid redundant initialization while ensuring...
David Blaikie [Mon, 6 Apr 2020 21:24:31 +0000 (14:24 -0700)]
X86ISelLowering: Minor refactor to avoid redundant initialization while ensuring compiler warnings can hopefully still prove initialization

Based on post-commit review/discussion in fabe52a7412b

4 years ago[clang-format] Don't break multi block parameters on ObjCBreakBeforeNestedBlockParam
Kanglei Fang [Mon, 6 Apr 2020 19:45:38 +0000 (12:45 -0700)]
[clang-format] Don't break multi block parameters on ObjCBreakBeforeNestedBlockParam

Summary:
While [the original diff](https://reviews.llvm.org/D42493) makes a lot of sense, and multiple inline block parameter/trailing paramemter after inline block paramemter should be discouraged, the formatting result is different than what xcode does by default
For the exact same example provided in the original diff:
```
[object
  blockArgument:^{
    a = 42;
  }
     anotherArg:42];
```
The code is hard to read and not very visually pleasing

This diff uses `ObjCBreakBeforeNestedBlockParam` to shield from the formatting
When it's set to false, don't allign the inline block paramemters.

Reviewers: jolesiak, benhamilton, jinlin

Reviewed By: jolesiak

Subscribers: cfe-commits

Tags: #clang

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

4 years agoAdd more detailed symbol type categorization, based on a swift patch by
Jason Molenda [Fri, 3 Apr 2020 05:10:00 +0000 (22:10 -0700)]
Add more detailed symbol type categorization, based on a swift patch by
Greg Clayton a few years ago.

My patch to augment the symbol table in Mach-O files with the
dyld trie exports data structure only categorized symbols as code
or data, but Greg Clayton had a patch to do something similar to
swift a few years ago that had a more extensive categorization of
symbols, as well as extracting some objc class/ivar names from the
entries. This patch is basically just Greg's, updated a bit and
with a test case added to it.

<rdar://problem/50791451>

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

4 years ago[AMDGPU] Disable 'Skip Uniform Regions' optimization by default for AMDGPU.
Konstantin Pyzhov [Mon, 6 Apr 2020 13:05:58 +0000 (09:05 -0400)]
[AMDGPU] Disable 'Skip Uniform Regions' optimization by default for AMDGPU.

Reviewers: sameerds, dstuttard

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

4 years ago[llvm-objdump][NFC] Declare command-line externs in headers with namespace
Hubert Tong [Mon, 6 Apr 2020 20:56:13 +0000 (16:56 -0400)]
[llvm-objdump][NFC] Declare command-line externs in headers with namespace

Summary:
This patch moves the forward declarations of command-line `cl::*`
externs in `MachODump.cpp` and `llvm-objdump.cpp` into the headers
corresponding to the file that defines the variable. At the same time,
these externs are moved into the `llvm::objdump` namespace. The externs
that are not referenced outside their defining translation unit are made
static.

This does not factor out uses of the Mach-O options from
`llvm-objdump.cpp`.

Reviewers: jhenderson, MaskRay, DiggerLin, jasonliu, daltenty

Reviewed By: jhenderson, MaskRay

Subscribers: rupprecht, llvm-commits

Tags: #llvm

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

4 years ago[gn build] (manually) port 6c1a9fb174ac3c
Nico Weber [Mon, 6 Apr 2020 20:50:02 +0000 (16:50 -0400)]
[gn build] (manually) port 6c1a9fb174ac3c

4 years ago[AsmPrinter] Do not define local aliases for global objects in a comdat
Leonard Chan [Fri, 3 Apr 2020 20:29:14 +0000 (13:29 -0700)]
[AsmPrinter] Do not define local aliases for global objects in a comdat

A global symbol that is defined in a comdat should not generate an alias since
call sites that would've referred to that symbol will refer to their own
independent local aliases rather than the surviving global comdat one. This
could result in something that looks like:

```
ld.lld: error: relocation refers to a discarded section: .text._ZN3fbl8internal18NullFunctionTargetIvJjjPjEED1Ev.stub
>>> defined in user-x64-clang/obj/system/ulib/minfs/libminfs.a(minfs._sources.file.cc.o)
>>> section group signature: _ZN3fbl8internal18NullFunctionTargetIvJjjPjEED1Ev.stub
>>> prevailing definition is in user-x64-clang/obj/system/ulib/minfs/libminfs.a(minfs._sources.vnode.cc.o)
>>> referenced by function.h:169 (../../zircon/system/ulib/fbl/include/fbl/function.h:169)
>>>               minfs._sources.file.cc.o:(minfs::File::AllocateAndCommitData(std::__2::unique_ptr<minfs::Transaction, std::__2::default_delete<minfs::Transaction> >)) in archive user-x64-clang/obj/system/ulib/minfs/libminfs.a
```

We ran into this when experimenting with a new C++ ABI for fuchsia
(refer to D72959) which takes relative offsets between comdat'd functions
which is why the normal C++ user wouldn't run into this.

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

4 years agoMake llvm_source_root in llvm-lit relative too.
Nico Weber [Mon, 6 Apr 2020 20:46:24 +0000 (16:46 -0400)]
Make llvm_source_root in llvm-lit relative too.

No intended behavior change.

4 years ago[SelectionDAG] fix predecessor list for INLINEASM_BRs' parent
Nick Desaulniers [Mon, 6 Apr 2020 20:34:06 +0000 (13:34 -0700)]
[SelectionDAG] fix predecessor list for INLINEASM_BRs' parent

Summary:
A bug report mentioned that LLVM was producing jumps off the end of a
function when using "asm goto with outputs". Further digging pointed to
MachineBasicBlocks that had their address taken and were indirect
targets of INLINEASM_BR being removed by BranchFolder, because their
 predecessor list was empty, so they appeared to have no entry.

This was a cascading failure caused earlier, during Pre-RA instruction
scheduling. We have a few special cases in Pre-RA instruction scheduling
where we split a MachineBasicBlock in two.  This requires careful
handing of predecessor and successor lists for a MachineBasicBlock that
was split, and careful handing of PHI MachineInstrs that referred to the
MachineBasicBlock before it was split.

The clue that led to this fix was the observation that many callers of
MachineBasicBlock::splice() frequently call
MachineBasicBlock::transferSuccessorsAndUpdatePHIs() to update their PHI
nodes after a splice. We don't want to reuse that method, as we have
custom successor transferring logic for this block split.

This patch fixes 2 pre-existing bugs, and adds tests.

The first bug was that MachineBasicBlock::splice() correctly handles
updating most successors and predecessors; we don't need to do anything
more than removing the previous fallthrough block from the first half of
the split block post splice. Previously, we were updating the successor
list incorrectly (updating successors updates predecessors).

The second bug was that PHI nodes that needed registers from the first
half of the split block were not having entries populated.  The register
live out information was correct, and the FuncInfo->PHINodesToUpdate was
correct. Specifically, the check in SelectionDAGISel::FinishBasicBlock:

    for (unsigned i = 0, e = FuncInfo->PHINodesToUpdate.size(); i != e; ++i) {
      MachineInstrBuilder PHI(*MF, FuncInfo->PHINodesToUpdate[i].first);
      if (!FuncInfo->MBB->isSuccessor(PHI->getParent()))
        continue;
      PHI.addReg(FuncInfo->PHINodesToUpdate[i].second).addMBB(FuncInfo->MBB);

was `continue`ing because FuncInfo->MBB tracks the second half of
the post-split block; no one was updating PHI entries for the first half
of the post-split block.

SelectionDAGBuilder::UpdateSplitBlock() already expects to perform
special handling for MachineBasicBlocks that were split post calls to
ScheduleDAGSDNodes::EmitSchedule(), so I'm confident that it's both
correct for ScheduleDAGSDNodes::EmitSchedule() to return the second half
of the split block `CopyBB` which updates `FuncInfo->MBB` (ie. the
current MachineBasicBlock being processed), and perform special handling
for this in SelectionDAGBuilder::UpdateSplitBlock().

Reviewers: void, craig.topper, efriedma

Reviewed By: void, efriedma

Subscribers: hfinkel, fhahn, MatzeB, efriedma, hiraditya, llvm-commits, srhines

Tags: #llvm

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

4 years agoUpstream Bionic definitions of ctype_base/regex.
Dan Albert [Mon, 6 Apr 2020 20:34:27 +0000 (13:34 -0700)]
Upstream Bionic definitions of ctype_base/regex.

Summary:
This is a patch that Android has been carrying in its tree for several
years. This patch upstreams the existing ABI.

There's some historical cruft here. __regex_word used to be a part of
regex_traits rather than ctype_base. Bionic also used to use its own
ctype implementation because the libc++ builtin one wasn't available
yet. Bionic's ctype masks were 8 bits wide and already saturated, so a
wider type needed to be used for the regex mask, and the existing
value was already used so Android needed to specify its own.

Since then Android has migrated to the builtin ctype implementation
and this patch probably should have been dropped then. Unfortunately
that was not noticed at the time, so now we need to keep this to
maintain the current ABI.

Reviewers: EricWF, #libc, ldionne

Reviewed By: #libc, ldionne

Subscribers: dexonsmith, ldionne, libcxx-commits

Tags: #libc

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

4 years ago[debugserver] Get rid of `else` after `return`. NFC.
Davide Italiano [Thu, 2 Apr 2020 20:22:52 +0000 (13:22 -0700)]
[debugserver] Get rid of `else` after `return`. NFC.

4 years ago[libunwind] Support the new libc++ test format
Sergej Jaskiewicz [Mon, 6 Apr 2020 20:26:37 +0000 (23:26 +0300)]
[libunwind] Support the new libc++ test format

Reviewers: ldionne, #libunwind, mstorsjo

Reviewed By: ldionne, #libunwind, mstorsjo

Subscribers: mstorsjo, dexonsmith, llvm-commits, libcxx-commits

Tags: #llvm, #libunwind

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

4 years agoMinor typo improvements in documentation, NFC.
Chris Lattner [Mon, 6 Apr 2020 20:18:49 +0000 (13:18 -0700)]
Minor typo improvements in documentation, NFC.

4 years agoAMDGPU: Remove dead paths for requiresUniformRegister
Matt Arsenault [Thu, 6 Feb 2020 17:02:51 +0000 (12:02 -0500)]
AMDGPU: Remove dead paths for requiresUniformRegister

The extracts from control flow intrinsics are already properly handled
by divergence analysis. The inline asm case isn't dead, but has also
never really worked correctly so leave it as-is for now.