Yitzhak Mandelbaum [Thu, 3 Mar 2022 11:58:57 +0000 (11:58 +0000)]
[clang][dataflow] Add `MatchSwitch` utility library.
Adds `MatchSwitch`, a library for simplifying implementation of transfer
functions. `MatchSwitch` supports constructing a "switch" statement, where each
case of the switch is defined by an AST matcher. The cases are considered in
order, like pattern matching in functional languages.
Differential Revision: https://reviews.llvm.org/D120900
Krzysztof Drewniak [Thu, 3 Mar 2022 22:52:27 +0000 (22:52 +0000)]
[MLIR][AMDGPU] Fix typo and add comment to SerializeToHsaco
Reviewed By: bondhugula
Differential Revision: https://reviews.llvm.org/D120943
Yitzhak Mandelbaum [Thu, 3 Mar 2022 03:34:44 +0000 (03:34 +0000)]
[clang][dataflow] Add a lattice to track source locations.
This patch adds a simpe lattice used to collect source loctions. An intended application is to track errors found in code during an analysis.
Differential Revision: https://reviews.llvm.org/D120890
William S. Moses [Thu, 3 Mar 2022 19:04:14 +0000 (14:04 -0500)]
[MLIR][SCF] Allow combining subsequent if statements that yield & negated condition
This patch extends the existing if combining canonicalization to also handle the case where a value returned by the first if is used within the body of the second if.
This patch also extends if combining to support if's whose conditions are logical negations of each other.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D120924
Jeremy Morse [Fri, 4 Mar 2022 16:39:22 +0000 (16:39 +0000)]
[DebugInfo][InstrRef] Accept register-reads after isel in any block
When lowering LLVM-IR to instruction referencing stuff, if a value is
defined by a COPY, we try and follow the register definitions back to where
the value was defined, and build an instruction reference to that
instruction. In a few scenarios (such as arguments), this isn't possible.
I added some assertions to catch cases that weren't explicitly whitelisted.
Over the course of a few months, several more scenarios have cropped up,
the lastest is the llvm.read_register intrinsic, which lets LLVM-IR read an
arbitary register at any point. In the face of this, there's little point
in validating whether debug-info reads a register in an expected scenario.
Thus: this patch just deletes those assertions, and adds a regression test
to check that something is done with the llvm.read_register intrinsic.
Fixes #54190
Differential Revision: https://reviews.llvm.org/D121001
William S. Moses [Wed, 2 Mar 2022 20:13:07 +0000 (15:13 -0500)]
[MLIR][MemRef] Ensure alloca_scope is inlined with no allocating ops
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D120841
Simon Pilgrim [Fri, 4 Mar 2022 16:47:20 +0000 (16:47 +0000)]
[X86] LowerShiftByScalarVariable - find splat patterns with getSplatSourceVector instead of getSplatValue
This completes the removal of uses of SelectionDAG::getSplatValue started in D119090 - by avoiding extracting the splatted element we make it a lot easier to zero-extend the bottom 64-bits of the shift amount and fixes issues we had on 32-bit targets where i64 isn't legal.
I've removed the old version of getTargetVShiftNode that took the scalar shift amount argument and LowerRotate can finally efficiently handle vXi16 rotates-by-scalar (using the same code as general funnel-shifts).
The only regression we see is in the X86-AVX2 PR52719 test case in vector-shift-ashr-256.ll - this is now hitting the same problem as the X86-AVX1 case (failure to simplify a multi-use X86ISD::VBROADCAST_LOAD) which I intend to address in a follow up patch.
Hans Wennborg [Fri, 4 Mar 2022 16:25:48 +0000 (17:25 +0100)]
Revert "[AArch64] Async unwind - function prologues"
It caused builds to assert with:
(StackSize == 0 && "We already have the CFA offset!"),
function generateCompactUnwindEncoding, file AArch64AsmBackend.cpp, line 624.
when targeting iOS. See comment on the code review for reproducer.
> This patch rearranges emission of CFI instructions, so the resulting
> DWARF and `.eh_frame` information is precise at every instruction.
>
> The current state is that the unwind info is emitted only after the
> function prologue. This is fine for synchronous (e.g. C++) exceptions,
> but the information is generally incorrect when the program counter is
> at an instruction in the prologue or the epilogue, for example:
>
> ```
> stp x29, x30, [sp, #-16]! // 16-byte Folded Spill
> mov x29, sp
> .cfi_def_cfa w29, 16
> ...
> ```
>
> after the `stp` is executed the (initial) rule for the CFA still says
> the CFA is in the `sp`, even though it's already offset by 16 bytes
>
> A correct unwind info could look like:
> ```
> stp x29, x30, [sp, #-16]! // 16-byte Folded Spill
> .cfi_def_cfa_offset 16
> mov x29, sp
> .cfi_def_cfa w29, 16
> ...
> ```
>
> Having this information precise up to an instruction is useful for
> sampling profilers that would like to get a stack backtrace. The end
> goal (towards this patch is just a step) is to have fully working
> `-fasynchronous-unwind-tables`.
>
> Reviewed By: danielkiss, MaskRay
>
> Differential Revision: https://reviews.llvm.org/D111411
This reverts commit
32e8b550e5439c7e4aafa73894faffd5f25d0d05.
zhongyunde [Fri, 4 Mar 2022 14:44:14 +0000 (22:44 +0800)]
[AArch64] Use simd mov to materialize big fp constants
mov w8, #
1325400064 + fmov s0, w8 ==> movi v0.2s, 0x4f, lsl 24
Fix https://github.com/llvm/llvm-project/issues/53651
Reviewed By: dmgreen, fhahn
Differential Revision: https://reviews.llvm.org/D120452
Richard Howell [Fri, 4 Mar 2022 16:30:32 +0000 (08:30 -0800)]
[llvm] fix bitcode-strip.test on windows
Remove the executable name from the test match as this will have
a `.exe` suffix on windows.
Reviewed By: drodriguez
Differential Revision: https://reviews.llvm.org/D121000
Michel Weber [Fri, 4 Mar 2022 15:04:37 +0000 (15:04 +0000)]
[MLIR][Presburger] skip IntegerPolyhedrons with LocalIds in coalesce
This patch makes coalesce skip the comparison of all pairs of IntegerPolyhedrons with LocalIds rather than crash. The heuristics to handle these cases will be upstreamed later on.
Reviewed By: arjunp
Differential Revision: https://reviews.llvm.org/D120995
Richard Howell [Fri, 4 Mar 2022 16:00:21 +0000 (08:00 -0800)]
[llvm] add -o flag to llvm-bitcode-strip
Add the -o flag to specify an output path for llvm-bitcode-strip.
This matches the interface to the Xcode bitcode_strip tool.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D120731
William S. Moses [Thu, 3 Mar 2022 17:31:48 +0000 (12:31 -0500)]
[MLIR][LLVM] Fold extractvalue to ignore insertvalue at distinct index
We can simplify an extractvalue of an insertvalue to extract out of the base of the insertvalue, if the insert and extract are at distinct and non-prefix'd indices
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D120915
Louis Dionne [Fri, 4 Mar 2022 15:59:03 +0000 (10:59 -0500)]
[runtimes] Trigger CI jobs when only the runtimes/ subdirectory is touched
Balazs Benics [Fri, 4 Mar 2022 15:45:20 +0000 (16:45 +0100)]
[clang-tidy][NFC] Document bugprone-narrowing-conversions check alias
Augie Fackler [Fri, 14 Jan 2022 19:38:44 +0000 (14:38 -0500)]
InstructionCombining: avoid eliding mismatched alloc/free pairs
Prior to this change LLVM would happily elide a call to any allocation
function and a call to any free function operating on the same unused
pointer. This can cause problems in some obscure cases, for example if
the body of operator::new can be inlined but the body of
operator::delete can't, as in this example from jyknight:
#include <stdlib.h>
#include <stdio.h>
int allocs = 0;
void *operator new(size_t n) {
allocs++;
void *mem = malloc(n);
if (!mem) abort();
return mem;
}
__attribute__((noinline)) void operator delete(void *mem) noexcept {
allocs--;
free(mem);
}
void deleteit(int*i) { delete i; }
int main() {
int*i = new int;
deleteit(i);
if (allocs != 0)
printf("MEMORY LEAK! allocs: %d\n", allocs);
}
This patch addresses the issue by introducing the concept of an
allocator function family and uses it to make sure that alloc/free
function pairs are only removed if they're in the same family.
Differential Revision: https://reviews.llvm.org/D117356
Karl Meakin [Wed, 16 Feb 2022 17:07:05 +0000 (17:07 +0000)]
Extend `performANDCSELCombine` to `performANDORCSELCombine`
Differential Revision: https://reviews.llvm.org/D120422
Nikita Popov [Fri, 4 Mar 2022 14:10:51 +0000 (15:10 +0100)]
[CoroFrame] Remove unused insertSpills() return value (NFC)
Simon Pilgrim [Fri, 4 Mar 2022 13:14:24 +0000 (13:14 +0000)]
[X86] SimplifyDemandedVectorElts - adjust X86ISD::ANDNP demanded elts based off constant masks
Similar to what we already do in combineAndnp, if either operand is a constant then we can improve the demanded elts/bits.
David Spickett [Fri, 4 Mar 2022 13:33:55 +0000 (13:33 +0000)]
Revert "[WebAssembly] Update WebAssemblyAsmTypeCheck for table.get"
This reverts commit
6b2482f6f4729a76776a48ac3b4a3fcd401a880e due to
test failures on AArch64 bots:
https://lab.llvm.org/buildbot/#/builders/183/builds/3684
Andrzej Warzynski [Fri, 4 Mar 2022 11:31:29 +0000 (11:31 +0000)]
[flang] Fix standalone builds
In
dd875dd88bf7f39ad56d8402bdc49ffeb51b4ab8 I added a missing MLIR
dependency in Flang. However, that particular CMake target is not
exported as something available to standalone builds. In this patch is
switch to `MLIRIR` instead, which depends on
`MLIRBuiltinAttributeInterfacesIncGen` - the missing dependency added
previously.
Differential Revision: https://reviews.llvm.org/D120986
Jay Foad [Fri, 4 Mar 2022 12:45:09 +0000 (12:45 +0000)]
[AMDGPU] Extra test cases in hard-clauses.mir
Add some cases where different kinds of instruction might be
combined in the same hard clause.
Jay Foad [Fri, 4 Mar 2022 12:45:38 +0000 (12:45 +0000)]
[AMDGPU] Regenerate checks in hard-clauses.mir
Nathan Sidwell [Thu, 3 Mar 2022 11:44:16 +0000 (03:44 -0800)]
[demangler] Make OutputBuffer non-copyable
In addressing the buffer ownership API, I discovered a rogue member
function that returned by value rather than by reference. It clearly
intended to return by reference, but because the copy ctor wasn't
deleted this wasn't caught.
It is not necessary to make this a move-only type, although that would
be an alternative.
Reviewed By: bruno
Differential Revision: https://reviews.llvm.org/D120901
Aaron Ballman [Fri, 4 Mar 2022 12:21:04 +0000 (07:21 -0500)]
Revert "[analyzer] Done some changes to detect Uninitialized read by the char array manipulation functions"
This reverts commit
9c300c18a4eaf79eb7044744bbdb705764579220.
This broke the sphinx bot and seems like an unintentional commit.
4vtomat [Fri, 4 Mar 2022 04:09:00 +0000 (20:09 -0800)]
[NFC] Divide tests into smaller files
This commit divides the large test files(over 30k lines) under clang/test/CodeGen/RISCV including:
rvv-intrinsics/vloxseg.c
rvv-intrinsics/vluxseg.c
rvv-intrinsics-overloaded/vloxseg.c
rvv-intrinsics-overloaded/vluxseg.c
into "non-masked" version and "masked" version which can reduce the test cases by 50% in a single file.
Differential Revision: https://reviews.llvm.org/D120967
Jay Foad [Thu, 3 Mar 2022 15:35:40 +0000 (15:35 +0000)]
[AMDGPU] Tweak predicates for image_bvh_intersect_ray instructions
Don't override SubtargetPredicate since that is already set in the
base classes for the appropriate subtarget like MIMG_gfx10. Use
OtherPredicates instead for consistency with the way we handle
features like HasImageInsts and HasExtendedImageInsts. NFC.
Differential Revision: https://reviews.llvm.org/D120909
nokotan [Fri, 4 Mar 2022 12:01:25 +0000 (13:01 +0100)]
[WebAssembly] Update WebAssemblyAsmTypeCheck for table.get
This patch is aimed to resolve [[ https://github.com/llvm/llvm-project/issues/53789 | GitHub Issue #53789 ]].
Reviewed By: sbc100
Differential Revision: https://reviews.llvm.org/D120229
Paul Walker [Thu, 24 Feb 2022 18:40:23 +0000 (18:40 +0000)]
[DAGCombine] Prevent illegal ISD::SPLAT_VECTOR operations post legalisation.
When triggered during operation legalisation the affected combine
generates a splat_vector that when custom lowered for SVE fixed
length code generation, results in the original precombine sequence
and thus we enter a legalisation/combine hang.
NOTE: The patch contains no tests because I observed this issue
only when combined with other work that might never become public.
The current way AArch64 lowers ISD::SPLAT_VECTOR meant a specific
test was not possible so I'm hoping the DAGCombiner fix can be seen
as obvious. The AArch64ISelLowering change is requirted to maintain
existing code quality.
Differential Revision: https://reviews.llvm.org/D120735
Florian Hahn [Fri, 4 Mar 2022 11:37:00 +0000 (11:37 +0000)]
[Driver] Split up huge arm-cortex-cpus.c test.
This test file has grown to the point where it takes a huge amount of
time to run. At the moment, this test seems to consistently time out
when running in the pre-commit checks in Phabricator with a 10 minute
timeout. For example see
https://reviews.llvm.org/harbormaster/unit/view/2832724/
While splitting up the test file is not ideal, it is even more
undesirable to have huge test files that time out in common settings.
This patch splits up the test file roughly in the middle.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D120876
Florian Hahn [Fri, 4 Mar 2022 11:24:12 +0000 (11:24 +0000)]
[Driver] Split up huge aarch64-cpus.c test.
This test file has grown to the point where it takes a huge amount of
time to run. At the moment, this test seems to consistently time out
when running in the pre-commit checks in Phabricator with a 10 minute
timeout. For example see
https://reviews.llvm.org/harbormaster/unit/view/2832723/
While splitting up the test file is not ideal, it is even more
undesirable to have huge test files that time out in common settings.
This patch splits up the test file roughly in the middle.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D120875
David Green [Fri, 4 Mar 2022 11:12:26 +0000 (11:12 +0000)]
[AArch64] Turn UZP1 with undef operand into truncate
This turns upz1(x, undef) to concat(truncate(x), undef), as the truncate
is simpler and can often be optimized away, and it helps some of the
insert-subvector tests optimize more cleanly.
Differential Revision: https://reviews.llvm.org/D120879
Nikita Popov [Fri, 4 Mar 2022 11:08:41 +0000 (12:08 +0100)]
[Attributor] Remove function pointer type check (NFCI)
This check is not relevant for correctness, it can only avoid
walking some recursive uses if the cast is to a non-function
pointer type. As this distinction will no longer be possible
with opaque pointers and all users will have to be walked
anyway, I'm dropping the check in advance.
Florian Hahn [Fri, 4 Mar 2022 11:07:42 +0000 (11:07 +0000)]
[IVDescriptor] Use DT to check order of Previous, OtherPrev.
Previous and OhterPrev may not be in the same block. Use DT::dominates
instead of local comesBefore. DT::dominates is already used earlier to
check the order of Previous and SinkCandidate.
Fixes https://github.com/llvm/llvm-project/issues/54195
Nikita Popov [Fri, 25 Feb 2022 16:36:29 +0000 (17:36 +0100)]
Reapply [MergeICmps] Don't require GEP
Recommit without changes over
53abe3ff66a54117308352d379837c7d3229f8d6,
which addressed the cause of the reported crash.
-----
With opaque pointers, the zero-offset load will generally not use
a GEP. Allow a direct load without GEP, which is treated the same
way as a zero-offset GEP.
David Sherwood [Mon, 28 Feb 2022 17:04:55 +0000 (17:04 +0000)]
[AArch64] Fix the TuneExynosM4 entry in lib/Target/AArch64/AArch64.td
A bug was introduced in
5ea35791e6642f6160819c930f79b0f57ad0e907 that
gave the wrong name and description for TuneExynosM4. This patch fixes
that and changes it back to m3.
Differential Revision: https://reviews.llvm.org/D120665
Nikita Popov [Fri, 4 Mar 2022 10:13:40 +0000 (11:13 +0100)]
[MergeICmp] Make instruction move robust against empty block (NFCI)
Use the overload that support moving into an empty block. I don't
think that this situation can occur right now, but it can happen
with the change from
e7fb1c15cb85d748c1c4fdd5a2eb5613ec7bef1d,
and the test is derived from the issue reported there.
Sander de Smalen [Thu, 3 Mar 2022 14:09:26 +0000 (14:09 +0000)]
[AArch64] Improve access to fixed-width object when stack has SVE.
When the stack has SVE objects, fixed-width objects are often better accessed
from the SP, instead of the FP, because part/all of the fixed-width offset
can be folded into the (non-scalable) addressing mode, where otherwise an
ADDVL would be required.
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D120738
Sander de Smalen [Tue, 1 Mar 2022 17:00:04 +0000 (17:00 +0000)]
[AArch64] NFC: Add test for access to fixed-width stack object when stack has SVE.
In this case, the access would benefit from being accessed from the SP, as that
would avoid the redundant ADDVL, since most of the offset can currently be
folded into the addressing mode.
Nikita Popov [Fri, 4 Mar 2022 09:30:50 +0000 (10:30 +0100)]
[Bitcode] Move x86_intrcc upgrade to bitcode reader
This upgrade requires access the legacy pointer element type, so
it needs to happen inside the bitcode reader.
Nikita Popov [Wed, 23 Feb 2022 15:56:41 +0000 (16:56 +0100)]
[Bitcode] Fully support opaque pointer auto upgrade
This completes the propagation of type IDs through bitcode reading,
and switches remaining uses of getPointerElementType() to use
contained type IDs.
The main new thing here is that sometimes we need to create a type
ID for a type that was not explicitly encoded in bitcode (or we
don't know its ID at the current point). For such types we create a
"virtual" type ID, which is cached based on the type and the
contained type IDs. Luckily, we generally only need zero or one
contained type IDs, and in the one case where we need two, we can
get away with not including it in the cache key.
With this change, we pass the entirety of llvm-test-suite at O3
with opaque pointers.
Differential Revision: https://reviews.llvm.org/D120471
David Green [Fri, 4 Mar 2022 09:04:09 +0000 (09:04 +0000)]
[AArch64] Additional insert-subvector codegen tests. NFC
Tim Northover [Fri, 4 Mar 2022 07:59:16 +0000 (07:59 +0000)]
[tests][Driver] Pass an empty sysroot for `DEFAULT_SYSROOT` builds
The baremetal-sysroot test fails when the toolchain is configured with
DEFAULT_SYSROOT. So, to emulate not having passed one at all, let's
pass an empty sysroot instead.
https://reviews.llvm.org/D119144
Patch by Carlo Cabrera <carlo.antonio.cabrera@gmail.com>
Martin Storsjö [Tue, 25 Jan 2022 11:19:18 +0000 (11:19 +0000)]
[libcxx] [test] Fix get_string_en_US, get_long_double_en_US for Windows
In the en_US locale on Windows, negative currency amounts is formatted
as "($0.01)" instead of "-$0.01".
Differential Revision: https://reviews.llvm.org/D120799
Martin Storsjö [Tue, 15 Feb 2022 13:49:40 +0000 (13:49 +0000)]
[libcxx] [test] Fix the get/put long_double_zh_CN tests on Windows
Differential Revision: https://reviews.llvm.org/D120889
Michel Weber [Thu, 3 Mar 2022 17:48:16 +0000 (23:18 +0530)]
[MLIR][Presburger] support a heuristic for the "cut case" in coalesce
This patch introduces the cut case. If one polytope has only cutting and
redundant inequalities for the other and the facet of the cutting
inequalities are contained within the other polytope, then the polytopes are
be combined into a polytope consisting only of their respective
redundant constraints.
Reviewed By: arjunp
Differential Revision: https://reviews.llvm.org/D120614
phyBrackets [Fri, 4 Mar 2022 06:45:27 +0000 (12:15 +0530)]
[analyzer] Done some changes to detect Uninitialized read by the char array manipulation functions
Few weeks back I was experimenting with reading the uninitialized values from src , which is actually a bug but the CSA seems to give up at that point . I was curious about that and I pinged @steakhal on the discord and according to him this seems to be a genuine issue and needs to be fix. So I goes with fixing this bug and thanks to @steakhal who help me creating this patch. This feature seems to break some tests but this was the genuine problem and the broken tests also needs to fix in certain manner. I add a test but yeah we need more tests,I'll try to add more tests.Thanks
Reviewed By: steakhal, NoQ
Differential Revision: https://reviews.llvm.org/D120489
Weining Lu [Fri, 4 Mar 2022 05:36:58 +0000 (13:36 +0800)]
[LoongArch] Delete unnecessary comments in LoongArchMCTargetDesc.cpp
David Blaikie [Fri, 4 Mar 2022 05:19:51 +0000 (05:19 +0000)]
Fix for D119899
David Blaikie [Fri, 4 Mar 2022 04:20:08 +0000 (04:20 +0000)]
More bazel fixes
River Riddle [Fri, 4 Mar 2022 04:20:36 +0000 (20:20 -0800)]
[PDLL] Attempt to fix shared libraries build
PDLLParser now depends on TableGen, which disables LLVM_DYLIB
David Blaikie [Fri, 4 Mar 2022 04:15:38 +0000 (04:15 +0000)]
More bazel fixes
Uday Bondhugula [Thu, 3 Mar 2022 01:18:27 +0000 (06:48 +0530)]
[MLIR] Extend isLoopMemoryParallel to account for locally allocated memrefs
Extend isLoopMemoryParallel check to include locally allocated memrefs.
This strengthens and also speeds up the dependence check used by the
utility by excluding locally allocated memrefs where appropriate.
Additional memref dialect ops can be supported exhaustively via proper
interfaces.
Reviewed By: dcaballe
Differential Revision: https://reviews.llvm.org/D120617
William S. Moses [Wed, 2 Mar 2022 23:57:58 +0000 (18:57 -0500)]
[MLIR][OpenMP] Mark openmp.parallel and omp.wsloop as having recursive side effects
An OpenMP wsloop is simply a regular for loop with the bounds determined by the thread number, and the same justification to allow this for scf.for works for omp.wsloop.
An OpenMP parallel is a parallel for, per thread. Similarly the same justification for scf.parallel having recursive side effects applies here.
In both cases the general justification is that the ops themselves don't have side effects (besides inaccessible runtime-specific memory) and thus the side effects are simply that of the contained ops.
Reviewed By: bondhugula
Differential Revision: https://reviews.llvm.org/D120853
River Riddle [Fri, 4 Mar 2022 03:05:57 +0000 (19:05 -0800)]
[PDLL] Specify LLVM_LINK_COMPONENTS using LINK_COMPONENTS
David Blaikie [Fri, 4 Mar 2022 01:02:18 +0000 (01:02 +0000)]
Jez Ng [Fri, 4 Mar 2022 00:48:34 +0000 (19:48 -0500)]
[lld-macho][nfc] Decouple tapi-link.s test from libSystem
If we fix https://github.com/llvm/llvm-project/issues/54184, we will end
up including libSystem in every %lld invocation, which would break
tapi-link.s as it assumes that libSystem isn't directly linked (instead
it goes through libReexportSystem).
Let's remove this unnecessary coupling, as well as use `split-file`
instead of having a separate file under `Inputs`.
Reviewed By: #lld-macho, oontvoo
Differential Revision: https://reviews.llvm.org/D120939
LLVM GN Syncbot [Fri, 4 Mar 2022 00:22:21 +0000 (00:22 +0000)]
[gn build] Port
e865fa75308a
Greg Clayton [Sun, 27 Feb 2022 20:01:19 +0000 (10:01 -1000)]
Fix race condition when launching and attaching.
This is a modified version of a previous patch that was reverted: https://reviews.llvm.org/D119797
This version only waits for the process to stop when using "launchCommands" or "attachCommands"...
...and doesn't play with the async mode when doing normal launch/attach.
We discovered that when using "launchCommands" or "attachCommands" that there was an issue where these commands were not being run synchronously. There were further problems in this case where we would get thread events for the process that was just launched or attached before the IDE was ready, which is after "configurationDone" was sent to lldb-vscode.
This fix introduces the ability to wait for the process to stop after "launchCommands" or "attachCommands" are run to ensure that we have a stopped process point that is ready for the debug session to proceed. We spin up the thread that listens for process events before we start the launch or attach, but we don't want stop events being delivered through the DAP protocol until the "configurationDone" packet is received. We now always ignore the stop event with a stop ID of 1, which is the first stop. All normal launch and attach scenarios use the synchronous mode, and "launchCommands and "attachCommands" run an array of LLDB commands in async mode.
This should make our launch with "launchCommands" and attach with "attachCommands" avoid a race condition when the process is being launched or attached.
Differential Revision: https://reviews.llvm.org/D120755
River Riddle [Tue, 15 Feb 2022 22:32:37 +0000 (14:32 -0800)]
[PDLL] Add support for tablegen includes and importing ODS information
This commit adds support for processing tablegen include files, and importing
various information from ODS. This includes operations, attribute+type constraints,
attribute/operation/type interfaces, etc. This will allow for much more robust tooling,
and also allows for referencing ODS constructs directly within PDLL (imported interfaces
can be used as constraints, operation result names can be used for member access, etc).
Differential Revision: https://reviews.llvm.org/D119900
River Riddle [Tue, 15 Feb 2022 06:22:53 +0000 (22:22 -0800)]
[TableGen] Add a library-based entry point for parsing td files
This commit adds a new `TableGenParseFile` entry point for tablegen
that parses an input buffer and invokes a callback function with
a record keeper (notably without an output buffer). This kind of entry
point is very useful for tablegen consuming tools that don't create
output, and want invoke tablegen multiple times. The current way
that we interact with tablegen is via relative includes to
TGParser(not great).
Differential Revision: https://reviews.llvm.org/D119899
Jez Ng [Fri, 4 Mar 2022 00:04:11 +0000 (19:04 -0500)]
[LTO] Initialize canAutoHide() using canBeOmittedFromSymbolTable()
Per discussion on
https://reviews.llvm.org/D59709#inline-1148734, this seems like the
right course of action. `canBeOmittedFromSymbolTable()` subsumes and
generalizes the previous logic. In addition to handling `linkonce_odr`
`unnamed_addr` globals, we now also internalize `linkonce_odr` +
`local_unnamed_addr` constants.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D120173
Jez Ng [Thu, 3 Mar 2022 23:50:59 +0000 (18:50 -0500)]
[lld-macho][nfc] Use %lld-watchos substitution in bind-opcodes.s
Previously, we were using a syslibroot that pointed to macos while
linking against arch arm64_32, which didn't really make sense. It isn't
currently an issue, but will be if we add the `-lSystem` as part of
dealing with https://github.com/llvm/llvm-project/issues/54184.
Jez Ng [Thu, 3 Mar 2022 23:58:08 +0000 (18:58 -0500)]
[lld-macho][nfc] Avoid using absolute addresses in cgprofile-icf.s
If we fix https://github.com/llvm/llvm-project/issues/54184, the
`dyld_stub_binder` symbol will get included in every output dylib. This
would cause the addresses of the other symbols to shift, breaking the
test as it currently stands. Let's make the test more flexible.
Reviewed By: lgrey
Differential Revision: https://reviews.llvm.org/D120940
Craig Topper [Thu, 3 Mar 2022 22:21:59 +0000 (14:21 -0800)]
[RISCV] With Zbb, fold (sext_inreg (abs X)) -> (max X, (negw X))
With Zbb, abs is expanded to (max X, neg) by default. If X has 33 or
more sign bits, we can expand it a little early using negw instead of
neg to save a sext_inreg. If X started as a 32 bit value, type
legalization would have inserted a sext before the abs so X having
33 sign bits should always be true.
Note: I've used ISD::FREEZE here since we increase the number of uses.
Our default expansion for ABS doesn't do that, but I think that's a bug.
We can't do this with custom type legalization because ISD::FREEZE
doesn't propagate sign bits so later DAG combine won't expand be
able to see optmize it.
Alives2 https://alive2.llvm.org/ce/z/Gx3RNe
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D120597
Shoaib Meenai [Sun, 23 Jan 2022 20:51:46 +0000 (12:51 -0800)]
[hmaptool] Fix string decoding for Python 3
Our "strings" were actually bytes, which made verbose dumping fail.
Decode them so they actually become strings.
Reviewed By: bruno
Differential Revision: https://reviews.llvm.org/D118005
Shoaib Meenai [Sun, 23 Jan 2022 20:50:01 +0000 (12:50 -0800)]
[hmaptool] Fix dumping
It was complaining about too many values to unpack, since our struct
unpack format string specified six members, but we only had five
variables to unpack to. The sixth value is the max value length, but
it's not used in dumping, so we can ignore it.
Reviewed By: bruno
Differential Revision: https://reviews.llvm.org/D118004
Arthur Eubanks [Thu, 3 Mar 2022 22:55:09 +0000 (14:55 -0800)]
Revert "[MergeICmps] Don't require GEP"
This reverts commit
e7fb1c15cb85d748c1c4fdd5a2eb5613ec7bef1d.
Causes crashes, see https://reviews.llvm.org/rGe7fb1c15cb85d748c1c4fdd5a2eb5613ec7bef1d.
Vladimir Vereschaka [Thu, 3 Mar 2022 22:32:16 +0000 (14:32 -0800)]
[CMake] Update cache file for Win to ARM cross tooolchain. NFC.
Removed passing CMAKE_AR from the library configurations.
Jonas Devlieghere [Thu, 3 Mar 2022 21:56:59 +0000 (13:56 -0800)]
[lldb] Fix the build after
8b3b66ea63d6
Remove remaining calls to FileSystem::Collect.
Nick Desaulniers [Thu, 3 Mar 2022 21:42:10 +0000 (13:42 -0800)]
[Mips] support "sp" named register
After Linux kernel commit
commit
200ed341b864 ("mips: Implement "current_stack_pointer"")
We observe the following build error when compiling the Linux kernel
targeting Mips:
fatal error: error in backend: Invalid register name global variable
Fixes: https://github.com/llvm/llvm-project/issues/54174
Link: https://github.com/ClangBuiltLinux/linux/issues/1608
Reviewed By: atanasyan
Differential Revision: https://reviews.llvm.org/D120926
Krzysztof Drewniak [Mon, 28 Feb 2022 15:56:17 +0000 (15:56 +0000)]
[MLIR] [AMDGPU] Use correct flags when building SerializeToHsaco
The SerializeToHsaco pass does not depend on ROCm being available on
the build system - it only requires ROCm to be present at runtime.
However, the CMake file that built it tested for
MLIR_ENABLE_ROCM_RUNNER , which implies that ROCm is currently
available and is used to control building ROCm integration tests.
Referencing MLIR_ENABLE_ROCM_RUNNER instead of
MLIR_ENABLE_ROCM_CONVERSIONS in the SerializeToHsaco build therefore
causes problems for clients who wish to build projects that depend on
this pass on a system without an AMD GPU present.
Reviewed By: whchung
Differential Revision: https://reviews.llvm.org/D120663
Maksim Panchenko [Thu, 3 Mar 2022 01:35:49 +0000 (17:35 -0800)]
[NFC] Fix typos
Reviewed By: yota9, Amir
Differential Revision: https://reviews.llvm.org/D120859
Maksim Panchenko [Thu, 3 Mar 2022 02:30:40 +0000 (18:30 -0800)]
[BOLT][NFC] Return MCRegister::NoRegister from MCPlusBuilder::getNoRegister()
Reviewed By: yota9
Differential Revision: https://reviews.llvm.org/D120863
Jonas Devlieghere [Thu, 3 Mar 2022 20:56:31 +0000 (12:56 -0800)]
[lldb] Remove reproducer_handler from the driver
Jonas Devlieghere [Thu, 3 Mar 2022 19:52:02 +0000 (11:52 -0800)]
[lldb] Remove FileSystem::Initialize from FileCollector
This patch removes the ability to instantiate the LLDB FileSystem class
with a FileCollector. It keeps the ability to collect files, but uses
the FileCollectorFileSystem to do that transparently.
Because the two are intertwined, this patch also removes the
finalization logic which copied the files over out of process.
Benjamin Kramer [Thu, 3 Mar 2022 21:15:36 +0000 (22:15 +0100)]
Aaron Ballman [Thu, 3 Mar 2022 21:03:05 +0000 (16:03 -0500)]
Fixed sphinx build due to indentation
Mark de Wever [Tue, 1 Mar 2022 17:02:10 +0000 (18:02 +0100)]
[libc++] Removes base member from tests.
Change the tests to use the base friend function instead of members.
Also changed some types to have a base friends instead of members.
Reviewed By: #libc, ldionne, Quuxplusone
Differential Revision: https://reviews.llvm.org/D120742
Matt Arsenault [Thu, 3 Mar 2022 18:23:41 +0000 (13:23 -0500)]
Revert "Inliner: Correctly merge amdgpu-unsafe-fp-atomics attribute"
This reverts commit
169ebf03ab2a6f16bfa32a36305929c7bc8e4784.
This was effectively rendering the attribute useless in the real
world, although this is still broken.
Sanjay Patel [Thu, 3 Mar 2022 17:50:48 +0000 (12:50 -0500)]
[x86] add tests for vector rotate; NFC
Sanjay Patel [Thu, 3 Mar 2022 16:01:12 +0000 (11:01 -0500)]
[AArch64][x86] add tests for rotate/funnel combines; NFC
Jim Ingham [Thu, 3 Mar 2022 20:10:54 +0000 (12:10 -0800)]
Fix the order of modules-loaded event and the resultant breakpoint-changed event.
The order used to be breakpoint-changed first, which didn't make much sense.
Differential Revision: https://reviews.llvm.org/D120919
Jim Ingham [Thu, 3 Mar 2022 17:56:50 +0000 (09:56 -0800)]
Fix up the "lldb log break" channel output.
1) Make the BreakpointEventData::Dump actually do something useful.
2) Make the Breakpoint events print when the break log channel is on
without having to turn on the events channel.
Differential Revision: https://reviews.llvm.org/D120917
Erich Keane [Thu, 3 Mar 2022 19:45:44 +0000 (11:45 -0800)]
[NFC] move CheckInstantiatedFunctionTemplateConstraints to SemaConcepts.cpp
This is a Sema function that now no longer depends on any of the
functionality in SemaTemplateInstantiateDecl.cpp (as the static function
was moved to Sema in a previous NFC). Moving it to SemaConcept means
that it and CheckFunctionConstraints can be changed to share more.
Philip Reames [Thu, 3 Mar 2022 19:36:21 +0000 (11:36 -0800)]
[DSE] Cache liveOnEntry as clobbering access
This builds on @fhahn's D112313, and caches the liveOnEntry node as a optimized access. D112313 tied to only cache a known clobber. This change adds caching the fact that no clobber exists. It still does not cache may-clobber results.
Differential Revision: https://reviews.llvm.org/D120842
Philip Reames [Thu, 3 Mar 2022 19:24:32 +0000 (11:24 -0800)]
Revert "Reapply "[SLP] Schedule only sub-graph of vectorizable instructions"""
This reverts commit
738042711bc08cde9135873200b1d088e6cf11c3. A second, apparently separate, issue has been reported on the original review.
Vasileios Porpodas [Tue, 1 Mar 2022 06:34:45 +0000 (22:34 -0800)]
[RegAlloc] Add a complexity limit in growRegion() to cap compilation time.
growRegion() does not scale in code with BBs with a very large number of edges.
In such code growRegion() becomes a compile-time bottleneck, consuming 60% of
the total compilation time.
This patch adds a limit to the complexity of growRegion() by incrementing a counter
in each iteration. We bail out once the limit is reached.
Differential Revision: https://reviews.llvm.org/D120752
Jonas Devlieghere [Thu, 3 Mar 2022 19:20:25 +0000 (11:20 -0800)]
[lldb] Remove reproducer verifier and corresponding command
This removes the reproducer verifier and the corresponding `reproducer
verify` subcommand.
Stanislav Mekhanoshin [Thu, 3 Mar 2022 19:17:50 +0000 (11:17 -0800)]
[AMDGPU] Added hsa-gfx90a-v3.s test. NFC.
Arthur Eubanks [Thu, 3 Mar 2022 18:57:10 +0000 (10:57 -0800)]
Revert "[GlobalOpt] Don't replace alias with aliasee if either alias/aliasee may be preemptible"
This reverts commit
30e8f83c84c5a302a559722fc0d2973dc3f425ee.
Causes huge compile time regressions on certain large files. Will followup offline with author.
Jonas Devlieghere [Thu, 3 Mar 2022 18:30:43 +0000 (10:30 -0800)]
[lldb] Remove FileSystem::Initialize from VFS mapping
This patch removes the ability to instantiate the LLDB FileSystem class
based on a VFS overlay. This also removes the "hack" where we cast the
VFS to a RedirectingFileSystem to obtain the external path. You can
still instantiate a FileSystem with a VFS, but with the caveat that
operations that rely on the external path won't work.
Differential revision: https://reviews.llvm.org/D120923
Stanislav Mekhanoshin [Thu, 3 Mar 2022 18:57:28 +0000 (10:57 -0800)]
[AMDGPU] Add test for instructions unsupported on gfx940. NFC.
Snehasish Kumar [Wed, 23 Feb 2022 20:37:42 +0000 (12:37 -0800)]
[memprof] Symbolize and cache stack frames.
Currently, symbolization of stack frames occurs on demand when the instrprof writer
iterates over all the records in the raw memprof reader. With this
change we symbolize and cache the frames immediately after reading the
raw profiles. For a large internal binary this results in a runtime
reduction of ~50% (2m -> 48s) when merging a memprof raw profile with a
raw instr profile to generate an indexed profile. This change also makes
it simpler in the future to generate additional calling context
metadata to attach to each memprof record.
Differential Revision: https://reviews.llvm.org/D120430
Nikolas Klauser [Thu, 3 Mar 2022 13:32:41 +0000 (14:32 +0100)]
[libc++] Remove _LIBCXX_MODULES_BUILD and ext/ headers from header tests
Reviewed By: ldionne, Quuxplusone, #libc
Spies: libcxx-commits, arichardson
Differential Revision: https://reviews.llvm.org/D120896
Shivam [Thu, 3 Mar 2022 15:32:34 +0000 (21:02 +0530)]
[analyzer] Done some changes to detect Uninitialized read by the char array manipulation functions
Few weeks back I was experimenting with reading the uninitialized values from src , which is actually a bug but the CSA seems to give up at that point . I was curious about that and I pinged @steakhal on the discord and according to him this seems to be a genuine issue and needs to be fix. So I goes with fixing this bug and thanks to @steakhal who help me creating this patch. This feature seems to break some tests but this was the genuine problem and the broken tests also needs to fix in certain manner. I add a test but yeah we need more tests,I'll try to add more tests.Thanks
Reviewed By: steakhal, NoQ
Differential Revision: https://reviews.llvm.org/D120489
Shafik Yaghmour [Thu, 3 Mar 2022 18:39:06 +0000 (10:39 -0800)]
[LLDB] Remove cases of using namespace llvm:: from header file
We have using namespace llvm::dwarf in dwarf.h header globally. Replacing that
with a using namespace within lldb_private::dwarf and moving to a
using namespace lldb_private::dwarf in .cpp files and fully qualified names
in the few header files.
Differential Revision: https://reviews.llvm.org/D120836
Louis Dionne [Thu, 3 Mar 2022 18:14:31 +0000 (13:14 -0500)]
[libc++] Move several defines to ADDITIONAL_COMPILE_FLAGS in the test suite
This avoids -Wmacro-redefined when turning warnings on with GCC.
Louis Dionne [Thu, 3 Mar 2022 18:07:42 +0000 (13:07 -0500)]
[libc++] Move .fail.cpp test to .verify.cpp
Arthur Eubanks [Thu, 3 Mar 2022 18:02:29 +0000 (10:02 -0800)]
[CostModel] Change printer pass wording to work with update_analyze_test_checks.py
update_analyze_test_checks.py looks for very specific wording, update
the printer pass to match the legacy `-analyze -cost-model` wording.