Aart Bik [Thu, 8 Sep 2022 05:46:31 +0000 (22:46 -0700)]
[mlir][sparse] fix bug in workspace dimension computation
Access pattern expansion is always done along the innermost stored
dimension, but this was incorrectly reordered due to using a
general utility typically used by original dimensions only.
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D133472
Thomas Lively [Thu, 8 Sep 2022 15:07:48 +0000 (08:07 -0700)]
[WebAssembly] Prototype `f32x4.relaxed_dot_bf16x8_add_f32`
As proposed in https://github.com/WebAssembly/relaxed-simd/issues/77. Only an
LLVM intrinsic and a clang builtin are implemented. Since there is no bfloat16
type, use u16 to represent the bfloats in the builtin function arguments.
Differential Revision: https://reviews.llvm.org/D133428
Joe Loser [Wed, 7 Sep 2022 00:06:58 +0000 (18:06 -0600)]
[llvm] Use std::size instead of llvm::array_lengthof
LLVM contains a helpful function for getting the size of a C-style
array: `llvm::array_lengthof`. This is useful prior to C++17, but not as
helpful for C++17 or later: `std::size` already has support for C-style
arrays.
Change call sites to use `std::size` instead.
Differential Revision: https://reviews.llvm.org/D133429
Djordje Todorovic [Thu, 8 Sep 2022 15:00:36 +0000 (17:00 +0200)]
Revert "Recommit "[AggressiveInstCombine] Lower Table Based CTTZ""
This reverts commit
f87993915768772d113bfd524347ce4341b843cf.
Krzysztof Parzyszek [Thu, 8 Sep 2022 14:06:05 +0000 (07:06 -0700)]
[Hexagon] Handle shifts of short vectors of i8
Eric Wang [Thu, 8 Sep 2022 00:12:29 +0000 (17:12 -0700)]
[NFC][Regalloc] Introduce the RegAllocPriorityAdvisorAnalysis
This patch introduces the priority analysis and the priority advisor,
the default implementation, and the scaffolding for introducing the
other implementations of the advisor.
Reviewed By: mtrofin
Differential Revision: https://reviews.llvm.org/D132835
Sanjay Patel [Thu, 8 Sep 2022 14:44:49 +0000 (10:44 -0400)]
[InstCombine] Fold icmp of truncated left shift
(trunc (1 << Y) to iN) == 0 --> Y u>= N
(trunc (1 << Y) to iN) != 0 --> Y u< N
These can be generalized in several ways as noted by the TODO
items, but this handles the pattern in the motivating bug report.
Fixes #51889
Differential Revision: https://reviews.llvm.org/D115480
Florian Hahn [Thu, 8 Sep 2022 14:45:32 +0000 (15:45 +0100)]
[AArch64] Add tests for lowering trunc to i8 using tbl.
Djordje Todorovic [Wed, 7 Sep 2022 09:57:43 +0000 (11:57 +0200)]
Recommit "[AggressiveInstCombine] Lower Table Based CTTZ"
Ivan Kosarev [Thu, 8 Sep 2022 13:56:37 +0000 (14:56 +0100)]
[AMDGPU] Only raise wave priority if there is a long enough sequence of VALU instructions.
Reviewed By: nhaehnle
Differential Revision: https://reviews.llvm.org/D124671
Jay Foad [Thu, 8 Sep 2022 13:13:17 +0000 (14:13 +0100)]
[AMDGPU] Add basic tests for emitting v_fma_f16 and friends
Florian Hahn [Thu, 8 Sep 2022 13:27:58 +0000 (14:27 +0100)]
[VPlan] Only generate single instr for loads uniform across all parts.
VPReplicateRecipe::isUniform actually means uniform-per-parts, hence a
scalar instruction is generated per-part.
This is a potential alternative D132892. For now the current patch only
catches cases where the address is trivially invariant (defined outside
VPlan), while D132892 catches any address that is considered invariant
by SCEV AFAICT.
It should be possible to hoist fully invariant recipes feeding loads out
of the vector loop region as well, but in practice LICM should do that
already.
This version of the patch artificially limits this to loads to make it
easier to compare, but this restriction should be easily liftable.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D133019
Florian Hahn [Thu, 8 Sep 2022 13:01:11 +0000 (14:01 +0100)]
[AArch64] Add tests for shuffle (tbl2, tbl2) -> tbl4 fold.
Add extra tests where shuffle (tbl2, tbl2) can be folded to tbl4.
Regenerate check lines automatically as well.
Nikita Popov [Thu, 8 Sep 2022 12:52:35 +0000 (14:52 +0200)]
[LICM] Add test for sret with conditional store (NFC)
Christian Sigg [Wed, 7 Sep 2022 21:59:18 +0000 (23:59 +0200)]
[lit] Test changes to make it work with bazel
These non-functional changes will make it easier to add the lit tests to the bazel build (see utils/bazel).
Reviewed By: bkramer
Differential Revision: https://reviews.llvm.org/D133416
Matt Devereau [Thu, 8 Sep 2022 11:30:06 +0000 (11:30 +0000)]
[AArch64][SVE] Add out of range SVE arg CC test
Add calling convention test for callee functions that have SVE
parameters outside of the z0-z7 range
liqinweng [Thu, 8 Sep 2022 10:33:29 +0000 (18:33 +0800)]
[AARCH64][COST] Improve cost of reverse shuffles for AArch64
Update the comments for reverse shuffles and add tests
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D132730
liqinweng [Thu, 8 Sep 2022 10:25:20 +0000 (18:25 +0800)]
[RISCV][COST] Add cost model for mask vector select instruction when its condition is a scalar type
Reviewed By: jacquesguan
Differential Revision: https://reviews.llvm.org/D132992
Manuel Brito [Thu, 8 Sep 2022 10:35:59 +0000 (11:35 +0100)]
[unittests] Change operands of Add in AsmWriterTest from Undef to Poison
Replacing UndefValue with PoisonValue in this test where it's use as dummy value
in light of the efforts to remove undef from llvm.
Differential Revision: https://reviews.llvm.org/D133481
Nico Weber [Thu, 8 Sep 2022 10:28:45 +0000 (06:28 -0400)]
[gn build] port
a0365abad811
David Spickett [Thu, 1 Sep 2022 13:30:39 +0000 (13:30 +0000)]
[LLVM][ARM] Remove options for armv2, 2A, 3 and 3M
Fixes #57486
These pre v4 architectures are not specifically supported
by codegen. As demonstrated in the linked issue.
GCC has not supported 3M since GCC 9 and presumably
2 and 2A earlier than that. So we are aligned in that sense.
(see https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=
2abd6e34fcf3bd9f9ffafcaa47cdc3ed443f9add)
This removes the options and associated testing.
The Pre_v4 build attribute remains mainly because its absence
would be more confusing. It will not be used other than to
complete the list of build attributes as shown in the ABI.
https://github.com/ARM-software/abi-aa/blob/main/addenda32/addenda32.rst#3352the-target-related-attributes
Reviewed By: nickdesaulniers, peter.smith, rengolin
Differential Revision: https://reviews.llvm.org/D133109
Johannes Reifferscheid [Thu, 8 Sep 2022 09:04:33 +0000 (11:04 +0200)]
Fix clang-format.
chenglin.bi [Thu, 8 Sep 2022 08:52:25 +0000 (16:52 +0800)]
[AArch64] add i56 load store pair test case; NFC
Fangrui Song [Thu, 8 Sep 2022 08:39:06 +0000 (01:39 -0700)]
[Driver] Support -gz=zstd
The driver option translates to --compress-debug-sections=zstd cc1/cc1as/GNU
assembler/linker options.
`clang -g -gz=zstd -c a.c` generates ELFCOMPRESS_ZSTD compressed debug info
sections if compression decreases size.
Nikita Popov [Wed, 7 Sep 2022 09:36:19 +0000 (11:36 +0200)]
[ConstantExpr] Remove fneg expression
As part of https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179,
this removes the fneg constant expression (which is, incidentally,
the only unary operator expression).
Differential Revision: https://reviews.llvm.org/D133418
Johannes Reifferscheid [Thu, 8 Sep 2022 07:38:50 +0000 (09:38 +0200)]
One-shot-bufferize: fix for inconsistent while arg types in before/after.
Currently, if the `before` and `after` regions of a while op have
tensor args in different indices, this leads to a crash.
This moves the pass-through check for args to the handling of the
condition block, since that is where the results are produced, so
it's also where copies must be made.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D133477
Fangrui Song [Thu, 8 Sep 2022 08:22:04 +0000 (08:22 +0000)]
C++/ObjC++: switch to gnu++17 as the default standard
Clang's default C++ standard is now `gnu++17` instead of `gnu++14`:
https://discourse.llvm.org/t/c-objc-switch-to-gnu-17-as-the-default-standard/64360
* CUDA/HIP are unchanged: C++14 from D103221.
* Sony PS4/PS5 are unchanged: https://discourse.llvm.org/t/c-objc-switch-to-gnu-17-as-the-default-standard/64360/6
* lit feature `default-std-cxx` is added to keep CLANG_DEFAULT_STD_CXX=xxx tests working.
Whether the cmake variable should be retained is disccused in D133375.
Depends on D131464
Reviewed By: #clang-language-wg, aaron.ballman
Differential Revision: https://reviews.llvm.org/D131465
Uday Bondhugula [Sat, 3 Sep 2022 05:56:29 +0000 (11:26 +0530)]
Improve diagnostic when emitting operations with regions
This has a broad impact on diagnostics that attach an operation. Ops
with one or more regions will now be printed on a new line. It was
confusing and hard to read with a trailing first line for ops
with regions.
Before:
```
<unknown>:0: note: see current operation: affine.for %arg3 = 0 to 8192 {
affine.for %arg4 = 0 to 8192 step 512 {
affine.for %arg5 = 0 to 8192 step 128 {
...
```
After:
```
<unknown>:0: note: see current operation:
affine.for %arg3 = 0 to 8192 {
affine.for %arg4 = 0 to 8192 step 512 {
affine.for %arg5 = 0 to 8192 step 128 {
...
```
Differential Revision: https://reviews.llvm.org/D132645
Valentin Clement [Thu, 8 Sep 2022 08:15:36 +0000 (10:15 +0200)]
[flang] Deallocate intent(out) allocatables
From Fortran 2018 standard 9.7.3.2 point 6:
When a procedure is invoked, any allocated allocatable object that is an actual
argument corresponding to an INTENT (OUT) allocatable dummy argument is
deallocated; any allocated allocatable object that is a subobject of an actual
argument corresponding to an INTENT (OUT) dummy argument is deallocated.
Deallocation is done on the callee side. For BIND(C) procedure, the deallocation
is also done on the caller side.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D133348
Timm Bäder [Thu, 8 Sep 2022 08:02:36 +0000 (10:02 +0200)]
[clang][Interp] Only initialize initmaps for primitive arrays
As the comment states, this code should only run for primitive arrays.
This should fix the memory sanitize builds.
Fangrui Song [Thu, 8 Sep 2022 08:00:06 +0000 (01:00 -0700)]
[MC] Support writing ELFCOMPRESS_ZSTD compressed debug info sections
and add --compress-debug-sections=zstd to llvm-mc for testing.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D130724
Fangrui Song [Thu, 8 Sep 2022 07:59:14 +0000 (00:59 -0700)]
[llvm-objcopy] Support --{,de}compress-debug-sections for zstd
Also, add ELFCOMPRESS_ZSTD (2) from the approved generic-abi proposal:
https://groups.google.com/g/generic-abi/c/satyPkuMisk
("Add new ch_type value: ELFCOMPRESS_ZSTD")
Link: https://discourse.llvm.org/t/rfc-zstandard-as-a-second-compression-method-to-llvm/63399
("[RFC] Zstandard as a second compression method to LLVM")
Reviewed By: jhenderson, dblaikie
Differential Revision: https://reviews.llvm.org/D130458
Fangrui Song [Thu, 8 Sep 2022 07:58:54 +0000 (00:58 -0700)]
[Support] Add llvm::compression::{getReasonIfUnsupported,compress,decompress}
as high-level API on top of `llvm::compression::{zlib,zstd}::*`:
* getReasonIfUnsupported: return nullptr if the specified format is
supported, or (if unsupported) a string like `LLVM was not built with LLVM_ENABLE_ZLIB ...`
* compress: dispatch to zlib::uncompress or zstd::uncompress
* decompress: dispatch to zlib::uncompress or zstd::uncompress
Move `llvm::DebugCompressionType` from MC to Support to avoid Support->MC cyclic
dependency. There are 40+ uses in llvm-project.
Add another enum class `llvm::compression::Format` to represent supported
compression formats, which may be a superset of ELF compression formats.
See D130458 (llvm-objcopy --{,de}compress-debug-sections for zstd) for a use
case.
Link: https://discourse.llvm.org/t/rfc-zstandard-as-a-second-compression-method-to-llvm/63399
("[RFC] Zstandard as a second compression method to LLVM")
---
Note: this patch alone will cause -Wswitch to llvm/lib/ObjCopy/ELF/ELFObject.cpp
Reviewed By: ckissane, dblaikie
Differential Revision: https://reviews.llvm.org/D130506
Nikita Popov [Thu, 8 Sep 2022 07:45:50 +0000 (09:45 +0200)]
Revert "C++/ObjC++: switch to gnu++17 as the default standard"
This reverts commit
e321c8dd2cea8365045ed44ae1c3c00c6a977d2e.
This causes many failures in llvm-test-suite, for example:
/home/npopov/repos/llvm-test-suite/build-O3/tools/timeit --summary MultiSource/Applications/lambda-0.1.3/CMakeFiles/lambda.dir/token_stream.cc.o.time /home/npopov/repos/llvm-project/build/bin/clang++ -DNDEBUG -I/home/npopov/repos/llvm-test-suite/MultiSource/Applications/lambda-0.1.3 -O3 -w -Werror=date-time -MD -MT MultiSource/Applications/lambda-0.1.3/CMakeFiles/lambda.dir/token_stream.cc.o -MF MultiSource/Applications/lambda-0.1.3/CMakeFiles/lambda.dir/token_stream.cc.o.d -o MultiSource/Applications/lambda-0.1.3/CMakeFiles/lambda.dir/token_stream.cc.o -c /home/npopov/repos/llvm-test-suite/MultiSource/Applications/lambda-0.1.3/token_stream.cc
/home/npopov/repos/llvm-test-suite/MultiSource/Applications/lambda-0.1.3/token_stream.cc:192:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
register char chr;
^~~~~~~~~
Nikita Popov [Thu, 8 Sep 2022 07:32:54 +0000 (09:32 +0200)]
Revert "[Support] Add llvm::compression::{getReasonIfUnsupported,compress,decompress}"
This reverts commit
19dc3cff0f771bb8933136ef68e782553e920d04.
This reverts commit
5b19a1f8e88da9ec92b995bfee90043795c2c252.
This reverts commit
9397648ac8ad192f7e6e6a8e6894c27bf7e024e9.
This reverts commit
10842b44759f987777b08e7714ef77da2526473a.
Breaks the GCC build, as reported here:
https://reviews.llvm.org/D130506#3776415
Fangrui Song [Thu, 8 Sep 2022 07:13:25 +0000 (00:13 -0700)]
[Support] Work around GCC's enum support
Fangrui Song [Thu, 8 Sep 2022 07:03:39 +0000 (00:03 -0700)]
[MC] Support writing ELFCOMPRESS_ZSTD compressed debug info sections
and add --compress-debug-sections=zstd to llvm-mc for testing.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D130724
Fangrui Song [Thu, 8 Sep 2022 06:53:40 +0000 (23:53 -0700)]
[llvm-objcopy] Support --{,de}compress-debug-sections for zstd
Also, add ELFCOMPRESS_ZSTD (2) from the approved generic-abi proposal:
https://groups.google.com/g/generic-abi/c/satyPkuMisk
("Add new ch_type value: ELFCOMPRESS_ZSTD")
Link: https://discourse.llvm.org/t/rfc-zstandard-as-a-second-compression-method-to-llvm/63399
("[RFC] Zstandard as a second compression method to LLVM")
Reviewed By: jhenderson, dblaikie
Differential Revision: https://reviews.llvm.org/D130458
Fangrui Song [Thu, 8 Sep 2022 06:53:14 +0000 (23:53 -0700)]
[Support] Add llvm::compression::{getReasonIfUnsupported,compress,decompress}
as high-level API on top of `llvm::compression::{zlib,zstd}::*`:
* getReasonIfUnsupported: return nullptr if the specified format is
supported, or (if unsupported) a string like `LLVM was not built with LLVM_ENABLE_ZLIB ...`
* compress: dispatch to zlib::uncompress or zstd::uncompress
* decompress: dispatch to zlib::uncompress or zstd::uncompress
Move `llvm::DebugCompressionType` from MC to Support to avoid Support->MC cyclic
dependency. There are 40+ uses in llvm-project.
Add another enum class `llvm::compression::Format` to represent supported
compression formats, which may be a superset of ELF compression formats.
See D130458 (llvm-objcopy --{,de}compress-debug-sections for zstd) for a use
case.
Link: https://discourse.llvm.org/t/rfc-zstandard-as-a-second-compression-method-to-llvm/63399
("[RFC] Zstandard as a second compression method to LLVM")
Differential Revision: https://reviews.llvm.org/D130506
jacquesguan [Wed, 7 Sep 2022 06:28:46 +0000 (14:28 +0800)]
[mlir][Math] Add constant folder for RoundOp.
This patch uses round/roundf of libm to fold RoundOp of constant.
Differential Revision: https://reviews.llvm.org/D133401
gonglingqin [Thu, 8 Sep 2022 05:56:59 +0000 (13:56 +0800)]
[LoongArch] Add codegen support for atomicrmw xchg operation on LA32
Depends on D131228
Differential Revision: https://reviews.llvm.org/D131229
gonglingqin [Tue, 19 Jul 2022 08:39:05 +0000 (16:39 +0800)]
[LoongArch] Add codegen support for atomicrmw xchg operation on LA64
In order to avoid the patch being too large, the atomicrmw xchg operation
on LA32 will be added later
Differential Revision: https://reviews.llvm.org/D131228
Christian Sigg [Thu, 8 Sep 2022 05:46:10 +0000 (07:46 +0200)]
[MLIR] NFC: add back exports_files(["run_lit.sh"]).
Timm Bäder [Tue, 6 Sep 2022 07:34:23 +0000 (09:34 +0200)]
[clang][Interp][NFC] Use constexpr if when possible in Integral.h
Timm Bäder [Mon, 29 Aug 2022 18:29:19 +0000 (20:29 +0200)]
[clang][Interp][NFC] Context::classify() can be const
Timm Bäder [Wed, 31 Aug 2022 14:09:40 +0000 (16:09 +0200)]
[clang][Interp] Implement array initializers and subscript expressions
Differential Revision: https://reviews.llvm.org/D132727
Timm Bäder [Mon, 29 Aug 2022 08:20:24 +0000 (10:20 +0200)]
[clang][Interp] Handle missing local initializers better
This is illegal in a constexpr context. We can already figure that out,
but we'd still run into an assertion later on when trying to visit the
missing initializer or run the invalid function.
Differential Revision: https://reviews.llvm.org/D132832
Timm Bäder [Sat, 27 Aug 2022 15:37:26 +0000 (17:37 +0200)]
[clang][Interp] Handle SubstNonTypeTemplateParmExprs
Differential Revision: https://reviews.llvm.org/D132831
Timm Bäder [Sat, 27 Aug 2022 06:21:59 +0000 (08:21 +0200)]
[clang][Interp] Implement ImplicitValueInitExprs
Take the existing Zero opcode and emit it.
Differential Revision: https://reviews.llvm.org/D132829
Timm Bäder [Fri, 26 Aug 2022 13:39:17 +0000 (15:39 +0200)]
[clang][Interp] Implement IntegralToBoolean casts
Redo how we do IntegralCasts and implement IntegralToBoolean casts using
the already existing cast op.
Differential Revision: https://reviews.llvm.org/D132739
Timm Bäder [Fri, 19 Aug 2022 11:45:11 +0000 (13:45 +0200)]
[clang][Interp] Implement function calls
Add Call() and CallVoid() ops and use them to call functions. Only
FunctionDecls are supported for now.
Differential Revision: https://reviews.llvm.org/D132286
Timm Bäder [Thu, 18 Aug 2022 14:06:08 +0000 (16:06 +0200)]
[clang] Perform implicit lvalue-to-rvalue cast with new interpreter
The EvaluateAsRValue() documentation mentions that an implicit
lvalue-to-rvalue cast is being performed if the result is an lvalue.
However, that was not being done if the new constant interpreter was in
use.
Just always do it.
Differential Revision: https://reviews.llvm.org/D132136
Fangrui Song [Thu, 8 Sep 2022 05:02:26 +0000 (22:02 -0700)]
[NewPM] Switch -filter-passes from ClassName to pass-name
NewPM -filter-passes (D86360) uses ClassName instead of pass-name as used in
`-passes`, `-print-after`, etc. D87216 has added a mechanism to map
ClassName to pass-name. Adopt it for -filter-passes.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D133263
Arthur Eubanks [Thu, 8 Sep 2022 04:38:00 +0000 (21:38 -0700)]
[NFC][MachineFunctionPass] Only lookup pass name if we request printing
Should report the small compile time regression reported in D133055.
Craig Topper [Thu, 8 Sep 2022 03:54:49 +0000 (20:54 -0700)]
[X86] Pre-commit test for PR57576. NFC
Amir Ayupov [Thu, 8 Sep 2022 02:17:39 +0000 (19:17 -0700)]
[BOLT][TEST] Remove functions with dynamic exception specification
Clang has switched to gnu++17 by default with https://reviews.llvm.org/D131465.
C++17 removes dynamic exception specification. Remove its use as it wasn't
properly tested.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D133467
Chenbing Zheng [Thu, 8 Sep 2022 03:12:55 +0000 (11:12 +0800)]
[InstCombine] extractvalue (any_mul_with_overflow X, 2^n), 0 -> X << n
Alive2: https://alive2.llvm.org/ce/z/JLmabt (umul)
https://alive2.llvm.org/ce/z/J_ruXR (smul)
https://alive2.llvm.org/ce/z/o9SVSz (vector)
Reviewed By: spatel, RKSimon
Differential Revision: https://reviews.llvm.org/D133188
Michael Berg [Thu, 8 Sep 2022 02:20:13 +0000 (19:20 -0700)]
[NFC][DSE] Add a masked dead store test that should rely on additional guards for removal.
Ryan Prichard [Wed, 7 Sep 2022 21:27:57 +0000 (17:27 -0400)]
[libunwind] Fix a few libunwind includes
In UnwindCursor.hpp, include config.h before checking _LIBUNWIND_SUPPORT_SEH_UNWIND.
Include libunwind_ext.h for UNW_STEP_SUCCESS.
Differential Revision: https://reviews.llvm.org/D86766
Katherine Rasmussen [Wed, 31 Aug 2022 19:12:00 +0000 (12:12 -0700)]
[flang] Write semantics test for atomic_fetch_add
Write a semantics test for the atomic intrinsic subroutine,
atomic_fetch_add.
Reviewed By: rouson
Differential Revision: https://reviews.llvm.org/D133139
Mehdi Amini [Mon, 29 Aug 2022 11:24:57 +0000 (11:24 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in CRunnerUtils.cpp (NFC)
Mehdi Amini [Mon, 29 Aug 2022 11:22:27 +0000 (11:22 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param in VectorDistribute.cpp (NFC)
River Riddle [Tue, 30 Aug 2022 22:25:55 +0000 (15:25 -0700)]
[mlir:PassTiming] Always use parentInfo for determining pipeline parent scope
This fixes a bug where, depending on thread usage, a pipeline may be
misattributed to a timer that wasn't it's parent.
Differential Revision: https://reviews.llvm.org/D132979
Fabian Parzefall [Wed, 7 Sep 2022 23:28:01 +0000 (16:28 -0700)]
[BOLT] Distinguish sections in heatmap
Output different letters for different sections in the heatmap to
visually separate sections.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D133068
Justin Bogner [Wed, 24 Aug 2022 22:35:02 +0000 (15:35 -0700)]
[AMDGPU] Drop _oneuse checks from med3 patterns
We use _oneuse checks to make sure combines won't accidentally
increase code size, but this prevents the optimization in cases where
we happen to want to clamp multiple values to the same range
It's safe to drop these checks for two reasons:
1. The pattern of max/min operations for med3 is complicated enough
it's unlikely to come up by accident, so this will still only fire
when appropriate to do so
2. Even if every intermediate is used and we don't save a single
operation, we still won't end up with more operations since the
med3 replaces the final max/min.
In pathological cases we could potentially end up with a larger
encoding size or possibly slightly increased vgpr pressure, but the
risk of that is low, especially considering the upside.
Differential Revision: https://reviews.llvm.org/D132621
Stanislav Mekhanoshin [Wed, 7 Sep 2022 22:24:11 +0000 (15:24 -0700)]
[AMDGPU] Fix liveness verifier error in hazard recognizer
After D133067 we are inserting swaps to use a new physical
register. I have noticed verifier errors about undefined
physical register uses if we are tracking liveness post RA.
We have no access to LIS at this point, so mark new register
uses as undef to calm down the verifier. Liveness should not
matter at this point anyway.
Note the description of the RegState::Undef: "Value of the
register doesn't matter." I.e. it does not say it is strictly
undefined. In fact that is what we really need: this value
does not matter.
I also had to modify the test a bit since with tracking enabled
it does not pass verification even before the recognizer.
Differential Revision: https://reviews.llvm.org/D133459
Tue Ly [Wed, 7 Sep 2022 06:20:45 +0000 (02:20 -0400)]
[libc][math] Implement asinf function correctly rounded for all rounding modes.
Implement asinf function correctly rounded for all rounding modes.
For `|x| <= 0.5`, we approximate `asin(x)` by
```
asin(x) = x * P(x^2)
```
where `P(X^2) = Q(X)` is a degree-20 minimax even polynomial approximating
`asin(x)/x` on `[0, 0.5]` generated by Sollya with:
```
> Q = fpminimax(asin(x)/x, [|0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20|],
[|1, D...|], [0, 0.5]);
```
When `|x| > 0.5`, we perform range reduction as follow:
Assume further that `0.5 < x <= 1`, and let:
```
y = asin(x)
```
We will use the double angle formula:
```
cos(2X) = 1 - 2 sin^2(X)
```
and the complement angle identity:
```
x = sin(y) = cos(pi/2 - y)
= 1 - 2 sin^2 (pi/4 - y/2)
```
So:
```
sin(pi/4 - y/2) = sqrt( (1 - x)/2 )
```
And hence:
```
pi/4 - y/2 = asin( sqrt( (1 - x)/2 ) )
```
Equivalently:
```
asin(x) = y = pi/2 - 2 * asin( sqrt( (1 - x)/2 ) )
```
Let `u = (1 - x)/2`, then
```
asin(x) = pi/2 - 2 * asin(u)
```
Moreover, since `0.5 < x <= 1`,
```
0 <= u < 1/4, and 0 <= sqrt(u) < 0.5.
```
And hence we can reuse the same polynomial approximation of `asin(x)` when
`|x| <= 0.5`:
```
asin(x) = pi/2 - 2 * u * P(u^2).
```
Performance benchmark using `perf` tool from the CORE-MATH project on Ryzen 1700:
```
$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh asinf
CORE-MATH reciprocal throughput : 23.418
System LIBC reciprocal throughput : 27.310
LIBC reciprocal throughput : 22.741
$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh asinf --latency
GNU libc version: 2.35
GNU libc release: stable
CORE-MATH latency : 58.884
System LIBC latency : 62.055
LIBC latency : 62.037
```
Reviewed By: orex, zimmermann6
Differential Revision: https://reviews.llvm.org/D133400
Aart Bik [Wed, 7 Sep 2022 22:08:29 +0000 (15:08 -0700)]
[mlir][sparse] change variable dimension to fixed attribute pointers/indices
The "sparsification" pass does not need the ability to use runtime values for
the dimension, so the only source for variability would have been user code.
Restricting the dimension to constants simplifies code generation.
Reviewed By: Peiming, wrengr
Differential Revision: https://reviews.llvm.org/D133458
Tue Ly [Tue, 6 Sep 2022 18:18:18 +0000 (14:18 -0400)]
[libc] Return correct values for hypot when overflowed.
Hypot incorrectly returns +Inf when overflowed with FE_DOWNWARD and
FE_TOWARDZERO rounding modes.
Reviewed By: sivachandra, zimmermann6
Differential Revision: https://reviews.llvm.org/D133370
Marc Auberer [Wed, 7 Sep 2022 23:12:23 +0000 (19:12 -0400)]
[InstCombine] Baseline tests for folding x + (x | -x) to x & (x - 1)
Baseline tests for D133362
Differential Revision: https://reviews.llvm.org/D133449
Fangrui Song [Wed, 7 Sep 2022 23:06:19 +0000 (16:06 -0700)]
Revert D133266 "[MinGW] Reject explicit non-default visibility applied to dllexport/dllimport declaration"
This reverts commit
91d8324366f405e871aa8174ab61fc66912964dd.
The combo dllexport protected makes sense and is used by PlayStation.
Will change the patch to allow dllexport protected.
LLVM GN Syncbot [Wed, 7 Sep 2022 23:00:40 +0000 (23:00 +0000)]
[gn build] Port
97c2220565ab
LLVM GN Syncbot [Wed, 7 Sep 2022 23:00:39 +0000 (23:00 +0000)]
[gn build] Port
3e7350f3173b
Sami Tolvanen [Wed, 7 Sep 2022 19:22:17 +0000 (19:22 +0000)]
[InstCombine] Fix a crash in -kcfi debug block
Don't attempt to print out DebugLoc as we may not have one.
Nico Weber [Wed, 7 Sep 2022 22:55:07 +0000 (18:55 -0400)]
[gn build] port
aa484c90cf59
Nico Weber [Wed, 7 Sep 2022 22:52:06 +0000 (18:52 -0400)]
[gn build] port
e321c8dd2cea
Joseph Huber [Wed, 7 Sep 2022 18:37:26 +0000 (13:37 -0500)]
[Libomptarget] Implement OpenMP 5.2 semantics for device pointers
In OpenMP 5.2, §5.8.6, page 160 line 32-33, when a device pointer
allocated by omp_target_alloc has implicitly been included on a target
construct as a zero-length array, the pointer initialisation should not
find a matching mapped list item, and so should retain its value as a
firstprivate variable. Previously, we would return a null pointer if the
list item was not found. This patch updates the map handling to the
OpenMP 5.2 semantics.
Reviewed By: jdoerfert, ye-luo
Differential Revision: https://reviews.llvm.org/D133447
Krzysztof Parzyszek [Wed, 7 Sep 2022 21:46:22 +0000 (14:46 -0700)]
[Hexagon] Move vectorization checks from subtarget to TTI
Volodymyr Sapsai [Tue, 28 Jun 2022 03:06:07 +0000 (20:06 -0700)]
[ODRHash diagnostics] Move `ODRDiagsEmitter` to libAST in separate files. NFC.
Intend to use `ODRDiagsEmitter` during parsing to diagnose a parsed
definition differing from a definition with the same name from a hidden
[sub]module.
Differential Revision: https://reviews.llvm.org/D128695
Stanislav Mekhanoshin [Wed, 31 Aug 2022 21:14:05 +0000 (14:14 -0700)]
[AMDGPU] W/a hazard if 64 bit shift amount is a highest allocated VGPR
In this case gfx90a uses v0 instead of the correct register. Swap
the value temporarily with a lower register and then swap it back.
Unfortunately hazard recognizer works after wait count insertion,
so we cannot simply reuse an arbitrary register, hence w/a also
includes a full waitcount. This can be avoided if we run it from
expandPostRAPseudo, but that is a complete misplacement.
Differential Revision: https://reviews.llvm.org/D133067
Fangrui Song [Wed, 7 Sep 2022 21:17:52 +0000 (14:17 -0700)]
C++/ObjC++: switch to gnu++17 as the default standard
Clang's default C++ standard is now `gnu++17` instead of `gnu++14`:
https://discourse.llvm.org/t/c-objc-switch-to-gnu-17-as-the-default-dialect/64360
* CUDA/HIP are unchanged: C++14 from D103221.
* Sony PS4/PS5 are unchanged: https://discourse.llvm.org/t/c-objc-switch-to-gnu-17-as-the-default-dialect/64360/6
* lit feature `default-std-cxx` is added to keep CLANG_DEFAULT_STD_CXX=xxx tests working.
Whether the cmake variable should be retained is disccused in D133375.
Depends on D131464
Close https://github.com/llvm/llvm-project/issues/56946
Reviewed By: #clang-language-wg, aaron.ballman
Differential Revision: https://reviews.llvm.org/D131465
Florian Mayer [Wed, 7 Sep 2022 00:44:20 +0000 (17:44 -0700)]
[ASan] Show memory rather than tag addresses in tag dump
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D133391
Christian Sigg [Wed, 7 Sep 2022 19:57:02 +0000 (21:57 +0200)]
[MLIR] NFC: add back `exports_files(["LICENSE.txt"])`.
Christian Sigg [Wed, 7 Sep 2022 19:57:02 +0000 (21:57 +0200)]
[MLIR] NFC: expand comment in bazel BUILD file
... and remove unnecessry `exports_files()`.
Fangrui Song [Wed, 7 Sep 2022 19:51:31 +0000 (12:51 -0700)]
[Bazel] Make clang/unittests:lex_tests depend on //llvm:TestingSupport
Mehdi Amini [Mon, 29 Aug 2022 11:12:46 +0000 (11:12 +0000)]
Apply clang-tidy fixes for llvm-else-after-return in SparseTensorRewriting.cpp (NFC)
Mehdi Amini [Mon, 29 Aug 2022 11:09:54 +0000 (11:09 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param in Utils.cpp (NFC)
Marco Elver [Tue, 6 Sep 2022 13:49:39 +0000 (15:49 +0200)]
[Clang] Introduce -fexperimental-sanitize-metadata=
Introduces the frontend flag -fexperimental-sanitize-metadata=, which
enables SanitizerBinaryMetadata instrumentation.
The first intended user of the binary metadata emitted will be a variant
of GWP-TSan [1]. The plan is to open source a stable and production
quality version of GWP-TSan. The development of which, however, requires
upstream compiler support.
[1] https://llvm.org/devmtg/2020-09/slides/Morehouse-GWP-Tsan.pdf
Until the tool has been open sourced, we mark this kind of
instrumentation as "experimental", and reserve the option to change
binary format, remove features, and similar.
Reviewed By: vitalybuka, MaskRay
Differential Revision: https://reviews.llvm.org/D130888
Marco Elver [Tue, 6 Sep 2022 13:49:33 +0000 (15:49 +0200)]
[SanitizerBinaryMetadata] Introduce SanitizerBinaryMetadata instrumentation pass
Introduces the SanitizerBinaryMetadata instrumentation pass which uses
the new MD_pcsections metadata kinds to instrument certain types of
instructions and functions required for breakpoint-based sanitizers.
The first intended user of the binary metadata emitted will be a variant
of GWP-TSan [1]. GWP-TSan will require information about atomic
accesses; to unambiguously determine if an access is atomic or not, we
also require "covered" information which code has been compiled with
SanitizerBinaryMetadata instrumentation enabled.
[1] https://llvm.org/devmtg/2020-09/slides/Morehouse-GWP-Tsan.pdf
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D130887
Joseph Huber [Wed, 7 Sep 2022 18:40:54 +0000 (13:40 -0500)]
[Libomptarget] Remove leftover ELF header from x86 plugin
Summary:
We removed the linking support for `gelf.h` in a previous patch. This
header was incorrectly leftover causing build problems on some systems.
Craig Topper [Wed, 7 Sep 2022 18:30:03 +0000 (11:30 -0700)]
[RISCV] Remove space before colon in error message.
Leonard Grey [Fri, 2 Sep 2022 17:50:01 +0000 (13:50 -0400)]
[lld-macho] Hardlink -object_path_lto files to cache when possible
This is a follow-up to https://reviews.llvm.org/D131624 (specifically to https://reviews.llvm.org/D131624#3716584)
Differential revision: https://reviews.llvm.org/D133218
Mark de Wever [Wed, 7 Sep 2022 17:56:52 +0000 (19:56 +0200)]
[libc++] Fixes CI.
It seems merging the changes in transitive macros and recent commits
conflicted.
Peiming Liu [Wed, 7 Sep 2022 00:49:44 +0000 (00:49 +0000)]
[mlir][sparse] Refactoring: remove dependence on tuple type when lowering sparse tensors.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D133390
Joseph Huber [Fri, 5 Aug 2022 18:32:42 +0000 (14:32 -0400)]
[Libomptarget] Replace libelf with LLVM's Elf libraries
This patch replaces the dependency on `libelf` with LLVM's ELF support.
With this patch the user no-longer needs to have `libelf` on their
system to build and configure OpenMP offloading. The replacement is
mostly mechanical, with the exception of the hash table support which
was added in D131309.
Depends on D131309
Reviewed By: JonChesterfield, saiislam
Differential Revision: https://reviews.llvm.org/D131401
Joseph Huber [Sat, 3 Sep 2022 16:38:26 +0000 (11:38 -0500)]
[Libomptarget] Add utility functions for loading an ELF symbol by name
The `SHT_HASH` sections in an ELF are used to look up a symbol in the
symbol table using a symbol's name. This is done by obtaining the
`SHT_HASH` section and using its `sh_link` attribute to access the
associated symbol table, from which we can access the string table
containing the associated name. We can then search for the symbol using
the hash of the name and the buckets and chains in the hash table
itself
This patch adds utility functions that allow us to look up a symbol in
an ELF file by name. It will first attempt to look through the hash
tables, and then search the section tables manually if failed. This
allows us to pull out constants necessary for setting up offloading
without first loading the object.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D131309
Florian Hahn [Wed, 7 Sep 2022 17:35:29 +0000 (18:35 +0100)]
[AArch64] Add tests for using tbl for fp conversions.
Craig Topper [Wed, 7 Sep 2022 17:29:58 +0000 (10:29 -0700)]
[RISCV] Remove unnecessary word from error message.
Argyrios Kyrtzidis [Mon, 5 Sep 2022 21:28:32 +0000 (14:28 -0700)]
[Lex/DependencyDirectivesScanner] Keep track of the presence of tokens between the last scanned directive and EOF
Directive `dependency_directives_scan::tokens_present_before_eof` is introduced to indicate there were tokens present before
the last scanned dependency directive and EOF.
This is useful to ensure we correctly identify the macro guards when lexing using the dependency directives.
Differential Revision: https://reviews.llvm.org/D133357
Jon Chesterfield [Wed, 7 Sep 2022 17:28:14 +0000 (18:28 +0100)]
[amdgpu] Always, instead of mostly, remove unused LDS symbols
Currently LDS variables are removed by the lower module pass
if they have a use which is caught by the replace with struct control flow.
This makes tests brittle to changes to that control flow which induces
noise when trying to improve lowering. Some tests already check that
variables are removed, while others checked that they are not removed.
LDS variables are not (currently) externally accessible, and if that
changes the machinery which makes them externally accessible will look
like a use. This change therefore breaks no applications.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D133028