Jay Foad [Wed, 16 Feb 2022 10:58:54 +0000 (10:58 +0000)]
[CodeGen] Return better Changed status from LocalStackSlotAllocation
Differential Revision: https://reviews.llvm.org/D119942
Jay Foad [Wed, 16 Feb 2022 10:57:50 +0000 (10:57 +0000)]
[CodeGen] Return false from LiveIntervals::runOnMachineFunction
This is an analysis pass so it does not modify the MachineFunction.
Differential Revision: https://reviews.llvm.org/D119941
Jay Foad [Wed, 16 Feb 2022 10:56:56 +0000 (10:56 +0000)]
[CodeGen] Return better Changed status from DetectDeadLanes
Differential Revision: https://reviews.llvm.org/D119940
Ben Shi [Thu, 17 Feb 2022 09:24:38 +0000 (17:24 +0800)]
Revert "[RISCV] LUI used for address computation should not isAsCheapAsAMove"
This reverts commit
23a50736004e94704a2393aa36a905d737f2b20f.
Although this patch achieved better codegen in most cases, it is really
important to accurately describe the cost of instructions. So I revert it.
Roman Lebedev [Thu, 17 Feb 2022 09:07:17 +0000 (12:07 +0300)]
[SimplifyCFG][PhaseOrdering] Defer lowering switch into an integer range comparison and branch until after at least the IPSCCP
That transformation is lossy, as discussed in
https://github.com/llvm/llvm-project/issues/53853
and https://github.com/rust-lang/rust/issues/85133#issuecomment-
904185574
This is an alternative to D119839,
which would add a limited IPSCCP into SimplifyCFG.
Unlike lowering switch to lookup, we still want this transformation
to happen relatively early, but after giving a chance for the things
like CVP to do their thing. It seems like deferring it just until
the IPSCCP is enough for the tests at hand, but perhaps we need to
be more aggressive and disable it until CVP.
Fixes https://github.com/llvm/llvm-project/issues/53853
Refs. https://github.com/rust-lang/rust/issues/85133
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D119854
Alex Zinenko [Wed, 16 Feb 2022 13:54:54 +0000 (14:54 +0100)]
[mlir] call target materialization more in dialect conversion
During dialect conversion, target materialization is triggered to create
cast-like operations when a type mismatch occurs between the value that
replaces a rewritten operation and the type that another operations expects as
operands processed by the type conversion. First, a dummy cast is inserted to
make sure the pattern application can proceed. The decision to trigger the
user-provided materialization hook is taken later based on the result of the
dummy cast having uses. However, it only has uses if other patterns constructed
new operations using the casted value as operand. If existing (legal)
operations use the replaced value, they may have not been updated to use the
casted value yet. The conversion infra would then delete the dummy cast first,
and then would replace the uses with now-invalid (null in the bast case) value.
When deciding whether to trigger cast materialization, check for liveness the
uses not only of the casted value, but also of all the values that it replaces.
This was discovered in the finalizing bufferize pass that cleans up
mutually-cancelling casts without touching other operations. It is not
impossible that there are other scenarios where the dialect converison infra
could produce invalid operand uses because of dummy casts erased too eagerly.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D119937
Stanislav Gatev [Wed, 16 Feb 2022 16:47:37 +0000 (16:47 +0000)]
[clang][dataflow] Add transfer functions for logical and, or, not.
This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.
Reviewed-by: xazax.hun
Differential Revision: https://reviews.llvm.org/D119953
Lorenzo Chelini [Thu, 17 Feb 2022 09:06:16 +0000 (10:06 +0100)]
[MLIR][PDL] Fix typo (NFC)
Nikita Popov [Thu, 17 Feb 2022 08:54:07 +0000 (09:54 +0100)]
[InstSimplify] Delay creation of constants for offsets (NFC)
Return APInt from stripAndComputeConstantOffsets(), and only
create corresponding Constants later, if we actually need them.
Martin Storsjö [Mon, 24 Jan 2022 22:25:41 +0000 (22:25 +0000)]
[libcxx] [test] Fix locale.time.get.byname get_date and get_date_wide on Windows
Also apply the same fix on glibc. This takes the test one step closer
to passing on glibc, but it still fails on the zh_CN test (which
requires a more involved fix in libc++ itself).
Differential Revision: https://reviews.llvm.org/D119791
Martin Storsjö [Tue, 25 Jan 2022 10:32:55 +0000 (10:32 +0000)]
[libcxx] [test] Fix the locale get_one_wide test for windows and glibc
Differential Revision: https://reviews.llvm.org/D119790
Martin Storsjö [Thu, 20 Jan 2022 09:30:57 +0000 (09:30 +0000)]
[libcxx] [test] Make the put_long_double test pass on mingw, clarify quirks in put_double
Expect the same NAN formatting on Windows as on Glibc. (Both MSVC and
MinGW produce the same formatting there.)
The hex float formatting tests pass on MinGW, so opt in to those tests.
Document exactly what issues are remaining in Clang-cl/MSVC
configurations. (It's easily possible to make the tests pass there too,
but it requires a whole lot of small-scope ifndefs in the test file;
around 60 ifdefs in total for those both test files. Those could
be avoided if the CI environment could run with a newer version
of UCRT, but that's nontrivial to fix right away.)
Differential Revision: https://reviews.llvm.org/D119766
Amir Ayupov [Thu, 17 Feb 2022 04:39:59 +0000 (20:39 -0800)]
[BOLT][NFC] Report errors from createBinaryContext and RewriteInstance ctor
Refactor createBinaryContext and RewriteInstance/MachORewriteInstance
constructors to report an error in a library and fuzzer-friendly way instead of
returning a nullptr or exiting.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D119658
Marek Kurdej [Thu, 17 Feb 2022 08:45:52 +0000 (09:45 +0100)]
[clang-format] Fix wrong assertion with non-negative shift when aligning tokens.
Fixes https://github.com/llvm/llvm-project/issues/53880.
Nikita Popov [Thu, 17 Feb 2022 08:28:33 +0000 (09:28 +0100)]
[IndVars] Don't run full optimization pipeline in test (NFC)
This extracts the IR prior to IndVarSimplify and only runs the
single pass.
Ivan Butygin [Wed, 16 Feb 2022 12:38:14 +0000 (15:38 +0300)]
[mlir][gpu] Split ops sinking from gpu-kernel-outlining pass into separate pass
Previously `gpu-kernel-outlining` pass was also doing index computation sinking into gpu.launch before actual outlining.
Split ops sinking from `gpu-kernel-outlining` pass into separate pass, so users can use theirs own sinking pass before outlining.
To achieve old behavior users will need to call both passes: `-gpu-launch-sink-index-computations -gpu-kernel-outlining`.
Differential Revision: https://reviews.llvm.org/D119932
Pavel Kosov [Thu, 17 Feb 2022 07:21:22 +0000 (10:21 +0300)]
[NFC][compiler-rt] Format file lib/builtins/arm/sync-ops.h
Pavel Kosov [Thu, 17 Feb 2022 07:11:25 +0000 (10:11 +0300)]
[compiler-rt] Implement ARM atomic operations for architectures without SMP support
ARMv5 and older architectures don’t support SMP and do not have atomic instructions. Still they’re in use in IoT world, where one has to stick to libgcc.
Reviewed By: mstorsjo
Differential Revision: https://reviews.llvm.org/D116088
Damian Rouson [Fri, 12 Nov 2021 00:20:30 +0000 (16:20 -0800)]
[flang] add semantics test for sync images
Test a range of acceptable forms of SYNC IMAGES statements,
including combinations with and without the stat-variable
and errmsg-variable present. Also test that several invalid
forms of SYNC IMAGES call generate the correct error messages.
Differential Revision: https://reviews.llvm.org/D118933
Tom Stellard [Thu, 17 Feb 2022 06:18:03 +0000 (22:18 -0800)]
issue-release-workflow: Add support for /cherry-pick command in issue body
Reviewed By: kwk
Differential Revision: https://reviews.llvm.org/D119312
Shraiysh Vaishay [Thu, 17 Feb 2022 04:54:10 +0000 (10:24 +0530)]
[mlir] Added oilist primitive
This patch attempts to add the `oilist` primitive proposed in the [[ https://llvm.discourse.group/t/rfc-extending-declarative-assembly-format-to-support-order-independent-variadic-segments/4388 | RFC: Extending Declarative Assembly Format to support order-independent variadic segments ]].
This element supports optional order-independent variadic segments for operations. This will allow OpenACC and OpenMP Dialects to have similar and relaxed requirements while encouraging the use of Declarative Assembly Format and avoiding code duplication.
An oilist element parses grammar of the form:
```
clause-list := clause clause-list | empty
clause := `keyword` clause1 | `otherKeyword` clause2
clause1 := <assembly-format element>
clause2 := <assembly-format element>
```
AssemblyFormat specification:
```
let assemblyFormat = [{
oilist( `keyword` clause1
| `otherkeyword` clause2
...
)
}];
```
Example:
```
oilist( `private` `(` $arg0 `:` type($arg0) `)`
| `nowait`
| `reduction` custom<ReductionClause>($arg1, type($arg1)))
oilist( `private` `=` $arg0 `:` type($arg0)
| `reduction` `=` $arg1 `:` type($arg1)
| `firstprivate` `=` $arg3 `:` type($arg2))
```
Reviewed By: Mogball, rriddle
Differential Revision: https://reviews.llvm.org/D115215
Eugene Zhulenev [Thu, 17 Feb 2022 04:35:05 +0000 (20:35 -0800)]
[mlir] NFC Async: always use 'b' for the current builder
Currently some of the nested IR building inconsistently uses `nb` and `b`, it's very easy to call wrong builder outside of the current scope, so for simplicity all builders are always called `b`, and in nested IR building regions they just shadow the "parent" builder.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D120003
Damian Rouson [Thu, 11 Nov 2021 19:27:15 +0000 (11:27 -0800)]
[flang] add semantics test for sync all
Test a range of acceptable forms of SYNC ALL statements,
including combinations with and without the stat-variable
and errmsg-variable present. Also test that several invalid
forms of SYNC ALL call generate the correct error messages.
Differential Revision: https://reviews.llvm.org/D114181
Serguei Katkov [Tue, 15 Feb 2022 11:12:22 +0000 (18:12 +0700)]
[MemoryDependency] Relax the re-ordering of atomic store and unordered load/store
Atomic store with Release semantic allows re-ordering of unordered load/store before the store.
Implement it.
Reviewers: reames
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D119844
Jim Ingham [Thu, 17 Feb 2022 03:09:01 +0000 (19:09 -0800)]
On Windows, the function name contains the return parameter, so
the test has to be "function name contains the name we used to specify
the breakpoint" not IS the name...
Alex Brachet [Thu, 17 Feb 2022 03:00:17 +0000 (03:00 +0000)]
[libc] Use '+' constraint on inline assembly
As suggested by @mcgrathr in D118099
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D119978
Jim Ingham [Thu, 17 Feb 2022 01:46:53 +0000 (17:46 -0800)]
Add a test for breaking on overloaded functions by name.
V Donaldson [Wed, 16 Feb 2022 23:26:50 +0000 (15:26 -0800)]
[flang] Allow tabs as white space in formats
The fortran standard views blanks in IO formats as white space in
non-string contexts. Other compilers extend this to also view horizontal
tabs as white space. Some compilers additionally add other white space
characters to this group.
Add recognition of horizontal and vertical tabs to runtime format
validation code to match what the runtime code currently does.
Aart Bik [Thu, 17 Feb 2022 00:30:46 +0000 (16:30 -0800)]
[mlir][sparse] avoid some codeup in sparsification transformation
A very small refactoring, but a big impact on tests that expect an exact order.
This revision fixes the tests, but also makes them less brittle for similar
minor changes in the future!
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D119992
Amara Emerson [Wed, 16 Feb 2022 23:06:07 +0000 (15:06 -0800)]
[AArch64][GlobalISel] Implement support for clang.arc.attachedcall call operand bundles.
Differential Revision: https://reviews.llvm.org/D119983
Yonghong Song [Wed, 16 Feb 2022 19:54:38 +0000 (11:54 -0800)]
[BPF] Fix a BTF type pruning bug
In BPF backend, BTF type generation may skip
some debuginfo types if they are the pointee
type of a struct member. For example,
struct task_struct {
...
struct mm_struct *mm;
...
};
BPF backend may generate a forward decl for
'struct mm_struct' instead of full type if
there are no other usage of 'struct mm_struct'.
The reason is to avoid bringing too much unneeded types
in BTF.
Alexei found a pruning bug where we may miss
some full type generation. The following is an illustrating
example:
struct t1 { ... }
struct t2 { struct t1 *p; };
struct t2 g;
void foo(struct t1 *arg) { ... }
In the above case, we will have partial debuginfo chain like below:
struct t2 -> member p
\ -> ptr -> struct t1
/
foo -> argument arg
During traversing
struct t2 -> member p -> ptr -> struct t1
The corresponding BTF types are generated except 'struct t1' which
will be in FixUp stage. Later, when traversing
foo -> argument arg -> ptr -> struct t1
The 'ptr' BTF type has been generated and currently implementation
ignores 'pointer' type hence 'struct t1' is not generated.
This patch fixed the issue not just for the above case, but for
general case with multiple derived types, e.g.,
struct t2 -> member p
\ -> const -> ptr -> volatile -> struct t1
/
foo -> argument arg
Differential Revision: https://reviews.llvm.org/D119986
Alina Sbirlea [Thu, 17 Feb 2022 00:28:05 +0000 (16:28 -0800)]
[bazel] Add libc dependency.
Jez Ng [Thu, 17 Feb 2022 01:03:57 +0000 (20:03 -0500)]
[lld-macho] Don't include CommandFlags.h in CommonLinkerContext.h
Main motivation: including `llvm/CodeGen/CommandFlags.h` in
`CommonLinkerContext.h` means that the declaration of `llvm::Reloc` is
visible in any file that includes `CommonLinkerContext.h`. Since our
cpp files have both `using namespace llvm` and `using namespace
lld::macho`, this results in conflicts with `lld::macho::Reloc`.
I suppose we could put `llvm::Reloc` into a nested namespace, but in general,
I think we should avoid transitively including too many header files in
a very widely used header like `CommonLinkerContext.h`.
RegisterCodeGenFlags' ctor initializes a bunch of function-`static`
structures and does nothing else, so it should be fine to "initialize"
it as a temporary stack variable rather than as a file static.
Reviewed By: aganea
Differential Revision: https://reviews.llvm.org/D119913
Daniil Suchkov [Tue, 15 Feb 2022 23:46:21 +0000 (23:46 +0000)]
[RewriteStatepointsForGC] Add a test exposing an incorrect assertion
Heejin Ahn [Mon, 14 Feb 2022 23:13:07 +0000 (15:13 -0800)]
[WebAssembly] Make __wasm_lpad_context thread-local
This makes `__wasm_lpad_context`, a struct that is used as a
communication channel between compiler-generated code and personality
function in libunwind, thread local. The library code will be changed to
thread local in the emscripten side.
Reviewed By: sbc100, tlively
Differential Revision: https://reviews.llvm.org/D119803
Matt Arsenault [Mon, 14 Feb 2022 22:22:55 +0000 (17:22 -0500)]
AMDGPU: Always reserve VGPR for AGPR copies on gfx908
Just because there aren't AGPRs in the original program doesn't mean
the register allocator can't choose to use them (unless we were to
forcibly reserve all AGPRs if there weren't any uses). This happens in
high pressure situations and introduces copies to avoid spills.
In this test, the allocator ends up introducing a copy from SGPR to
AGPR which requires an intermediate VGPR. I don't believe it would
introduce a copy from AGPR to AGPR in this situation, since it would
be trying to use an intermediate with a different class.
Theoretically this is also broken on gfx90a, but I have been unable to
come up with a testcase.
Jacques Pienaar [Wed, 16 Feb 2022 23:42:20 +0000 (15:42 -0800)]
[mlir][doc] Add passes docs to Passes.md
Florian Mayer [Tue, 15 Feb 2022 20:02:35 +0000 (12:02 -0800)]
[NFC] [MTE] [HWASan] Remove unnecessary member of AllocaInfo
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D119981
Jacob Lambert [Wed, 2 Feb 2022 03:40:11 +0000 (19:40 -0800)]
[AMDGPU] Add agpr_count to metadata and AsmParser
gfx90a allows the number of ACC registers (AGPRs) to be set
independently to the VGPR registers. For both HSA and PAL metadata, we
now include an "agpr_count" key to report the number of AGPRs set for
supported devices (gfx90a, gfx908, as determined by hasMAIInsts()).
This is collected from SIProgramInfo.NumAccVGPR for both HSA and PAL.
The AsmParser also now recognizes ".kernel.agpr_count" for supported
devices.
Differential Revision: https://reviews.llvm.org/D116140
Nikolas Klauser [Wed, 16 Feb 2022 17:55:43 +0000 (18:55 +0100)]
[libc++] Remove a few unneeded _LIBCPP_CXX03_LANG ifdefs
Reviewed By: Quuxplusone, ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D119896
Arthur Eubanks [Wed, 16 Feb 2022 22:30:51 +0000 (14:30 -0800)]
[SLPVectorizer][OpaquePtrs] Check GEP source element type
Fixes a miscompile with opaque pointers.
Reviewed By: #opaque-pointers, nikic
Differential Revision: https://reviews.llvm.org/D119980
Arthur Eubanks [Wed, 16 Feb 2022 22:26:58 +0000 (14:26 -0800)]
[test][SLPVectorizer][OpaquePtr] Precommit test
Eugene Zhulenev [Wed, 16 Feb 2022 18:40:28 +0000 (10:40 -0800)]
[mlir] Async: create async.group inside the scf.if branch
Reviewed By: cota
Differential Revision: https://reviews.llvm.org/D119959
Sam Clegg [Sun, 13 Feb 2022 16:00:42 +0000 (08:00 -0800)]
[lld][WebAssembly] Apply global relocs before data relocs
Since the code for apply data relocations can sometimes use
the values stored in he globals, they need to be relocated
before the data relocations can be run.
Fixes: https://github.com/emscripten-core/emscripten/issues/13398
Differential Revision: https://reviews.llvm.org/D119666
Marek Kurdej [Wed, 16 Feb 2022 22:05:34 +0000 (23:05 +0100)]
[clang-format] Make checking for a record more robust and avoid a loop.
Johannes Doerfert [Tue, 15 Feb 2022 00:32:00 +0000 (18:32 -0600)]
[Attributor][FIX] Heap2Stack needs to use the alloca AS
When we move an allocation from the heap to the stack we need to
allocate it in the alloca AS and then cast the result. This also
prevents us from inserting the alloca after the allocation call but
rather right before.
Fixes https://github.com/llvm/llvm-project/issues/53858
Johannes Doerfert [Fri, 4 Feb 2022 09:17:20 +0000 (03:17 -0600)]
[Attributor][FIX] Use liveness information of the right function
When we use liveness for edges during the `genericValueTraversal` we
need to make sure to use the AAIsDead of the correct function. This
patch adds the proper logic and some simple caching scheme. We also
add an assertion to the `isEdgeDead` call to make sure future misuse
is detected earlier.
Fixes https://github.com/llvm/llvm-project/issues/53872
Marek Kurdej [Wed, 16 Feb 2022 21:55:09 +0000 (22:55 +0100)]
[clang-format] Mark FormatToken::getPreviousNonComment() nodiscard. NFC.
Nico Weber [Wed, 16 Feb 2022 21:47:26 +0000 (16:47 -0500)]
try to fix check-llvm after
c5fb05f663f
llvm-config wants all libraries referenced in
llvm/lib/CMakeLists.txt to exist on disk.
But WindowsDriver is only referenced in clang and lld and hence
wasn't built as a dependency of check-llvm.
Add it as an explicit dependency to make llvm-config happy.
Med Ismail Bennani [Wed, 16 Feb 2022 21:49:48 +0000 (13:49 -0800)]
[lldb/test] Disable scripted_crashlog_json.test on non darwin aarch64 systems
This patch adds requirement for the `scripted_crashlog_json` test to
make sure it only runs on apple silicon systems.
This should fix the following green dragon failure:
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/41454
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Andrzej Warzynski [Wed, 9 Feb 2022 14:19:22 +0000 (14:19 +0000)]
[flang] Add Win32 to the list of supported triples
This patch adds Win32 to the list of supported triples in
`fir::CodeGenSpecifics`. This change means that we can use the "native"
triple, even when running tests on Windows. Currently this affects only
1 test, but it will change once we start adding more tests for lowering
and code-generation.
Differential Revision: https://reviews.llvm.org/D119332
Joseph Huber [Tue, 15 Feb 2022 14:57:54 +0000 (09:57 -0500)]
[OpenMP] Pass AMDGPU math libraries into the linker wrapper
This patch passes in the AMDPGU math libraries to the linker wrapper.
The wrapper already handles linking OpenMP bitcode libraries via the
`--target-library` option. This should be sufficient to link in math
libraries for the accompanying architecture.
Fixes #53526.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D119841
Joseph Huber [Wed, 16 Feb 2022 21:30:45 +0000 (16:30 -0500)]
[OpenMP] Properly save strings when doing LTO
Summary:
We were not previously saving strings when saving symbol names during
LTO symbol resolution. This caused a crash inside the dense set when
some of the strings would rarely be moved internally by the object file
class.
Marek Kurdej [Mon, 14 Feb 2022 21:25:36 +0000 (22:25 +0100)]
[clang-format] Fix formatting of struct-like records followed by variable declaration.
Fixes https://github.com/llvm/llvm-project/issues/24781.
Fixes https://github.com/llvm/llvm-project/issues/38160.
This patch splits `TT_RecordLBrace` for classes/enums/structs/unions (and other records, e.g. interfaces) and uses the brace type to avoid the error-prone scanning for record token.
The mentioned bugs were provoked by the scanning being too limited (and so not considering `const` or `constexpr`, or other qualifiers, on an anonymous struct variable declaration).
Moreover, the proposed solution is more efficient as we parse tokens once only (scanning being parsing too).
Reviewed By: MyDeveloperDay, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D119785
Florian Mayer [Wed, 16 Feb 2022 21:34:02 +0000 (13:34 -0800)]
[NFC] Fix order in global_symbols.txt.
I added posix_madvise out of order before.
Louis Dionne [Thu, 3 Feb 2022 15:57:49 +0000 (10:57 -0500)]
[libc++] Refactor the Apple build scripts
This patch upstreams some changes we've made internally to how we're
building the libc++ dylib on Apple platforms. The goal is still to
eventually get rid of `apple-install-libcxx.sh` entirely and have a
proper way to mirror what we do internally with just the normal CMake
configuration.
Differential Revision: https://reviews.llvm.org/D118912
Louis Dionne [Wed, 16 Feb 2022 15:44:39 +0000 (10:44 -0500)]
[libc++abi] Bump the libc++abi version and add it to the post-release list
Differential Revision: https://reviews.llvm.org/D119947
Roman Lebedev [Wed, 16 Feb 2022 20:39:26 +0000 (23:39 +0300)]
[NFC][PhaseOrdering] spurious-peeling.ll: also test -O1/-O2 results
William S. Moses [Wed, 16 Feb 2022 20:29:42 +0000 (23:29 +0300)]
[NFC][PhaseOrdering] Precommit tests from D119965
Aaron Ballman [Wed, 16 Feb 2022 21:09:36 +0000 (16:09 -0500)]
Use functions with prototypes when appropriate; NFC
A significant number of our tests in C accidentally use functions
without prototypes. This patch converts the function signatures to have
a prototype for the situations where the test is not specific to K&R C
declarations. e.g.,
void func();
becomes
void func(void);
This is the twelfth batch of tests being updated (the end may be in
sight soon though).
Marek Kurdej [Wed, 16 Feb 2022 21:06:04 +0000 (22:06 +0100)]
[clang-format] Fall through and avoid an unnecessary check. NFC.
Florian Mayer [Wed, 16 Feb 2022 21:04:37 +0000 (13:04 -0800)]
Fix build_symbolizer.sh.
We now use posix_madvise, so we need to allow this symbol.
Differential Revision: https://reviews.llvm.org/D119970
Johannes Doerfert [Mon, 14 Feb 2022 23:19:33 +0000 (17:19 -0600)]
[OpenMP][FIX] Eliminate race on the IsSPMD global
The `IsSPMD` global can only be read by threads other than the main
thread *after* initialization is complete. To allow usage of
`mapping::getBlockSize` before initialization is done, we can pass the
`IsSPMD` state explicitly. This is similar to other APIs that take
`IsSPMD` explicitly to avoid such a race, e.g.,
`mapping::isInitialThreadInLevel0(IsSPMD)`
Fixes https://github.com/llvm/llvm-project/issues/53857
Johannes Doerfert [Wed, 16 Feb 2022 17:05:09 +0000 (11:05 -0600)]
[Attributor][FIX] Pipe UsedAssumedInformation through more interfaces
`UsedAssumedInformation` is a return argument utilized to determine what
information is known. Most APIs used it already but
`genericValueTraversal` did not. This adds it to `genericValueTraversal`
and replaces `AllCallSitesKnown` of `checkForAllCallSites` with the
commonly used `UsedAssumedInformation`.
This was supposed to be a NFC commit, then the test change appeared.
Turns out, we had one user of `AllCallSitesKnown` (AANoReturn) and the
way we set `AllCallSitesKnown` was wrong as we ignored the fact some
call sites were optimistically assumed dead. Included a dedicated test
for this as well now.
Fixes https://github.com/llvm/llvm-project/issues/53884
Jessica Paquette [Wed, 16 Feb 2022 19:59:57 +0000 (11:59 -0800)]
[MachineOutliner] NFC: Update LRU stuff for RISCV
I missed it in my grep. Fixes broken buildbot.`
Shafik Yaghmour [Wed, 16 Feb 2022 19:51:50 +0000 (11:51 -0800)]
[LLDB] Replace use of double underscore in identifiers
Identifiers with __ anywhere are reserved. I picked this up via the
bugprone-reserved-identifier clang-tidy check but -Wreserved-identifier will
also flag these uses as well.
Differential Revision: https://reviews.llvm.org/D119915
Med Ismail Bennani [Wed, 16 Feb 2022 19:43:53 +0000 (11:43 -0800)]
[lldb/crashlog] Fix exception signal parsing
In some cases, it can happen that crashlogs don't have any signal in
the exception, which causes the parser to crash.
This fixes the parsing by checking if the `signal` field is in the
`exception` dictionary before trying to access it.
rdar://
84552251
Differential Revision: https://reviews.llvm.org/D119504
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Wed, 16 Feb 2022 19:43:44 +0000 (11:43 -0800)]
[lldb/crashlog] Add CrashLogScriptedProcess & remove interactive mode
This patch introduces a new type of ScriptedProcess: CrashLogScriptedProcess.
It takes advantage of lldb's crashlog parsers and Scripted Processes to
reconstruct a static debugging session with symbolicated stackframes, instead
of just dumping out everything in the user's terminal.
The crashlog command also has an interactive mode that only provide a
very limited experience. This is why this patch removes all the logic
for this interactive mode and creates CrashLogScriptedProcess instead.
This will fetch and load all the libraries that were used by the crashed
thread and re-create all the frames artificially.
rdar://
88721117
Differential Revision: https://reviews.llvm.org/D119501
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Fri, 11 Feb 2022 00:12:59 +0000 (16:12 -0800)]
[lldb/API] Add a way to check if the CommandInterpreter is interactive
This patch adds the ability for the user to check if the command
interpreter's IOHandler is interactive.
Differential Revision: https://reviews.llvm.org/D119499
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Thu, 10 Feb 2022 03:04:21 +0000 (19:04 -0800)]
[lldb/Plugin] Add artificial stackframe loading in ScriptedThread
This patch adds the ability for ScriptedThread to load artificial stack
frames. To do so, the interpreter instance can create a list that will
contain the frame index and its pc address.
Then, when the Scripted Process plugin stops, it will refresh its
Scripted Threads state by invalidating their register context and load
to list from the interpreter object and reconstruct each frame.
This patch also removes all of the default implementation for
`get_stackframes` from the derived ScriptedThread classes, and add the
interface code for the Scripted Thread Interface.
rdar://
88721095
Differential Revision: https://reviews.llvm.org/D119388
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Thu, 10 Feb 2022 00:24:39 +0000 (16:24 -0800)]
[lldb/Plugins] Clean-up ScriptedProcess python script (NFC)
This patch removes the `my_scripted_process.py` blueprint since it's not
used anymore.
The patch also updates the base ScriptedProcess and ScriptedThread
initializers to automatically initialize convinience variables, to
access debugger from the ScriptedProcess, access the SBProcess and
ScriptedProcess object from a ScriptedThread instance.
Differential Revision: https://reviews.llvm.org/D119386
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Jessica Paquette [Wed, 16 Feb 2022 19:28:14 +0000 (11:28 -0800)]
[MachineOutliner] NFC: Hide LRU-related stuff behind helper functions
It's not particularly user-friendly to have to call `initLRU` everywhere. Also,
it wasn't particularly great that the LRU for registers used in a sequence was
also initialized by `initLRU`.
This patch hides this stuff behind some helper functions:
* `isAvailableAcrossAndOutOfSeq`
* `isAnyUnavailableAcrossOrOutOfSeq`
* `isAvailableInsideSeq`
This allows the user to avoid calling `initLRU` explicitly. Also, it allows
us to separate initializing the used-in-sequence LRU from the main LRU.
Since both ARM and AArch64 check LR liveness in `insertOutlinedCall`, this
refactor requires that we de-const the Candidate there.
Some other quality-of-code improvements:
* LRUs in outliner::Candidate now have more descriptive names
* Use `Register` instead of `unsigned` in some places
* Improve readability in some places by using ranges rather than `std::for_each`
This is a preparatory commit for a larger compile time related change for the
AArch64 outliner.
David Blaikie [Wed, 16 Feb 2022 19:18:31 +0000 (11:18 -0800)]
DebugInfo: fix a couple of spurious spaces in simplified template name rebuilding
Valentin Clement [Wed, 16 Feb 2022 19:27:23 +0000 (20:27 +0100)]
[flang] Handle lowering arguments in subroutine and function
This patch adds infrsatrcutrue to be able to lower
arguments in functions and subroutines.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D119957
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Roman Lebedev [Wed, 16 Feb 2022 18:57:04 +0000 (21:57 +0300)]
[NFC][SCEV] Recognize umin_seq when operand is zext'ed in zero-check
zext(umin(x,y)) == umin(zext(x),zext(y))
zext(x) == 0 -> x == 0
While it is not a very likely scenario, we probably should not expect
that instcombine already dropped such a redundant zext,
but handle directly. Moreover, perhaps there was no ZExtInst,
and SCEV somehow managed to pull out said zext out of the SCEV expression.
Roman Lebedev [Wed, 16 Feb 2022 18:46:39 +0000 (21:46 +0300)]
[NFC][SCEV] Recognize umin_seq when operand is zext'ed in umin but not in zero-check
zext(umin(x,y)) == umin(zext(x),zext(y))
zext(x) == 0 -> x == 0
Extra leading zeros do not affect the result of comparison with zero,
nor do they matter for the unsigned min/max,
so we should not be dissuaded when we find a zero-extensions,
but instead we should just skip it.
Roman Lebedev [Wed, 16 Feb 2022 18:31:40 +0000 (21:31 +0300)]
[NFC][SCEV] Add tests for umin_seq recognition with interfering zext's
Jacob Lambert [Wed, 16 Feb 2022 03:07:20 +0000 (19:07 -0800)]
Hoist getTotalNumVGPRs into AMDGPUBaseInfo for use in both codegen and MC
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D119912
Florian Mayer [Wed, 16 Feb 2022 00:10:00 +0000 (16:10 -0800)]
[HWASan] Improve dbg-value-tag-offset test.
Reviewed By: hctim
Differential Revision: https://reviews.llvm.org/D119961
Michael Kruse [Wed, 16 Feb 2022 17:56:25 +0000 (11:56 -0600)]
[polly] Match function definitions and header declarations. NFC.
Ensure that function definitions match their declrations in header
files, even if they have no effect on linking. This includes
1. Both have the same __isl_* annotations
2. Both use the same type alias
3. Remove unused declarations that have no definition
4. Use explicit polly namespace qualifier for definitions; generally,
the .cpp file should use at most an anon namespace region since
only symbols declared in the header file can be accessed from other
translation units anyway. For defintions that have been declared in
the header file, the explicit namespace qualifier ensures that both
match.
Lei Zhang [Wed, 16 Feb 2022 16:26:47 +0000 (11:26 -0500)]
[mlir][tensor] Add a pattern to split tensor.pad ops
This commit adds a pattern to wrap a tensor.pad op with
an scf.if op to separate the cases where we don't need padding
(all pad sizes are actually zeros) and where we indeed need
padding.
This pattern is meant to handle padding inside tiled loops.
Under such cases the padding sizes typically depend on the
loop induction variables. Splitting them would allow treating
perfect tiles and edge tiles separately.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D117018
Jonas Devlieghere [Wed, 16 Feb 2022 18:16:24 +0000 (10:16 -0800)]
[lldb] BreakpointResolver::CreateFromStructuredData Gardening (NFC)
- Use an early return.
- Check for error.Fail() instead of !error.Success().
- Check the resolver pointer before using instead of relying on the
error being set.
Jonas Devlieghere [Wed, 16 Feb 2022 18:01:04 +0000 (10:01 -0800)]
[lldb] Default initialize DWARFDebugMacroHeader
Default initialize the DWARFDebugMacroHeader to avoid returning a header
with uninitialized variables from DWARFDebugMacroHeader::ParseHeader.
Michał Górny [Tue, 15 Feb 2022 20:21:12 +0000 (21:21 +0100)]
[llvm] [bindings/OCaml] Remove unused dep on ounit2
Remove the dependency on ounit2 and the relevant lit code. It seems
that ounit2 is not used at all and all OCaml binding tests pass without
it installed.
Thanks for Shiwei Weng and Josh Berdine for bringing this to
my attention.
Differential Revision: https://reviews.llvm.org/D119884
Michał Górny [Fri, 11 Feb 2022 11:48:31 +0000 (12:48 +0100)]
[libcxxabi] [test] Depend on unwind only if available
When building libcxxabi via LLVM_ENABLE_RUNTIMES=libcxxabi the CMake
invocation fails because of missing "unwind" target. However,
if the extraneous dependency is removed, the library builds just fine
against installed libunwind and tests work fine. To fix this,
add the dependency only if the target actually exists.
Differential Revision: https://reviews.llvm.org/D119538
Arthur Eubanks [Wed, 16 Feb 2022 17:32:45 +0000 (09:32 -0800)]
[test] Mark archive-as-start-lib.s as unsupported on Windows
gnuwin32 tail does not support the `tail -c +9` syntax.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D119956
Kevin P. Neal [Wed, 16 Feb 2022 18:10:14 +0000 (13:10 -0500)]
Add an include that is required on some hosts. This should fix the bot
failures.
Haowei Wu [Mon, 14 Feb 2022 18:42:18 +0000 (10:42 -0800)]
[ifs] Add the invalid STRSZ test to llvm-ifs
This patch adds an addition test to test llvm-ifs's behavior when
DT_STRSZ value from .dynamic is invalid
Differential Revision: https://reviews.llvm.org/D119741
Nico Weber [Wed, 16 Feb 2022 17:56:02 +0000 (12:56 -0500)]
[gn build] (semi-manually) port
f87aa19be644
Louis Dionne [Mon, 14 Feb 2022 18:41:09 +0000 (13:41 -0500)]
[libc++] Move everything related solely to _LIBCPP_ASSERT to its own file
This is the first step towards disentangling the debug mode and assertions
in libc++. This patch doesn't make any functional change: it simply moves
_LIBCPP_ASSERT-related stuff to its own file so as to make it clear that
libc++ assertions and the debug mode are different things. Future patches
will make it possible to enable assertions without enabling the debug
mode.
Differential Revision: https://reviews.llvm.org/D119769
Fangrui Song [Wed, 16 Feb 2022 17:40:55 +0000 (09:40 -0800)]
[ELF][test] Add --undefine-glob test to lto/duplicated.ll
Kevin P. Neal [Mon, 14 Feb 2022 16:49:43 +0000 (11:49 -0500)]
[FPEnv][FMF] Move helper function to header, move fast math flags to new include file.
In a prior review I was asked to move the helper function canIgnoreSNaN()
out to FPEnv.h. This wasn't possible at the time because that function
needs the fast math flags, and including them includes lots of other stuff
that isn't needed.
This patch moves the fast math flags out into a new FMF.h file unchanged,
and moves the helper function out to FPEnv.h also unchanged. This ticket
only moves code around.
Differential Revision: https://reviews.llvm.org/D119752
Rashmi Mudduluru [Mon, 14 Feb 2022 19:09:43 +0000 (11:09 -0800)]
Reverting
ce420820c815e806bab9c5f17cb3b829a616548a because it fails expensive checks
Craig Topper [Wed, 16 Feb 2022 17:13:32 +0000 (09:13 -0800)]
[RISCV] Improve lowering of SHL_PARTS/SRL_PARTS/SRA_PARTS.
Part of the shift lowering creates a (sub XLEN-1, ShAmt). When this
value is used we know that ShAmt is [0..XLEN-1]. Since XLEN is a power
of 2 we can replace the sub with an xor. This allows us to use XORI
instead of LI+SUB.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D119411
Craig Topper [Wed, 16 Feb 2022 17:13:01 +0000 (09:13 -0800)]
[SelectionDAG] Add SPLAT_VECTOR to SelectionDAG::isConstantFPBuildVectorOrConstantFP.
Matches what is done for the int version.
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D119793
Sanjay Patel [Wed, 16 Feb 2022 17:02:03 +0000 (12:02 -0500)]
[InstCombine] add tests for min/max reassociation; NFC
D119851
Christopher Di Bella [Tue, 17 Aug 2021 20:23:22 +0000 (20:23 +0000)]
[llvm-libgcc] initial commit
Note: the term "libgcc" refers to the all of `libgcc.a`, `libgcc_eh.a`,
and `libgcc_s.so`.
Enabling libunwind as a replacement for libgcc on Linux has proven to be
challenging since libgcc_s.so is a required dependency in the [Linux
standard base][5]. Some software is transitively dependent on libgcc
because glibc makes hardcoded calls to functions in libgcc_s. For example,
the function `__GI___backtrace` eventually makes its way to a [hardcoded
dlopen to libgcc_s' _Unwind_Backtrace][1]. Since libgcc_{eh.a,s.so} and
libunwind have the same ABI, but different implementations, the two
libraries end up [cross-talking, which ultimately results in a
segfault][2].
To solve this problem, libunwind needs to build a “libgcc”. That is, link
the necessary functions from compiler-rt and libunwind into an archive
and shared object that advertise themselves as `libgcc.a`, `libgcc_eh.a`,
and `libgcc_s.so`, so that glibc’s baked calls are diverted to the
correct objects in memory. Fortunately for us, compiler-rt and libunwind
use the same ABI as the libgcc family, so the problem is solvable at the
llvm-project configuration level: no program source needs to be edited.
Thus, the end result is for a user to configure their LLVM build with a
flag that indicates they want to archive compiler-rt/unwind as libgcc.
We achieve this by compiling libunwind with all the symbols necessary
for compiler-rt to emulate the libgcc family, and then generate symlinks
named for our "libgcc" that point to their corresponding libunwind
counterparts.
We alternatively considered patching glibc so that the source doesn't
directly refer to libgcc, but rather _defaults_ to libgcc, so that a
system preferring compiler-rt/libunwind can point to these libraries
at the config stage instead. Even if we modified the Linux standard
base, this alternative won't work because binaries that are built using
libgcc will still end up having crosstalk between the differing
implementations.
This problem has been solved in this manner for [FreeBSD][3], and this
CL has been tested against [Chrome OS][4].
[1]: https://github.com/bminor/glibc/blob/master/sysdeps/arm/backtrace.c#L68
[2]: https://bugs.chromium.org/p/chromium/issues/detail?id=1162190#c16
[3]: https://github.com/freebsd/freebsd-src/tree/main/lib/libgcc_s
[4]: https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/2945947
[5]: https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/libgcc-s.html
Differential Revision: https://reviews.llvm.org/D108416
Jonas Devlieghere [Wed, 16 Feb 2022 16:58:38 +0000 (08:58 -0800)]
[lldb] Fix memory leak in CommandObjectType
Avoid leaking the ScriptAddOptions or SynthAddOptions when we return
early because of an empty type name.
Louis Dionne [Wed, 16 Feb 2022 16:59:32 +0000 (11:59 -0500)]
[runtimes] Move warning messages for FOO_SYSROOT & friends above their default value
Otherwise, the warnings always trigger.
Jameson Nash [Fri, 11 Feb 2022 21:42:37 +0000 (16:42 -0500)]
clang-analyzer plugins require LLVM_ENABLE_PLUGINS also
The clang-analyzer plugins are not linked to a particular tool, so they
can only be compiled if plugins are broadly supported. We could opt
instead to decide whether to link them to specifically against clang or
with undefined symbols, depending on the value of LLVM_ENABLE_PLUGINS,
but we do not currently expect there to be a use case for that rather
niche configuration.
Differential Revision: https://reviews.llvm.org/D119591