Craig Topper [Thu, 18 May 2023 04:31:51 +0000 (21:31 -0700)]
[RISCV] Use IRBuilder::CreateInsertVector/CreateExtractVector to simplify code. NFC
Reviewed By: eopXD
Differential Revision: https://reviews.llvm.org/D150690
Kazu Hirata [Thu, 18 May 2023 04:28:38 +0000 (21:28 -0700)]
[Utils] Use LLVMContext::MD_loop (NFC)
Kazu Hirata [Thu, 18 May 2023 04:06:29 +0000 (21:06 -0700)]
[SCCP] Remove unused forward declarations (NFC)
While we are at it, this patch removes unnecessary includes.
Kazu Hirata [Thu, 18 May 2023 03:49:31 +0000 (20:49 -0700)]
[IPO] Remove unused declaration RemoveUnusedGlobalValue
The corresponding function definition was removed by:
commit
9071393c18e5264e3bbf3ca3f3584fa5f45be6c2
Author: Jay Foad <jay.foad@amd.com>
Date: Thu Feb 17 14:17:36 2022 +0000
Wang, Xin10 [Thu, 18 May 2023 03:36:15 +0000 (23:36 -0400)]
[X86]Fix wrong asm match for VMASKMOVDQU
VMASKMOVDQU supports 32bit/64bit version in 64bitmode, previously we prefer to use VMASKMOVDQU64 in 64bitmode because the 32bit one need 0x67 prefix.
After D150436, asm match table changed a little, which makes in 64bit mode "vmaskmovdqu %xmm0, %xmm1" will match VMASKMOVDQU other than VMASKMOVDQU64, this patch correct the asm match order for this instruction.
Reviewed By: skan
Differential Revision: https://reviews.llvm.org/D150835
Kazu Hirata [Thu, 18 May 2023 03:32:37 +0000 (20:32 -0700)]
[TableGen] Remove unused getMinimalTypeForEnumBitfield
The last use was removed by:
commit
e98944ed47acd04279184343017aa2bf34999111
Author: Stanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
Date: Mon Mar 11 17:04:35 2019 +0000
Shengchen Kan [Thu, 18 May 2023 03:09:57 +0000 (11:09 +0800)]
[X86][MC] Move the code about INC/DEC encoding optimization to X86EncodingOptimization.cpp, NFCI
Emilia Kond [Thu, 18 May 2023 02:50:10 +0000 (05:50 +0300)]
[clang-format] Ignore first token when finding MustBreak
When in ColumnLimit 0, the formatter looks for MustBreakBefore in the
line in order to check if a line is allowed to be merged onto one line.
However, since MustBreakBefore is really a property of the gap between
the token and the one previously, I belive the check is erroneous in
checking all the tokens in a line, since whether the previous line ended
with a forced line break should have no effect on whether the current
line is allowed to merge with the next one.
This patch changes the check to skip the first token in
`LineJoiner.containsMustBreak`.
This patch also changes a test, which is not ideal, but I believe the
test also suffered from this bug. The test case in question sets
AllowShortFunctionsOnASingleLine to "Empty", but the empty function in
said test case isn't merged to a single line, because of the very same
bug this patch fixes.
Fixes https://github.com/llvm/llvm-project/issues/62721
Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D150614
Katherine Rasmussen [Wed, 17 May 2023 00:55:01 +0000 (17:55 -0700)]
[flang] Apply the check for the constraint `C1172` to more stmts
Apply the check for the constraint `C1172` to `unlock-stmt`,
`change-team-stmt`, `end-team-stmt`, and `critical-stmt`, which
all have `sync-stat-lists` and so `C1172` applies to them. Add
a test to check the `sync-stat-lists` for these 4 statements.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D150745
Jianjian GUAN [Wed, 17 May 2023 06:19:37 +0000 (14:19 +0800)]
[RISCV] Refactor predicates for rvv SDNode patterns.
This patch is similar to https://reviews.llvm.org/D150550, it adds accurate predicates for SDNode patterns depending on vector type.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D150754
Sergei Barannikov [Thu, 18 May 2023 01:28:31 +0000 (04:28 +0300)]
[clang][CodeGen] Reformat ABIInfo.h (NFC)
Preparatory change for D148094.
Alex Langford [Thu, 18 May 2023 00:33:13 +0000 (17:33 -0700)]
[lldb][NFCI] Qualify param type in SBDebugger::FindTargetWithProcessID
We should specify that this is the pid_t as defined in the lldb
namespace, not some other pid_t. This doesn't really affect builds but
it makes writing tooling against the SBAPI easier.
I have verified that this does not change the emitted mangled name and
does not break ABI.
wren romano [Wed, 17 May 2023 23:32:19 +0000 (16:32 -0700)]
[mlir][sparse] Fixing sparse_reshape.mlir integration test (followup to D150822)
For some reason, even though D150822 passed the buildbot, it failed to
catch this test
Reviewed By: anlunx
Differential Revision: https://reviews.llvm.org/D150830
Jan Svoboda [Wed, 17 May 2023 23:45:18 +0000 (16:45 -0700)]
[clang] NFC: Modernize Decl iteration via IdentifierResolver
Fangrui Song [Wed, 17 May 2023 23:09:12 +0000 (16:09 -0700)]
[gcov] Simplify cc1 options and remove CodeGenOptions EmitCovNotes/EmitCovArcs
After
a07b135ce0c0111bd83450b5dc29ef0381cdbc39, we always pass
-coverage-notes-file/-coverage-data-file for driver options
-ftest-coverage/-fprofile-arcs/--coverage. As a bonus, we can make the following
simplification to cc1 options:
* `-ftest-coverage -coverage-notes-file a.gcno` => `-coverage-notes-file a.gcno`
* `-fprofile-arcs -coverage-data-file a.gcda` => `-coverage-data-file a.gcda`
and remove EmitCovNotes/EmitCovArcs.
Joseph Huber [Tue, 16 May 2023 18:39:28 +0000 (13:39 -0500)]
[libc] Restrict access to the RPC Process internals
This patch changes the `Process` struct to only provide the functions
expected to be visible by the interface. So, now we only export the
open, reset, and size query functions. This prevents users of the
interface from messing with the internals of the process, so now the
only existing failure mode is mismatched send and recieve calls.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D150703
Joseph Huber [Wed, 17 May 2023 18:20:34 +0000 (13:20 -0500)]
[Clang] Remove direct linking of offloading runtimes from the arch tools
The tools `amdgpu-arch` and `nvptx-arch` are used to query the supported
GPUs on a system to implement features like `--offload-arch=native` as
well as generally being useful for setting up tests. However, we
currently directly link these if they are availible. This patch removes
this because it causes many problems on the user not having the libaries
present or misconfigured at build time. Since these are built
unconditionally we shoudl keep the dependencies away from clang.
Fixes https://github.com/llvm/llvm-project/issues/62784
Reviewed By: ye-luo
Differential Revision: https://reviews.llvm.org/D150807
CaprYang [Wed, 17 May 2023 20:39:36 +0000 (21:39 +0100)]
[InferAddressSpaces] Handle vector of pointers type & Support intrinsic masked gather/scatter
Matt Arsenault [Tue, 18 Apr 2023 02:14:36 +0000 (22:14 -0400)]
ValueTracking: Handle sign bit for fptrunc in computeKnownFPClass
Matt Arsenault [Sun, 9 Apr 2023 11:13:26 +0000 (07:13 -0400)]
ValueTracking: Implement computeKnownFPClass for various rounding intrinsics
Arthur Eubanks [Wed, 17 May 2023 22:33:03 +0000 (15:33 -0700)]
Revert "[Driver] Support multi /guard: options"
This reverts commit
3b6f7e45a20990fdbc2b43dc08457fc79d53bd39.
See comments on D150645.
wren romano [Wed, 17 May 2023 21:59:02 +0000 (14:59 -0700)]
[mlir][sparse] Fixing GPU tests (followup to D150330)
The GPU tests weren't updated when rebasing D150330, so this patch fixes that.
Reviewed By: anlunx
Differential Revision: https://reviews.llvm.org/D150822
Jennifer Yu [Wed, 10 May 2023 22:01:52 +0000 (15:01 -0700)]
Fix assertion when try is used inside catch(...) block
Current assert wiht /EHa:
A single unwind edge may only enter one EH pad
invoke void @llvm.seh.try.begin()
to label %invoke.cont1 unwind label %catch.dispatch2
Current IR:
%1 = catchpad within %0 [ptr null, i32 0, ptr null]
invoke void @llvm.seh.try.begin()
to label %invoke.cont5 unwind label %catch.dispatch2
The problem is the invoke to llvm.seh.try.begin() missing "funclet"
Accodring: https://llvm.org/docs/LangRef.html#ob-funclet
If any "funclet" EH pads have been entered but not exited (per the
description in the EH doc), it is undefined behavior to execute a
call or invoke.
To fix the problem, when emit seh_try_begin, call EmitSehTryScopeBegin,
instead of calling EmitRuntimeCallOrInvoke for proper "funclet"
gerenration.
Differential Revision: https://reviews.llvm.org/D150340
Arthur Eubanks [Wed, 17 May 2023 21:37:02 +0000 (14:37 -0700)]
[test] Minor changes to optnone-opt.ll
Test doesn't require asserts.
Remove a CHECK line in preparation for an upcoming change.
Alexander Shaposhnikov [Wed, 17 May 2023 21:02:02 +0000 (21:02 +0000)]
[Clang][Sema] Substitute constraints only for declarations with different lexical contexts
Substitute constraints only for declarations with different lexical contexts.
This results in avoiding the substitution of constraints during the redeclaration check
inside a class (and by product caching the wrong substitution result).
Test plan: ninja check-all
Differential revision: https://reviews.llvm.org/D150730
wren romano [Wed, 17 May 2023 20:09:53 +0000 (13:09 -0700)]
[mlir][sparse] Renaming the STEA field `dimLevelType` to `lvlTypes`
This commit is part of the migration of towards the new STEA syntax/design. In particular, this commit includes the following changes:
* Renaming compiler-internal functions/methods:
* `SparseTensorEncodingAttr::{getDimLevelType => getLvlTypes}`
* `Merger::{getDimLevelType => getLvlType}` (for consistency)
* `sparse_tensor::{getDimLevelType => buildLevelType}` (to help reduce confusion vs actual getter methods)
* Renaming external facets to match:
* the STEA parser and printer
* the C and Python bindings
* PyTACO
However, the actual renaming of the `DimLevelType` itself (along with all the "dlt" names) will be handled in a separate commit.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D150330
Siva Chandra Reddy [Tue, 16 May 2023 17:19:10 +0000 (17:19 +0000)]
[libc] Add a convenience CMake function `add_unittest_framework_library`.
This function is used to add unit test and hermetic test framework libraries.
It avoids the duplicated code to add compile options to each every test
framework libraries.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D150727
Mathieu Fehr [Wed, 8 Mar 2023 20:21:54 +0000 (21:21 +0100)]
[mlir][irdl] Add `irdl.any_of` operation
The `irdl.any_of` operation represent a constraint that is satisfied
if any of its subconstraint is satisfied.
For instance, in the following example:
```
%0 = irdl.is f32
%1 = irdl.is f64
%2 = irdl.any_of(f32, f64)
```
`%2` can only be satisfied by `f32` or `f64`.
Note that the verification algorithm required by `irdl.any_of` is
non-trivial, since we want that the order of arguments of
`irdl.any_of` to not matter. For this reason, our registration
algorithm fails if two constraints used by `any_of` might be
satisfied by the same `Attribute`. This is approximated by checking
the possible `Attribute` bases of each constraints.
Depends on D145734
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D145735
Alex Langford [Wed, 17 May 2023 20:22:24 +0000 (13:22 -0700)]
[lldb][NFCI] Clean up ThreadSafeDenseMap
- Change header guard after
147a61618989
- Fix file header
- Remove the `_MutexType` template parameter, I did not see this used
anywhere on llvm.org or on Apple's downstream forks.
Thurston Dang [Wed, 17 May 2023 18:56:52 +0000 (18:56 +0000)]
Revert 'hwasan: lay groundwork for importing subset of sanitizer_common interceptors [NFC]'
It was reported in https://reviews.llvm.org/D150708 that my patch has broken
stage2/hwasan check: https://lab.llvm.org/buildbot/#/builders/236/builds/4069
Reverting that patch (and the followup fixes) until I can investigate this further
Sergei Barannikov [Tue, 16 May 2023 11:09:51 +0000 (14:09 +0300)]
[clang] Convert remaining OpenMP tests to opaque pointers
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D150733
Alex Langford [Wed, 17 May 2023 19:50:36 +0000 (12:50 -0700)]
[lldb][NFCI] Move ThreadSafeDenseMap to Utility
This seems better suited for Utility than Core
Artem Belevich [Tue, 16 May 2023 19:30:22 +0000 (12:30 -0700)]
[CUDA] Relax restrictions on GPU-side variadic functions
Allow parsing GPU-side variadic functions when we're compiling with CUDA-9 or
newer. We still do not allow accessing variadic arguments.
CUDA-9 was the version which introduced PTX-6.0 which allows implementing
variadic functions, so older versions can't have variadics in principle.
This is required for dealing with headers in recent CUDA versions that rely on
variadic function declarations in some of the templated code in libcu++.
E.g. https://github.com/llvm/llvm-project/issues/58410
Differential Revision: https://reviews.llvm.org/D150718
Fangrui Song [Wed, 17 May 2023 19:43:49 +0000 (12:43 -0700)]
[Driver][gcov] Derive .gcno .gcda file names from -o and -dumpdir
Resolve a FIXME.
When -ftest-profile, -fprofile-arcs, or --coverage is specified and the
driver performs both compilation and linking phases, derive the .gcno &
.gcda file names from -o and -dumpdir.
`clang --coverage d/a.c d/b.c -o e/x && e/x` will now emit
`e/x-[ab].gc{no,da}` like GCC.
For -fprofile-dir=, we make the deliberate decision to not mangle the
input filename if relative.
The following script demonstrates the .gcno and .gcda filenames.
```
PATH=/tmp/Rel/bin:$PATH # adapt according to your build directory
mkdir -p d e f
echo 'int main() {}' > d/a.c
echo > d/b.c
a() { rm $@ || exit 1; }
clang --coverage d/a.c d/b.c && ./a.out
a a-[ab].gc{no,da}
clang --coverage d/a.c d/b.c -o e/x && e/x
a e/x-[ab].gc{no,da}
clang --coverage d/a.c d/b.c -o e/x -dumpdir f/ && e/x
a f/[ab].gc{no,da}
clang --coverage -fprofile-dir=f d/a.c d/b.c -o e/x && e/x
a e/x-[ab].gcno f/e/x-[ab].gcda
clang -c --coverage d/a.c d/b.c && clang --coverage a.o b.o && ./a.out
a [ab].gc{no,da}
clang -c --coverage -fprofile-dir=f d/a.c d/b.c && clang --coverage a.o b.o && ./a.out
a [ab].gcno f/[ab].gcda
clang -c --coverage d/a.c -o e/xa.o && clang --coverage e/xa.o && ./a.out
a e/xa.gc{no,da}
clang -c --coverage d/a.c -o e/xa.o -dumpdir f/g && clang --coverage e/xa.o && ./a.out
a f/ga.gc{no,da}
```
The gcov code accidentally claims -c and -S, so -fsyntax-only -c/-S and
-E -c/-S don't lead to a -Wunused-command-line-argument warning. Keep
the unintended code for now.
Aiden Grossman [Wed, 17 May 2023 18:01:37 +0000 (18:01 +0000)]
[clang][X86] Add __cpuidex function to cpuid.h
MSVC has a `__cpuidex` function implemented to call the underlying cpuid
instruction which accepts a leaf, subleaf, and data array that the output
data is written into. This patch adds this functionality into clang
under the cpuid.h header. This also makes clang match GCC's behavior.
GCC has had `__cpuidex` in its cpuid.h since 2020.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D150646
LLVM GN Syncbot [Wed, 17 May 2023 19:02:47 +0000 (19:02 +0000)]
[gn build] Port
da42b2846c82
Fangrui Song [Wed, 17 May 2023 18:54:38 +0000 (11:54 -0700)]
[gcov][test] Add -dumpdir ./
These tests rely on an unintended behavior that when the driver performs both
compilation and linking phases, the .gcno & .gcda files are placed in PWD. The
behavior will be fixed to respect -o (match -ftime-trace, -gsplit-dwarf, and
GCC).
Add -dumpdir ./ so that the tests will work with or without the behavior change,
and make it easy to compare the coverage behavior with GCC.
Sergei Barannikov [Mon, 1 May 2023 08:56:39 +0000 (11:56 +0300)]
[CodeGen] Support allocating of arguments by decreasing offsets
Previously, `CCState::AllocateStack` always allocated stack space by increasing
offsets. For targets with stack growing up (away from zero) it is more
convenient to allocate arguments by decreasing offsets, so that the first
argument is at the top of the stack. This is important when calling a function
with variable number of arguments: the callee does not know the size of the
stack, but must be able to access "fixed" arguments. For that to work, the
"fixed" arguments should have fixed offsets relative to the stack top, i.e. the
variadic arguments area should be at the stack bottom (at lowest addresses).
The in-tree target with stack growing up is AMDGPU, but it allocates
arguments by increasing addresses. It does not support variadic arguments.
A drive-by change is to promote stack size/offset to 64-bit integer.
This is what MachineFrameInfo expects.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D149575
Sergei Barannikov [Mon, 1 May 2023 02:39:30 +0000 (05:39 +0300)]
[CodeGen] Replace CCState's getNextStackOffset with getStackSize (NFC)
The term "next stack offset" is misleading because the next argument is
not necessarily allocated at this offset due to alignment constrains.
It also does not make much sense when allocating arguments at negative
offsets (introduced in a follow-up patch), because the returned offset
would be past the end of the next argument.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D149566
Leonard Chan [Wed, 17 May 2023 18:45:44 +0000 (18:45 +0000)]
[NFC][hwasan][Fuchsia] Instead wrap contents of InitLoadedGlobals with if constexpr (!SANITIZER_FUCHSIA)
This prevents spamming the build log with unused InitLoadedGlobals when building fuchsia runtimes.
Differential Revision: https://reviews.llvm.org/D150737
Sam McCall [Tue, 16 May 2023 15:24:48 +0000 (17:24 +0200)]
[clangd] Tweak "provides" hover card when symbols have the same name
Previously for overloaded functions we'd show:
Provides: foo, bar bar bar bar
The symbol name is duplicated
==> only show unique names, since we're not displaying the signature
Commas are missing
==> fix the logic which was checking for "last element" by value
(though after the above fix this bug is dead anyway)
While here, remove a redundant bounds check before take_front().
Differential Revision: https://reviews.llvm.org/D150683
Valentin Clement [Wed, 17 May 2023 18:11:42 +0000 (11:11 -0700)]
[mlir][openacc] Add firstprivate representation
Add a representation for firstprivate clause modeled on the
private representation added in D150622.
The firstprivate recipe operation has an additional mandatory
region representing a sequences of operations needed to copy
the initial value to the created private copy.
Depends on D150622
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D150729
Philip Reames [Wed, 17 May 2023 18:06:24 +0000 (11:06 -0700)]
[RISCV] Implement storeOfVectorConstantIsCheap hook to prevent store merging at VL=2
In general, VL=2 vectors are very questionable profitability wise. For constants specifically, our inability to materialize many vector constants cheaply biases us strongly towards unprofitability at VL=2.
This hook is very close to the x86 implementation. The difference is that X86 whitelists stores of zeros, and we're better off letting that stay scalar at VL=2.
Differential Revision: https://reviews.llvm.org/D150798
Philip Reames [Wed, 17 May 2023 17:01:16 +0000 (10:01 -0700)]
[RISCV] Expand testing for store merging of multiple constant stores
Valentin Clement [Wed, 17 May 2023 18:06:07 +0000 (11:06 -0700)]
[mlir][openacc] Add private representation
Currently privatization is not well represented in the OpenACC dialect. This
patch is a prototype to model privatization with a dedicated operation that
declares how the private value is created and destroyed.
The newly introduced operation is `acc.private.recipe` and it declares
an OpenACC privatization. The operation requires one mandatory and
one optional region.
1. The initializer region specifies how to create and initialize a new
private value. For example in Fortran, a derived-type might have a
default initialization. The region has an argument that contains the
value that need to be privatized. This is useful if the type is not
a known at compile time and the private value is needed to create its
copy.
2. The destroy region specifies how to destruct the value when it reaches
its end of life. It takes the privatized value as argument.
A same privatization can be used for multiple operand if they have the same
type and do not require a specific default initialization.
Example:
```mlir
acc.private.recipe @privatization_f32 : f32 init {
^bb0(%0: f32):
// init region contains a sequence of operations to create and initialize the
// copy if needed.
} destroy {
^bb0(%0: f32):
// destroy region contains a sequences of operations to destruct the created
// copy.
}
// The privatization symbol is then used in the corresponding operation.
acc.parallel private(@privatization_f32 -> %a : f32) {
}
```
Reviewed By: razvanlupusoru, jeanPerier
Differential Revision: https://reviews.llvm.org/D150622
Jon Roelofs [Tue, 16 May 2023 20:43:34 +0000 (13:43 -0700)]
builtins: fix a -Wshorten-64-to-32 in gcc_personality_v0
Differential revision: https://reviews.llvm.org/D150720
Amir Ayupov [Tue, 16 May 2023 20:57:41 +0000 (13:57 -0700)]
[BOLT][NFC] Use llvm::make_range
Use `llvm::make_range` convenience wrapper from ADT.
Reviewed By: #bolt, rafauler
Differential Revision: https://reviews.llvm.org/D145887
Krzysztof Parzyszek [Wed, 17 May 2023 17:41:46 +0000 (10:41 -0700)]
[Hexagon] Split SETCC on float16/float32 HVX pairs
Craig Topper [Wed, 17 May 2023 17:31:39 +0000 (10:31 -0700)]
[RISCV] Refactor parseVTypeI and use ParseFail if we parsed more than one identifier.
Previously we lexed into a SmallVector and unlexed the tokens if
the parsing failed.
This patch gets rid of the SmallVector and the unlexing.
If the first token fails to parse, return MatchFail. This allows us
to fallback to parsing as an immediate. If we successfully parsed the
first token, use ParseFail if any later tokens fail to parse. This
avoids needing to UnLex the tokens.
I've used a state machine to keep track of what component we've
parsed so far.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D150753
Alex Brachet [Wed, 17 May 2023 17:24:58 +0000 (17:24 +0000)]
[Fuchsia] Correctly pass lists from STAGE2_ vars
Differential Revision: https://reviews.llvm.org/D150799
Pranav Kant [Wed, 10 May 2023 00:38:59 +0000 (00:38 +0000)]
[AArch64] Sink operands for faster bitselect vector instructions
Differential Revision: https://reviews.llvm.org/D150237
Mats Petersson [Tue, 16 May 2023 16:15:17 +0000 (17:15 +0100)]
[OpenMP]Fix trivial build failure in MacOS
MacOS build of LLVM with OpenMP enabled fails with an error
that it doesn't know what std::abs is. Fix by including <cmath>
so that the relevant function declaration is included.
No functional change intended.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D150687
yronglin [Wed, 17 May 2023 17:05:13 +0000 (01:05 +0800)]
[libc++] Implement P2505R5(Monadic operations for std::expected).
Implement P2505R5(https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2505r5.html)
Reviewed By: #libc, philnik, ldionne
Differential Revision: https://reviews.llvm.org/D140911
yronglin [Wed, 17 May 2023 16:55:03 +0000 (00:55 +0800)]
Revert "[libc++] Implement P2505R5(Monadic operations for std::expected)."
This reverts commit
ebc111b08bddca55d5f7e560a20bdb2c913d80cb.
Sorry, I forgot to append Phabricator reversion when land D140911, I try to revert this change and reland.
Reviewed By: #libc, ldionne, EricWF
Differential Revision: https://reviews.llvm.org/D150793
Louis Dionne [Tue, 16 May 2023 14:48:13 +0000 (07:48 -0700)]
[libc++][NFC] Rename the 'noexceptions' CI config to 'no-exceptions' for consistency
Differential Revision: https://reviews.llvm.org/D150672
Kazu Hirata [Wed, 17 May 2023 16:45:03 +0000 (09:45 -0700)]
[flang] Fix an unused variable warning
This patch fixes:
flang/lib/Semantics/runtime-type-info.cpp:1275:12: error: unused
variable 'name' [-Werror,-Wunused-variable]
Nick Desaulniers [Wed, 17 May 2023 16:30:30 +0000 (09:30 -0700)]
[libcxxabi] define _LIBCPP_VERBOSE_ABORT
libc++ may be built with or without assertions. This causes definitions
of various methods of std::string_view to contain assertions and calls
to __libcpp_verbose_abort which libcxxabi does not provide. libcxxabi
does provide abort_message with the same interface, so define
_LIBCPP_VERBOSE_ABORT to use that. Otherwise D148566 will trigger
linkage failures for the missing symbol __libcpp_verbose_abort.
Link: https://libcxx.llvm.org/UsingLibcxx.html#enabling-the-safe-libc-mode
Reviewed By: #libc_abi, philnik, ldionne
Differential Revision: https://reviews.llvm.org/D149092
Nikita Popov [Wed, 17 May 2023 16:39:26 +0000 (18:39 +0200)]
[InstCombine] Return poison for known bits conflict
I suspect that this case is not actually reachable in practice
(because it gets folded away by other code before), but if we do
reach it, we should return poison, not undef.
Philip Reames [Wed, 17 May 2023 16:29:21 +0000 (09:29 -0700)]
[RISCV] Expand testing for store merging of constant stores
Nikita Popov [Wed, 17 May 2023 16:30:40 +0000 (18:30 +0200)]
[InstCombine] Compute bits of first operand for multi-use sub
Otherwise the result will always be unknown anyway. This fixes one
of the last inconsistencies in results between computeKnownBits()
and SimplifyDemandedBits().
V Donaldson [Tue, 16 May 2023 20:34:57 +0000 (13:34 -0700)]
[flang] Non-type-bound defined IO lowering
Generate supporting data structures and calls to new runtime IO functions
for defined IO that accesses non-type-bound procedures, such as `wft` in:
module m1
type t
integer n
end type
interface write(formatted)
module procedure wft
end interface
contains
subroutine wft(dtv, unit, iotype, v_list, iostat, iomsg)
class(t), intent(in) :: dtv
integer, intent(in) :: unit
character(*), intent(in) :: iotype
integer, intent(in) :: v_list(:)
integer, intent(out) :: iostat
character(*), intent(inout) :: iomsg
iostat = 0
write(unit,*,iostat=iostat,iomsg=iomsg) 'wft was called: ', dtv%n
end subroutine
end module
module m2
contains
subroutine test1
use m1
print *, 'test1, should call wft: ', t(1)
end subroutine
subroutine test2
use m1, only: t
print *, 'test2, should not call wft: ', t(2)
end subroutine
end module
use m1
use m2
call test1
call test2
print *, 'main, should call wft: ', t(3)
end
Azat Khuzhin [Wed, 17 May 2023 16:16:54 +0000 (09:16 -0700)]
[libcxx] Fix crash in std::stringstream with payload >= INT_MAX
stringstream does works for payload > INT_MAX, however
stringstream::gcount() can break the internal field (__nout_) and this
breaks the stringstream itself, and so the program will crash.
Fix this, by using __pbump(streamsize) over pbump(int)
Note, libstdc++ does not have this bug.
Reviewed By: #libc, ldionne, Mordante
Spies: arichardson, Mordante, philnik, ldionne, libcxx-commits, mikhail.ramalho
Differential Revision: https://reviews.llvm.org/D146294
Philip Reames [Wed, 17 May 2023 14:35:47 +0000 (07:35 -0700)]
[TLI] Add IsZero parameter to storeOfVectorConstantIsCheap [nfc]
Make the decision to consider zero constant stores cheap target specific. Will be used in an upcoming change for RISCV.
zijunzhao [Tue, 16 May 2023 22:49:48 +0000 (22:49 +0000)]
[libc++] Improve ranges::starts_with
Fix some nits in ranges::starts_with
Kazu Hirata [Wed, 17 May 2023 16:12:16 +0000 (09:12 -0700)]
[Inliner] Remove unused forward declarations (NFC)
Nikita Popov [Wed, 17 May 2023 16:05:01 +0000 (18:05 +0200)]
[InstCombine] Use canonical index type in more places
Also fixes an issue with
80cd3e4e2059f8deda735c32bf7dfa5b9d75c4e0
pointed out by Roman Divacky: For one of the occurrences I only
changed the name of the type variable, without actually changing
the type...
Lei Zhang [Wed, 17 May 2023 15:57:13 +0000 (08:57 -0700)]
[mlir][vector] Separate out vector transfer + tensor slice patterns
These patterns touches the structure generated from tiling so it
affects later steps like bufferization and vector hoisting.
Instead of putting them in canonicalization, this commit creates
separate entry points for them to be called explicitly.
This is NFC regarding the functionality and tests of those patterns.
It also addresses two TODO items in the codebase.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D150702
Slava Zakharin [Wed, 17 May 2023 03:05:22 +0000 (20:05 -0700)]
[flang][hlfir] Fixed symbol lookup for character returns.
Symbols corresponding to entries returning character results
must be mapped to EmboxCharOp, first, before we can map them
to DeclareOp. The code may be reworked after HLFIR is enabled
by default, but right now it seems like an acceptable solution to me.
Differential Revision: https://reviews.llvm.org/D150749
LLVM GN Syncbot [Wed, 17 May 2023 15:51:46 +0000 (15:51 +0000)]
[gn build] Port
7f3047219cf5
Nikita Popov [Wed, 17 May 2023 15:36:05 +0000 (17:36 +0200)]
[InstCombine] Compute known bits for multi-use add/sub
We were failing to set the known bits for add/sub in the multi-use
case, resulting in odd behavioral differences depending on the
number of uses. Noticed while adding a consistency assertion.
The test changes are essentially a revert to the state before
d6498ab. These changes are not really desirable, but if we don't
want them, that needs to be handled as part of the heuristic for
demanded constant shrinking, not by artifically suppressing the
known bits in one specific case.
yronglin [Tue, 16 May 2023 17:40:03 +0000 (01:40 +0800)]
[libc++] Implement P2505R5(Monadic operations for std::expected).
Signed-off-by: yronglin <yronglin777@gmail.com>
Kazu Hirata [Wed, 17 May 2023 15:39:48 +0000 (08:39 -0700)]
[Analysis] Remove AliasAnalysisSummary.cpp
The last use was removed by:
commit
8005332835246c54a4a6b026eede930ed559deb4
Author: Nikita Popov <npopov@redhat.com>
Date: Fri Dec 9 11:57:50 2022 +0100
Differential Revision: https://reviews.llvm.org/D150748
Nikita Popov [Wed, 17 May 2023 15:12:32 +0000 (17:12 +0200)]
[InstCombine] Use KnownBits::urem() helper
This provides more precise results than the ad-hoc implementation.
Noticed while trying to add a consistency assertion.
To be honest I'm not sure why this code exists at all -- the
recursive calls are done with all bits demanded, so this should
be equivalent to just using the default case.
Alex Zinenko [Wed, 17 May 2023 14:01:08 +0000 (14:01 +0000)]
[mlir] don't hardcode PDL_Operation in Transform dialect extensions
Update operations in Transform dialect extensions defined in the Affine,
GPU, MemRef and Tensor dialects to use the more generic
`TransformHandleTypeInterface` type constraint instead of hardcoding
`PDL_Operation`. See
https://discourse.llvm.org/t/rfc-type-system-for-the-transform-dialect/65702
for motivation.
Remove the dependency on PDLDialect from these extensions.
Update tests to use `!transform.any_op` instead of `!pdl.operation`.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D150781
Tobias Hieta [Wed, 17 May 2023 15:05:13 +0000 (17:05 +0200)]
[NFC][Py Reformat] Added more commits to .git-blame-ignore-revs
Nikita Popov [Wed, 17 May 2023 15:01:58 +0000 (17:01 +0200)]
[InstCombine] Use KnownBits::udiv() helper
This produces more precise results than the ad-hoc implementation.
Noticed while trying to add a consistency assertion.
Tobias Hieta [Wed, 17 May 2023 09:01:54 +0000 (11:01 +0200)]
[NFC][Py Reformat] Reformat lit.local.cfg python files in llvm
This is a follow-up to
b71edfaa4ec3c998aadb35255ce2f60bba2940b0
since I forgot the lit.local.cfg files in that one.
Reformatting is done with `black`.
If you end up having problems merging this commit because you
have made changes to a python file, the best way to handle that
is to run git checkout --ours <yourfile> and then reformat it
with black.
If you run into any problems, post to discourse about it and
we will try to help.
RFC Thread below:
https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style
Reviewed By: barannikov88, kwk
Differential Revision: https://reviews.llvm.org/D150762
Nico Weber [Wed, 17 May 2023 15:00:54 +0000 (11:00 -0400)]
Revert "[Lex] Warn when defining or undefining any builtin macro"
This reverts commit
22e3f587fd1ff97185014cb1ba723579ed2150d3.
Breaks check-clang on arm, see https://reviews.llvm.org/D144654#4349954
Also reverts follow-up "[AArch64] Don't redefine _LP64 and __LP64__"
This reverts commit
e55d52cd34fb7a6a6617639d147b9d0abaceeeab.
Nico Weber [Wed, 17 May 2023 14:46:45 +0000 (10:46 -0400)]
Revert "Reland "[CMake] Bumps minimum version to 3.20.0.""
This reverts commit
65429b9af6a2c99d340ab2dcddd41dab201f399c.
Broke several projects, see https://reviews.llvm.org/D144509#4347562 onwards.
Also reverts follow-up commit "[OpenMP] Compile assembly files as ASM, not C"
This reverts commit
4072c8aee4c89c4457f4f30d01dc9bb4dfa52559.
Also reverts fix attempt "[cmake] Set CMP0091 to fix Windows builds after the cmake_minimum_required bump"
This reverts commit
7d47dac5f828efd1d378ba44a97559114f00fb64.
Shengchen Kan [Wed, 17 May 2023 14:45:07 +0000 (22:45 +0800)]
[X86][MC] Move the code about MOVSX encoding optimization to X86EncodingOptimization.cpp, NFCI
Philip Reames [Wed, 17 May 2023 14:21:25 +0000 (07:21 -0700)]
[RISCV] Use scalar stores for splats of zero to memory up to XLen
The direct motivation here is to undo an unprofitable vectorization performed by SLP, but the transform seems generally useful as well. If we are storing a zero to memory, we can use a single scalar store (from X0) for all power of two sizes up to XLen.
Differential Revision: https://reviews.llvm.org/D150717
Martin Braenne [Wed, 17 May 2023 07:07:52 +0000 (07:07 +0000)]
[clang][dataflow] Remove unused parameter from `diagnoseUnwrapCall()`.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D150756
John Brawn [Wed, 17 May 2023 13:25:50 +0000 (14:25 +0100)]
[AArch64] Don't redefine _LP64 and __LP64__
Don't define these macros in AArch64TargetInfo::getTargetDefines, as
they're already defined in InitializePredefinedMacros and the
redefinition causes unwanted warnings with -Wsystem-headers.
Shengchen Kan [Wed, 17 May 2023 14:08:48 +0000 (22:08 +0800)]
[X86][MC] Move the code about VPCMP encoding optimization to X86EncodingOptimization.cpp, NFCI
Nikita Popov [Wed, 17 May 2023 13:54:11 +0000 (15:54 +0200)]
[InstCombine] Use computeKnownBits() for srem SimplifyDemandedBits()
For the case of a non-constant operand, fall back to
computeKnownBits() rather than trying to reimplement logic.
Found while testing a consistency assertion for both functions.
Alexey Lapshin [Wed, 17 May 2023 13:21:15 +0000 (15:21 +0200)]
Addition to Fddf5bfd6e6e2fc5b94718a29e718b4f821a3b853
Fix test bot breakage from
bd0dd27bb5be0fbf60c1b2a4ce15188812388574
This addresses the issue found by: https://lab.llvm.org/buildbot/#/builders/93/builds/14929
Nikita Popov [Wed, 17 May 2023 13:34:31 +0000 (15:34 +0200)]
[InstCombine] Don't create bitcast when simplifying round-trip
The bitcast was not being added to the worklist. I could switch
this to use the IRBuilder instead, but this bitcast is not relevant
with opaque pointers anyway, so just drop it entirely.
Alex Bradbury [Wed, 17 May 2023 13:43:56 +0000 (14:43 +0100)]
[clang][test][RISCV] Precommit zhinx coverage in Float16-arith.c test
Now codegen support is present, we should set HasLeftHalfType=true if
zhinx is present. This adds test coverage prior to making that change.
Alexey Bataev [Wed, 17 May 2023 12:41:34 +0000 (05:41 -0700)]
[SLP]Fix crash for scalarized vectors.
Need to remove insertion of the nodes to the InVector in case of
scalarized vectors too to avoid compiler crashes.
Peter Klausler [Thu, 11 May 2023 21:28:58 +0000 (14:28 -0700)]
[flang] Catch (and fix) attempts to create an invalid source range for a Scope
When Scope::AddSourceRange() is called to extend the scope's source range to
include another snippet from a cooked character stream, add a check to ensure
that the new range is part of the same cooked character stream as the rest
of the scope.
And fix the bug that was causing such invalid source ranges to be created:
a submodule's Scope is a children of its parent's in the Scope tree, but
it may or may not be part of the same source file, and it is certainly
not enclosed in the parent's source range. So don't propagate Scope
source range expansion from a submodule to its parent.
Differential Revision: https://reviews.llvm.org/D150714
Nikita Popov [Wed, 17 May 2023 13:19:35 +0000 (15:19 +0200)]
[InstCombine] Create store using IRBuilder
This ensures it gets reprocessed in the same iteration. In
particular the alignment will be increased (which is quite
pointless, of course).
Jonas Hahnfeld [Wed, 17 May 2023 12:44:02 +0000 (14:44 +0200)]
[clang][modules] Add features for recent C++ versions
Add cplusplus20, cplusplus23, and cplusplus26 (but don't document
the latter, following the current policy).
Differential Revision: https://reviews.llvm.org/D150773
Dhruv Chawla [Wed, 17 May 2023 13:12:11 +0000 (15:12 +0200)]
[SelectionDAG] Handle NSW for ADD/SUB in computeKnownBits()
This patch is a continuation of D150110. It separates the cases for
ADD and SUB into their own cases so that computeForAddSub can be
directly called and the NSW flag passed. This allows better
optimization when the NSW flag is enabled, and allows fixing up the
TODO that was there previously in SimplifyDemandedBits.
Differential Revision: https://reviews.llvm.org/D150769
Nico Weber [Wed, 17 May 2023 13:13:28 +0000 (09:13 -0400)]
Nabeel Omer [Wed, 17 May 2023 13:12:16 +0000 (13:12 +0000)]
[llvm-debuginfo-analyzer] Include linkage names while evaluating `--select`
This patch allows mangled names to be passed to --select.
Differential Revision: https://reviews.llvm.org/D150190
Nico Weber [Wed, 17 May 2023 13:07:22 +0000 (09:07 -0400)]
[gn] port
ed90cf1873aa6 (RISCVTests)
Nico Weber [Wed, 17 May 2023 13:07:40 +0000 (09:07 -0400)]
Nikita Popov [Wed, 17 May 2023 13:04:42 +0000 (15:04 +0200)]
[InstCombine] Use IRBuilder in evaluateInDifferentElementOrder()
This ensures that the new instructions get reprocessed in the same
iteration.
This should be largely NFC, apart from worklist order effects and
naming changes, as seen in the test diff.
Thorsten Schütt [Wed, 17 May 2023 07:07:08 +0000 (09:07 +0200)]
[GlobalIsel][x86] Legalize G_CTPOP and G_CTLZ II
check plan: ninja check-llvm-codegen-x86
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D150755
Nikita Popov [Wed, 17 May 2023 12:31:21 +0000 (14:31 +0200)]
[InstCombine] Fix worklist management for multi-use demanded element fold
Add the old instruction to the worklist, so it can be DCEd in the
same iteration.