platform/upstream/llvm.git
5 years ago[ELF] Fix ARM and Thumb V7PILongThunk overflow behavior.
Peter Smith [Thu, 10 Jan 2019 16:08:23 +0000 (16:08 +0000)]
[ELF] Fix ARM and Thumb V7PILongThunk overflow behavior.

When the range between the source and target of a V7PILongThunk exceeded an
int32 we would trigger a relocation out of range error for the
R_ARM_MOVT_PREL or R_ARM_THM_MOVT_PREL relocation. This case can happen when
linking the linux kernel as it is loaded above 0xf0000000.

There are two parts to the fix.
- Remove the overflow check for R_ARM_MOVT_PREL or R_ARM_THM_MOVT_PREL. The
ELF for the ARM Architecture document defines these relocations as having no
overflow checking so the check was spurious.
- Use int64_t for the offset calculation, in line with similar thunks so
that PC + (S - P) < 32-bits. This results in less surprising disassembly.

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

llvm-svn: 350836

5 years ago[opaque pointer types] Remove some calls to generic Type subtype accessors.
James Y Knight [Thu, 10 Jan 2019 16:07:20 +0000 (16:07 +0000)]
[opaque pointer types] Remove some calls to generic Type subtype accessors.

That is, remove many of the calls to Type::getNumContainedTypes(),
Type::subtypes(), and Type::getContainedType(N).

I'm not intending to remove these accessors -- they are
useful/necessary in some cases. However, removing the pointee type
from pointers would potentially break some uses, and reducing the
number of calls makes it easier to audit.

llvm-svn: 350835

5 years agoFix compilation error on 32-bit architectures introduced in r350511
Pavel Labath [Thu, 10 Jan 2019 15:53:20 +0000 (15:53 +0000)]
Fix compilation error on 32-bit architectures introduced in r350511

The issue was a narrowing conversion when converting from uint64_t to a
size_t.

llvm-svn: 350834

5 years ago[LLD][ELF] - A follow up for r350819 ("Support MSP430") : add a test case missing.
George Rimar [Thu, 10 Jan 2019 15:34:33 +0000 (15:34 +0000)]
[LLD][ELF] - A follow up for r350819 ("Support MSP430") : add a test case missing.

It got lost for some reason.

llvm-svn: 350833

5 years ago[llvm-symbolizer] Add -p as alias to -pretty-print
Dmitry Venikov [Thu, 10 Jan 2019 15:33:35 +0000 (15:33 +0000)]
[llvm-symbolizer] Add -p as alias to -pretty-print

Summary: Provides -p as a short alias for -pretty-print. Motivation: https://bugs.llvm.org/show_bug.cgi?id=40076

Reviewers: samsonov, khemant, ruiu, rnk, fjricci, jhenderson

Reviewed By: jhenderson

Subscribers: llvm-commits

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

llvm-svn: 350832

5 years ago[RISCV][MC] Add support for evaluating constant symbols as immediates
Alex Bradbury [Thu, 10 Jan 2019 15:33:17 +0000 (15:33 +0000)]
[RISCV][MC] Add support for evaluating constant symbols as immediates

This further improves compatibility with GNU as, allowing input such as the
following to be assembled:

.equ CONST, 0x123456
li a0, CONST
addi a0, a0, %lo(CONST)

.equ CONST, 1
slli a0, a0, CONST

Note that we don't have perfect compatibility with gas, as it will avoid
emitting a relocation in this case:

addi a0, a0, %lo(CONST2)
.equ CONST2, 0x123456

Thanks to Shiva Chen for suggesting a better way to approach this during review.

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

llvm-svn: 350831

5 years ago[x86] fix remaining miscompile bug in horizontal binop matching (PR40243)
Sanjay Patel [Thu, 10 Jan 2019 15:27:23 +0000 (15:27 +0000)]
[x86] fix remaining miscompile bug in horizontal binop matching (PR40243)

When we use the partial-matching function on a 128-bit chunk, we must
account for the possibility that we've matched undef halves of the
original source vectors, so the outputs may need to be reset.

This should allow closing PR40243:
https://bugs.llvm.org/show_bug.cgi?id=40243

llvm-svn: 350830

5 years agogn build: Merge r350819
Nico Weber [Thu, 10 Jan 2019 15:16:32 +0000 (15:16 +0000)]
gn build: Merge r350819

llvm-svn: 350829

5 years agoModify InputSectionBase::getLocation to add section and offset to every loc.
Sean Fertile [Thu, 10 Jan 2019 15:08:06 +0000 (15:08 +0000)]
Modify InputSectionBase::getLocation to add section and offset to every loc.

The section and offset can be very helpful in diagnosing certian errors.
For example on a relocation overflow or misalignment diagnostic:

test.c:(function  foo): relocation R_PPC64_ADDR16_DS out of range: ...

The function foo can have many R_PPC64_ADDR16_DS relocations. Adding the offset
and section will identify exactly which relocation is causing the failure.

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

llvm-svn: 350828

5 years ago[PPC64] Fix RelType in checkInt and checkAlignment diagnsotics.
Sean Fertile [Thu, 10 Jan 2019 15:08:02 +0000 (15:08 +0000)]
[PPC64] Fix RelType in checkInt and checkAlignment diagnsotics.

In the PPC64 target we map toc-relative relocations, dynamic thread pointer
relative relocations, and got relocations into a corresponding ADDR16 relocation
type for handling in relocateOne. This patch saves the orignal RelType before
mapping to an ADDR16 relocation so that any diagnostic messages will not
mistakenly use the mapped type.

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

llvm-svn: 350827

5 years ago[x86] fix horizontal binop matching for 256-bit vectors (PR40243)
Sanjay Patel [Thu, 10 Jan 2019 15:04:52 +0000 (15:04 +0000)]
[x86] fix horizontal binop matching for 256-bit vectors (PR40243)

This is a partial fix for:
https://bugs.llvm.org/show_bug.cgi?id=40243
...as seen in the integer test, we still need to correct the result when using the
existing (old) horizontal op matching function because it does not model the way
x86 256-bit horizontal ops return results (each 128-bit half is its own horizontal-op).
A potential follow-up change for that is discussed in the bug report - see also D56490.

This generally duplicates a lot of the existing matching code, but we can't just remove
that without introducing regressions, so the existing code is renamed and used less often.
Follow-ups may try to reduce that overlap.

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

llvm-svn: 350826

5 years ago[AArch64] Fix operation actions for FP16 vector intrinsics
Bryan Chan [Thu, 10 Jan 2019 15:02:37 +0000 (15:02 +0000)]
[AArch64] Fix operation actions for FP16 vector intrinsics

Summary:
This patch changes the legalization action for some half-precision floating-
point vector intrinsics (FSIN, FLOG, etc.) from Promote to Expand. These ops
are not supported in hardware for half-precision vectors, but promotion is
not always possible (for v8f16 operands). Changing the action to Expand fixes
an assertion failure in the legalizer when the frontend produces such ops.
In addition, a quick microbenchmark shows that, in the v4f16 case,
expanding introduces fewer spills and is therefore slightly faster than
promoting.

Reviewers: t.p.northover, SjoerdMeijer

Reviewed By: SjoerdMeijer

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

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

llvm-svn: 350825

5 years ago[LLD][ELF] - Fix the test cases after r350823.
George Rimar [Thu, 10 Jan 2019 14:57:25 +0000 (14:57 +0000)]
[LLD][ELF] - Fix the test cases after r350823.

r350823 changed the output of the llvm-objdump.

llvm-svn: 350824

5 years ago[llvm-objdump] - Implement -z/--disassemble-zeroes.
George Rimar [Thu, 10 Jan 2019 14:55:26 +0000 (14:55 +0000)]
[llvm-objdump] - Implement -z/--disassemble-zeroes.

This is https://bugs.llvm.org/show_bug.cgi?id=37151,

GNU objdump spec says that "Normally the disassembly output will skip blocks of zeroes.",
but currently, llvm-objdump prints them.

The patch implements the -z/--disassemble-zeroes option and switches the default to always
skip blocks of zeroes.

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

llvm-svn: 350823

5 years ago[X86] Add SSE41 vector abs tests
Simon Pilgrim [Thu, 10 Jan 2019 14:26:15 +0000 (14:26 +0000)]
[X86] Add SSE41 vector abs tests

llvm-svn: 350822

5 years ago[llvm-symbolizer] Add support for specifying addresses on command-line
James Henderson [Thu, 10 Jan 2019 14:10:02 +0000 (14:10 +0000)]
[llvm-symbolizer] Add support for specifying addresses on command-line

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

GNU addr2line accepts input addresses both on the command-line and via
stdin. llvm-symbolizer previously only supported the latter. This
change adds support for the former. As with addr2line, the new
behaviour is to only look for addresses on stdin if no positional
arguments were provided to llvm-symbolizer.

Reviewed by: ruiu

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

llvm-svn: 350821

5 years ago[MCA] Fix wrong definition of ResourceUnitMask in DefaultResourceStrategy.
Andrea Di Biagio [Thu, 10 Jan 2019 13:59:13 +0000 (13:59 +0000)]
[MCA] Fix wrong definition of ResourceUnitMask in DefaultResourceStrategy.

Field ResourceUnitMask was incorrectly defined as a 'const unsigned' mask. It
should have been a 64 bit quantity instead. That means, ResourceUnitMask was
always implicitly truncated to a 32 bit quantity.
This issue has been found by inspection. Surprisingly, that bug was latent, and
it never negatively affected any existing upstream targets.

This patch fixes  the wrong definition of ResourceUnitMask, and adds a bunch of
extra debug prints to help debugging potential issues related to invalid
processor resource masks.

llvm-svn: 350820

5 years ago[LLD][ELF] - Support MSP430.
George Rimar [Thu, 10 Jan 2019 13:43:06 +0000 (13:43 +0000)]
[LLD][ELF] - Support MSP430.

Patch by Michael Skvortsov!

This change adds a basic support for linking static MSP430 ELF code.
Implemented relocation types are intended to correspond to the BFD.

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

llvm-svn: 350819

5 years ago[compiler-rt][builtins][PowerPC] Implemented __floattitf builtin on PowerPC
Amy Kwan [Thu, 10 Jan 2019 13:23:33 +0000 (13:23 +0000)]
[compiler-rt][builtins][PowerPC] Implemented __floattitf builtin on PowerPC

This patch implements the long double __floattitf (int128_t) method for
PowerPC -- specifically to convert a 128 bit integer into a long double
(IBM double-double).

To invoke this method, one can do so by linking against compiler-rt, via the
--rtlib=compiler-rt command line option supplied to clang.

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

llvm-svn: 350818

5 years agoCorrect the spelling of helpURI to helpUri.
Aaron Ballman [Thu, 10 Jan 2019 13:19:48 +0000 (13:19 +0000)]
Correct the spelling of helpURI to helpUri.

JSON is case sensitive and the SARIF spec uses the corrected spelling.

llvm-svn: 350817

5 years ago[compiler-rt][builtins][PowerPC] Implemented __fixunstfti builtin on PowerPC
Amy Kwan [Thu, 10 Jan 2019 12:30:12 +0000 (12:30 +0000)]
[compiler-rt][builtins][PowerPC] Implemented __fixunstfti builtin on PowerPC

This patch implements the __uint128_t __fixunstfti (long double) method for
PowerPC -- specifically to convert a long double (IBM double-double) to an
unsigned 128 bit integer.

The general approach of this algorithm is to convert the high and low doubles
of the long double and add them together if the doubles fit within 64 bits.
However, additional adjustments and scaling is performed when the high or low
double does not fit within a 64 bit integer.

To invoke this method, one can do so by linking against compiler-rt, via the
--rtlib=compiler-rt command line option supplied to clang.

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

llvm-svn: 350815

5 years ago[clang-tidy] Fix case of local variables in modernize-use-nodiscard checker
Jonas Toth [Thu, 10 Jan 2019 11:56:44 +0000 (11:56 +0000)]
[clang-tidy] Fix case of local variables in modernize-use-nodiscard checker

Summary:
Correct the case of the local variables..

Rational:
I want to be able to run clang-tidy on new clang-tidy checker code prior to creating a review (to demonstrate we should dog food our own tools during development, not my suggestion but @Eugene.Zelenko)

To this end I am running the following in a script, prior to make a change.

```
tidy:
    @for source in $$(git status -suno | grep ".cpp$$" | cut -c4-) ;\
    do \
        clang-tidy -quiet  $$source -- $(TIDY_FLAGS);\
    done

```

I then want to go through the checkers and see which checkers most closely match the review style of the reviewers

```
---
Checks:          '
-clang-diagnostic-*,
readability-identifier-naming,
llvm-header-guard
'
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle:     LLVM
CheckOptions:
  - key:             readability-identifier-naming.IgnoreFailedSplit
    value:           '0'
  - key:             readability-identifier-naming.VariableCase
    value:           'CamelCase'
  - key:             readability-identifier-naming.LocalVariableCase
    value:           'CamelCase'
...

```

Unfortunately in doing so, I have identified that my previous review {D55433} it violates what looks like to be the convention of local variables being in CamelCase.

Sending this small review in the hope it can be corrected.

Patch by MyDeveloperDay.

Reviewers: JonasToth, Eugene.Zelenko

Reviewed By: JonasToth

Subscribers: xazax.hun, Eugene.Zelenko

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

llvm-svn: 350814

5 years ago[pstl] Fix compile errors when PARALLEL_POLICIES is disabled
Louis Dionne [Thu, 10 Jan 2019 11:23:33 +0000 (11:23 +0000)]
[pstl] Fix compile errors when PARALLEL_POLICIES is disabled

Reviewed as https://reviews.llvm.org/D56139.
Thanks to @jerryct for the patch.

llvm-svn: 350813

5 years ago[pstl] Fix CMake configuration when parallel policies are disabled
Louis Dionne [Thu, 10 Jan 2019 11:17:26 +0000 (11:17 +0000)]
[pstl] Fix CMake configuration when parallel policies are disabled

llvm-svn: 350812

5 years ago[ARM] Fix for verifier buildbot
Sam Parker [Thu, 10 Jan 2019 10:47:23 +0000 (10:47 +0000)]
[ARM] Fix for verifier buildbot

Copy the MachineOperand first and then change the flags instead of
making a copy.

llvm-svn: 350811

5 years agoRevert "Add a verbose mode to "image dump line-table" and use it to write a .debug_li...
Pavel Labath [Thu, 10 Jan 2019 10:23:27 +0000 (10:23 +0000)]
Revert "Add a verbose mode to "image dump line-table" and use it to write a .debug_line test"

This reverts commit r350802 because the test fails on windows. This
happens because we treat the paths as windows paths even though they
have linux path separators in the asm file. That results in wrong paths
being computed (\tmp\tmp\a.c instead of /tmp/a.c).

Reverting until I can figure out what to do with this.

llvm-svn: 350810

5 years agoPECOFF: Fix section name computation
Pavel Labath [Thu, 10 Jan 2019 10:23:19 +0000 (10:23 +0000)]
PECOFF: Fix section name computation

If a section name is exactly 8 bytes long (or has been truncated to 8
bytes), it will not contain the terminating nul character. This means
reading the name as a c string will pick up random data following the
name field (which happens to be the section vm size).

This fixes the name computation to avoid out-of-bounds access and adds a
test.

Reviewers: zturner, stella.stamenova

Subscribers: lldb-commits

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

llvm-svn: 350809

5 years ago[LoopUnroll] add parsing for unroll parameters in -passes pipeline
Fedor Sergeev [Thu, 10 Jan 2019 10:01:53 +0000 (10:01 +0000)]
[LoopUnroll] add parsing for unroll parameters in -passes pipeline

Allow to specify loop-unrolling with optional parameters explicitly
spelled out in -passes pipeline specification.
Introducing somewhat generic way of specifying parameters parsing via
FUNCTION_PASS_PARAMETRIZED pass registration.

Syntax of parametrized unroll pass name is as follows:
   'unroll<' parameter-list '>'

Where parameter-list is ';'-separate list of parameter names and optlevel
   optlevel: 'O[0-3]'
   parameter: { 'partial' | 'peeling' | 'runtime' | 'upperbound' }
   negated:  'no-' parameter

Example:
   -passes=loop(unroll<O3;runtime;no-upperbound>)

    this invokes LoopUnrollPass configured with OptLevel=3,
    Runtime, no UpperBound, everything else by default.

llvm-svn: 350808

5 years agoFix RUN line in test/Transforms/LoopDeletion/crashbc.ll
Bjorn Pettersson [Thu, 10 Jan 2019 09:58:23 +0000 (09:58 +0000)]
Fix RUN line in test/Transforms/LoopDeletion/crashbc.ll

llvm-svn: 350807

5 years ago[asan] Mark tests as UNSUPPORTED on arm
Diana Picus [Thu, 10 Jan 2019 09:40:56 +0000 (09:40 +0000)]
[asan] Mark tests as UNSUPPORTED on arm

Temporarily mark a couple of tests as UNSUPPORTED until we figure out
why they fail on the thumb bots.

The failure was introduced in
r350139 - Add support for background thread on NetBSD in ASan.

llvm-svn: 350806

5 years ago[libclang] Fix clang_Cursor_isAnonymous
Ivan Donchevskii [Thu, 10 Jan 2019 09:34:44 +0000 (09:34 +0000)]
[libclang] Fix clang_Cursor_isAnonymous

Use the same logic as in TypePrinter::printTag to determine that the tag is anonymous and the separate check for namespaces.

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

llvm-svn: 350805

5 years agoImplement ObjectFileELF::GetBaseAddress
Pavel Labath [Thu, 10 Jan 2019 09:32:31 +0000 (09:32 +0000)]
Implement ObjectFileELF::GetBaseAddress

Summary:
The concept of a base address was already present in the implementation
(it's needed for computing section load addresses properly), but it was
never exposed through this function. This fixes that.

llvm-svn: 350804

5 years ago[clangd] Don't store completion info if the symbol is not used for code completion.
Haojian Wu [Thu, 10 Jan 2019 09:22:40 +0000 (09:22 +0000)]
[clangd] Don't store completion info if the symbol is not used for code completion.

Summary:
This would save us some memory and disk space:
  - Dex usage (261 MB vs 266 MB)
  - Disk (75 MB vs 76 MB)

It would save more when we index the main file symbol D55185.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: nridge, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 350803

5 years agoAdd a verbose mode to "image dump line-table" and use it to write a .debug_line test
Pavel Labath [Thu, 10 Jan 2019 09:16:00 +0000 (09:16 +0000)]
Add a verbose mode to "image dump line-table" and use it to write a .debug_line test

Summary:
The motivation for this is being able to write tests for the upcoming
breakpad line table parser, but this could be useful for testing the
low-level workings of any line table format. Or simply for viewing the
line table information with more detail (the brief format doesn't
include any of the flags for end_of_prologue and similar).

I've also removed the load_addresses argument from the
DumpCompileUnitLineTable function, as it wasn't being used anywhere.

Reviewers: clayborg, zturner

Subscribers: JDevlieghere, lldb-commits

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

llvm-svn: 350802

5 years ago[ARM] Size reduce teq to eors
Sam Parker [Thu, 10 Jan 2019 08:36:33 +0000 (08:36 +0000)]
[ARM] Size reduce teq to eors

Add t2TEQrr to the map of instructions with can be reduced down into
a T1 instruction. This is a special case because TEQ just sets the
CPSR and doesn't write to a GPR, which is not the case for EOR. So,
we need to ensure that the EOR can write to the first operand.

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

llvm-svn: 350801

5 years ago[X86] Disable DomainReassignment pass when AVX512BW is disabled to avoid injecting...
Craig Topper [Thu, 10 Jan 2019 07:43:54 +0000 (07:43 +0000)]
[X86] Disable DomainReassignment pass when AVX512BW is disabled to avoid injecting VK32/VK64 references into the MachineIR

Summary:
This pass replaces GR8/GR16/GR32/GR64 with their equivalent sized mask register classes. But VK32/VK64 aren't legal without AVX512BW. Apparently this mostly appears to work if the register coalescer is able to remove the VK32/VK64 register class reference. Or if we don't ever spill it. But there's no guarantee of that.

Another Intel employee managed to trigger a crash due to this with ISPC. Unfortunately, I've lost the test case he sent me at the time. I'm trying to get him to reproduce it for me. I'd like to get this in before 8.0 branches since its a little scary.

The regressions here are unfortunate, but I think we can make some improvements to DAG combine, load folding, etc. to fix them. Just not sure if we can get that done for 8.0.

Fixes PR39741

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 350800

5 years agoRecommit "[PowerPC] Fix assert from machine verify pass that unmatched register class...
Zi Xuan Wu [Thu, 10 Jan 2019 06:20:14 +0000 (06:20 +0000)]
Recommit "[PowerPC] Fix assert from machine verify pass that unmatched register class about fcmp selection in fast-isel"

This re-commit r350685.

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

llvm-svn: 350799

5 years ago[AArch64] Emit the correct MCExpr relocations specifiers like VK_ABS_G0, etc
Mandeep Singh Grang [Thu, 10 Jan 2019 04:59:44 +0000 (04:59 +0000)]
[AArch64] Emit the correct MCExpr relocations specifiers like VK_ABS_G0, etc

Summary:
D55896 and D56029 add support to emit fixups for :abs_g0: , :abs_g1_s: , etc.
This patch adds the necessary enums and MCExpr needed for lowering these.

Reviewers: rnk, mstorsjo, efriedma

Reviewed By: efriedma

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

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

llvm-svn: 350798

5 years agoRemove unnecessary include.
Richard Trieu [Thu, 10 Jan 2019 04:53:10 +0000 (04:53 +0000)]
Remove unnecessary include.

QuerySession.h does not need anything from Query.h, so it does not need to
include it.

llvm-svn: 350797

5 years agoi[Sanitizer] Enable pututxline interception
David Carlier [Thu, 10 Jan 2019 04:19:30 +0000 (04:19 +0000)]
i[Sanitizer] Enable pututxline interception

Reviewers: krytarowski

Reviewed By: krytarowski

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

llvm-svn: 350796

5 years agoRevert "[WebAssembly] Add simd128-unimplemented subtarget feature"
Thomas Lively [Thu, 10 Jan 2019 04:09:25 +0000 (04:09 +0000)]
Revert "[WebAssembly] Add simd128-unimplemented subtarget feature"

This reverts rL350791.

llvm-svn: 350795

5 years ago[AMDGPU] Separate feature dot-insts
Stanislav Mekhanoshin [Thu, 10 Jan 2019 03:25:47 +0000 (03:25 +0000)]
[AMDGPU] Separate feature dot-insts

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

llvm-svn: 350794

5 years ago[AMDGPU] Separate feature dot-insts
Stanislav Mekhanoshin [Thu, 10 Jan 2019 03:25:20 +0000 (03:25 +0000)]
[AMDGPU] Separate feature dot-insts

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

llvm-svn: 350793

5 years agoRefactor declarations of ASTContext allocate functions into its own header.
Richard Trieu [Thu, 10 Jan 2019 03:23:25 +0000 (03:23 +0000)]
Refactor declarations of ASTContext allocate functions into its own header.

Forward declarations of the allocate functions combine with the forward
declaration of the ASTContext class is enough information for some headers
without pulling in ASTContext.h in its entirety.  Pull the existing
declarations from AttrIterator.h into a new header.  Also place the default
alignment size into this header.  Previously, new had its default in
AttrIterator.h while new[] had its default in ASTContext.h.  Add new header
includes where it is needed.  Specifically to ASTVector.h to make it a
standalone header, unlike previously which it was standalone as long as
none of its functions were called.

llvm-svn: 350792

5 years ago[WebAssembly] Add simd128-unimplemented subtarget feature
Thomas Lively [Thu, 10 Jan 2019 02:55:52 +0000 (02:55 +0000)]
[WebAssembly] Add simd128-unimplemented subtarget feature

This is a second attempt at r350778, which was reverted in
r350789. The only change is that the unimplemented-simd128 feature has
been renamed simd128-unimplemented, since naming it
unimplemented-simd128 somehow made the simd128 feature flag enable the
unimplemented-simd128 feature on Windows.

llvm-svn: 350791

5 years agoRevert "Fix go bindings for r350647: missed a function rename"
Jorge Gorbe Moya [Thu, 10 Jan 2019 01:51:54 +0000 (01:51 +0000)]
Revert "Fix go bindings for r350647: missed a function rename"

This reverts commit a74266858a8164cfb23d4e138cd4c7c37be0b5d1. SVN revision r350657.

llvm-svn: 350790

5 years agoRevert "[WebAssembly] Add unimplemented-simd128 subtarget feature"
Thomas Lively [Thu, 10 Jan 2019 01:37:44 +0000 (01:37 +0000)]
Revert "[WebAssembly] Add unimplemented-simd128 subtarget feature"

This reverts L350778.

llvm-svn: 350789

5 years ago[Python] Update checkDsymForUUIDIsOn to be compatible with Python 3.
Davide Italiano [Thu, 10 Jan 2019 01:15:18 +0000 (01:15 +0000)]
[Python] Update checkDsymForUUIDIsOn to be compatible with Python 3.

Summary:
In python 2, strings and bytes are the same, but they're not in
python 3, hence the return of read() needs an explicit conversion.
While I'm around, rename the return of Popen() from `pipe` to
`process`, as that's what Popen returns.

Reviewers: JDevlieghere, friss, zturner, aprantl, serge-sans-paille

Subscribers: lldb-commits

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

llvm-svn: 350788

5 years agoRevert "[Sparc] Add Sparc V8 support"
Jorge Gorbe Moya [Thu, 10 Jan 2019 01:08:31 +0000 (01:08 +0000)]
Revert "[Sparc] Add Sparc V8 support"

This reverts commit r350705.

llvm-svn: 350787

5 years agoA little cleanup / commenting on locating kernel binaries while I
Jason Molenda [Thu, 10 Jan 2019 00:57:54 +0000 (00:57 +0000)]
A little cleanup / commenting on locating kernel binaries while I
was working on something else.
DynamicLoaderDarwinKernel::SearchForKernelNearPC should have had
an early return if the pc value is not in high memory; add that.
The search for a kernel at 0x2000 offsets was a stopgap; it doesn't
need to be checked any longer.

llvm-svn: 350786

5 years ago[X86] Really make the pointer arguments to avx512 gather/scatter intrinsics 'void...
Craig Topper [Thu, 10 Jan 2019 00:47:25 +0000 (00:47 +0000)]
[X86] Really make the pointer arguments to avx512 gather/scatter intrinsics 'void*' to match gcc and Intel's documentation.

The avx2 gather intrinsics are documented to use 'int', 'long long', 'float', or 'double' *. So I'm leaving those. This matches gcc.

I tried to do this in r350696, but I only updated the header not the builtin definition.

llvm-svn: 350785

5 years ago[lldb-server] Add unnamed pipe support to PipeWindows
Aaron Smith [Thu, 10 Jan 2019 00:46:09 +0000 (00:46 +0000)]
[lldb-server] Add unnamed pipe support to PipeWindows

Summary:
This adds unnamed pipe support in PipeWindows to support communication between a debug server and child process.
Modify PipeWindows::CreateNew to support the creation of an unnamed pipe.
Rename the previous method that created a named pipe to PipeWindows::CreateNewNamed.

Reviewers: zturner, llvm-commits

Reviewed By: zturner

Subscribers: Hui, labath, lldb-commits

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

llvm-svn: 350784

5 years ago[MemorySSA] Remove optimized value when reseting optimized.
Alina Sbirlea [Thu, 10 Jan 2019 00:16:54 +0000 (00:16 +0000)]
[MemorySSA] Remove optimized value when reseting optimized.

Summary:
If we don't reset the optimized value O for access A, even though A is no longer optimized to O, A will still show up in that O's users list.
This fails verification when hoisting a Def outside a loop, even though the updates are correct.
The reason is that the phi in the loop header still find as user the hoisted def, because the Def has a pointer to the Phi in its optimized operand.

Reviewers: george.burgess.iv

Subscribers: sanjoy, jlebar, Prazek, llvm-commits

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

llvm-svn: 350783

5 years ago[X86] After turning VSELECT into SHRUNKBLEND, make we push the VSELECT into the workl...
Craig Topper [Thu, 10 Jan 2019 00:14:27 +0000 (00:14 +0000)]
[X86] After turning VSELECT into SHRUNKBLEND, make we push the VSELECT into the worklist so it can be deleted.

Found while trying to figure out why my second version of D56421 worked better than the first version. We weren't deleting the vselect in a timely fashion and that caused SimplfyDemandedBit to see an additional user.

The new version doesn't have this problem so this fix isn't needed there, but seemed like the right thing to do.

llvm-svn: 350781

5 years agoIn nothrow new-expressions, null-check the result if we're going to
Richard Smith [Thu, 10 Jan 2019 00:03:29 +0000 (00:03 +0000)]
In nothrow new-expressions, null-check the result if we're going to
apply sanitizers to it.

This avoids a sanitizer false positive that we are initializing a null
pointer.

llvm-svn: 350779

5 years ago[WebAssembly] Add unimplemented-simd128 subtarget feature
Thomas Lively [Wed, 9 Jan 2019 23:59:37 +0000 (23:59 +0000)]
[WebAssembly] Add unimplemented-simd128 subtarget feature

Summary:
This replaces the old ad-hoc -wasm-enable-unimplemented-simd
flag. Also makes the new unimplemented-simd128 feature imply the
simd128 feature.

Reviewers: aheejin, dschuff

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

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

llvm-svn: 350778

5 years ago[llvm-mca] Display masks in hex
Evandro Menezes [Wed, 9 Jan 2019 23:57:15 +0000 (23:57 +0000)]
[llvm-mca] Display masks in hex

Display the resources masks as hexadecimal.  Otherwise, NFC.

llvm-svn: 350777

5 years ago[Sema] Mark target of __attribute__((alias("target"))) used for C
Nick Desaulniers [Wed, 9 Jan 2019 23:54:55 +0000 (23:54 +0000)]
[Sema] Mark target of __attribute__((alias("target"))) used for C

Summary:
Prevents -Wunneeded-internal-delcaration warnings when the target has no
other references. This occurs frequently in device drivers in the Linux
kernel.

Sema would need to invoke the demangler on the target, since in C++ the
target name is mangled:

int f() { return 42; }
int g() __attribute__((alias("_Z1fv")));

Sema does not have the ability to demangle names at this time.

https://bugs.llvm.org/show_bug.cgi?id=39088
https://github.com/ClangBuiltLinux/linux/issues/232

Reviewers: rsmith, rjmccall

Reviewed By: rsmith

Subscribers: erik.pilkington, cfe-commits, pirama, srhines

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

llvm-svn: 350776

5 years ago[SimplifyLibCalls] Fix memchr expansion for constant strings.
Eli Friedman [Wed, 9 Jan 2019 23:39:26 +0000 (23:39 +0000)]
[SimplifyLibCalls] Fix memchr expansion for constant strings.

The C standard says "The memchr function locates the first
occurrence of c (converted to an unsigned char)[...]".  The expansion
was missing the conversion to unsigned char.

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

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

llvm-svn: 350775

5 years agoDon't require a null terminator when loading objects
David Major [Wed, 9 Jan 2019 23:36:32 +0000 (23:36 +0000)]
Don't require a null terminator when loading objects

When a null terminator is required and the file size is a multiple of the system page size, MemoryBuffer will prefer pread() over mmap(), which can result in excessive memory usage.

Patch by Mike Hommey!

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

llvm-svn: 350774

5 years agoWrite PDB/variables.test to be more robust.
Zachary Turner [Wed, 9 Jan 2019 23:26:50 +0000 (23:26 +0000)]
Write PDB/variables.test to be more robust.

CHECK-DAG can't really be mixed with CHECK-NEXT statements because
each non DAG check sets a new search-origin for following CHECK-DAG
statements.  This was passing by coincidence before, but a benign
change in the way we process symbols caused the order of the output
to be different, which triggered this test to fail.

This change makes the test resilient against ordering problems by
running a separate invocation of FileCheck for each function that
we want to test.

Note that with the Native PDB reader, we have full control over
the ordering that symbols are processed in, so we don't have
to worry about different machines returning things in different
orders due to different DIA SDK versions.

llvm-svn: 350773

5 years ago[NFC] Always lock free test: add indirection
JF Bastien [Wed, 9 Jan 2019 23:20:24 +0000 (23:20 +0000)]
[NFC] Always lock free test: add indirection

I have a big patch coming up, and this indirection is required to avoid hitting the following after my big change:

  error: empty struct has size 0 in C, size 1 in C++ [-Werror,-Wextern-c-compat]

llvm-svn: 350772

5 years ago[WebAssembly] Print a debug message at the start of each pass
Heejin Ahn [Wed, 9 Jan 2019 23:05:21 +0000 (23:05 +0000)]
[WebAssembly] Print a debug message at the start of each pass

Summary:
Looks like many passes print its pass description as a debug message at
the start of each pass, so added that to (mostly newly added) other
passes as well.

Reviewers: dschuff

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

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

llvm-svn: 350771

5 years ago[NFC] Normalize some test 'main' signatures
JF Bastien [Wed, 9 Jan 2019 22:56:45 +0000 (22:56 +0000)]
[NFC] Normalize some test 'main' signatures

There were 3 tests with 'int main(void)', and 6 with the return type on a different line. I'm about to send a patch for main in tests, and this NFC change is unrelated.

llvm-svn: 350770

5 years ago[Python] Update PyString_FromString() to work for python 2 and 3.
Davide Italiano [Wed, 9 Jan 2019 22:52:47 +0000 (22:52 +0000)]
[Python] Update PyString_FromString() to work for python 2 and 3.

Reviewers: aprantl, JDevlieghere, friss, zturner

Subscribers: lldb-commits

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

llvm-svn: 350769

5 years ago[ObjC] Allow the use of implemented unavailable methods from within
Alex Lorenz [Wed, 9 Jan 2019 22:31:37 +0000 (22:31 +0000)]
[ObjC] Allow the use of implemented unavailable methods from within
the @implementation context

In Objective-C, it's common for some frameworks to mark some methods like init
as unavailable in the @interface to prohibit their usage. However, these
frameworks then often implemented said method and refer to it in another method
that acts as a factory for that object. The recent change to how messages to
self are type checked in clang (r349841) introduced a regression which started
to prohibit this pattern with an X is unavailable error. This commit addresses
the aforementioned regression.

rdar://47134898

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

llvm-svn: 350768

5 years agoFix formatting. NFC.
Rui Ueyama [Wed, 9 Jan 2019 22:24:27 +0000 (22:24 +0000)]
Fix formatting. NFC.

llvm-svn: 350767

5 years ago[libfuzzer][MSVC] Make calls to builtin functions work with MSVC
Jonathan Metzman [Wed, 9 Jan 2019 21:46:09 +0000 (21:46 +0000)]
[libfuzzer][MSVC] Make calls to builtin functions work with MSVC

Summary:
Replace calls to builtin functions with macros or functions that call the
Windows-equivalents when targeting windows and call the original
builtin functions everywhere else.
This change makes more parts of libFuzzer buildable with MSVC.

Reviewers: vitalybuka

Reviewed By: vitalybuka

Subscribers: mgorny, rnk, thakis

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

llvm-svn: 350766

5 years ago[clang-tidy] another take at fixing doc
Jonas Toth [Wed, 9 Jan 2019 21:27:59 +0000 (21:27 +0000)]
[clang-tidy] another take at fixing doc

llvm-svn: 350765

5 years agoChange lldb-test to use ParseAllDebugSymbols.
Zachary Turner [Wed, 9 Jan 2019 21:20:44 +0000 (21:20 +0000)]
Change lldb-test to use ParseAllDebugSymbols.

ParseDeclsForContext was originally created to serve the very specific
case where the context is a function block. It was never intended to be
used for arbitrary DeclContexts, however due to the generic name, the
DWARF and PDB plugins implemented it in this way "just in case". Then,
lldb-test came along and decided to use it in that way.

Related to this, there are a set of functions in the SymbolFile class
interface whose requirements and expectations are not documented. For
example, if you call ParseCompileUnitFunctions, there's an inherent
requirement that you create entries in the underlying clang AST for
these functions as well as their signature types, because in order to
create an lldb_private::Function object, you have to pass it a
CompilerType for the parameter representing the signature.

On the other hand, there is no similar requirement (either inherent or
documented) if one were to call ParseDeclsForContext. Specifically, if
one calls ParseDeclsForContext, and some variable declarations, types,
and other things are added to the clang AST, is it necessary to create
lldb::Variable, lldb::Type, etc objects representing them? Nobody knows.
There is, however, an accidental requirement, because since all of the
plugins implemented this just in case, lldb-test came along and used
ParsedDeclsForContext, and then wrote check lines that depended on this.

When I went to try and implemented the NativePDB reader, I did not
adhere to this (in fact, from a layering perspective I went out of my
way to avoid it), and as a result the existing DIA PDB tests don't work
when the native PDB reader is enabled, because they expect that calling
ParseDeclsForContext will modify the *module's* view of symbols, and not
just the internal AST.

All of this confusion, however, can be avoided if we simply stick to
using ParseDeclsForContext for its original intended use case (blocks),
and use a different function (ParseAllDebugSymbols) for its intended use
case which is, unsuprisingly, to parse all the debug symbols (which is
all lldb-test really wanted to do anyway).

In the future, I would like to change ParseDeclsForContext to
ParseDeclsForFunctionBlock, then delete all of the dead code inside that
handles other types of DeclContexts (and probably even assert if the
DeclContext is anything other than a block).

A few PDB tests needed to be fixed up as a result of this, and this also
exposed a couple of bugs in the DIA PDB reader (doesn't matter much
since it should be going away soon, but worth mentioning) where the
appropriate AST entries weren't being created always.

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

llvm-svn: 350764

5 years ago[clang-tidy] tryfix documentation build
Jonas Toth [Wed, 9 Jan 2019 21:19:44 +0000 (21:19 +0000)]
[clang-tidy] tryfix documentation build

llvm-svn: 350763

5 years ago[AArch64] Add test for constant shrinking with multiple users (NFC).
Florian Hahn [Wed, 9 Jan 2019 21:04:36 +0000 (21:04 +0000)]
[AArch64] Add test for constant shrinking with multiple users (NFC).

Test to avoid regression fixed by rL350684.

llvm-svn: 350762

5 years ago[clang-tidy] fix-up failing tests
Jonas Toth [Wed, 9 Jan 2019 21:03:54 +0000 (21:03 +0000)]
[clang-tidy] fix-up failing tests

llvm-svn: 350761

5 years ago[clang-tidy] Adding a new modernize use nodiscard checker
Jonas Toth [Wed, 9 Jan 2019 20:50:50 +0000 (20:50 +0000)]
[clang-tidy] Adding a new modernize use nodiscard checker

Summary: Adds a checker to clang-tidy to warn when a non void const member function, taking only parameters passed by value or const reference could be marked as '[[nodiscard]]'

Patch by MyDeveloperDay.

Reviewers: alexfh, stephenkelly, curdeius, aaron.ballman, hokein, JonasToth

Reviewed By: curdeius, JonasToth

Subscribers: Eugene.Zelenko, lefticus, lebedev.ri, mgorny, xazax.hun, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 350760

5 years ago[OpenMP] Avoid remainder operations for loop index values on a collapsed loop nest.
Gheorghe-Teodor Bercea [Wed, 9 Jan 2019 20:45:26 +0000 (20:45 +0000)]
[OpenMP] Avoid remainder operations for loop index values on a collapsed loop nest.

Summary: Change the strategy for computing loop index variables after collapsing a loop nest via the collapse clause by replacing the expensive remainder operation with multiplications and additions.

Reviewers: ABataev, caomhin

Reviewed By: ABataev

Subscribers: guansong, arphaman, cfe-commits

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

llvm-svn: 350759

5 years ago[OpenMP] Add flag for preventing the extension to 64 bits for the collapse loop counter
Gheorghe-Teodor Bercea [Wed, 9 Jan 2019 20:38:35 +0000 (20:38 +0000)]
[OpenMP] Add flag for preventing the extension to 64 bits for the collapse loop counter

Summary: Introduce a compiler flag for cases when the user knows that the collapsed loop counter can be safely represented using at most 32 bits. This will prevent the emission of expensive mathematical operations (such as the div operation) on the iteration variable using 64 bits where 32 bit operations are sufficient.

Reviewers: ABataev, caomhin

Reviewed By: ABataev

Subscribers: hfinkel, kkwli0, guansong, cfe-commits

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

llvm-svn: 350758

5 years ago[OPENMP][DOCS]Release notes/OpenMP support updates, NFC.
Alexey Bataev [Wed, 9 Jan 2019 20:32:56 +0000 (20:32 +0000)]
[OPENMP][DOCS]Release notes/OpenMP support updates, NFC.

llvm-svn: 350757

5 years agoRemoving an include that was not necessary; NFC.
Aaron Ballman [Wed, 9 Jan 2019 20:15:10 +0000 (20:15 +0000)]
Removing an include that was not necessary; NFC.

The include also had a using namespace llvm in it, so this adds qualifiers where needed as well.

llvm-svn: 350756

5 years agoRefactor synthetic profile count computation. NFC.
Easwaran Raman [Wed, 9 Jan 2019 20:10:27 +0000 (20:10 +0000)]
Refactor synthetic profile count computation. NFC.

Summary:
Instead of using two separate callbacks to return the entry count and the
relative block frequency, use a single callback to return callsite
count. This would allow better supporting hybrid mode in the future as
the count of callsite need not always be derived from entry count (as in
sample PGO).

Reviewers: davidxl

Subscribers: mehdi_amini, steven_wu, dexonsmith, dang, llvm-commits

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

llvm-svn: 350755

5 years ago[CodeGen] Clarify comment about COFF common symbol alignment
Shoaib Meenai [Wed, 9 Jan 2019 20:05:16 +0000 (20:05 +0000)]
[CodeGen] Clarify comment about COFF common symbol alignment

After a discussion on the commit thread, it seems the 32 byte alignment
limitation is an MSVC toolchain artifact, not an inherent COFF
restriction. Clarify the comment accordingly, since saying COFF in the
comment but using isKnownWindowsMSVCEnvironment in the conditional is
confusing. Also add a newline before the comment, which is consistent
with the local style.

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

llvm-svn: 350754

5 years ago[CodeGen] Ignore return sext/zext attributes of unused results for tail calls
Francis Visoiu Mistrih [Wed, 9 Jan 2019 19:46:15 +0000 (19:46 +0000)]
[CodeGen] Ignore return sext/zext attributes of unused results for tail calls

If the caller's return type does not have a zeroext attribute but the
callee does a tail call zeroext, we won't consider the tail call during
CodeGenPrepare because the attributes don't match.

However, if the result of the tail call has no uses, it makes sense to
drop the sext/zext attributes.

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

llvm-svn: 350753

5 years ago[libcxx] Add a script to run CI on older MacOS versions
Louis Dionne [Wed, 9 Jan 2019 19:40:20 +0000 (19:40 +0000)]
[libcxx] Add a script to run CI on older MacOS versions

This script can be used by CI systems to test things like availability
markup and binary compatibility on older MacOS versions. This is still
a bit rough on the edges, for example we don't test libc++abi yet.

llvm-svn: 350752

5 years ago[Inliner] Assert that the computed inline threshold is non-negative.
Easwaran Raman [Wed, 9 Jan 2019 19:26:17 +0000 (19:26 +0000)]
[Inliner] Assert that the computed inline threshold is non-negative.

Reviewers: chandlerc

Subscribers: haicheng, llvm-commits

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

llvm-svn: 350751

5 years agolld-link: Add help strings for /manifest, /nodefaultlib, /noentry; tweak manifest...
Nico Weber [Wed, 9 Jan 2019 19:18:03 +0000 (19:18 +0000)]
lld-link: Add help strings for /manifest, /nodefaultlib, /noentry; tweak manifest help strings

My main motivation is that I can never remember /nodefaultlib and
`lld-link /? | grep no` didn't display it due to it not having a help string.

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

llvm-svn: 350750

5 years agorefactor BlockFrequencyInfo::view to take a title parameter
David Callahan [Wed, 9 Jan 2019 19:12:38 +0000 (19:12 +0000)]
refactor  BlockFrequencyInfo::view to take a title parameter

Summary: All a non-default title for the debugging this debugging aide

Reviewers: twoh, Kader, modocache

Reviewed By: twoh

Subscribers: llvm-commits

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

llvm-svn: 350749

5 years agoFix visualization of intrusive reference counted objects in MSVC.
Aaron Ballman [Wed, 9 Jan 2019 18:59:56 +0000 (18:59 +0000)]
Fix visualization of intrusive reference counted objects in MSVC.

llvm-svn: 350748

5 years ago[OpenMP][libomptarget] Use shared memory variable for tracking parallel level
Gheorghe-Teodor Bercea [Wed, 9 Jan 2019 18:30:14 +0000 (18:30 +0000)]
[OpenMP][libomptarget] Use shared memory variable for tracking parallel level

Summary: Replace existing infrastructure for tracking parallel level using global memory with a per-team shared memory variable. This minimizes the impact of the overhead of tracking the parallel level for non-nested cases.

Reviewers: ABataev, caomhin

Reviewed By: ABataev

Subscribers: guansong, openmp-commits

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

llvm-svn: 350747

5 years ago[WebAssembly] Standardize order of SIMD bitselect arguments
Thomas Lively [Wed, 9 Jan 2019 18:13:11 +0000 (18:13 +0000)]
[WebAssembly] Standardize order of SIMD bitselect arguments

Summary:
For some reason the backend assumed that the condition mask would be
the first argument to the LLVM intrinsic, but everywhere else the
condition mask is the third argument.

Reviewers: aheejin

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

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

llvm-svn: 350746

5 years ago[x86] use 'nounwind' to remove test noise; NFC
Sanjay Patel [Wed, 9 Jan 2019 17:29:18 +0000 (17:29 +0000)]
[x86] use 'nounwind' to remove test noise; NFC

llvm-svn: 350745

5 years ago[asan] Disable TSD dtor leak unit tests on FreeBSD x86 64
David Carlier [Wed, 9 Jan 2019 17:14:57 +0000 (17:14 +0000)]
[asan] Disable TSD dtor leak unit tests on FreeBSD x86 64

- Assertion fails in the third iteration.

Reviewers: krytarowski

Reviewed By: krytarowski

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

llvm-svn: 350744

5 years agoELF: create "container" sections from PT_LOAD segments
Pavel Labath [Wed, 9 Jan 2019 16:50:45 +0000 (16:50 +0000)]
ELF: create "container" sections from PT_LOAD segments

Summary:
This is the result of the discussion in D55356, where it was suggested
as a solution to representing the addresses that logically belong to a
module in memory, but are not a part of any of its sections.

The ELF PT_LOAD segments are similar to the MachO "load commands",
except that the relationship between them and the object file sections
is a bit weaker. While in the MachO case, the sections belonging to a
specific segment are placed directly inside it in the object file
logical structur, in the ELF case, the sections and segments form two
separate hierarchies. This means that it is in theory possible to create
an elf file where only a part of a section would belong to some segment
(and another part to a different one). However, I am not aware of any
tool which would produce such a file (and most tools will have problems
ingesting them), so this means it is still possible to follow the MachO
model and make sections children of the PT_LOAD segments.

In case we run into (corrupt?) files with overlapping sections, I have
added code (and tests) which adjusts the sizes and/or drops the offending
sections in order to present a reasonable image to the upper layers of
LLDB. This is mostly done for completeness, as I don't anticipate
running into this situation in the real world. However, if we do run
into it, and the current behavior is not suitable for some reason, we
can implement this logic differently.

Reviewers: clayborg, jankratochvil, krytarowski, joerg, espindola

Subscribers: emaste, arichardson, lldb-commits

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

llvm-svn: 350742

5 years ago[AST] Move back BasePathSize to the bit-fields of CastExpr
Bruno Ricci [Wed, 9 Jan 2019 16:41:33 +0000 (16:41 +0000)]
[AST] Move back BasePathSize to the bit-fields of CastExpr

The number of trailing CXXBaseSpecifiers in CastExpr was moved from
CastExprBitfields to a trailing object in r338489 (D50050). At this time these
bit-fields classes were only 32 bits wide. However later r345459 widened these
bit-field classes to 64 bits.

The reason for this change was that on 64 bit archs alignment requirements
caused 4 bytes of padding after the Stmt sub-object in nearly all expression
classes. Reusing this padding yielded an >10% reduction in the size used by all
statement/expressions when parsing all of Boost (on a 64 bit arch). This
increased the size of statement/expressions for 32 bits archs, but this can be
mitigated by moving more data to the bit-fields of Stmt (and moreover most
people now care about 64 bits archs as a host).

Therefore move back the number of CXXBaseSpecifiers in CastExpr to the
bit-fields of Stmt. This in effect mostly revert r338489 while keeping the
added test.

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

Reviewed By: lebedev.ri

Reviewers: lebedev.ri, rjmccall
llvm-svn: 350741

5 years ago[libcxx] Add a script to run CI on MacOS
Louis Dionne [Wed, 9 Jan 2019 16:35:55 +0000 (16:35 +0000)]
[libcxx] Add a script to run CI on MacOS

CI systems like Green Dragon should use this script so as to make
reproducing errors easy locally.

llvm-svn: 350740

5 years agoMark two UDL tests as being unsupported with Clang 7
Eric Fiselier [Wed, 9 Jan 2019 16:34:17 +0000 (16:34 +0000)]
Mark two UDL tests as being unsupported with Clang 7

llvm-svn: 350739

5 years ago[CMake] In standalone builds, LLVM_BINARY_DIR should point to LLVM's binary directory
Stefan Granitz [Wed, 9 Jan 2019 16:25:37 +0000 (16:25 +0000)]
[CMake] In standalone builds, LLVM_BINARY_DIR should point to LLVM's binary directory

Summary: In standalone builds `LLVM_BINARY_DIR` was equal to `LLDB_BINARY_DIR` so far. This is counterintuitive and invalidated the values of `LLDB_DEFAULT_TEST_DSYMUTIL/FILECHECK/COMPILER` etc.

Reviewers: zturner, labath, clayborg, JDevlieghere, stella.stamenova, serge-sans-paille

Reviewed By: labath

Subscribers: mgorny, friss, lldb-commits, #lldb

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

llvm-svn: 350738

5 years ago[CMake] Fix standalone builds: workaround the cxx target not getting imported yet...
Stefan Granitz [Wed, 9 Jan 2019 16:25:31 +0000 (16:25 +0000)]
[CMake] Fix standalone builds: workaround the cxx target not getting imported yet (unlike clang target)

Summary: Handle standalone builds separately and print a warning if we have no libcxx.

Reviewers: aprantl, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: mgorny, lldb-commits, #lldb

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

llvm-svn: 350737

5 years ago[libcxx] Remove outdated XFAILs for aligned deallocation
Louis Dionne [Wed, 9 Jan 2019 16:13:04 +0000 (16:13 +0000)]
[libcxx] Remove outdated XFAILs for aligned deallocation

AppleClang 10 has been fixed and so these tests don't fail anymore.

llvm-svn: 350736

5 years ago[unittests][Support] AIX: Skip sticky bit file tests
Hubert Tong [Wed, 9 Jan 2019 16:00:39 +0000 (16:00 +0000)]
[unittests][Support] AIX: Skip sticky bit file tests

On AIX, attempting (without root) to set the sticky bit on a file with
the `chmod` utility will give:
```
chmod: not all requested changes were made to <file>
```

The same occurs when modifying other permission bits on a file with the
sticky bit already set.

It seems that the `chmod` function will report success despite failing
to set the sticky bit.

llvm-svn: 350735

5 years agoIncorrect implicit data-sharing for nested tasks
Alexey Bataev [Wed, 9 Jan 2019 15:58:05 +0000 (15:58 +0000)]
Incorrect implicit data-sharing for nested tasks

Summary:
There is a minor issue in how the implicit data-sharings for nested tasks are computed.

For the following example:
```
int x;
#pragma omp task shared(x)
#pragma omp task
x++;
```
We compute an implicit data-sharing of shared for `x` in the second task although I think that it should be firstprivate. Below you can find the part of the OpenMP spec that covers this example:
- // In a task generating construct, if no default clause is present, a variable for which the data-sharing attribute is not determined by the rules above and that in the enclosing context is determined to be shared by all implicit tasks bound to the current team is shared.//
- //In a task generating construct, if no default clause is present, a variable for which the data-sharing attribute is not determined by the rules above is firstprivate.//

Since each implicit-task has its own copy of `x`, we shouldn't apply the first rule.

Reviewers: ABataev

Reviewed By: ABataev

Subscribers: cfe-commits, rogfer01

Tags: #openmp

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

llvm-svn: 350734

5 years ago[mips][micrompis] Emit 16bit NOPs by default
Aleksandar Beserminji [Wed, 9 Jan 2019 15:58:02 +0000 (15:58 +0000)]
[mips][micrompis] Emit 16bit NOPs by default

Emit 16bit NOPs by default.
Use 32bit NOPs in delay slots where necessary.

Differential https://reviews.llvm.org/D55323

llvm-svn: 350733