esmeyi [Tue, 22 Nov 2022 12:17:44 +0000 (07:17 -0500)]
[XCOFF] set fragment for XMC_PR csects.
Summary: -xcoff-traceback-table is a default option on AIX regardless of optimization and debug levels. An error of relocation for paired relocatable term is not yet supported in XCOFFObjectWriter::recordRelocation occurred when both of the -xcoff-traceback-table and -function-sections are enabled.
The root cause is that we missed to calculate the symbols difference as absolute value before adding fixups when symbol_A without the fragment set is the csect itself and symbol_B is in it.
This patch only sets the fragment for XMC_PR csects because we don't have other cases that hit this problem yet.
Reviewed By: DiggerLin, hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/D137230
Yi Kong [Tue, 22 Nov 2022 11:11:42 +0000 (20:11 +0900)]
Revert "[libc++] Remove workarounds for systems that used to require __need_XXX macros"
This reverts commit
119cef40d18c48240854edc553dca61c4e9fdf27.
The change broke multiple builders.
Manuel Brito [Tue, 22 Nov 2022 11:40:06 +0000 (11:40 +0000)]
[CodeGen] Use poison instead of undef as placeholder in AtomicExpandPass [NFC]
Differential Revision: https://reviews.llvm.org/D138483
Stefan Gränitz [Tue, 22 Nov 2022 09:13:33 +0000 (10:13 +0100)]
[CGObjC] Open cleanup scope before SaveAndRestore CurrentFuncletPad and push CatchRetScope early
Pushing the `CatchRetScope` early causes cleanups for catch parameters to be emitted in the basic block of the catch handler instead of the `catchret.dest` block. This is important because the latter is not part of the catchpad and this caused code truncations due to ARC PreISel intrinsics in WinEHPrepare.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D137939
Piotr Sobczak [Tue, 22 Nov 2022 09:35:07 +0000 (10:35 +0100)]
[AMDGPU] Add encoding tests for SALU_CYCLE_2/3
Add missing assembler/disassembler tests for INSTID_SALU_CYCLE_2
and INSTID_SALU_CYCLE_3 which are possible arguments in S_DELAY_ALU.
Differential Revision: https://reviews.llvm.org/D138482
Lorenzo Chelini [Tue, 22 Nov 2022 09:19:34 +0000 (10:19 +0100)]
[MLIR][Tensor] Use the existing helper function `applyPermutationToVector` (NFC)
Avoid duplicate code by using an existing helper function to interchange
a vector based on a permutation. Address comments emerged after landing
D138119.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D138480
Matthias Springer [Tue, 22 Nov 2022 10:20:41 +0000 (11:20 +0100)]
[mlir][SCF] Add tensor.dim(scf.foreach_thread) folding
Dim sizes of `scf.foreach_thread` op results match the dim sizes of their respective tied shared_outs operands.
Differential Revision: https://reviews.llvm.org/D138484
Alexander Belyaev [Tue, 22 Nov 2022 09:58:23 +0000 (10:58 +0100)]
[mlir] Update custom<DynamicIndexList> for Pack/Unpack.
Alexander Belyaev [Tue, 22 Nov 2022 07:55:59 +0000 (08:55 +0100)]
[mlir] Clean-up ViewLikeOpInterface w.r.t. kDynamic change.
Differential Revision: https://reviews.llvm.org/D138478
Benjamin Kramer [Tue, 22 Nov 2022 09:46:52 +0000 (10:46 +0100)]
[bazel] Add missing dependency after
9aa505a28d
zhanghb97 [Fri, 11 Nov 2022 08:01:05 +0000 (16:01 +0800)]
[mlir] Initial MLIR VP intrinsic integration test on host and RVV emulator.
This patch adds the initial VP intrinsic integration test on the host backend and RVV emulator. Please see more detailed [discussion on the discourse](https://discourse.llvm.org/t/mlir-vp-ops-on-rvv-backend-integration-test-and-issues-report/66343).
- Run the test cases on the host by configuring the CMake option: `-DMLIR_INCLUDE_INTEGRATION_TESTS=ON`
- Build the RVV environment and run the test cases on RVV QEMU by [this doc](https://gist.github.com/zhanghb97/
ad44407e169de298911b8a4235e68497).
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D137816
Han-Kuan Chen [Tue, 8 Nov 2022 09:43:11 +0000 (01:43 -0800)]
[CodeGen] Refactor visitSCALAR_TO_VECTOR. NFC.
Differential Revision: https://reviews.llvm.org/D137688
WuXinlong [Mon, 21 Nov 2022 03:20:41 +0000 (11:20 +0800)]
[RISCV] Add CodeGen support and MC testcase of RISCV Zca Extension
This patch add the support of RISCV Zca ext
`Zca` is a subset of C extension instructions that are compatible with the Zc extension.
So this patch implements Zca code generation with reference to the C extension and sets the 2-byte alignment for the Zca extension, just like C extension does.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D130483
Pierre van Houtryve [Tue, 22 Nov 2022 09:13:57 +0000 (09:13 +0000)]
[AMDGPU] Make aperture registers 64 bit
Makes the SRC_(SHARED|PRIVATE)_(BASE|LIMIT) registers 64 bit instead of 32.
They're still usable as 32 bit operands by using the _LO suffix.
Preparation for D137542
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D137767
Valentin Clement [Tue, 22 Nov 2022 09:11:50 +0000 (10:11 +0100)]
Revert "[flang][NFC] Switch CollectBindings return to SymbolVector"
This reverts commit
97e8eeb758fcae4f2afd9ac516ffc9509b4daaf0.
Max Kazantsev [Tue, 22 Nov 2022 08:52:49 +0000 (15:52 +0700)]
[SCEV][NFC] Introduce API for getting basic block's symbolic max exit count
Currently, it just returns exact exit count. This is a refectoring step
before it is actually implemented.
gonglingqin [Tue, 22 Nov 2022 08:16:09 +0000 (16:16 +0800)]
[LoongArch] Fix issue on CMake Xcode build configuration
Add missing dependency for loongarch-resource-headers. This patch refers to D126892 to repair same error.
Differential Revision: https://reviews.llvm.org/D138403
Valentin Clement [Tue, 22 Nov 2022 08:42:32 +0000 (09:42 +0100)]
[flang][NFC] Switch CollectBindings return to SymbolVector
As suggested on D138129, switching rteurn of CollectBindings
function to SymbolVector.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D138419
Valentin Clement [Tue, 22 Nov 2022 08:41:09 +0000 (09:41 +0100)]
[flang] Do not propagate type desc when box type is not polymorphic
When the rhs is non-polymorphic the type descriptor should not
be propagated. An error in the EmboxOp verifier was raised in that case.
This patch propagate the type descriptor only if the result type of the
EmboxOp operation is polymorphic.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D138442
Alvin Wong [Tue, 22 Nov 2022 08:33:35 +0000 (16:33 +0800)]
[libcxx] Fix std::equal not accepting volatile types by refactoring __equal_to
Fixes https://github.com/llvm/llvm-project/issues/59021
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D138268
Max Kazantsev [Tue, 22 Nov 2022 08:18:05 +0000 (15:18 +0700)]
[SCEV][NFC] Call getExitCount with SymbolicMaximum when computing loop symbolic max
Currently this is NFC, because SymbolicMaximum for BB is not implemented and just
reuses exact result. However, from code purity perspective, it's a necessary step
to do. Plans to implement symbolic max for blocks are underway.
Pierre van Houtryve [Tue, 22 Nov 2022 08:23:29 +0000 (08:23 +0000)]
[AMDGPU][GISel] Add llvm.amdgcn.icmp selection
Add missing logic to select i16 variants and enable GISel testing.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D136448
Lorenzo Chelini [Tue, 15 Nov 2022 09:30:50 +0000 (10:30 +0100)]
Introduce `tensor.pack` and `tensor.unpack` operations
Pack and Unpack return new tensors within which the individual elements
are reshuffled according to the packing specification. This has the
consequence of modifying the canonical order in which a given operator
(i.e., Matmul) accesses the individual elements. After bufferization,
this typically translates to increased access locality and cache
behavior improvement, e.g., eliminating cache line splitting.
Co-authored-by: Mahesh Ravishankar <ravishankarm@google.com>
Co-authored-by: Han-Chung Wang <hanchung@google.com>
RFC: https://discourse.llvm.org/t/rfc-tensor-pack-and-tensor-unpack/66408/1
Reviewed By: nicolasvasilache, rengolin, hanchung
Differential Revision: https://reviews.llvm.org/D138119
Chen Zheng [Tue, 22 Nov 2022 07:40:30 +0000 (02:40 -0500)]
[PowerPC][GISel]add support for float point arithmetic operations
Add global isel support for G_FADD, G_FSUB, G_FMUL, G_FDIV.
Reviewed By: Kai, nemanjai, arsenm, amyk
Differential Revision: https://reviews.llvm.org/D132942
gonglingqin [Tue, 22 Nov 2022 07:23:49 +0000 (15:23 +0800)]
[LoongArch] Support when the depth of __builtin_frame_address is greater than zero
As discussed in D137541, it supports processing when the depth of
__builtin_frame_address is greater than 0 instead of reporting an error.
Unsafe calls rely on the '-Wframe-address' option for diagnosis.
Differential Revision: https://reviews.llvm.org/D138084
Chen Zheng [Tue, 22 Nov 2022 07:23:10 +0000 (07:23 +0000)]
[PowerPC] store the LR before stack update for big offsets.
For case that LROffset + FrameSize can not be encoded to the LR
store instruction, we have to store the LR before the stack update.
Chen Zheng [Tue, 22 Nov 2022 07:17:20 +0000 (07:17 +0000)]
[PowerPC][NFC] add test case for mflr store fix
David Green [Tue, 22 Nov 2022 07:23:56 +0000 (07:23 +0000)]
[LoopFlatten] Fix IV increment use count
The add from the IV in the inner loop was always checking for 2 uses,
the phi and the compare. The compare could be based on the phi though,
leaving one valid use of the compare. In the testcase we could be left
with the phi and a lcssa phi as the two users, invalidly allowing
flattening where we shouldn't.
Fixes 58441
Differential Revision: https://reviews.llvm.org/D138404
Mahesh Ravishankar [Wed, 16 Nov 2022 07:52:34 +0000 (07:52 +0000)]
[mlir][Linalg] Avoid unnecessary propagating producer result to fused op result.
Elementwise op fusion conserves the result of the producer in the
fused op, relying on later clean up patterns to drop unused results of
the fused op. Instead, if the producer result has no other use apart
from the consumer op, avoid making the producer result available in
the fused node. This saves some unnecessary IR manipulations.
Differential Revision: https://reviews.llvm.org/D138096
Max Kazantsev [Tue, 22 Nov 2022 05:53:37 +0000 (12:53 +0700)]
[IndVarSimplify] Lift limitations on IV being a Phi for turn-to-invariant
These limitations are too strict, and their only purpose is to avoid code
size explosion. These restrictions seem obsolete, and the size problem
is solved in other places through cheap expansion limits.
The motivation is that the old code cannot deal with comparisons against
induction variant's increment.
Differential Revision: https://reviews.llvm.org/D138412
Reviewed By: lebedev.ri, reames
KAWASHIMA Takahiro [Mon, 14 Nov 2022 05:09:27 +0000 (14:09 +0900)]
[clang] Fix -fp-model={strict|precise} to disable -fapprox-func
`-fapprox-func` should be disabled by `-fp-model={strict|precise}`,
as well as other fast-math flags. See the last changes in
`clang/test/Driver/fp-model.c`.
Probably this route (`case options::OPT_ffp_model_EQ`) was forgot
to update in D106191 and D114564. There is no appropriate reason not
to disable the flag.
This commit also updates other regression tests, which are not directly
related to this bug, for consistency with other fast-math flags.
Differential Revision: https://reviews.llvm.org/D138109
Craig Topper [Tue, 22 Nov 2022 03:23:08 +0000 (19:23 -0800)]
[RISCV] Remove SExtWRemovalCands set from RISCVSExtWRemoval.
After D137970, we do the fixable instruction conversion in place
so we don't need to worry about iterator invalidation. This lets
us to conversion and updates in a single loop.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D138043
Craig Topper [Tue, 22 Nov 2022 03:22:51 +0000 (19:22 -0800)]
[RISCV] Transform fixable instruction in place in RISCVSExtWRemoval. NFC
Instead of creating a new instruction and copying operands, we can
use setDesc to convert in place.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D137970
Craig Topper [Tue, 22 Nov 2022 03:16:40 +0000 (19:16 -0800)]
[RISCV] Prevent constant hoisting for (and (shl X, C), mask<<C)
If the immediate is a shifted mask, we will use a pair of shifts
and never materialize the immediate. Consider the immediate free.
Reviewed By: reames, luismarques
Differential Revision: https://reviews.llvm.org/D138260
Kazu Hirata [Tue, 22 Nov 2022 03:06:42 +0000 (19:06 -0800)]
Return None instead of Optional<T>() (NFC)
This patch replaces:
return Optional<T>();
with:
return None;
to make the migration from llvm::Optional to std::optional easier.
Specifically, I can deprecate None (in my source tree, that is) to
identify all the instances of None that should be replaced with
std::nullopt.
Note that "return None" far outnumbers "return Optional<T>();". There
are more than 2000 instances of "return None" in our source tree.
All of the instances in this patch come from functions that return
Optional<T> except Archive::findSym and ASTNodeImporter::import, where
we return Expected<Optional<T>>. Note that we can construct
Expected<Optional<T>> from any parameter convertible to Optional<T>,
which None certainly is.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Differential Revision: https://reviews.llvm.org/D138464
Kazu Hirata [Tue, 22 Nov 2022 03:03:40 +0000 (19:03 -0800)]
Don't use Optional::getPointer (NFC)
Since std::optional does not offer getPointer(), this patch replaces
X.getPointer() with &*X to make the migration from llvm::Optional to
std::optional easier.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Differential Revision: https://reviews.llvm.org/D138466
Phoebe Wang [Tue, 22 Nov 2022 01:48:43 +0000 (09:48 +0800)]
[X86] Allow no X87 on 32-bit
This patch is an alternative of D100091. It solved the problems in `f80` type lowering.
Reviewed By: LuoYuanke
Differential Revision: https://reviews.llvm.org/D137946
Vitaly Buka [Tue, 22 Nov 2022 02:44:43 +0000 (18:44 -0800)]
[test][asan] Another try to fix Windows bot
Update pattern on Linux and Darwin for consistency.
Stephen Neuendorffer [Tue, 22 Nov 2022 02:03:30 +0000 (18:03 -0800)]
[llvm-link] Fix options of llvm-link
This tool only parsed options after creating the LLVMContext.
Unfortunately, this means that some options, such as --opaque-pointers,
which are read when the LLVMContext is created are impossible to
set from the command line. This patch moves the LLVMContext creation
after the option parsing.
Vitaly Buka [Tue, 22 Nov 2022 01:45:51 +0000 (17:45 -0800)]
[test][asan] Replace tr with sed
tr is not available on Windows bot.
Nico Weber [Tue, 22 Nov 2022 01:48:11 +0000 (20:48 -0500)]
[gn build] Add missing dep from check-bolt on llvm-bat-dump
KAWASHIMA Takahiro [Wed, 16 Nov 2022 04:57:52 +0000 (13:57 +0900)]
[clang][docs] Correct indent of option explanation
Indentation is significant for Sphinx. Lines with indentation after
a `.. option::` line are treated as explanations of the option.
KAWASHIMA Takahiro [Wed, 16 Nov 2022 04:56:27 +0000 (13:56 +0900)]
[clang][docs] Remove an unnecessary space
KAWASHIMA Takahiro [Wed, 16 Nov 2022 04:23:51 +0000 (13:23 +0900)]
[clang][docs] Use `option` directive in User's Manual
Sphinx has the `option` directive. Most option descriptions
in `clang/docs/UsersManual.rst` used it but some didn't.
This commit changes the remaining option descriptions to use
the `option` directive. This makes a consistent view in HTML.
The `option` directive automatically creates a cross-reference target.
So labeling by `.. _opt_XXX:` is almost unnecessary. However, options
with and without `no-` (e.g. `-fno-show-column`/`-fshow-column`)
cannot be distinguish for the cross-reference. So some required
`.. _opt_XXX:` directives are kept unremoved.
Differential Revision: https://reviews.llvm.org/D138088
Vitaly Buka [Tue, 22 Nov 2022 01:36:47 +0000 (17:36 -0800)]
[test][asan] Try to fix Windows bot
Peiming Liu [Wed, 16 Nov 2022 23:18:16 +0000 (23:18 +0000)]
[mlir][sparse] support affine expression on dense dimensions (except constant affine)
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D138169
Christopher Di Bella [Thu, 17 Nov 2022 07:36:37 +0000 (07:36 +0000)]
[libcxx] adds an include-what-you-use (IWYU) mapping file
This makes it possible for programmers to run IWYU and get more accurate
standard library inclusions. Prior to this commit, the following program
would be transformed thusly:
```cpp
// Before
#include <algorithm>
#include <vector>
void f() {
auto v = std::vector{0, 1};
std::find(std::ranges::begin(v), std::ranges::end(v), 0);
}
```
```cpp
// After
#include <__algorithm/find.h>
#include <__ranges/access.h>
#include <vector>
...
```
There are two ways to fix this issue: to use [comment pragmas](https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUPragmas.md)
on every private include, or to write a canonical [mapping file](https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUMappings.md)
that provides the tool with a manual on how libc++ is laid out. Due to
the complexity of libc++, this commit opts for the latter, to maximise
correctness and minimise developer burden.
To mimimise developer updates to the file, it makes use of wildcards
that match everything within listed subdirectories. A script has also
been added to ensure that the mapping is always fresh in CI, and makes
the process a single step.
Finally, documentation has been added to inform users that IWYU is
supported, and what they need to do in order to leverage the mapping
file.
Closes #56937.
Differential Revision: https://reviews.llvm.org/D138189
Kazu Hirata [Tue, 22 Nov 2022 01:00:50 +0000 (17:00 -0800)]
[AArch64] Remove emitCalleeSavedFrameMoves
The last use of emitCalleeSavedFrameMoves was removed on March 24,
2022 in commit
50a97aacacf689f838451439d913421d608e1bed.
Differential Revision: https://reviews.llvm.org/D138388
Evgenii Stepanov [Tue, 22 Nov 2022 00:56:53 +0000 (16:56 -0800)]
Revert "[scudo] Detect double free when running with MTE."
Mysterious failures on the x86_64-linux-qemu, to be debugged.
This reverts commit
1dd54691b20d8bf65156cdf35d241cfcd684cb54.
Aart Bik [Sat, 19 Nov 2022 00:57:02 +0000 (16:57 -0800)]
[mlir][sparse][vector] ensure loop peeling to remove vector masks works
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D138343
Nico Weber [Fri, 18 Nov 2022 13:48:30 +0000 (08:48 -0500)]
[gn build] Add build files for //bolt
Adds build files for libraries, tools, and tests -- everything except
the runtime.
Doesn't hook up bolt in the main BUILD.gn file yet -- I want to verify
that it builds on Linux, macOS, Windows before doing that. (I've only
checked on macOS so far.)
`ninja check-bolt` passes on macOS with this.
(I locally bumped the deployment target to macOS 10.12 for that. bolt/ uses
std::mutex quite a bit, which requires 10.12.)
Differential Revision: https://reviews.llvm.org/D138355
Advenam Tacet [Sun, 20 Nov 2022 01:34:46 +0000 (17:34 -0800)]
[1a/3][ASan][compiler-rt] API for double ended containers
This revision is a part of a series of patches extending
AddressSanitizer C++ container overflow detection capabilities by adding
annotations, similar to those existing in std::vector, to std::string
and std::deque collections. These changes allow ASan to detect cases
when the instrumented program accesses memory which is internally
allocated by the collection but is still not in-use (accesses before or
after the stored elements for std::deque, or between the size and
capacity bounds for std::string).
The motivation for the research and those changes was a bug, found by
Trail of Bits, in a real code where an out-of-bounds read could happen
as two strings were compared via a std::equals function that took
iter1_begin, iter1_end, iter2_begin iterators (with a custom comparison
function). When object iter1 was longer than iter2, read out-of-bounds
on iter2 could happen. Container sanitization would detect it.
This revision adds a new compiler-rt ASan sanitization API function
sanitizer_annotate_double_ended_contiguous_container necessary to
sanitize/annotate double ended contiguous containers. Note that that
function annotates a single contiguous memory buffer (for example the
std::deque's internal chunk). Such containers have the beginning of
allocated memory block, beginning of the container in-use data, end of
the container's in-use data and the end of the allocated memory block.
This also adds a new API function to verify if a double ended contiguous
container is correctly annotated
(__sanitizer_verify_double_ended_contiguous_container).
Since we do not modify the ASan's shadow memory encoding values, the
capability of sanitizing/annotating a prefix of the internal contiguous
memory buffer is limited – up to SHADOW_GRANULARITY-1 bytes may not be
poisoned before the container's in-use data. This can cause false
negatives (situations when ASan will not detect memory corruption in
those areas).
On the other hand, API function interfaces are designed to work even if
this caveat would not exist. Therefore implementations using those
functions will poison every byte correctly, if only ASan (and
compiler-rt) is extended to support it. In other words, if ASan was
modified to support annotating/poisoning of objects lying on addresses
unaligned to SHADOW_GRANULARITY (so e.g. prefixes of those blocks),
which would require changing its shadow memory encoding, this would not
require any changes in the libcxx std::string/deque code which is added
in further commits of this patch series.
If you have any questions, please email:
advenam.tacet@trailofbits.com
disconnect3d@trailofbits.com
Differential Revision: https://reviews.llvm.org/D132090
Vitaly Buka [Tue, 22 Nov 2022 00:22:38 +0000 (16:22 -0800)]
[test][asan] Ignore new lines in header
Vitaly Buka [Sun, 20 Nov 2022 06:24:46 +0000 (22:24 -0800)]
[test][asan] Limit scope of the var
Nico Weber [Mon, 21 Nov 2022 13:45:45 +0000 (08:45 -0500)]
[bolt] Use llvm::sys::RWMutex instead of std::shared_timed_mutex
This has the following advantages:
- std::shared_timed_mutex is macOS 10.12+ only. llvm::sys::RWMutex
automatically switches to a different implementation internally
when targeting older macOS versions.
- bolt only needs std::shared_mutex, not std::shared_timed_mutex.
llvm::sys::RWMutex automatically uses std::shared_mutex internally
where available.
std::shared_mutex and RWMutex have the same API, so no code changes
other than types and includes are needed.
Differential Revision: https://reviews.llvm.org/D138423
Aart Bik [Fri, 18 Nov 2022 20:18:00 +0000 (12:18 -0800)]
[mlir][sparse] introduce vectorization pass for sparse loops
This brings back previous SIMD functionality, but in a separate pass.
The idea is to improve this new pass incrementally, going beyond for-loops
to while-loops for co-iteration as welll (masking), while introducing new
abstractions to make the lowering more progressive. The separation of
sparsification and vectorization is a very good first step on this journey.
Also brings back ArmSVE support
Still to be fine-tuned:
+ use of "index" in SIMD loop (viz. a[i] = i)
+ check that all ops really have SIMD support
+ check all forms of reductions
+ chain reduction SIMD values
Reviewed By: dcaballe
Differential Revision: https://reviews.llvm.org/D138236
David Blaikie [Mon, 21 Nov 2022 23:59:21 +0000 (23:59 +0000)]
pr59000: Clarify packed-non-pod warning that it's pod-for-the-purposes-of-layout
Kai Nacke [Mon, 21 Nov 2022 20:47:52 +0000 (20:47 +0000)]
[PowerPC] Add support for G_ADD and G_SUB.
Extends the global isel implementation to support G_ADD and G_SUB.
Reviewed By: arsenm, amyk
Differential Revision: https://reviews.llvm.org/D128106
Louis Dionne [Mon, 21 Nov 2022 14:50:31 +0000 (09:50 -0500)]
[libc++][NFC] Add missing conditionals for the existence of wide characters
Differential Revision: https://reviews.llvm.org/D138435
Quentin Colombet [Mon, 21 Nov 2022 17:37:39 +0000 (17:37 +0000)]
[mlir][MemRef] NFC rename simplify-extract-strided-metadata
This pass has outgrown its original goal and is now going to be used to
expand certain memref operations before lowering.
Reflect that in the name.
The pass is now called expand-strided-metadata.
NFC
Differential Revision: https://reviews.llvm.org/D138448
Saleem Abdulrasool [Tue, 15 Nov 2022 15:44:34 +0000 (15:44 +0000)]
parse: process GNU and standard attributes on top-level decls
We would previously reject valid input where GNU attributes preceded the
standard attributes on top-level declarations. A previous attribute
handling change had begun rejecting this whilst GCC does honour this
layout. In practice, this breaks use of `extern "C"` attributed
functions which use both standard and GNU attributes as experienced by
the Swift runtime.
Objective-C deserves an honourable mention for requiring some additional
special casing. Because attributes on declarations and definitions
differ in semantics, we need to replicate some of the logic for
detecting attributes to declarations to which they appertain cannot be
attributed. This should match the existing case for the application of
GNU attributes to interfaces, protocols, and implementations.
Take the opportunity to split out the tooling tests into two cases: ones
which process macros and ones which do not.
Special thanks to Aaron Ballman for the many hints and extensive rubber
ducking that was involved in identifying the various places where we
accidentally dropped attributes.
Differential Revision: https://reviews.llvm.org/D137979
Fixes: #58229
Reviewed By: aaron.ballman, arphaman
John Baldwin [Mon, 21 Nov 2022 22:34:07 +0000 (14:34 -0800)]
[libc++] <type_traits>: Avoid instantiating a pointer type.
GCC expands the pointer type in this conditional expression even for
template types _Up that are not arrays. This raises an error when
std::decay<> is used with reference types (as is done in LLVM's
sources). Using add_pointer<> causes GCC to only instantiate a
pointer type for array types.
Reviewed By: #libc, philnik, ldionne
Differential Revision: https://reviews.llvm.org/D135469
Heejin Ahn [Wed, 16 Nov 2022 01:30:07 +0000 (17:30 -0800)]
[WebAssembly] Disable register coalescing at -O1
This disables `RegisterCoalescer` pass at -O1, which currently runs for
all levels except for -O0, as a part of common optimization pipeline.
`RegisterCoalescer` pass degrades Wasm debug info quality by a
significant margin. When I use `LiveDebugValue` analysis, disabling this
increases the average PC ranges covered by 15% on Emscripten core
benchmarks (52% -> 66.8%). (Our code is currently not using
`LiveDebugValues` analysis at the moment, and the experiment was done on
a local setting that enabled it. I'm planning to upstream it soon.)
In Emscripten core benchmarks, disabling this at -O1 causes +4.5% in
code size and +1% in the number of locals. The number of globals stays
the same. I believe this tradeoff is acceptable given that -O1 is not
usually used in production builds and is often used for debugging when
the application size is very large.
The plan is to investigate and fix what's causing the degradation in
that pass, but for now disabling it seems like a low-hanging quick fix.
Reviewed By: dschuff
Differential Revision: https://reviews.llvm.org/D138455
Florian Hahn [Mon, 21 Nov 2022 21:56:14 +0000 (21:56 +0000)]
[SCEV] Iteratively compute ranges for deeply nested expressions.
At the moment, getRangeRef may overflow the stack for very deeply nested
expressions.
This patch introduces a new getRangeRefIter function, which first builds
a worklist of N-ary expressions and phi nodes, followed by their
operands iteratively.
getRangeRef has been extended to also take a Depth argument and it
switches to use getRangeRefIter once the depth reaches a certain
threshold.
This ensures compile-time is not impacted in general. Note that
the iterative algorithm may lead to a slightly different evaluation
order, which could result in slightly worse ranges for cyclic phis.
https://llvm-compile-time-tracker.com/compare.php?from=
23c3eb7cdf3478c9db86f6cb5115821a8f0f5f40&to=
e0e09fa338e77e53242bfc846e1484350ad79773&stat=instructions
Fixes #49579.
Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D130728
Nikolas Klauser [Fri, 4 Nov 2022 15:36:34 +0000 (16:36 +0100)]
[libc++][math.h][NFC] Reformat functions
This is just to make to follow-up diffs simpler
Reviewed By: ldionne, #libc, EricWF
Spies: EricWF, libcxx-commits
Differential Revision: https://reviews.llvm.org/D137498
Benjamin Kramer [Mon, 21 Nov 2022 21:21:22 +0000 (22:21 +0100)]
[PowerPC] Move PPCGenRegisterBankInfo.def into the directory where it would be if it was autogenerated
Ji, Jinsong [Mon, 21 Nov 2022 21:11:24 +0000 (13:11 -0800)]
[clang-format] Support new file formatting with vim
The vim Formatonsave integration is not working if we create a new file directly using vim.
eg: vi -V9t.log t.cpp
It will not able to format the buffer.
> Traceback (most recent call last):
> File "<string>", line 1, in <module>
> File "...clang/tools/clang-format/clang-format.py", line 156, in <module>
> main()
> File "...clang/tools/clang-format/clang-format.py", line 80, in main
> with open(vim.current.buffer.name, 'r') as f:
> FileNotFoundError: [Errno 2] No such file or directory: '...t.cpp'
This patch check the file before we try to open it.
Reviewed By: owenpan
Differential Revision: https://reviews.llvm.org/D138234
Louis Dionne [Mon, 21 Nov 2022 16:04:05 +0000 (11:04 -0500)]
[libc++] Don't workaround GCC issue on non-GCC compilers
Differential Revision: https://reviews.llvm.org/D138438
Christian Kandeler [Mon, 21 Nov 2022 21:00:23 +0000 (22:00 +0100)]
[clangd] Mark "override" and "final" as modifiers
... in semantic highlighting.
These specifiers cannot be identified by simple lexing (since e.g.
variables with these names can legally be declared), which means they
should be semantic tokens.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D137943
Fangrui Song [Mon, 21 Nov 2022 20:51:52 +0000 (20:51 +0000)]
Restore global descriptor demangling after D138095 "[asan] Keep Itanium mangled names in global metadata"
This amends commit
00be3578e0841dd9abe408e5b4946180de0bf46b to demangle symbol
names in global descriptors. We keep the mangled name for the `__odr_gen_asan_*`
variables and the runtime __cxa_demangle call site change (which fixed possible
leaks for other scenarios: non-fatal diagnostics).
compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp uses
an undefined weak `__cxa_demangle` which does not pull in an archive definition.
A -static-libstdc++ executable link does not get demangled names.
Unfortunately this means we cannot rely on runtime demangling.
See compiler-rt/test/asan/TestCases/global-demangle.cpp
Dave Lee [Mon, 21 Nov 2022 20:31:59 +0000 (12:31 -0800)]
Reland "[lldb] Fix SBFileSpec.fullpath"
Update `fullpath` asserts in TestMiniDump.py.
This reverts commit
682fcc95f4149f00e9da961817fe2f5832e4b301.
Thomas Lively [Mon, 21 Nov 2022 20:40:14 +0000 (12:40 -0800)]
[WebAssembly] Update relaxed-simd instruction names
Including builtin and intrinsic names. These should be the final names for the
proposal.
https://github.com/WebAssembly/relaxed-simd/blob/main/proposals/relaxed-simd/Overview.md
Reviewed By: aheejin, maratyszcza
Differential Revision: https://reviews.llvm.org/D138249
Owen Pan [Sun, 20 Nov 2022 03:04:24 +0000 (19:04 -0800)]
[clang-format] Fix a crash due to dereferencing null MatchingParen
Fixes #59089.
Differential Revision: https://reviews.llvm.org/D138371
Dave Lee [Mon, 21 Nov 2022 20:31:24 +0000 (12:31 -0800)]
Revert "[lldb] Fix SBFileSpec.fullpath"
This reverts commit
a59ed8fa86036efe66efcaddd5cd3e1d17856563.
Kazu Hirata [Mon, 21 Nov 2022 20:22:16 +0000 (12:22 -0800)]
[Support] Use a custom base class for FormatVariadicTest.cpp (NFC)
This patch replaces None with a custom base class in
FormatVariadicTest.cpp.
As part of the migration from llvm::Optional to std::optional, I'd
like to define None as std::nullopt, but FormatVariadicTest.cpp blocks
that.
When you specialize indexed_accessor_range with the base class being
None, the template instantiation eventually generates code to compare
two instances of None. That's not guaranteed with std::nullopt.
Replacing None with a custom base class allows me to define None as
std::nullopt.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Differential Revision: https://reviews.llvm.org/D138381
Dave Lee [Sat, 19 Nov 2022 03:27:41 +0000 (19:27 -0800)]
[lldb] Fix SBFileSpec.fullpath
Reimplement `SBFileSpec.fullpath` to (indirectly) use `FileSpec::GetPath`.
Instead of hardcoding a `/` separator, use `GetPath`. This makes use of the
`FileSpec`'s internal style, which for example allows for backslash on Windows
where required.
It's not obvious from looking at the source, but the `fullpath` property is
implemented with `str`, which calls `GetDescription`, which finally calls
`GetPath`.
Differential Revision: https://reviews.llvm.org/D138348
Kai Nacke [Fri, 16 Sep 2022 23:55:53 +0000 (23:55 +0000)]
[PowerPC] Extend GlobalISel implementation to emit and/or/xor.
Adds some more code to GlobalISel to enable instruction selection for and/or/xor.
- Makes G_IMPLICIT_DEF, G_CONSTANT, G_AND, G_OR, G_XOR legal for 64bit register size.
- Implement lowerReturn in CallLowering
- Provides mapping of the operands to register banks.
- Adds register info to G_COPY operands.
The utility functions are all only implemented so far to support this use case.
Especially the functions in PPCGenRegisterBankInfo.def are too simple for
general use.
Reviewed By: nemanjai, shchenz, amyk
Differential Revision: https://reviews.llvm.org/D127530
Florian Hahn [Mon, 21 Nov 2022 19:58:43 +0000 (19:58 +0000)]
[SCEV] Add range test with phi and division.
Extra test coverage for D130728.
Jordan Rupprecht [Mon, 21 Nov 2022 19:56:02 +0000 (11:56 -0800)]
[test] Fix TestSourceManager when the source file is readonly.
This test copies main.c to main-copy.c and modifies main-copy.c while debugging, but main.c may have come from a readonly location, which means writing to main-copy.c will fail because permissions are preserved. Run the equivalent of "chmod u+w" before attempting to modify it.
This effect can be seen by attempting to run this test after running `chmod u-w lldb/test/API/source-manager/main.c`
Nikolas Klauser [Sat, 5 Nov 2022 01:57:52 +0000 (02:57 +0100)]
[libc++] Add utilites for instantiating functions with multiple types
We currently call a lot of functions with the same list of types. To avoid forgetting any of them, this patch adds type_lists and utilities for it. Specifically, it adds
- `type_list` - This is just a list of types
- `concatenate` - This allows concatenating type_lists
- `for_each` - Iterate over a type_list
Reviewed By: ldionne, #libc
Spies: jloser, EricWF, libcxx-commits
Differential Revision: https://reviews.llvm.org/D137476
Maryam Moghadas [Fri, 28 Oct 2022 22:03:16 +0000 (17:03 -0500)]
[PowerPC] Add new load/store with length instructions to Future CPU.
This patch adds 8 news load and store with length instructions including
lxvrl, lxvrll, stxvrl, stxvrll, lxvprl, lxvprll, stxvprl, stxvprll.
Reviewed By: stefanp, amyk, saghir
Differential Revision: https://reviews.llvm.org/D136992
Nathan Sidwell [Mon, 14 Nov 2022 13:53:59 +0000 (08:53 -0500)]
[clang] NFC: Robustify sret test regex
Replace old-style, brittle, grep with new-fangled FileCheck technology.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D137941
Sanjay Patel [Mon, 21 Nov 2022 18:16:56 +0000 (13:16 -0500)]
[Passes][VectorCombine] enable early run generally and try load folds
An early run of VectorCombine was added with D102496 specifically to
deal with unnecessary vector ops produced with the C matrix extension.
This patch is proposing to try those folds in general and add a pair
of load folds to the menu.
The load transform will partly solve (see PhaseOrdering diffs) a
longstanding vectorization perf bug by removing redundant loads via GVN:
issue #17113
The main reason for not enabling the extra pass generally in the initial
patch was compile-time cost. The cost of VectorCombine was significantly
(surprisingly) improved with:
87debdadaf18
https://llvm-compile-time-tracker.com/compare.php?from=
ffe05b8f57d97bc4340f791cb386c8d00e0739f2&to=
87debdadaf18f8a5c7e5d563889e10731dc3554d&stat=instructions:u
...so the extra run is going to cost very little now - the total cost of
the 2 runs should be less than the 1 run before that micro-optimization:
https://llvm-compile-time-tracker.com/compare.php?from=
5e8c2026d10e8e2c93c038c776853bed0e7c8fc1&to=
2c4b68eab5ae969811f422714e0eba44c5f7eefb&stat=instructions:u
It may be possible to reduce the cost slightly more with a few more
earlier-exits like that, but it's probably in the noise based on timing
experiments.
Differential Revision: https://reviews.llvm.org/D138353
Sanjay Patel [Sat, 19 Nov 2022 15:04:49 +0000 (10:04 -0500)]
[VectorCombine] generalize pass param name for early combines; NFC
The option was added with https://reviews.llvm.org/D102496,
and currently the name is accurate, but I am hoping to add
a load transform that is not a scalarization. See issue #17113.
Fangrui Song [Mon, 21 Nov 2022 18:57:29 +0000 (18:57 +0000)]
[ELF] Test rejected --detect-odr-violations
Manuel Brito [Mon, 21 Nov 2022 18:41:01 +0000 (18:41 +0000)]
Use poison instead of undef as placeholder for vector construction [NFC]
Differential Revision: https://reviews.llvm.org/D138450
Mark de Wever [Sun, 13 Nov 2022 17:51:36 +0000 (18:51 +0100)]
[libc++][format] Makes format_context copyable.
This was a bug discovered by @jwakely.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D137911
Archibald Elliott [Mon, 21 Nov 2022 18:26:49 +0000 (18:26 +0000)]
[Support] Reduce Dependence on Host.h
The intention behind this commit is to reduce the use of Host.h/Host.cpp
in Support, to where it is only necessary.
In this case, the endian-detection and support functionality needed by
these implementations can be provided by `Support/SwapByteOrder.h` in a
cleaner manner.
This patch also changes the byte swap in SHA256.cpp to use the byte swap
function from that header, rather than an inlined implementation.
Differential Revision: https://reviews.llvm.org/D137834
Alexey Bataev [Mon, 21 Nov 2022 17:59:56 +0000 (09:59 -0800)]
[SLP]Fix PR59098: check if the vector type is scalarized for
extractelements.
If the resulting type is going to be scalarized, no need to adjust the
cost of removed extractelement and insert/extract subvector costs.
Otherwise, the compiler can crash because of the wrong type sizes.
Hassnaa Hamdi [Fri, 18 Nov 2022 10:50:37 +0000 (10:50 +0000)]
[AArch64][SME]: Generate streaming-compatible code for fp_to_int and int_to_fp.
1-To generate code compatible to streaming mode:
- enable custom lowering fp_to_int, int_to_fp, fp_round, fmul, trunc.
- disable fp_to_int combining into invalid NEON intrinsic.
2-Add testing files:
fp_to_int.ll
fp-convert.ll
int_to_fp.ll
trunc.ll
Differential Revision: https://reviews.llvm.org/D138281
Hassnaa Hamdi [Fri, 18 Nov 2022 09:42:43 +0000 (09:42 +0000)]
[AArch64][SME]: Add precursory tests for D138281
Jordan Rupprecht [Mon, 21 Nov 2022 18:05:41 +0000 (10:05 -0800)]
[test] Remove named function arguments from TestSBEnvironment
This is not available in all versions of swig 3.
Caroline Concatto [Mon, 21 Nov 2022 17:27:48 +0000 (17:27 +0000)]
[AArch64][NFC] SME2 Add missing tests for usvdot and sumlall instructions
Christian Sigg [Mon, 21 Nov 2022 06:40:54 +0000 (07:40 +0100)]
[MLIR] Hide FailureOr::hasValue()
`Optional<T>::hasValue()` is deprecated and should be private like `has_value()`.
Reviewed By: tpopp, bondhugula
Differential Revision: https://reviews.llvm.org/D138400
Craig Topper [Mon, 21 Nov 2022 17:32:51 +0000 (09:32 -0800)]
[RISCV] Add isel patterns to select slli+shXadd.uw.
This matches what we get for something like.
%0 = shl i32 %x, C
%1 = zext i32 %0 to i64
%2 = getelementptr i32, ptr %y, %1
The shift before the zext and the shift implied by the GEP get
combined with an AND after them. We need to split it back into
2 shifts so we can fold one into shXadd.uw.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D137886
Arthur Eubanks [Mon, 14 Nov 2022 21:45:44 +0000 (13:45 -0800)]
[lldb] Disable looking at pointee types to find synthetic value for non-ObjC
After D134378, we started seeing crashes with incomplete types (in the
context of shared libraries).
When trying to print a `std::vector<int> &` with only debug info for a
declaration, we now try to use the formatter after D134378. With an
incomplete type, this somehow goes into infinite recursion with the
frames
```
lldb_private::ValueObject::Dereference
lldb_private::ValueObjectSynthetic::CreateSynthFilter
lldb_private::ValueObjectSynthetic::ValueObjectSynthetic
lldb_private::ValueObject::CalculateSyntheticValue
lldb_private::ValueObject::HasSyntheticValue
```
This has to do with `FrontEndWantsDereference` that some STL formatters
set, causing recursion between the formatter (which tries to dereference),
and dereferencing (which wants to know if there's a formatter to avoid dereferencing).
The reason this only started appearing after D134378 was because
previously with incomplete types, for names with `<`, lldb would attempt
to parse template parameter DIEs, which were empty, then create an empty
`ClassTemplateSpecializationDecl` which overrode the name used to lookup
a formatter in `FormattersMatchData()` to not include template
parameters (e.g. `std::vector<> &`). After D134378 we don't create a
`ClassTemplateSpecializationDecl` when there are no template parameters
and the name to lookup a formatter is the original name (e.g.
`std::vector<int> &`).
The code to try harder with incomplete child compiler types was added in
D79554 for ObjC purposes.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D137983
Benjamin Kramer [Mon, 21 Nov 2022 17:18:25 +0000 (18:18 +0100)]
Simon Pilgrim [Mon, 21 Nov 2022 17:15:38 +0000 (17:15 +0000)]
[X86] Synchronise scheduler classes of VPERM2F128/VBROADCASTF128/VEXTRACTF128/VINSERTF128 with I128 equivalents
znver1/znver2 has barely any difference in behaviour between the AVX1/2 variants of these instructions - it looks like it was a copy+paste mistake to miss the AVX2 integer domain instructions in the overrides.
Having said that the override numbers don't appear to match the numbers in the AMD 17h SoGs very well - for instance vperm2f128/vperm2i128 might be microcoded from the AMD sense of >3 uops, but it doesn't have a 100cy latency..... These will need to be further addressed.
Krzysztof Drewniak [Wed, 9 Nov 2022 22:26:33 +0000 (22:26 +0000)]
[mlir][AMDGPU] Remove buffer ops that are statically out of bounds
When the bounds check attribute is true, the raw buffer load, store,
and atomic operations have well-defined behavior (returning 0 for
loads and ignoring stores) when the buffer access exceeds the bounds
of the memory being accessed.
Because of how LLVM currently implements these buffer operations (as
opaque intrinsics), the backend cannot optimize out this known
behavior and eliminate the memory operations. Therefore, use MLIR's
canonicalization system to eliminate these operations.
Reviewed By: nirvedhmeshram
Differential Revision: https://reviews.llvm.org/D138146
Sander de Smalen [Mon, 21 Nov 2022 16:01:54 +0000 (16:01 +0000)]
[AArch64][SME] Always allocate a lazy-save buffer if a function has ZA state.
We already do this for most cases, with the exception of instructions that
get expanded to function calls (e.g. for lowering operations on fp128
values), in which case we temporarily allocate a lazy-save buffer.
The code that is generated in this case, is however incorrect, as it seems
to pass an incorrect address for the TPIDR2 object to the ZA restore
function. By always allocating the lazy-save buffer once, we avoid this
issue entirely.
The cost is that we also allocate such a buffer when it is not
needed. We could fix that in a follow-up patch, where we remove the
lazy-save buffer when it isn't used.
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D138208