platform/upstream/llvm.git
4 years ago[Target][XCOFF] Correctly halt when mixing AIX or XCOFF with ppc64le
Hubert Tong [Fri, 8 May 2020 20:40:28 +0000 (16:40 -0400)]
[Target][XCOFF] Correctly halt when mixing AIX or XCOFF with ppc64le

The code to prevent using `PPCXCOFFMCAsmInfo` with little-endian targets
used an incorrect check. Also, there does not appear to be sufficient
earlier checking to prevent failing this check, so the check here is
upgraded to be a `report_fatal_error`.

`PPCAIXAsmPrinter` was also missing a check against use with
little-endian targets. This patch adds such a check in.

4 years ago[XCOFF] XCOFF constants, MCObjectFileInfo placeholder code for DWARF; NFC
Hubert Tong [Fri, 8 May 2020 20:32:12 +0000 (16:32 -0400)]
[XCOFF] XCOFF constants, MCObjectFileInfo placeholder code for DWARF; NFC

Summary:
This patch introduces the constants defined to identify DWARF sections
in XCOFF into `llvm/BinaryFormat/XCOFF.h` and adds (NFC) placeholder
code to `llvm/lib/MC/MCObjectFileInfo.cpp` where the DWARF sections for
XCOFF are to be set up.

Reviewers: jasonliu, sfertile, daltenty, DiggerLin, Xiangling_L

Reviewed By: jasonliu, sfertile, DiggerLin

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

4 years ago[AIX] Avoid structor alias; die before bad alias codegen
Hubert Tong [Fri, 8 May 2020 20:29:58 +0000 (16:29 -0400)]
[AIX] Avoid structor alias; die before bad alias codegen

Summary:
`AsmPrinter::emitGlobalIndirectSymbol` is dependent on
`MCStreamer::emitAssignment` to produce `.set` directives for alias
symbols; however, the `.set` pseudo-op on AIX is documented as not
usable with external relocatable terms or expressions, which limits its
applicability in generating alias symbols.

Disable generating aliases on AIX until a different implementation
strategy is available.

Reviewers: cebowleratibm, jasonliu, sfertile, daltenty, DiggerLin

Reviewed By: jasonliu

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

4 years ago[GlobalISel] Don't add duplicate successors to MBBs when translating indirectbr
Jessica Paquette [Thu, 7 May 2020 23:25:34 +0000 (16:25 -0700)]
[GlobalISel] Don't add duplicate successors to MBBs when translating indirectbr

This fixes a verifier failure on a bot:

http://green.lab.llvm.org/green/job/test-suite-verify-machineinstrs-aarch64-O0-g/

```
*** Bad machine code: MBB has duplicate entries in its successor list. ***
- function:    foo
- basic block: %bb.5 indirectgoto (0x7fe3d687ca08)
```

One of the GCC torture suite tests (pr70460.c) has an indirectbr instruction
which has duplicate blocks in its destination list.

According to the langref this is allowed:

> Blocks are allowed to occur multiple times in the destination list, though
> this isn’t particularly useful.
(https://www.llvm.org/docs/LangRef.html#indirectbr-instruction)

We don't allow this in MIR. So, when we translate such an instruction, the
verifier screams.

This patch makes `translateIndirectBr` check if a successor has already been
added to a block. If the successor is present, it is skipped rather than added
twice.

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

4 years ago[VectorCombine] scalarize binop of inserted elements into vector constants
Sanjay Patel [Fri, 8 May 2020 20:29:07 +0000 (16:29 -0400)]
[VectorCombine] scalarize binop of inserted elements into vector constants

As with the extractelement patterns that are currently in vector-combine,
there are going to be several possible variations on this theme. This
should be the clearest, simplest example.

Scalarization is the right direction for target-independent canonicalization,
and InstCombine has some of those folds already, but it doesn't do this.
I proposed a similar transform in D50992. Here in vector-combine, we can
check the cost model to be sure it's profitable, so there should be less risk.

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

4 years ago[lldb/Test] Update TestProcessList.py for reproducer replay
Jonas Devlieghere [Fri, 8 May 2020 20:12:22 +0000 (13:12 -0700)]
[lldb/Test] Update TestProcessList.py for reproducer replay

Because LLDB isn't the one spawning the subprocess, the PID is different
during replay. Exclude it form the substring check during replay.

Depends on D79646 to pass with reproducer replay.

4 years agoReland [libc++] Move abs and div into stdlib.h to fix header cycle.
Eric Fiselier [Sat, 15 Feb 2020 23:55:07 +0000 (18:55 -0500)]
Reland [libc++] Move abs and div into stdlib.h to fix header cycle.

This commit should will break libc++ without local submodule visibility, but
the LLVM+modules bots are now all using this mode. Before the Green Dragon
LLDB bot was failing to compile with a libc++ built with this commit as LSV
was disabled on macOS.

Original summary:

libc++ is careful to not fracture overload sets. When one overload
is visible to a user, all of them should be. Anything less causes
subtle bugs and ODR violations.

Previously, in order to support ::abs and ::div being supplied by
both <cmath> and <cstdlib> we had to do awful things that make
<math.h> and <stdlib.h> have header cycles and be non-modular.
This really breaks with modules.

Specifically the problem was that in C++ ::abs introduces overloads
for floating point numbers, these overloads forward to ::fabs,
which are defined in math.h. Therefore ::abs needed to be in math.h
too. But this required stdlib.h to include math.h and math.h to
include stdlib.h.

To avoid these problems the definitions have been moved to stddef.h
(which math includes), and the floating point overloads of ::abs
have been changed to call __builtin_fabs, which both Clang and GCC
support.

4 years ago[X86] Remove the mayLoad and mayStore flags from vzeroupper/vzeroall.
Craig Topper [Fri, 8 May 2020 19:32:19 +0000 (12:32 -0700)]
[X86] Remove the mayLoad and mayStore flags from vzeroupper/vzeroall.

But leave the hasUnmodelledSideEffects flag.

4 years ago[InstCombine] fix typo in comment; NFC
Sanjay Patel [Fri, 8 May 2020 19:42:54 +0000 (15:42 -0400)]
[InstCombine] fix typo in comment; NFC

4 years agoRe-commit: Mark values as trivially dead when their only use is a start or end lifeti...
zoecarver [Fri, 8 May 2020 19:22:39 +0000 (12:22 -0700)]
Re-commit: Mark values as trivially dead when their only use is a start or end lifetime intrinsic.

Summary:
If the only use of a value is a start or end lifetime intrinsic then mark the intrinsic as trivially dead. This should allow for that value to then be removed as well.

Currently, this only works for allocas, globals, and arguments.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[InstCombine] add/adjust tests for fpext of casted value; NFC
Sanjay Patel [Fri, 8 May 2020 19:14:36 +0000 (15:14 -0400)]
[InstCombine] add/adjust tests for fpext of casted value; NFC

4 years ago[InstCombine] add helper for known exact cast to FP; NFC
Sanjay Patel [Fri, 8 May 2020 18:40:04 +0000 (14:40 -0400)]
[InstCombine] add helper for known exact cast to FP; NFC

As suggested in D79116 - there's shared logic between the
existing code and potential new folds. This could go in
ValueTracking if it seems generally useful.

4 years ago[libcxx] Delete pointer in shared_ptr deduction test.
zoecarver [Fri, 8 May 2020 19:18:21 +0000 (12:18 -0700)]
[libcxx] Delete pointer in shared_ptr deduction test.

Updates the dummy deleter in deduction.pass.cpp to delete the pointer argument. This will fix the asan bots.

4 years ago[lldb] Remove 'use_synthetic' parameters in ValueObject code
Raphael Isemann [Fri, 8 May 2020 17:09:30 +0000 (19:09 +0200)]
[lldb] Remove 'use_synthetic' parameters in ValueObject code

Summary:
`CalculateSyntheticValue` and `GetSyntheticValue` have a `use_synthetic` parameter
that makes the function do nothing when it's false. We obviously always pass true
to the function (or check that the value we pass is true), because there really isn't
any point calling with function with a `false`. This just removes all of this.

Reviewers: labath, JDevlieghere, davide

Reviewed By: davide

Subscribers: davide

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

4 years ago[X86] Add assembler support for {vex} prefix to match GNU as.
Craig Topper [Fri, 8 May 2020 18:49:30 +0000 (11:49 -0700)]
[X86] Add assembler support for {vex} prefix to match GNU as.

This does the same thing as {vex2}. Which is give an error
if the instruction can't be done with VEX. It doesn't force
the instruction to use 2 byte VEX. That's already the preference
if its possible. Therefore {vex} is a clearer name.

4 years ago[SampleFDO] For functions without profiles, provide an option to put
Wei Mi [Tue, 5 May 2020 00:17:34 +0000 (17:17 -0700)]
[SampleFDO] For functions without profiles, provide an option to put
them in a special text section.

For sampleFDO, because the optimized build uses profile generated from
previous release, previously we couldn't tell a function without profile
was truely cold or just newly created so we had to treat them conservatively
and put them in .text section instead of .text.unlikely. The result was when
we persuing the best performance by locking .text.hot and .text in memory,
we wasted a lot of memory to keep cold functions inside.

In https://reviews.llvm.org/D66374, we introduced profile symbol list to
discriminate functions being cold versus functions being newly added.
This mechanism works quite well for regular use cases in AutoFDO. However,
in some case, we can only have a partial profile when optimizing a target.
The partial profile may be an aggregated profile collected from many targets.
The profile symbol list method used for regular sampleFDO profile is not
applicable to partial profile use case because it may be too large and
introduce many false positives.

To solve the problem for partial profile use case, we provide an option called
--profile-unknown-in-special-section. For functions without profile, we will
still treat them conservatively in compiler optimizations -- for example,
treat them as warm instead of cold in inliner. When we use profile info to
add section prefix for functions, we will discriminate functions known to be
not cold versus functions without profile (being unknown), and we will put
functions being unknown in a special text section called .text.unknown.
Runtime system will have the flexibility to decide where to put the special
section in order to achieve a balance between performance and memory saving.

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

4 years ago[lld] Add a new output section ".text.unknown" for funtions with unknown hotness
Wei Mi [Thu, 7 May 2020 17:24:19 +0000 (10:24 -0700)]
[lld] Add a new output section ".text.unknown" for funtions with unknown hotness

For sampleFDO, because the optimized build uses profile generated from previous
release, often we couldn't tell a function without profile was truely cold or
just newly created so we had to treat them conservatively and put them in .text
section instead of .text.unlikely. The result was when we persue the best
performance by locking .text.hot and .text in memory, we wasted a lot of memory
to keep cold functions inside. This problem has been largely solved for regular
sampleFDO using profile-symbol-list (https://reviews.llvm.org/D66374), but for
the case when we use partial profile, we still waste a lot of memory because
of it.

In https://reviews.llvm.org/D62540, we propose to save functions with unknown
hotness information in a special section called ".text.unknown", so that
compiler will treat those functions as luck-warm, but runtime can choose not
to mlock the special section in memory or use other strategy to save memory.
That will solve most of the memory problem even if we use a partial profile.

The patch adds the support in lld for the special section.For sampleFDO,
because the optimized build uses profile generated from previous release,
often we couldn't tell a function without profile was truely cold or just
newly created so we had to treat them conservatively and put them in .text
section instead of .text.unlikely. The result was when we persue the best
performance by locking .text.hot and .text in memory, we wasted a lot of
memory to keep cold functions inside. This problem has been largely solved
for regular sampleFDO using profile-symbol-list
(https://reviews.llvm.org/D66374), but for the case when we use partial
profile, we still waste a lot of memory because of it.

In https://reviews.llvm.org/D62540, we propose to save functions with unknown
hotness information in a special section called ".text.unknown", so that
compiler will treat those functions as luck-warm, but runtime can choose not
to mlock the special section in memory or use other strategy to save memory.
That will solve most of the memory problem even if we use a partial profile.

The patch adds the support in lld for the special section.

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

4 years ago[SimplifyCFG] Remap rewritten debug intrinsic operands.
Ricky Zhou [Fri, 8 May 2020 17:55:27 +0000 (10:55 -0700)]
[SimplifyCFG] Remap rewritten debug intrinsic operands.

FoldBranchToCommonDest clones instructions to a different basic block,
but handles debug intrinsics in a separate path. Previously, when
cloning debug intrinsics, their operands were not updated to reference
the correct cloned values. As a result, we would emit debug.value
intrinsics with broken operand references which are discarded in later
passes. This leads to incorrect debuginfo that reports incorrect values
for variables.

Fix this by remapping debug intrinsic operands when cloning them.

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

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

4 years ago[DAG] SimplifyMultipleUseDemandedBits - remove superfluous bitcasts
Simon Pilgrim [Fri, 8 May 2020 18:04:29 +0000 (19:04 +0100)]
[DAG] SimplifyMultipleUseDemandedBits - remove superfluous bitcasts

If the SimplifyMultipleUseDemandedBits calls BITCASTs that peek through back to the original type then we can remove the BITCASTs entirely.

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

4 years ago[AIX] Make sure we use export lists for plugins
David Tenty [Fri, 8 May 2020 17:45:44 +0000 (13:45 -0400)]
[AIX] Make sure we use export lists for plugins

Summary:
Besides just generating and consuming the lists, this includes:

 * Calling  nm with the right options in extract_symbols.py. Such as not
  demangling C++ names, which AIX nm does by default, and accepting both
  32/64-bit names.
 * Not having nm sort the list of symbols or we may run in to memory
   issues on debug builds, as nm calls a 32-bit sort.
 * Defaulting to having LLVM_EXPORT_SYMBOLS_FOR_PLUGINS on for AIX
 * CMake versions prior to 3.16 set the -brtl linker flag globally on
   AIX. Clear it out early on so we don't run into failures. We will set
   it as needed.

Reviewers: jasonliu, DiggerLin, stevewan, hubert.reinterpretcast

Reviewed By: hubert.reinterpretcast

Subscribers: hubert.reinterpretcast, mgorny, llvm-commits

Tags: #llvm

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

4 years agoRe-land "get rid of PythonInteger::GetInteger()"
Lawrence D'Anna [Fri, 8 May 2020 17:56:30 +0000 (10:56 -0700)]
Re-land "get rid of PythonInteger::GetInteger()"

This was reverted due to a python2-specific bug.  Re-landing with a fix
for python2.

Summary:
One small step in my long running quest to improve python exception handling in
LLDB.  Replace GetInteger() which just returns an int with As<long long> and
friends, which return Expected types that can track python exceptions

Reviewers: labath, jasonmolenda, JDevlieghere, vadimcn, omjavaid

Reviewed By: labath, omjavaid

Subscribers: omjavaid, lldb-commits

Tags: #lldb

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

4 years agoAdd an API to construct an XcodeSDK from an SDK type.
Adrian Prantl [Thu, 7 May 2020 23:02:23 +0000 (16:02 -0700)]
Add an API to construct an XcodeSDK from an SDK type.

Also, this moves numSDKs out of the actual enum, as to not mess with
the switch-cases-covered warning.

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

4 years ago[InstCombine] add tests for known bits before FP casts; NFC
Sanjay Patel [Fri, 8 May 2020 17:44:03 +0000 (13:44 -0400)]
[InstCombine] add tests for known bits before FP casts; NFC

4 years agoRevert "[libc++] ECMAScript IdentityEscape is ambiguous (2584)"
zoecarver [Fri, 8 May 2020 17:35:18 +0000 (10:35 -0700)]
Revert "[libc++] ECMAScript IdentityEscape is ambiguous (2584)"

This reverts commit 6d2a66b10d458e34c852be46028092d2b46edc14.

The regex expressions in some lld tests need to be fixed. Reverting
until those are fixed.

4 years agoFix bugs when an included file name is typo corrected.
Nico Weber [Fri, 8 May 2020 17:03:14 +0000 (13:03 -0400)]
Fix bugs when an included file name is typo corrected.

D52774 fixed a bug with typo correction of includes, but didn't add
a test.

D65907 then broke recovery of typo correction of includes again,
because it extracted the code that writes to Filename to a separate
function that took the parameter not by reference.

Fix that, and also don't repeat the slash normalization computation
and fix both lookup and regular file name after recovery.

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

4 years ago[hwasan] Reset current thread pointer on thread exit.
Evgenii Stepanov [Thu, 7 May 2020 23:22:21 +0000 (16:22 -0700)]
[hwasan] Reset current thread pointer on thread exit.

Summary:
This is necessary to handle calls to free() after __hwasan_thread_exit,
which is possible in glibc.

Also, add a null check to GetCurrentThread, otherwise the logic in
GetThreadByBufferAddress turns it into a non-null value. This means that
all of the checks for GetCurrentThread() != nullptr do not have any
effect at all right now!

Reviewers: pcc, hctim

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers

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

4 years agoReland [lldb][cmake] Also use local submodule visibility on Darwin
Raphael Isemann [Mon, 27 Apr 2020 12:58:50 +0000 (14:58 +0200)]
Reland [lldb][cmake] Also use local submodule visibility on Darwin

Relanding this as D79632 should fix the macOS tests with this option.

Original commit:

Summary:
Currently building LLVM on macOS and on other platforms with LLVM_ENABLE_MODULES is using different module flags,
which means that a passing modules build on macOS might fail on Linux and vice versa. -fmodules-local-submodule-visibility
is the mode that has clearer semantics and is closer to the actual C++ module standard, so let's make this the default everywhere.

We can still test building without local submodule visibility on an additional bot by just changing the respective CMake flag. However,
if building without local-submodule-visibility breaks we won't revert other commits and we won't loose LLDB's/Clang's test run
information.

Reviewers: aprantl, bruno, Bigcheese

Reviewed By: Bigcheese

Subscribers: abidh, dexonsmith, JDevlieghere, lldb-commits, mgorny, llvm-commits

Tags: #llvm, #lldb

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

4 years ago[PDB] Optimize public symbol processing
Reid Kleckner [Sun, 3 May 2020 16:29:03 +0000 (09:29 -0700)]
[PDB] Optimize public symbol processing

Reduces time to link PGO instrumented net_unittets.exe by 11% (9.766s ->
8.672s, best of three). Reduces peak memory by 65.7MB (2142.71MB ->
2076.95MB).

Use a more compact struct, BulkPublic, for faster sorting. Sort in
parallel. Construct the hash buckets in parallel. Try to use one vector
to hold all the publics instead of copying them from one to another.
Allocate all the memory needed to serialize publics up front, and then
serialize them in place in parallel.

Reviewed By: aganea, hans

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

4 years ago[lldb/test][Darwin] Ask dyld where the real python is
Vedant Kumar [Thu, 7 May 2020 23:07:32 +0000 (16:07 -0700)]
[lldb/test][Darwin] Ask dyld where the real python is

Summary:
On macOS, we can't do the DYLD_INSERT_LIBRARIES trick with a shim
python binary as the ASan interceptors get loaded too late. Find the
"real" python binary, copy it, and invoke it.

Hopefully this makes the GreenDragon and swift-ci sanitizer bots
happy...

I tested this out by running `../llvm-macosx-x86_64/bin/llvm-lit test
--filter TestNSDictionarySynthetic.py` in an ASanified swift-lldb build
directory and it worked (i.e. no more "interceptors loaded too late"
messages).

Reviewers: JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

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

4 years agoAMDGPU: Don't assert on unknown address spaces
Matt Arsenault [Thu, 7 May 2020 15:22:54 +0000 (11:22 -0400)]
AMDGPU: Don't assert on unknown address spaces

Assume unknown address spaces behave like some flavor of global
memory.

4 years agoUnbreak clang-tidy tests after D79599 / e9b4113902850.
Nico Weber [Fri, 8 May 2020 16:36:31 +0000 (12:36 -0400)]
Unbreak clang-tidy tests after D79599 / e9b4113902850.

4 years agoReland D79501 "[DebugInfo] Fix handling DW_OP_call_ref in DWARF64 units."
Fangrui Song [Fri, 8 May 2020 16:28:25 +0000 (09:28 -0700)]
Reland D79501 "[DebugInfo] Fix handling DW_OP_call_ref in DWARF64 units."

With a fix to uninitialized EndOffset.

DW_OP_call_ref is the only operation that has an operand which depends
on the DWARF format. The patch fixes handling that operation in DWARF64
units.

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

4 years ago[lldb][modules] Disable Clang Modules in source/Host directory on macOS
Raphael Isemann [Fri, 8 May 2020 16:13:43 +0000 (18:13 +0200)]
[lldb][modules] Disable Clang Modules in source/Host directory on macOS

Summary:
The arpa/inet.h header in macOS is providing an incorrect htonl
function with enabled local submodule visibility while building LLDB. This
caused several networking tests to fail as the IP addresses are now flipped
in LLDB.

This patch disables building with modules when local submodule visibility is
active and the current system is macOS for the source/Host directory (which
is the *only directory that includes arpa/inet.h).

* debugserver also includes arpa/inet.h but there we already disabled
modules.

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: mgorny, JDevlieghere

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

4 years ago[InstCombine] clean up foldItoFPtoI; NFC
Sanjay Patel [Fri, 8 May 2020 16:06:38 +0000 (12:06 -0400)]
[InstCombine] clean up foldItoFPtoI; NFC

Mostly cosmetic improvements to variable names and logic to ease
refactoring suggested in D79116.

4 years agoFix MSan test use-after-dtor.cpp under new pass manager
Arthur Eubanks [Thu, 7 May 2020 19:14:43 +0000 (12:14 -0700)]
Fix MSan test use-after-dtor.cpp under new pass manager

Summary: The new pass manager symbolizes the location as ~Simple instead of Simple::~Simple.

Reviewers: rnk, leonardchan, vitalybuka

Subscribers: #sanitizers

Tags: #sanitizers

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

4 years agoAdd a flag that controls if clang-tidy and clang-include-fixer are built into libclang.
Nico Weber [Thu, 7 May 2020 21:05:42 +0000 (17:05 -0400)]
Add a flag that controls if clang-tidy and clang-include-fixer are built into libclang.

Based on the discussion on D55415, also make the flag default to false.
Having libclang depend on clang-tools-extra means check-clang builds all
of clang-tools-extra, which besides being a layering violation takes
quite some time, since clang-tools-extra has many files that are slow
to compile.

Longer term, we likely will want to remove this flag completely. If
people need this functionality, maybe there could be a
libclang-tools-extra that's libclang + clang-tidy and
clang-includes-fixer linked in.

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

4 years agoRevert "[DebugInfo] Fix handling DW_OP_call_ref in DWARF64 units."
Krasimir Georgiev [Fri, 8 May 2020 15:14:12 +0000 (17:14 +0200)]
Revert "[DebugInfo] Fix handling DW_OP_call_ref in DWARF64 units."

This reverts commit 989ae9e848a079715c2d23e5d3622cac9b48e08e.

Newly added test fails:
FAIL: LLVM::DW_OP_call_ref_unexpected.s

http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/28298

4 years ago[mlir][spirv] Handle debuginfo for variables.
Denis Khalikov [Fri, 8 May 2020 11:56:58 +0000 (14:56 +0300)]
[mlir][spirv] Handle debuginfo for variables.

Summary:
Handle debuginfo for spv.Variable and spv.globalVariable during
(de)serialization.

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

4 years agoAMDGPU/GlobalISel: Regenerate checks
Matt Arsenault [Fri, 8 May 2020 14:29:25 +0000 (10:29 -0400)]
AMDGPU/GlobalISel: Regenerate checks

Avoids extra diffs from the rename of G_GEP to G_PTR_ADD in the
generated check variables in a future patch.

4 years agoAMDGPU: Lower addrspacecast to 32-bit constant
Matt Arsenault [Thu, 7 May 2020 15:49:39 +0000 (11:49 -0400)]
AMDGPU: Lower addrspacecast to 32-bit constant

Somehow this was missing from the DAG path, but not global isel.

4 years ago[ELF] Add convenience TableGen classes to enforce two dashes for options not supporte...
Fangrui Song [Mon, 4 May 2020 21:42:36 +0000 (14:42 -0700)]
[ELF] Add convenience TableGen classes to enforce two dashes for options not supported by GNU ld

Announced on https://lists.llvm.org/pipermail/llvm-dev/2020-May/141416.html

For many options, we have to support either one or two dash to be
compatible with GNU ld. For newer and lld specific options, we can enforce strict double dashes.

Affected options:

* --thinlto-*
* --lto-*
* --shuffle-sections=

This patch does not change `-plugin-opt=*` because clang driver passes
`-plugin-opt=*` and I don't intend to cause churn.

In 2000, GNU ld tried something similar with --omagic
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=e4897a3288f37d5f69e8acd256a6e83e607fe8d8

Reviewed By: tejohnson, psmith

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

4 years ago[PatternMatch] add missing FP cast matchers; NFC
Sanjay Patel [Fri, 8 May 2020 13:56:59 +0000 (09:56 -0400)]
[PatternMatch] add missing FP cast matchers; NFC

These are the obvious counterparts to the existing cast matchers.
Moving out of D79116 to reduce that patch.

4 years ago[InstCombine] simplify code for FP to integer casts; NFCI
Sanjay Patel [Fri, 8 May 2020 13:05:41 +0000 (09:05 -0400)]
[InstCombine] simplify code for FP to integer casts; NFCI

FoldIToFPtoI() returns immediately if the operand is not
an opposite cast instruction, so the extra checks in the
callers are redundant.

4 years agoLiveIntervalCalc - remove unnecessary includes. NFC.
Simon Pilgrim [Fri, 8 May 2020 13:57:35 +0000 (14:57 +0100)]
LiveIntervalCalc - remove unnecessary includes. NFC.

As we're inheriting from LiveRangeCalc, all the headers are already explicitly required by LiveRangeCalc.h

4 years agoDFAEmitter.h - remove unnecessary headers. NFC.
Simon Pilgrim [Fri, 8 May 2020 13:53:10 +0000 (14:53 +0100)]
DFAEmitter.h - remove unnecessary headers. NFC.

Reduce StringRef.h include to forward declaration and add implicit SmallVector.h and <map> include dependencies.

4 years agoItaniumManglingCanonicalizer.h - add cstdint.h include for missing uintptr_t def
Simon Pilgrim [Fri, 8 May 2020 13:21:49 +0000 (14:21 +0100)]
ItaniumManglingCanonicalizer.h - add cstdint.h include for missing uintptr_t def

MSVC builds don't need it but everything else does.

4 years ago[ARM] Change test target to arm-none-none-eabi. NFC
David Green [Fri, 8 May 2020 12:30:04 +0000 (13:30 +0100)]
[ARM] Change test target to arm-none-none-eabi. NFC

4 years ago[libc++][test] Add test coverage for codecvt<char(16|32)_t, char8_t, mbstate_t>
Casey Carter [Thu, 7 May 2020 17:42:10 +0000 (10:42 -0700)]
[libc++][test] Add test coverage for codecvt<char(16|32)_t, char8_t, mbstate_t>

This change adds test coverage for the `codecvt<char16_t, char8_t, mbstate_t>` and `codecvt<char32_t, char8_t, mbstate_t>` ctype facets added to the C++20 WD by [P0482R6](https://wg21.link/P0428R6). Note that libc++ does not implement these facets despite implementing the remainder of P0482, presumably for ABI reasons, so these tests are marked `UNSUPPORTED: libc++`.

4 years ago[clangd] Update the new clangd url, NFC.
Haojian Wu [Fri, 8 May 2020 13:11:44 +0000 (15:11 +0200)]
[clangd] Update the new clangd url, NFC.

4 years agoCachePruning.h - reduce StringRef.h to Optional.h include. NFC
Simon Pilgrim [Fri, 8 May 2020 12:15:49 +0000 (13:15 +0100)]
CachePruning.h - reduce StringRef.h to Optional.h include. NFC

We only need to include Optional.h, forward declare StringRef and move the StringRef.h include down to CachePruning.cpp.

4 years agoItaniumManglingCanonicalizer - reduce StringRef.h include to forward declaration...
Simon Pilgrim [Fri, 8 May 2020 12:02:57 +0000 (13:02 +0100)]
ItaniumManglingCanonicalizer - reduce StringRef.h include to forward declaration + remove duplicate includes. NFC

4 years ago[lldb] Fix RecordDecl match string in module-ownership.mm to get the test running...
Raphael Isemann [Fri, 8 May 2020 12:43:16 +0000 (14:43 +0200)]
[lldb] Fix RecordDecl match string in module-ownership.mm to get the test running again

The relevant output FileCheck is scanning in this test is as follows:

    CXXRecordDecl 0x7f96cf8239c8 <<invalid sloc>> <invalid sloc> imported in A.B <undeserialized declarations> struct definition
    <<DefinitionData boilerplate>>
    `-FieldDecl 0x7f96cf823b90 <<invalid sloc>> <invalid sloc> imported in A.B anon_field_b 'int'
    (anonymous struct)
    CXXRecordDecl 0x7f96cf823be8 <<invalid sloc>> <invalid sloc> imported in A.B struct

Before 710fa2c4ee346e1ec2db66ac5fdf6909e79d9a8c this test was passing by
accident as it had a -DAG suffix in the checks changed by this patch,
causing FileCheck to first match the last line of the output above
(instead of the first one), and then finding the FieldDecl above.
When I removed the -DAG suffix, FileCheck actually enforced the ordering
and started failing as the FieldDecl comes before the CXXRecordDecl match
we get.

This patch fixes the CXXRecordDecl check to find the first line of the output
above which caused FileCheck to also find the FieldDecl that follows. Also
gives the FieldDecl a more unique name to make name collisions less likely.

4 years agoRevert "Recommit "[LV] Induction Variable does not remain scalar under tail-folding.""
Benjamin Kramer [Fri, 8 May 2020 12:48:17 +0000 (14:48 +0200)]
Revert "Recommit "[LV] Induction Variable does not remain scalar under tail-folding.""

This reverts commit ae45b4dbe73ffde5fe3119835aa947d5a49635ed. It
causes miscompilations, test case on the mailing list.

4 years ago[lldb] Prevent objc-root-class warning when compiling module-ownership.mm test
Raphael Isemann [Fri, 8 May 2020 12:40:57 +0000 (14:40 +0200)]
[lldb] Prevent objc-root-class warning when compiling module-ownership.mm test

This test was generating the following false-positive warning when being compiled:
 warning: class 'SomeClass' defined without specifying a base class [-Wobjc-root-class]

4 years ago[clangd] Fix crash in AddUsing tweak due to non-identifier DeclName
Adam Czachorowski [Fri, 8 May 2020 12:23:19 +0000 (14:23 +0200)]
[clangd] Fix crash in AddUsing tweak due to non-identifier DeclName

Patch by Adam Czachorowski!

Reviewers: hokein

Reviewed By: hokein

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

Tags: #clang

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

4 years ago[lldb] Make module-ownership.mm test more robust against AST node ordering
Raphael Isemann [Fri, 8 May 2020 11:26:42 +0000 (13:26 +0200)]
[lldb] Make module-ownership.mm test more robust against AST node ordering

The current test is checking both the anonymous structs and the template
specializations in one FileCheck run, but the anonymous struct line can
partially match the AST dump of a template specialization, causing that
FileCheck won't match that same line later against the template specialization
check and incorrectly fails on that check. This only happens when the
template specialization node somehow ends up before the anonymous struct node.

This patch just puts the checks for the anonymous structs in their own FileCheck
run to prevent them from partially matching any other record decl.

Fixes rdar://62997926

4 years ago[X86][AVX] Don't let X86ISD::BROADCAST peek through bitcasts to illegal types.
Simon Pilgrim [Fri, 8 May 2020 11:30:33 +0000 (12:30 +0100)]
[X86][AVX] Don't let X86ISD::BROADCAST peek through bitcasts to illegal types.

This was an existing bug exposed by the more aggressive X86ISD::BROADCAST generation by rG8817334ce3c7

Original test case thanks to @mstorsjo

4 years agoRemarkStringTable.h - reduce StringRef/Remark includes to forward declarations. NFC
Simon Pilgrim [Fri, 8 May 2020 11:25:15 +0000 (12:25 +0100)]
RemarkStringTable.h - reduce StringRef/Remark includes to forward declarations. NFC

Move StringRef.h include down to RemarkStringTable.cpp and remove some unused includes there as well.

4 years ago[compiler-rt] Reduce the number of threads in gcov test to avoid failure
Calixte Denizet [Fri, 8 May 2020 09:04:17 +0000 (11:04 +0200)]
[compiler-rt] Reduce the number of threads in gcov test to avoid failure

Summary:
Patch in D78477 introduced a new test for gcov and this test is failing on arm:
 - http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-full-sh/builds/4752/steps/ninja%20check%202/logs/stdio
  - http://lab.llvm.org:8011/builders/clang-cmake-armv7-full/builds/10501/steps/ninja%20check%202/logs/stdio
So try to fix it in reducing the number of threads.

Reviewers: marco-c

Reviewed By: marco-c

Subscribers: dberris, kristof.beyls, #sanitizers, serge-sans-paille, sylvestre.ledru

Tags: #sanitizers

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

4 years agoRemark.h - reduce ArrayRef.h include to SmallVector.h. NFC.
Simon Pilgrim [Thu, 7 May 2020 17:06:23 +0000 (18:06 +0100)]
Remark.h - reduce ArrayRef.h include to SmallVector.h. NFC.

We only need to include SmallVector.h in Remark.h, and then the more bulky ArrayRef.h in Remark.cpp.

4 years agoAArch6/ARMTargetParser.h - move Triple.h dependency down to cpp file. NFC.
Simon Pilgrim [Thu, 7 May 2020 16:14:14 +0000 (17:14 +0100)]
AArch6/ARMTargetParser.h - move Triple.h dependency down to cpp file. NFC.

Reduce Triple.h include to a forward declaration in the header. Only the implementations in the cpp files need the actual Triple class definition.

4 years ago[MLIR] Add complex addition and substraction to the standard dialect
Frederik Gossen [Fri, 8 May 2020 09:49:48 +0000 (09:49 +0000)]
[MLIR] Add complex addition and substraction to the standard dialect

Complex addition and substraction are the first two binary operations on complex
numbers.
Remaining operations will follow the same pattern.

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

4 years ago[clangd] NFC: Use deprecated grpc++ headers for compatibility
Kirill Bobyrev [Fri, 8 May 2020 09:01:34 +0000 (11:01 +0200)]
[clangd] NFC: Use deprecated grpc++ headers for compatibility

Summary:
Ubuntu 18.04 and older versions do not provide latest gRCP packages and the
ones that are in the repository use deprecated headers. Use these headers to
make builds possible.

https://packages.ubuntu.com/bionic/amd64/libgrpc++-dev/filelist

Reviewers: sammccall

Reviewed By: sammccall

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

Tags: #clang

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

4 years agoFix a failing test.
Igor Kudrin [Fri, 8 May 2020 08:36:01 +0000 (15:36 +0700)]
Fix a failing test.

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

4 years agoReapply [InstSimplify] Remove known bits constant folding
Nikita Popov [Fri, 20 Mar 2020 10:57:20 +0000 (11:57 +0100)]
Reapply [InstSimplify] Remove known bits constant folding

No changes relative to last time, but after a mitigation for
an AMDGPU regression landed.

---

If SimplifyInstruction() does not succeed in simplifying the
instruction, it will compute the known bits of the instruction
in the hope that all bits are known and the instruction can be
folded to a constant. I have removed a similar optimization
from InstCombine in D75801, and would like to drop this one as well.

On average, we spend ~1% of total compile-time performing this
known bits calculation. However, if we introduce some additional
statistics for known bits computations and how many of them succeed
in simplifying the instruction we get (on test-suite):

    instsimplify.NumKnownBits: 216
    instsimplify.NumKnownBitsComputed: 13828375
    valuetracking.NumKnownBitsComputed: 45860806

Out of ~14M known bits calculations (accounting for approximately
one third of all known bits calculations), only 0.0015% succeed in
producing a constant. Those cases where we do succeed to compute
all known bits will get folded by other passes like InstCombine
later. On test-suite, only lencod.test and GCC-C-execute-pr44858.test
show a hash difference after this change. On lencod we see an
improvement (a loop phi is optimized away), on the GCC torture
test a regression (a function return value is determined only
after IPSCCP, preventing propagation from a noinline function.)

There are various regressions in InstSimplify tests. However, all
of these cases are already handled by InstCombine, and corresponding
tests have already been added there.

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

4 years ago[DebugInfo] Fix handling DW_OP_call_ref in DWARF64 units.
Igor Kudrin [Fri, 8 May 2020 08:02:20 +0000 (15:02 +0700)]
[DebugInfo] Fix handling DW_OP_call_ref in DWARF64 units.

DW_OP_call_ref is the only operation that has an operand which depends
on the DWARF format. The patch fixes handling that operation in DWARF64
units.

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

4 years ago[DebugInfo] Fix printing values of forms which depend on the DWARF format.
Igor Kudrin [Fri, 8 May 2020 05:58:01 +0000 (12:58 +0700)]
[DebugInfo] Fix printing values of forms which depend on the DWARF format.

The values are 8 bytes long in DWARF64, so they should not be truncated
to uint32_t on dumping.

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

4 years ago[AMDGPU] Try to determine sign bit during div/rem expansion
Nikita Popov [Thu, 7 May 2020 20:42:18 +0000 (22:42 +0200)]
[AMDGPU] Try to determine sign bit during div/rem expansion

This is preparation for D79294, which removes an expensive
InstSimplify optimization, on the assumption that it will be
picked up by InstCombine instead. Of course, this does not hold
up if a backend performs non-trivial IR expansions without running
a canonicalization pipeline afterwards, which turned up as an
issue in the context of AMDGPU div/rem expansion.

This patch mitigates the issue by explicitly performing a known
bits calculation where it matters. No test changes, as those would
only be visible after the other patch lands.

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

4 years ago[mlir] Updated SideEffect interface definitions to use tablegen Resource objects.
Marcel Koester [Mon, 27 Apr 2020 11:46:04 +0000 (13:46 +0200)]
[mlir] Updated SideEffect interface definitions to use tablegen Resource objects.

The SideEffect interface definitions currently use string expressions to
reference custom resource objects. This CL introduces Resource objects in
tablegen definitions to simplify linking of resource reference to resource
objects.

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

4 years ago[X86] Add v32i8 and v64i8 tests to vec_smulo.ll and vec_umulo.ll. NFC
Craig Topper [Fri, 8 May 2020 05:16:23 +0000 (22:16 -0700)]
[X86] Add v32i8 and v64i8 tests to vec_smulo.ll and vec_umulo.ll. NFC

I was look at our vXi8 handling in LowerMULH and noticed that
vXi8 mulo uses but we don't test all types.

4 years ago [flang]Semantics for SELECT RANK.
sameeran joshi [Wed, 22 Apr 2020 09:16:37 +0000 (14:46 +0530)]
[flang]Semantics for SELECT RANK.

    Summary:
    Initially on github I worked on semantic checks.Then I tried some compile-time
    test of the rank value, they were failing as there were no symbols
    generated for them inside SELECT RANK's scope.So I went further to
    add new symbol in each scope, also added the respective 'rank: '
    field for a symbol when we dump the symboltable. I added a field to
    keep track of the rank in AssocEntityDetails class.This caused shape
    analysis framework to become inconsistent. So shape analysis framework
    was updated to handle this new representation.

 *   I added more tests for above changes.

 *   On phabricator I addressed some minor changes.

 *   Lastly I worked on review comments.

    Reviewers: klausler,sscalpone,DavidTruby,kiranchandramohan,tskeith,anchu-rajendran,kiranktp

    Reviewed By:klausler, DavidTruby, tskeith

    Subscribers:#flang-commits, #llvm-commits

    Tags: #flang, #llvm

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

4 years agoFix false positive with -Wnon-c-typedef-for-linkage
Weverything [Fri, 8 May 2020 01:47:19 +0000 (18:47 -0700)]
Fix false positive with -Wnon-c-typedef-for-linkage

Implicit methods for structs can confuse the warning, so exclude checking
the Decl's that are implicit. Implicit Decl's for lambdas still need to
be checked, so skipping all implicit Decl's won't work.

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

4 years ago[llvm] [CodeGen] Fixed vector halving bug for masked store
aartbik [Fri, 8 May 2020 01:39:10 +0000 (18:39 -0700)]
[llvm] [CodeGen] Fixed vector halving bug for masked store

Summary:
Note that this fix is very similar to what has already been
done for the masked load in https://reviews.llvm.org/D78608

Bugs:
https://bugs.llvm.org/show_bug.cgi?id=45563
https://bugs.llvm.org/show_bug.cgi?id=45833

Reviewers: craig.topper, nicolasvasilache, mehdi_amini

Reviewed By: craig.topper

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoAdd a new lockdownd plist for launching posix processes
Jason Molenda [Fri, 8 May 2020 01:52:10 +0000 (18:52 -0700)]
Add a new lockdownd plist for launching posix processes

Similar to
com.apple.debugserver.plist & com.apple.debugserver.internal.plist
com.apple.debugserver.applist.plist & com.apple.debugserver.applist.internal.plist
add a variant of the posix plist.

<rdar://problem/62995567>

4 years ago[Object] Remove unneeded check in ELFFile<ELFT>::dynamicEntries().
Xing GUO [Fri, 8 May 2020 01:54:08 +0000 (09:54 +0800)]
[Object] Remove unneeded check in ELFFile<ELFT>::dynamicEntries().

Check for `DynSecSize % sizeof(Elf_Dyn) != 0` is unneeded in this context.

1. If the .dynamic section is acquired from program headers, the .dynamic
section is "cut off" by

```
makeArrayRef(..., Phdr.p_filesz / sizeof(Elf_Dyn));
DynSeSize = Phdr.p_filesz;
```

2. If the .dynamic section is acquired from section headers, the .dynamic
section is checked in `getSectionContentsAsArray<Elf_Dyn>(&Sec)`.

Reviewed By: MaskRay

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

4 years agoUniuqe Names for Internal Linkage Symbols.
Sriraman Tallam [Fri, 8 May 2020 01:18:37 +0000 (18:18 -0700)]
Uniuqe Names for Internal Linkage Symbols.

This is a standalone patch and this would help Propeller do a better job of code
layout as it can accurately attribute the profiles to the right internal linkage
function.

This also helps SampledFDO/AutoFDO correctly associate sampled profiles to the
right internal function. Currently, if there is more than one internal symbol
foo, their profiles are aggregated by SampledFDO.

This patch adds a new clang option, -funique-internal-funcnames, to generate
unique names for functions with internal linkage. This patch appends the md5
hash of the module name to the function symbol as a best effort to generate a
unique name for symbols with internal linkage.

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

4 years ago[LoopFusion] Remove unreachable blocks from DT and LI after fusion
Diego Caballero [Tue, 21 Apr 2020 19:10:55 +0000 (22:10 +0300)]
[LoopFusion] Remove unreachable blocks from DT and LI after fusion

This patch removes FC0.ExitBlock and FC1GuardBlock from DT and LI
after fusion of guarded loops. They become unreachable and LI
verification failed when they happened to be inside another loop.

Reviewed By: kbarton

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

4 years agoRevert "[YAMLVFSWriter][Test][NFC] Add couple tests"
Nico Weber [Thu, 7 May 2020 23:07:08 +0000 (19:07 -0400)]
Revert "[YAMLVFSWriter][Test][NFC] Add couple tests"

This reverts commit 7143d7925490e9123b1c93305700221584ba10c6.
Breaks check-llvm on Windows, see e.g.
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/15919/steps/stage%201%20check/logs/stdio

4 years agoCorrectly modify the CFG in IfConverter, and then remove the
James Y Knight [Thu, 20 Feb 2020 06:16:13 +0000 (01:16 -0500)]
Correctly modify the CFG in IfConverter, and then remove the
CorrectExtraCFGEdges function.

The latter was a workaround for "Various pieces of code" leaving bogus
extra CFG edges in place. Where by "various" it meant only
IfConverter::MergeBlocks, which failed to clear all of the successors
of dead blocks it emptied out. This wouldn't matter a whole lot,
except that the dead blocks remained listed as predecessors of
still-useful blocks, inhibiting optimizations.

This fix slightly changed two thumb tests, because the correct CFG
successors allowed for the "diamond" if-conversion pattern to be
detected, when it could only use "simple" before.

Additionally, the removal of a now-redundant call to analyzeBranch
(with AllowModify=true) in BranchFolder::OptimizeFunction caused a
later check for an empty block in BranchFolder::OptimizeBlock to
fail. Correct this by moving the call to analyzeBranch in
OptimizeBlock higher.

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

4 years ago[lldb/Test] Skip more tests that are not expected to work with passive replay
Jonas Devlieghere [Thu, 7 May 2020 22:13:18 +0000 (15:13 -0700)]
[lldb/Test] Skip more tests that are not expected to work with passive replay

This skips some tests that pass with active replay (which doesn't check
the output) but fail with passive replay. Valid reasons for this
include:

 - Checking the output of the process (which doesn't run during replay),
 - Checking files that cannot be captured in the VFS (non-existing or
   unreadable files or files that are removed during test),

Unfortunately there's no good way to mark a test as supported for active
replay but unsupported for passive replay because the number and order
of API calls needs to be identical during capture and replay. I don't
think this is a huge loss however.

4 years ago[Attributor][FIX] Record dependences for assumed dead abstract attributes
Johannes Doerfert [Thu, 7 May 2020 21:50:50 +0000 (16:50 -0500)]
[Attributor][FIX] Record dependences for assumed dead abstract attributes

In a recent patch we introduced a problem with abstract attributes that
were assumed dead at some point. Since `Attributor::updateAA` was
introduced in 95e0d28b71e42c9b7cd77c96f728311981a021f6, we did not
remember the dependence on the liveness AA when an abstract attribute
was assumed dead and therefore not updated.

Explicit reproducer added in liveness.ll.

---

Single run of the Attributor module and then CGSCC pass (oldPM)
for SPASS/clause.c (~10k LLVM-IR loc):

Before:
```
calls to allocation functions: 509242 (345483/s)
temporary memory allocations: 98666 (66937/s)
peak heap memory consumption: 18.60MB
peak RSS (including heaptrack overhead): 103.29MB
total memory leaked: 269.10KB
```

After:
```
calls to allocation functions: 529332 (355494/s)
temporary memory allocations: 102107 (68574/s)
peak heap memory consumption: 19.40MB
peak RSS (including heaptrack overhead): 102.79MB
total memory leaked: 269.10KB
```

Difference:
```
calls to allocation functions: 20090 (1339333/s)
temporary memory allocations: 3441 (229400/s)
peak heap memory consumption: 801.45KB
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B
```

4 years ago[Attributor] Mark dependence as optional
Johannes Doerfert [Thu, 7 May 2020 21:47:57 +0000 (16:47 -0500)]
[Attributor] Mark dependence as optional

4 years ago[libc++] ECMAScript IdentityEscape is ambiguous (2584)
zoecarver [Thu, 7 May 2020 21:26:25 +0000 (14:26 -0700)]
[libc++] ECMAScript IdentityEscape is ambiguous (2584)

This patch fixes [[ https://cplusplus.github.io/LWG/issue2584 | 2584 ]]. Now the following works:
    const std::regex r1("\\z");
    assert(std::regex_match("z", r1));

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

4 years agogetMainExecutable: Fix hand-rolled AT_EXECPATH for older FreeBSD
Ed Maste [Thu, 7 May 2020 18:57:11 +0000 (14:57 -0400)]
getMainExecutable: Fix hand-rolled AT_EXECPATH for older FreeBSD

Once we hit AT_NULL, we need to bail out of the loop; not just the
enclosing switch.  This fixes basic usage (e.g. `cc --version`) when
AT_EXECPATH isn't present on older branches (e.g. under
emu-user-static, at the moment), where we would previously run off
the end of ::environ.

Patch By: kevans

Reviewed By: arichardson

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

4 years ago[libcxx] [NFC] fpos Requirements (p0759r1).
zoecarver [Thu, 7 May 2020 21:01:58 +0000 (14:01 -0700)]
[libcxx] [NFC] fpos Requirements (p0759r1).

Implements p0759r1. Test-only change. Adds explicit test for table 106 and type checking.

Differential Review: https://reviews.llvm.org/D60491

4 years ago[clang-format] [PR45639] clang-format splits up the brackets of C++17 attribute ...
mydeveloperday [Thu, 7 May 2020 20:57:14 +0000 (21:57 +0100)]
[clang-format] [PR45639] clang-format splits up the brackets of C++17 attribute [[ ]] when used with the first parameter

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

clang-format incorrectly splits the `[[` in a long argument list

```
void SomeLongClassName::ALongMethodNameInThatClass([[maybe_unused]] const shared_ptr<ALongTypeName>& argumentNameForThat
LongType) {

}
```

becomes

```
void SomeLongClassName::ALongMethodNameInThatClass([
    [maybe_unused]] const shared_ptr<ALongTypeName> &argumentNameForThatLongType) {

}
```

leaving one `[` on the previous line

For a function with just 1 very long argument, clang-format chooses to split between the `[[`,

This revision prevents the slip between the two `[` and the second `[`

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang, #clang-format

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

4 years ago[SimpleLoopUnswitch] Update DefaultExit condition to check unreachable is not empty.
Alina Sbirlea [Thu, 16 Apr 2020 04:49:00 +0000 (21:49 -0700)]
[SimpleLoopUnswitch] Update DefaultExit condition to check unreachable is not empty.

Summary:
Update the check for the default exit block to not only check that the
terminator is not unreachable, but also check that unreachable block has
*only* the unreachable instruction.

Reviewers: chandlerc

Subscribers: hiraditya, uabelho, llvm-commits

Tags: #llvm

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

4 years agoRemove unused _LIBCPP_RAW_ITERATORS
Marcel Hlopko [Thu, 7 May 2020 20:14:26 +0000 (22:14 +0200)]
Remove unused _LIBCPP_RAW_ITERATORS

Summary: This change removes seemingly unused _LIBCPP_RAW_ITERATORS.

Reviewers: #libc, EricWF, ldionne

Reviewed By: #libc, EricWF, ldionne

Subscribers: dexonsmith, ldionne, gribozavr2, libcxx-commits

Tags: #libc

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

4 years agoEnsure aux-target specific builtins get validated.
Erich Keane [Thu, 7 May 2020 16:28:10 +0000 (09:28 -0700)]
Ensure aux-target specific builtins get validated.

I discovered that when using an aux-target builtin, it was recognized as
a builtin but never checked. This patch checks for an aux-target builtin
and instead validates it against the correct target.

It does this by extracting the checking code for Target-specific
builtins into its own function, then calls with either targetInfo or
AuxTargetInfo.

4 years ago[VectorCombine] adjust test to make intent clearer; NFC
Sanjay Patel [Thu, 7 May 2020 20:08:43 +0000 (16:08 -0400)]
[VectorCombine] adjust test to make intent clearer; NFC

Create a non-zero result to show that the other lane is computed correctly.

4 years ago[NFC] Adjust test check lines for D78267.
Huihui Zhang [Thu, 7 May 2020 20:18:09 +0000 (13:18 -0700)]
[NFC] Adjust test check lines for D78267.

This wasn't identified through buildbot before.

4 years agoAllow -fsanitize-minimal-runtime with memtag sanitizer.
Evgenii Stepanov [Tue, 14 Apr 2020 21:38:10 +0000 (14:38 -0700)]
Allow -fsanitize-minimal-runtime with memtag sanitizer.

Summary:
MemTag does not have any runtime at the moment, it's strictly code
instrumentation.

Reviewers: pcc

Subscribers: cryptoad, cfe-commits

Tags: #clang

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

4 years ago[InstCombine][SVE] Fix visitExtractElementInst for scalable type.
Huihui Zhang [Thu, 7 May 2020 20:03:26 +0000 (13:03 -0700)]
[InstCombine][SVE] Fix visitExtractElementInst for scalable type.

Summary:
This patch fix the following issues with visitExtractElementInst:

      1. Restrict VectorUtils::findScalarElement to fixed-length vector.
         For scalable type, the number of elements in shuffle mask is
         unknown at compile-time.
      2. Fix out-of-range calculation for fixed-length vector.
      3. Skip scalable type when analysis rely on fixed number of elements.
      4. Add unit tests to check functionality of extractelement for scalable type.

Reviewers: sdesmalen, efriedma, spatel, nikic

Reviewed By: efriedma

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years agoMake -Wnonportable-include-path ignore drive case on Windows.
Nico Weber [Thu, 7 May 2020 00:19:14 +0000 (20:19 -0400)]
Make -Wnonportable-include-path ignore drive case on Windows.

See PR45812 for motivation.

No explicit test since I couldn't figure out how to get the
current disk drive in lower case into a form in lit where I could
mkdir it and cd to it. But the change does have test coverage in
that I can remove the case normalization in lit, and tests failed
on several bots (and for me locally if in a pwd with a lower-case
drive) without that normalization prior to this change.

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

4 years agoAdd static assert to ID Table to make sure aux targets work right.
Erich Keane [Thu, 7 May 2020 19:11:03 +0000 (12:11 -0700)]
Add static assert to ID Table to make sure aux targets work right.

I discovered that the limit on possible builtins managed by this
ObjCOrBuiltin variable is too low when combining large targets, since
aux-targets are appended to the targets list. A runtime assert exists
for this, however this patch creates a static-assert as well.

The logic for said static-assert is to make sure we have the room for
the aux-target and target to both be the largest list, which makes sure
we have room for all possible combinations.

I also incremented the number of bits by 1, since I discovered this
currently broken.  The current bit-count was 36, so this doesn't
increase any size.

4 years ago[InstCombine][SVE] Fix visitInsertElementInst for scalable type.
Huihui Zhang [Thu, 7 May 2020 19:43:14 +0000 (12:43 -0700)]
[InstCombine][SVE] Fix visitInsertElementInst for scalable type.

Summary:
This patch fixes the following issues in visitInsertElementInst:

      1. Bail out for scalable type when analysis requires fixed size number of vector elements.
      2. Use cast<FixedVectorType> to get vector number of elements. This ensure assertion
          on scalable vector type.
      3. For scalable type, avoid folding a chain of insertelement into splat:
            insertelt(insertelt(insertelt(insertelt X, %k, 0), %k, 1), %k, 2) ...
              ->
            shufflevector(insertelt(X, %k, 0), undef, zero)
          The length of scalable vector is unknown at compile-time, therefore we don't know if
          given insertelement sequence is valid for splat.

Reviewers: sdesmalen, efriedma, spatel, nikic

Reviewed By: sdesmalen, efriedma

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years ago[mlir] Add NamedAttrList
Jacques Pienaar [Wed, 6 May 2020 20:48:36 +0000 (13:48 -0700)]
[mlir] Add NamedAttrList

This is a wrapper around vector of NamedAttributes that keeps track of whether sorted and does some minimal effort to remain sorted (doing more, e.g., appending attributes in sorted order, could be done in follow up). It contains whether sorted and if a DictionaryAttr is queried, it caches the returned DictionaryAttr along with whether sorted.

Change MutableDictionaryAttr to always return a non-null Attribute even when empty (reserve null cases for errors). To this end change the getter to take a context as input so that the empty DictionaryAttr could be queried. Also create one instance of the empty dictionary attribute that could be reused without needing to lock context etc.

Update infer type op interface to use DictionaryAttr and use NamedAttrList to avoid incurring multiple conversion costs.

Fix bug in sorting helper function.

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

4 years ago[VectorCombine] add tests with undefs; NFC
Sanjay Patel [Thu, 7 May 2020 19:23:37 +0000 (15:23 -0400)]
[VectorCombine] add tests with undefs; NFC

Goes with D79452.

4 years agoAMDGPU: Fix broken tests for HSA metadata
Matt Arsenault [Thu, 7 May 2020 18:26:14 +0000 (14:26 -0400)]
AMDGPU: Fix broken tests for HSA metadata

These were testing byval private kernel arguments, which doesn't make
any sense and has never been used. There didn't seem to be any tests
for real value struct arguments, which are.

4 years ago[SLP] add another bailout for load-combine patterns (2nd try)
Sanjay Patel [Thu, 7 May 2020 19:00:23 +0000 (15:00 -0400)]
[SLP] add another bailout for load-combine patterns (2nd try)

The original patch (rG86dfbc676ebe) exposed an existing bug:
we could wrongly cast a constant expression to BinaryOperator
because the pattern matching allows that. This adds a check
for that case, and there's a reduced test case to verify no
crashing.

Original commit message:

This builds on the or-reduction bailout that was added with D67841.
We still do not have IR-level load combining, although that could
be a target-specific enhancement for -vector-combiner.

The heuristic is narrowly defined to catch the motivating case from
PR39538:
https://bugs.llvm.org/show_bug.cgi?id=39538
...while preserving existing functionality.

That is, there's an unmodified test of pure load/zext/store that is
not seen in this patch at llvm/test/Transforms/SLPVectorizer/X86/cast.ll.
That's the reason for the logic difference to require the 'or'
instructions. The chances that vectorization would actually help a
memory-bound sequence like that seem small, but it looks nicer with:

  vpmovzxwd     (%rsi), %xmm0
  vmovdqu       %xmm0, (%rdi)

rather than:

  movzwl        (%rsi), %eax
  movl  %eax, (%rdi)
  ...

In the motivating test, we avoid creating a vector mess that is
unrecoverable in the backend, and SDAG forms the expected bswap
instructions after load combining:

  movzbl (%rdi), %eax
  vmovd %eax, %xmm0
  movzbl 1(%rdi), %eax
  vmovd %eax, %xmm1
  movzbl 2(%rdi), %eax
  vpinsrb $4, 4(%rdi), %xmm0, %xmm0
  vpinsrb $8, 8(%rdi), %xmm0, %xmm0
  vpinsrb $12, 12(%rdi), %xmm0, %xmm0
  vmovd %eax, %xmm2
  movzbl 3(%rdi), %eax
  vpinsrb $1, 5(%rdi), %xmm1, %xmm1
  vpinsrb $2, 9(%rdi), %xmm1, %xmm1
  vpinsrb $3, 13(%rdi), %xmm1, %xmm1
  vpslld $24, %xmm0, %xmm0
  vpmovzxbd %xmm1, %xmm1 # xmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero,xmm1[2],zero,zero,zero,xmm1[3],zero,zero,zero
  vpslld $16, %xmm1, %xmm1
  vpor %xmm0, %xmm1, %xmm0
  vpinsrb $1, 6(%rdi), %xmm2, %xmm1
  vmovd %eax, %xmm2
  vpinsrb $2, 10(%rdi), %xmm1, %xmm1
  vpinsrb $3, 14(%rdi), %xmm1, %xmm1
  vpinsrb $1, 7(%rdi), %xmm2, %xmm2
  vpinsrb $2, 11(%rdi), %xmm2, %xmm2
  vpmovzxbd %xmm1, %xmm1 # xmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero,xmm1[2],zero,zero,zero,xmm1[3],zero,zero,zero
  vpinsrb $3, 15(%rdi), %xmm2, %xmm2
  vpslld $8, %xmm1, %xmm1
  vpmovzxbd %xmm2, %xmm2 # xmm2 = xmm2[0],zero,zero,zero,xmm2[1],zero,zero,zero,xmm2[2],zero,zero,zero,xmm2[3],zero,zero,zero
  vpor %xmm2, %xmm1, %xmm1
  vpor %xmm1, %xmm0, %xmm0
  vmovdqu %xmm0, (%rsi)

  movl  (%rdi), %eax
  movl  4(%rdi), %ecx
  movl  8(%rdi), %edx
  movbel        %eax, (%rsi)
  movbel        %ecx, 4(%rsi)
  movl  12(%rdi), %ecx
  movbel        %edx, 8(%rsi)
  movbel        %ecx, 12(%rsi)

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