platform/upstream/llvm.git
5 years ago[libc++] Fix link error with _LIBCPP_HIDE_FROM_ABI_PER_TU and std::string
Louis Dionne [Fri, 19 Jul 2019 11:52:55 +0000 (11:52 +0000)]
[libc++] Fix link error with _LIBCPP_HIDE_FROM_ABI_PER_TU and std::string

Summary:
This is effectively a revert of r344616, which was a partial fix for
PR38964 (compilation of <string> with GCC in C++03 mode). However, that
configuration is explicitly not supported anymore and that partial fix
breaks compilation with Clang when per-TU insulation is provided.

PR42676
rdar://52899715

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

llvm-svn: 366567

5 years ago[Clangd] Fixed SelectionTree bug for macros
Shaurya Gupta [Fri, 19 Jul 2019 11:41:02 +0000 (11:41 +0000)]
[Clangd] Fixed SelectionTree bug for macros

Summary:
Fixed SelectionTree bug for macros
- Fixed SelectionTree claimRange for macros and template instantiations
- Fixed SelectionTree unit tests
- Changed a breaking test in TweakTests

Reviewers: sammccall, kadircet

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

Tags: #clang

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

llvm-svn: 366566

5 years ago[NFC][InstCombine] Tests for 'rem' formation from sub-of-mul-by-'div' (PR42673)
Roman Lebedev [Fri, 19 Jul 2019 11:29:18 +0000 (11:29 +0000)]
[NFC][InstCombine] Tests for 'rem' formation from sub-of-mul-by-'div' (PR42673)

https://rise4fun.com/Alive/8Rp
https://bugs.llvm.org/show_bug.cgi?id=42673

llvm-svn: 366565

5 years ago[NFC][InstCombine] Redundant masking before left-shift: tests with assume
Roman Lebedev [Fri, 19 Jul 2019 11:29:04 +0000 (11:29 +0000)]
[NFC][InstCombine] Redundant masking before left-shift: tests with assume

If the legality check is `(shiftNbits-maskNbits) s>= 0`,
then we can simplify it to `shiftNbits u>= maskNbits`,
which is easier to check for.

However, currently switching the `dropRedundantMaskingOfLeftShiftInput()`
to `SimplifyICmpInst()` does not catch these cases and regresses
currently-handled cases, so i'll leave it as is for now.

https://rise4fun.com/Alive/25P

llvm-svn: 366564

5 years agoFix MSVC "result of 32-bit shift implicitly converted to 64 bits" warning. NFCI.
Simon Pilgrim [Fri, 19 Jul 2019 11:18:46 +0000 (11:18 +0000)]
Fix MSVC "result of 32-bit shift implicitly converted to 64 bits" warning. NFCI.

llvm-svn: 366563

5 years agoDon't update NoTrappingFPMath and FPDenormalMode in resetTargetOptions
Oliver Stannard [Fri, 19 Jul 2019 10:37:37 +0000 (10:37 +0000)]
Don't update NoTrappingFPMath and FPDenormalMode in resetTargetOptions

We'd like to remove this whole function, because these are properties of
functions, not the target as a whole. These two are easy to remove
because they are only used for emitting ARM build attributes, which
expects them to represent the defaults for the whole module, not just
the last function generated.

This is needed to get correct build attributes when using IPRA on ARM,
because IPRA causes resetTargetOptions to get called before
ARMAsmPrinter::emitAttributes.

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

llvm-svn: 366562

5 years ago[lldb][NFC] Tablegenify target
Raphael Isemann [Fri, 19 Jul 2019 10:23:22 +0000 (10:23 +0000)]
[lldb][NFC] Tablegenify target

llvm-svn: 366561

5 years ago[NFC] Remove indent after r366433
Stefan Granitz [Fri, 19 Jul 2019 10:20:35 +0000 (10:20 +0000)]
[NFC] Remove indent after r366433

llvm-svn: 366560

5 years agoRevert "Revert r366458, r366467 and r366468"
Kadir Cetinkaya [Fri, 19 Jul 2019 10:18:52 +0000 (10:18 +0000)]
Revert "Revert r366458, r366467 and r366468"

This reverts commit 9c377105da0be7c2c9a3c70035ce674c71b846af.

[clangd][BackgroundIndexLoader] Directly store DependentTU while loading shard

Summary:
We were deferring the population of DependentTU field in LoadedShard
until BackgroundIndexLoader was consumed. This actually triggers a use after
free since the shards FileToTU was pointing at could've been moved while
consuming the Loader.

Reviewers: sammccall

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

Tags: #clang

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

llvm-svn: 366559

5 years ago[llvm-readelf] - A fix for: "--hash-symbols asserts for 64-bit ELFs"
George Rimar [Fri, 19 Jul 2019 10:15:03 +0000 (10:15 +0000)]
[llvm-readelf] - A fix for: "--hash-symbols asserts for 64-bit ELFs"

Fixes https://bugs.llvm.org/show_bug.cgi?id=42622.
(--hash-symbols switch is currently broken for 64-bit ELF files, due to r352630.)

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

llvm-svn: 366558

5 years ago[IPRA] Don't rely on non-exact function definitions
Oliver Stannard [Fri, 19 Jul 2019 09:59:26 +0000 (09:59 +0000)]
[IPRA] Don't rely on non-exact function definitions

If a function definition is not exact, then the linker could select a
differently-compiled version of it, which could use different registers.

https://reviews.llvm.org/D64909

llvm-svn: 366557

5 years ago[ARM] Add <saturate> operand to SQRSHRL and UQRSHLL
Mikhail Maltsev [Fri, 19 Jul 2019 09:46:28 +0000 (09:46 +0000)]
[ARM] Add <saturate> operand to SQRSHRL and UQRSHLL

Summary:
According to the new Armv8-M specification
https://static.docs.arm.com/ddi0553/bh/DDI0553B_h_armv8m_arm.pdf the
instructions SQRSHRL and UQRSHLL now have an additional immediate
operand <saturate>. The new assembly syntax is:

SQRSHRL<c> RdaLo, RdaHi, #<saturate>, Rm
UQRSHLL<c> RdaLo, RdaHi, #<saturate>, Rm

where <saturate> can be either 64 (the existing behavior) or 48, in
that case the result is saturated to 48 bits.

The new operand is encoded as follows:
  #64 Encoded as sat = 0
  #48 Encoded as sat = 1
sat is bit 7 of the instruction bit pattern.

This patch adds a new assembler operand class MveSaturateOperand which
implements parsing and encoding. Decoding is implemented in
DecodeMVEOverlappingLongShift.

Reviewers: ostannard, simon_tatham, t.p.northover, samparker, dmgreen, SjoerdMeijer

Reviewed By: simon_tatham

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

Tags: #llvm

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

llvm-svn: 366555

5 years agoRevert r366458, r366467 and r366468
Azharuddin Mohammed [Fri, 19 Jul 2019 09:26:33 +0000 (09:26 +0000)]
Revert r366458, r366467 and r366468

r366458 is causing test failures. r366467 and r366468 had to be reverted as
they were casuing conflict while reverting r366458.

r366468 [clangd] Remove dead code from BackgroundIndex
r366467 [clangd] BackgroundIndex stores shards to the closest project
r366458 [clangd] Refactor background-index shard loading

llvm-svn: 366551

5 years ago[OpenCL] Define CLK_NULL_EVENT without cast
Sven van Haastregt [Fri, 19 Jul 2019 09:11:48 +0000 (09:11 +0000)]
[OpenCL] Define CLK_NULL_EVENT without cast

Defining CLK_NULL_EVENT with a `(void*)` cast has the (unintended?)
side-effect that the address space will be fixed (as generic in OpenCL
2.0 mode).  The consequence is that any target specific address space
for the clk_event_t type will not be applied.

It is not clear why the void pointer cast was needed in the first
place, and it seems we can do without it.

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

llvm-svn: 366546

5 years ago[clangd] Handle windows line endings in QueryDriver
Kadir Cetinkaya [Fri, 19 Jul 2019 09:08:22 +0000 (09:08 +0000)]
[clangd] Handle windows line endings in QueryDriver

Summary:
The previous patch did not fix the end mark. D64789
fixes second case of https://github.com/clangd/clangd/issues/93

Patch by @lh123 !

Reviewers: sammccall, kadircet

Reviewed By: kadircet

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

Tags: #clang-tools-extra, #clang

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

llvm-svn: 366545

5 years ago[sanitizers] Use covering ObjectFormatType switches
Hubert Tong [Fri, 19 Jul 2019 08:46:18 +0000 (08:46 +0000)]
[sanitizers] Use covering ObjectFormatType switches

Summary:
This patch removes the `default` case from some switches on
`llvm::Triple::ObjectFormatType`, and cases for the missing enumerators
(`UnknownObjectFormat`, `Wasm`, and `XCOFF`) are then added.

For `UnknownObjectFormat`, the effect of the action for the `default`
case is maintained; otherwise, where `llvm_unreachable` is called,
`report_fatal_error` is used instead.

Where the `default` case returns a default value, `report_fatal_error`
is used for XCOFF as a placeholder. For `Wasm`, the effect of the action
for the `default` case in maintained.

The code is structured to avoid strongly implying that the `Wasm` case
is present for any reason other than to make the switch cover all
`ObjectFormatType` enumerator values.

Reviewers: sfertile, jasonliu, daltenty

Reviewed By: sfertile

Subscribers: hiraditya, aheejin, sunfish, llvm-commits, cfe-commits

Tags: #clang, #llvm

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

llvm-svn: 366544

5 years ago[AMDGPU] Simplify the exclusive scan used for optimized atomics
Jay Foad [Fri, 19 Jul 2019 08:40:37 +0000 (08:40 +0000)]
[AMDGPU] Simplify the exclusive scan used for optimized atomics

Summary:
Change the scan algorithm to use only power-of-two shifts (1, 2, 4, 8,
16, 32) instead of starting off shifting by 1, 2 and 3 and then doing
a 3-way ADD, because:

1. It simplifies the compiler a little.
2. It minimizes vgpr pressure because each instruction is now of the
   form vn = vn + vn << c.
3. It is more friendly to the DPP combiner, which currently can't
   combine into an ADD3 instruction.

Because of #2 and #3 the end result is improved from this:

  v_add_u32_dpp v4, v3, v3  row_shr:1 row_mask:0xf bank_mask:0xf bound_ctrl:0
  v_mov_b32_dpp v5, v3  row_shr:2 row_mask:0xf bank_mask:0xf
  v_mov_b32_dpp v1, v3  row_shr:3 row_mask:0xf bank_mask:0xf
  v_add3_u32 v1, v4, v5, v1
  s_nop 1
  v_add_u32_dpp v1, v1, v1  row_shr:4 row_mask:0xf bank_mask:0xe
  s_nop 1
  v_add_u32_dpp v1, v1, v1  row_shr:8 row_mask:0xf bank_mask:0xc
  s_nop 1
  v_add_u32_dpp v1, v1, v1  row_bcast:15 row_mask:0xa bank_mask:0xf
  s_nop 1
  v_add_u32_dpp v1, v1, v1  row_bcast:31 row_mask:0xc bank_mask:0xf

To this:

  v_add_u32_dpp v1, v1, v1  row_shr:1 row_mask:0xf bank_mask:0xf bound_ctrl:0
  s_nop 1
  v_add_u32_dpp v1, v1, v1  row_shr:2 row_mask:0xf bank_mask:0xf bound_ctrl:0
  s_nop 1
  v_add_u32_dpp v1, v1, v1  row_shr:4 row_mask:0xf bank_mask:0xe
  s_nop 1
  v_add_u32_dpp v1, v1, v1  row_shr:8 row_mask:0xf bank_mask:0xc
  s_nop 1
  v_add_u32_dpp v1, v1, v1  row_bcast:15 row_mask:0xa bank_mask:0xf
  s_nop 1
  v_add_u32_dpp v1, v1, v1  row_bcast:31 row_mask:0xc bank_mask:0xf

I.e. two fewer computational instructions, one extra nop where we could
schedule something else.

Reviewers: arsenm, sheredom, critson, rampitec, vpykhtin

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 366543

5 years ago[Loop Peeling] Enable peeling of multiple exits by default.
Serguei Katkov [Fri, 19 Jul 2019 08:35:45 +0000 (08:35 +0000)]
[Loop Peeling] Enable peeling of multiple exits by default.

Enable loop peeling with multiple exits where all non-latch exits
ends up with deopt by default.

Reviewers: reames, fhahn
Reviewed By: reames
Subscribers: xbolva00, hiraditya, zzheng, llvm-commits
Differential Revision: https://reviews.llvm.org/D64619

llvm-svn: 366542

5 years ago[clangd] cleanup: unify the implemenation of checking a location is inside main file.
Haojian Wu [Fri, 19 Jul 2019 08:33:39 +0000 (08:33 +0000)]
[clangd] cleanup: unify the implemenation of checking a location is inside main file.

Summary: We have variant implementations in the codebase, this patch unifies them.

Reviewers: ilya-biryukov, kadircet

Subscribers: MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 366541

5 years ago[InstCombine] Dropping redundant masking before left-shift [5/5] (PR42563)
Roman Lebedev [Fri, 19 Jul 2019 08:26:58 +0000 (08:26 +0000)]
[InstCombine] Dropping redundant masking before left-shift [5/5] (PR42563)

Summary:
If we have some pattern that leaves only some low bits set, and then performs
left-shift of those bits, if none of the bits that are left after the final
shift are modified by the mask, we can omit the mask.

There are many variants to this pattern:
f. `((x << MaskShAmt) a>> MaskShAmt) << ShiftShAmt`
All these patterns can be simplified to just:
`x << ShiftShAmt`
iff:
f. `(ShiftShAmt-MaskShAmt) s>= 0` (i.e. `ShiftShAmt u>= MaskShAmt`)

Normally, the inner pattern is sign-extend,
but for our purposes it's no different to other patterns:

alive proofs:
f: https://rise4fun.com/Alive/7U3

For now let's start with patterns where both shift amounts are variable,
with trivial constant "offset" between them, since i believe this is
both simplest to handle and i think this is most common.
But again, there are likely other variants where we could use
ValueTracking/ConstantRange to handle more cases.

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

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

llvm-svn: 366540

5 years ago[InstCombine] Dropping redundant masking before left-shift [4/5] (PR42563)
Roman Lebedev [Fri, 19 Jul 2019 08:26:47 +0000 (08:26 +0000)]
[InstCombine] Dropping redundant masking before left-shift [4/5] (PR42563)

Summary:
If we have some pattern that leaves only some low bits set, and then performs
left-shift of those bits, if none of the bits that are left after the final
shift are modified by the mask, we can omit the mask.

There are many variants to this pattern:
e. `((x << MaskShAmt) l>> MaskShAmt) << ShiftShAmt`
All these patterns can be simplified to just:
`x << ShiftShAmt`
iff:
e. `(ShiftShAmt-MaskShAmt) s>= 0` (i.e. `ShiftShAmt u>= MaskShAmt`)

alive proofs:
e: https://rise4fun.com/Alive/0FT

For now let's start with patterns where both shift amounts are variable,
with trivial constant "offset" between them, since i believe this is
both simplest to handle and i think this is most common.
But again, there are likely other variants where we could use
ValueTracking/ConstantRange to handle more cases.

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

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

llvm-svn: 366539

5 years ago[InstCombine] Dropping redundant masking before left-shift [3/5] (PR42563)
Roman Lebedev [Fri, 19 Jul 2019 08:26:37 +0000 (08:26 +0000)]
[InstCombine] Dropping redundant masking before left-shift [3/5] (PR42563)

Summary:
If we have some pattern that leaves only some low bits set, and then performs
left-shift of those bits, if none of the bits that are left after the final
shift are modified by the mask, we can omit the mask.

There are many variants to this pattern:
d. `(x & ((-1 << MaskShAmt) >> MaskShAmt)) << ShiftShAmt`
All these patterns can be simplified to just:
`x << ShiftShAmt`
iff:
d. `(ShiftShAmt-MaskShAmt) s>= 0` (i.e. `ShiftShAmt u>= MaskShAmt`)

alive proofs:
d: https://rise4fun.com/Alive/I5Y

For now let's start with patterns where both shift amounts are variable,
with trivial constant "offset" between them, since i believe this is
both simplest to handle and i think this is most common.
But again, there are likely other variants where we could use
ValueTracking/ConstantRange to handle more cases.

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

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

llvm-svn: 366538

5 years ago[InstCombine] Dropping redundant masking before left-shift [2/5] (PR42563)
Roman Lebedev [Fri, 19 Jul 2019 08:26:25 +0000 (08:26 +0000)]
[InstCombine] Dropping redundant masking before left-shift [2/5] (PR42563)

Summary:
If we have some pattern that leaves only some low bits set, and then performs
left-shift of those bits, if none of the bits that are left after the final
shift are modified by the mask, we can omit the mask.

There are many variants to this pattern:
c. `(x & (-1 >> MaskShAmt)) << ShiftShAmt`
All these patterns can be simplified to just:
`x << ShiftShAmt`
iff:
c. `(ShiftShAmt-MaskShAmt) s>= 0` (i.e. `ShiftShAmt u>= MaskShAmt`)

alive proofs:
c: https://rise4fun.com/Alive/RgJh

For now let's start with patterns where both shift amounts are variable,
with trivial constant "offset" between them, since i believe this is
both simplest to handle and i think this is most common.
But again, there are likely other variants where we could use
ValueTracking/ConstantRange to handle more cases.

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

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

llvm-svn: 366537

5 years ago[InstCombine] Dropping redundant masking before left-shift [1/5] (PR42563)
Roman Lebedev [Fri, 19 Jul 2019 08:26:13 +0000 (08:26 +0000)]
[InstCombine] Dropping redundant masking before left-shift [1/5] (PR42563)

Summary:
If we have some pattern that leaves only some low bits set, and then performs
left-shift of those bits, if none of the bits that are left after the final
shift are modified by the mask, we can omit the mask.

There are many variants to this pattern:
b. `(x & (~(-1 << maskNbits))) << shiftNbits`
All these patterns can be simplified to just:
`x << ShiftShAmt`
iff:
b. `(MaskShAmt+ShiftShAmt) u>= bitwidth(x)`

alive proof:
b: https://rise4fun.com/Alive/y8M

For now let's start with patterns where both shift amounts are variable,
with trivial constant "offset" between them, since i believe this is
both simplest to handle and i think this is most common.
But again, there are likely other variants where we could use
ValueTracking/ConstantRange to handle more cases.

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

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

llvm-svn: 366536

5 years ago[InstCombine] Dropping redundant masking before left-shift [0/5] (PR42563)
Roman Lebedev [Fri, 19 Jul 2019 08:25:43 +0000 (08:25 +0000)]
[InstCombine] Dropping redundant masking before left-shift [0/5] (PR42563)

Summary:
If we have some pattern that leaves only some low bits set, and then performs
left-shift of those bits, if none of the bits that are left after the final
shift are modified by the mask, we can omit the mask.

There are many variants to this pattern:
a. `(x & ((1 << MaskShAmt) - 1)) << ShiftShAmt`
All these patterns can be simplified to just:
`x << ShiftShAmt`
iff:
a. `(MaskShAmt+ShiftShAmt) u>= bitwidth(x)`

alive proof:
a: https://rise4fun.com/Alive/wi9

Indeed, not all of these patterns are canonical.
But since this fold will only produce a single instruction
i'm really interested in handling even uncanonical patterns,
since i have this general kind of pattern in hotpaths,
and it is not totally outlandish for bit-twiddling code.

For now let's start with patterns where both shift amounts are variable,
with trivial constant "offset" between them, since i believe this is
both simplest to handle and i think this is most common.
But again, there are likely other variants where we could use
ValueTracking/ConstantRange to handle more cases.

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

Reviewers: spatel, nikic, huihuiz, xbolva00

Reviewed By: xbolva00

Subscribers: efriedma, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 366535

5 years ago[ELF][test] Fix aarch64-condb-reloc.s
Fangrui Song [Fri, 19 Jul 2019 08:00:22 +0000 (08:00 +0000)]
[ELF][test] Fix aarch64-condb-reloc.s

llvm-svn: 366534

5 years ago[NFC] Fix an indentation issue in llvm/Support/TargetRegistry.h
Hubert Tong [Fri, 19 Jul 2019 07:21:59 +0000 (07:21 +0000)]
[NFC] Fix an indentation issue in llvm/Support/TargetRegistry.h

llvm-svn: 366533

5 years ago[ELF][AArch64] Improve some aarch64-*.s tests
Fangrui Song [Fri, 19 Jul 2019 06:33:36 +0000 (06:33 +0000)]
[ELF][AArch64] Improve some aarch64-*.s tests

* Delete aarch64-tls-static.s: it is covered by aarch64-tlsdesc.c
* Add --no-show-raw-insn to llvm-objdump -d tests
* When linking an executable with %t.so, the path %t.so will be recorded in the DT_NEEDED entry if %t.so doesn't have DT_SONAME. The DT_NEEDED has varying lengths on different systems.
  Add -soname to make tests more robust. This issue will become outstanding if we allow overlapping PT_LOAD (D64930).

llvm-svn: 366532

5 years ago[DebugInfo] Some fields do not need relocations even relax is enabled.
Hsiangkai Wang [Fri, 19 Jul 2019 06:10:36 +0000 (06:10 +0000)]
[DebugInfo] Some fields do not need relocations even relax is enabled.

In debug frame information, some fields, e.g., Length in CIE/FDE and
Offset in FDE are attributes to describe the structure of CIE/FDE. They
are not related to the relaxed code. However, these attributes are
symbol differences. So, in current design, these attributes will be
filled as zero and LLVM generates relocations for them.

We only need to generate relocations for symbols in executable sections.
So, if the symbols are not located in executable sections, we still
evaluate their values under relaxation.

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

llvm-svn: 366531

5 years agounbreak links
Chris Lattner [Fri, 19 Jul 2019 05:49:11 +0000 (05:49 +0000)]
unbreak links

llvm-svn: 366530

5 years agoreplace the old kaleidoscope tutorial files with orphaned pages that forward to the...
Chris Lattner [Fri, 19 Jul 2019 05:23:17 +0000 (05:23 +0000)]
replace the old kaleidoscope tutorial files with orphaned pages that forward to the new copy.

llvm-svn: 366529

5 years agoPoint to the dusted off version of the kaleidoscope tutorial.
Chris Lattner [Fri, 19 Jul 2019 05:15:57 +0000 (05:15 +0000)]
Point to the dusted off version of the kaleidoscope tutorial.

llvm-svn: 366528

5 years ago[test] [llvm-objcopy] Fix broken test case
Alex Brachet [Fri, 19 Jul 2019 02:31:21 +0000 (02:31 +0000)]
[test] [llvm-objcopy] Fix broken test case

Summary: The test case added in D62718 did not work unless the user was root because write bits were not set for the output file. This change uses only permissions with user write (0200) to ensure tests pass regardless of the users permissions.

Reviewers: jhenderson, rupprecht, MaskRay, espindola, alexshap

Reviewed By: MaskRay

Subscribers: emaste, arichardson, jakehehrlich, llvm-commits

Tags: #llvm

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

llvm-svn: 366527

5 years ago[NFC][PowerPC] Modify the test case add_cmp.ll
Kang Zhang [Fri, 19 Jul 2019 02:23:26 +0000 (02:23 +0000)]
[NFC][PowerPC] Modify the test case add_cmp.ll

llvm-svn: 366526

5 years ago[libFuzzer] Set Android specific ALL_FUZZER_SUPPORTED_ARCH
Yi Kong [Fri, 19 Jul 2019 02:07:46 +0000 (02:07 +0000)]
[libFuzzer] Set Android specific ALL_FUZZER_SUPPORTED_ARCH

Build libFuzzer for all Android supported architectures.

llvm-svn: 366525

5 years ago[DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame.
Hsiangkai Wang [Fri, 19 Jul 2019 02:03:34 +0000 (02:03 +0000)]
[DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame.

It is necessary to generate fixups in .debug_frame or .eh_frame as
relaxation is enabled due to the address delta may be changed after
relaxation.

There is an opcode with 6-bits data in debug frame encoding. So, we
also need 6-bits fixup types.

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

llvm-svn: 366524

5 years agoUse the MachineBasicBlock symbol for a callbr target
Bill Wendling [Fri, 19 Jul 2019 01:10:28 +0000 (01:10 +0000)]
Use the MachineBasicBlock symbol for a callbr target

Summary:
Inline asm doesn't use labels when compiled as an object file. Therefore, we
shouldn't create one for the (potential) callbr destination. Instead, use the
symbol for the MachineBasicBlock.

Reviewers: nickdesaulniers, craig.topper

Reviewed By: nickdesaulniers

Subscribers: xbolva00, llvm-commits

Tags: #llvm

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

llvm-svn: 366523

5 years ago[Target] Fix formatting and whitespace (NFC)
Jonas Devlieghere [Fri, 19 Jul 2019 00:56:26 +0000 (00:56 +0000)]
[Target] Fix formatting and whitespace (NFC)

llvm-svn: 366522

5 years ago[Target] Return an llvm::Expected from GetEntryPointAddress (NFC)
Jonas Devlieghere [Fri, 19 Jul 2019 00:52:08 +0000 (00:52 +0000)]
[Target] Return an llvm::Expected from  GetEntryPointAddress (NFC)

Instead of taking a status and potentially returning an invalid address,
return an expected which is guaranteed to contain a valid address.

llvm-svn: 366521

5 years agocheck for interrupt from fgets on Windows
Nathan Lanza [Fri, 19 Jul 2019 00:40:37 +0000 (00:40 +0000)]
check for interrupt from fgets on Windows

Windows does not have the error EINTR when a blocking syscall is
interrupted by a signal. The ReadFile API that fgets is implemented
with instead use ERROR_OPERATION_ABORTED. Check for that after fgets.

llvm-svn: 366520

5 years ago[NFC] Remove instances of unused ClangASTContext header
Alex Langford [Fri, 19 Jul 2019 00:39:51 +0000 (00:39 +0000)]
[NFC] Remove instances of unused ClangASTContext header

llvm-svn: 366519

5 years agoFix formatting of inline argument comments. NFC.
Sam Clegg [Fri, 19 Jul 2019 00:30:23 +0000 (00:30 +0000)]
Fix formatting of inline argument comments. NFC.

Also, remove the final arg from ItaniumCXXABI in the PNaCl case since
its not needed.

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

llvm-svn: 366518

5 years ago[Commands] Remove unused header from CommandObjectFrame
Alex Langford [Fri, 19 Jul 2019 00:26:31 +0000 (00:26 +0000)]
[Commands] Remove unused header from CommandObjectFrame

llvm-svn: 366517

5 years ago[GlobalISel] Translate calls to memcpy et al to G_INTRINSIC_W_SIDE_EFFECTs and legali...
Amara Emerson [Fri, 19 Jul 2019 00:24:45 +0000 (00:24 +0000)]
[GlobalISel] Translate calls to memcpy et al to G_INTRINSIC_W_SIDE_EFFECTs and legalize later.

I plan on adding memcpy optimizations in the GlobalISel pipeline, but we can't
do that unless we delay lowering to actual function calls. This patch changes
the translator to generate G_INTRINSIC_W_SIDE_EFFECTS for these functions, and
then have each target specify that using the new custom legalizer for intrinsics
hook that they want it expanded it a libcall.

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

llvm-svn: 366516

5 years ago[cmake] Fix typo where a varible was checked for Apple instead of Darwin
Nathan Lanza [Fri, 19 Jul 2019 00:20:58 +0000 (00:20 +0000)]
[cmake] Fix typo where a varible was checked for Apple instead of Darwin

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 366515

5 years ago[cmake] Convert the NATIVE llvm build process to be project agnostic
Nathan Lanza [Fri, 19 Jul 2019 00:10:06 +0000 (00:10 +0000)]
[cmake] Convert the NATIVE llvm build process to be project agnostic

lldb recently added a tablegen tool. In order to properly cross compile
lldb standalone there needs to be a mechanism to generate the native
lldb build, analgous to what's done for the NATIVE llvm build. Thus,
we can simply modify this setup to allow for any project to be used.

llvm-svn: 366514

5 years ago[cmake] Update NATIVE build variables to account for standalone changes
Nathan Lanza [Thu, 18 Jul 2019 23:40:23 +0000 (23:40 +0000)]
[cmake] Update NATIVE build variables to account for standalone changes

Summary:
LLDB_PATH_TO_{CLANG,LLVM}_BUILD were removed and replaced with
{LLVM,Clang}_DIR. Adjust the NATIVE build to account for this.

Subscribers: mgorny

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

llvm-svn: 366513

5 years agoReapply [llvm-lipo] Implement -create (with hardcoded alignments)
Shoaib Meenai [Thu, 18 Jul 2019 22:48:38 +0000 (22:48 +0000)]
Reapply [llvm-lipo] Implement -create (with hardcoded alignments)

This reapplies r366142 with a fix for the failing Windows test.

Original commit message:

Creates universal binary output file from input files. Currently uses
hard coded value for alignment.  Want to get the create functionality
approved before implementing the alignment function.

Patch by Anusha Basana <anusha.basana@gmail.com>

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

llvm-svn: 366512

5 years agoUpdate the SimpleJIT class in the clang-interpreter example to use ORCv2.
Lang Hames [Thu, 18 Jul 2019 22:47:18 +0000 (22:47 +0000)]
Update the SimpleJIT class in the clang-interpreter example to use ORCv2.

This will remove the ORCv1 deprecation warnings.

llvm-svn: 366511

5 years agoUpdate polly test for SCEV change.
Eli Friedman [Thu, 18 Jul 2019 22:35:45 +0000 (22:35 +0000)]
Update polly test for SCEV change.

r366419 adds nsw to more SCEV expressions, which allows polly to
make more aggressive assumptions about the input expressions.

llvm-svn: 366510

5 years ago[clang-scan-deps] Dependency directives source minimizer: handle #pragma once
Alex Lorenz [Thu, 18 Jul 2019 22:33:14 +0000 (22:33 +0000)]
[clang-scan-deps] Dependency directives source minimizer: handle #pragma once

We should re-emit `#pragma once` to ensure the preprocessor will
still honor it when running on minimized sources.

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

llvm-svn: 366509

5 years agoRemember to sort the Xcode project!!!
Jim Ingham [Thu, 18 Jul 2019 22:25:56 +0000 (22:25 +0000)]
Remember to sort the Xcode project!!!

llvm-svn: 366508

5 years agoAdd an expectedFailure test for type finding.
Jim Ingham [Thu, 18 Jul 2019 22:21:16 +0000 (22:21 +0000)]
Add an expectedFailure test for type finding.

When two .c files define a type of the same name, lldb
just picks one and uses it regardless of context.  That is
not correct.  When stopped in a frame in one of the .c files
that define this type, it should use that local definition.

This commit just adds a test that checks for the correct
behavior.  It is currently xfailed.

llvm-svn: 366507

5 years agoThe switch to table-genning command options broke
Jim Ingham [Thu, 18 Jul 2019 22:18:50 +0000 (22:18 +0000)]
The switch to table-genning command options broke
the xcode project.  This gets it a little closer to
working, but I still have to figure out how to generate
the lldb tablegen backend from the Xcode project.

llvm-svn: 366506

5 years ago[AMDGPU] Drop Reg32 and use regular AsmName
Stanislav Mekhanoshin [Thu, 18 Jul 2019 22:18:33 +0000 (22:18 +0000)]
[AMDGPU] Drop Reg32 and use regular AsmName

This allows to reduce generated AMDGPUGenAsmWriter.inc by ~100Kb.

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

llvm-svn: 366505

5 years ago[WebAssembly] Use passive segments by default when memory is shared
Thomas Lively [Thu, 18 Jul 2019 21:50:24 +0000 (21:50 +0000)]
[WebAssembly] Use passive segments by default when memory is shared

Summary:
This change makes it so that passing --shared-memory is all a user
needs to do to get proper multithreaded code. This default can still
be explicitly overridden for any reason using --passive-segments and
--active-segments.

Reviewers: sbc100, quantum

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

Tags: #llvm

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

llvm-svn: 366504

5 years ago[GlobalISel][AArch64] Add support for base register + offset register loads
Jessica Paquette [Thu, 18 Jul 2019 21:50:11 +0000 (21:50 +0000)]
[GlobalISel][AArch64] Add support for base register + offset register loads

Add support for folding G_GEPs into loads of the form

```
ldr reg, [base, off]
```

when possible. This can save an add before the load. Currently, this is only
supported for loads of 64 bits into 64 bit registers.

Add a new addressing mode function, `selectAddrModeRegisterOffset` which
performs this folding when it is profitable.

Also add a test for addressing modes for G_LOAD.

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

llvm-svn: 366503

5 years agoCodeGen: Allow !associated metadata to point to aliases.
Peter Collingbourne [Thu, 18 Jul 2019 21:37:16 +0000 (21:37 +0000)]
CodeGen: Allow !associated metadata to point to aliases.

This is a small extension of !associated, mostly useful for the implementation
convenience of instrumentation passes that RAUW globals with aliases, such
as LowerTypeTests.

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

llvm-svn: 366502

5 years agoRevert [X86] EltsFromConsecutiveLoads - support common source loads
Reid Kleckner [Thu, 18 Jul 2019 21:26:41 +0000 (21:26 +0000)]
Revert [X86] EltsFromConsecutiveLoads - support common source loads

This reverts r366441 (git commit 48104ef7c9c653bbb732b66d7254957389fea337)

This causes clang to fail to compile some file in Skia. Reduction soon.

llvm-svn: 366501

5 years ago[WebAssembly] fix bug in finding .tdata segment
Guanzhong Chen [Thu, 18 Jul 2019 21:18:24 +0000 (21:18 +0000)]
[WebAssembly] fix bug in finding .tdata segment

Summary: Fix bug in `wasm-ld`'s `Writer::createInitTLSFunction` that only finds `.tdata` if it's the first section.

Reviewers: tlively, aheejin, sbc100

Reviewed By: sbc100

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

Tags: #llvm

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

llvm-svn: 366500

5 years ago[WebAssembly] Fix __builtin_wasm_tls_base intrinsic
Guanzhong Chen [Thu, 18 Jul 2019 21:17:52 +0000 (21:17 +0000)]
[WebAssembly] Fix __builtin_wasm_tls_base intrinsic

Summary:
Properly generate the outchain for the `__builtin_wasm_tls_base` intrinsic.

Also marked the intrinsic pure, per @sunfish's suggestion.

Reviewers: tlively, aheejin, sbc100, sunfish

Reviewed By: tlively

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

Tags: #clang, #llvm

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

llvm-svn: 366499

5 years ago[cmake] Only run llvm-codesign if targetting apple on an apple host
Nathan Lanza [Thu, 18 Jul 2019 21:14:26 +0000 (21:14 +0000)]
[cmake] Only run llvm-codesign if targetting apple on an apple host

Summary:
Other platforms don't have the capability to perform llvm_codesign
step. If LLVM_CODESIGNING_IDENTITY is set then this chunk of code would
attempt to codesign if the target was Apple. But when cross compiling
to Darwin from Linux, for example, this step would fail. So test if the
host is Apple as well.

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 366498

5 years agoFix typo in r366494. Spotted by Yuanfang Chen.
Peter Collingbourne [Thu, 18 Jul 2019 21:03:37 +0000 (21:03 +0000)]
Fix typo in r366494. Spotted by Yuanfang Chen.

llvm-svn: 366497

5 years agoRemove the static initialize introduced in r365099
Steven Wu [Thu, 18 Jul 2019 21:01:21 +0000 (21:01 +0000)]
Remove the static initialize introduced in r365099

Summary:
Some polish for r365099 which adds a static initializer to
MachOObjectFile. Remove it by moving it to file scope.

Reviewers: smeenai, alexshap, compnerd, mtrent, anushabasana

Reviewed By: smeenai

Subscribers: hiraditya, jkorous, dexonsmith, llvm-commits

Tags: #llvm

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

llvm-svn: 366496

5 years ago[Breakpoint] Replace use of ClangASTContext with TypeSystem
Alex Langford [Thu, 18 Jul 2019 20:58:24 +0000 (20:58 +0000)]
[Breakpoint] Replace use of ClangASTContext with TypeSystem

llvm-svn: 366495

5 years agoIR: Teach Constant::needsRelocation() that relative pointers don't need to be relocated.
Peter Collingbourne [Thu, 18 Jul 2019 20:56:21 +0000 (20:56 +0000)]
IR: Teach Constant::needsRelocation() that relative pointers don't need to be relocated.

This causes sections with relative pointers to be marked as read only,
which means that they won't end up sharing pages with writable data.

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

llvm-svn: 366494

5 years agoFall back to dyld's _dyld_start when no LC_MAIN / main() func can be found
Jason Molenda [Thu, 18 Jul 2019 20:55:24 +0000 (20:55 +0000)]
Fall back to dyld's _dyld_start when no LC_MAIN / main() func can be found

The new DriverKit user-land kernel drivers in macOS 10.15 / Catalina
do not have a main() function or an LC_MAIN load command.  lldb uses
the address of main() as the return address for inferior function
calls; it puts a breakpoint on main, runs the inferior function call,
and when the main() breakpoint is hit, lldb knows unambiguously that
the inferior function call ran to completion - no other function calls
main.

This change hoists the logic for finding the "entry address" from
ThreadPlanCallFunction to Target.  It changes the logic to first
try to get the entry address from the main executable module,
but if that module does not have one, it will iterate through all
modules looking for an entry address.

The patch also adds code to ObjectFileMachO to use dyld's
_dyld_start function as an entry address.

<rdar://problem/52343958>

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

llvm-svn: 366493

5 years ago[NFC][pstl] Run clang-format on the sources, including the tests
Louis Dionne [Thu, 18 Jul 2019 20:22:28 +0000 (20:22 +0000)]
[NFC][pstl] Run clang-format on the sources, including the tests

llvm-svn: 366492

5 years ago[pstl] Fix test that checked the version number after version bump
Louis Dionne [Thu, 18 Jul 2019 20:21:59 +0000 (20:21 +0000)]
[pstl] Fix test that checked the version number after version bump

llvm-svn: 366491

5 years ago[pstl] Declare main() as returning int, not int32_t
Louis Dionne [Thu, 18 Jul 2019 20:21:52 +0000 (20:21 +0000)]
[pstl] Declare main() as returning int, not int32_t

llvm-svn: 366490

5 years ago[FileSpecList] Add EmplaceBack method (NFC)
Jonas Devlieghere [Thu, 18 Jul 2019 20:19:24 +0000 (20:19 +0000)]
[FileSpecList] Add EmplaceBack method (NFC)

Instead of having to write FileSpecList::Append(FileSpec(args)) you can
now call FileSpecList::EmplaceBack(args), similar to
std::vector<>::emplace_back.

llvm-svn: 366489

5 years ago[ASan] Support `{f}puts(NULL)` on Darwin, part 2
Julian Lettner [Thu, 18 Jul 2019 20:14:50 +0000 (20:14 +0000)]
[ASan] Support `{f}puts(NULL)` on Darwin, part 2

Add braces around macro `{ MACRO(); }` to guard against macros that
expand to multiple statements.

llvm-svn: 366488

5 years agogn build: Merge r366458.
Peter Collingbourne [Thu, 18 Jul 2019 20:14:16 +0000 (20:14 +0000)]
gn build: Merge r366458.

llvm-svn: 366487

5 years agoFileSystem: Check for DTTOIF alone, not _DIRENT_HAVE_D_TYPE
Jordan Rose [Thu, 18 Jul 2019 20:05:11 +0000 (20:05 +0000)]
FileSystem: Check for DTTOIF alone, not _DIRENT_HAVE_D_TYPE

While 'd_type' is a non-standard extension to `struct dirent`, only
glibc signals its presence with a macro '_DIRENT_HAVE_D_TYPE'.
However, any platform with 'd_type' also includes a way to convert to
mode_t values using the macro 'DTTOIF', so we can check for that alone
and still be confident that the 'd_type' member exists.

(If this turns out to be wrong, I'll go back and set up an actual
CMake check.)

I couldn't think of how to write a test for this, because I couldn't
think of how to test that a 'stat' call doesn't happen without
controlling the filesystem or intercepting 'stat', and there's no good
cross-platform way to do that that I know of.

Follow-up (almost a year later) to r342089.

rdar://problem/50592673
https://reviews.llvm.org/D64940

llvm-svn: 366486

5 years ago[ORC] Suppress an ORCv1 deprecation warning.
Lang Hames [Thu, 18 Jul 2019 19:55:42 +0000 (19:55 +0000)]
[ORC] Suppress an ORCv1 deprecation warning.

llvm-svn: 366485

5 years ago[libc++] Add C++17 deduction guides for std::function
Louis Dionne [Thu, 18 Jul 2019 19:50:56 +0000 (19:50 +0000)]
[libc++] Add C++17 deduction guides for std::function

Summary: http://llvm.org/PR39606

Reviewers: Quuxplusone

Subscribers: christof, dexonsmith, libcxx-commits

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

llvm-svn: 366484

5 years ago[OPENMP]Fix sharing of threadprivate variables with TLS support.
Alexey Bataev [Thu, 18 Jul 2019 19:40:24 +0000 (19:40 +0000)]
[OPENMP]Fix sharing of threadprivate variables with TLS support.

If the threadprivate variable is used in the copyin clause on inner
parallel directive with TLS support, we capture this variable in all
outer OpenMP scopes. It leads to the fact that in all scopes we're
working with the original variable, not the threadprivate copies.

llvm-svn: 366483

5 years ago[compiler-rt] Complete revert of r366413
Matthew Voss [Thu, 18 Jul 2019 18:39:06 +0000 (18:39 +0000)]
[compiler-rt] Complete revert of r366413

Incomplete revert. Mea culpa. This test is failing on sanitizer-x86_64-linux
and our internal CI.

llvm-svn: 366482

5 years agoFix C++ modules build
Raphael Isemann [Thu, 18 Jul 2019 18:33:40 +0000 (18:33 +0000)]
Fix C++ modules build

llvm-svn: 366344 missed an include that broke the LLVM_ENABLE_MODULES
build.

llvm-svn: 366481

5 years ago[RISCV] Hard float ABI support
Alex Bradbury [Thu, 18 Jul 2019 18:29:59 +0000 (18:29 +0000)]
[RISCV] Hard float ABI support

The RISC-V hard float calling convention requires the frontend to:

* Detect cases where, once "flattened", a struct can be passed using
int+fp or fp+fp registers under the hard float ABI and coerce to the
appropriate type(s)
* Track usage of GPRs and FPRs in order to gate the above, and to
determine when signext/zeroext attributes must be added to integer
scalars

This patch attempts to do this in compliance with the documented ABI,
and uses ABIArgInfo::CoerceAndExpand in order to do this. @rjmccall, as
author of that code I've tagged you as reviewer for initial feedback on
my usage.

Note that a previous version of the ABI indicated that when passing an
int+fp struct using a GPR+FPR, the int would need to be sign or
zero-extended appropriately. GCC never did this and the ABI was changed,
which makes life easier as ABIArgInfo::CoerceAndExpand can't currently
handle sign/zero-extension attributes.

Re-landed after backing out 366450 due to missed hunks.

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

llvm-svn: 366480

5 years ago[COFF] Change a variable type to be const in the HeapAllocSite map.
Amy Huang [Thu, 18 Jul 2019 18:22:52 +0000 (18:22 +0000)]
[COFF] Change a variable type to be const in the HeapAllocSite map.

llvm-svn: 366479

5 years ago[lldb][swig] Fix autodocs flag parsing
Jordan Rupprecht [Thu, 18 Jul 2019 18:18:51 +0000 (18:18 +0000)]
[lldb][swig] Fix autodocs flag parsing

r366471 added "-features autodoc" without a trailing comment, leading to `Unrecognized option -features autodoc-threads` due to implicit string concatenation. Add a comma to fix that.

Also separate into "-features" and "autodoc", otherwise it gets parsed as a single "-features autodoc" flag which is also not recognized (it must be two separate CLI args).

llvm-svn: 366478

5 years ago[FPEnv] Teach the IRBuilder about constrained FPTrunc and FPExt
Kevin P. Neal [Thu, 18 Jul 2019 18:01:57 +0000 (18:01 +0000)]
[FPEnv] Teach the IRBuilder about constrained FPTrunc and FPExt

The IRBuilder doesn't know that FPTrunc and FPExt have constrained
equivalents. Add the support by building on the strict FP mode now
present in the IRBuilder.

Reviewed by: John McCall
Approved by: John McCall
Differential Revision: https://reviews.llvm.org/D64934

llvm-svn: 366477

5 years agoAdd offsetof support to expression evaluator.
Raphael Isemann [Thu, 18 Jul 2019 17:58:04 +0000 (17:58 +0000)]
Add offsetof support to expression evaluator.

Summary:
We currently don't support offsetof in the expression evaluator as it is implemented as a macro
(which then calls __builtin_offsetof) in stddef.h. The best solution would be to include that
header (or even better, import Clang's builtin module), but header-parsing and
(cross-platform) importing modules is not ready yet.

Until we get this working with modules I would say we add the macro to our existing macro list
as we already do with other macros from stddef.h/stdint.h. We should be able to drop all of them
once we can import the relevant modules by default.

rdar://26040641

Reviewers: shafik, davide

Reviewed By: davide

Subscribers: clayborg, lldb-commits

Tags: #lldb

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

llvm-svn: 366476

5 years ago[WebAssembly] Implement __builtin_wasm_tls_base intrinsic
Guanzhong Chen [Thu, 18 Jul 2019 17:53:22 +0000 (17:53 +0000)]
[WebAssembly] Implement __builtin_wasm_tls_base intrinsic

Summary:
Add `__builtin_wasm_tls_base` so that LeakSanitizer can find the thread-local
block and scan through it for memory leaks.

Reviewers: tlively, aheejin, sbc100

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

Tags: #clang, #llvm

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

llvm-svn: 366475

5 years ago[OPENMP]Provide correct data sharing attributes for loop control
Alexey Bataev [Thu, 18 Jul 2019 17:49:13 +0000 (17:49 +0000)]
[OPENMP]Provide correct data sharing attributes for loop control
variables.

Loop control variables are private in loop-based constructs and we shall
take this into account when generate the code for inner constructs.
Currently, those variables are reported as shared in many cases. Moved
the analysis of the data-sharing attributes of the loop control variable
to an early semantic stage to correctly handle their attributes.

llvm-svn: 366474

5 years ago[LibTooling] Relax Transformer to allow rewriting macro expansions
Yitzhak Mandelbaum [Thu, 18 Jul 2019 17:44:54 +0000 (17:44 +0000)]
[LibTooling] Relax Transformer to allow rewriting macro expansions

Summary:
Currently, Transformer rejects any changes to source locations inside macro
expansions. This change relaxes that constraint to allow rewrites when the
entirety of the expansion is replaced, since that can be mapped to replacing the
entirety of the expansion range in the file source.  This change makes
Transformer consistent with the handling of edit ranges in `clang::edit::Commit`
(which is used, for example, for applying `FixItHint`s from diagnostics).

Reviewers: ilya-biryukov

Subscribers: gribozavr, cfe-commits

Tags: #clang

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

llvm-svn: 366473

5 years agoRevert "Fix asan infinite loop on undefined symbol"
Matthew Voss [Thu, 18 Jul 2019 17:43:44 +0000 (17:43 +0000)]
Revert "Fix asan infinite loop on undefined symbol"

This reverts commit 63719119c78ca965b5d80e5c20fcfe81ba28f896.

The tests in this commit were failing on a Linux sanitizer bot
and our internal CI.

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/22401/steps/test%20standalone%20compiler-rt%20with%20symbolizer/logs/stdio

llvm-svn: 366472

5 years ago[swig] Enable autodoc feature
Jonas Devlieghere [Thu, 18 Jul 2019 17:40:30 +0000 (17:40 +0000)]
[swig] Enable autodoc feature

This patch enables the SWIG `autodoc` feature so that the generated
Python reference [1] includes class properties.

[1] https://lldb.llvm.org/python_reference/index.html

llvm-svn: 366471

5 years ago[LAA] Re-check bit-width of pointers after stripping.
Michael Liao [Thu, 18 Jul 2019 17:30:27 +0000 (17:30 +0000)]
[LAA] Re-check bit-width of pointers after stripping.

Summary:
- As the pointer stripping now tracks through `addrspacecast`, prepare
  to handle the bit-width difference from the result pointer.

Reviewers: jdoerfert

Subscribers: jvesely, nhaehnle, hiraditya, arphaman, llvm-commits

Tags: #llvm

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

llvm-svn: 366470

5 years ago[LibTooling] Add function to translate and validate source range for editing
Yitzhak Mandelbaum [Thu, 18 Jul 2019 17:26:57 +0000 (17:26 +0000)]
[LibTooling] Add function to translate and validate source range for editing

Summary:
Adds the function `getRangeForEdit` to validate that a given source range is
editable and, if needed, translate it into a range in the source file (for
example, if it's sourced in macro expansions).

Reviewers: ilya-biryukov

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 366469

5 years ago[clangd] Remove dead code from BackgroundIndex
Kadir Cetinkaya [Thu, 18 Jul 2019 17:25:57 +0000 (17:25 +0000)]
[clangd] Remove dead code from BackgroundIndex

llvm-svn: 366468

5 years ago[clangd] BackgroundIndex stores shards to the closest project
Kadir Cetinkaya [Thu, 18 Jul 2019 17:20:41 +0000 (17:20 +0000)]
[clangd] BackgroundIndex stores shards to the closest project

Summary:
Changes persistance logic to store shards at the directory of closest
CDB. Previously we were storing all shards to directory of the CDB that
triggered indexing, it had its downsides.

For example, if you had two TUs coming from a different CDB but depending on the
same header foo.h, we will store the foo.h only for the first CDB, and it would
be missing for the second and we would never persist it since it was actually
present in the memory and persisted before.

This patch still stores only a single copy of a shard, but makes the directory a
function of the file name. So that the shard place will be unique even with
multiple CDBs accessing the file. This directory is determined as the first
directory containing a CDB in the file's parent directories, if no such
directory exists we make use of the home directory.

Reviewers: sammccall

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

Tags: #clang

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

llvm-svn: 366467

5 years agoELF: Add support for remaining R_AARCH64_MOVW* relocations.
Peter Collingbourne [Thu, 18 Jul 2019 17:12:50 +0000 (17:12 +0000)]
ELF: Add support for remaining R_AARCH64_MOVW* relocations.

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

llvm-svn: 366466

5 years ago[LLDB] Remove lldb-mi
Jonas Devlieghere [Thu, 18 Jul 2019 17:06:06 +0000 (17:06 +0000)]
[LLDB] Remove lldb-mi

As discussed on the mailing list [1], this patch removes the lldb-mi
tool and its tests from the LLDB repository. We moved lldb-mi into a
separate repository on GitHub [2] for downstream users or maintainers to
build and package.

[1] http://lists.llvm.org/pipermail/lldb-dev/2019-July/015103.html
[2] https://github.com/lldb-tools/lldb-mi

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

llvm-svn: 366465

5 years ago[NFC][llvm-readobj] Refactor dynamic string table indexing into a function.
Yuanfang Chen [Thu, 18 Jul 2019 17:04:28 +0000 (17:04 +0000)]
[NFC][llvm-readobj] Refactor dynamic string table indexing into a function.

Restore printDynamicString removed in rL363868. It provides better
error handling whenever indexing dynamic string table is needed.

Reviewers: jhenderson, MaskRay, grimar

Reviewed by: jhenderson, MaskRay, grimar

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

llvm-svn: 366464

5 years agoELF: Simplify test. NFCI.
Peter Collingbourne [Thu, 18 Jul 2019 16:57:06 +0000 (16:57 +0000)]
ELF: Simplify test. NFCI.

Avoid splitting the test into multiple files and use zero for the value of
the symbol with addends at relocations so that it's clear what value is
being used at relocations.

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

llvm-svn: 366463

5 years agoMC: AArch64: Add support for prel_g* relocation specifiers.
Peter Collingbourne [Thu, 18 Jul 2019 16:54:33 +0000 (16:54 +0000)]
MC: AArch64: Add support for prel_g* relocation specifiers.

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

llvm-svn: 366462

5 years agoAArch64: Unify relocation restrictions between MOVK/MOVN/MOVZ.
Peter Collingbourne [Thu, 18 Jul 2019 16:51:53 +0000 (16:51 +0000)]
AArch64: Unify relocation restrictions between MOVK/MOVN/MOVZ.

There doesn't seem to be a practical reason for these instructions to have
different restrictions on the types of relocations that they may be used
with, notwithstanding the language in the ELF AArch64 spec that implies that
specific relocations are meant to be used with specific instructions.

For example, we currently forbid the first instruction in the following
sequence, despite it currently being used by clang to generate a global
reference under -mcmodel=large:

movz x0, #:abs_g0_nc:foo
movk x0, #:abs_g1_nc:foo
movk x0, #:abs_g2_nc:foo
movk x0, #:abs_g3:foo

Therefore, allow MOVK/MOVN/MOVZ to accept the union of the set of relocations
that they currently accept individually.

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

llvm-svn: 366461

5 years agoELF: Allow forward references to linked sections.
Peter Collingbourne [Thu, 18 Jul 2019 16:47:29 +0000 (16:47 +0000)]
ELF: Allow forward references to linked sections.

It's possible to create IR that uses !associated to refer to a global that
appears later in the module, which can result in these types of forward
references being generated. Unfortunately our assembler does not currently
accept the resulting .s so I needed to use yaml2obj to test this.

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

llvm-svn: 366460