Lawrence Benson [Wed, 29 Mar 2023 14:26:28 +0000 (15:26 +0100)]
[AArch64] Use NEON's tbl1 for 16xi8 and 8xi8 build vector with mask.
When using Clang's __builtin_shufflevector with a 16xi8 or 8xi8 source and
runtime mask on an AArch64 target, LLVM currently generates 16 or 8
extract+and+insert operations. This patch replaces these inserts with (a vector
AND +) NEON's tbl1 intruction.
Issue: https://github.com/llvm/llvm-project/issues/60515
Differential Revision: https://reviews.llvm.org/D146212
Louis Dionne [Tue, 28 Mar 2023 20:45:57 +0000 (16:45 -0400)]
[libc++][NFC] Move __insertion_sort_move to partial_sort.h
The __insertion_sort_move helper function is only used in partial_sort.h,
so it makes sense to define it there.
Differential Revision: https://reviews.llvm.org/D147080
Erich Keane [Wed, 29 Mar 2023 13:37:01 +0000 (06:37 -0700)]
Fix missing newline in ReleaseNotes which caused sphinx problems
Erich Keane [Tue, 28 Mar 2023 18:12:50 +0000 (11:12 -0700)]
Improve requirement clause limitation on non templated function
The current implementation
6da3d66f03f9162ef341cc67218be40e22fe9808
got a few things wrong, particularly that a template, or definition
or member in a templated entity is required to be allowed to have a
trailing requires clause.
This patch corrects this, as reproted by #61748
Fixes: #61748
Differential Revision: https://reviews.llvm.org/D147070
OCHyams [Wed, 29 Mar 2023 12:29:51 +0000 (13:29 +0100)]
[Assignment Tracking] Elide a map copy in some cases
Restructure AssignmentTrackingLowering::join to avoid a map copy in the case
where BB has more than one pred.
We only need to perform a copy of a pred LiveOut if there's exactly one
already-visited pred (Result = PredLiveOut). With more than one pred the result
is built by calling Result = join(std::move(Result), PredLiveOut) for each
subsequent pred, where join parameters are const &. i.e. with more than 1 pred
we can avoid copying by referencing the first two pred LiveOuts in the first
join and then using a move + reference for the rest.
This reduces compile time for CTMark LTO-O3-g builds.
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D144732
David Green [Wed, 29 Mar 2023 13:17:10 +0000 (14:17 +0100)]
[ARM] Convert active.lane.masks to vctp with non-zero starts
This attempts to expand the logic in the MVETailPredication pass to convert
active lane masks that the vectorizer produces to vctp instructions that the
backend can later turn into tail predicated loops. Especially for addrecs with
non-zero starts that can be created from epilog vectorization. There is some
adjustment to the logic to handle this, moving some of the code to check the
addrec earlier so that we can get the start value. This start value is then
incorporated into the logic of checkin the new vctp is valid, and there is a
newly added check that it is known to be a multiple of the VF as we expect.
Differential Revision: https://reviews.llvm.org/D146517
Alex Bradbury [Wed, 29 Mar 2023 13:13:37 +0000 (14:13 +0100)]
[RISCV][test] Update CHECK lines in condops related tests in preparation for Zicond codegen
Prefixes like 'CONDOPS' referring to the xventanacondops extension are
going to be confusing once zicond is added to the mix.
Benjamin Kramer [Wed, 29 Mar 2023 13:03:22 +0000 (15:03 +0200)]
[bazel] Port
ab49747f9d67
OCHyams [Wed, 29 Mar 2023 12:50:46 +0000 (13:50 +0100)]
[Assignment Tracking] Follow up for D147129 - fix broken clang tests
D147129 causes the assignment tracking pass to skip optnone functions, which
ends up overriding the "-fexperimental-assignment-tracking=forced" option at
O0. Add -disable-O0-optnone to the tests so that optnone doesn't interfere.
Buildbot example: https://lab.llvm.org/buildbot/#/builders/216/builds/18986
OCHyams [Wed, 29 Mar 2023 12:13:45 +0000 (13:13 +0100)]
[Assignment Tracking][NFC] Reduce work done in fragment overlap calculation
Only calculate fragment overlaps for partially stack homed variables. This
filter is already applied to the rest of the analysis - this change simply
prevents some unnecessary work.
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D145515
Sacha Ballantyne [Mon, 27 Mar 2023 13:12:10 +0000 (13:12 +0000)]
[Flang] Add debug flag to enable current debug information pass
While a pass exists to generate basic debug information, currently there is not a corresponding flag to enable it.
This patch adds support for activating this pass at any debug level >= -g1, as well as emiting a warning for higher levels that the functionality is not yet fully implemented.
This patch also adds -g and -gline-tables-only to appear when `flang-new` --help is run
Depends on D142347.
Reviewed By: awarzynski
Differential Revision: https://reviews.llvm.org/D146814
Paul Osmialowski [Wed, 29 Mar 2023 12:05:49 +0000 (13:05 +0100)]
[TLI][AArch64] Extend SLEEF vectorized functions mapping with VLA functions
This commit extends D134719 "[AArch64] Enable libm vectorized
functions via SLEEF" with the mappings for the scalable functions.
It also introduces all the necessary changes needed to support masked
interfaces.
Reviewed By: danielkiss, sdesmalen
Differential Revision: https://reviews.llvm.org/D146839
Kiran Chandramohan [Fri, 24 Mar 2023 17:12:40 +0000 (17:12 +0000)]
[NFC][Clang] Move DebugOptions to llvm/Frontend for reuse in Flang
This patch moves the Debug Options to llvm/Frontend so that it can be shared by Flang as well.
Reviewed By: kiranchandramohan, awarzynski
Differential Revision: https://reviews.llvm.org/D142347
OCHyams [Wed, 29 Mar 2023 11:54:39 +0000 (12:54 +0100)]
[Assignment Tracking] Don't run declare-to-assign on functions marked optnone
Assignment tracking doesn't add value when optimisations are disabled - don't
apply it to functions marked optnone.
Reviewed By: jryans
Differential Revision: https://reviews.llvm.org/D147129
Paul Osmialowski [Wed, 29 Mar 2023 11:54:22 +0000 (12:54 +0100)]
Revert "[TLI][AArch64] Extend SLEEF vectorized functions mapping with VLA functions"
Reverting it so I could land it with Arcanist.
This reverts commit
59dcf927ee43e995374907b6846b657f68d7ea49.
OCHyams [Wed, 29 Mar 2023 11:51:59 +0000 (12:51 +0100)]
[Assignment Tracking][NFC] Cache debug-info-assignment-tracking module flag
This reduces CTMark LTO-O3-g compile time by a geomean of 0.1%.
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D146985
OCHyams [Wed, 29 Mar 2023 10:33:11 +0000 (11:33 +0100)]
[Assignment Tracking] Give -fexperimental-assignment-tracking flag 3 options
Without this patch assignment tracking is enabled with
`-fexperimental-assignment-tracking` and disabled with
`-fno-experimental-assignment-tracking` (default). This patch removes the
`-fno-` version and changes `-fexperimental-assignment-tracking` to take 3
values: `enabled`, `disabled` (default), and `forced`.
`clang -Xclang -fexperimental-assignment-tracking=enabled` enables the feature
if some other conditions are met and `=forced` enables it without any further
checks.
If `enabled` is specified the feature will remain disabled if any of the
following are true: it's an LTO or ThinLTO build, optimisations are not
enabled, or lldb debugger tuning has been specified. See this short RFC
for more info:
https://discourse.llvm.org/t/rfc-enable-assignment-tracking/69399
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D146615
Serguei Katkov [Wed, 29 Mar 2023 11:35:53 +0000 (18:35 +0700)]
Revert "[GuardWidening] Freeze the introduced use."
This reverts commit
f4b2360cecd4c92e85bccb1443f2ef425fc6a77b.
The patch has no specific order in adding freeze instruction in the
entry basic block. It causes failure of CHECK like unit tests.
Roy Jacobson [Wed, 29 Mar 2023 11:25:27 +0000 (14:25 +0300)]
[Doc][Clang] Update information about default standard version
Simon Pilgrim [Wed, 29 Mar 2023 11:19:36 +0000 (12:19 +0100)]
[X86] combineMOVMSK - fold movmsk(logic(X,C)) -> logic(movmsk(X),C)
Avoid a vector mask load for something that is likely to be able to fold into a scalar logic op + EFLAGS comparison result
Roy Jacobson [Wed, 29 Mar 2023 11:20:08 +0000 (14:20 +0300)]
[Doc][Clang] Update Clang 16 from 'unreleased' to 'full'
Alex Bradbury [Wed, 29 Mar 2023 11:13:53 +0000 (12:13 +0100)]
[RISCV][MC] Add support for the experimental zicond extension
This patch adds the basic MC layer support for Zicond, based on
[1.0-rc1](https://github.com/riscv/riscv-zicond/releases/tag/v1.0-rc1).
As with other extensions, if there are additional changes between
release candidates without incrementing the version number we won't be
able to reflect that in the version number. I believe we've previously
decided this is not a problem for extensions still considered
experimental (i.e. not yet ratified).
Differential Revision: https://reviews.llvm.org/D146946
Alvin Wong [Sun, 26 Mar 2023 11:07:06 +0000 (19:07 +0800)]
[clang][MinGW] Add asan DLL lib before other libs and objects
As stated in https://github.com/llvm/llvm-project/issues/61685, by
passing LLD the import lib of the asan DLL first, the asan DLL will be
listed as the first entry in the Import Directory Table, making it be
loaded first before other user DLLs. This allows asan to be initialized
as early as possible to increase its instrumentation coverage to include
other DLLs not built with asan.
This also avoids some false asan reports on `realloc` for memory
allocated during initialization of user DLLs being loaded earlier than
asan, because after this change they will be loaded later than asan.
Differential Revision: https://reviews.llvm.org/D146908
Johannes de Fine Licht [Wed, 29 Mar 2023 08:38:52 +0000 (08:38 +0000)]
[MLIR][LLVM] Take the alignment attribute into account during inlining.
This is a subset of the full LLVM functionality to detect whether
realignment is necessary, conservatively copying byval arguments
whenever we cannot prove that the alignment requirement is met.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D147049
Christian Ulmann [Wed, 29 Mar 2023 09:02:36 +0000 (09:02 +0000)]
[mlir][llvm] Make DINamespace name optional
This commit makes the name of a DINamespace optional to enable modeling
of anonymous namespaces.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D147125
David Sherwood [Wed, 29 Mar 2023 08:54:56 +0000 (08:54 +0000)]
[LoopVectorize] Add non-zero check for MaxPowerOf2RuntimeVF in computeMaxVF
This one-line patch just tightens up the code added in
1c4fedfa35aeb8b456e2d8f4f826c0e026b9d863
where we try to avoid tail-folding if we know the runtime
VF will always be a multiple of the trip count.
Paul Osmialowski [Fri, 24 Mar 2023 15:07:05 +0000 (15:07 +0000)]
[TLI][AArch64] Extend SLEEF vectorized functions mapping with VLA functions
This commit extends D134719 "[AArch64] Enable libm vectorized
functions via SLEEF" with the mappings for the scalable functions.
It also introduces all the necessary changes needed to support masked
interfaces.
Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
Paul Osmialowski [Wed, 29 Mar 2023 09:27:46 +0000 (10:27 +0100)]
NFC: remove stray extra space from llvm.spec.in
Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
LLVM GN Syncbot [Wed, 29 Mar 2023 09:55:58 +0000 (09:55 +0000)]
[gn build] Port
791164751241
Daniel Grumberg [Tue, 28 Mar 2023 17:00:13 +0000 (18:00 +0100)]
Revert "Revert ExtractAPI from https://reviews.llvm.org/D146656"
This reverts commit
158a431227a876306fe5838936413dd51588d0c6.
Michael Halkenhaeuser [Wed, 22 Mar 2023 09:45:08 +0000 (10:45 +0100)]
[clang][HIP][OpenMP] Add warning if mixed HIP / OpenMP offloading
Adds a warning, issued by the clang semantic analysis, if HIP and OpenMP target offloading is requested concurrently.
That is, if HIP language mode is active but OpenMP target directives are encountered.
Previously, a user might not have been aware that target directives are ignored in such a case.
Generation of this warning is (lit-)tested via "make check-clang-semaopenmp".
The warning can be ignored via "-Wno-hip-omp-target-directives".
Differential Revision: https://reviews.llvm.org/D145591
Serguei Katkov [Thu, 23 Mar 2023 04:05:10 +0000 (11:05 +0700)]
[GuardWidening] Freeze the introduced use.
Guard widening optimization is able to move the condition from one
guard to the previous one. As a result if the condition is poison
and orginal second guard is never executed but the first one does,
we introduce undefined behavior which was not observed in original
program.
To resolve the issue we must freeze the condition we are moving.
However optimization itself does not know how to work with freeze.
Additionally optimization is written in incremental way.
For example we have three guards
G1(base + 8 < L)
G2(base + 16 < L)
G3(base + 24 < L)
On the first step GW will combine G1 and G2 as
G1(base + 8 < L && freeze(base + 16 < L))
G2(true)
G3(base + 24 < L)
while combining G1 and G3 base appears to be different.
To keep optimization enabled after freezing the moving condition, the
freeze instruction is pushed as much as possible and later all uses
of freezed values are replaced with frozen version.
This is similar what instruction combining does but more aggressevely.
Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D146699
Graham Hunter [Tue, 28 Mar 2023 13:13:26 +0000 (14:13 +0100)]
[LV][AArch64] Precommit interleaved access tests
Precommit for D145163
Haojian Wu [Wed, 29 Mar 2023 09:20:01 +0000 (11:20 +0200)]
[clangd] Handle the C++2b elifdef and elindef PP structure in CollectMainFileMacros.
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D146717
Simi Pallipurath [Mon, 20 Feb 2023 13:31:45 +0000 (13:31 +0000)]
[lld][ARM][2/3]Big Endian support - Word invariant support
Changes:
- Adding BE32 big endian Support for Arm.
- Replace the writele and readle with their endian-aware versions.
- Adding test cases for the big-endian be32 arm configuration.
Patch by: Milosz Plichta. This patch merges all the changes from
this patch https://reviews.llvm.org/D140203 as well.
Reviewed By: peter.smith, MaskRay
Differential Revision: https://reviews.llvm.org/D140202
Matthias Springer [Wed, 29 Mar 2023 09:13:40 +0000 (11:13 +0200)]
[mlir] Fix build files
This should have been part of D147039.
Matthias Springer [Wed, 29 Mar 2023 09:02:26 +0000 (11:02 +0200)]
[mlir][transform] Add TrackingListener
This change makes it possible to use a greedy pattern rewrite as part of a transform op, even if the transform op does not invalidate the target handle (in particular transform ops without `FunctionalStyleTransformOpTrait`) and the targeted op is not isolated from above.
The listener API allows us to track replacements of ops with values, but not ops with ops. Therefore, the TrackingListener is conservative: If an op is replaced with values that all have the same defining op and the defining op is of the same type as the original op, it is safe to assume that the op was replaced with an equivalent op. Otherwise, the op mapping is dropped. When this is not good enough, transforms can track values instead or provide a custom `findReplacementOp` function.
Differential Revision: https://reviews.llvm.org/D147039
Matthias Springer [Wed, 29 Mar 2023 08:48:00 +0000 (10:48 +0200)]
[mlir][transform] TransformStateExtension: Replace op/value handles separately
Differential Revision: https://reviews.llvm.org/D147038
Marco Elver [Wed, 29 Mar 2023 08:25:10 +0000 (10:25 +0200)]
[X86] Preserve !pcsections on atomic intrinsics
Preserve !pcsections metadata on X86-only atomic intrinsics when
expanding higher-level atomics.
Differential Revision: https://reviews.llvm.org/D147123
Serguei Katkov [Wed, 22 Mar 2023 10:10:38 +0000 (17:10 +0700)]
[LoopPredication] Fix the LoopPredication by feezing the result of predication.
LoopPredication introduces the use of possibly posion value in branch (guard)
instruction, so to avoid introducing undefined behavior it should be frozen.
Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D146685
Yeting Kuo [Wed, 29 Mar 2023 07:47:29 +0000 (15:47 +0800)]
[RISCV][NFC] Fix ident in RISCVISelLowering.h.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D147120
Johannes Reifferscheid [Wed, 29 Mar 2023 07:40:39 +0000 (09:40 +0200)]
[mlir] [bazel] Make OpenMPInterfaces.h a textual header.
This header can't be built standalone. Making it textual will prevent
blaze from attempting to do so.
Dominik Adamski [Mon, 27 Mar 2023 12:19:40 +0000 (07:19 -0500)]
[Clang][Flang][AMDGPU] Add support for AMDGPU to Flang driver
Scope of changes:
1) Extract common code between Clang and Flang for parsing AMDGPU features
2) Add function which adds implicit target features for AMDGPU as Clang does
3) Add AMDGPU target as one of valid targets for Flang
Differential Revision: https://reviews.llvm.org/D145579
Reviewed By: yaxunl, awarzynski
Matthias Springer [Tue, 28 Mar 2023 14:37:03 +0000 (16:37 +0200)]
[mlir][Tensor] Use helper function for `getDroppedDims`
This helper function is used for both ExtractSliceOp and InsertSliceOp. Also fixes a bug in the implementation of `InsertSliceOp::getDroppedDims`.
Differential Revision: https://reviews.llvm.org/D147048
Henry Yu [Wed, 29 Mar 2023 07:06:06 +0000 (00:06 -0700)]
[AsmPrinter] Fix Crash when Emitting Global Constant of small bit width when targeting Big Endian arch
For Big Endian, the function `emitGlobalConstantLargeInt` tries to right shift `Realigned` by an amount `ExtraBitSize` in place. However, if the constant to emit has a bit width less than 64 and the bit width is not a multiple of 8, the shift amount will be greater than the bit width of `Realigned`, which causes assertion error described in issue [[ https://github.com/llvm/llvm-project/issues/59055 | issue #59055 ]].
This patch fixes the issue by avoiding right shift when bit width is under 64 to avoid the assertion error.
Reviewed By: Peter
Differential Revision: https://reviews.llvm.org/D138246
Sameer Sahasrabuddhe [Wed, 29 Mar 2023 06:37:44 +0000 (12:07 +0530)]
[llvm][CycleInfo] Quick look-up for block in cycle.
Use a SetVector to store blocks in a cycle to ensure a quick loop-up when
querying whether the cycle contains a given block. This is along the same lines
as the SmallPtrSet in LoopBase, introduced by commit
be640b28c0cb81b77015baaef20ca2941fc61dea.
To make this work, we also enhance SetVector to support vector operations with
pointers and set operations with const pointers in the same container.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D146136
Sergei Barannikov [Sun, 26 Mar 2023 16:25:16 +0000 (19:25 +0300)]
[compiler-rt] Quote multiple warning flags in check_cxx_compiler_flag invocation
Without this all checks fail because CMake passes the flags
like this:
`... -nodefaultlibs -D-Warray-bounds -Werror -std=c++17 ...`
Note the `-D` before the `-W`.
Reviewed By: ahatanak
Differential Revision: https://reviews.llvm.org/D146920
Iain Sandoe [Fri, 3 Jun 2022 09:43:38 +0000 (10:43 +0100)]
re-land [C++20][Modules] Introduce an implementation module.
We need to be able to distinguish individual TUs from the same module in cases
where TU-local entities either need to be hidden (or, for some cases of ADL in
template instantiation, need to be detected as exposures).
This creates a module type for the implementation which implicitly imports its
primary module interface per C++20:
[module.unit/8] 'A module-declaration that contains neither an export-keyword
nor a module-partition implicitly imports the primary module interface unit of
the module as if by a module-import-declaration.
Implementation modules are never serialized (-emit-module-interface for an
implementation unit is diagnosed and rejected).
Differential Revision: https://reviews.llvm.org/D126959
Chuanqi Xu [Wed, 29 Mar 2023 03:05:37 +0000 (11:05 +0800)]
Revert "[C++20] [Modules] Don't load declaration eagerly for named modules"
This reverts commit
af86957cbbffd3dfff3c6750ebddf118aebd0069.
Close https://github.com/llvm/llvm-project/issues/61733.
Previously I banned the eagerly loading for declarations from named
modules to speedup the process of reading modules. But I didn't think
about special decls like PragmaCommentDecl and PragmaDetectMismatchDecl.
So here is the issue https://github.com/llvm/llvm-project/issues/61733.
Note that the current behavior is still incorrect. Given:
```
// mod.cppm
module;
export module mod;
```
and
```
// user.cpp
import mod;
```
Now the IR of `user.cpp` will contain the metadata '!0 =
!{!"msvcprt.lib"}' incorrectly. The root cause of the problem is that
`EagerlyDeserializedDecls` is designed for headers and it didn't take
care for named modules. We need to redesign a new mechanism for named
modules.
Anubhab Ghosh [Wed, 29 Mar 2023 02:48:36 +0000 (08:18 +0530)]
[clang-repl] Use std::move when converting Error to Expected
Anubhab Ghosh [Sun, 15 Jan 2023 15:10:44 +0000 (20:40 +0530)]
[clang-repl] Add a command to load dynamic libraries
This commit adds the %lib <file> command to load a dynamic library to be
used by the currently running interpreted code.
For example `%lib libSDL2.so`.
Differential Revision: https://reviews.llvm.org/D141824
Ben Shi [Wed, 29 Mar 2023 01:08:02 +0000 (09:08 +0800)]
[lld][ELF] Support relocations R_AVR_8_LO8/R_AVR_8_HI8/R_AVR_8_HLO8
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D147100
Brad Smith [Wed, 29 Mar 2023 02:21:28 +0000 (22:21 -0400)]
[Clang][Driver] Default Generic_GCC::IsIntegratedAssemblerDefault to true
Invert the logic and have the default being true. Disable the few spots where
it looks like IAS is currently not used.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D147030
Fangrui Song [Wed, 29 Mar 2023 01:21:15 +0000 (18:21 -0700)]
[crt] Remove __USER_LABEL_PREFIX__
The .init_array code is ELF specific. For ELF platforms,
`__USER_LABEL_PREFIX__` is defined as "". Make the simplification
so that downstream ELF targets can build this file even if
`__USER_LABEL_PREFIX__` is undefined.
Reviewed By: barannikov88
Differential Revision: https://reviews.llvm.org/D147093
Phoebe Wang [Wed, 29 Mar 2023 00:20:14 +0000 (08:20 +0800)]
Reland "[Windows SEH]: HARDWARE EXCEPTION HANDLING (MSVC -EHa) - Part 2"
This reverts commit
db6a979ae82410e42430e47afa488936ba8e3025.
Reland D102817 without any change. The previous revert was a mistake.
Differential Revision: https://reviews.llvm.org/D102817
Roy Sundahl [Tue, 28 Mar 2023 23:07:54 +0000 (16:07 -0700)]
[fuzzer] Limit big-file-copy.test to darwin only
This test has to be limited to darwin due to multiple failures on other
platforms for multple reasons. (Timeout, puts() limit, etc.). This
commit modifies D146189.
Reviewed By: NoQ
Differential Revision: https://reviews.llvm.org/D147094
Thomas Raoux [Tue, 28 Mar 2023 23:59:00 +0000 (23:59 +0000)]
[mlir][bufferization] Use rewriter to erase ops in scf.forall bufferization.
Without this bufferization cannot track operations removed during bufferization.
Unfortunately there is currently no way to enforce that ops need to be erased through
the rewriter and this causes sporadic errors when tracking pointers in Bufferization pass.
Therefore there is no easy way to test that the pattern is doing the right thing.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D147095
wren romano [Tue, 28 Mar 2023 21:48:21 +0000 (14:48 -0700)]
[mlir][sparse] Fixing -Wignored-reference-qualifiers in MergerTest.cpp
These warnings were introduced by D146561.
Reviewed By: aartbik, Peiming
Differential Revision: https://reviews.llvm.org/D147090
Aaron Siddhartha Mondal [Tue, 28 Mar 2023 23:29:05 +0000 (01:29 +0200)]
[bazel] Port zstd support
Originally added in D128465. Used by `llvm:Support` and `lld:ELF`.
Enabled by default. Disable with `--@llvm_zstd//:llvm_enable_zstd=false`.
Reviewed By: MaskRay, GMNGeoffrey
Differential Revision: https://reviews.llvm.org/D143344
Hongtao Yu [Mon, 27 Mar 2023 18:40:52 +0000 (11:40 -0700)]
[CSSPGO][Preinliner] Trim cold call edges of the profiled call graph for a more stable profile generation.
I've noticed that for some services CSSPGO profile is less stable than non-CS AutoFDO profile from profiling to profiling without source changes. This is manifested by comparing profile similarities. For example in my experiments, AutoFDO profiles are always 99+% similar over same binary but different inputs (very close dynamic traffics) while CSSPGO profile similarity is around 90%.
The main source of the profile stability is the top-down order computed on the profiled call graph in the llvm-profgen CS preinliner. The top-down order is used to guide the CS preinliner to pre-compute an inline decision that is later on fulfilled by the compiler. A subtle change in the top-down order from run to run could cause a different inline decision computed. A deeper look in the diversion of the top-down order revealed that:
- The topological sorting inside one SCC isn't quite right. This is fixed by {D130717}.
- The profiled call graphs of the two sides of the A/B run isn't 100% the same. The call edges in the two runs do not subsume each other, and edges appear in both graphs may not have exactly the same weight. This is due to the nature that the graphs are dynamic. However, I saw that the graphs can be made more close by removing the cold edges from them and this bumped up the CSSPGO profile stableness to the same level of the AutoFDO profile.
Removing cold call edges from the dynamic call graph may have an impact on cold inlining, but so far I haven't seen any performance issues since the CS preinliner mainly targets hot callsites, and cold inlining can always be done by the compiler CGSCC inliner.
Also fixing an issue where the largest weight instead of the accumulated weight for a call edge is used in the profiled call graph.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D147013
Jonas Devlieghere [Tue, 28 Mar 2023 21:13:49 +0000 (14:13 -0700)]
[lldb] Support Universal Mach-O binaries with a fat64 header
Support universal Mach-O binaries with a fat64 header. After
4d683f7fa7d4, dsymutil can now generate such binaries when the offsets
would otherwise overflow the 32-bit offsets in the regular fat header.
rdar://
107289570
Differential revision: https://reviews.llvm.org/D147012
Anshil Gandhi [Tue, 28 Mar 2023 21:58:02 +0000 (15:58 -0600)]
[AMDGPU] Replace target feature for global fadd32
Change target feature of __builtin_amdgcn_global_atomic_fadd_f32
to atomic-fadd-rtn-insts. Enable atomic-fadd-rtn-insts for gfx90a,
gfx940 and gfx1100 as they all support the return variant of
`global_atomic_add_f32`.
Fixes https://github.com/llvm/llvm-project/issues/61331.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D146840
Aaron Siddhartha Mondal [Tue, 28 Mar 2023 21:56:05 +0000 (23:56 +0200)]
[bazel] Fix MLIR tests after 92c6946
Reviewed By: GMNGeoffrey
Differential Revision: https://reviews.llvm.org/D147088
Peiming Liu [Tue, 28 Mar 2023 19:54:34 +0000 (19:54 +0000)]
[mlir][sparse] convert a sparse tensor slice to sparse tensor correctly.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D147074
Artem Dergachev [Tue, 28 Mar 2023 21:20:33 +0000 (14:20 -0700)]
[analyzer] Teach scan-build how to pass -analyzer-config to xcodebuild.
The scan-build tool assists various build systems with applying the Clang
static analyzer alongside compilation. It offers explicit integration with
Xcode's native build system aka `xcodebuild`; in this case it doesn't
substitute the compiler, but instead kindly asks xcodebuild to enable
the static analyzer, something that it already knows how to do.
Make sure scan-build's `-analyzer-config` flag (which translates to a
similar `clang -cc1 -analyzer-config` flag) is properly translated
to Xcode build system. This unbreaks a few related features such as
checker silencing.
No LIT tests because they'd require an Xcode installation on your system.
Roy Sundahl [Thu, 16 Mar 2023 01:56:11 +0000 (18:56 -0700)]
[fuzzer] Use puts() rather than printf() in CopyFileToErr()
CopyFileToErr() uses Printf("%s", ...) which fails with a negative size on
files >2Gb (Its path is through var-args wrappers to an unnecessary "%s"
expansion and subject to int overflows) Using puts() in place of printf()
bypasses this path and writes the string directly to stderr. This avoids the
present loss of data when a crashed worker has generated >2Gb of output.
rdar://
99384640
Reviewed By: yln, rsundahl
Differential Revision: https://reviews.llvm.org/D146189
David Tenty [Mon, 20 Mar 2023 21:34:30 +0000 (17:34 -0400)]
[clang][PowerPC] Remove remaining Darwin support
POWER Darwin support in the backend has been removed for some time: https://discourse.llvm.org/t/rfc-remove-darwin-support-from-power-backends
but Clang still has the TargetInfo and other remnants lying around.
This patch does some cleanup and removes those and other related frontend support still remaining. We adjust any tests using the triple to either remove
the test if unneeded or switch to another Power triple.
Reviewed By: MaskRay, nemanjai
Differential Revision: https://reviews.llvm.org/D146459
Thurston Dang [Tue, 28 Mar 2023 20:08:34 +0000 (20:08 +0000)]
Disable resize_tls_dynamic test for HWASan
The test is not applicable because HWASan does not intercept __tls_get_addr.
This is pre-emptive cleanup, to get ready for Kirill's patch to enable sanitizer common tests for HWASan (https://reviews.llvm.org/D147067).
Note that there is an outstanding dynamic TLS bug for sanitizers - https://github.com/google/sanitizers/issues/1409
- but that isn't applicable here due to the lack of interception.
Test: LIT_FILTER=resize_tls_dynamic ninja check-sanitizer
Differential Revision: https://reviews.llvm.org/D147076
David Blaikie [Wed, 22 Mar 2023 21:26:03 +0000 (21:26 +0000)]
DebugInfo: Rebuild dwp debug_info index column from v5 indexes more robustly
the v4 rebuilding is a best-effort because it's not possible to reliably
parse the DWO ID as it requires the abbrev section (& if the index isn't
trustworthy then there's no way to find the associated abbrev section
contribution for a given info section contribution)
But in v5 the DWO ID/type signature is in the header and can be rebuilt
losslessly (only at the cost of performance of rescanning/parsing the
headers of all the units), so let's implement that.
the testing isn't /ideal/ - I think the testing should've been
implemented as a hardcoded dwp file with a corrupted/incorrect index,
then the test could've demonstrated that reparsing the index produces
the right answer - but this is a quick port of the existing v5 test back
to v4 so that we don't lose coverage on the v4 codepath now that it's
separated from the v5 codepath.
Differential Revision: https://reviews.llvm.org/D146662
Carlos Galvez [Tue, 28 Mar 2023 13:53:48 +0000 (13:53 +0000)]
[clang-tidy] Add option to ignore capture default by reference in cppcoreguidelines-avoid-capture-default-when-capturing-this
The rule exists primarily for when using capture default
by copy "[=]", since member variables will be captured by
reference, which is against developer expectations.
However when the capture default is by reference, then there
is no doubt: everything will be captured by reference. Add
an option to allow just that.
Note: Release Notes do not need update since this check
has been introduced in the current WIP release.
A ticket has been opened at the C++ Core Guidelines repo
to consider updating the rule such that this behavior
is the default one:
https://github.com/isocpp/CppCoreGuidelines/issues/2060
Differential Revision: https://reviews.llvm.org/D147062
David Blaikie [Wed, 22 Mar 2023 21:24:40 +0000 (21:24 +0000)]
Simplify index rebuilding test.
This isn't an ideal test - probably would be better if it had a
corrupted index (& was hardcoded - so it didn't depend on llvm-dwp) to
demonstrate that index rebuilding produces a distinct result.
But, ah well, this'll do for now.
Alex Brachet [Tue, 28 Mar 2023 20:24:20 +0000 (20:24 +0000)]
[libc][NFC] Fix conversion warning
Owen Pan [Fri, 24 Mar 2023 20:16:44 +0000 (13:16 -0700)]
[clang-format] Handle '_' in ud-suffix for IntegerLiteralSeparator
Also, handle imaginary numbers, i.e., those with suffixes starting
with an 'i'.
Fixes #61676.
Differential Revision: https://reviews.llvm.org/D146844
Fangrui Song [Tue, 28 Mar 2023 20:11:47 +0000 (13:11 -0700)]
[bazel] Fix mlir buildifier issues
Peter Klausler [Tue, 28 Mar 2023 17:52:48 +0000 (10:52 -0700)]
[flang] Fine-tune NAN formatted input editing
Per Fortran 2018, "NAN" and "NAN()" are to be translated into quiet
NaNs, and the other forms are implementation-dependent; I've made
them quiet NaNs too. Also process signs on input NaNs, which seems
wrong but other compilers all do it, and fix some misleading template
argument names noticed along the way.
Differential Revision: https://reviews.llvm.org/D147071
Chenguang Wang [Tue, 28 Mar 2023 18:06:54 +0000 (11:06 -0700)]
[MLIR][MemRef] Add missing #include for FailureOr
FailureOr was used without including correct headers, so the code only works if the user of Transform.h includes the correct headers first.
Reviewed By: jyknight
Differential Revision: https://reviews.llvm.org/D147069
Joseph Huber [Mon, 27 Mar 2023 13:55:02 +0000 (08:55 -0500)]
[libc] Install GPU headers to `gpu-none-llvm/` subfolder
The GPU support for the `libc` generates all its own headers. Since
these headers use the same names as the system headers we need to make
sure that they are separate. Currently, we either use the system headers
on the GPU or the GPU headers on the system. This patch makes them
explicitly separate. A follow-up patch will then make `clang` look in
this folder by default.
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/D146970
Alex Langford [Mon, 27 Mar 2023 21:03:12 +0000 (14:03 -0700)]
[lldb] TestInferiorCrashing.py should check for crash reason
In a now-reverted series of patches, I inadvertently broke the ability
for lldb-server to explain a crash reason. To ensure that this feature
continues to work after future refactors, let's test the feature.
Differential Revision: https://reviews.llvm.org/D147001
Peter Klausler [Tue, 28 Mar 2023 14:50:58 +0000 (07:50 -0700)]
[flang] Fix checking of pointer passed to assumed-rank
Don't check ranks when a pointer actual argument is associated with
a pointer assumed-rank dummy argument.
Differential Revision: https://reviews.llvm.org/D147052
Joseph Huber [Mon, 27 Mar 2023 18:20:24 +0000 (13:20 -0500)]
[libc] Support setting 'native' GPU architecture for libc
We already use the `amdgpu-arch` and `nvptx-arch` tools to determine the
GPU architectures the user's system supports. We can provide
`LIBC_GPU_ARCHITECTURES=native` to allow users to easily build support
for only the one found on their system. This also cleans up the code
somewhat.
Reviewed By: tra
Differential Revision: https://reviews.llvm.org/D146994
wren romano [Fri, 24 Mar 2023 22:33:50 +0000 (15:33 -0700)]
[mlir][sparse] Removing shared_ptr from the MergerTest.cpp unit test
This is a preliminary change to make way for converting the Merger's identifier types from mere typedefs to actual types (which causes some issues that this patch fixes).
Depends On D146676
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D146561
spupyrev [Thu, 16 Feb 2023 18:52:04 +0000 (10:52 -0800)]
[BOLT] computing raw branch count for yaml profiles
`Function.RawBranchCount` is initialized for fdata profile but not for yaml one.
The diff adds the computation of the field for yaml profiles
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D144211
Rahul Joshi [Tue, 28 Mar 2023 17:44:26 +0000 (10:44 -0700)]
[NFC] For formatting for `enumerator_result::get`.
Daniel Thornburgh [Tue, 28 Mar 2023 17:26:55 +0000 (10:26 -0700)]
[Fuchsia][CMake] Always use multiple distribution model.
Slava Zakharin [Tue, 28 Mar 2023 02:28:36 +0000 (19:28 -0700)]
[flang] Normalize logical values during type conversions.
Flang was missing value normalization for logical<->integer conversions
which is required by Flang specification. The shrinking logical<->logical
conversions were also incorrectly truncating the input.
This change performs value normalization for all logical<->integer
conversions and logical<->logical conversions between different kinds.
Note that value normalization is not strictly required for
logical(kind=k1)->logical(kind=k2) conversions when k1 < k2.
Differential Revision: https://reviews.llvm.org/D147019
Andrew Gozillon [Tue, 28 Mar 2023 16:49:22 +0000 (11:49 -0500)]
[OpenMP][MLIR] Fix warning from getIsDevice OffloadModuleInterface function
Missed the default return component of the function on original
implementation, which is a warning that causes subsequent
failure (but regardless it's incorrect behaviour and should
have been fixed).
Rahul Joshi [Tue, 28 Mar 2023 16:49:57 +0000 (09:49 -0700)]
Fix build failures with MSVC 14.x
Zain Jaffal [Tue, 28 Mar 2023 16:41:08 +0000 (17:41 +0100)]
[SLP][AArch64] Add test to check for the vectorization of fshl
Currently the cost for fshl is an overestimate causing SLP to vectorize when it is not necessary.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D147056
Krzysztof Drewniak [Thu, 23 Feb 2023 21:47:48 +0000 (21:47 +0000)]
[llvm] Use pointer index type for more GEP offsets (pre-codegen)
Many uses of getIntPtrType() were using that type to calculate the
neened type for GEP offset arguments. However, some time ago,
DataLayout was extended to support pointers where the size of the
pointer is not equal to the size of the values used to index it.
Much code was already migrated to, for example, use getIndexSizeInBits
instead of getPtrSizeInBits, but some rewrites still used
getIntPtrType() to get the type for GEP offsets.
This commit changes uses of getIntPtrType() to getIndexType() where
they are involved in a GEP-related calculation.
In at least one case (bounds check insertion) this resolves a compiler
crash that the new test added here would previously trigger.
This commit does not impact
- C library-related rewriting (memcpy()), which are operating under
the assumption that intptr_t == size_t. While all the mechanisms for
breaking this assumption now exist, doing so is outside the scope of
this commit.
- Code generation and below. Note that the use of getIntPtrType() in
CodeGenPrepare will be changed in a future commit.
- Usage of getIntPtrType() in any backend
Depends on D143435
Reviewed By: arichardson
Differential Revision: https://reviews.llvm.org/D143437
Dave Lee [Mon, 27 Mar 2023 21:58:10 +0000 (14:58 -0700)]
[lldb] Fix value printing for a specific case
Fixes printing of spaces in cases where the following are true:
1. Persistent results are disabled
2. The type has a summary string
As reported by @jgorbe in D146783, two spaces were being printed before the summary
string, and no spaces were printed after.
Differential Revision: https://reviews.llvm.org/D147006
Uday Bondhugula [Tue, 28 Mar 2023 15:23:57 +0000 (20:53 +0530)]
[MLIR] Refactor affine tilePerfectlyNestedLoops to drop validity check
The affine loop utility `tilePerfectlyNestedLoops` was checking for the
validity of tiling as well as performing the tiling. This is
inconsistent with how other similar utilities work. Move out the
analysis/check from the utility so that the latter only performs the
mechanics of IR manipulation.
This is NFC/pure move beyond the change in behavior of
tilePerfectlyNestedLoops.
Differential Revision: https://reviews.llvm.org/D147055
Andrzej Warzynski [Mon, 27 Mar 2023 07:21:57 +0000 (07:21 +0000)]
[mlir-cpu-runner] Add export_executable_symbols in CMake.
LLJIT needs access to symbols (e.g. llvm_orc_registerEHFrameSectionWrapper)
that will be defined in the executable when LLVM is linked statically.
This change is consistent with how other tools within LLVM use LLJIT. It
is required to make sure that `mlir-cpu-runner --host-supports-jit`
correctly returns `true` on platforms that do support JITting (in my
case that's AArch64 Linux).
See https://github.com/llvm/llvm-project/issues/61712 for more context.
Differential Revision: https://reviews.llvm.org/D146935
Paulo Matos [Tue, 28 Mar 2023 16:09:52 +0000 (18:09 +0200)]
[clang][doc] Fix link to SYCL compiler design doc
Archibald Elliott [Fri, 24 Mar 2023 11:50:28 +0000 (11:50 +0000)]
[AArch64] Add v8.9a/v9.4a FEAT_ATS1A
FEAT_ATS1A adds three new AT system instruction aliases. This feature is
optional from v8.9a/v9.4a. FEAT_ATS1A is a very late addition to the
2022 A-profile VMSA extension, and has not yet been added to the public
docs available on developer.arm.com
These AT instructions are added without a command-line flag or feature,
because it is system-instruction only, and FEAT_S1PIE also has no
command-line flag.
Differential Revision: https://reviews.llvm.org/D146962
Philip Reames [Tue, 28 Mar 2023 15:39:50 +0000 (08:39 -0700)]
[RISCV] Add shuffle cost tests for general fixed vector permute [nfc]
Philip Reames [Tue, 28 Mar 2023 15:19:48 +0000 (08:19 -0700)]
[RISCV] Consolidate and extend fixed vector shuffle cost tests [nfc]
Jay Foad [Tue, 28 Mar 2023 15:48:34 +0000 (16:48 +0100)]
[AMDGPU] Avoid duplicated work in SIRegisterInfo::getReservedRegs
Andrew Gozillon [Tue, 28 Mar 2023 15:24:35 +0000 (10:24 -0500)]
[OpenMP][Flang][MLIR] Implement OffloadModuleInterface for OpenMP Dialect and convert is_device to an Attribute
This commit adds the OffloadModuleInterface to the OpenMP dialect,
which will implement future module attribute get/set's for offloading.
Currently it implements set and get's for the omp.is_device attribute,
which is promoted to a real attribute in this commit as well (primarily
to allow switch cases to work nicely with it for future work and to keep
consistency with future module attributes).
This interface is attached to mlir::ModuleOp's on registration of the
OpenMPDialect and should be accessible anywhere the OpenMP
dialect is registered and initialized.
Reviewers: kiranchandramohan, awarzynski
Differential Revision: https://reviews.llvm.org/D146850
Kevin Sala [Tue, 28 Mar 2023 15:22:33 +0000 (17:22 +0200)]
[NFC][OpenMP][libomptarget] Remove unnecessary AsyncInfoWrapperTy parameter
Victor Perez [Tue, 28 Mar 2023 15:19:29 +0000 (16:19 +0100)]
[mlir][llvm] Verify consistency of llvm.resume and llvm.landingpad types
Following the steps of the LLVM verifier
(https://github.com/llvm/llvm-project/blob/
b2c48559c882fd558f91e471c4d23ea7b0c6e718/llvm/lib/IR/Verifier.cpp#L4195),
checks in llvm.func verifier are added to ensure consistency of
llvm.landingpad operations' result types and llvm.resume operations'
input types.
As in LLVM, we will allow llvm.resume operations with input values
defined by operations other than llvm.landingpad.
Signed-off-by: Victor Perez <victor.perez@codeplay.com>
Reviewed By: gysit, Dinistro
Differential Revision: https://reviews.llvm.org/D146968