Jonas Devlieghere [Thu, 30 Mar 2023 20:54:18 +0000 (13:54 -0700)]
[lldb] Fix macos build after
e64cc756819d
Shafik Yaghmour [Thu, 30 Mar 2023 20:35:10 +0000 (13:35 -0700)]
[Clang] Fix how ReadMacroParameterList handles comments in macro parameter-list when in -CC mode
Currently when in -CC mode when processing a function like macro
ReadMacroParameterList(...) does not handle the case where there is a comment
embedded in the parameter-list.
Instead of using LexUnexpandedToken(...) I switched to using
LexUnexpandedNonComment(...) which eats comments while lexing.
Fixes: https://github.com/llvm/llvm-project/issues/60887
Differential Revision: https://reviews.llvm.org/D144511
River Riddle [Thu, 30 Mar 2023 04:21:22 +0000 (21:21 -0700)]
[lldb][NFC] Move various constructor definitions from .h to .cpp
I ran into issues with linking downstream language plugin to liblldb in
debug builds, hitting link time errors of form:
```
undefined reference to `vtable for lldb_private::<Insert LLDB class here>'
```
Anchoring the vtable to the .cpp files resolved those issues.
Differential Revision: https://reviews.llvm.org/D147252
Alex Bradbury [Thu, 30 Mar 2023 20:04:37 +0000 (21:04 +0100)]
[RISCV] Add codegen for the experimental zicond extension
This directly matches the codegen for xventanacondops with vt.maskcn =>
czero.nez and vt.maskc => czero.eqz. An additional difference is that
zicond is available on RV32 in addition to RV64 (xventanacondops is RV64
only).
Differential Revision: https://reviews.llvm.org/D147147
Leonard Chan [Thu, 30 Mar 2023 19:55:05 +0000 (19:55 +0000)]
"Reland "[hwasan] Provide aliases for c allocation functions for Fuchsia"
This reverts commit
c5c6781428a70d1fffd00a256a237cbf5a3ccfd3.
This likely broke the android sanitizer builders prior because it
accidentally enabled interceptors for android, which they don't use, so
c-allocation functions like malloc would go through hwasan.
This reland adds the HWASAN_WITH_INTERCEPTORS check.
Alex Bradbury [Thu, 30 Mar 2023 19:47:28 +0000 (20:47 +0100)]
[RISCV] Slightly weaken expanded seq_cst atomic op to match reference mapping in in the spec
Table A.6 in the RISC-V ISA Manual indicates that sequentially
consistent atomic ops that have a matching instruction should be mapped
to `amo<op>.{w|d}.aqrl`. But sequentially consistent operations that are
mapped to lr/sc should produce `loop: lr.{w|d}.aqrl; <op>; sc.{w|d}.rl;
bnez loop`. Previously, LLVM produced an `sc.{w|d}.aqrl` which was
stronger than necessary. This patch adjusts the relevant logic so that a
`sc.{w|d}.rl` is produced.
Differential Revision: https://reviews.llvm.org/D146933
Dave Lee [Sat, 24 Sep 2022 22:58:03 +0000 (15:58 -0700)]
[lldb] Replace sprintf with snprintf (NFC)
On macOS, `sprintf` is deprecated, using `snprintf` is recommended instead.
Differential Revision: https://reviews.llvm.org/D147246
Louis Dionne [Thu, 30 Mar 2023 12:51:13 +0000 (08:51 -0400)]
[libc++] Systematically define a macro to check whether a feature is unavailable
Previously, we inconsistently defined whether a feature was unavailable
on a given deployment target. We would have availability attributes for
all features, but only some features had the equivalent of a _HAS_NO_FOO
macro in the form of the DISABLE_FTM___foo macros. Instead, systematically
define a _HAS_NO_FOO macro, which makes it easier to understand how to
add availability markup for a new platform.
Differential Revision: https://reviews.llvm.org/D147226
Florian Hahn [Thu, 30 Mar 2023 19:17:12 +0000 (20:17 +0100)]
[LV] Regenerate check lines for test to reduce diff in follow-up patch.
Jisheng Zhao [Tue, 28 Mar 2023 14:32:11 +0000 (10:32 -0400)]
[OpenMP] asynchronous memory copy support
We introduced the implementation of supporting asynchronous routines with depend objects specified in Version 5.1 of the OpenMP Application Programming Interface. In brief, these routines omp_target_memcpy_async and omp_target_memcpy_rect_async perform asynchronous (nonblocking) memory copies between any
combination of host and device pointers. The basic idea is to create the implicit tasks to carry the memory copy calls and handle dependencies specified by depend objects. The implicit tasks are executed via hidden helper thread in OpenMP runtime.
Reviewed By: jdoerfert, tianshilei1992
Committed By: jplehr
Differential Revision: https://reviews.llvm.org/D136103
wren romano [Thu, 30 Mar 2023 01:36:24 +0000 (18:36 -0700)]
[mlir][sparse] Cleaning up some usage of SparseTensorType
This is a followup to D147192.
Reviewed By: aartbik, Peiming
Differential Revision: https://reviews.llvm.org/D147196
Philip Reames [Thu, 30 Mar 2023 16:01:40 +0000 (09:01 -0700)]
[IVDescriptors] Add pointer InductionDescriptors with non-constant strides
This matches the handling for integer IVs. I left the non-opaque cases alone, mostly because they're largely irrelevant today.
This doesn't actually make much difference in vectorization right now as we immediately fail on aliasing checks (which also bail on non-constant strides). Slightly suprisingly, it's the case which *do* need runtime checks which work after this patch as they don't use the same dependency analysis path.
This will also enable non-constant stride pointer recurrences for other consumers. I've auditted said code, and don't see any obvious issues.
duk [Thu, 30 Mar 2023 18:43:12 +0000 (14:43 -0400)]
[MachineOutliner] Fix label outlining regression introduced in D125072
Due to a change in the APIs used to determine what instructions can be outlined, the check for label outling was never hit. Instead, all labels were considered invisible, which is the opposite of the intended behavior and causes obscure crashes down the line. We now replicate the original behavior more closely, with explicit checks for known-good and known-bad instruction types.
Reviewed by: paquette
Differential Revision: https://reviews.llvm.org/D147178
NagaChaitanya Vellanki [Thu, 30 Mar 2023 17:51:06 +0000 (10:51 -0700)]
[clang][ExtractAPI] Remove extra pointer indirection from declaration fragments for Obj-C lightweight generics on id
Fixes https://github.com/llvm/llvm-project/issues/61479
Reviewed By: dang
Differential Revision: https://reviews.llvm.org/D146866
Jez Ng [Thu, 30 Mar 2023 18:16:16 +0000 (14:16 -0400)]
[lld-macho] Don't emit spurious dupe method warnings for +load methods
+load methods are static initializers and treated specially by the
runtime: all +load methods for a class & its categories are called when
loading that class, unlike regular methods where only one definition
will get called per message. Thus, there is no need to check for
duplicates.
Reviewed By: #lld-macho, oontvoo
Differential Revision: https://reviews.llvm.org/D147230
Jez Ng [Thu, 30 Mar 2023 18:16:12 +0000 (14:16 -0400)]
[lld-macho][objc] Don't crash when rodata isn't statically linked
We were previously assuming that to hold, but it appears that `swiftc`
may generate classes that link against `__objc_empty_cache` for their
rodata pointer.
This should allow us to re-land {D142916} (as a stack).
Reviewed By: #lld-macho, oontvoo
Differential Revision: https://reviews.llvm.org/D147229
Jez Ng [Thu, 16 Feb 2023 21:18:46 +0000 (16:18 -0500)]
[lld-macho][re-land] Warn on method name collisions from category definitions
This implements ld64's checks for duplicate method names in categories &
classes.
In addition, this sets us up for implementing Obj-C category merging.
This diff handles the most of the parsing work; what's left is rewriting
those category / class structures.
Numbers for chromium_framework:
base diff difference (95% CI)
sys_time 2.182 ± 0.027 2.200 ± 0.047 [ -0.2% .. +1.8%]
user_time 6.451 ± 0.034 6.479 ± 0.062 [ -0.0% .. +0.9%]
wall_time 6.841 ± 0.048 6.885 ± 0.105 [ -0.1% .. +1.4%]
samples 33 22
Fixes https://github.com/llvm/llvm-project/issues/54912.
Issues seen with the previous land will be fixed in the next commit.
Reviewed By: #lld-macho, thevinster, oontvoo
Differential Revision: https://reviews.llvm.org/D142916
SJW [Thu, 30 Mar 2023 18:08:47 +0000 (18:08 +0000)]
[TOSA] Loosen folding restrictions for tosa.add,tosa.sub, tosa.mul
Allow folding of different tensor types when the constant tensor is broadcast.
Removed redundant and incorrect AddZero and MulOne canonical optimizations.
Reviewed By: rsuderman, eric-k256
Differential Revision: https://reviews.llvm.org/D145738
wlei [Thu, 30 Mar 2023 18:21:30 +0000 (11:21 -0700)]
fix docs warning in llvm-profdata.rst
Dave Lee [Sat, 24 Sep 2022 23:06:01 +0000 (16:06 -0700)]
[lldb] Replace deprecated CFPropertyListWriteToStream (NFC)
Replace `CFPropertyListWriteToStream` with its recommended replacement, `CFPropertyListWrite`.
Differential Revision: https://reviews.llvm.org/D147249
Jay Foad [Wed, 29 Mar 2023 16:13:52 +0000 (17:13 +0100)]
[TwoAddressInstruction] Improve tests for register killed by instruction
Define and use a MachineOperand overload of isPlainlyKilled. This
improves codegen in a couple of tests because it catches the case where
MO does not kill Reg but another operand of the same instruction does.
Differential Revision: https://reviews.llvm.org/D147167
Matthias Braun [Thu, 23 Mar 2023 20:38:16 +0000 (13:38 -0700)]
Fix codegen for coroutine with function-try-block
This fixes an assertion error when writing a coroutine with a
function-try-block. In this case the function body is not a
`CompoundStmt` so the code constructing an artificial CXXTryStmt must
also construct a `CompoundStmt` for it.
While on it adjust the `CXXStmt::Create` function to only accept
`CompoundStmt*`.
Differential Revision: https://reviews.llvm.org/D146758
Piotr Zegar [Thu, 30 Mar 2023 18:14:42 +0000 (18:14 +0000)]
[clang-tidy] Fix example provided by add_new_check.py
Currently test for newly added check in clang-tidy fails,
this is because Fix is attached to note, but test is executed
without --fix-notes. This change adding --fix-notes to test.
Fixes: https://github.com/llvm/llvm-project/issues/50400
Reviewed By: carlosgalvezp
Differential Revision: https://reviews.llvm.org/D146875
Changpeng Fang [Thu, 30 Mar 2023 18:13:21 +0000 (11:13 -0700)]
AMDGPU: Created a subclass for the return address operand in the tail call return instruction
Summary:
This is to avoid using the callee saved registers for the return address of the tail call return instruction.
Reviewers:
arsenm, cdevadas
Differential Revision:
https://reviews.llvm.org/D147096
Natasha Kononenko [Thu, 30 Mar 2023 17:57:55 +0000 (17:57 +0000)]
[mlir][tosa] Disable folder for non-int/float/index types in tosa.slice
In order to fold, we need to create an ElementsAttr, and those cannot be
generated from any type. In particular, currently we need to avoid folding
quantized types.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D147191
wlei [Mon, 20 Mar 2023 05:37:01 +0000 (22:37 -0700)]
[AutoFDO] Use flattened profiles for profile staleness metrics
For profile staleness report, before it only counts for the top-level function samples in the nested profile, the samples in the inlinees are ignored. This could affect the quality of the metrics when there are heavily inlined functions. This change adds a feature to flatten the nested profile and we're changing to use flatten profile as the input for stale profile detection and matching.
Example for profile flattening:
```
Original profile:
_Z3bazi:20301:1000
1: 1000
3: 2000
5: inline1:1600
1: 600
3: inline2:500
1: 500
Flattened profile:
_Z3bazi:18701:1000
1: 1000
3: 2000
5: 600 inline1:600
inline1:1100:600
1: 600
3: 500 inline2: 500
inline2:500:500
1: 500
```
This feature could be useful for offline analysis, like understanding the hotness of each individual function. So I'm adding the support to `llvm-profdata merge` under `--gen-flattened-profile`.
Reviewed By: hoy, wenlei
Differential Revision: https://reviews.llvm.org/D146452
Alex Brachet [Thu, 30 Mar 2023 18:00:50 +0000 (18:00 +0000)]
[CMake] Switch to -fPIE for Fuchsia Toolchain
This is a reland of D135471, save for dropping libLTO which was
already done in a separate change.
Differential Revision: https://reviews.llvm.org/D147250
Daniel Thornburgh [Thu, 30 Mar 2023 17:40:34 +0000 (10:40 -0700)]
[Docs][llvm-cov] Correct flag name.
LLVM GN Syncbot [Thu, 30 Mar 2023 17:24:21 +0000 (17:24 +0000)]
[gn build] Port
142c3d9d1414
Chenguang Wang [Thu, 30 Mar 2023 17:10:57 +0000 (10:10 -0700)]
[mlir][bazel] reformat BUILD.bazel with buildifier
Reviewed By: jreiffers
Differential Revision: https://reviews.llvm.org/D147244
Jakub Kuderski [Thu, 30 Mar 2023 17:14:36 +0000 (13:14 -0400)]
[docs] Add section on iteration utilities (`zip` & `enumerate`)
Since these are not in C++17, mention them in the programmers manual.
Reviewed By: kazu
Differential Revision: https://reviews.llvm.org/D147199
Daniel Grumberg [Thu, 30 Mar 2023 13:51:45 +0000 (14:51 +0100)]
[clang][ExtractAPI] Reland ExtractAPI for libclang improvements
This relands the changes that were originally introduced by:
- https://reviews.llvm.org/D146656
- https://reviews.llvm.org/D147138
This also fixes the leak that led to these changes being reverted
Differential Revision: https://reviews.llvm.org/D147234
Wei Wang [Tue, 21 Mar 2023 05:36:47 +0000 (22:36 -0700)]
[Coroutines] Look for dbg.declare for temp spills
A temp spill may not have direct dbg.declare attached. This can cause problem for debugger when it wants to print the value in resume/destroy/cleanup functions.
In particular, we found this happening to "this" pointer that a temp is used to store its value in entry block and spilled later.
Reviewed By: ChuanqiXu
Differential Revision: https://reviews.llvm.org/D146543
Louis Dionne [Thu, 30 Mar 2023 17:09:16 +0000 (13:09 -0400)]
[libc++][NFC] Remove stray tests
Those tests are remnants of patches that were created before we renamed
the FTM tests but merged after we renamed them.
Philip Reames [Thu, 30 Mar 2023 16:21:51 +0000 (09:21 -0700)]
[RISCV][LV] Add test coverage for strided access patterns [nfc]
Joseph Huber [Thu, 30 Mar 2023 14:50:56 +0000 (09:50 -0500)]
[libc] Support suspending threads during RPC spin loops
The RPC interface relies on waiting on atomic signals to coordinate
which side of the protocol is in control of the shared buffer. The GPU client
supports briefly suspending the executing thread group. This is used by the
thread scheduler to identify which thread groups can be switched out so that
others may execute. This allows us to ensure that other threads get a chance
to make forward progress while these threads wait on the atomic signal.
This is currently only relevant on the client-side. We could use an
alternative implementation on the server that uses the standard
`nanosleep` on supported hosts.
Reviewed By: JonChesterfield, tianshilei1992
Differential Revision: https://reviews.llvm.org/D147238
Alexey Bataev [Thu, 30 Mar 2023 14:36:12 +0000 (07:36 -0700)]
[SLP]Fix a crash when trying to shuffle multiple nodes.
Need to transform mask after applying shuffle using the mask itself as
a base to correctly mark with identity those indices, actually used in
previous shuffle. Allows to fix a crash, if different sized vectors are
shuffled.
Mateja Marjanovic [Thu, 30 Mar 2023 15:06:37 +0000 (17:06 +0200)]
[AMDGPU][GlobalISel] Add support for S_INDIRECT_REG_WRITE_MOVREL_B32_V[9|10|11|12]
Lei Zhang [Thu, 30 Mar 2023 15:49:57 +0000 (08:49 -0700)]
[mlir][spirv][complex] Convert complex ops to SPIR-V ops
This commit adds conversion from complex construction and
extraction ops to SPIR-V. Other arithemtic ops can be done
via ComplexToStandard patterns.
Reviewed By: kuhar
Differential Revision: https://reviews.llvm.org/D147193
Lei Zhang [Thu, 30 Mar 2023 15:48:24 +0000 (08:48 -0700)]
[mlir][spirv] Support convert complex types
Complex types are converted to a two-element vector type to contain
the real and imaginary numbers.
Reviewed By: kuhar
Differential Revision: https://reviews.llvm.org/D147188
David Green [Thu, 30 Mar 2023 15:46:47 +0000 (16:46 +0100)]
[AArch64] Basic target(+crypto) handling
This adds some basic handling for target(+crypto) attributes. In this patch it
just enabled aes and sha2 regardless of the architecture revision, which
matches gccs implementation (and keeps the patch simple).
Differential Revision: https://reviews.llvm.org/D142135
Benjamin Maxwell [Thu, 30 Mar 2023 14:45:54 +0000 (14:45 +0000)]
[DebugInfo] Correct out-of-bounds error message for DW_FORM_line_strp
DW_FORM_line_strp reads from the .debug_line_str section, but
previously the out-of-bounds error reported the .debug_line section.
This incorrect error message showed up when debugging an issue with
some invalid DWARF5 data.
The verify_string.s test has now been extended to check this (which
required a small change to the DWARF verifier to also look at
DW_FORM_line_strp).
Differential Revision: https://reviews.llvm.org/D146539
Ayushi Shukla [Thu, 30 Mar 2023 14:55:49 +0000 (15:55 +0100)]
[documentation] Fix some typos
This patch fixes https://github.com/llvm/llvm-project/issues/56747
Patch-By: ayushi-8102
Differential Revision: https://reviews.llvm.org/D146892
Louis Dionne [Wed, 29 Mar 2023 21:01:18 +0000 (17:01 -0400)]
[libc++] Add minor test for polymorphic_allocator.construct with mixed argument pair
Re-applying the patch after fixing an issue.
Ivan Kosarev [Thu, 30 Mar 2023 14:31:57 +0000 (15:31 +0100)]
[AMDGPU][MC] v_interp tests to check reported operands.
For these tests we want to make sure the reported operands are the
expected ones.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D147228
Corentin Jabot [Thu, 23 Mar 2023 13:26:45 +0000 (14:26 +0100)]
[Clang] Improve diagnostics when using a concept as template argument
When using the name of a template variable or concept in places
where an expression was expected, Clang would drop the cxxscope token
preceeding it, if any.
This leads to subpar diagnostics - complaining about the
identifier being undeclared as clang would not know to look into a
non-global scope.
We make sure the scope is preserved.
When encountering `ns::Concept foo x;`, Clang would also fail
to provide the same quality as it does at global scope.
Reviewed By: aaron.ballman, erichkeane
Differential Revision: https://reviews.llvm.org/D146719
Ivan Kosarev [Thu, 30 Mar 2023 14:17:18 +0000 (15:17 +0100)]
[AMDGPU][AsmParser] Refine SMRD offset definitions.
- Fixes the type of default 8-bit offset operands.
- Adds a test for optional offsets.
This is effectively an NFC.
Reviewed By: dp
Differential Revision: https://reviews.llvm.org/D142231
Serge Pavlov [Thu, 30 Mar 2023 14:27:38 +0000 (21:27 +0700)]
[symbolizer] Build 'Request' object in single point. NFC
All control paths in executeCommand create Request object for use in
calls to 'print' function and do it identically. With this change the
Request object is created in a single point, which simplifies changing
implementation of Request class.
This is a prerequisite patch for implementation of symbol+offset lookup.
Differential Revision: https://reviews.llvm.org/D147115
Rahul Kayaith [Wed, 29 Mar 2023 22:49:08 +0000 (18:49 -0400)]
[mlir][python] Support buffer protocol for splat dense attributes
These can be made to work by setting the buffer strides to 0.
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D147187
Ivan Kosarev [Thu, 30 Mar 2023 14:11:28 +0000 (15:11 +0100)]
[AMDGPU][AsmParser][NFC] Refine immediate operand definitions.
Reviewed By: dp
Differential Revision: https://reviews.llvm.org/D144959
Jay Foad [Thu, 30 Mar 2023 11:24:53 +0000 (12:24 +0100)]
[AMDGPU] Reduce repetition in SMEM instruction definitions
This tries to remove all cases where we repeat the instruction name as
both an identifier (the tablegen name) and as a string (the assembler/
disassembler name). It uses tablegen's new !tolower operator.
Differential Revision: https://reviews.llvm.org/D147216
Timm Bäder [Thu, 30 Mar 2023 13:43:14 +0000 (15:43 +0200)]
[clang][Interp] Add missing static_assert messages
This broke builders, e.g.
https://lab.llvm.org/buildbot/#builders/139/builds/38250
Momchil Velikov [Thu, 30 Mar 2023 13:19:23 +0000 (14:19 +0100)]
[CodeGenPrepare] Increase the limit on the number of instructions to scan
... when finding all memory uses for an address and make it a
parameter.
Now that we have avoided potentially exponential run time of
`FindAllMemoryUses` in D143893. it'd be beneficial to increase the
limit up from 20.
Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D143894
Change-Id: I3abdf40332ef65e9b2f819ac32ac60e4200ec51d
Timm Bäder [Wed, 11 Jan 2023 11:12:52 +0000 (12:12 +0100)]
[clang][Interp] Implement function pointers
Differential Revision: https://reviews.llvm.org/D141472
Momchil Velikov [Thu, 30 Mar 2023 12:31:45 +0000 (13:31 +0100)]
[CodeGenPrepare] Fix counting uses when folding addresses into memory instructions
The counter of the number of instructions seen in `FindAllMemoryUses`
is reset after returning from a recursive invocation of
`FindAllMemoryUses` to the value it had before the call. In effect,
depending on the shape of the uses graph, the function may scan up to
`2^N-1` instructions where `N` is the scan limit
(`MaxMemoryUsesToScan`). This does not look intuitive or intended.
This patch changes the counting to just count the scanned
instructions, independent of the shape of the references.
Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D143893
Change-Id: I99f5de55e84843cf2fbea287d6ae4312fa196240
Erich Keane [Wed, 29 Mar 2023 19:17:25 +0000 (12:17 -0700)]
Correct deferred concepts with NTTP placeholder constraints
Seemingly we never tested this, but the constraint on a NTTP was being
swtiched to the 'instantiated' version, but constraints need to be
relative to the 'top level', so this was causing us to not be able to
check the constraint on final use.
This patch corrects the issue by making the constraint created with the
un-instantiated version in the case of dependent constraint attachment.
Fixes: #61777
Ivan Kosarev [Thu, 30 Mar 2023 12:45:24 +0000 (13:45 +0100)]
[AMDGPU] Add tests on v_interp_p*_f16 with immediate parameters.
Jon Chesterfield [Thu, 30 Mar 2023 12:42:37 +0000 (13:42 +0100)]
[amdgpu] Fix broken error detection in LDS lowering
std::optional<uint32_t> can be compared to uint32_t without warning, but does
not compare to the value within the optional. It needs to be prefixed *.
Wconversion does not warn about this.
```
bool bug(uint32_t Offset, std::optional<uint32_t> Expect)
{
return (Offset != Expect);
}
bool deref(uint32_t Offset, std::optional<uint32_t> Expect)
{
return (Offset != *Expect);
}
```
Both compile without warnings. Wrote the former, intended the latter.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D146775
Max Kazantsev [Thu, 30 Mar 2023 12:17:13 +0000 (19:17 +0700)]
[Test] Add test showing that SCEV cannot infer simple facts for decrementing AddRecs
Mikhail Maltsev [Thu, 30 Mar 2023 12:14:59 +0000 (13:14 +0100)]
[MemCpyOpt] Don't fold memcpy.inline into memmove
The llvm.memcpy.inline intrinsic must be expanded into code that
does not contain any function calls because it is intended for
the implementation of low-level functions like memcpy. Currently the
MemCpyOpt might covert llvm.memcpy.inline into llvm.memmove in
certain circumstances. This patch fixes the issue.
Fixes https://github.com/llvm/llvm-project/issues/61791.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D147162
Ingo Müller [Thu, 30 Mar 2023 12:04:23 +0000 (12:04 +0000)]
[mlir] Fix typos in comments in 1:N type conversion utils. (NFC)
Reviewed By: ingomueller-net
Differential Revision: https://reviews.llvm.org/D147220
Simon Pilgrim [Wed, 29 Mar 2023 17:50:45 +0000 (18:50 +0100)]
[X86] LowerVectorAllZero - use MOVMSKPS for comparisons coming from vXi32/vXi64 vectors
Reduces size of all/anyof comparison mask and is more likely to further fold with source vectors.
MOVMSKPD is trickier to match as if we had the CMPEQQ instruction we'd be using the PTEST path
Simon Pilgrim [Wed, 29 Mar 2023 16:04:17 +0000 (17:04 +0100)]
[X86] combineVectorShiftImm - fold (shift (logic X, C2), C1) -> (logic (shift X, C1), (shift C2, C1))
Helps expose a number of cases that we could/should reassociate - if only the vector constants hadn't already been lowered :(
It also forms a number of additional VPTERNLOG nodes, bringing together logic ops that had been stuck on either side of a shift op
Haojian Wu [Thu, 30 Mar 2023 10:31:41 +0000 (12:31 +0200)]
[include-cleaner] Ignore builtin symbols in the WalkAST.
There is no need to add headers for builtin symbols.
Additionally, there is a bonus benefit which help eliminate some bugs -- builtin
functions are modeled as implicit FunctionDecls in the clang AST, which results in
them being treated as normal FunctionDecls in the implementation of the include-cleaner
(going through the path: ast-node -> decl -> source location -> header).
And, the source location of these built-in symbols' AST nodes is not precise (e.g. points to the first call site),
which leads to subtle behavior that inserts a header of the call site.
Differential Revision: https://reviews.llvm.org/D147213
Johannes de Fine Licht [Thu, 30 Mar 2023 11:41:21 +0000 (11:41 +0000)]
[MLIR][LLVM] Allowlist more side-effecting operations in LLVM inliner.
These operations do not on their own require special handling to be
inlined, and can just be inlined as is.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D147148
Timm Bäder [Mon, 6 Mar 2023 18:05:54 +0000 (19:05 +0100)]
[clang][Interp] Support destructors
Emit destructors for non-primitive (array) variables on scope ends.
Differential Revision: https://reviews.llvm.org/D145545
Louis Dionne [Sat, 18 Mar 2023 17:34:29 +0000 (13:34 -0400)]
[libc++] Use the stdlib=<LIB> Lit feature instead of use_system_cxx_lib
The use_system_cxx_lib Lit feature was only used for back-deployment
testing. However, one immense hole in that setup was that we didn't
have a proper way to test Apple's own libc++ outside of back-deployment,
which was embodied by the fact that we needed to define _LIBCPP_DISABLE_AVAILABILITY
when testing (see change in libcxx/utils/libcxx/test/params.py).
This led to the apple-system testing configuration not checking for
availability markup, which is obviously quite bad since the library
we ship actually has availability markup.
Using stdlib=<VENDOR>-libc++ instead to encode back-deployment restrictions
on tests is simpler and it makes it possible to naturally support tests
such as availability markup checking even in the tip-of-trunk Apple-libc++
configuration.
Differential Revision: https://reviews.llvm.org/D146366
Pavel Labath [Mon, 27 Mar 2023 15:39:55 +0000 (17:39 +0200)]
[lldb-server/linux] Use waitpid(-1) to collect inferior events
This is a follow-up to D116372, which had a rather unfortunate side
effect of making the processing of a single SIGCHLD quadratic in the
number of threads -- which does not matter for simple applications, but
can get really bad for applications with thousands of threads.
This patch fixes the problem by implementing the other possibility
mentioned in the first patch -- doing waitpid(-1) centrally and then
routing the events to the correct process instance. The "uncollected"
threads are held in the process factory class -- which I've renamed to
Manager for this purpose, as it now does more than creating processes.
Differential Revision: https://reviews.llvm.org/D146977
Jay Foad [Thu, 30 Mar 2023 10:24:39 +0000 (11:24 +0100)]
[AMDGPU] TableGen syntax cleanups
Mariya Podchishchaeva [Thu, 30 Mar 2023 10:04:28 +0000 (06:04 -0400)]
[NFC] Fix potential for use-after-free in DumpModuleInfoAction
Since each `DumpModuleInfoAction` can now contain a pointer to a
`raw_ostream`, saving there a poiter that owned by a local `unique_ptr`
may cause use-after-free. Clarify ownership and save a `shared_ptr`
inside of `DumpModuleInfoAction` instead.
Found by static analyzer.
Reviewed By: tahonermann, aaron.ballman
Differential Revision: https://reviews.llvm.org/D146412
Nico Weber [Thu, 30 Mar 2023 10:40:16 +0000 (06:40 -0400)]
Revert "[LSR] Preserve LCSSA when rewriting instruction with PHI user"
This reverts commit
8ff4832679e1ff2d2a1cfaa45bb5cb995b0685a1.
Breaks tests, see https://reviews.llvm.org/D146811#4232839
Matthias Springer [Thu, 30 Mar 2023 10:08:20 +0000 (12:08 +0200)]
[mlir][transform] Fix typo in TrackingListener
This was an oversight in D147206. The function should not have been made
`const` (just like the other `notify...` functions).
Kadir Cetinkaya [Wed, 29 Mar 2023 11:09:39 +0000 (13:09 +0200)]
[clangd] Map references from include'd files to directives
Differential Revision: https://reviews.llvm.org/D147139
Jay Foad [Thu, 30 Mar 2023 09:43:37 +0000 (10:43 +0100)]
[AMDGPU] Remove two unused ComplexRendererFns
These were left over after https://reviews.llvm.org/D98663
Alexander Belyaev [Thu, 30 Mar 2023 09:26:09 +0000 (11:26 +0200)]
[mlir] Fix folding into tensor.pad op.
When low/high padding is folded in padOp, there should be inserted a
tensor.cast back to the original result type. Right now, there is a no-op
tensor.cast from new type to new type...
Differential Revision: https://reviews.llvm.org/D147210
Nikita Popov [Tue, 21 Mar 2023 11:14:44 +0000 (12:14 +0100)]
[AArch64] Extend icmp bitcast to vecreduce fold to comparison with -1
D130163 added support for folding
setcc (iN (bitcast (vNi1 X))), 0, (eq|ne) to
setcc (iN (zext (i1 (vecreduce_or (vNi1 X))))), 0, (eq|ne).
There is a conjugate fold for comparison with -1 which uses
vecreduce_and and sext instead.
Proof: https://alive2.llvm.org/ce/z/Zz--xy
Differential Revision: https://reviews.llvm.org/D146518
Matthias Springer [Thu, 30 Mar 2023 08:18:10 +0000 (10:18 +0200)]
[mlir][transform] Add optional error checking to TrackingListener
Derived classes can implement `notifyPayloadReplacementNotFound` for custom error checking.
Differential Revision: https://reviews.llvm.org/D147206
Adrian Kuegel [Thu, 30 Mar 2023 08:43:15 +0000 (10:43 +0200)]
[mlir] Apply ClangTidy readability fix (NFC).
Jean Perier [Thu, 30 Mar 2023 07:48:45 +0000 (09:48 +0200)]
[flang][hlfir] disable region simplification in HLFIR pipeline
Block merging is disabled with FIR: some FIR value should not be promoted
to block arguments, and the region simplification block merging is
promoting all SSA value types to block argument when two blocks are
similar except for the usage these values.
Differential Revision: https://reviews.llvm.org/D147130
Dmitry Makogon [Fri, 24 Mar 2023 13:42:30 +0000 (20:42 +0700)]
[LSR] Preserve LCSSA when rewriting instruction with PHI user
Fixes https://github.com/llvm/llvm-project/issues/61182.
LoopStrengthReduce may sometimes break LCSSA form when applying a rewrite
for an instruction used in a PHI.
It happens if:
- The PHI is in a loop exit block,
- The edge from the corresponding exiting block to that exit is critical,
- The PHI has at least two inputs coming from loop blocks,
- and the rewritten instruction is inserted in the loop.
In such case we split the critical edge and then replace PHI inputs
with the rewritten instruction. However ExitBlock is no longer
a loop exit, so LCSSA form is broken.
This patch fixes it by collecting all inserted instructions for PHIs
whose parent block is not a loop exit and then forming LCSSA for them.
Differential Revision: https://reviews.llvm.org/D146811
Peter Rong [Tue, 28 Mar 2023 12:14:23 +0000 (05:14 -0700)]
[CodeGen] Remove redundent instructions generated by combineAddrModes.
CodeGenPare may optimize memory access modes.
During such optimization, it might create a new instruction representing combined value.
Later, If the optimization failed, the generated value is not removed and remains a dead instruction.
Normally this won't be a problem as dead code will be eliminated later.
However, in this case (Issue 58538), the generated instruction may trigger an infinite loop.
The infinite loop involves `sinkCmpExpression`, where it tries to optimize the placeholder generated by us.
(See the test case detailed in the issue)
To fix this, we remove the unnecessary placeholder immediately when we abort the optimization.
`AddressingModeCombiner` will keep track of the placeholder, and remove it if it is an inserted placeholder and has no uses.
This patch fixes https://github.com/llvm/llvm-project/issues/58538, a test is also included.
Reviewed By: skatkov
Differential Revision: https://reviews.llvm.org/D147041
Craig Topper [Thu, 30 Mar 2023 07:10:36 +0000 (00:10 -0700)]
[RISCV] isDigit instead of isdigit for consistency. NFC
There are several other calls to isDigit in RISCVISAInfo.cpp
Serge Pavlov [Thu, 30 Mar 2023 06:29:48 +0000 (13:29 +0700)]
[symbolizer] Additional tests for invalid address handling
These tests check GNU-compatible output if llvm-symbolizer is called with
the option --output-style=GNU and LLVM-style output if llvm-addr2line is
called with --output-style=LLVM.
Differential Revision: https://reviews.llvm.org/D147110
Kazu Hirata [Thu, 30 Mar 2023 06:01:11 +0000 (23:01 -0700)]
Use Dense{Map,Set}::contains (NFC)
Craig Topper [Thu, 30 Mar 2023 05:22:57 +0000 (22:22 -0700)]
[RISCV] Replace std::string with StringRef in RISCVISAInfo. NFC
We're just slicing off part of an existing StringRef. No need to
allocate any new storage.
Peter Rong [Thu, 30 Mar 2023 05:17:59 +0000 (22:17 -0700)]
[WASM] Precommit WebAssemblyISelLowering.cpp format changes for D147198
Signed-off-by: Peter Rong <PeterRong96@gmail.com>
Hau Hsu [Thu, 30 Mar 2023 04:47:33 +0000 (12:47 +0800)]
[compiler-rt] Fix cross-compiling detection
Previously the detection compares "CMAKE_SYSTEM_NAME" and
"CMAKE_TARGET_SYSTEM_NAME", which only contains OS names like "Linux".
This is not sufficient when cross-compiling for different target CPUs.
This patch uses CMAKE_CROSSCOMPILING, which sets automatically by CMake
when cross compiling.
Reviewed By: smeenai, phosek
Differential Revision: https://reviews.llvm.org/D147103
Jonas Devlieghere [Thu, 30 Mar 2023 04:51:45 +0000 (21:51 -0700)]
[DWARFLinker] Honor verbose flag for input verification
Fix an inconsistency between input and output verification in dsymutil.
Previously, output verification would be controlled by the verbose flag,
while input verification would unconditionally dump to stdout. Make
input and output verification behave the same by printing verification
error to stderr in verbose mode only.
Craig Topper [Thu, 30 Mar 2023 04:37:26 +0000 (21:37 -0700)]
[RISCV] Use StringRef(&C, 1) instead of std::string(1, C).
We're calling functions that take a StringRef. We can create one
from a single character variable without using std::string.
Kazu Hirata [Thu, 30 Mar 2023 04:50:34 +0000 (21:50 -0700)]
[ARM] Use isNullConstant and isOneConstant (NFC)
Serguei Katkov [Thu, 30 Mar 2023 03:21:31 +0000 (10:21 +0700)]
[GuardWidening] Freeze the introduced use. Re-land.
Non-determenism is fixed.
Guard widening optimization is able to move the condition from one
guard to the previous one. As a result if the condition is poison
and orginal second guard is never executed but the first one does,
we introduce undefined behavior which was not observed in original
program.
To resolve the issue we must freeze the condition we are moving.
However optimization itself does not know how to work with freeze.
Additionally optimization is written in incremental way.
For example we have three guards
G1(base + 8 < L)
G2(base + 16 < L)
G3(base + 24 < L)
On the first step GW will combine G1 and G2 as
G1(base + 8 < L && freeze(base + 16 < L))
G2(true)
G3(base + 24 < L)
while combining G1 and G3 base appears to be different.
To keep optimization enabled after freezing the moving condition, the
freeze instruction is pushed as much as possible and later all uses
of freezed values are replaced with frozen version.
This is similar what instruction combining does but more aggressevely.
Ben Shi [Thu, 30 Mar 2023 03:34:19 +0000 (11:34 +0800)]
[lld][ELF][NFC] Simplify method "Thunk *elf::addThunk()"
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D147124
Sergei Barannikov [Sun, 26 Mar 2023 23:22:46 +0000 (02:22 +0300)]
[MCP] Do not try forward non-existent sub-register of a copy
In this example:
```
$d14 = COPY killed $d18
$s0 = MI $s28
```
$s28 is a sub-register of $d14. However, $d18 does not have
sub-registers and thus cannot be forwarded. Previously, this resulted
in $noreg being substituted in place of the use of $s28, which later
led to an assertion failure.
Fixes https://github.com/llvm/llvm-project/issues/60908, a regression
that was introduced in D141747.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D146930
jacquesguan [Fri, 24 Mar 2023 10:18:25 +0000 (18:18 +0800)]
[MachineScheduler] Rename postprocessDAG to postProcessDAG. NFC
Rename postprocessDAG to camel case.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D146795
Wang, Xin10 [Thu, 30 Mar 2023 02:33:57 +0000 (10:33 +0800)]
Handle the unexpected inputs for pass HardwareLoops
For a function TryConvertLoop in pass HardwareLoops, wrong input arguments will
lead to crash. There will be 3 cases.
In line 342, compiler want to get something from
HWLoopInfo.CountType, which depends on if argument Bitwidth is given, if not,
will crash.
In Function isHardwareLoopCandidate, it dereference CountType too.
In Function InsertLoopDec, it dereference LoopDecrement.
They all could lead to crash. This patch add condition to this pass, when we meet unexpected inputs then skip
the pass.
Reviewed By: samparker, fhahn
Differential Revision: https://reviews.llvm.org/D146277
Leonard Chan [Thu, 30 Mar 2023 01:38:05 +0000 (01:38 +0000)]
Revert "Reland "[hwasan] Provide aliases for c allocation functions for Fuchsia"
This reverts commit
5bb826d569ccd80e28aedd682db39b8cddd44e53.
We suspect this is leading to the segfaults for tests run on
aarch64+android+hwasan:
https://lab.llvm.org/buildbot/#/builders/77/builds/26025/steps/21/logs/stdio
Peiming Liu [Thu, 30 Mar 2023 01:01:13 +0000 (01:01 +0000)]
[mlir][sparse] avoid creating temporary unordered COO buffer when reshape sparse tensor.
Reviewed By: aartbik, wrengr
Differential Revision: https://reviews.llvm.org/D147192
Harald van Dijk [Thu, 30 Mar 2023 01:18:52 +0000 (02:18 +0100)]
[SYCL] Always set NoUnwind attribute for SYCL.
Like CUDA and OpenCL, the SYCL specification says that throwing and
catching exceptions in device functions is not supported, so this change
extends the logic for adding the NoUnwind attribute to SYCL.
The existing convergent.cpp test, which tests that the convergent
attribute is added to functions by default, is renamed and reused to
test that the nounwind attribute is added by default. This test now has
-fexceptions added to it, which the driver adds by default as well.
The obvious question here is why not simply change the driver to remove
-fexceptions. This change follows the direction given by the TODO
comment because removing -fexceptions would also disable the
__EXCEPTIONS macro, which should reflect whether exceptions are enabled
on the host, rather than on the device, to avoid conflicts in types
shared between host and device.
Reviewed By: bader
Differential Revision: https://reviews.llvm.org/D147097
wren romano [Fri, 24 Mar 2023 23:03:56 +0000 (16:03 -0700)]
[mlir][sparse] Preliminary code changes for ExprId, LatPointId, LatSetId newtypes
This commit contains several code changes which are ultimately required for converting the varions `Merger` identifiers from typedefs to newtypes. The actual implementation of the newtypes themselves has been split off into separate commits, in hopes of simplifying the review process.
Depends On D146561
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D146684
Robert Suderman [Thu, 30 Mar 2023 00:49:01 +0000 (00:49 +0000)]
[mlir][arith] Add expansion pattern for ext/trunc of bf16
bf16 has a trivial truncation/extension behavior with F32 that
can be described in elementary arith operations. Include some
expansions to efficiently convert.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D147091