platform/upstream/llvm.git
5 years ago [CodeGen] Add a pass to do block predication on SSA machine IR.
Thomas Raoux [Tue, 20 Aug 2019 15:54:59 +0000 (15:54 +0000)]
[CodeGen] Add a pass to do block predication on SSA machine IR.

    For targets requiring aggressive scheduling and/or software pipeline we need to
    apply predication before preRA scheduling. This adds a pass re-using the early
    if-cvt infrastructure but generating predicated instructions instead of
    speculatively executing instructions. It allows doing if conversion on blocks
    containing instructions with side-effects. The pass re-use the target hook from
    postRA if-conversion to let the target decide on the heuristic to apply.

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

llvm-svn: 369395

5 years ago[libc++] std::abs should not return double
Zoe Carver [Tue, 20 Aug 2019 15:43:25 +0000 (15:43 +0000)]
[libc++] std::abs should not return double

Implement LWG Issue 2735 by adding std::abs
tests for several types and checking their
return value. NFC.

llvm-svn: 369394

5 years ago[libc++] Explicitly cast in generate_canonical
Louis Dionne [Tue, 20 Aug 2019 15:39:20 +0000 (15:39 +0000)]
[libc++] Explicitly cast in generate_canonical

A new clang warning introduced in r367497 was complaining about
the change in value.

Thanks to Brian Cain for the patch.
Differential Revision: https://reviews.llvm.org/D66422

llvm-svn: 369393

5 years ago[llvm-objcopy][test] Add a test to show that argv[0] is included in error/warning...
Fangrui Song [Tue, 20 Aug 2019 15:34:07 +0000 (15:34 +0000)]
[llvm-objcopy][test] Add a test to show that argv[0] is included in error/warning messages

test/llvm-objcopy/ELF/error-format.test is similar to test/llvm-readobj/error-format.test added in D66425.

Reviewed By: grimar, jhenderson

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

llvm-svn: 369392

5 years ago[llvm-objcopy] Append '\n' to warning messages
Fangrui Song [Tue, 20 Aug 2019 15:00:07 +0000 (15:00 +0000)]
[llvm-objcopy] Append '\n' to warning messages

Currently the warning message of `llvm-strip %t.o %t.o` does not include
the trailing newline. Fix this by appending a '\n'.

This is the only warning llvm-objcopy and llvm-strip can issue.

Reviewed By: jhenderson

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

llvm-svn: 369391

5 years ago[InstCombine] improve readability for icmp with cast folds; NFC
Sanjay Patel [Tue, 20 Aug 2019 14:56:44 +0000 (14:56 +0000)]
[InstCombine] improve readability for icmp with cast folds; NFC

1. Update function name and stale code comments.
2. Use variable names that are less ambiguous.
3. Move operand checks into the function as early exits.

llvm-svn: 369390

5 years ago[BlockExtractor] Avoid assert with wrong line format
Jinsong Ji [Tue, 20 Aug 2019 14:46:02 +0000 (14:46 +0000)]
[BlockExtractor] Avoid assert with wrong line format

Summary:
When the line format is wrong, we may end up accessing out of bound
memory. eg: the test with invalide line will cause assert.
Assertion `idx < size()' failed

The fix is to report fatal when we found mismatched line format.

Reviewers: qcolombet, volkan

Reviewed By: qcolombet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 369389

5 years ago[X86][BtVer2] Fix latency and throughput of atomic INC/DEC/NEG/NOT.
Andrea Di Biagio [Tue, 20 Aug 2019 14:31:27 +0000 (14:31 +0000)]
[X86][BtVer2] Fix latency and throughput of atomic INC/DEC/NEG/NOT.

Latency and throughput of LOCK INC/DEC/NEG/NOT is always 19cy.
Number of uOPs is still 1.

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

llvm-svn: 369388

5 years ago[clangd] Fix one testcase in XRefsTests.
Haojian Wu [Tue, 20 Aug 2019 14:07:27 +0000 (14:07 +0000)]
[clangd] Fix one testcase in XRefsTests.

Summary:
The test didn't test anything actually -- it used "[]" as annotation which should be
"[[]]".

This patch also fixes a bug in XRef where we may return duplicated refs.

Reviewers: ilya-biryukov

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

Tags: #clang

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

llvm-svn: 369387

5 years ago[InstCombine] simplify min/max of min/max with same operands (PR35607)
Sanjay Patel [Tue, 20 Aug 2019 13:39:17 +0000 (13:39 +0000)]
[InstCombine] simplify min/max of min/max with same operands (PR35607)

This is the original integer variant requested in:
https://bugs.llvm.org/show_bug.cgi?id=35607

As noted in the TODO and several similar TODOs around this block,
we could do this in instsimplify, but then it would cost more
because we would be trying to match min/max via ValueTracking
in 2 different places.

There are 4 commuted variants for each of smin/smax/umin/umax
that are not matched here. There are also icmp predicate variants
that are not included in the affected test file because they are
already handled by instsimplify by folding the final icmp to
true/false.

https://rise4fun.com/Alive/3KVc

  Name: smax(smax, smin)
  %c1 = icmp slt i32 %x, %y
  %c2 = icmp slt i32 %y, %x
  %min = select i1 %c1, i32 %x, i32 %y
  %max = select i1 %c2, i32 %x, i32 %y
  %c3 = icmp sgt i32 %max, %min
  %r = select i1 %c3, i32 %max, i32 %min
  =>
  %r = %max

  Name: smin(smax, smin)
  %c1 = icmp slt i32 %x, %y
  %c2 = icmp slt i32 %y, %x
  %min = select i1 %c1, i32 %x, i32 %y
  %max = select i1 %c2, i32 %x, i32 %y
  %c3 = icmp sgt i32 %max, %min
  %r = select i1 %c3, i32 %min, i32 %max
  =>
  %r = %min

  Name: umax(umax, umin)
  %c1 = icmp ult i32 %x, %y
  %c2 = icmp ult i32 %y, %x
  %min = select i1 %c1, i32 %x, i32 %y
  %max = select i1 %c2, i32 %x, i32 %y
  %c3 = icmp ult i32 %min, %max
  %r = select i1 %c3, i32 %max, i32 %min
  =>
  %r = %max

  Name: umin(umax, umin)
  %c1 = icmp ult i32 %x, %y
  %c2 = icmp ult i32 %y, %x
  %min = select i1 %c1, i32 %x, i32 %y
  %max = select i1 %c2, i32 %x, i32 %y
  %c3 = icmp ult i32 %min, %max
  %r = select i1 %c3, i32 %min, i32 %max
  =>
  %r = %min

llvm-svn: 369386

5 years ago[Syntax] Added function to get macro expansion tokens to TokenBuffer.
Johan Vikstrom [Tue, 20 Aug 2019 13:34:01 +0000 (13:34 +0000)]
[Syntax] Added function to get macro expansion tokens to TokenBuffer.

Summary:
Returns the first token in every mapping where the token is an identifier.
This API is required to be able to highlight macro expansions in clangd.

Reviewers: hokein, ilya-biryukov

Subscribers: kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 369385

5 years ago[X86][FMA] Add FMA 'negated expression' combine tests for D63141
Simon Pilgrim [Tue, 20 Aug 2019 13:25:55 +0000 (13:25 +0000)]
[X86][FMA] Add FMA 'negated expression' combine tests for D63141

llvm-svn: 369384

5 years agoRegex: +regex string lifetime comment
Jan Kratochvil [Tue, 20 Aug 2019 13:25:19 +0000 (13:25 +0000)]
Regex: +regex string lifetime comment

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

llvm-svn: 369383

5 years ago[llvm-objdump] - Remove one of `report_error` functions and improve the error reporting.
George Rimar [Tue, 20 Aug 2019 13:19:16 +0000 (13:19 +0000)]
[llvm-objdump] - Remove one of `report_error` functions and improve the error reporting.

One of the report_error functions was taking object::Archive::Child as an
argument. It feels excessive, this patch removes it and introduce a helper
function instead. Also I fixed a "TODO" in this patch what improved the message printed.

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

llvm-svn: 369382

5 years agoFix build for r369374
Pavel Labath [Tue, 20 Aug 2019 13:17:20 +0000 (13:17 +0000)]
Fix build for r369374

This patch added some gtest code to the TestingSupport library. As this
is not a unit test, but a unit test library, gtest does not get added to
the include path automatically, but we have to do that ourselves. (It
was working for me without this because the compiler picked up the
system gtest instead.)

llvm-svn: 369381

5 years agoRemoved the 'id' AST matcher, which is superseded by '.bind()'
Dmitri Gribenko [Tue, 20 Aug 2019 13:02:28 +0000 (13:02 +0000)]
Removed the 'id' AST matcher, which is superseded by '.bind()'

Summary:
The 'id' matcher is not even included in the AST Matchers Reference
document, so I don't expect there to be a significant number of users.

There's no reason to provide two ways to do the exact same thing that
only have a minor syntactic difference.

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 369380

5 years agoConvert minidump unittests to use llvm::yaml::convertYAML
Pavel Labath [Tue, 20 Aug 2019 12:53:42 +0000 (12:53 +0000)]
Convert minidump unittests to use llvm::yaml::convertYAML

previously they used a minidump-specific function for this purpose, but
this is no longer needed now that whole of yaml2obj is available as a
library.

llvm-svn: 369379

5 years ago[DWARF] Fix reading 64-bit DWARF type units.
Igor Kudrin [Tue, 20 Aug 2019 12:52:32 +0000 (12:52 +0000)]
[DWARF] Fix reading 64-bit DWARF type units.

The type_offset field is 8 bytes long in DWARF64. The patch extends
TypeOffset to uint64_t and fixes its reading. The patch also fixes
checking of TypeOffset bounds as it was inaccurate in DWARF64 case.

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

llvm-svn: 369378

5 years ago[llvm-readobj] Prepend argv[0] to error/warning messages
Fangrui Song [Tue, 20 Aug 2019 12:49:15 +0000 (12:49 +0000)]
[llvm-readobj] Prepend argv[0] to error/warning messages

Summary:
Currently, we report:

    error: ...

Prepend argv[0] (tool name):

    llvm-readobj: error: ...

This is consistent with most GNU binutils/clang/lld, and gives a bit
more context in a long build log.

Reviewed By: grimar, jhenderson, rupprecht

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

llvm-svn: 369377

5 years ago[InstCombine] add tests for min/max with min/max of same operands; NFC
Sanjay Patel [Tue, 20 Aug 2019 12:49:03 +0000 (12:49 +0000)]
[InstCombine] add tests for min/max with min/max of same operands; NFC

llvm-svn: 369376

5 years ago[RISCV] Implement getExprForFDESymbol to ensure RISCV_32_PCREL is used for the FDE...
Alex Bradbury [Tue, 20 Aug 2019 12:32:31 +0000 (12:32 +0000)]
[RISCV] Implement getExprForFDESymbol to ensure RISCV_32_PCREL is used for the FDE location

Follow binutils in using RISCV_32_PCREL for the FDE initial location. As
explained in the relevant binutils commit
<https://github.com/riscv/riscv-binutils-gdb/commit/a6cbf936e3dce68114d28cdf60d510a3f78a6d40>,
the ADD/SUB pair of relocations is problematic in the presence of linker
relaxation.

This patch has the same end goal as D64715 but includes test changes and
avoids adding a new global VariantKind to MCExpr.h (preferring
RISCVMCExpr VKs like the rest of the RISC-V backend).

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

llvm-svn: 369375

5 years agounittests: Use yaml2obj as a library instead of an external process
Pavel Labath [Tue, 20 Aug 2019 12:28:36 +0000 (12:28 +0000)]
unittests: Use yaml2obj as a library instead of an external process

Summary:
Recently, yaml2obj has been turned into a library. This means we can use
it from our unit tests directly, instead of shelling out to an external
process. This patch does just that.

Reviewers: JDevlieghere, aadsm, espindola, jdoerfert

Subscribers: emaste, mgorny, arichardson, MaskRay, jhenderson, abrachet, lldb-commits

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

llvm-svn: 369374

5 years ago[OpenCL] Add const, volatile and pointer builtin handling
Sven van Haastregt [Tue, 20 Aug 2019 12:21:03 +0000 (12:21 +0000)]
[OpenCL] Add const, volatile and pointer builtin handling

Const, volatile, and pointer types were previously available, but not
working.  This patch adds handling for OpenCL builtin functions.

Add TableGen definitions for some atomic and asynchronous builtins to
make use of the new functionality.

Patch by Pierre Gondois and Sven van Haastregt.

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

llvm-svn: 369373

5 years ago[cmake] Remove the test for libstdc++<4.9
Pavel Labath [Tue, 20 Aug 2019 12:17:42 +0000 (12:17 +0000)]
[cmake] Remove the test for libstdc++<4.9

It is no longer relevant now that llvm requires >=5.1.

llvm-svn: 369371

5 years agoRecommit "MemoryBuffer: Add a missing error-check to getOpenFileImpl"
Pavel Labath [Tue, 20 Aug 2019 12:08:52 +0000 (12:08 +0000)]
Recommit "MemoryBuffer: Add a missing error-check to getOpenFileImpl"

This recommits r368977, which was reverted in r369027 due to test
failures in lldb. The cause of this was different behavior of
readNativeFileSlice on windows and unix. These have been addressed in
r369269.

The original commit message was:
In case the function was called with a desired read size *and* the file
was not an "mmap()" candidate, the function was falling back to a
"pread()", but it was failing to check the result of that system call.
This meant that the function would return "success" even though the read
operation failed, and it returned a buffer full of uninitialized memory.

Reviewers: rnk, dblaikie

Subscribers: kristina, llvm-commits

Tags: #llvm

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

llvm-svn: 369370

5 years ago[CMake] Update C4324 MSVC warning comment to explain its still broken at VS2019
Simon Pilgrim [Tue, 20 Aug 2019 11:20:05 +0000 (11:20 +0000)]
[CMake] Update C4324 MSVC warning comment to explain its still broken at VS2019

As promised, I've updated the comment for the C4324 MSVC warning that was re-disabled at rL367409 / rG8f823e63e3edf87ab029ba32b68f3eb5d2f392b5 to put it in terms of currently supported VS versions

llvm-svn: 369368

5 years ago[MCA][X86] Add tests for LOCK variants of standard X86 arithmetic ops
Simon Pilgrim [Tue, 20 Aug 2019 11:13:20 +0000 (11:13 +0000)]
[MCA][X86] Add tests for LOCK variants of standard X86 arithmetic ops

D66424 adds the base support for LOCK so we should be able to add special case support for all these cases in future patches

llvm-svn: 369367

5 years agoFix MSVC "result of 32-bit shift implicitly converted to 64 bits" warning. NFCI.
Simon Pilgrim [Tue, 20 Aug 2019 10:25:57 +0000 (10:25 +0000)]
Fix MSVC "result of 32-bit shift implicitly converted to 64 bits" warning. NFCI.

llvm-svn: 369366

5 years ago[X86][Btver2] Fix latency and throughput of CMPXCHG instructions.
Andrea Di Biagio [Tue, 20 Aug 2019 10:23:55 +0000 (10:23 +0000)]
[X86][Btver2] Fix latency and throughput of CMPXCHG instructions.

On Jaguar, CMPXCHG has a latency of 11cy, and a maximum throughput of 0.33 IPC.
Throughput is superiorly limited to 0.33 because of the implicit in/out
dependency on register EAX. In the case of repeated non-atomic CMPXCHG with the
same memory location, store-to-load forwarding occurs and values for sequent
loads are quickly forwarded from the store buffer.

Interestingly, the functionality in LLVM that computes the reciprocal throughput
doesn't seem to know about RMW instructions. That functionality only looks at
the "consumed resource cycles" for the throughput computation. It should be
fixed/improved by a future patch. In particular, for RMW instructions, that
logic should also take into account for the write latency of in/out register
operands.

An atomic CMPXCHG has a latency of ~17cy. Throughput is also limited to
~17cy/inst due to cache locking, which prevents other memory uOPs to start
executing before the "lock releasing" store uOP.

CMPXCHG8rr and CMPXCHG8rm are treated specially because they decode to one less
macro opcode. Their latency tend to be the same as the other RR/RM variants. RR
variants are relatively fast 3cy (but still microcoded - 5 macro opcodes).

CMPXCHG8B is 11cy and unfortunately doesn't seem to benefit from store-to-load
forwarding. That means, throughput is clearly limited by the in/out dependency
on GPR registers. The uOP composition is sadly unknown (due to the lack of PMCs
for the Integer pipes). I have reused the same mix of consumed resource from the
other CMPXCHG instructions for CMPXCHG8B too.
LOCK CMPXCHG8B is instead 18cycles.

CMPXCHG16B is 32cycles. Up to 38cycles when the LOCK prefix is specified. Due to
the in/out dependencies, throughput is limited to 1 instruction every 32 (or 38)
cycles dependeing on whether the LOCK prefix is specified or not.
I wouldn't be surprised if the microcode for CMPXCHG16B is similar to 2x
microcode from CMPXCHG8B. So, I have speculatively set the JALU01 consumption to
2x the resource cycles used for CMPXCHG8B.

The two new hasLockPrefix() functions are used by the btver2 scheduling model
check if a MCInst/MachineInst has a LOCK prefix. Calls to hasLockPrefix() have
been encoded in predicates of variant scheduling classes that describe lat/thr
of CMPXCHG.

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

llvm-svn: 369365

5 years ago[libcxx] Fix build breakage on mips
Mikhail Maltsev [Tue, 20 Aug 2019 10:19:55 +0000 (10:19 +0000)]
[libcxx] Fix build breakage on mips

Fixes https://bugs.llvm.org/show_bug.cgi?id=43011 caused by
https://reviews.llvm.org/D63284.

Committing as obvious.

llvm-svn: 369364

5 years ago[COFF] Require an explicit -implib option for creating implibs in mingw mode
Martin Storsjo [Tue, 20 Aug 2019 10:14:54 +0000 (10:14 +0000)]
[COFF] Require an explicit -implib option for creating implibs in mingw mode

GNU ld doesn't produce implibs unless explicitly requested.

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

llvm-svn: 369363

5 years ago[yaml2obj/obj2yaml][MachO] Fix a test failure in big endian hosts
Seiya Nuta [Tue, 20 Aug 2019 09:58:31 +0000 (09:58 +0000)]
[yaml2obj/obj2yaml][MachO] Fix a test failure in big endian hosts

These section contents are dummy data (0xdeadbeef) and it's endianess
does not matter.

- http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/37265

llvm-svn: 369360

5 years ago[COFF] Allow using custom .edata from input object files
Martin Storsjo [Tue, 20 Aug 2019 09:53:06 +0000 (09:53 +0000)]
[COFF] Allow using custom .edata from input object files

This is used by Wine for manually crafting export tables.

If the input object contains .edata sections, GNU ld references them
in the export directory instead of synthesizing an export table using
either export directives or the normal auto export mechanism. (AFAIK,
historically, way way back, GNU ld didn't support synthesizing the
export table - one was supposed to generate it using dlltool and link
it in instead.)

If faced with --out-implib and --output-def, GNU ld still populates
those output files with the same export info as it would have generated
otherwise, disregarding the input .edata. As this isn't an intended
usage combination, I'm not adding checks for that in tests.

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

llvm-svn: 369358

5 years ago[DWARF] Fix DWARFUnit::getDebugInfoSize() for 64-bit DWARF.
Igor Kudrin [Tue, 20 Aug 2019 09:50:44 +0000 (09:50 +0000)]
[DWARF] Fix DWARFUnit::getDebugInfoSize() for 64-bit DWARF.

The calculation there was correct only for DWARF32.

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

llvm-svn: 369356

5 years ago[lldb][NFC] Test quotes when completing
Raphael Isemann [Tue, 20 Aug 2019 09:26:58 +0000 (09:26 +0000)]
[lldb][NFC] Test quotes when completing

llvm-svn: 369353

5 years ago[lldb] D66174 `RegularExpression` cleanup
Jan Kratochvil [Tue, 20 Aug 2019 09:24:20 +0000 (09:24 +0000)]
[lldb] D66174 `RegularExpression` cleanup

I find as a good cleanup to drop the Compile method. As I do not find TIMTOWTDI
as an advantage and there is already constructor parameter to compile the
regex.

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

llvm-svn: 369352

5 years ago[ELF][PPC] Allow PT_LOAD to have overlapping p_offset ranges on EM_PPC
Fangrui Song [Tue, 20 Aug 2019 09:20:05 +0000 (09:20 +0000)]
[ELF][PPC] Allow PT_LOAD to have overlapping p_offset ranges on EM_PPC

Ported the D64906 technique to EM_PPC.

Delete ppc-rela.s that is covered by ppc32-abs-pic.s

llvm-svn: 369351

5 years ago[clangd] Skip function bodies inside processed files while indexing
Ilya Biryukov [Tue, 20 Aug 2019 08:54:30 +0000 (08:54 +0000)]
[clangd] Skip function bodies inside processed files while indexing

Summary:
This significantly improves performance of background indexing.

We do not collect references and declarations inside the processed
files, so this does not affect the final indexing results.

The idea is borrowed from libclang, which has a similar optimization in
its indexing functionality.

Measurements show a nice decrease in indexing time, up to ~40% for
building the whole index. These are not proper benchmarks, so one should
not rely on these results too much.

1. Rebuilding the whole index for LLVM:
  - Before. Total time: 14m58s.
    ./bin/clangd -pch-storage=memory < ./clangd.input  23917.67s user 515.86s system 2718% cpu 14:58.68 total
  - After. Total time: 8m41s.
    ./bin/clangd -pch-storage=memory < ./clangd.input  13627.29s user 288.10s system 2672% cpu 8:40.67 total

2. Rebuilding index after removing shards matching '*clangd*' (case-insensitively):
  - Before. Total time: 30s.
    ./bin/clangd -pch-storage=memory < ./clangd.input  130.94s user 6.82s system 452% cpu 30.423 total
  - After. Total time: 26s.
    ./bin/clangd -pch-storage=memory < ./clangd.input  80.51s user 5.40s system 333% cpu 25.777 total

Reviewers: kadircet, sammccall

Reviewed By: kadircet

Subscribers: MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 369349

5 years ago[yaml2obj/obj2yaml][MachO] Allow setting custom section data
Seiya Nuta [Tue, 20 Aug 2019 08:49:07 +0000 (08:49 +0000)]
[yaml2obj/obj2yaml][MachO] Allow setting custom section data

Reviewers: alexshap, jhenderson, rupprecht

Reviewed By: alexshap, jhenderson

Subscribers: abrachet, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 369348

5 years ago[ELF][X86] Allow PT_LOAD to have overlapping p_offset ranges on EM_386
Fangrui Song [Tue, 20 Aug 2019 08:43:47 +0000 (08:43 +0000)]
[ELF][X86] Allow PT_LOAD to have overlapping p_offset ranges on EM_386

Ported the D64906 technique to EM_386.

If `sh_addralign(.tdata) < sh_addralign(.tbss)`,
we can potentially make `p_vaddr(PT_TLS)%p_align(PT_TLS) != 0`.

ld.so that are known to have problems if p_vaddr%p_align!=0:

* FreeBSD 13.0-CURRENT rtld-elf
* glibc https://sourceware.org/bugzilla/show_bug.cgi?id=24606

New test i386-tls-vaddr-align.s checks our workaround makes p_vaddr%p_align = 0.

Reviewed By: ruiu

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

llvm-svn: 369347

5 years ago[llvm-objcopy][MachO] Fix method names. NFC.
Seiya Nuta [Tue, 20 Aug 2019 08:36:47 +0000 (08:36 +0000)]
[llvm-objcopy][MachO] Fix method names. NFC.

Reviewers: alexshap, rupprecht, jhenderson

Reviewed By: alexshap, rupprecht

Subscribers: jakehehrlich, abrachet, llvm-commits

Tags: #llvm

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

llvm-svn: 369346

5 years agoRudimentary support for Doxygen \retval command
Stephan Bergmann [Tue, 20 Aug 2019 08:36:21 +0000 (08:36 +0000)]
Rudimentary support for Doxygen \retval command

...so that at least a preceding \param etc. that lacks a description gets a
-Wdocumentation warning (instead of erroneously treating the \retval ... text as
its paragraph).

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

llvm-svn: 369345

5 years ago[ELF][AArch64] Allow PT_LOAD to have overlapping p_offset ranges
Fangrui Song [Tue, 20 Aug 2019 08:34:56 +0000 (08:34 +0000)]
[ELF][AArch64] Allow PT_LOAD to have overlapping p_offset ranges

Ported the D64906 technique to AArch64. It deletes 3 alignments at
PT_LOAD boundaries for the default case: the size of an aarch64 binary
decreases by at most 192kb.

If `sh_addralign(.tdata) < sh_addralign(.tbss)`,
we can potentially make `p_vaddr(PT_TLS)%p_align(PT_TLS) != 0`.

ld.so that are known to have problems if p_vaddr%p_align!=0:

* musl<=1.1.22
* FreeBSD 13.0-CURRENT (and before) rtld-elf arm64

New test aarch64-tls-vaddr-align.s checks that our workaround makes p_vaddr%p_align = 0.

Reviewed By: ruiu

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

llvm-svn: 369344

5 years ago[ELF][PPC] Allow PT_LOAD to have overlapping p_offset ranges
Fangrui Song [Tue, 20 Aug 2019 08:34:25 +0000 (08:34 +0000)]
[ELF][PPC] Allow PT_LOAD to have overlapping p_offset ranges

This change affects the non-linker script case (precisely, when the
`SECTIONS` command is not used). It deletes 3 alignments at PT_LOAD
boundaries for the default case: the size of a powerpc64 binary can be
decreased by at most 192kb. The technique can be ported to other
targets.

Let me demonstrate the idea with a maxPageSize=65536 example:

When assigning the address to the first output section of a new PT_LOAD,
if the end p_vaddr of the previous PT_LOAD is 0x10020, we advance to
the next multiple of maxPageSize: 0x20000. The new PT_LOAD will thus
have p_vaddr=0x20000. Because p_offset and p_vaddr are congruent modulo
maxPageSize, p_offset will be 0x20000, leaving a p_offset gap [0x10020,
0x20000) in the output.

Alternatively, if we advance to 0x20020, the new PT_LOAD will have
p_vaddr=0x20020. We can pick either 0x10020 or 0x20020 for p_offset!
Obviously 0x10020 is the choice because it leaves no gap. At runtime,
p_vaddr will be rounded down by pagesize (65536 if
pagesize=maxPageSize). This PT_LOAD will load additional initial
contents from p_offset ranges [0x10000,0x10020), which will also be
loaded by the previous PT_LOAD. This is fine if -z noseparate-code is in
effect or if we are not transiting between executable and non-executable
segments.

ld.bfd -z noseparate-code leverages this technique to keep output small.
This patch implements the technique in lld, which is mostly effective on
targets with large defaultMaxPageSize (AArch64/MIPS/PPC: 65536). The 3
removed alignments can save almost 3*65536 bytes.

Two places that rely on p_vaddr%pagesize = 0 have to be updated.

1) We used to round p_memsz(PT_GNU_RELRO) up to commonPageSize (defaults
  to 4096 on all targets). Now p_vaddr%commonPageSize may be non-zero.
  The updated formula takes account of that factor.
2) Our TP offsets formulae are only correct if p_vaddr%p_align = 0.
  Fix them. See the updated comments in InputSection.cpp for details.

  On targets that we enable the technique (only PPC64 now),
  we can potentially make `p_vaddr(PT_TLS)%p_align(PT_TLS) != 0`
  if `sh_addralign(.tdata) < sh_addralign(.tbss)`

  This exposes many problems in ld.so implementations, especially the
  offsets of dynamic TLS blocks. Known issues:

  FreeBSD 13.0-CURRENT rtld-elf (i386/amd64/powerpc/arm64)
  glibc (HEAD) i386 and x86_64 https://sourceware.org/bugzilla/show_bug.cgi?id=24606
  musl<=1.1.22 on TLS Variant I architectures (aarch64/powerpc64/...)

  So, force p_vaddr%p_align = 0 by rounding dot up to p_align(PT_TLS).

The technique will be enabled (with updated tests) for other targets in
subsequent patches.

Reviewed By: ruiu

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

llvm-svn: 369343

5 years ago[test/Object] - Move/rewrite 2 more test cases.
George Rimar [Tue, 20 Aug 2019 08:23:57 +0000 (08:23 +0000)]
[test/Object] - Move/rewrite 2 more test cases.

This patch makes a change for test/Object tests responsible
for relocations.

* 2 tests were moved to llvm-readobj/llvm-objdump folders:
Object/elf-reloc-no-sym.test -> tools/llvm-readobj/elf-reloc-no-sym.test
Object/objdump-reloc-shared.test -> tools/llvm-objdump/relocations-in-nonreloc.test

* A prerecompiled binary was removed and these tests were refactored.

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

llvm-svn: 369342

5 years ago[MC] Delete an overload of MCExpr::evaluateKnownAbsolute and its associated hack
Fangrui Song [Tue, 20 Aug 2019 07:42:04 +0000 (07:42 +0000)]
[MC] Delete an overload of MCExpr::evaluateKnownAbsolute and its associated hack

The hack dated back to 2010 (r121076) and was documented by r122144:

  // FIXME: The use if InSet = Addrs is a hack. Setting InSet causes us
  // absolutize differences across sections and that is what the MachO writer
  // uses Addrs for.

llvm-svn: 369337

5 years ago[compiler-rt][crt] Pass -fno-lto in check_cxx_section_exists
Hans Wennborg [Tue, 20 Aug 2019 07:41:14 +0000 (07:41 +0000)]
[compiler-rt][crt] Pass -fno-lto in check_cxx_section_exists

Otherwise it doesn't work when building with -DLLVM_ENABLE_LTO=thin

(We hit this in Chromium in
https://bugs.chromium.org/p/chromium/issues/detail?id=966403)

llvm-svn: 369336

5 years ago[Attributor] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after r369331
Fangrui Song [Tue, 20 Aug 2019 07:21:43 +0000 (07:21 +0000)]
[Attributor] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after r369331

llvm-svn: 369334

5 years ago[X86] Add back the -x86-experimental-vector-widening-legalization comand line flag...
Craig Topper [Tue, 20 Aug 2019 06:58:00 +0000 (06:58 +0000)]
[X86] Add back the -x86-experimental-vector-widening-legalization comand line flag and all associated code, but leave it enabled by default

Google is reporting performance issues with the new default behavior
and have asked for a way to switch back to the old behavior while we
investigate and make fixes.

I've restored all of the code that had since been removed and added
additional checks of the command flag onto code paths that are
not otherwise guarded by a check of getTypeAction.

I've also modified the cost model tables to hopefully get us back
to the previous costs.

Hopefully we won't need to support this for very long since we
have no test coverage of the old behavior so we can very easily
break it.

llvm-svn: 369332

5 years ago[Attributor] Create abstract attributes on-demand
Johannes Doerfert [Tue, 20 Aug 2019 06:15:50 +0000 (06:15 +0000)]
[Attributor] Create abstract attributes on-demand

Before, we create the set of abstract attributes initially and then
dealt with the fact hat a lookup could fail, e.g., return a nullptr.
This patch will ensure we always return a valid object from a lookup,
allowing us not only to remove the nullptr checks but also to grow the
set of abstract attributes "in-flight" on-demand.

One can now start from those that have the best chance of improving
performance without the need to specify all they might depend on.

While this introduces some boilerplate, the usage of attributes is much
easier and cleaner now.

Reviewers: uenoku, sstefan1

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

llvm-svn: 369331

5 years ago[Attributor][NFC] Cleanup statistics code
Johannes Doerfert [Tue, 20 Aug 2019 06:09:56 +0000 (06:09 +0000)]
[Attributor][NFC] Cleanup statistics code

llvm-svn: 369330

5 years ago[Attributor] Use structured deduction for AADereferenceable
Johannes Doerfert [Tue, 20 Aug 2019 06:08:35 +0000 (06:08 +0000)]
[Attributor] Use structured deduction for AADereferenceable

Summary:
This is analogous to D66128 but for AADereferenceable. We have the logic
concentrated in the floating value updateImpl and we use the combiner
helper classes for arguments and return values.

The regressions will go away with "on-demand" attribute creation.
Improvements are already visible in the existing tests.

Reviewers: uenoku, sstefan1

Subscribers: hiraditya, bollu, jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 369329

5 years ago[Attributor] Use structured deduction for AANonNull
Johannes Doerfert [Tue, 20 Aug 2019 06:02:39 +0000 (06:02 +0000)]
[Attributor] Use structured deduction for AANonNull

Summary:
What D66126 did for AAAlign, this patch does for AANonNull. Agian, the
logic becomes more concise and localized. Again, returned poiners are
not annotated properly but that will not be an issue if this lands with
the "on-demand" generation of attributes. First improvements due to the
genericValueTraversal are already visible.

Reviewers: sstefan1, uenoku

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

llvm-svn: 369328

5 years ago[Attributor] Fix the "clamp" operator
Johannes Doerfert [Tue, 20 Aug 2019 05:57:01 +0000 (05:57 +0000)]
[Attributor] Fix the "clamp" operator

The clamp operator should not take the known of the given state as the
known is potentially based on assumed information. This also adds TODOs
to guide improvements.

llvm-svn: 369327

5 years ago[NFC] Test commit, fix some comment spelling.
Thomas Raoux [Tue, 20 Aug 2019 05:21:27 +0000 (05:21 +0000)]
[NFC] Test commit, fix some comment spelling.

llvm-svn: 369326

5 years ago[AsmPrinter] Remove const qualifier from EmitBasicBlockStart.
Karl-Johan Karlsson [Tue, 20 Aug 2019 05:13:57 +0000 (05:13 +0000)]
[AsmPrinter] Remove const qualifier from EmitBasicBlockStart.

Overriders may want to modify state in it. AMDGPU wants
to, but has to make its members mutable in order to do so.

Besides, EmitBasicBlockEnd is not const, so why should
Start be?

Patch by Bevin Hansson.

Reviewed By: nickdesaulniers

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

llvm-svn: 369325

5 years agoMCAsmMacro: add `#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)` to some dump...
Fangrui Song [Tue, 20 Aug 2019 04:14:43 +0000 (04:14 +0000)]
MCAsmMacro: add `#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)` to some dump() declarations

llvm-svn: 369324

5 years ago[CallGraph] Take into accound calls that aren't within any function bodies.
Artem Dergachev [Tue, 20 Aug 2019 02:22:37 +0000 (02:22 +0000)]
[CallGraph] Take into accound calls that aren't within any function bodies.

This patch improves Clang call graph analysis by adding in expressions
that are not found in regular function bodies, such as default arguments
or member initializers.

Patch by Joshua Cranmer!

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

llvm-svn: 369321

5 years ago[analyzer] NFC: Rename GRBugReporter to PathSensitiveBugReporter.
Artem Dergachev [Tue, 20 Aug 2019 02:15:50 +0000 (02:15 +0000)]
[analyzer] NFC: Rename GRBugReporter to PathSensitiveBugReporter.

The GR prefix is super ancient.

llvm-svn: 369320

5 years ago[analyzer] NFC: Drop support for extra text attached to bug reports.
Artem Dergachev [Tue, 20 Aug 2019 02:15:47 +0000 (02:15 +0000)]
[analyzer] NFC: Drop support for extra text attached to bug reports.

It was introduced in 2011 but never used since then.

llvm-svn: 369319

5 years ago[WebAssembly][MC] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after...
Fangrui Song [Tue, 20 Aug 2019 02:02:57 +0000 (02:02 +0000)]
[WebAssembly][MC] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after r369317

llvm-svn: 369318

5 years ago[WebAssembly][MC] Simplify WasmObjectWriter::recordRelocation. NFC.
Sam Clegg [Tue, 20 Aug 2019 00:33:50 +0000 (00:33 +0000)]
[WebAssembly][MC] Simplify WasmObjectWriter::recordRelocation. NFC.

WebAssembly doesn't support PC relative relocation or relocation
expressions that can't be reduced to single symbol.

The only support for we have for fixups involving two symbols are when
both symbols are defined and withing the same section.  In this case
evaluateFixup will already have evaluated to the expression before
calling recordRelocation.

llvm-svn: 369317

5 years agoFix typo. "piont" => "point"
Richard Trieu [Tue, 20 Aug 2019 00:28:21 +0000 (00:28 +0000)]
Fix typo.  "piont" => "point"

Found by Chris Morris (cwmorris).

llvm-svn: 369316

5 years ago[SLP][NFC] Avoid repetitive calls to getSameOpcode()
Dinar Temirbulatov [Tue, 20 Aug 2019 00:22:04 +0000 (00:22 +0000)]
[SLP][NFC] Avoid repetitive calls to getSameOpcode()

We can avoid repetitive calls getSameOpcode() for already known tree elements by keeping MainOp and AltOp in TreeEntry.

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

llvm-svn: 369315

5 years ago[TSan] Rename file with libdispatch interceptors
Julian Lettner [Tue, 20 Aug 2019 00:04:19 +0000 (00:04 +0000)]
[TSan] Rename file with libdispatch interceptors

llvm-svn: 369314

5 years ago[lldb] Fix typo on the BreakpointLocation header and the lldbtest.py (NFC)
Med Ismail Bennani [Mon, 19 Aug 2019 23:59:31 +0000 (23:59 +0000)]
[lldb] Fix typo on the BreakpointLocation header and the lldbtest.py (NFC)

Summary:
This commit fixes some typo I found while exploring LLDB's codebase.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 369313

5 years agoProvide a meaningful diagnostic when LLVM_PATH doesn't point to a directory
Louis Dionne [Mon, 19 Aug 2019 23:51:26 +0000 (23:51 +0000)]
Provide a meaningful diagnostic when LLVM_PATH doesn't point to a directory

llvm-svn: 369312

5 years ago[sanitizer_common] Extend test after switch to posix_spawn
Julian Lettner [Mon, 19 Aug 2019 23:47:35 +0000 (23:47 +0000)]
[sanitizer_common] Extend test after switch to posix_spawn

llvm-svn: 369311

5 years ago[cmake] Link in LLVMPasses due to dependency by LLVMOrcJIT; NFC
Hubert Tong [Mon, 19 Aug 2019 23:12:48 +0000 (23:12 +0000)]
[cmake] Link in LLVMPasses due to dependency by LLVMOrcJIT; NFC

Summary:
rL367756 (f5c40cb) increases the dependency of LLVMOrcJIT on LLVMPasses.
In particular, symbols defined in LLVMPasses that are referenced by the
destructor of `PassBuilder` are now referenced by LLVMOrcJIT through
`Speculation.cpp.o`.

We believe that referencing symbols defined in LLVMPasses in the
destructor of `PassBuilder` is valid, and that adding to the set of such
symbols is legitimate. To support such cases, this patch adds LLVMPasses
to the set of libraries being linked when linking in LLVMOrcJIT causes
such symbols from LLVMPasses to be referenced.

Reviewers: Whitney, anhtuyen, pree-jackie

Reviewed By: pree-jackie

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 369310

5 years ago[lit] Check for accidental external command calls
Joel E. Denny [Mon, 19 Aug 2019 22:59:37 +0000 (22:59 +0000)]
[lit] Check for accidental external command calls

This patch extends lit's test suite to check that lit's internal shell
doesn't accidentally execute internal commands as external commands.
It does so by putting fake failing versions of those commands in
`PATH` while the entire lit test suite is running.  Without the fixes
in D65697 but with its tests, this approach catches accidental
external `env` calls.

Reviewed By: probinson

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

llvm-svn: 369309

5 years ago[Support][Time profiler] Make FE codegen blocks to be inside frontend blocks
Anton Afanasyev [Mon, 19 Aug 2019 22:58:26 +0000 (22:58 +0000)]
[Support][Time profiler] Make FE codegen blocks to be inside frontend blocks

Summary:
Add `Frontend` time trace entry to `HandleTranslationUnit()` function.
Add test to check all codegen blocks are inside frontend blocks.
Also, change `--time-trace-granularity` option a bit to make sure very small
time blocks are outputed to json-file when using `--time-trace-granularity=0`.

This fixes http://llvm.org/pr41969

Reviewers: russell.gallop, lebedev.ri, thakis

Reviewed By: russell.gallop

Subscribers: vsapsai, aras-p, lebedev.ri, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 369308

5 years agoWindows: Include "windows" Instead of "Windows"
Saleem Abdulrasool [Mon, 19 Aug 2019 22:45:01 +0000 (22:45 +0000)]
Windows: Include "windows" Instead of "Windows"

The actual include directory is lldb/Host/windows not
lldb/Host/Windows which breaks on case sensitive file systems

Patch by Gwen Mittertreiner!

llvm-svn: 369307

5 years ago[ORC] fix use-after-free detected by -Wreturn-stack-address
Matthias Gehre [Mon, 19 Aug 2019 21:59:44 +0000 (21:59 +0000)]
[ORC] fix use-after-free detected by -Wreturn-stack-address

Summary:
llvm/lib/ExecutionEngine/Orc/Layer.cpp:53:12: warning: returning address of local temporary object [-Wreturn-stack-address]

In
```
StringRef IRMaterializationUnit::getName() const {
[...]
     return TSM.withModuleDo(
        [](const Module &M) { return M.getModuleIdentifier(); });
```
`getModuleIdentifier()` returns a `const std::string &`, but the implicit return type
of the lambda is `std::string` by value, and thus the returned `StringRef` refers
to a temporary `std::string`.

Detect by annotating `llvm::StringRef` with `[[gsl::Pointer]]`.

Reviewers: lhames, sgraenitz

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 369306

5 years ago[CaptureTracker] Let subclasses provide dereferenceability information
Johannes Doerfert [Mon, 19 Aug 2019 21:56:38 +0000 (21:56 +0000)]
[CaptureTracker] Let subclasses provide dereferenceability information

Summary:
CaptureTracker subclasses might have better dereferenceability
information which allows null pointer checks to be no-capturing.
The first user will be D59922.

Reviewers: sanjoy, hfinkel, aykevl, sstefan1, uenoku, xbolva00

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

llvm-svn: 369305

5 years agoFix use-after-free
Matthias Gehre [Mon, 19 Aug 2019 21:39:16 +0000 (21:39 +0000)]
Fix use-after-free

Summary:
The warning
```
lldb/source/Core/FormatEntity.cpp:2350:25: warning: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling]
```
is emitted after annotating `llvm::StringRef` with `[[gsl::Pointer]]`.

The reason is that in
```
 size_t FormatEntity::AutoComplete(CompletionRequest &request) {
  llvm::StringRef str = request.GetCursorArgumentPrefix().str();
```
the function `GetCursorArgumentPrefix()` returns a `StringRef`, and `StringRef::str()` returns
a temporary `std::string`.

Reviewers: jingham, JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 369304

5 years agoRecommit "[Attributor] Fix: Do not partially resolve returned calls."
Johannes Doerfert [Mon, 19 Aug 2019 21:35:31 +0000 (21:35 +0000)]
Recommit "[Attributor] Fix: Do not partially resolve returned calls."

This reverts commit b1752f670f3d6393306dd5d37546b6e23384d8a2.

Fixed the issue with a different commit, reapply this one as it was,
afaik, not broken.

llvm-svn: 369303

5 years agoRecommit "[llvm-objcopy][MachO] Implement a layout algorithm for executables"
Seiya Nuta [Mon, 19 Aug 2019 21:12:02 +0000 (21:12 +0000)]
Recommit "[llvm-objcopy][MachO] Implement a layout algorithm for executables"

Summary: The layout algorithm for relocatable objects and for executable are somewhat different. This patch implements the latter one based on the algorithm in LLD (MachOFileLayout).

Reviewers: alexshap, rupprecht, jhenderson

Reviewed By: alexshap

Subscribers: jakehehrlich, abrachet, llvm-commits

Tags: #llvm

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

llvm-svn: 369301

5 years agoRefactor isPointerOffset (NFC).
Evgeniy Stepanov [Mon, 19 Aug 2019 21:08:04 +0000 (21:08 +0000)]
Refactor isPointerOffset (NFC).

Summary:
Simplify the API using Optional<> and address comments in
         https://reviews.llvm.org/D66165

Reviewers: vitalybuka

Subscribers: hiraditya, llvm-commits, ostannard, pcc

Tags: #llvm

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

llvm-svn: 369300

5 years agoFixed placement of llvm.global_dtors on Windows.
Vyacheslav Zakharin [Mon, 19 Aug 2019 21:07:03 +0000 (21:07 +0000)]
Fixed placement of llvm.global_dtors on Windows.

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

llvm-svn: 369299

5 years agoRecommit "[llvm-objcopy][MachO] Support load commands used in executables/shared...
Seiya Nuta [Mon, 19 Aug 2019 21:05:31 +0000 (21:05 +0000)]
Recommit "[llvm-objcopy][MachO] Support load commands used in executables/shared libraries"

Summary:
This patch implements copying some load commands that appear in executables/shared libraries such as the indirect symbol table.

I don't add tests intentionally because this patch is incomplete: we need a layout algorithm for executables/shared libraries. I'll submit it as a separate patch with tests.

Reviewers: alexshap, rupprecht, jhenderson, compnerd

Reviewed By: alexshap

Subscribers: abrachet, mgorny, mgrang, MaskRay, mtrent, jakehehrlich, llvm-commits

Tags: #llvm

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

llvm-svn: 369298

5 years agoMemTag: stack initializer merging.
Evgeniy Stepanov [Mon, 19 Aug 2019 20:47:09 +0000 (20:47 +0000)]
MemTag: stack initializer merging.

Summary:
MTE provides instructions to update memory tags and data at the same
time. This change makes use of those to generate more compact code for
stack variable tagging + initialization.

We collect memory store and memset instructions following an alloca or a
lifetime.start call, and replace them with the corresponding MTE
intrinsics. Since the intrinsics work on 16-byte aligned chunks, the
stored values are combined as necessary.

Reviewers: pcc, vitalybuka, ostannard

Subscribers: srhines, javed.absar, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 369297

5 years ago[lldb-vscode] add `launchCommands` to handle launch specific commands
Alex Langford [Mon, 19 Aug 2019 20:17:27 +0000 (20:17 +0000)]
[lldb-vscode] add `launchCommands` to handle launch specific commands

Summary:
This can help `lldb-vscode` handle launch commands associate with remote platform
attach request have field `attachCommands` to handle attach specific commands
add a corresponding one for launch request
if no launch command is provided, create a new target and launch; otherwise, execute the launch command

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

Patch by Wanyi Ye <kusmour@gmail.com>

llvm-svn: 369296

5 years ago[Support] Replace sys::Mutex with their standard equivalents.
Benjamin Kramer [Mon, 19 Aug 2019 19:49:57 +0000 (19:49 +0000)]
[Support] Replace sys::Mutex with their standard equivalents.

Only use a recursive mutex if it can be locked recursively.

llvm-svn: 369295

5 years agoRe-apply fixed "[Attributor] Fix: Make sure we set the changed flag"
Johannes Doerfert [Mon, 19 Aug 2019 19:14:10 +0000 (19:14 +0000)]
Re-apply fixed "[Attributor] Fix: Make sure we set the changed flag"

This reverts commit cedd0d9a6e4b433e1cd6585d1d4d152eb5e60b11.

Re-apply the original commit but make sure the variables are initialized
(even if they are not used) so UBSan is not complaining.

llvm-svn: 369294

5 years ago[lldb] Make TestIOHandlerCompletion more stable and document it
Raphael Isemann [Mon, 19 Aug 2019 19:13:26 +0000 (19:13 +0000)]
[lldb] Make TestIOHandlerCompletion more stable and document it

Instead of relying that three tabs show all completions, we should
show all remaining completions which will always stop the mode
where we show completions. Should fix this test on systems that
somehow have more completions that our normal LLDB (as they
would end up being stuck in the mode where we show completions).

llvm-svn: 369293

5 years ago[WebAssembly][MC] Allow empty assembly functions
Sam Clegg [Mon, 19 Aug 2019 19:04:54 +0000 (19:04 +0000)]
[WebAssembly][MC] Allow empty assembly functions

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

llvm-svn: 369292

5 years ago[MemorySSA] Rename uses when inserting memory uses.
Alina Sbirlea [Mon, 19 Aug 2019 18:57:40 +0000 (18:57 +0000)]
[MemorySSA] Rename uses when inserting memory uses.

Summary:
When inserting uses from outside the MemorySSA creation, we don't
normally need to rename uses, based on the assumption that there will be
no inserted Phis (if  Def existed that required a Phi, that Phi already
exists). However, when dealing with unreachable blocks, MemorySSA will
optimize away Phis whose incoming blocks are unreachable, and these Phis end
up being re-added when inserting a Use.
There are two potential solutions here:
1. Analyze the inserted Phis and clean them up if they are unneeded
(current method for cleaning up trivial phis does not cover this)
2. Leave the Phi in place and rename uses, the same way as whe inserting
defs.
This patch use approach 2.

Resolves first test in PR42940.

Reviewers: george.burgess.iv

Subscribers: Prazek, sanjoy.google, llvm-commits

Tags: #llvm

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

llvm-svn: 369291

5 years agoBuild symbolizer runtime with C++14.
Peter Collingbourne [Mon, 19 Aug 2019 18:43:52 +0000 (18:43 +0000)]
Build symbolizer runtime with C++14.

Should hopefully fix sanitizer-x86_64-linux bot.

llvm-svn: 369290

5 years ago[TSan] Rename file to make it clear that it defines interceptors
Julian Lettner [Mon, 19 Aug 2019 18:41:20 +0000 (18:41 +0000)]
[TSan] Rename file to make it clear that it defines interceptors

Rename file `tsan_libdispatch.cpp -> tsan_libdispatch_interceptors.cpp`
to make it clear that it's main purpose is defining interceptors.

llvm-svn: 369289

5 years ago[X86] Move scheduling tests for CMPXCHG to the corresponding resources-x86_64.s files...
Andrea Di Biagio [Mon, 19 Aug 2019 18:20:30 +0000 (18:20 +0000)]
[X86] Move scheduling tests for CMPXCHG to the corresponding resources-x86_64.s files. NFC

In D66424 it has been requested to move all the new tests added by r369278 into
resources-x86_64.s. That is because only the 8b/16 ops should be tested by
resources-cmpxchg.s. This partially reverts r369278.

llvm-svn: 369288

5 years ago[X86] Teach lowerV4I32Shuffle to only use broadcasts if the mask has more than one...
Craig Topper [Mon, 19 Aug 2019 18:15:50 +0000 (18:15 +0000)]
[X86] Teach lowerV4I32Shuffle to only use broadcasts if the mask has more than one undef element. Prioritize shifts over broadcast in lowerV8I16Shuffle.

The motivating case are the changes in vector-reduce-add.ll where
we were doing extra work in the scalar domain instead of shuffling.
There may be some one use check that needs to be looked into there,
but this patch sidesteps the issue by avoiding broadcasts that
aren't really broadcasting.

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

llvm-svn: 369287

5 years agoFix poorly formatted HTML in the cxx_status.html file caused by adding
Erich Keane [Mon, 19 Aug 2019 18:14:22 +0000 (18:14 +0000)]
Fix poorly formatted HTML in the cxx_status.html file caused by adding
1668.

llvm-svn: 369286

5 years ago[Sanitizer] arc4random interception on Mac
David Carlier [Mon, 19 Aug 2019 18:12:15 +0000 (18:12 +0000)]
[Sanitizer] arc4random interception on Mac

Reviewers: yln,vitalybuka

Reviewed By: yln

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

llvm-svn: 369285

5 years agoFix test where diagnostics changed in P1668 implementation
Erich Keane [Mon, 19 Aug 2019 18:08:52 +0000 (18:08 +0000)]
Fix test where diagnostics changed in P1668 implementation

llvm-svn: 369284

5 years ago[CGP] Remove ModifiedDT from the makeBitReverse loop
Craig Topper [Mon, 19 Aug 2019 18:02:24 +0000 (18:02 +0000)]
[CGP] Remove ModifiedDT from the makeBitReverse loop

I don't think anything in this loop modifies the control flow and we don't restart any iteration after setting the flag.

This code was added in http://reviews.llvm.org/D16893 but looking at the test case added there the code that caused the dominator tree to change was merging blocks with their predecessor not the bitreverse optimization.

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

llvm-svn: 369283

5 years agoUpdate cxx_status.html with P1668 status.
Erich Keane [Mon, 19 Aug 2019 17:57:27 +0000 (17:57 +0000)]
Update cxx_status.html with P1668 status.

llvm-svn: 369282

5 years agoImplement P1668R1
Erich Keane [Mon, 19 Aug 2019 17:39:59 +0000 (17:39 +0000)]
Implement P1668R1

Allow inline assembly statements in unexecuted branches of constexpr
functions.

llvm-svn: 369281

5 years ago[libc++] Add XFAIL for is_base_of test on AppleClang 11
Louis Dionne [Mon, 19 Aug 2019 17:29:42 +0000 (17:29 +0000)]
[libc++] Add XFAIL for is_base_of test on AppleClang 11

llvm-svn: 369280

5 years ago[X86] Added extensive scheduling model tests for all the CMPXCHG variants. NFC
Andrea Di Biagio [Mon, 19 Aug 2019 17:07:26 +0000 (17:07 +0000)]
[X86] Added extensive scheduling model tests for all the CMPXCHG variants. NFC

Addresses a review comment in D66424

llvm-svn: 369279

5 years ago[Attributor] -attributor-verify has false positives. Temporarily remove
Stefan Stipanovic [Mon, 19 Aug 2019 16:39:32 +0000 (16:39 +0000)]
[Attributor] -attributor-verify has false positives. Temporarily remove
it, until resolved.

llvm-svn: 369277