Commit Graph

354302 Commits

Author SHA1 Message Date
Kellie Medlin 2b920ae78c [lld] Add archive file support to Mach-O backend
With this change, basic archive files can be linked together. Input
section discovery has been refactored into a function since archive
files lazily resolve their symbols / the object files containing those
symbols.

Reviewed By: int3, smeenai

Differential Revision: https://reviews.llvm.org/D78342
2020-05-14 12:58:35 -07:00
Christopher Tetreault 920ff806d4 [SVE] Remove usages of VectorType::getNumElements() from SystemZ
Reviewers: efriedma, david-arm, c-rhodes, jnspaulsson

Reviewed By: david-arm

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

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79824
2020-05-14 12:46:51 -07:00
Eli Friedman 44ecaabc07 [BitcodeReader] datalayout must be specified before it is queried.
This isn't really a new invariant; it effectively already existed due to
existing DataLayout queries.  But this makes it explicit.

This is technically not backward-compatible with the existing bitcode
reader, but it's backward-compatible with the output of the bitcode
writer, which is what matters in practice.

No testcase because I don't know a good way to write one: there are no
existing tools that can generate a bitcode file that would trigger the
error.

Split off from D78403.

Differential Revision: https://reviews.llvm.org/D79900
2020-05-14 12:45:17 -07:00
Volodymyr Sapsai 6a3469f58d [ObjC] Add compatibility mode for type checking of qualified id block parameters.
Commit 73152a2ec2 fixed type checking for
blocks with qualified id parameters. But there are existing APIs in
Apple SDKs relying on the old type checking behavior. Specifically,
these are APIs using NSItemProviderCompletionHandler in
Foundation/NSItemProvider.h. To keep existing code working and to allow
developers to use affected APIs introduce a compatibility mode that
enables the previous and the fixed type checking. This mode is enabled
only on Darwin platforms.

Reviewed By: jyknight, ahatanak

Differential Revision: https://reviews.llvm.org/D79511
2020-05-14 12:08:19 -07:00
zoecarver 8f2cc889b0 [libcxx] [NFC] Add more reinterpret_pointer_cast tests.
* Add test for inheritance.
 * Test value is preserved through cast.
2020-05-14 12:04:05 -07:00
Benjamin Kramer 77346daaa5 [StringSet] Simplify code a bit. NFC. 2020-05-14 20:56:49 +02:00
Reid Kleckner 3774bcf9f8 [COFF] Fix var names cVStrTab->cvStrTab sXDataChunks->sxDataChunks
NFC
2020-05-14 11:23:07 -07:00
LLVM GN Syncbot 7b73e5e08d [gn build] Port 42a5560503 2020-05-14 17:59:56 +00:00
Craig Topper 2fdeee9c82 [X86] Add support for forming vXi16 PMULH instructions from shifts.
We already form PMULH when the shift is truncated. But we can
also do it from just a shift by extending the result.

Unfortunately, I get regressions if I try to replace the truncate
combine with this as we turn the truncate into a more complicated
sequence first. Then we are unable to combine that sequence with
the extend produced at the end of this combine.

Differential Revision: https://reviews.llvm.org/D79682
2020-05-14 10:58:00 -07:00
Jay Foad 42a5560503 [AMDGPU] New SIInsertHardClauses pass
Enable clausing of memory loads on gfx10 by adding a new pass to insert
the s_clause instructions that mark the start of each hard clause.

Differential Revision: https://reviews.llvm.org/D79792
2020-05-14 18:54:49 +01:00
Marius Brehler 426afd79da [mlir] Adopt changes in mlir-opt to standalone example
MLIRContext was moved with commit 6bce7d8

Differential Revision: https://reviews.llvm.org/D79946
2020-05-14 17:50:55 +00:00
Jonas Devlieghere e7c91e3124 [lldb/Test] Skip remaining 'side_effect' tests with reproducers.
The side_effect Python package bypasses the reproducer instrumentation
and therefore these tests are not expected to replay from a reproducer.
2020-05-14 10:38:56 -07:00
Jonas Devlieghere e29cae1e53 [lldb/Test] Skip TestExpressionInSyscall with reproducers
Skip this test because it relies on a timeout.
2020-05-14 10:38:56 -07:00
Fangrui Song 5ecb514146 [Driver] Pass -plugin-opt=O2 for -Os -Oz and -plugin-opt=O1 for -Og
Fixes PR42445 (compiler driver options -Os -Oz translate to
-plugin-opt=Os (Oz) which are not recognized by LLVMgold.so or LLD).

The optimization level mapping matches
CompilerInvocation.cpp:getOptimizationLevel() and SpeedLevel of
PassBuilder::OptimizationLevel::O*.

-plugin-opt=O* affects the way we construct regular LTO/ThinLTO pass
manager pipeline.

Reviewed By: pcc

Differential Revision: https://reviews.llvm.org/D79919
2020-05-14 10:37:33 -07:00
Reid Kleckner f5a79713b6 [LLD] Fix precomp-link.test
I had a stale directory at %t, so the test passed locally, but not
remotely. Skip the %t directory altogether.
2020-05-14 10:32:50 -07:00
Craig Topper 2b0b9b1148 [X86] Fix a regression caused by moving combineLoopMAddPattern to IR
When I moved combineLoopMAddPattern to an IR pass. I didn't match the behavior of canReduceVMulWidth that was used in the SelectionDAG version. canReduceVMulWidth just calls computeSignBits and assumes a truncate is always profitable. The version I put in IR just looks for constants and zext/sext. Though I neglected to check the number of bits in input of the zext/sext.

This patch adds a check for the number of input bits to the sext/zext. And it adds a special case for add/sub with zext/sext inputs which can be handled by combineTruncatedArithmetic. Match the original SelectionDAG behavior appears to be a regression in some cases if the truncate isn't removed and becomes pack and permq. So enabling only this specific case is the conservative approach.

Differential Revision: https://reviews.llvm.org/D79909
2020-05-14 10:31:28 -07:00
Simon Pilgrim acb6f1ae09 TargetLowering.cpp - remove non-constant EXTRACT_SUBVECTOR/INSERT_SUBVECTOR handling. NFC.
Now that D79814 has landed, we can assume that subvector ops use constant, in-range indices.
2020-05-14 18:13:58 +01:00
Alex Lorenz 10b49315fa [test] NFC, add missing declarations and include to test files to avoid 'implicit-function-declaration' diagnostics in the tests 2020-05-14 10:01:50 -07:00
Peter Collingbourne d2a26ad0dc hwasan: Collect ring buffer statistics and include in dev note.
These statistics are intended to help us tune the scudo MTE
implementation.

Differential Revision: https://reviews.llvm.org/D79913
2020-05-14 09:47:42 -07:00
Reid Kleckner 54a335a2f6 [COFF] Move type merging to TpiSource::mergeDebugT virtual method
This paves the way to doing more things in parallel, and allows us to
order type sources in dependency order. PDBs and PCH objects have to be
loaded before object files which use them.

This is a rebase of the unapplied remaining changes in
https://reviews.llvm.org/D59226. I found it very challenging to rebase
this across the LLD variable name style change. I recall there was a
tool for that, but I didn't take the time to use it.

Reviewers: aganea, akhuang

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79672
2020-05-14 09:47:00 -07:00
Matt Arsenault 235fb7dc24 AMDGPU/OpenCL: Accept -nostdlib in place of -nogpulib
-nogpulib makes sense when there is a host (where -nostdlib would
 apply) and offload target. Accept nostdlib when there is no offload
 target as an alias.
2020-05-14 12:33:31 -04:00
Momchil Velikov bc2e572f51 Re-commit: [ARM] CMSE code generation
This patch implements the final bits of CMSE code generation:

* emit special linker symbols

* restrict parameter passing to no use memory

* emit BXNS and BLXNS instructions for returns from non-secure entry
  functions, and non-secure function calls, respectively

* emit code to save/restore secure floating-point state around calls
  to non-secure functions

* emit code to save/restore non-secure floating-pointy state upon
  entry to non-secure entry function, and return to non-secure state

* emit code to clobber registers not used for arguments and returns

* when switching to no-secure state

Patch by Momchil Velikov, Bradley Smith, Javed Absar, David Green,
possibly others.

Differential Revision: https://reviews.llvm.org/D76518
2020-05-14 16:46:16 +01:00
Jay Foad 17941437a2 [TargetLowering] Improve expansion of FSHL/FSHR
Use an extra shift-by-1 instead of a compare and select to handle the
shift-by-zero case. This sometimes saves one instruction (if the compare
couldn't be combined with a previous instruction). It also works better
on targets that don't have good select instructions.

Note that currently this change doesn't affect most targets because
expandFunnelShift is not used because funnel shift intrinsics are
lowered early in SelectionDAGBuilder. But there is work afoot to change
that; see D77152.

Differential Revision: https://reviews.llvm.org/D77301
2020-05-14 16:36:22 +01:00
Erich Keane 0c5db3e4aa Fix test from 5f1f4a5
My test needs a requires target clause to support inline assembly.  This
patch splits out the asm tests into a separate test so we don't skip the
rest of the conditions.
2020-05-14 08:22:08 -07:00
Anna Thomas eb282be9f8 [RS4GC] Fix algorithm to avoid setting vector BDV for scalar derived pointer""
This is relanding of rGbb308b020522420413c7d3f2989a88f2fc423c56 after
speculatively fixing buildbot lit test failure which was seen on two
bots (I cannot reproduce the lit test failure locally either).

[RS4GC] Fix algorithm to avoid setting vector BDV for scalar derived
pointer

Summary:
This is a more general fix to 59029b9eef (D75704).
This patch does the following:

updates isKnownBaseValue to account for base pointer and
derived pointer having differing types.

This inturn allows us to populate the
lattice (States) for such derived pointers.

It also updates all states where the base and derived pointers have
differing types (vector versus scalar) and conservatively marks these
states as conflictcs.
Note that in 59029b9eef, we were just fixing existing lattice values
and that too, only for uses of extractelement.

Reviewers: reames, skatkov, dantrushin

Reviewed By: skatkov

Subscribers: hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D76305
2020-05-14 11:17:45 -04:00
Benjamin Kramer 29560a89dd [Support] Make UniqueStringSaver wrap a StringSet
This is slightly more efficient while providing exactly the same
semantics.
2020-05-14 17:11:44 +02:00
Ehud Katz c6c265527d Revert "[StructurizeCFG] Fix region nodes ordering"
This reverts commit 897d8ee5cd,
due to causing an infinite loop when encountering a loop with
a sub-region with an inner loop.
2020-05-14 17:56:39 +03:00
Levon Ter-Grigoryan 631048e811 Moving executable module symbols parsing to target creation method.
Summary:
In our project we are using remote client-server LLDB configuration.
We want to parse as much debugging symbols as we can before debugger starts attachment to the remote process.
To do that we are passing the path of the local executable module to CreateTarget method at the client.
But, it seems that this method are not parsing the executable module symbols.
To fix this I added PreloadSymbols call for executable module to target creation method.

This patch also fixes a problem where the DynamicLoader would reset a
module when launching the target. We fix it by making sure
Platform::ResolveExecutable returns the module object obtained from the
remote platform.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D78654
2020-05-14 16:54:14 +02:00
Michael Schellenberger Costa ab9f11168f [libcxx][span] Implement solution to LWG-3255
This implements the relaxed requirements on the std::array constructors of span,
where the type only needs to be convertible to the element type of the span.

Note that the previous tests were not sufficient, as the const array<T, n> constructor
was only tested for compile time and the array<T, N> only during runtime.

Restructure the tests so that we can test conversions as well as both constructors.

Differential Revision: https://reviews.llvm.org/D75706
2020-05-14 10:50:44 -04:00
Sean Fertile ce4ebc14a8 [PowerPC] Remove support for SplitCSR.
SplitCSR was only suppored for functions with CXX_FAST_TLS calling
convention. Clang only emits that calling convention for Darwin which is
no longer supported by the PowerPC backend. Another IR producer could
use the calling convention, but considering the calling convention is
meant to be an optimization and the codegen for SplitCSR can be
attrocious on Power (see the modifed lit test) it is best to remove it
and codegen CXX_FAST_TLS same as the C calling convention.

Differential Revision: https://reviews.llvm.org/D79018
2020-05-14 10:32:17 -04:00
Erich Keane 5f1f4a5d01 Prohibit capture of _ExtInt in inline assembly.
The backends don't seem to properly handle the _ExtInt type in inline
assembly with crashes occurring in many. While the ones I tested seem to
work for powers of 2 < 64 (and some any multiple of 64 greater than
that), it seemed like a better idea to just use of this type in inline
assembly prohibited.
2020-05-14 07:21:09 -07:00
Anna Thomas f20c62741e Revert "[RS4GC] Fix algorithm to avoid setting vector BDV for scalar derived pointer"
This reverts commit bb308b0205.
Failing a testcase.
2020-05-14 10:16:25 -04:00
Anna Thomas bb308b0205 [RS4GC] Fix algorithm to avoid setting vector BDV for scalar derived pointer
Summary:
This is a more general fix to 59029b9eef (D75704).
This patch does the following:
1. updates isKnownBaseValue to account for base pointer and
derived pointer having differing types.
2. This inturn allows us to populate the
lattice (States) for such derived pointers.
3. It also updates all states where the base and derived pointers have
differing types (vector versus scalar) and conservatively marks these
states as conflictcs.
Note that in 59029b9eef, we were just fixing existing lattice values
and that too, only for uses of extractelement.

Reviewers: reames, skatkov, dantrushin

Reviewed By: skatkov

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D76305
2020-05-14 10:03:30 -04:00
Pavel Labath eb50b643fe [lldb/PDB] Make "native" pdb tests host-independent
These test don't execute the binaries they build, and so they don't need
to build for the host. By hardcoding the target, we don't have do xfail
or skip them for targets which don't have the appropriate support in
clang(-cl).
2020-05-14 16:01:23 +02:00
Matt Arsenault 2b2a961309 lld: Let find_package(LLD) work
Install a cmake config file. Copied exactly from how clang exports.

I also wasn't sure whether the canonical capitalization is "lld" or
"LLD". The project() is still calling this lld, but most places seemed
to capitalize it.
2020-05-14 09:59:53 -04:00
Gabor Marton 7c3768495e [analyzer] Improve PlacementNewChecker
Summary:
1. Added insufficient storage check for arrays
2. Added align support check

Based on https://reviews.llvm.org/D76229

Reviewers: aaron.ballman, lebedev.ri, NoQ, martong

Reviewed By: martong

Subscribers: xazax.hun, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, Charusso, ASDenysPetrov, cfe-commits

Tags: #clang

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

Patch by Karasev Nikita!
2020-05-14 15:50:39 +02:00
Xinglong Liao 5f3f45dc53 [Hexagon] Check isInstr() before getInstr() with SUnit
SUnit represent a MachineInstr in post-regalloc scheduling but SDNode
in pre-regalloc scheduling. when pass -enable-hexagon-sdnode-sched to
Hexagon backend with -O1 and above, this may cause an assertion failed.

Fixes PR45194.

Differential Revision: https://reviews.llvm.org/D76134
2020-05-14 08:47:54 -05:00
Gabor Marton 5fc05c376a Fix Z3 function calls regarding arithmetic operations
Summary:
The order of Z3_mk_fpa_mul, Z3_mk_fpa_div, Z3_mk_fpa_add and Z3_mk_fpa_sub functions' arguments is: context, rounding_mode, ast1, ast2.
See for example: a14c2a3051/src/api/api_fpa.cpp (L433)

At function calls from LLVM the argument order was different: rounding_mode was passed as last argument.

Unfortunately these Z3_ast and other function parameter types are technically like void* which are reinterpret_cast-ed to a specific class type. So there was no type error, but the assertions fail in runtime if something goes wrong. Such a crash happened during Z3 refutation while using StaticAnalyzer.

Reviewers: Szelethus, xazax.hun, baloghadamsoftware, steakhal, martong, mikhail.ramalho

Reviewed By: martong

Subscribers: hiraditya, rnkovacs, mikhail.ramalho, martong, llvm-commits

Tags: #llvm

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

Patch by Tibor Brunner!
2020-05-14 15:46:13 +02:00
Gabor Marton ff4492c89f [analyzer] StdLibraryFunctionsChecker: Add option to display loaded summaries
Reviewers: NoQ, Szelethus, baloghadamsoftware, balazske

Subscribers: whisperity, xazax.hun, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, gamesh411, Charusso, steakhal, ASDenysPetrov, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78118
2020-05-14 15:40:58 +02:00
Michael Schellenberger Costa 79941086fb [libc++][span] SFINAE span default constructor on Extent == 0
The default constructor of a static span requires _Extent == 0 so
SFINAE it out rather than using a static_assert

Differential Revision: https://reviews.llvm.org/D71994
2020-05-14 09:35:07 -04:00
Gabor Marton d061685a83 [analyzer] Make NonNullParamChecker as dependency for StdCLibraryFunctionsChecker
Summary:
If a given parameter in a FunctionDecl has a nonull attribute then the NonNull
constraint in StdCLibraryFunctionsChecker has the same effect as
NonNullParamChecker. I think it is better to emit diagnostics from the simpler
checker. By making NonNullParamChecker as a dependency, in these cases it will
be the first to emit a diagnostic and to stop the analysis on that path.

Reviewers: Szelethus, NoQ, baloghadamsoftware, balazske, steakhal

Subscribers: whisperity, xazax.hun, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, gamesh411, Charusso, ASDenysPetrov, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D79420
2020-05-14 15:28:40 +02:00
Melanie Blower 7b8e306560 [clang] Fix bug in #pragma float_control(push/pop)
Summary: #pragma float_control(pop) was failing to restore the expected
floating point settings because the settings were not correctly preserved
at #pragma float_control(push).
2020-05-14 05:58:11 -07:00
Valeriy Savchenko c98872e3a3 [analyzer] Modernize analyzer's Python scripts
Summary:
Fix read/write in binary format, which crashes Python 3.
Additionally, clean up redundant (as for Python 3) code and
fix a handful of flake8 warnings.

Differential Revision: https://reviews.llvm.org/D79932
2020-05-14 15:55:37 +03:00
Sanjay Patel 26e742fd84 [x86][CGP] improve sinking of splatted vector shift amount operand
Expands on the enablement of the shouldSinkOperands() TLI hook in:
D79718

The last codegen/IR test diff shows what I suspected could happen - we were
sinking all splat shift operands into a loop. But that's not what we want in
general; we only want to sink the *shift amount* operand if it is a splat.

Differential Revision: https://reviews.llvm.org/D79827
2020-05-14 08:36:03 -04:00
Michael Schellenberger Costa c5ff4031c6 [libcxx][span] Remove const_iterator from std::span
This implements the resolution to LWG-3320.

Differential Revision: https://reviews.llvm.org/D75642
2020-05-14 08:34:32 -04:00
Balázs Kéri cb1eeb42c0 [Analyzer][VLASizeChecker] Check VLA size in typedef and sizeof.
Summary:
The check of VLA size was done previously for variable declarations
(of VLA type) only. Now it is done for typedef (and type-alias)
and sizeof expressions with VLA too.

Reviewers: Szelethus, martong

Reviewed By: Szelethus, martong

Subscribers: rnkovacs, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, gamesh411, Charusso, martong, ASDenysPetrov, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D79072
2020-05-14 14:30:05 +02:00
Michael Schellenberger Costa c73a491d10 [libcxx][span] Remove tuple interface
This implements P2116 by removing the tuple interface from std::span.

Differential Revision: https://reviews.llvm.org/D75640
2020-05-14 08:25:49 -04:00
Simon Pilgrim 80715b7124 SelectionDAG.cpp - remove non-constant EXTRACT_SUBVECTOR/INSERT_SUBVECTOR handling. NFC.
Now that D79814 has landed, we can assume that subvector ops use constant, in-range indices.
2020-05-14 13:23:00 +01:00
Haojian Wu 0e5706d018 [clangd] Correct the elog message, NFC. 2020-05-14 14:15:21 +02:00
Florian Hahn 4c8285c750 [VPlan] Move emission of \\l\"+\n to dumpBasicBlock (NFC).
The patch standardizes printing of VPRecipes a bit, by hoisting out the
common emission of \\l\"+\n. It simplifies the code and is also a first
step towards untangling printing from DOT format output, with the goal
of making the DOT output optional and to provide a more concise debug
output if DOT output is disabled.

Reviewers: gilr, Ayal, rengolin

Reviewed By: gilr

Differential Revision: https://reviews.llvm.org/D78883
2020-05-14 13:07:59 +01:00