Stefan Gränitz [Fri, 12 Feb 2021 13:03:41 +0000 (13:03 +0000)]
[Orc] Fix remaining memory size of slab allocator
Stefan Gränitz [Tue, 2 Mar 2021 13:14:44 +0000 (14:14 +0100)]
[docs][JITLink] Fix a typo (NFC)
Stefan Gränitz [Tue, 2 Mar 2021 13:03:29 +0000 (14:03 +0100)]
[Orc] Extend lli debug support tests to JITLink
Stefan Gränitz [Tue, 23 Feb 2021 14:54:21 +0000 (14:54 +0000)]
[lli] Add JITLink in-process debug support
lli aims to provide both, RuntimeDyld and JITLink, as the dynamic linkers/loaders for it's JIT implementations. And they both offer debugging via the GDB JIT interface, which builds on the two well-known symbol names `__jit_debug_descriptor` and `__jit_debug_register_code`. As these symbols must be unique accross the linked executable, we can only define them in one of the libraries and make the other depend on it. OrcTargetProcess is a minimal stub for embedding a JIT client in remote executors. For the moment it seems reasonable to have the definition there and let ExecutionEngine depend on it, until we find a better solution.
This is the second commit for the reviewed patch.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D97339
Stefan Gränitz [Tue, 2 Mar 2021 11:37:48 +0000 (12:37 +0100)]
[Orc] Add JITLink debug support plugin for ELF x86-64
Add a new ObjectLinkingLayer plugin `DebugObjectManagerPlugin` and infrastructure to handle creation of `DebugObject`s as well as their registration in OrcTargetProcess. The current implementation only covers ELF on x86-64, but the infrastructure is not limited to that.
The journey starts with a new `LinkGraph` / `JITLinkContext` pair being created for a `MaterializationResponsibility` in ORC's `ObjectLinkingLayer`. It sends a `notifyMaterializing()` notification, which is forwarded to all registered plugins. The `DebugObjectManagerPlugin` aims to create a `DebugObject` form the provided target triple and object buffer. (Future implementations might create `DebugObject`s from a `LinkGraph` in other ways.) On success it will track it as the pending `DebugObject` for the `MaterializationResponsibility`.
This patch only implements the `ELFDebugObject` for `x86-64` targets. It follows the RuntimeDyld approach for debug object setup: it captures a copy of the input object, parses all section headers and prepares to patch their load-address fields with their final addresses in target memory. It instructs the plugin to report the section load-addresses once they are available. The plugin overrides `modifyPassConfig()` and installs a JITLink post-allocation pass to capture them.
Once JITLink emitted the finalized executable, the plugin emits and registers the `DebugObject`. For emission it requests a new `JITLinkMemoryManager::Allocation` with a single read-only segment, copies the object with patched section load-addresses over to working memory and triggers finalization to target memory. For registration, it notifies the `DebugObjectRegistrar` provided in the constructor and stores the previously pending`DebugObject` as registered for the corresponding MaterializationResponsibility.
The `DebugObjectRegistrar` registers the `DebugObject` with the target process. `llvm-jitlink` uses the `TPCDebugObjectRegistrar`, which calls `llvm_orc_registerJITLoaderGDBWrapper()` in the target process via `TargetProcessControl` to emit a `jit_code_entry` compatible with the GDB JIT interface [1]. So far the implementation only supports registration and no removal. It appears to me that it wouldn't raise any new design questions, so I left this as an addition for the near future.
[1] https://sourceware.org/gdb/current/onlinedocs/gdb/JIT-Interface.html
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D97335
Stefan Gränitz [Tue, 23 Feb 2021 14:36:02 +0000 (14:36 +0000)]
[Orc] Rename local variable to avoid confusion with equally-named class member (NFC)
Stefan Gränitz [Thu, 18 Feb 2021 13:48:23 +0000 (13:48 +0000)]
[Orc] Fix a file header (NFC)
Stefan Gränitz [Thu, 18 Feb 2021 13:47:47 +0000 (13:47 +0000)]
[JITLink] LinkGraph::getName() can be const
Stefan Gränitz [Fri, 12 Feb 2021 13:58:57 +0000 (13:58 +0000)]
[JITLink] Remove some std::move(MemoryBufferRef) below createLinkGraphFromObject() (NFC)
Stefan Gränitz [Tue, 23 Feb 2021 14:33:11 +0000 (14:33 +0000)]
[llvm-jitlink] Remove duplicate type defintion (NFC)
Stefan Gränitz [Tue, 2 Mar 2021 09:41:52 +0000 (10:41 +0100)]
[lli] Add --jit-linker command line argument
The argument value determines the dynamic linker to use (`default`, `rtdyld` or `jitlink`). The JITLink implementation only supports in-process JITing for now. This is the first commit for the reviewed patch.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D97339
Utkarsh Saxena [Tue, 2 Mar 2021 13:57:26 +0000 (14:57 +0100)]
Revert "[clangd] Use ML Code completion ranking as default."
CodeCompletionContext::Kind has 36 Kinds. The completion model currently
only handles categorical features of 32 cardinality.
Changing the datatype to uint64_t will solve the problem.
This reverts commit
438b5bb05a429d697674088d400e4800c1108658.
Peyton, Jonathan L [Tue, 2 Mar 2021 13:44:15 +0000 (07:44 -0600)]
[OpenMP] Fix clang-cl build error regarding TSX intrinsics
Fix for https://bugs.llvm.org/show_bug.cgi?id=49339
The CMake check for the RTM intrinsics needs the -mrtm flag to be set
during the test. This way clang-cl correctly detects it has the
_xbegin() intrinsic. Otherwise, the CMake check fails.
Differential Revision: https://reviews.llvm.org/D97413
Ed Maste [Mon, 1 Mar 2021 18:17:30 +0000 (13:17 -0500)]
[Driver] Fix -gz=zlib options for linker also on FreeBSD
ccb4124a4172 fixed translating -gz=zlib to --compress-debug-sections for
linker invocation for several ToolChains, but omitted FreeBSD.
Differential Revision: https://reviews.llvm.org/D97752
Simon Pilgrim [Tue, 2 Mar 2021 12:22:16 +0000 (12:22 +0000)]
[DAG] DAGCombiner::tryStoreMergeOfLoads - remove unused StartAddress variable. NFCI.
Noticed in "initialization is never read" clang-tidy warning - the only StartAddress set/used is inside the load combine loop.
Benjamin Kramer [Tue, 2 Mar 2021 12:41:50 +0000 (13:41 +0100)]
[MCParser] Bring back srcmanager diagnostics in AsmParser
AsmParser may have no LLVMContext attached to it, which means after
5de2d189e6ad466a1f0616195e8c524a4eb3cbc0 everything goes to stderr.
Restore the old behavior.
Christian Sigg [Tue, 2 Mar 2021 12:27:35 +0000 (13:27 +0100)]
[mlir] Use mlir::OpState::operator->() to get to Operation::getAttrs().
This is a preparation step to remove getAttrs() from OpState.
Muhammad Omair Javaid [Tue, 2 Mar 2021 12:20:46 +0000 (17:20 +0500)]
Support GDB remote g packet partial read
GDB remote protocol does not specify length of g packet for register read. It depends on remote to include all or exclude certain registers from g packet. In case a register or set of registers is not included as part of g packet then we should fall back to p packet for reading all registers excluded from g packet by remote. This patch adds support for above feature and adds a test-case for the same.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D97498
Jan Svoboda [Tue, 2 Mar 2021 12:14:00 +0000 (13:14 +0100)]
[clang][cli] NFC: Use .str() instead of operator<<
Simon Pilgrim [Tue, 2 Mar 2021 12:06:10 +0000 (12:06 +0000)]
[AMDGPU] Fix "initialization is never read" clang-tidy warnings. NFCI.
Jan Svoboda [Tue, 2 Mar 2021 12:02:04 +0000 (13:02 +0100)]
[clang][cli] NFC: Use .str() instead of operator<<
Fraser Cormack [Mon, 1 Mar 2021 15:57:42 +0000 (15:57 +0000)]
[RISCV] Lower CONCAT_VECTORS to INSERT_SUBVECTOR nodes
The default expansion of CONCAT_VECTORS goes through the stack. This
patch avoids that penalty by custom-lowering CONCAT_VECTORS to a series
of INSERT_SUBVECTOR nodes. Futher optimizations are possible, but this
is a good start.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D97692
Peter Smith [Fri, 26 Feb 2021 13:14:21 +0000 (13:14 +0000)]
[LLD][ELF][ARM] Refactor inBranchRange to use addend for PC Bias
In AArch32 ARM, the PC reads two instructions ahead of the currently
executiing instruction. This evaluates to 8 in ARM state and 4 in
Thumb state. Branch instructions on AArch32 compensate for this by
subtracting the PC bias from the addend. For a branch to symbol this
will result in an addend of -8 in ARM state and -4 in Thumb state.
The existing ARM Target::inBranchRange function accounted for this
implict addend within the function meaning that if the addend were
to be taken into account by the caller then it would be double
counted. This complicates the interface for all Targets as callers
wanting to account for addends had to account for the ARM PC-bias.
In certain situations such as:
https://github.com/ClangBuiltLinux/linux/issues/1305
the PC-bias compensation code didn't match up. In particular
normalizeExistingThunk() didn't put the PC-bias back in as Arm
thunks did not store the addend.
The simplest fix for the problem is to add the PC bias in
normalizeExistingThunk when restoring the addend. However I think
it is worth refactoring the Arm inBranchRange implementation so
that fewer calls to getPCBias are needed for other Targets. I
wasn't able to remove getPCBias completely but hopefully the
Relocations.cpp code is simpler now.
In principle a test could be written to replicate the linux kernel
build failure but I wasn't able to reproduce with a small example
that I could build up from scratch.
Fixes https://github.com/ClangBuiltLinux/linux/issues/1305
Differential Revision: https://reviews.llvm.org/D97550
Jan Svoboda [Tue, 2 Mar 2021 10:53:40 +0000 (11:53 +0100)]
[clang][cli] NFC: Rename marshalling multiclass
The new name drops `String` from `MarshallingInfoStringInt`, which follows the naming convention of other marshalling multiclasses.
Florian Hahn [Tue, 2 Mar 2021 10:43:33 +0000 (10:43 +0000)]
[LV] Add test cases that require a larger number of RT checks.
Precommit tests cases for D75981.
KareemErgawy-TomTom [Tue, 2 Mar 2021 10:16:28 +0000 (11:16 +0100)]
[MLIR][LinAlg] Detensorize interal function control flow.
This patch continues detensorizing implementation by detensoring
internal control flow in functions.
In order to detensorize functions, all the non-entry block's arguments
are detensored and branches between such blocks are properly updated to
reflect the detensored types as well. Function entry block (signature)
is left intact.
This continues work towards handling github/google/iree#1159.
Reviewed By: silvas
Differential Revision: https://reviews.llvm.org/D97148
Jan Svoboda [Tue, 2 Mar 2021 10:32:03 +0000 (11:32 +0100)]
[clang][docs] Fix code blocks rendering
Some code blocks that render fine locally don't appear on the llvm.org website. Attempting to fix this by specifying the `text` type.
Benjamin Kramer [Tue, 2 Mar 2021 10:21:54 +0000 (11:21 +0100)]
Revert "[X86] Fold shuffle(not(x),undef) -> not(shuffle(x,undef))"
This reverts commit
925093d88ae74560a8e94cf66f95d60ea3ffa2d3.
Causes an infinite loop when compiling some shuffles:
$ cat bugpoint-reduced-simplified.ll
target triple = "x86_64-unknown-linux-gnu"
define void @foo() {
entry:
%0 = load i8, i8* undef, align 1
%broadcast.splatinsert = insertelement <16 x i8> poison, i8 %0, i32 0
%1 = icmp ne <16 x i8> %broadcast.splatinsert, zeroinitializer
%2 = shufflevector <16 x i1> %1, <16 x i1> undef, <16 x i32> zeroinitializer
%wide.load = load <16 x i8>, <16 x i8>* undef, align 1
%3 = icmp ne <16 x i8> %wide.load, zeroinitializer
%4 = and <16 x i1> %3, %2
%5 = zext <16 x i1> %4 to <16 x i8>
store <16 x i8> %5, <16 x i8>* undef, align 1
ret void
}
$ llc < bugpoint-reduced-simplified.ll
<timeout>
Dmitry Preobrazhensky [Tue, 2 Mar 2021 09:59:09 +0000 (12:59 +0300)]
[AMDGPU][MC][GFX9+] Corrected encoding of op_sel_hi for unused operands in VOP3P
Corrected encoding of VOP3P op_sel_hi for unused operands. See bug 49363.
Differential Revision: https://reviews.llvm.org/D97689
Raphael Isemann [Tue, 2 Mar 2021 10:00:22 +0000 (11:00 +0100)]
[lldb] Add missing include to Cloneable.h
This header is using make_shared so it needs to include <memory>.
Pavel Labath [Tue, 9 Feb 2021 20:12:30 +0000 (21:12 +0100)]
[lldb] Remote leftover _llgs from TestGdbRemoteConnection.py
the suffix will be added when the test is instantiated for llgs and
debugserver.
Stefan Gränitz [Tue, 2 Mar 2021 09:37:55 +0000 (10:37 +0100)]
[lli] Test debug support in RuntimeDyld with built-in functions
When lli runs the below IR, it emits in-memory debug objects and registers them with the GDB JIT interface. The tests dump and check the registered information. IR has limited ability to produce complex output in a portable way. Instead the tests rely on built-in functions implemented in lli. They use a new command line flag `-generate=function-name` to instruct the ORC JIT to expose the built-in function with the given name to the JITed program.
`debug-descriptor-elf-minimal.ll` calls `__dump_jit_debug_descriptor()` to reflect the list of debug entries issued for itself after emitting the main module. The output is textual and can be checked straight away.
`debug-objects-elf-minimal.ll` calls `__dump_jit_debug_objects()`, which instructs lli to walk through the list of debug entries and append the encountered in-memory objects to the program output. We feed this output into llvm-dwarfdump to parse the DWARF in each file and dump their structures.
We can do the same for JITLink once D97335 has landed.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D97694
Sven van Haastregt [Tue, 2 Mar 2021 09:37:26 +0000 (09:37 +0000)]
[OpenCL] Use StringMap instead of std::map
As the LLVM Programmer's Manual suggests, use a StringMap instead of
an std::map with a StringRef key.
Juneyoung Lee [Tue, 2 Mar 2021 09:34:32 +0000 (18:34 +0900)]
[JumpThreading] Fix tryToUnfoldSelectInCurrBB to treat and/or and its select form equally
This is a minor fix to update tryToUnfoldSelectInCurrBB to ignore select
form of and/ors because the function does not look into binops as well
Benjamin Kramer [Tue, 2 Mar 2021 09:26:14 +0000 (10:26 +0100)]
[AArch64] Mark test depending on -debug as requiring asserts
Utkarsh Saxena [Tue, 2 Mar 2021 09:09:22 +0000 (10:09 +0100)]
Fix DecisionForestBenchmark.cpp compile errors
clang-tools-extra/clangd/benchmarks/CompletionModel/DecisionForestBenchmark.cpp fails to compile since `"CompletionModel.h"` is auto-generated from clang-tools-extra/clangd/quality/model/features.json, which was changed in https://reviews.llvm.org/D94697 to remove `setFilterLength` and `setIsForbidden`, rename `setFileProximityDistance` and `setSymbolScopeDistance`, and add `setNumNameInContext` and `setFractionNameInContext`. This patch removes calls to the two removed functions, updates calls to the two renamed functions, and adds calls to the two new functions. (`20` is an arbitrary choice for the `setNumNameInContext` argument.) It also changes the `FlipCoin` argument from float to double to silence lossy conversion warnings.
Note: I don't use this tool but encountered the build errors and took a shot at fixing them. Please holler if there's another recommended solution. Thanks!
Reviewed By: usaxena95
Differential Revision: https://reviews.llvm.org/D97620
Utkarsh Saxena [Mon, 1 Feb 2021 15:49:38 +0000 (16:49 +0100)]
[clangd] Use ML Code completion ranking as default.
This makes code completion use a Decision Forest based ranking algorithm to rank
completion candidates. [Esitmated 6% accuracy boost]. This was
previously hidden behind the flag --ranking-model=decision_forest. This
patch makes it the default ranking algorithm.
Note: this is a generic model, not specialized for any particular
project. clangd does not collect or upload data to train code completion.
Also treat Keywords separately as they are not recorded by the training set generator.
Differential Revision: https://reviews.llvm.org/D96353
OCHyams [Tue, 2 Mar 2021 08:45:53 +0000 (08:45 +0000)]
[debuginfo-tests] Add some optnone tests
Add dexter tests using the optnone attribute in various scenarios. Our users
have found optnone useful when debugging optimised code. We have these tests
downstream (and one upstream already: D89873) and we would like to contribute
them if there is any interest.
The tests are fairly self explanatory. Testing optnone with:
* optnone-fastmath.cpp: floats and -ffast-math,
* optnone-simple-functions: simple functions and integer arithmetic,
* optnone-struct-and-methods: a struct with methods,
* optnone-vectors-and-functions: templates and integer vector arithmetic.
optnone-vectors-and-functions contains two FIXMEs. The first problem is that
lldb seems to struggle with evaluating expressions with the templates used
here (example below). Perhaps this is PR42920?
(lldb) p TypeTraits<int __attribute__((ext_vector_type(4)))>::NumElements
error: <user expression 0>:1:1: no template named 'TypeTraits'
TypeTraits<int __attribute__((ext_vector_type(4)))>::NumElements
^
The second is that while lldb cannot evaluate the following expression, gdb
can, but it reports that the variable has been optimzed away. It does this when
compiling at O0 too. llvm-dwarfdump shows that MysteryNumber does have a
location. I don't know whether the DIE is bad or if both debuggers just don't
support it.
TypeTraits<int __attribute__((ext_vector_type(4)))>::MysteryNumber
DW_TAG_variable
DW_AT_specification (0x0000006b "MysteryNumber")
DW_AT_location (DW_OP_addr 0x601028)
DW_AT_linkage_name ("_ZN10TypeTraitsIDv4_iE13MysteryNumberE")
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D97668
David Green [Tue, 2 Mar 2021 08:46:07 +0000 (08:46 +0000)]
[ARM] Add handling of t2LDRSB/t2LDRSH in Constant Island Pass
These constant pool loads should be treated similarly to t2LDRB/t2LDRH,
acting on the same offset ranges. Add handling and a simple test.
Vladislav Vinogradov [Thu, 25 Feb 2021 15:54:21 +0000 (18:54 +0300)]
[mlir][NFC] Rename `MemRefType::getMemorySpace` to `getMemorySpaceAsInt`
Just a pure method renaming.
It is a preparation step for replacing "memory space as raw integer"
with more generic "memory space as attribute", which will be done in
separate commit.
The `MemRefType::getMemorySpace` method will return `Attribute` and
become the main API, while `getMemorySpaceAsInt` will be declared as
deprecated and will be replaced in all in-tree dialects (also in separate
commits).
Reviewed By: mehdi_amini, rriddle
Differential Revision: https://reviews.llvm.org/D97476
Kazu Hirata [Tue, 2 Mar 2021 07:40:32 +0000 (23:40 -0800)]
[IR] Use range-based for loops (NFC)
Kazu Hirata [Tue, 2 Mar 2021 07:40:31 +0000 (23:40 -0800)]
[readobj] Use ListSeparator (NFC)
Kazu Hirata [Tue, 2 Mar 2021 07:40:29 +0000 (23:40 -0800)]
[lldb] Fix typos in documentation (NFC)
Richard Smith [Mon, 1 Mar 2021 21:55:17 +0000 (13:55 -0800)]
Fix infinite recursion during IR emission if a constant-initialized lifetime-extended temporary object's initializer refers back to the same object.
`GetAddrOfGlobalTemporary` previously tried to emit the initializer of
a global temporary before updating the global temporary map. Emitting the
initializer could recurse back into `GetAddrOfGlobalTemporary` for the same
temporary, resulting in an infinite recursion.
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D97733
Stella Laurenzo [Tue, 2 Mar 2021 05:19:39 +0000 (21:19 -0800)]
[mlir][linalg] Replace monomorphic contration ops with polymorphic variants.
* Moves `batch_matmul`, `matmul`, `matvec`, `vectmat`, `dot` to the new mechanism.
* This is not just an NFC change, in addition to using a new code generation mechanism, it also activates symbolic casting, allowing mixed precision operands and results.
* These definitions were generated from DSL by the tool: https://github.com/stellaraccident/mlir-linalgpy/blob/main/mlir_linalg/oplib/core.py (will be upstreamed in a subsequent set of changes).
Reviewed By: nicolasvasilache, ThomasRaoux
Differential Revision: https://reviews.llvm.org/D97719
Stella Laurenzo [Fri, 26 Feb 2021 21:11:02 +0000 (13:11 -0800)]
[mlir][linalg] Memoize indexing map generation.
Differential Revision: https://reviews.llvm.org/D97602
Stanislav Mekhanoshin [Tue, 2 Mar 2021 00:13:13 +0000 (16:13 -0800)]
[AMDGPU] Do not check max-bb for a single block callee
-amdgpu-inline-max-bb option could lead to a suboptimal
codegen preventing inlining of really simple functions
including pure wrapper calls. Relax the cutoff by allowing
to call a function with a single block on the grounds
that it will not increase total number of blocks after
inlining.
Differential Revision: https://reviews.llvm.org/D97744
Ta-Wei Tu [Tue, 2 Mar 2021 03:42:48 +0000 (11:42 +0800)]
[NFC] Use std::swap in LoopInterchange
Nemanja Ivanovic [Tue, 2 Mar 2021 03:38:41 +0000 (21:38 -0600)]
[PowerPC] Add missing overloads of vec_promote to altivec.h
The VSX-only overloads (for 8-byte element vectors) are missing.
Add the missing overloads and convert element numbering to
modulo arithmetic to match GCC and XLC.
Peter Steinfeld [Tue, 2 Mar 2021 00:59:08 +0000 (16:59 -0800)]
[flang] Detect circularly defined interfaces of procedures
It's possible to define a procedure whose interface depends on a procedure
which has an interface that depends on the original procedure. Such a circular
definition was causing the compiler to fall into an infinite loop when
resolving the name of the second procedure. It's also possible to create
circular dependency chains of more than two procedures.
I fixed this by adding the function HasCycle() to the class DeclarationVisitor
and calling it from DeclareProcEntity() to detect procedures with such
circularly defined interfaces. I marked the associated symbols of such
procedures by calling SetError() on them. When processing subsequent
procedures, I called HasError() before attempting to analyze their interfaces.
Unfortunately, this did not work.
With help from Tim, we determined that the SymbolSet used to track the
erroneous symbols was instantiated using a "<" operator which was defined using
the location of the name of the procedure. But the location of the procedure
name was being changed by a call to ReplaceName() between the times that the
calls to SetError() and HasError() were made. This caused HasError() to
incorrectly report that a symbol was not in the set of erroneous symbols.
I fixed this by changing SymbolSet to be an unordered set that uses the
contents of the name of the symbol as the basis for its hash function. This
works because the contents of the name of the symbol is preserved by
ReplaceName() even though its location changes.
I also fixed the error message used when reporting recursively defined dummy
procedure arguments.
I also added tests that will crash the compiler without this change.
Note that the "<" operator is used in other contexts, for example, in the map
of characterized procedures, maps of items in equivalence sets, maps of
structure constructor values, ... All of these situations happen after name
resolution has been completed and all calls to ReplaceName() have already
happened and thus are not subject to the problem I ran into when ReplaceName()
was called when processing procedure entities.
Note also that the implementation of the "<" operator uses the relative
location in the cooked character stream as the basis of its implementation.
This is potentially problematic when symbols from diffent compilation units
(for example symbols originating in .mod files) are put into the same map since
their names will appear in two different source streams which may not be
allocated in the same relative positions in memory. But I was unable to create
a test that caused a problem. Using a direct comparison of the content of the
name of the symbol in the "<" operator has problems. Symbols in enclosing or
parallel scopes can have the same name. Also using the location of the symbol
in the cooked character stream has the advantage that it preserves the the
order of the symbols in a structure constructor constant, which makes matching
the values with the symbols relatively easy.
This change supersedes D97201.
Differential Revision: https://reviews.llvm.org/D97749
Nemanja Ivanovic [Tue, 2 Mar 2021 01:23:26 +0000 (19:23 -0600)]
[PowerPC] Use modulo arithmetic for vec_extract in altivec.h
These interfaces are not covered in the ELFv2 ABI but are rather
implemented to emulate those available in GCC/XLC. However, the
ones in the other compilers are documented to perform modulo
arithmetic on the element number. This patch just brings clang
inline with the other compilers at -O0 (with optimization, clang
already does the right thing).
Jian Cai [Mon, 1 Mar 2021 23:03:42 +0000 (15:03 -0800)]
[ARM] support symbolic expressions as branch target in b.w
Currently ARM backend validates the range of branch targets before the
layout of fragments is finalized. This causes build failure if symbolic
expressions are used, with the exception of a single symbolic value.
For example, "b.w ." works but "b.w . + 2" currently fails to
assemble. This fixes the issue by delaying this check (in
ARMAsmParser::validateInstruction) of b.w instructions until the symbol
expressions are resolved (in ARMAsmBackend::adjustFixupValue).
Link:
https://github.com/ClangBuiltLinux/linux/issues/1286
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D97568
Kamlesh Kumar [Tue, 2 Mar 2021 01:27:54 +0000 (06:57 +0530)]
[libunwind] This adds support in libunwind for rv32 hard float
and soft-float for both rv32 and rv64.
Differential Revision: https://reviews.llvm.org/D80690
Yuanfang Chen [Tue, 2 Mar 2021 00:49:26 +0000 (16:49 -0800)]
Fix memleak for
5de2d189e6ad4
Fix typo `release` -> `reset`
Sam Clegg [Sat, 27 Feb 2021 00:54:15 +0000 (16:54 -0800)]
[lld][WebAssembly] Minor refactor in preparation for SHF_STRINGS supports. NFC.
A couple of small changes to match the ELF linker in preparation
for adding support string mergings.
Differential Revision: https://reviews.llvm.org/D97654
Sam Clegg [Mon, 1 Mar 2021 02:15:28 +0000 (18:15 -0800)]
[lld][WebAssembly] Convert lld/test/wasm/data-layout.ll to asm. NFC.
Part of ongoing conversion work started in https://reviews.llvm.org/D80361.
Differential Revision: https://reviews.llvm.org/D97651
Yuanfang Chen [Tue, 2 Mar 2021 00:06:30 +0000 (16:06 -0800)]
Fix build
5de2d189e6ad4
Remove source_mgr remark diagnose kind.
Yuanfang Chen [Tue, 23 Feb 2021 17:47:15 +0000 (09:47 -0800)]
[Diagnose] Unify MCContext and LLVMContext diagnosing
The situation with inline asm/MC error reporting is kind of messy at the
moment. The errors from MC layout are not reliably propagated and users
have to specify an inlineasm handler separately to get inlineasm
diagnose. The latter issue is not a correctness issue but could be improved.
* Kill LLVMContext inlineasm diagnose handler and migrate it to use
DiagnoseInfo/DiagnoseHandler.
* Introduce `DiagnoseInfoSrcMgr` to diagnose SourceMgr backed errors. This
covers use cases like inlineasm, MC, and any clients using SourceMgr.
* Move AsmPrinter::SrcMgrDiagInfo and its instance to MCContext. The next step
is to combine MCContext::SrcMgr and MCContext::InlineSrcMgr because in all
use cases, only one of them is used.
* If LLVMContext is available, let MCContext uses LLVMContext's diagnose
handler; if LLVMContext is not available, MCContext uses its own default
diagnose handler which just prints SMDiagnostic.
* Change a few clients(Clang, llc, lldb) to use the new way of reporting.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D97449
Luís Marques [Mon, 1 Mar 2021 23:47:03 +0000 (23:47 +0000)]
[Sanitizer][NFC] Fix typo
Med Ismail Bennani [Mon, 1 Mar 2021 23:23:27 +0000 (23:23 +0000)]
MaheshRavishankar [Mon, 1 Mar 2021 20:21:00 +0000 (12:21 -0800)]
[mlir] Add canonicaliations for subtensor_insert operation.
Add canonicalizers to subtensor_insert operations need canonicalizers
that propagate the constant arguments within offsets, sizes and
strides. Also add pattern to propogate tensor_cast operations.
Differential Revision: https://reviews.llvm.org/D97704
Jonas Devlieghere [Mon, 1 Mar 2021 22:57:29 +0000 (14:57 -0800)]
[lldb] Add scoped timer to HostInfoMacOSX::GetXcodeSDKPath
Nikita Popov [Mon, 1 Mar 2021 20:37:26 +0000 (21:37 +0100)]
[GlobalISel] Bail on G_PHI narrowing of odd types (PR48188)
The current narrowing code for G_PHI can only handle the case
where the size is a multiple of the narrow size. If this is not
the case, fall back to SDAG instead of asserting.
Original patch by shepmaster.
Differential Revision: https://reviews.llvm.org/D92446
Yaxun (Sam) Liu [Mon, 1 Mar 2021 22:10:14 +0000 (17:10 -0500)]
Fix test cxx-call-kernel.cpp
Only test it with x86 since other target may have an ABI
making it difficult to test.
Change-Id: I85423c8bbbbbb8f24cb3ea4cb64a408069b4d61c
Nathan James [Mon, 1 Mar 2021 22:07:09 +0000 (22:07 +0000)]
[clang-tidy] Added command line option `fix-notes`
Added an option to control whether to apply the fixes found in notes attached to clang tidy errors or not.
Diagnostics may contain multiple notes each offering different ways to fix the issue, for that reason the default behaviour should be to not look at fixes found in notes.
Instead offer up all the available fix-its in the output but don't try to apply the first one unless `-fix-notes` is supplied.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D84924
Matt Arsenault [Mon, 1 Mar 2021 20:29:56 +0000 (15:29 -0500)]
GlobalISel: Remove dead code
Generic code should probably not introduce G_INSERT/G_EXTRACT. The
mirror unpackRegs should also be removed, but AMDGPU still has a use
remaining which needs to be fixed.
Jessica Paquette [Mon, 1 Mar 2021 21:30:30 +0000 (13:30 -0800)]
[AArch64][GlobalISel] NFC: Remove dead G_BUILD_VECTOR legalization rule
Remove a rule which allows larger scalar types than the destination vector
element type.
This appears to be irrelevant now that we have G_BUILD_VECTOR_TRUNC. Plus,
making a G_BUILD_VECTOR which satisfies this introduces a verifier failure
anyway.
Differential Revision: https://reviews.llvm.org/D97727
Artem Belevich [Mon, 1 Mar 2021 18:52:15 +0000 (10:52 -0800)]
[CUDA] Remove `noreturn` attribute from __assertfail().
`noreturn` complicates control flow and tends to trigger a known bug in ptxas if
the assert is used within loops in sufficiently complicated code.
https://bugs.llvm.org/show_bug.cgi?id=27738
Differential Revision: https://reviews.llvm.org/D97708
David Green [Mon, 1 Mar 2021 21:57:19 +0000 (21:57 +0000)]
[ARM] Rename pass to MVETPAndVPTOptimisationsPass
This pass has for a while performed Tail predication as well as VPT
block optimizations. Rename the pass to make that clear.
Amara Emerson [Fri, 26 Feb 2021 20:01:14 +0000 (12:01 -0800)]
[AArch64] Fix emitting an AdrpAddLdr LOH when there's a potential clobber of the
def of the adrp before the ldr.
Apparently this pass used to have liveness analysis but it was removed for
scompile time reasons. This workaround prevents the LOH from being emitted
unless the ADD and LDR are adjacent.
Fixes https://github.com/JuliaLang/julia/issues/39820
Differential Revision: https://reviews.llvm.org/D97571
Nathan James [Mon, 1 Mar 2021 21:52:12 +0000 (21:52 +0000)]
[clang-tidy] Added option to uniqueptr delete release check
Adds an option, `PreferResetCall`, currently defaulted to `false`, to the check.
When `true` the check will refactor by calling the `reset` member function.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D97630
Stella Stamenova [Mon, 1 Mar 2021 21:48:22 +0000 (13:48 -0800)]
[mlir][lldb] Fix several gcc warnings in mlir and lldb
These warnings are raised when compiling with gcc due to either having too few or too many commas, or in the case of lldb, the possibility of a nullptr.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D97586
David Green [Mon, 1 Mar 2021 21:46:09 +0000 (21:46 +0000)]
[ARM] Update and add extra WLS testing. NFC
Yaxun (Sam) Liu [Mon, 1 Mar 2021 21:43:04 +0000 (16:43 -0500)]
Fix build failure due to dump()
Change-Id: I86b534223d63bf8bb8f49af5a64b300efbeba77b
Fangrui Song [Mon, 1 Mar 2021 21:43:23 +0000 (13:43 -0800)]
[InstrProfiling] Place __llvm_prf_vnodes and __llvm_prf_names in llvm.used on ELF
`__llvm_prf_vnodes` and `__llvm_prf_names` are used by runtime but not
referenced via relocation in the translation unit.
With `-z start-stop-gc` (D96914 https://sourceware.org/bugzilla/show_bug.cgi?id=27451),
the linker no longer lets `__start_/__stop_` references retain them.
Place `__llvm_prf_vnodes` and `__llvm_prf_names` in `llvm.used` to make
them retained by the linker.
This patch changes most existing `UsedVars` cases to `CompilerUsedVars`
to reflect the ideal state - if the binary format properly supports
section based GC (dead stripping), `llvm.compiler.used` should be sufficient.
`__llvm_prf_vnodes` and `__llvm_prf_names` are switched to `UsedVars`
since we want them to be unconditionally retained by both compiler and linker.
Behaviors on other COFF/Mach-O are not affected.
Differential Revision: https://reviews.llvm.org/D97649
Med Ismail Bennani [Mon, 1 Mar 2021 21:33:16 +0000 (22:33 +0100)]
[lldb/Plugins] Fix SWIGPythonBridge build issue
This patch should fi the build issue on the windows bots:
https://lab.llvm.org/buildbot/#/builders/83/builds/4214/steps/5/logs/stdio
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Anirudh Prasad [Mon, 1 Mar 2021 21:31:29 +0000 (16:31 -0500)]
[SystemZ] Introduce distinction between the jg/jl family of mnemonics for GNU as vs HLASM
- This patch adds in the distinction between jg[*] and jl[*] pc-relative
mnemonics based on the variant/dialect.
- Under the hlasm variant, we use the jl[*] family of mnemonics and under
the att (GNU as) variant, we use the jg[*] family of mnemonics.
- jgnop which was added in https://reviews.llvm.org/D92185, is now restricted
to att variant. jlnop is introduced and restricted to hlasm variant.
- The br[*]l additional mnemonics are mapped to either jl[*]/jg[*] based on
the variant.
Reviewed By: uweigand
Differential Revision: https://reviews.llvm.org/D97581
Yaxun (Sam) Liu [Mon, 8 Feb 2021 17:29:29 +0000 (12:29 -0500)]
[HIP] Emit kernel symbol
Currently clang uses stub function to launch kernel. This is inconvenient
to interop with C++ programs since the stub function has different name
as kernel, which is required by ROCm debugger.
This patch emits a variable symbol which has the same name as the kernel
and uses it to register and launch the kernel. This allows C++ program to
launch a kernel by using the original kernel name.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D86376
Sanjay Patel [Mon, 1 Mar 2021 21:23:09 +0000 (16:23 -0500)]
[SDAG] add helper for select->logic folds; NFC
This set of transforms should be extended to handle vector types.
Richard Smith [Mon, 1 Mar 2021 20:17:10 +0000 (12:17 -0800)]
Revert "[c++20] Mark class type NTTPs as done and start defining the feature test macro."
Some of the parts of this work were reverted; stop defining the feature
test macro for now.
This reverts commit
b4c63ef6dd90dba9af26a111c9a78b121c5284b1.
Nico Weber [Sun, 28 Feb 2021 18:42:14 +0000 (13:42 -0500)]
[lld/mac] Implement the missing bits of -undefined
This adds support for `-undefined dynamic_lookup`, and for
`-undefined warning` and `-undefined suppress` with `-flat_namespace`.
We just replace undefined symbols with a DynamicLookup when we hit them.
With this, `check-llvm` passes when using ld64.lld.darwinnew as host linker.
Differential Revision: https://reviews.llvm.org/D97642
Krystian Kuzniarek [Mon, 1 Mar 2021 20:15:04 +0000 (21:15 +0100)]
[clang-format][PR47290] Add ShortNamespaceLines format option
clang-format documentation states that having enabled
FixNamespaceComments one may expect below code:
c++
namespace a {
foo();
}
to be turned into:
c++
namespace a {
foo();
} // namespace a
In reality, no "// namespace a" was added. The problem was too high
value of kShortNamespaceMaxLines, which is used while deciding whether
a namespace is long enough to be formatted.
As with 9163fe2, clang-format idempotence is preserved.
Differential Revision: https://reviews.llvm.org/D87587
Björn Schäpers [Sat, 27 Feb 2021 22:23:37 +0000 (23:23 +0100)]
[clang-format] Respect spaces in line comment section...
... without an active column limit.
Before line comments were not touched at all with ColumnLimit == 0.
Differential Revision: https://reviews.llvm.org/D96896
Nico Weber [Mon, 1 Mar 2021 20:25:10 +0000 (15:25 -0500)]
[lld/mac] Add support for -flat_namespace
-flat_namespace makes lld emit binaries that use name lookup that's more in
line with other POSIX systems: Instead of looking up symbols as (dylib,name)
pairs by dyld, they're instead looked up just by name.
-flat_namespace has three effects:
1. MH_TWOLEVEL and MH_NNOUNDEFS are no longer set in the Mach-O header
2. All symbols use BIND_SPECIAL_DYLIB_FLAT_LOOKUP as ordinal
3. When a dylib is added to the link, its dependent dylibs are also added,
so that lld can verify that no undefined symbols remain at the end of
a link with -flat_namespace. These transitive dylibs are added for symbol
resolution, but they are not emitted in LC_LOAD_COMMANDs.
-undefined with -flat_namespace still isn't implemented. Before this change,
it was impossible to hit that combination because -flat_namespace caused a
diagnostic. Now that it no longer does, emit a dedicated temporary diagnostic
when both flags are used.
Differential Revision: https://reviews.llvm.org/D97641
Nico Weber [Mon, 1 Mar 2021 20:23:25 +0000 (15:23 -0500)]
[lld/mac] Use libSystem.dylib instead of libSystem.B.dylib in tests
For -flat_namespace, lld needs to load dylibs in LC_LOAD_DYLIB.
The current setup meant that libSystem.dylib would cause a LC_LOAD_DYLIB
with libSystem.B.dylib, but that didn't exist in our libsysroot for
tests. So just drop the .B.
See https://reviews.llvm.org/D97641#2595237 and
https://reviews.llvm.org/D97641#2595270
Nico Weber [Mon, 1 Mar 2021 20:21:24 +0000 (15:21 -0500)]
[lld/mac on non-mac] fix test/MachO/search-paths.test after
ab45289d2e7ce
peter klausler [Fri, 26 Feb 2021 22:32:26 +0000 (14:32 -0800)]
[flang] Runtime: SCAN and VERIFY
Implement the related character intrinsic functions
SCAN and VERIFY.
Differential Revision: https://reviews.llvm.org/D97580
Med Ismail Bennani [Mon, 1 Mar 2021 19:34:11 +0000 (19:34 +0000)]
[lldb/Plugins] Add ScriptedProcess Process Plugin
This patch introduces Scripted Processes to lldb.
The goal, here, is to be able to attach in the debugger to fake processes
that are backed by script files (in Python, Lua, Swift, etc ...) and
inspect them statically.
Scripted Processes can be used in cooperative multithreading environments
like the XNU Kernel or other real-time operating systems, but it can
also help us improve the debugger testing infrastructure by writting
synthetic tests that simulates hard-to-reproduce process/thread states.
Although ScriptedProcess is not feature-complete at the moment, it has
basic execution capabilities and will improve in the following patches.
rdar://
65508855
Differential Revision: https://reviews.llvm.org/D95713
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Fri, 19 Feb 2021 00:36:05 +0000 (00:36 +0000)]
[lldb/bindings] Add Python ScriptedProcess base class to lldb module
In order to facilitate the writting of Scripted Processes, this patch
introduces a `ScriptedProcess` python base class in the lldb module.
The base class holds the python interface with all the - abstract -
methods that need to be implemented by the inherited class but also some
methods that can be overwritten.
This patch also provides an example of a Scripted Process with the
`MyScriptedProcess` class.
rdar://
65508855
Differential Revision: https://reviews.llvm.org/D95712
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Thu, 18 Feb 2021 10:31:10 +0000 (11:31 +0100)]
[lldb/Interpreter] Add ScriptInterpreter Wrapper for ScriptedProcess
This patch adds a ScriptedProcess interface to the ScriptInterpreter and
more specifically, to the ScriptInterpreterPython.
This interface will be used in the C++ `ScriptProcess` Process Plugin to
call the script methods.
At the moment, not all methods are implemented, they will upstreamed in
upcoming patches.
This patch also adds helper methods to the ScriptInterpreter to
convert `SBAPI` Types (SBData & SBError) to `lldb_private` types
(DataExtractor & Status).
rdar://
65508855
Differential Revision: https://reviews.llvm.org/D95711
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Tue, 16 Feb 2021 09:12:41 +0000 (09:12 +0000)]
[lldb/Commands] Add command options for ScriptedProcess to ProcessLaunch
This patch adds a new command options to the CommandObjectProcessLaunch
for scripted processes.
Among the options, the user need to specify the class name managing the
scripted process. The user can also use a key-value dictionary holding
arbitrary data that will be passed to the managing class.
This patch also adds getters and setters to `SBLaunchInfo` for the
class name managing the scripted process and the dictionary.
rdar://
65508855
Differential Review: https://reviews.llvm.org/D95710
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Wed, 20 Jan 2021 22:50:53 +0000 (23:50 +0100)]
[lldb/Commands] Fix short option collision for `process launch`
This patch changes the short option used in `CommandOptionsProcessLaunch`
for the `-v|--environment` command option to `-E|--environment`.
The reason for that is, that it collides with the `-v|--structured-data-value`
command option generated by `OptionGroupPythonClassWithDict` that
I'm using in an upcoming patch for the `process launch` command.
The long option `--environment` remains the same.
Differential Review: https://reviews.llvm.org/D95100
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Nico Weber [Mon, 1 Mar 2021 19:58:35 +0000 (14:58 -0500)]
[lld/mac] Make -v print version and search paths in additon to linking, not instead of linking
This matches ld64's behavior.
Differential Revision: https://reviews.llvm.org/D97718
Nico Weber [Mon, 1 Mar 2021 19:45:17 +0000 (14:45 -0500)]
[lld/mac] Prefix errors with "ld64.lld" instead of just "lld"
Matches the ELF and COFF ports, which use ld.lld and lld-link, respectively.
While here, also move up `cleanupCallback` to match ELF / COFF.
Differential Revision: https://reviews.llvm.org/D97715
Sanjay Patel [Mon, 1 Mar 2021 19:44:04 +0000 (14:44 -0500)]
[AArch64] add tests for select-of-bools; NFC
Sanjay Patel [Mon, 1 Mar 2021 19:05:16 +0000 (14:05 -0500)]
[x86] add tests for select-of-bools; NFC
Wouter van Oortmerssen [Fri, 26 Feb 2021 17:53:16 +0000 (09:53 -0800)]
[WebAssembly] Fix split-dwarf not emitting DW_OP_WASM_location correctly
It was using the regular path for target indices that uses uleb, but TI_GLOBAL_RELOC needs to be uint32_t.
Introduced here: https://reviews.llvm.org/D85685
Fixes: https://github.com/emscripten-core/emscripten/issues/13240
Differential Revision: https://reviews.llvm.org/D97564
Jan Kratochvil [Mon, 1 Mar 2021 19:45:30 +0000 (20:45 +0100)]
Revert "[lldb] Fix handling of `DW_AT_decl_file` according to D91014"
This reverts commit
7ec7876feda412b6edad0d83565395ef2fd5a004.
Non-x86_64 non-Linux bots broke by the testcase.
Jez Ng [Mon, 1 Mar 2021 19:22:26 +0000 (11:22 -0800)]
[lld-macho] Partial revert of D95204
Trying to unbreak https://lab.llvm.org/buildbot/#/builders/57/builds/4753
I'm not able to repro the failures locally so... here's hoping
Shoaib Meenai [Mon, 1 Mar 2021 17:46:21 +0000 (09:46 -0800)]
[lldb] Remove XPCServices symlinking
This is a downstream change that was accidentally included upstream.
Reviewed By: vsk
Differential Revision: https://reviews.llvm.org/D97701