Commit Graph

353982 Commits

Author SHA1 Message Date
Hubert Tong ab59aa6c61 [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
2020-05-08 16:51:34 -04:00
Hubert Tong b116ded57d [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
2020-05-08 16:51:34 -04:00
Jessica Paquette f66309deab [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
2020-05-08 13:40:02 -07:00
Sanjay Patel 0d2a0b44c8 [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
2020-05-08 16:31:12 -04:00
Jonas Devlieghere eb7d32e46f [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.
2020-05-08 13:14:18 -07:00
Eric Fiselier c490c5e81a 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.
2020-05-08 21:52:27 +02:00
Craig Topper 465f5648ee [X86] Remove the mayLoad and mayStore flags from vzeroupper/vzeroall.
But leave the hasUnmodelledSideEffects flag.
2020-05-08 12:47:20 -07:00
Sanjay Patel 46d6f76be3 [InstCombine] fix typo in comment; NFC 2020-05-08 15:43:14 -04:00
zoecarver f65f566aeb 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
2020-05-08 12:24:10 -07:00
Sanjay Patel 1aa8cef97a [InstCombine] add/adjust tests for fpext of casted value; NFC 2020-05-08 15:22:36 -04:00
Sanjay Patel 5cf17034e5 [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.
2020-05-08 15:22:36 -04:00
zoecarver afc8b49782 [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.
2020-05-08 12:19:38 -07:00
Raphael Isemann 7b1f1cf1cf [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
2020-05-08 21:17:32 +02:00
Craig Topper adf3b8e366 [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.
2020-05-08 11:50:58 -07:00
Wei Mi aa2ddfc73d [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
2020-05-08 11:18:09 -07:00
Wei Mi 538208f6c0 [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
2020-05-08 11:14:48 -07:00
Ricky Zhou b38d77f185 [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
2020-05-08 11:10:25 -07:00
Simon Pilgrim 70293ba26f [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
2020-05-08 19:04:49 +01:00
David Tenty d26a8daa49 [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
2020-05-08 14:00:25 -04:00
Lawrence D'Anna 52712d3ff7 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
2020-05-08 10:57:10 -07:00
Adrian Prantl ae920a81ff 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
2020-05-08 10:47:13 -07:00
Sanjay Patel df5c9fdaac [InstCombine] add tests for known bits before FP casts; NFC 2020-05-08 13:44:32 -04:00
zoecarver 26466efe08 Revert "[libc++] ECMAScript IdentityEscape is ambiguous (2584)"
This reverts commit 6d2a66b10d.

The regex expressions in some lld tests need to be fixed. Reverting
until those are fixed.
2020-05-08 10:37:04 -07:00
Nico Weber 51d938bc94 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
2020-05-08 13:33:39 -04:00
Evgenii Stepanov eaea9ed835 [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
2020-05-08 10:31:25 -07:00
Raphael Isemann fcf10d1908 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
2020-05-08 19:25:02 +02:00
Reid Kleckner 3b3e28a07c [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
2020-05-08 10:23:27 -07:00
Vedant Kumar 8cb86ead77 [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
2020-05-08 10:22:58 -07:00
Matt Arsenault 78a43f10c7 AMDGPU: Don't assert on unknown address spaces
Assume unknown address spaces behave like some flavor of global
memory.
2020-05-08 12:57:27 -04:00
Nico Weber e20fcf0504 Unbreak clang-tidy tests after D79599 / e9b4113902. 2020-05-08 12:37:33 -04:00
Fangrui Song befbc99a7f 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
2020-05-08 09:35:54 -07:00
Raphael Isemann 7cf4ab13af [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
2020-05-08 18:13:58 +02:00
Sanjay Patel ff9045dc9c [InstCombine] clean up foldItoFPtoI; NFC
Mostly cosmetic improvements to variable names and logic to ease
refactoring suggested in D79116.
2020-05-08 12:13:42 -04:00
Arthur Eubanks 355633860e 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
2020-05-08 09:12:41 -07:00
Nico Weber e9b4113902 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
2020-05-08 11:41:45 -04:00
Krasimir Georgiev c5e0967e4c Revert "[DebugInfo] Fix handling DW_OP_call_ref in DWARF64 units."
This reverts commit 989ae9e848.

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
2020-05-08 17:24:32 +02:00
Denis Khalikov b5973d20b3 [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
2020-05-08 18:10:18 +03:00
Matt Arsenault d8d62e358e 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.
2020-05-08 10:46:00 -04:00
Matt Arsenault fda0c8df28 AMDGPU: Lower addrspacecast to 32-bit constant
Somehow this was missing from the DAG path, but not global isel.
2020-05-08 10:46:00 -04:00
Fangrui Song e20a215992 [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
2020-05-08 07:37:06 -07:00
Sanjay Patel 97828928ee [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.
2020-05-08 10:14:03 -04:00
Sanjay Patel 09d70e0588 [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.
2020-05-08 10:14:03 -04:00
Simon Pilgrim 9f726376e3 LiveIntervalCalc - remove unnecessary includes. NFC.
As we're inheriting from LiveRangeCalc, all the headers are already explicitly required by LiveRangeCalc.h
2020-05-08 14:57:35 +01:00
Simon Pilgrim 3561526208 DFAEmitter.h - remove unnecessary headers. NFC.
Reduce StringRef.h include to forward declaration and add implicit SmallVector.h and <map> include dependencies.
2020-05-08 14:53:10 +01:00
Simon Pilgrim fa22594c0f ItaniumManglingCanonicalizer.h - add cstdint.h include for missing uintptr_t def
MSVC builds don't need it but everything else does.
2020-05-08 14:22:26 +01:00
David Green dc2b282a8a [ARM] Change test target to arm-none-none-eabi. NFC 2020-05-08 14:16:31 +01:00
Casey Carter 197f185274 [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++`.
2020-05-08 06:14:25 -07:00
Haojian Wu ad811a2728 [clangd] Update the new clangd url, NFC. 2020-05-08 15:11:44 +02:00
Simon Pilgrim a30f5fd94d 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.
2020-05-08 14:06:53 +01:00
Simon Pilgrim c60c80e0cf ItaniumManglingCanonicalizer - reduce StringRef.h include to forward declaration + remove duplicate includes. NFC 2020-05-08 14:06:53 +01:00