Felipe de Azevedo Piovezan [Wed, 19 Apr 2023 13:04:54 +0000 (09:04 -0400)]
[coroutine] Salvage dbg.values in the original function as well
D97673 implemented salvaging o dbg.value inside coroutine funclets, but
left the original function untouched. Before, only dbg.addr and dbg.decl
would get salvaged.
D121324 implemented salvaging of dbg.addr and dbg.decl in the original
function as well, but not of dbg.values.
This patch unifies salvaging in the original function and related
funclets, so that all intrinsics are salvaged in all functions. This is
particularly useful for ABIs where the original function is also
rewritten to receive the frame pointer as an argument.
Differential Revision: https://reviews.llvm.org/D148745
Nikita Popov [Tue, 18 Apr 2023 10:33:58 +0000 (12:33 +0200)]
[SCEV] Clarify inference in isAddRecNeverPoison()
The justification in isAddRecNeverPoison() no longer applies, as
it dates back to a time where LLVM had an unconditional forward
progress guarantee. However, we also no longer need it, because we
can exploit branch on poison UB instead.
For a single exit loop (without abnormal exits) we know that all
instructions dominating the exit will be executed, so if any of
them trigger UB on poison that means that addrec is not poison.
This is slightly stronger than the previous code, because a) we
don't need the exit to also be the latch and b) we don't need the
value to be used in the exit branch in particular, any UB-producing
instruction is fine.
I don't expect much practical impact from this change, this is
mainly to clarify the reasoning behind this logic.
Differential Revision: https://reviews.llvm.org/D148633
Doru Bercea [Thu, 20 Apr 2023 20:54:46 +0000 (16:54 -0400)]
Avoid capping heap to stack optimization for __kmpc_alloc_shared allocations.
Review: https://reviews.llvm.org/D148849
Alvin Wong [Mon, 3 Apr 2023 14:50:14 +0000 (22:50 +0800)]
[asan][test][win] Port more tests to not use clang-cl on MinGW
Depends on D147432
Differential Revision: https://reviews.llvm.org/D147444
Alvin Wong [Mon, 3 Apr 2023 08:37:31 +0000 (16:37 +0800)]
[asan][test][win] Port trivial tests to not use clang-cl on MinGW
Use clang driver on MinGW where clang-cl is not usable. MSVC target
still uses clang-cl to minimize changes to existing test runners.
Differential Revision: https://reviews.llvm.org/D147432
Jay Foad [Fri, 21 Apr 2023 12:59:13 +0000 (13:59 +0100)]
Revert "[ConstantFolding] Fix crash when folding vector llvm.is.fpclass"
This reverts commit
5fc6425fb6c77052a26cf0cf7b886449fabe1af4.
It is reported to cause other crashes that require a larger fix.
Jacek Caban [Fri, 21 Apr 2023 12:32:07 +0000 (15:32 +0300)]
[llvm-lib] [llvm-readobj] [llvm-cvtres] Add Support for ARM64X object files.
Similar to D125411, but for ARM64X.
ARM64X PE binaries are hybrids containing both ARM64EC and pure ARM64
variants in one file. They are usually linked by passing separate
ARM64EC and ARM64 object files to linker. Linked binaries use ARM64
machine and contain additional CHPE metadata in their load config.
CHPE metadata support is not part of this patch, I plan to send that later.
Using ARM64X as a machine type of object files themselves is somewhat
ambiguous, but such files are allowed by MSVC. It treats them as ARM64
or ARM64EC object, depending on the context. Such objects can be
produced with cvtres.exe -machine:arm64x.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D148517
Jacek Caban [Fri, 21 Apr 2023 12:31:54 +0000 (15:31 +0300)]
[llvm-nm] Print EC symbol map.
This is useful for examining ARM64EC static libraries and allows
better llvm-lib testing. Changes to Archive class will also be
useful for LLD to support ARM64EC, where it will need to use one
map or the other, depending on linking target (or both, in case of
ARM64X, but separately as they are in different namespaces).
Reviewed By: jhenderson, efriedma
Differential Revision: https://reviews.llvm.org/D146534
Jacek Caban [Fri, 21 Apr 2023 12:31:21 +0000 (15:31 +0300)]
[llvm-lib] Add support for ARM64EC libraries.
ARM64EC allows having both pure ARM64 objects and ARM64EC in the
same archive. This allows using single static library for linking
pure ARM64, pure ARM64EC or mixed modules (what MS calls ARM64X:
a single module that may be used in both modes). To achieve that,
such static libraries need two separated symbol maps. The usual map
contains only pure ARM64 symbols, while a new /<ECSYMBOLS>/ section
contains EC symbols. EC symbols map has very similar format to the
usual map, except it doesn't contain object offsets and uses offsets
from regular map instead. This is true even for pure ARM64EC static
library: it will simply have 0 symbols in the symbol map.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D143541
Max Kazantsev [Fri, 21 Apr 2023 12:06:06 +0000 (19:06 +0700)]
[BasicBlockUtils][NFCI] Extract branch inverting to a separate method
The motivation is to make possible branch inverting code reuse.
Patch by Aleksandr Popov!
Differential Revision: https://reviews.llvm.org/D148708
Louis Dionne [Fri, 21 Apr 2023 12:37:35 +0000 (08:37 -0400)]
[libc++] Fix likely rebase conflict that was not resolved properly
Nikita Popov [Fri, 21 Apr 2023 12:31:59 +0000 (14:31 +0200)]
[LoopLoadElimination] Preserve DT and LI (NFCI)
This pass makes control-flow changes, but only via LoopSimplify
and LoopVersioning utilities, which perserve DT and LI.
Matt Arsenault [Wed, 19 Apr 2023 22:51:11 +0000 (18:51 -0400)]
ValueTracking: Recognize >=, <= compares with 0 as is.fpclass masks
Leave DAZ handling for a future change.
Matt Arsenault [Wed, 19 Apr 2023 23:08:29 +0000 (19:08 -0400)]
InstCombine: Add some baseline tests for recognizing fcmp as is.fpclass
We should be able to recognize > 0, < 0 indicates the sign.
Ilya Biryukov [Fri, 21 Apr 2023 11:49:27 +0000 (13:49 +0200)]
Revert "Reland [Modules] Remove unnecessary check when generating name lookup table in ASTWriter"
This reverts commit
67b298f6d82e0b4bb648ac0dabe895e816a77ef1.
We got linker errors with undefined symbols during a compiler release
and tracked it down to this change. I am in the process of understanding
what is happening and getting a reproducer.
Sorry for reverting this again.
I will reopen #61065 until we fix this.
Manuel Klimek [Fri, 21 Apr 2023 11:56:37 +0000 (11:56 +0000)]
[clang-format] Fix dropped 'else'.
'else' was dropped accidentally in
398cddf6acec.
Patch by Jared Grubb.
Differential revision: https://reviews.llvm.org/D146310
David Spickett [Thu, 20 Apr 2023 10:07:21 +0000 (10:07 +0000)]
[LLDB] Don't print register fields when asked for a specific format
Previously if a register had fields we would always print them after the
value if the register was asked for by name.
```
(lldb) register read MDCR_EL3
MDCR_EL3 = 0x00000000
= {
ETBAD = 0
<...>
RLTE = 0
}
```
This can be quite annoying if there are a whole lot of fields but you
want to see the register in a specific format.
```
(lldb) register read MDCR_EL3 -f i
MDCR_EL3 = 0x00000000 unknown udf #0x0
= {
ETBAD = 0
<...lots of fields...>
```
Since it pushes the interesting bit far up the terminal. To solve this,
don't print fields if the user passes --format. If they're doing that
then I think it's reasonable to assume they know what they want and only
want to see that output.
This also gives users a way to silence fields, but not change the format.
By doing `register read foo -f x`. In case they are not useful or perhaps
they are trying to work around a crash.
I have customised the help text for --format for register read to explain this:
```
-f <format> ( --format <format> )
Specify a format to be used for display. If this is set, register fields will not be dispayed.
```
Reviewed By: jasonmolenda
Differential Revision: https://reviews.llvm.org/D148790
Jorge Pinto Sousa [Fri, 21 Apr 2023 11:45:05 +0000 (07:45 -0400)]
[clang] trigger -Wcast-qual on functional casts
-Wcast-qual does not trigger on the following code in Clang, but does
in GCC.
const auto i = 42;
using T = int*;
auto p = T(&i);
The expected behavior is that a functional cast should trigger
the warning the same as the equivalent C cast because
the meaning is the same, and nothing about the functional cast
makes it easier to recognize that a const_cast is occurring.
Fixes https://github.com/llvm/llvm-project/issues/62083
Differential Revision: https://reviews.llvm.org/D148276
Alexis Engelke [Fri, 10 Mar 2023 11:26:10 +0000 (12:26 +0100)]
[X86][FastISel] Handle CRC32 intrinsics
Some applications make heavy use of the crc32 operation (e.g., as part
of a hash function), so having a FastISel path avoids fallbacks to
SelectionDAG and improves compile times, in our case by ~1.5%.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D148023
Max Kazantsev [Fri, 21 Apr 2023 10:58:16 +0000 (17:58 +0700)]
[IRCE] Support non-strict range check's predicate
Patch by Aleksandr Popov!
Differential Revision: https://reviews.llvm.org/D148227
Nikita Popov [Fri, 21 Apr 2023 11:15:15 +0000 (13:15 +0200)]
[Pipelines] Don't explicitly require ORE
LICM does not use ORE from the pass manager, it constructs its
own instance. As such, explicitly requiring the analysis in the
pipeline is unnecessary.
Louis Dionne [Thu, 20 Apr 2023 19:06:41 +0000 (15:06 -0400)]
[libc++] Use $CXX instead of 'c++' in run-buildbot
We don't have `c++` anymore in the Docker image, but the script does
require $CXX to be in the environment so that should always work.
Differential Revision: https://reviews.llvm.org/D148830
Matt Arsenault [Mon, 17 Apr 2023 18:48:50 +0000 (14:48 -0400)]
ValueTracking: Add baseline tests for fma computeKnownFPClass
Matt Arsenault [Wed, 19 Apr 2023 13:25:00 +0000 (09:25 -0400)]
ValueTracking: Add tests for fneg/fabs computeKnownFPClass
Matt Arsenault [Mon, 10 Apr 2023 02:18:03 +0000 (22:18 -0400)]
ValueTracking: Implement computeKnownFPClass for fpext
Nikita Popov [Fri, 21 Apr 2023 10:55:12 +0000 (12:55 +0200)]
[Pipelines] Don't request BFI in LICM-only loop pass adaptors
LICM doesn't use BFI anymore, so requesting BFI in these loop
pass adaptors is just a waste of compile-time.
Nikita Popov [Fri, 21 Apr 2023 10:42:22 +0000 (12:42 +0200)]
[NewGVN] Convert tests to opaque pointers (NFC)
Nikita Popov [Fri, 21 Apr 2023 10:40:36 +0000 (12:40 +0200)]
[NewGVN] Regenerate test checks (NFC)
Max Kazantsev [Fri, 21 Apr 2023 10:16:59 +0000 (17:16 +0700)]
[IRCE][NFCI] Refactor parseRangeCheckICmp
Simplify parseRangeCheckICmp:
- If RHS is loop-variant, swap LHS/RHS and swap predicate
- all checks are either IV >(=) const or IV <(=) RHS (maybe not const)
Patch by Aleksandr Popov!
Differential Revision: https://reviews.llvm.org/D148720
Igor Kirillov [Mon, 3 Apr 2023 16:22:01 +0000 (16:22 +0000)]
[CodeGen] Enable AArch64 SVE FCMLA/FCADD instruction generation in ComplexDeinterleaving
This commit adds support for scalable vector types in theComplexDeinterleaving
pass, allowing it to recognize and handle `llvm.vector.interleave2` and
`llvm.vector.deinterleave2` intrinsics for both fixed and scalable vectors
Differential Revision: https://reviews.llvm.org/D147451
Max Kazantsev [Fri, 21 Apr 2023 09:49:18 +0000 (16:49 +0700)]
[FlattenCFG] Replace branch condition with a created one correctly
Fix case when FlattenCFGOpt combines the conditions but doesn't update
branch with a new combined condition. It happens when one of the
combinable condition is inverted and has more then 1 user
Patch by Aleksandr Popov!
Differential Revision: https://reviews.llvm.org/D148707
Max Kazantsev [Fri, 21 Apr 2023 09:41:51 +0000 (16:41 +0700)]
[FlattenCFG] Add a test to demonstrate bug
FlattenCFGOpt combines the conditions but doesn't update branch with a
new combined condition. It happens when one of the combinable condition
is inverted and has more then 1 user.
Patch by Aleksandr Popov!
Differential Revision: https://reviews.llvm.org/D148706
Akshay Khadse [Fri, 21 Apr 2023 09:42:04 +0000 (17:42 +0800)]
[Coverity] Fix uninitialized scalar members in TableGen
This change fixes static code analysis warnings
Reviewed By: skan
Differential Revision: https://reviews.llvm.org/D148815
Nikolas Klauser [Fri, 13 Jan 2023 17:48:17 +0000 (18:48 +0100)]
[libc++][PSTL] Copy the headers into libc++
We decided to integrate the PSTL into our own headers and only share the backend impletementations. This is a first step in that direction, specifically it copies the PSTL headers into the libc++ structure.
Reviewed By: ldionne, #libc
Spies: rodgert, mikhail.ramalho, jplehr, bcain, h-vetinari, Mordante, rarutyun, var-const, sstefan1, pcwang-thead, libcxx-commits, arichardson, mgrang, miyuki
Differential Revision: https://reviews.llvm.org/D141779
Shengchen Kan [Fri, 21 Apr 2023 09:20:00 +0000 (17:20 +0800)]
[X86][tablgen] Fix typo in comments, NFC
Max Kazantsev [Fri, 21 Apr 2023 08:54:19 +0000 (15:54 +0700)]
[Test] Regenerate checks using update_test_checks.py
Carlos Alberto Enciso [Fri, 21 Apr 2023 08:11:40 +0000 (09:11 +0100)]
Revert "Reapply D146987 "[Assignment Tracking] Enable by default""
This reverts commit
b74aeaccbae876ca348aa87a3db05d444052ae65.
Note: The author (Orlando) asked to revert this commit.
Nikita Popov [Thu, 20 Apr 2023 12:59:27 +0000 (14:59 +0200)]
[OpenMP] Replace libomp_check_linker_flag with llvm_check_compiler_linker_flag
Replace the custom libomp_check_linker_flag() implementation with
llvm_check_compiler_linker_flag() from the common cmake utils. Due
to the way the custom implementation is implemented (capturing
output from an entire nested cmake invocation) it can easily end
up incorrectly detecting flags as unavailable, e.g. because "error",
"unknown" or similar occurs inside compiler flags, the directory
name, etc.
Fixes https://github.com/llvm/llvm-project/issues/62240.
Differential Revision: https://reviews.llvm.org/D148798
Andrzej Warzynski [Wed, 12 Apr 2023 19:44:13 +0000 (12:44 -0700)]
[mlir][linalg] Refine `tensor.extract` vectorisation
This patch updates the vectorisation of the extract Op so that the
permutation map for the transfer_read Op is defined explicitly by the
vectoriser (as opposed to being constructed implicitly by the
transfer_read builder).
This change is needed for cases where the rank of the source tensor is
lower than the rank of the output vector generated by the vectoriser:
```mlir
%17 = vector.transfer_read %arg1[%14, %16], %cst_4 {in_bounds = [true, true]} : tensor<257x24xf32>, vector<1x1x4xf32>
```
In cases like this, the vectorize will create the following permutation map:
```
(d0, d1) -> (0, d0, d1)
```
In other cases the behaviour remains unchanged.
Fixes https://github.com/openxla/iree/issues/13036. That's also where
the test case was extracted from.
Differential Revision: https://reviews.llvm.org/D148537
Jay Foad [Fri, 21 Apr 2023 07:28:05 +0000 (08:28 +0100)]
[AMDGPU] Avoid using tuple where pair does suffice
Fixes the following building errors, happening with official Android prebuilt clang 14 shipped with Android 13:
external/llvm-project/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp:5491:13: error: no viable constructor or deduction guide for deduction of template arguments of 'tuple'
? std::tuple(HSAMD::V3::AssemblerDirectiveBegin,
^
...
external/llvm-project/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp:5493:13: error: no viable constructor or deduction guide for deduction of template arguments of 'tuple'
: std::tuple(HSAMD::AssemblerDirectiveBegin,
^
Fixes: 6443c0e ("[AMDGPU] Stop using make_pair and make_tuple. NFC.")
Patch by Mauro Rossi!
Differential Revision: https://reviews.llvm.org/D142839
Dominik Adamski [Fri, 14 Apr 2023 19:04:35 +0000 (14:04 -0500)]
[OpenMP][AMDGPU] Refactor setting uniform work group size attribute
Work group size attribute was set in Clang specific class. That's why
we cannot reuse this code in Flang.
If we move setting of this attribute to OpenMPIRBuilder, then we can reuse this
code in Flang and Clang. Function createOffloadEntry from OpenMPIRBuilder is
already used by Clang (via OpenMPIRBuilder::createOffloadEntriesAndInfoMetadata
function).
Differential Revision: https://reviews.llvm.org/D148525
Reviewed By: jdoerfert
Mehdi Amini [Fri, 21 Apr 2023 06:13:55 +0000 (00:13 -0600)]
Revert "Fix handling of special and large vals in expand pattern for `round`" and "Add pattern that expands `math.roundeven` into `math.round` + arith"
This reverts commit
8d2bae9abdc30e104bab00a4dd0f9d39f5bdda6e and
commit
ab2fc9521ec606603412645d4a4b3cf456acd153.
Tests are broken on Mac M2
Serguei Katkov [Fri, 14 Apr 2023 07:05:03 +0000 (14:05 +0700)]
[BreakFalseDeps] Respect dead blocks.
The pass uses ReachingDefAnalysis which has no information about
instructions in dead blocks.
So do not process them.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D148329
Lang Hames [Fri, 21 Apr 2023 04:47:49 +0000 (21:47 -0700)]
[RuntimeDyld] Disable some ppc64 tests on 32-bit architectures.
These tests have been failing on 32-bit machines.
https://github.com/llvm/llvm-project/issues/62184.
Lang Hames [Fri, 21 Apr 2023 01:50:02 +0000 (18:50 -0700)]
[ORC-RT] Fix typo in include-guard comment.
Akshay Khadse [Fri, 21 Apr 2023 04:22:28 +0000 (12:22 +0800)]
Fix uninitialized scalar members in CodeGen
This change fixes some static code analysis warnings.
Reviewed By: LuoYuanke
Differential Revision: https://reviews.llvm.org/D148811
Shilei Tian [Fri, 21 Apr 2023 04:08:24 +0000 (00:08 -0400)]
[Attributor] Set up a dedicated simplification call back map for `GlobalVariable`
Currently we don't check call backs for global variable simplification.
What's more, the only way that we can register a simplification call back for
global variable is through its initializer (essentially a `Constant *`). It might
not correspond to the right global variable. In this patch, we set up a dedicated
simplification map for `GlobalVariable`.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D144749
Jie Fu [Fri, 21 Apr 2023 03:59:38 +0000 (11:59 +0800)]
[lldb] Fix -Wctad-maybe-unsupported in PathMappingList.cpp (NFC)
/home/jiefu/llvm-project/lldb/source/Target/PathMappingList.cpp:51:5: error: 'scoped_lock' may not intend to support class template argument deduction [-Werror,-Wctad-maybe-unsupported]
std::scoped_lock locks(m_mutex, rhs.m_mutex);
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/mutex:692:11: note: add a deduction guide to suppress this warning
class scoped_lock
^
/home/jiefu/llvm-project/lldb/source/Target/PathMappingList.cpp:72:3: error: 'scoped_lock' may not intend to support class template argument deduction [-Werror,-Wctad-maybe-unsupported]
std::scoped_lock locks(m_mutex, rhs.m_mutex);
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/mutex:692:11: note: add a deduction guide to suppress this warning
class scoped_lock
^
2 errors generated.
Akshay Khadse [Fri, 21 Apr 2023 03:41:42 +0000 (11:41 +0800)]
[Coverity] Fix uninitialized scalar members
This change fixes static code analysis errors
Reviewed By: LuoYuanke
Differential Revision: https://reviews.llvm.org/D148813
LLVM GN Syncbot [Fri, 21 Apr 2023 03:37:17 +0000 (03:37 +0000)]
[gn build] Port
c847b8e24cfd
Nikolas Klauser [Sat, 4 Mar 2023 01:37:37 +0000 (02:37 +0100)]
[libc++] Make bsd_locale_fallbacks.h modular and move it into __locale/locale_base_api/
This is a first step towards granularizing `<locale>`.
Reviewed By: ldionne, #libc
Spies: arichardson, libcxx-commits, mikhail.ramalho
Differential Revision: https://reviews.llvm.org/D146397
Siva Chandra Reddy [Fri, 21 Apr 2023 03:29:36 +0000 (03:29 +0000)]
[libc] Another fix to add a null-terminator to the pthread name.
This fix is similar to the one done in https://reviews.llvm.org/D148844.
This miss was caught by the risv64 builder.
Differential Revision: https://reviews.llvm.org/D148871
Nikolas Klauser [Sun, 16 Apr 2023 20:31:25 +0000 (22:31 +0200)]
[libc++][PSTL] Remove current integration
We decided to go a different route. To make the switch easier, rip out the old integration first and build on a clean base.
Reviewed By: ldionne, #libc, #libc_abi
Spies: arichardson, libcxx-commits
Differential Revision: https://reviews.llvm.org/D148480
Sam McCall [Fri, 21 Apr 2023 03:23:46 +0000 (05:23 +0200)]
[dataflow] allow specifying path to dot with $GRAPHVIZ_DOT
I'd like to use this in a CI system where it's easier to tell the
program about paths than manipulate $PATH.
Chuanqi Xu [Fri, 21 Apr 2023 02:39:15 +0000 (10:39 +0800)]
[doc] [C++20] [Modules] Document that the interfaces of header units is experimental
Close https://github.com/llvm/llvm-project/issues/62241
In tooling group (SG15), it is still unclear how tools should support
header units. Add a warning in the documentation to avoid further
confusions.
Diego Caballero [Fri, 21 Apr 2023 01:16:22 +0000 (01:16 +0000)]
[Vector][NFC] Fix DEBUG_TYPE in LowerVectorTranspose.cpp
Fix wrong debug type.
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D148729
Mircea Trofin [Wed, 19 Apr 2023 23:39:03 +0000 (16:39 -0700)]
[nfc][thinlto] Separate `selectCallee` legality from cutoffs
This makes it easier to reuse the legality part for other import
policies that wouldn't use thresholds.
Importing un-inlinable functions is also legal, because they could be
further specialized in a context-specific way, without inlining.
Differential Revision: https://reviews.llvm.org/D148838
Nick Desaulniers [Fri, 21 Apr 2023 00:23:22 +0000 (17:23 -0700)]
[Demangle] fix another test on windows
Alan spotted another test failure that was a result of
https://reviews.llvm.org/D148546 when running expensive checks tests
locally on windows.
Reviewed By: ayzhao
Differential Revision: https://reviews.llvm.org/D148861
Igor Kudrin [Fri, 21 Apr 2023 00:02:17 +0000 (17:02 -0700)]
[CMake] Add llvm-lib to Clang bootstrap dependency for LTO builds on Windows
Without this dependency, it is possible that llvm-lib.exe will not be
built, in which case CMake will try to use lib.exe to build libraries,
but this tool cannot handle bitcode files.
Differential Revision: https://reviews.llvm.org/D148751
Nick Desaulniers [Thu, 20 Apr 2023 22:59:10 +0000 (15:59 -0700)]
[Demangle] fix windows tests
My reland of https://reviews.llvm.org/D148546 has caused a few windows
demangler tests to fail when run with -DLLVM_ENABLE_EXPENSIVE_CHECKS=ON
on windows.
I have a sneaking suspicion that MSVC's
std::string_view::iterator::operator* may be missing a nullptr check.
Link: https://lab.llvm.org/buildbot/#/builders/42/builds/9723/steps/7/logs/stdio
Reviewed By: ayzhao
Differential Revision: https://reviews.llvm.org/D148852
Mikhail R. Gadelha [Thu, 20 Apr 2023 23:30:23 +0000 (20:30 -0300)]
[libc] Added checks to src and dest types in bit_cast
This patch adds assertions to prevent the compilation when we try to
bit cast a type that is not trivially copyable when using
__builtin_bit_cast, or when we try to bit cast a type that is not
trivially copyable and trivially constructable when using memcpy.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D148739
Joseph Huber [Thu, 20 Apr 2023 22:59:21 +0000 (17:59 -0500)]
[libc] Set minimum CUDA PTX feature to +ptx60
Summary:
The `+ptx` features correspond to the related CUDA version. We require a
certain set of features from the `ptxas` assembler, which is tied to the
CUDA version. Some of the ones set here were insufficient, so I am
simply setting a cutoff to the CUDA 9.0 release as the minimum. This
roughly corresponds to what should be required for sm_60 to be compiled
with the source.
Sp00ph [Thu, 20 Apr 2023 22:26:49 +0000 (15:26 -0700)]
Fix i1 vector reduction miscompilation
Previously, `vecreduce_{and,or} vNi1` could lead to miscompilations because the legalizer first decides to `any_ext` the operand (which is correct for `vecreduce_{and,or}`) and then decides to use `vecreduce_u{min,max}` instead (for which `any_ext` is incorrect). This patch changes it so the `vecreduce_u{min,max}` operations use `sign_ext` instead of `any_ext`.
Issue: https://github.com/llvm/llvm-project/issues/62211
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D148672
Valentin Clement [Thu, 20 Apr 2023 21:42:56 +0000 (14:42 -0700)]
[mlir][openacc] Restrict types for acc.bounds operands to index or integer type
Values in bounds are expected to have integer or index types. Enforce
this expectation by restricting the type to be IntOrIndex.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D148839
Siva Chandra Reddy [Thu, 20 Apr 2023 21:30:36 +0000 (21:30 +0000)]
[libc] Add null-terminator to the thread name obtained from the syscall.
This bug was caught by the aarch64 full build builder.
Differential Revision: https://reviews.llvm.org/D148844
Jez Ng [Thu, 20 Apr 2023 21:23:36 +0000 (17:23 -0400)]
[lld-macho] Tweak the names we give to archive members
In particular, make it `foo.a(foo.o)$ARCHIVE_OFFSET`. The goal is to
make it more similar to both ld64 implementation, which uses the
`foo.a(foo.o)$MODULE_ID` format. We dump some of these names in LTO
code, so matching ld64's format is helpful. This format is also more
similar to LLD-ELF's, which is `foo.a(foo.o at $ARCHIVE_OFFSET)`.
Reviewed By: #lld-macho, oontvoo
Differential Revision: https://reviews.llvm.org/D148828
Peiming Liu [Thu, 20 Apr 2023 21:12:12 +0000 (21:12 +0000)]
[mlir][sparse] fix crash when generating coiteration loop with compressed-hi DLT.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D148842
Craig Topper [Thu, 20 Apr 2023 20:58:24 +0000 (13:58 -0700)]
[RISCV][WIP] Use vsetvli x0, x0 in more cases.
If the AVL is a virtual register defined by a vsetvli with the same
vlmax we need and the previous vsetvli we saw in the data flow also
has that vlmax, we can use the x0, x0 form when we insert a vsetvli.
Not only does this avoid an update of the VL physical register, but
it may allow doLocalPostpass to completely remove the inserted vsetvli
by rewriting the vtype of the previous vsetvli.
Differential Revision: https://reviews.llvm.org/D148735
Craig Topper [Thu, 20 Apr 2023 20:58:19 +0000 (13:58 -0700)]
[RISCV] Pre-commit test case for D148735. NFC
Peter Klausler [Thu, 20 Apr 2023 19:07:09 +0000 (12:07 -0700)]
[flang] Relax two !DIR$ IGNORE_TKR error cases with descriptor arguments
Allow two currently erroneous cases of !DIR$ IGNORE_TKR errors: allocatable
and pointers, and IGNORE_TKR(R) on (other) arguments passed via descriptors.
Downgrade these cases to warnings when they appear in external interfaces,
since their implementations may well be in C. But retain the error status
on these cases for module procedures, since the Fortran implementation
probably can't work.
Differential Revision: https://reviews.llvm.org/D148833
Rahul Kayaith [Sun, 16 Apr 2023 21:28:48 +0000 (17:28 -0400)]
[mlir] Prevent implicit downcasting to interfaces
Currently conversions to interfaces may happen implicitly (e.g.
`Attribute -> TypedAttr`), failing a runtime assert if the interface
isn't actually implemented. This change marks the `Interface(ValueT)`
constructor as explicit so that a cast is required.
Where it was straightforward to I adjusted code to not require casts,
otherwise I just made them explicit.
Depends on D148491, D148492
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D148493
Rahul Kayaith [Sun, 16 Apr 2023 19:47:44 +0000 (15:47 -0400)]
[mlir] Make ElementsAttr inherit from TypedAttr
This allows implicit conversion from `ElementsAttr` to `TypedAttr`, but
required renaming the `ElementsAttr::getType()` interface method to
`getShapedType`.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D148492
Rahul Kayaith [Sun, 16 Apr 2023 21:26:03 +0000 (17:26 -0400)]
[mlir][arith] Add arith.constant materialization helper
This adds `arith::ConstantOp::materialize`, which builds a constant from
an attribute and type only if it would result in a valid op. This is
useful for dialect `materializeConstant` hooks, and allows for removing
the previous `Attribute, Type` builder which was only used during
materialization.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D148491
Alexey Bataev [Thu, 20 Apr 2023 20:27:18 +0000 (13:27 -0700)]
[SLP][NFC]Add a test with an extra cost of the reused extractelement
instruction, NFC.
Peiming Liu [Thu, 20 Apr 2023 17:42:19 +0000 (17:42 +0000)]
use heap memory for position buffer allocated for PackOp.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D148818
Aaron Ballman [Thu, 20 Apr 2023 20:11:42 +0000 (16:11 -0400)]
Add documentation for -Wwrite-strings
This is the first instance where we've really needed to add
documentation for a diagnostic group, but -Wwrite-strings really
deserves it.
This warning option changes the semantic behavior of code, so enabling
it can cause code to break (and disabling it can too). That's worth
calling out loudly in our documentation.
Siva Chandra Reddy [Thu, 20 Apr 2023 07:47:31 +0000 (07:47 +0000)]
[libc] Actually run integration tests.
After the switch to `add_custom_target` to run integration tests, most
of them were not actually being run because of the difference in the way
the COMMAND value is treated between `add_custom_target` and
`add_custom_command`. This patch gets the integration tests to run
again by passing the correct set of arguments to `add_custom_target`.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D148786
Michael Jones [Wed, 19 Apr 2023 23:51:33 +0000 (16:51 -0700)]
[libc] Support constexpr uint initialization
Uint addition and subtraction normally use builtins which aren't
constexpr. This patch adds an rvalue overload version of the addition
and subtraction operation that is always constexpr.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D148759
Doru Bercea [Thu, 20 Apr 2023 18:55:58 +0000 (14:55 -0400)]
Modify test to explicitely use the size of the mapped array.
Review: https://reviews.llvm.org/D148832
Noah Goldstein [Thu, 20 Apr 2023 19:51:10 +0000 (14:51 -0500)]
[LIBC] Implement remainder of posix 'sched.h' minus `SCHED_SPORADIC`
Includes macros:
linux/SCHED_OTHER // posix req
linux/SCHED_FIFO // posix req
linux/SCHED_RR // posix req
linux/SCHED_BATCH
linux/SCHED_ISO
linux/SCHED_IDLE
linux/SCHED_DEADLINE
Includes types:
struct sched_param { int sched_priority; }
Includes functions:
sched_setparam
sched_getparam
sched_setscheduler
sched_getscheduler
sched_get_priority_max
sched_get_priority_min
sched_rr_get_interval
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D148069
Noah Goldstein [Thu, 20 Apr 2023 19:50:00 +0000 (14:50 -0500)]
[LIBC] Fix incorrect handling of `pthread_join(tid, nullptr)`
Previously unconditionally stored to the return value. This is
incorrect, we should only return if user value is non-null.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D148293
Ramiro Leal-Cavazos [Thu, 20 Apr 2023 19:35:57 +0000 (12:35 -0700)]
Add pattern that expands `math.roundeven` into `math.round` + arith
This commit adds a pattern that expands `math.roundeven` into
`math.round` + some ops from `arith`. This is needed to be able to run
`math.roundeven` in a vectorized manner.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D148285
Sam McCall [Thu, 20 Apr 2023 19:37:36 +0000 (21:37 +0200)]
[dataflow] Try to fix missing order dependency in HTMLLogger
LLVM GN Syncbot [Thu, 20 Apr 2023 19:24:12 +0000 (19:24 +0000)]
[gn build] Port
68c3d66a97a0
Roy Sundahl [Wed, 19 Apr 2023 16:32:05 +0000 (09:32 -0700)]
[fuzzer][test] Disable big-file-copy.test for everything but macOS
This test is heavy on test resources and involves moving a large 2GB+ file
across an ssh connection when testing on remote devices. Exclude all tests
except for macOS testing (on host). Remote device testing for macOS may
eventually cause a problem on macOS as well w/o better handling of tests
that require more resource/time than we currently handle.
Introduced by:
https://reviews.llvm.org/D146189
Subsequent exclusion of all but darwin by:
https://reviews.llvm.org/D147094
Subsequent exclusion of tvOS and watchOS by:
https://reviews.llvm.org/D147502
Subsequent exclusion of all but macOS...
rdar://
107570309
Reviewed By: yln, thetruestblue
Differential Revision: https://reviews.llvm.org/D148727
Mark de Wever [Tue, 21 Feb 2023 16:33:56 +0000 (17:33 +0100)]
[libc++][format] Improves width estimate.
As obvious from the paper's title this is an LWG issue and thus retroactively
applied to C++20. This change may the output for certain code points:
1 Considers 8477 extra codepoints as having a width 2 (as of Unicode 15)
(mostly Tangut Ideographs)
2 Change the width of 85 unassigned code points from 2 to 1
3 Change the width of 8 codepoints (in the range U+3248 CIRCLED NUMBER
TEN ON BLACK SQUARE ... U+324F CIRCLED NUMBER EIGHTY ON BLACK
SQUARE) from 2 to 1, because it seems questionable to make an exception
for those without input from Unicode
Note that libc++ already uses Unicode 15, while the Standard requires Unicode 12.
(The last time I checked MSVC STL used Unicode 14.)
So in practice the only notable change is item 3.
Implements
P2675 LWG3780: The Paper
format's width estimation is too approximate and not forward compatible
Benchmark before these changes
--------------------------------------------------------------------
Benchmark Time CPU Iterations
--------------------------------------------------------------------
BM_ascii_text<char> 3928 ns 3928 ns 178131
BM_unicode_text<char> 75231 ns 75230 ns 9158
BM_cyrillic_text<char> 59837 ns 59834 ns 11529
BM_japanese_text<char> 39842 ns 39832 ns 17501
BM_emoji_text<char> 3931 ns 3930 ns 177750
BM_ascii_text<wchar_t> 4024 ns 4024 ns 174190
BM_unicode_text<wchar_t> 63756 ns 63751 ns 11136
BM_cyrillic_text<wchar_t> 44639 ns 44638 ns 15597
BM_japanese_text<wchar_t> 34425 ns 34424 ns 20283
BM_emoji_text<wchar_t> 3937 ns 3937 ns 177684
Benchmark after these changes
--------------------------------------------------------------------
Benchmark Time CPU Iterations
--------------------------------------------------------------------
BM_ascii_text<char> 3914 ns 3913 ns 178814
BM_unicode_text<char> 70380 ns 70378 ns 9694
BM_cyrillic_text<char> 51889 ns 51877 ns 13488
BM_japanese_text<char> 41707 ns 41705 ns 16723
BM_emoji_text<char> 3908 ns 3907 ns 177912
BM_ascii_text<wchar_t> 3949 ns 3948 ns 177525
BM_unicode_text<wchar_t> 64591 ns 64587 ns 10649
BM_cyrillic_text<wchar_t> 44089 ns 44078 ns 15721
BM_japanese_text<wchar_t> 39369 ns 39367 ns 17779
BM_emoji_text<wchar_t> 3936 ns 3934 ns 177821
Benchmarks without "if(__code_point < (__entries[0] >> 14))"
--------------------------------------------------------------------
Benchmark Time CPU Iterations
--------------------------------------------------------------------
BM_ascii_text<char> 3922 ns 3922 ns 178587
BM_unicode_text<char> 94474 ns 94474 ns 7351
BM_cyrillic_text<char> 69202 ns 69200 ns 10157
BM_japanese_text<char> 42735 ns 42692 ns 16382
BM_emoji_text<char> 3920 ns 3919 ns 178704
BM_ascii_text<wchar_t> 3951 ns 3950 ns 177224
BM_unicode_text<wchar_t> 81003 ns 80988 ns 8668
BM_cyrillic_text<wchar_t> 57020 ns 57018 ns 12048
BM_japanese_text<wchar_t> 39695 ns 39687 ns 17582
BM_emoji_text<wchar_t> 3977 ns 3976 ns 176479
This optimization does carry its weight for the Unicode and Cyrillic
test. For the Japanese tests the gains are minor and for emoji it seems
to have no effect.
Reviewed By: ldionne, tahonermann, #libc
Differential Revision: https://reviews.llvm.org/D144499
Fangrui Song [Thu, 20 Apr 2023 19:17:26 +0000 (12:17 -0700)]
[ELF] Cap parallel::strategy to 16 threads when --threads= is unspecified
When --threads= is unspecified, we set it to
`parallel::strategy.compute_thread_count()`, which uses
sched_getaffinity (Linux)/cpuset_getaffinity (FreeBSD)/std::thread::hardware_concurrency (others).
With extensive testing on many machines (many configurations from
{aarch64,x86-64} x {Linux,FreeBSD,Windows} x allocators(native,mimalloc,rpmalloc) combinations)
with varying workloads, we discovered that when the concurrency is larger than
16, the linking process is slower than using --threads=16 due to parallelism
overhead outweighs optimizations. This is particularly harmful for machines with
many cores or when the link job competes with other jobs.
Cap parallel::strategy when --threads= is unspecified.
For some workloads changing the concurrency from 8 to 16 has nearly no improvement.
--thinlto-jobs= is unchanged since ThinLTO backend compiles are embarrassingly
parallel.
Link: https://discourse.llvm.org/t/avoidable-overhead-from-threading-by-default/69160
Reviewed By: peter.smith, andrewng
Differential Revision: https://reviews.llvm.org/D147493
Mark de Wever [Sun, 16 Apr 2023 10:16:36 +0000 (12:16 +0200)]
[libc++][doc] Update format status.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D148459
Teresa Johnson [Wed, 19 Apr 2023 21:51:10 +0000 (14:51 -0700)]
[ThinLTO] Remove BlockCount for non partial sample profile builds
As pointed out in
https://discourse.llvm.org/t/undeterministic-thin-index-file/69985, the
block count added to distributed ThinLTO index files breaks incremental
builds on ThinLTO - if any linked file has a different number of BBs,
then the accumulated sum placed in the index files will change, causing
all ThinLTO backend compiles to be redone.
The block count is only used for scaling of partial sample profiles, and
was added in D80403 for D79831.
This patch simply removes this field from the index files of non partial
sample profile compiles, which is NFC on the output of the compiler.
We subsequently need to see if this can be removed for partial sample
profiles without signficant performance loss, or redesigned in a way
that does not destroy caching.
Differential Revision: https://reviews.llvm.org/D148746
Alexander Yermolovich [Wed, 19 Apr 2023 23:38:08 +0000 (16:38 -0700)]
[dwarfdump][dwarf] Fix parsing of tu-index
Fixed issue where {tu,cu}-index fixup code for DWARF5 that would report an error when
fixup map is empty. Which is the case when seciton(s) are not over 4GB or
--manaully-generate-unit-index is not specified
Differential Revision: https://reviews.llvm.org/D148578
Nathan Sidwell [Wed, 19 Apr 2023 20:08:25 +0000 (16:08 -0400)]
[BOLT] Make BOLT_ENABLE_RUNTIME user-configurable
Defaults to ON for x86_64 && (Linux | Darwin).
If enabled, checks that /proc/self/map_files is readable. Some systems are configured so that getdents fails with EPERM.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D148742
Doru Bercea [Tue, 4 Apr 2023 19:12:08 +0000 (15:12 -0400)]
Fix failure with team-wide allocated variable
Review: https://reviews.llvm.org/D147572
Simon Pilgrim [Thu, 20 Apr 2023 18:38:40 +0000 (19:38 +0100)]
[CostModel][X86] Improve i8 and vXi8 MUL costs
We were treating vXi8 multiply as the sum of a trunc(mul(extend(),extend())) which diverged from the costs from llvm-mcaonce we extended beyond legal types
Use a modified version of the D103695 script to determine more accurate throughput/latency/codesize/size-latency cost estimates
Helps address some of the regressions identified in D148806
Dimitry Andric [Thu, 20 Apr 2023 17:43:37 +0000 (19:43 +0200)]
[compiler-rt] Include system headers before optionally defining HWCAP macros
In https://reviews.llvm.org/D141285 the optional definitions of `HWCAP`
macros were moved to before their usage. However, they were also moved
to before the inclusion of system headers which can optionally define
them. If any of those system headers then actually defined any of the
`HWCAP` macros, it would result in a redefinition error.
Move the system header includes to just before the optional definitions,
to avoid this problem.
Reviewed By: ilinpv
Differential Revision: https://reviews.llvm.org/D148819
Ben Langmuir [Wed, 12 Apr 2023 21:54:55 +0000 (14:54 -0700)]
[clang][modules] Avoid re-exporting PCH imports on every later module import
We only want to make PCH imports visible once for the the TU, not
repeatedly after every subsequent import. This causes some incorrect
behaviour with submodule visibility, and causes us to get extra module
dependencies in the scanner. So far I have only seen obviously incorrect
behaviour when building with -fmodule-name to cause a submodule to be
textually included when using the PCH, though the old behaviour seems
wrong regardless.
rdar://
107449644
Differential Revision: https://reviews.llvm.org/D148176
Nick Desaulniers [Thu, 20 Apr 2023 18:08:04 +0000 (11:08 -0700)]
Reland: [Demangle] replace use of llvm::StringView w/ std::string_view
This reverts commit
d81cdb49d74064e88843733e7da92db865943509.
This refactoring was waiting on converting LLVM to C++17.
Leave StringView.h and cleanup around for subsequent cleanup.
Additional fixes for missing std::string_view conversions for MSVC.
Reviewed By: MaskRay, DavidSpickett, ayzhao
Differential Revision: https://reviews.llvm.org/D148546
Robert Suderman [Thu, 20 Apr 2023 18:10:23 +0000 (18:10 +0000)]
[mlir] Expose Arith::ExpandOps options in constructor
ExpandOpsPass could only be configured via command line flags. Updated
to allowed constructing using the specified Options structure.
Reviewed By: NatashaKnk
Differential Revision: https://reviews.llvm.org/D148820
Jan Svoboda [Thu, 20 Apr 2023 18:03:02 +0000 (11:03 -0700)]
[clang][deps] Print timing information
This patch adds new `-print-timing` option to `clang-scan-deps`. It measures the wall and process time taken to scan dependencies for the compilation database. This provides more representative data compared to measuring the timing for the whole tool invocation, since that includes parsing and generating JSON files, which can be significant for larger inputs.
Reviewed By: akyrtzi
Differential Revision: https://reviews.llvm.org/D147815
Ramiro Leal-Cavazos [Thu, 20 Apr 2023 18:00:08 +0000 (18:00 +0000)]
Fix handling of special and large vals in expand pattern for `round`
The current expand pattern for `math.round` does not handle the
special values -0.0, +-inf, and +-nan correctly. It also does not
properly handle values with magnitude |x| >= 2^23. Lastly, the pattern
generates invalid IR when the input to `math.round` is a vector. This
patch fixes these issues.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D148398
David Green [Thu, 20 Apr 2023 18:05:45 +0000 (19:05 +0100)]
[DAG] Retain nuw flags when reassociating adds
Given two adds that are both nuw, they will still be nuw after being
reassociated. (They only increase in value and at no point wrap).
https://alive2.llvm.org/ce/z/JrYM6H
Differential Revision: https://reviews.llvm.org/D148804