Anshil Gandhi [Wed, 3 May 2023 02:26:23 +0000 (20:26 -0600)]
[AMDGPU][NFC] Preserve PDTWrapperPass in UnifyDivergentExitNodes
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D149568
Nico Weber [Wed, 3 May 2023 00:46:23 +0000 (20:46 -0400)]
[gn] Actually reformat files after adding CodeGen deps
This should've been part of
8221c316d524695.
Nico Weber [Wed, 3 May 2023 00:40:49 +0000 (20:40 -0400)]
[gn build] Port rest of
9cfeba5b12b6 (LowLevelType->Support)
This adds all the CodeGen deps all over the place.
I ran
git show
9cfeba5b12b6 > foo2.txt
to get the original patch into a text file and then ran
#!/usr/bin/env python3
import os
in_cmake = False
for l in open('foo2.txt'):
if l.startswith('+++ b/'):
cmake = l[len('+++ b/'):-1]
in_cmake = 'CMakeLists.txt' in cmake
if not in_cmake:
continue
prefix = 'llvm/utils/gn/secondary/'
gn_file = os.path.join(prefix, os.path.dirname(cmake), 'BUILD.gn')
if l.startswith('+ '):
add = l[1:].strip()
if add == 'CodeGen':
try:
with open(gn_file) as f:
contents = f.read()
except:
print(f'skipping {gn_file}')
continue
contents = contents.replace(' deps = [', ' deps = ["//llvm/lib/CodeGen",')
with open(gn_file, 'w') as f:
f.write(contents)
to update all the GN files.
(I manually removed the dep on CodeGen that this added to llvm-min-tblgen.)
Finally, I ran
git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format
to fix up the formatting.
Nico Weber [Wed, 3 May 2023 00:42:03 +0000 (20:42 -0400)]
[gn] reformat all gn files
I ran:
git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format
Mingming Liu [Fri, 28 Apr 2023 00:49:41 +0000 (17:49 -0700)]
[NFC] Add a test case to make sure EarlyCSE preserves !prof when one
instruction CSE'ed another.
- This should be a part of D148877. Before that patch, !prof is not added to known-id-set [1], and turns out unknown types of metadata are dropped in the implementation [2].
- This test is mainly added to make sure there won't be regressions for this kind of pattern. The pattern is observed it in application code; looks like the result of indirect call is used as function arguments initially; after the function is inlined load-after-store CSE opportunity is exposed.
[1] https://github.com/llvm/llvm-project/blob/
f478721231bdb71ba8f0f6fb21673b9b7f652add/llvm/lib/Transforms/Utils/Local.cpp#L2727-L2741
[2] https://github.com/llvm/llvm-project/blob/
ade3c6a6a88ed3a9b06c076406f196da9d3cc1b9/llvm/lib/Transforms/Utils/Local.cpp#L2639
Differential Revision: https://reviews.llvm.org/D149396
Mingming Liu [Thu, 27 Apr 2023 22:55:29 +0000 (15:55 -0700)]
[NFC][EarlyCSE]Modify test case to ensure branch weights are preserved with cse.
Differential Revision: https://reviews.llvm.org/D149390
Yeting Kuo [Wed, 3 May 2023 00:32:08 +0000 (08:32 +0800)]
[RISCV] Enable strict fp for RISC-V in clang.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D149334
Alex Langford [Tue, 2 May 2023 17:05:36 +0000 (10:05 -0700)]
[lldb] Remove FileSpec::GetLastPathComponent
As far as I can tell, this just computes the filename of the FileSpec,
which is already conveniently stored in m_filename. We can use
FileSpec::GetFilename() instead.
Differential Revision: https://reviews.llvm.org/D149663
Alex Langford [Tue, 2 May 2023 17:48:53 +0000 (10:48 -0700)]
[lldb] Minor cleanups at callsites of FileSpec::GetFileNameExtension
FileSpec::GetFileNameExtension returns a StringRef. In some cases we
are calling it and then storing the result in a local. To prevent
cases where we store the StringRef, mutate the Filespec, and then try to
use the stored StringRef afterwards, I've audited the callsites and made
adjustments to mitigate: Either marking the FileSpec it comes from as
const (to avoid mutations) or by not storing the StringRef in a local if
it makes sense not to.
Differential Revision: https://reviews.llvm.org/D149671
Nico Weber [Wed, 3 May 2023 00:07:59 +0000 (20:07 -0400)]
[gn build] Port some of
9cfeba5b12b6 (LowLevelType->Support, llvm-tblgen->CodeGen)
Doesn't yet add all the CodeGen deps all over the place.
Nico Weber [Wed, 3 May 2023 00:07:59 +0000 (20:07 -0400)]
[gn build] Port
3e3a926be8a9
Nico Weber [Wed, 19 Apr 2023 18:34:31 +0000 (14:34 -0400)]
[gn] Unbreak sync_source_lists_from_cmake on mac after Xcode update
Apparently `\b` stopped working with --pickaxe-regex for some reason.
Nico Weber [Tue, 2 May 2023 23:36:53 +0000 (19:36 -0400)]
[gn] Port
631bfdbee5b4 (GenVT.inc)
Nico Weber [Tue, 2 May 2023 23:59:21 +0000 (19:59 -0400)]
[gn] port
243e8f8d23ac71 (llvm-min-tblgen)
Joseph Huber [Tue, 2 May 2023 20:54:29 +0000 (15:54 -0500)]
[libc] Add 'UNIT_TEST_ONLY' and 'HERMETIC_TEST_ONLY' to 'add_libc_test'
The `add_libc_test` option allows us to enable both kinds of tests in a
single option. However, some tests cannot be made hermetic with the
current approach. Such as tests that rely on system utilities or
libraries. This patch adds two options `UNIT_TEST_ONLY` and
`HERMETIC_TEST_ONLY` to offer more fine-grained control over which
version gets built. This makes it explicit which version a test supports
and why.
Depends on D149662
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D149691
Joseph Huber [Tue, 2 May 2023 16:58:47 +0000 (11:58 -0500)]
[libc] Enable the 'string' unit tests to be hermetic
This changes over the string unit tests to the new `add_libc_test`
framework. The one test that wasn't changes was the memory utils because
it overran the static buffer used for the hermetic test's bump pointer.
Depends on D149656
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D149662
Joseph Huber [Tue, 2 May 2023 15:29:13 +0000 (10:29 -0500)]
[libc] Remove use of 'assert' from the string tests
Currently we use `assert` as a stand-in for the typical test assertions.
This is because these functions exist outside of the base test class so
we can't use the typical assertion methods. The presence of these
asserts makes it difficult to compile these tests in a standalone
format. This patch removes all occurrences.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D149656
Muhammad Omair Javaid [Tue, 2 May 2023 23:03:10 +0000 (04:03 +0500)]
[LLDB] Add/Remove xfail for some API tests on Windows
This patch add or removes XFAIL decorator from various tests which were marked
xfail for windows.
since 44363f2 various tests have started passing but introduced a couple of new failures.
Weight is in favor of new XPasses and I have removed XFail decorator from them. Also
some new tests have started failing for which we need to file separate bugs. I have
marked them xfail for now and will add the bug id after investigating the issue.
Differential Revision: https://reviews.llvm.org/D149235
Matt Arsenault [Tue, 18 Apr 2023 11:36:46 +0000 (07:36 -0400)]
ValueTracking: Sign handling for minnum/maxnum
If we know one operand is positive for maxnum, or one is negative
for minnum, the result will have the same sign.
Nico Weber [Tue, 2 May 2023 22:59:47 +0000 (18:59 -0400)]
[gn] port
fa43608d1649 (riscv_sifive_vector.td)
Nick Desaulniers [Tue, 2 May 2023 22:54:09 +0000 (15:54 -0700)]
Revert "[Demangle] make llvm::demangle take std::string_view rather than const std::string&"
This reverts commit
c117c2c8ba4afd45a006043ec6dd858652b2ffcc.
itaniumDemangle calls std::strlen with the results of
std::string_view::data() which may not be NUL-terminated. This causes
lld/test/wasm/why-extract.s to fail when "expensive checks" are enabled
via -DLLVM_ENABLE_EXPENSIVE_CHECKS=ON. See D149675 for further
discussion. Back this out until the individual demanglers are converted
to use std::string_view.
Okwan Kwon [Tue, 2 May 2023 20:37:14 +0000 (13:37 -0700)]
[mlir][linalg] check if a function has a body during detensorizing
A func may not have a body.
Differential Revision: https://reviews.llvm.org/D149688
Teresa Johnson [Tue, 2 May 2023 20:03:41 +0000 (13:03 -0700)]
[MemProf] Use profiled lifetime access density directly
Now that the runtime tracks the lifetime access density directly, we can
use that directly in the threshold checks instead of less accurately
computing from other statistics.
Differential Revision: https://reviews.llvm.org/D149684
Michael Jones [Tue, 2 May 2023 18:24:19 +0000 (11:24 -0700)]
[libc][bazel] static link test targets
This solves issues caused by the symbols for internal components being
marked as hidden. When dynamically linked, the tests of internal
components, such as printf_parser_test, fail due to the symbols being
unavailable.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D149674
Jorge Gorbe Moya [Tue, 11 Apr 2023 01:37:03 +0000 (18:37 -0700)]
[lldb-vscode] Implement RestartRequest
This is an optional request, but supporting it makes the experience
better when re-launching a big binary that takes significant time to
parse: instead of tearing down and re-create the whole session we just
need to kill the current process and launch a new one.
Some non-obvious comments that might help review this change:
* After killing the process, we get an "exited" event for it. Because
the process no longer exists some interesting things can occur that
manifest as flaky failures if not dealt with:
- `EventIsProcessEvent` relies on `SBEvent::GetBroadcasterClass`,
which can crash if the broadcaster is no longer there: the event
only holds a weak_ptr to its broadcaster, and `GetBroadcasterClass`
uses it without checking.
Other `EventIs*` functions look at the flavor of the EventData, so I
have modified EventIsProcessEvent to do that.
- We keep the PID of the old process so we can detect its "exited"
event and not terminate the whole session. But sometimes the
SBProcess we get from the event won't have a PID, for some reason.
* I have factored out the code to launch a process out to a new
LaunchProcess function, so it can be used from both `request_launch`
and `request_restart`.
* The restart_runInTerminal test has the same problem with debug builds
as the original runInTerminal test: when attaching to the launcher
instance of lldb-vscode it takes a long time to parse its debug info.
I have used the same workaround to disable that particular test for
debug builds.
Differential Revision: https://reviews.llvm.org/D147831
Louis Dionne [Tue, 2 May 2023 21:12:04 +0000 (17:12 -0400)]
[clang] Build the ToT Clang in Release mode in the Clang/libcxx CI pipeline
This is an attempt to reduce the insane amount of network we use when
uploading Clang binaries to Buildkite for other jobs to use. We think
that removing debug information will result in much smaller binaries.
Andrzej Warzynski [Tue, 2 May 2023 21:02:22 +0000 (21:02 +0000)]
[mlir][SparseTensor][ArmSVE] Disable scalable vectorisation in a test
The MLIR SVE integration tests are now enabled in the
clang-aarch64-full-2stage buildbot under emulation (QEMU) and one of the
sparse integration tests is failing [1]:
* Integration/Dialect/SparseTensor/CPU/concatenate_dim_1.mlir
That test is failing because we we don't have a LIT substitution to
replace:
```
; RUN: mlir-cpu-runner <command>
```
with
```
; RUN: <emulator> mlir-cpu-runner <command>
```
clang-aarch64-full-2stage does not support SVE natively and hence all
SVE integration tests require emulation. Other SVE tests use `lli` (for
which we do have the required substitution) and hence are not affected.
This patch simplifies concatenate_dim_1.mlir to always use fixed-width
vectorisation. We will re-enable scalable vectorisation once LIT
substitutions for `mlir-cpu-runner` are updated.
[1] https://lab.llvm.org/buildbot/#/builders/179/builds/6062
spupyrev [Thu, 16 Feb 2023 18:52:04 +0000 (10:52 -0800)]
[BOLT][NFC] Add hash computation for basic blocks
Extending yaml profile format with block hashes, which are used for stale
profile matching. To avoid duplication of the code, created a new class with a
collection of utilities for computing hashes.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D144306
Alexey Bataev [Tue, 2 May 2023 20:27:45 +0000 (13:27 -0700)]
[SLP][NFC]Add a test with the reshuffled nodes in buildvector nodes,
NFC.
Matt Arsenault [Sun, 9 Apr 2023 11:15:13 +0000 (07:15 -0400)]
ValueTracking: Handle minimum/maximum in computeKnownFPClass
Dávid Bolvanský [Tue, 2 May 2023 20:47:51 +0000 (22:47 +0200)]
[MachineInst] Switch NumOperands to 16bits
Decrease NumOperands from 32 to 16bits (matches MCInstrDesc) so we can use saved bits to extend Flags (https://reviews.llvm.org/D118118).
Reviewed By: barannikov88
Differential Revision: https://reviews.llvm.org/D149445
Trevor Morris [Tue, 2 May 2023 18:40:44 +0000 (11:40 -0700)]
Add tensor.bitcast op to Tensor dialect
Add tensor.bitcast operator to bitcast between two tensors of compatible shape
and same bit width. This can be use to reinterpret an unsigned integer as a
signed integer or vice versa.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D149608
Teresa Johnson [Tue, 2 May 2023 17:43:23 +0000 (10:43 -0700)]
[MemProf] Removed unused allocation type
Removes the 'notcoldandcold' allocation type summary
(de)serialization support added in D135714, after realizing that this
will never be generated in practice.
There are 2 uses of the allocation type keywords in the summary. One is
for the individual profiled memprof context summaries, and each context
can only be assigned a single type of hotness. The second is in the
clone version information produced by the MemProfContextDisambiguation
whole program step, and we only create a clone for a specific allocation
type.
Differential Revision: https://reviews.llvm.org/D149669
Vitaly Buka [Tue, 2 May 2023 19:56:37 +0000 (12:56 -0700)]
[CodeGen] Fix signed int overflow
Exposed by the test from
8f966cedea594d9a91e585e88a80a42c04049e6c.
Jonas Devlieghere [Tue, 2 May 2023 19:47:38 +0000 (12:47 -0700)]
[lldb] Assert on invalid index in OptionValueProperties (NFC)
All indexes passed to GetPropertyAtIndex are constants generated by
ablegen. We should never pass an invalid index.
Florian Hahn [Tue, 2 May 2023 19:41:57 +0000 (20:41 +0100)]
[ShrinkWrap] Add tests with loads from byval/inalloca/preallocated args.
Extra test coverage for D149668.
Joel E. Denny [Tue, 2 May 2023 19:38:21 +0000 (15:38 -0400)]
[OpenMP] Fix libomptarget test mapping/ompx_hold/struct.c
For me, the test fails for nvptx64 offload. The problem was
introduced by D146838, which landed as
747af2415519. It tries to copy
a string constant's address from device to host and then print the
string. This patch copies the contents of the string instead.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D149623
Michael Buch [Tue, 2 May 2023 19:35:46 +0000 (15:35 -0400)]
Revert "[lldb][DWARFExpression] Fix DW_OP_div to use signed division"
This reverts commit
e15d6b520e1e85d2cdf9ffc66f0c4698390eaa3d.
Newly added test fails on Darwin platforms and arm.
Differential Revision: https://reviews.llvm.org/D147370
Vitaly Buka [Tue, 2 May 2023 19:25:06 +0000 (12:25 -0700)]
[test][HWASAN] Don't run common tests without lld
Follow up to D149234 for bots without lld.
Corentin Jabot [Tue, 2 May 2023 08:30:56 +0000 (10:30 +0200)]
[Clang] Correctly expand pack in binary subscript expression.
When constructing an array expression where the index expression
was a pack expansion, we would construct an ArraySubscriptExpr
instead of an CreateOverloadedArraySubscriptExpr, and pack
expansion would not occur - leading a crash during code gen
or a failure during constant evaluation
Reviewed By: erichkeane, shafik
Differential Revision: https://reviews.llvm.org/D149637
Nikolas Klauser [Tue, 2 May 2023 19:04:40 +0000 (12:04 -0700)]
[libc++][PSTL] Fix nasty macros test
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D149595
Simon Pilgrim [Tue, 2 May 2023 17:37:28 +0000 (18:37 +0100)]
[X86] Lower abdu(lhs, rhs) -> or(usubsat(lhs,rhs), usubsat(rhs,lhs))
Adds pre-SSE4 v8i16 abdu handling - we already have something similar for umax(x,y) -> add(x,usubsat(y,x)) / umin(x,y) -> sub(x,usubsat(x,y))
(I'm starting to look at adding generic TargetLowering expandABD() handling and came across this missed opportunity).
Inspiration: http://0x80.pl/notesen/2018-03-11-sse-abs-unsigned.html
Alive2: https://alive2.llvm.org/ce/z/gMhaTa
Adrian Prantl [Tue, 2 May 2023 18:41:36 +0000 (11:41 -0700)]
Revert "Add amissing REQUIRES: to test"
This reverts commit
1f74964b403c615c121c0adbd06661adaae14667.
The googles. They do nothing!
Shilei Tian [Tue, 2 May 2023 18:33:12 +0000 (14:33 -0400)]
Revert "[OpenMP] [OMPT] [amdgpu] [4/8] Implemented callback registration in nextgen plugins"
This reverts commit
8cd1f0d8885fd69c452c6bf3fb04514d06c899b0.
It causes issues when OMPT is disabled explicitly and dependences are not set
correctly.
Matt Arsenault [Sat, 8 Apr 2023 23:20:34 +0000 (19:20 -0400)]
ValueTracking: Implement computeKnownFPClass for minnum/maxnum
Nick Desaulniers [Tue, 2 May 2023 18:10:43 +0000 (11:10 -0700)]
[Demangle] make llvm::demangle take std::string_view rather than const std::string&
As suggested by @erichkeane in
https://reviews.llvm.org/D141451#inline-1429549
There's potential for a lot more cleanups around these APIs. This is
just a start.
Callers need to be more careful about sub-expressions producing strings
that don't outlast the expression using ``llvm::demangle``. Add a
release note.
Reviewed By: MaskRay, #lld-macho
Differential Revision: https://reviews.llvm.org/D149104
Adrian Prantl [Tue, 2 May 2023 18:15:29 +0000 (11:15 -0700)]
Add amissing REQUIRES: to test
Vasileios Porpodas [Tue, 2 May 2023 17:14:53 +0000 (10:14 -0700)]
[NFC][SLP] Fix typo
Differential Revision: https://reviews.llvm.org/D149670
Jonas Devlieghere [Tue, 2 May 2023 18:09:48 +0000 (11:09 -0700)]
[lldb] Fix
8be139fc1251 for propery value changes
Fix
8be139fc1251 for mid-air collision with the propery value changes.
Ilya Kuklin [Tue, 2 May 2023 18:02:30 +0000 (11:02 -0700)]
[lldb] Add settings for expression evaluation memory allocations.
Expression evaluation allocates memory for storing intermediate data during evaluation. For it to work properly it has to be allocated within target's available address space, for example within first 0xFFFF bytes for the 16-bit MSP430. The memory for such targets can be very tightly packed, but not all targets support GetMemoryRegionInfo API to pick an unused region, like MSP430 with MSPDebug GDB server.
These settings allow the programmer to manually pick precisely where and how much memory to allocate for expression evaluation in order not to overlap with existing data in process memory.
Reviewed By: bulbazord
Differential Revision: https://reviews.llvm.org/D149262
Nikolas Klauser [Tue, 2 May 2023 17:48:00 +0000 (10:48 -0700)]
[libc++] Add _LIBCPP_HIDE_FROM_ABI to the unsequenced_policy constructor
Jonas Devlieghere [Tue, 2 May 2023 17:31:21 +0000 (10:31 -0700)]
[lldb] Make exe_ctx an optional argument in OptionValueProperties (NFC)
The majority of call sites are nullptr as the execution context.
Refactor OptionValueProperties to make the argument optional and
simplify all the callers.
Florian Hahn [Tue, 2 May 2023 17:22:04 +0000 (18:22 +0100)]
[X86] Remove stale checks after
a30c17aba9.
NAKAMURA Takumi [Tue, 2 May 2023 17:18:03 +0000 (02:18 +0900)]
Temporary fix for `MVT::getSizeInBits()` to handle `aarch64svcount`
Support/MVTTest.cpp was missing text matrix for it.
FIXME: `aarch64svcount` should be in the td.
Florian Hahn [Tue, 2 May 2023 17:21:11 +0000 (18:21 +0100)]
[X86] Auto-generate checks for file.
This makes it easier to update the test checks and also adds better
coverage.
Alex Langford [Tue, 2 May 2023 00:29:28 +0000 (17:29 -0700)]
[lldb] Refactor SBFileSpec::GetDirectory
There's no reason to create an entire new filespec to mutate and grab
data from when we can just grab the data directly.
Differential Revision: https://reviews.llvm.org/D149625
Alexey Lapshin [Thu, 20 Apr 2023 21:03:21 +0000 (23:03 +0200)]
[Support][Parallel] Initialize threadIndex and add assertion checking its usage.
That patch adds a check for threadIndex being used with only threads
created by ThreadPoolExecutor. This helps catch two types of errors:
1. If a thread is created not by ThreadPoolExecutor its index may clash
with the index of another thread. Using threadIndex, in that case, may
lead to a data race.
2. Index of the main thread(threadIndex == 0) currently clashes with
the index of thread0 in ThreadPoolExecutor threads. That may lead
to a data race if main thread and thread0 are executed concurrently.
This patch allows execution tasks on the main thread only in case
parallel::strategy.ThreadsRequested == 1. In all other cases,
assertions check that threadIndex != UINT_MAX(i.e. that task
is executed on a thread created by ThreadPoolExecutor).
Differential Revision: https://reviews.llvm.org/D148916
Ben Langmuir [Tue, 25 Apr 2023 18:04:06 +0000 (11:04 -0700)]
[llvm][vfs] Avoid silent fallback to process-wide working directory
In createPhysicalFileSystem, preserve the per-instance working
directory, even after the first call to getcwd fails.
rdar://
108213753
Differential Revision: https://reviews.llvm.org/D149173
NAKAMURA Takumi [Tue, 2 May 2023 16:30:03 +0000 (01:30 +0900)]
SemaRISCVVectorLookup.cpp: Prune `default:` block. [-Wcovered-switch-default]
Dhruva Chakrabarti [Thu, 27 Apr 2023 16:56:25 +0000 (18:56 +0200)]
[OpenMP] [OMPT] [amdgpu] [4/8] Implemented callback registration in nextgen plugins
The purpose of this patch is to Implement registration of callback functions in the generic plugin by looking up corresponding callbacks in libomptarget. The overall design document is https://rice.app.box.com/s/pf3gix2hs4d4o1aatwir1set05xmjljc
Defined an object of type OmptDeviceCallbacksTy in the amdgpu plugin for holding the tool-provided callback functions. Implemented a global constructor in the plugin that creates a connector object to connect with libomptarget. The callbacks that are already registered with libomptarget are looked up and registered with the plugin.
Combined with an internal patch from Dhruva Chakrabarti, which fixes the OMPT initialization ordering.
Achieved through removal of the constructor attribute from ompt_init.
Patch from John Mellor-Crummey <johnmc@rice.edu>
With contributions from:
Dhruva Chakrabarti <Dhruva.Chakrabarti@amd.com>
Michael Halkenhaeuser <MichaelGerald.Halkenhauser@amd.com>
Differential Revision: https://reviews.llvm.org/D124070
Fangrui Song [Tue, 2 May 2023 16:35:00 +0000 (09:35 -0700)]
[ELF] Name MergeSyntheticSection using an input section instead of the output section
In a link map, the input section name gives more information. See the updated
merge-entsize.s for an example. The output file is unchanged.
Compiler generated input sections with the SHF_MERGE flag have names such as
.rodata.str1.1 and .rodata.cstN, and are not affected by -fdata-sections.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D149466
Quinn Dawkins [Sun, 2 Apr 2023 19:46:32 +0000 (15:46 -0400)]
[mlir][linalg] Allow outer dims perm and untiled dims in pack/unpack generalization
Extends the pack/unpack generalization patterns to work for any packing
op with only full tiles. This produces a combination of rank-reduced
insert/extract slice ops paired with a transpose on the reduced shape,
similar to what the pattern currently produces for fully tiled
pack/unpacks. Note that only the outer dims are rank-reduced in this
pattern, leaving the shape of the inner tile intact.
Differential Revision: https://reviews.llvm.org/D147555
Alvin Wong [Sun, 23 Apr 2023 15:42:21 +0000 (23:42 +0800)]
[sanitizer][asan][win] Only unmap unneeded shadow memory on x86_64
D21942 /
1128db8fe1c13800ebc77206efc50d0a219b8750 added support for
committing shadow memory on demand on Win 64-bit. The reason it is not
enabled on 32-bit wasn't clear but the page table overhead on Windows 7
may be a contributing factor.
In `AsanMapUnmapCallback::OnUnmap`, `FlushUnneededASanShadowMemory` is
called to release shadow memory. It calls `ReleaseMemoryPagesToOS`,
which had been a no-op on Windows, until D95892 /
81b1d3da094c54ffd75e05c8d4683792edf17f4c in which it was changed to
unmap full pages that the memory region covers. This was done on both
32-bit and 64-bit.
AddressSanitizerInterface.GetHeapSizeTest appears to fail on i686
targets as a side effect of this. This test allocates and frees a huge
chunk of memory which causes shadow memory to be unmapped immediately.
When the test allocates the chunk of memory a second time, asan tries to
reuse the same shadow memory region, but because the shadow memory has
now been unmapped, it causes an access violation and crashes the test.
x86_64 is not affected, because the code that handles commiting shadow
memory on demand also handles this situation, allowing the test to work
without crashing.
Therefore, this patch changes `FlushUnneededASanShadowMemory` on Windows
to only release/unmap the shadow memory on x86_64 to stop this from
happening on i686.
Differential Revision: https://reviews.llvm.org/D149025
4vtomat [Tue, 2 May 2023 15:24:44 +0000 (08:24 -0700)]
[tests] Add missing REQUIRES: riscv-registered-target to clang test
Shao-Ce SUN [Sun, 30 Apr 2023 18:25:51 +0000 (02:25 +0800)]
[RISCV][CodeGen] Support Zfinx codegen
This patch was split from D122918 . Co-Author: @liaolucy @realqhc
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D148874
NAKAMURA Takumi [Tue, 2 May 2023 15:42:24 +0000 (00:42 +0900)]
Try to fix CodeGenTypes issues in mlir
Dan McGregor [Tue, 2 May 2023 15:53:48 +0000 (11:53 -0400)]
Call printName to get name of Decl
Rather than sending a name directly to the stream, use printName
to preserve any PrintingPolicy. This ensures that names are properly
affected by path remapping.
Fixes: https://github.com/llvm/llvm-project/issues/62192
Differential Revision: https://reviews.llvm.org/D149272
Mark de Wever [Mon, 1 May 2023 15:50:55 +0000 (17:50 +0200)]
[libc++][ranges] Fixes as_rvalue's linkage.
This was discovered while working on modules. They can't export
declarations with internal linkage.
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D149593
Adrian Prantl [Tue, 2 May 2023 15:37:40 +0000 (08:37 -0700)]
Add missing include
Spenser Bauman [Tue, 2 May 2023 15:17:45 +0000 (08:17 -0700)]
[mlir][tosa] Fix crash when inferring shape of tosa.equal
The tosa-infer-shapes pass crashes when trying to infer the output shape
of tosa.equal when the input shape is unranked.
This is due to tosa-infer-shapes requiring at least information on the
base type of the resulting operation from inferReturnTypeComponents.
This change enhances EqualOp::inferReturnTypeComponents to always supply
the inferred elementType.
Reviewed By: eric-k256
Differential Revision: https://reviews.llvm.org/D149582
NAKAMURA Takumi [Mon, 17 Apr 2023 14:46:47 +0000 (23:46 +0900)]
Switch `llvm/CodeGen/MachineValueType.h` to the generated one
Prune `SupportTests/MVTTest` since it is no longer needed.
Depends on D148769
Differential Revision: https://reviews.llvm.org/D148770
NAKAMURA Takumi [Mon, 17 Apr 2023 14:46:47 +0000 (23:46 +0900)]
Split out `CodeGenTypes` from `CodeGen` for LLT/MVT
This reduces dependencies on `llvm-tblgen` so much.
`CodeGenTypes` depends on `Support` at the moment.
Be careful to append deps on this, since Targets' tablegens
depend on this.
Depends on D149024
Differential Revision: https://reviews.llvm.org/D148769
NAKAMURA Takumi [Mon, 10 Apr 2023 15:05:24 +0000 (00:05 +0900)]
Restore CodeGen/MachineValueType.h from `Support`
This is rework of;
- rG13e77db2df94 (r328395; MVT)
Since `LowLevelType.h` has been restored to `CodeGen`, `MachinveValueType.h`
can be restored as well.
Depends on D148767
Differential Revision: https://reviews.llvm.org/D149024
NAKAMURA Takumi [Mon, 10 Apr 2023 15:05:24 +0000 (00:05 +0900)]
Restore CodeGen/LowLevelType from `Support`
This is rework of;
- D30046 (LLT)
Since I have introduced `llvm-min-tblgen` as D146352, `llvm-tblgen`
may depend on `CodeGen`.
`LowLevlType.h` originally belonged to `CodeGen`. Almost all userse are
still under `CodeGen` or `Target`. I think `CodeGen` is the right place
to put `LowLevelType.h`.
`MachineValueType.h` may be moved as well. (later, D149024)
I have made many modules depend on `CodeGen`. It is consistent but
inefficient. It will be split out later, D148769
Besides, I had to isolate MVT and LLT in modmap, since
`llvm::PredicateInfo` clashes between `TableGen/CodeGenSchedule.h`
and `Transforms/Utils/PredicateInfo.h`.
(I think better to introduce namespace llvm::TableGen)
Depends on D145937, D146352, and D148768.
Differential Revision: https://reviews.llvm.org/D148767
NAKAMURA Takumi [Tue, 2 May 2023 15:09:30 +0000 (00:09 +0900)]
[Bazel] Update for D148308 (riscv-sifive)
Erich Keane [Tue, 2 May 2023 15:09:26 +0000 (08:09 -0700)]
Revert "[Clang][Sema] Fix comparison of constraint expressions"
This reverts commit
e3b1083e00e62f5d157d15cb8c63a1c3dfdf12e2.
This was reverted because it breaks a number of libstdc++ examples, AND
required a workaround that causes hiding of legitimate bugs.
Erich Keane [Tue, 2 May 2023 15:09:01 +0000 (08:09 -0700)]
Revert "[Clang][Sema] Add a temporary workaround in SemaConcept.cpp"
This reverts commit
ce861ec782ae3f41807b61e855512aaccf3c2149.
Jakub Kuderski [Tue, 2 May 2023 14:48:01 +0000 (10:48 -0400)]
[mlir][arith] Add narrowing patterns for `max*i` and `min*i`
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D149583
Teresa Johnson [Tue, 2 May 2023 02:04:00 +0000 (19:04 -0700)]
[ThinLTO] Loosen up variable importing correctness checks
After importing variables, we do some checking to ensure that variables
marked read or write only, which have been marked exported (e.g.
because a referencing function has been exported), are on at least one
module's imports list. This is because the read or write only variables
will be internalized, so we need a copy any any module that references
it.
This checking is overly conservative in the case of linkonce_odr or
other linkage types where there can already be a duplicate copy in
existence in the importing module, which therefore wouldn't need to
import it. Loosen up the checking for these linkage types.
Fixes https://github.com/llvm/llvm-project/issues/62468.
Differential Revision: https://reviews.llvm.org/D149630
Jakub Kuderski [Tue, 2 May 2023 14:41:05 +0000 (10:41 -0400)]
[mlir][arith] Add narrowing patterns for subi, divsi, and divui
Each of these ops is compatible with only one extension kind and
produces an extra result bit.
I checked these transformation in Alive2:
1. subi + extsi: https://alive2.llvm.org/ce/z/ipmZZA
2. divsi + extsi: https://alive2.llvm.org/ce/z/fAcqUv
3. divui + extui: https://alive2.llvm.org/ce/z/QZJpFp
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D149531
Cullen Rhodes [Tue, 2 May 2023 14:30:02 +0000 (14:30 +0000)]
[mlir][SparseTensor][ArmSVE] Fix missing lli substitutions
The MLIR SVE integration tests are now enabled in the
clang-aarch64-full-2stage buildbot under emulation (QEMU) and two of the
sparse integration tests are failing [1]:
* mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sorted_coo.mlir
* mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_spmm.mlir
The reason for this is the SVE RUN lines use plain 'lli' rather than the
'%lli_host_or_aarch64_cmd' substitution that's necessary to run under
emulation. The CI doesn't support SVE so the tests will SIGILL unless
run under emulation.
I should note the logs don't show a SIGILL, only the non-descript:
FileCheck error: '<stdin>' is empty.
but I expect this is what's actually happening.
https://lab.llvm.org/buildbot/#/builders/179/builds/6051/steps/12/logs/stdio
Joseph Huber [Tue, 2 May 2023 11:39:14 +0000 (06:39 -0500)]
[libc] Fix some missing features from the hermetic test support
This patch addresses some of the flags and features that are currently
missing from the hermetic test support. This mostly just fixes the
`add_libc_test` option failing to find a few dependencies or missing
arguments from the previous unit test support.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D149629
Job Noorman [Tue, 2 May 2023 14:22:48 +0000 (16:22 +0200)]
[BOLT] Make sure Mach-O binaries are actually linked
Note that this issue is also solved by D147544.
Reviewed By: alexander-shaposhnikov
Differential Revision: https://reviews.llvm.org/D149244
Job Noorman [Tue, 2 May 2023 13:43:37 +0000 (15:43 +0200)]
[BOLT] Make sure all section allocations have deterministic contents
For empty sections, RuntimeDyld always allocates 1 byte but leaves it
uninitialized. This causes the contents of some output sections to be
non-deterministic.
Note that this issue is also solved by D147544.
Fixes #59008
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D149243
Jakub Kuderski [Tue, 2 May 2023 14:09:51 +0000 (10:09 -0400)]
[mlir][arith] Add narrowing patterns for `addi` and `muli`
These two ops are handled in a very similar way -- the only difference
in the number result bits produced.
I checked these transformation with Alive2:
1. addi + sext: https://alive2.llvm.org/ce/z/3NSs9T
2. addi + zext: https://alive2.llvm.org/ce/z/t7XHOT
3. muli + sext: https://alive2.llvm.org/ce/z/-7sfW9
4. muli + zext: https://alive2.llvm.org/ce/z/h4yntF
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D149530
Jay Foad [Tue, 2 May 2023 13:38:27 +0000 (14:38 +0100)]
[CodeGen] One more use of MachineBasicBlock::phis. NFC.
Joel E. Denny [Tue, 2 May 2023 13:44:58 +0000 (09:44 -0400)]
[OpenMP] In libomptarget, assume alignment at powers of two
This patch fixes a bug introduced by D142586, which landed as
434992c96ed1. The fix was to only look for alignments that are powers
of 2. See the new test case for details.
Reviewed By: jdoerfert, jhuber6
Differential Revision: https://reviews.llvm.org/D149490
Alexey Lapshin [Fri, 31 Mar 2023 15:10:11 +0000 (17:10 +0200)]
[DWARFLinker][NFC] Make interfaces to be compatible.
This patch makes interface of AddressManager from DWARFLinker
to be compatible with AddressesMap from DWARFLinkerParallel.
This makes both linkers to be interchangeable.
Differential Revision: https://reviews.llvm.org/D147455
4vtomat [Sat, 18 Mar 2023 12:15:24 +0000 (05:15 -0700)]
[RISCV][RISCV][clang] Split out SiFive Vector C intrinsics from riscv_vector.td
Since we don't always need the vendor extension to be in riscv_vector.td,
so it's better to make it be in separated header.
Depends on D148223 and D148680
Differential Revision: https://reviews.llvm.org/D148308
Alexandre Ganea [Tue, 2 May 2023 12:49:35 +0000 (08:49 -0400)]
[llvm][unittests] Silence warning on MSVC after
5b2423183cb3
Differential revision: https://reviews.llvm.org/D149609
Dmitry Chernenkov [Tue, 2 May 2023 12:45:28 +0000 (12:45 +0000)]
4vtomat [Wed, 19 Apr 2023 02:43:57 +0000 (19:43 -0700)]
[RISCV] Split out part of riscv_vector.td to riscv_vector_common.td
This makes other new targets able to reuse predefined classes
in their own *.td files.
Differential Revision: https://reviews.llvm.org/D148680
Nelson Chu [Wed, 18 May 2022 10:03:34 +0000 (03:03 -0700)]
[SiFive][RISCV][clang] Support C intrinsics for xsfvcp extension.
Depends on D147934 and D147935
Differential Revision: https://reviews.llvm.org/D148223
Jay Foad [Tue, 2 May 2023 12:29:51 +0000 (13:29 +0100)]
[CodeGen] Make use of MachineBasicBlock::phis. NFC.
Shilei Tian [Tue, 2 May 2023 12:35:55 +0000 (08:35 -0400)]
Revert "[OpenMP] Make `libomptarget` link against `libomp`"
This reverts commit
dc049a4ea681b1d0a4880bae3e19ae0ef40f6e80.
It causes issue of export target.
Mariya Podchishchaeva [Tue, 2 May 2023 12:20:29 +0000 (08:20 -0400)]
[clang] Do not attempt to zero-extend _BitInt(1) when not required
`ConvertTypeForMem` doesn't return wider type for _BitInt unless it is
used in a bitfield, so no need to extend when trying to initialize a
global variable.
Fixes https://github.com/llvm/llvm-project/issues/62207
Reviewed By: erichkeane, shafik
Differential Revision: https://reviews.llvm.org/D149436
Zhiyao Ma [Tue, 2 May 2023 09:23:19 +0000 (10:23 +0100)]
[ARM] Don't allocate memory if free space in segmented stack is just enough
Assuming that the stack grows downwards, it is fine if the stack
pointer is exactly at the stacklet boundary. We should use
less-or-equal condition when deciding whether to skip new memory
allocation.
Differential Revision: https://reviews.llvm.org/D149315
Kiran Chandramohan [Tue, 2 May 2023 11:29:42 +0000 (11:29 +0000)]
[Flang][OpenMP] Use fir.if instead of scf.if in lastprivate lowering
For finding the last iteration of a loop, or the last section an
if condition is generated. Using scf::if can cause some lowering
issues since the code contained inside it can have branches. Using
fir::if instead ensures that the fir::if is lowered into branches
along with any code contained inside that can generate branches.
Fixes #62458.
Reviewed By: NimishMishra
Differential Revision: https://reviews.llvm.org/D149547
Michael Buch [Mon, 1 May 2023 17:09:54 +0000 (13:09 -0400)]
[lldb][test] TestCPP20Standard.py: make it a libc++ test
We just want to test whether the language switch works.
This is easier to control for libc++, since for bots building
the tests against libstdc++ we might not have the necessary
`<compare>` header available currently.
LU Hongyi [Mon, 1 May 2023 11:05:47 +0000 (07:05 -0400)]
[lldb][DWARFExpression] Fix DW_OP_div to use signed division
This patch resolves an issue where a value
is incorrectly displayed if it is represented
by DW_OP_div.
This issue is caused by lldb evaluating
operands of DW_OP_div as unsigned
and performed unintended unsigned
division.
This issue is resolved by creating two
temporary signed scalar and performing
signed division.
(Addresses GH#61727)
Differential Revision: https://reviews.llvm.org/D147370