platform/upstream/llvm.git
16 months ago[SPARC] Implement hooks for conditional branch relaxation
Koakuma [Sat, 11 Mar 2023 22:39:25 +0000 (17:39 -0500)]
[SPARC] Implement hooks for conditional branch relaxation

Integrate the BranchRelaxation pass to help with relaxing out-of-range
conditional branches.

This is mostly of concern for SPARCv9, which uses conditional branches with
much smaller range than its v8 counterparts.
(Some large autogenerated code, such as the ones generated by TableGen, already
hits this limitation when building in Release)

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D142458

16 months agoRevert "[InstCombine] use loop info when running the pass after loop vectorization"
Sanjay Patel [Sat, 11 Mar 2023 22:25:12 +0000 (17:25 -0500)]
Revert "[InstCombine] use loop info when running the pass after loop vectorization"

This reverts commit 43ae4b62b2671cf73e691c0b53324cd39405cd51.

This was intended to be practically NFC in terms of the overall
opt pipeline, but there is experimental data showing that code
changes occurred here:
https://llvm-compile-time-tracker.com/compare.php?from=772aa05452f8ff90a47168e6801cda2acb5a1873&to=43ae4b62b2671cf73e691c0b53324cd39405cd51&stat=size-text

16 months ago[sanitizer] Fix text in error message
Vitaly Buka [Sat, 11 Mar 2023 21:40:42 +0000 (13:40 -0800)]
[sanitizer] Fix text in error message

16 months ago[InstCombine] use loop info when running the pass after loop vectorization
Sanjay Patel [Sat, 11 Mar 2023 19:17:50 +0000 (14:17 -0500)]
[InstCombine] use loop info when running the pass after loop vectorization

This is the follow-up to D144199 and suggestion from D144045.
We make use of loop info explicit via InstCombine pass parameter
rather than semi-arbitrary via caching.

The only InstCombine transform that uses LoopInfo currently is a
GEP fold in visitGEPOfGEP(), so that shows up as a failure in the
dedicated test for the fold as well as several LoopVectorizer tests
that run extra passes.

I don't see any pass manager regression tests that actually check
for pass options, but this is intended to be NFC for the pass
pipeline behavior - we only try to use loop info where it would
have been used before via caching .

Differential Revision: https://reviews.llvm.org/D144274

16 months ago[X86] Add tests showing the failure to merge SHL/ADD through AND masks into LEA
Simon Pilgrim [Sat, 11 Mar 2023 18:43:44 +0000 (18:43 +0000)]
[X86] Add tests showing the failure to merge SHL/ADD through AND masks into LEA

16 months ago[HIP] Make `--offload-add-rpath` alias of `-frtlib-add-rpath`
Yaxun (Sam) Liu [Mon, 6 Mar 2023 16:45:11 +0000 (11:45 -0500)]
[HIP] Make `--offload-add-rpath` alias of `-frtlib-add-rpath`

HIP runtime is the language runtime of HIP. When users need
to specify rpath, they usually need to specify rpath for
both compiler-rt and HIP runtime. It seems redundant
to have separate options. Therefore make --offload-add-rpath
an alias to -frtlib-add-rpath.

Reviewed by: Fangrui Song, Artem Belevich

Differential Revision: https://reviews.llvm.org/D145393

16 months ago[clang-tidy][NFC] Make abseil-redundant-strcat-calls checker use <string> header
Mike Crowe [Sat, 11 Mar 2023 17:46:56 +0000 (17:46 +0000)]
[clang-tidy][NFC] Make abseil-redundant-strcat-calls checker use <string> header

Remove duplication in abseil-redundant-strcat-calls check tests,
by using dummy <string> header file string.

Depends on D145310

Reviewed By: PiotrZSL

Differential Revision: https://reviews.llvm.org/D145311

16 months ago[clang-tidy] Fix false-positive in cppcoreguidelines-slicing
Piotr Zegar [Sat, 11 Mar 2023 17:36:20 +0000 (17:36 +0000)]
[clang-tidy] Fix false-positive in cppcoreguidelines-slicing

When warning would be emitted in constructor for virtual base class
initialization.

Fixes: https://github.com/llvm/llvm-project/issues/31187

Reviewed By: carlosgalvezp

Differential Revision: https://reviews.llvm.org/D144206

16 months ago[mlir][core] Fix inline pass default pipeline dump
Ahmed Harmouche [Sat, 11 Mar 2023 17:07:42 +0000 (09:07 -0800)]
[mlir][core] Fix inline pass default pipeline dump

The inliner pass performs canonicalization when created programtically, run with `mlir-opt` with default options, or when explicitly specified. However, when running the pipeline resulting from a `-dump-pass-pipeline` on a default inline pass, the canonicalization is not performed as part of the inlining. This is because the default value for the `default-pipeline` option of the inline pass is an empty string, and this is selected during the dumping. When `InlinerPass::initializeOptions` detects the empty string, it sets the `defaultPipeline` to `nullptr`, which was previously set to canonicalize in the `InlinerPass` constructor, thus the canonicalization is not performed.

The added test checks if the inline pass performs canonicalization by default, and that the dumped `default-pipeline` is set to `canonicalize`.

Fixes: https://github.com/llvm/llvm-project/issues/60960

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D145066

16 months ago[libc] update LibcTableGenUtil for LLVM_LINK_LLVM_DYLIB
Stephen Neuendorffer [Sat, 11 Mar 2023 05:52:26 +0000 (21:52 -0800)]
[libc] update LibcTableGenUtil for LLVM_LINK_LLVM_DYLIB

This library is linked into libc-hdrgen, which is compiled with
DISABLE_LLVM_LINK_LLVM_DYLIB.  This option avoids linking with
libLLVM.so when LLVM_LINK_LLVM_DYLIB is specified.  Unfortunately,
this can cause wierd linkage errors where symbols are defined
multiple times, with one definition coming from static linkage
and another definition coming from libLLVM.so.  This is usually
apparent as a link error with options defined multiple times.

This patch adds DISABLE_LLVM_LINK_LLVM_DYLIB to this library, to
get consistent linkage of libc-hdrgen.

Differential Revision: https://reviews.llvm.org/D145839

16 months ago[Flang] Allow compile *.f03, *.f08 file
Shao-Ce SUN [Sat, 11 Mar 2023 16:17:30 +0000 (00:17 +0800)]
[Flang] Allow compile *.f03, *.f08 file

Fix issue [#61260](https://github.com/llvm/llvm-project/issues/61260)

Reviewed By: awarzynski

Differential Revision: https://reviews.llvm.org/D145845

16 months ago[Clang][Doc] Fix inconsistent links in release notes
Roy Jacobson [Sat, 11 Mar 2023 16:39:33 +0000 (18:39 +0200)]
[Clang][Doc] Fix inconsistent links in release notes

16 months ago[DAG] combineShiftAnd1ToBitTest - improve support for peeking through truncations
Simon Pilgrim [Sat, 11 Mar 2023 16:37:41 +0000 (16:37 +0000)]
[DAG] combineShiftAnd1ToBitTest - improve support for peeking through truncations

Allows us to handle shift amounts that exceed the original bitwidth

16 months agoRevert "[Flang] Allow compile *.f03, *.f08 file"
Shao-Ce SUN [Sat, 11 Mar 2023 16:06:09 +0000 (00:06 +0800)]
Revert "[Flang] Allow compile *.f03, *.f08 file"

The test will fail in the MSVC environment.

This reverts commit 171794de533b400edb47f0e6df4375a7ae052fc8.

16 months ago[libc++] Optimize std::ranges::{min, max} for types that are cheap to copy
Nikolas Klauser [Wed, 8 Feb 2023 19:09:12 +0000 (20:09 +0100)]
[libc++] Optimize std::ranges::{min, max} for types that are cheap to copy

Don't forward to `min_element` for small types that are trivially copyable, and instead use a naive loop that keeps track of the smallest element (as opposed to an iterator to the smallest element). This allows the compiler to vectorize the loop in some cases.

Reviewed By: #libc, ldionne

Spies: ldionne, libcxx-commits

Differential Revision: https://reviews.llvm.org/D143596

16 months ago[Flang] Allow compile *.f03, *.f08 file
Shao-Ce SUN [Sat, 11 Mar 2023 15:16:32 +0000 (23:16 +0800)]
[Flang] Allow compile *.f03, *.f08 file

Fix issue [#61260](https://github.com/llvm/llvm-project/issues/61260)

Reviewed By: awarzynski

Differential Revision: https://reviews.llvm.org/D145845

16 months ago[DAG] Add test showing combineShiftAnd1ToBitTest failing to peek through a truncation
Simon Pilgrim [Sat, 11 Mar 2023 14:25:42 +0000 (14:25 +0000)]
[DAG] Add test showing combineShiftAnd1ToBitTest failing to peek through a truncation

16 months ago[clang-tidy] Make readability-container-data-pointer use <string> header
Mike Crowe [Sat, 11 Mar 2023 13:46:21 +0000 (13:46 +0000)]
[clang-tidy] Make readability-container-data-pointer use <string> header

This requires operator[] to be added to the std::basic_string
implementation.

Depends on D144216

Reviewed By: carlosgalvezp

Differential Revision: https://reviews.llvm.org/D145310

16 months ago[Flang][OpenMP] NFC: Fix a few format issues
Kiran Chandramohan [Sat, 11 Mar 2023 10:36:55 +0000 (10:36 +0000)]
[Flang][OpenMP] NFC: Fix a few format issues

Change a few variable/class names to be in line with guidelines.

16 months ago[VPlan] Simplify code in createReplicateRegion (NFC).
Florian Hahn [Sat, 11 Mar 2023 10:46:38 +0000 (11:46 +0100)]
[VPlan] Simplify code in createReplicateRegion (NFC).

Simplify the code as suggested in D143865.

16 months ago[lld-macho] Don't include zero-size private label symbols in map file
Jez Ng [Sat, 11 Mar 2023 03:31:13 +0000 (22:31 -0500)]
[lld-macho] Don't include zero-size private label symbols in map file

This is also what ld64 does. This will make it easier to compare their
respective map files.

Reviewed By: #lld-macho, thevinster

Differential Revision: https://reviews.llvm.org/D145654

16 months ago[lld-macho] Print archive names in linker map
Jez Ng [Sat, 11 Mar 2023 03:29:14 +0000 (22:29 -0500)]
[lld-macho] Print archive names in linker map

If a symbol is pulled in from an archive, we should include the archive
name in the map file output. This is what ld64 does.

Note that we aren't using `toString(InputFile*)` here because it
includes the install name for dylibs in its output, and ld64's map file
does not contain those.

Reviewed By: #lld-macho, smeenai

Differential Revision: https://reviews.llvm.org/D145623

16 months ago[lld-macho] Coalesce local symbol aliases along with their aliased weak def
Jez Ng [Sat, 11 Mar 2023 03:28:36 +0000 (22:28 -0500)]
[lld-macho] Coalesce local symbol aliases along with their aliased weak def

This supersedes {D139069}. In some ways we are now closer to ld64's
behavior: we previously only did this coalescing for private-label
symbols, but now we do it for all locals, just like ld64. However, we no
longer generate weak binds when a local alias to a weak symbol is
referenced. This is merely for implementation simplicity; it's not clear
to me that any real-world programs depend on us emulating this behavior.

The problem with the previous approach is that we ended up with
duplicate references to the same symbol instance in our InputFiles,
which translated into duplicate symbols in our output. While we could
work around that problem by performing a dedup step before emitting the
symbol table, it seems cleaner to not generate duplicate references in
the first place.

Numbers for chromium_framework on my 16 Core Intel Mac Pro:

             base           diff           difference (95% CI)
  sys_time   2.243 ± 0.093  2.231 ± 0.066  [  -2.5% ..   +1.4%]
  user_time  6.529 ± 0.087  6.080 ± 0.050  [  -7.5% ..   -6.3%]
  wall_time  6.928 ± 0.175  6.474 ± 0.112  [  -7.7% ..   -5.4%]
  samples    26             31

Yep, that's a massive win... because it turns out that {D140606} and
{D139069} caused a regression (of about the same size.) I just didn't
think to measure them back then. I'm guessing all the extra symbols we
have been emitting did not help perf at all...

Reviewed By: lgrey

Differential Revision: https://reviews.llvm.org/D145455

16 months agoRevert "[hwasan] Provide aliases for c allocation functions for Fuchsia"
Vitaly Buka [Sat, 11 Mar 2023 05:17:46 +0000 (21:17 -0800)]
Revert "[hwasan] Provide aliases for c allocation functions for Fuchsia"

Breaks build bots, details in D145718.

This reverts commit 7de775159660538449652ca442c34fd91feecef6.

16 months ago[sanitizer] Add diagnostics for munmap failure
Vitaly Buka [Sat, 11 Mar 2023 05:01:09 +0000 (21:01 -0800)]
[sanitizer] Add diagnostics for munmap failure

We are seeing CHECK is triggered there, but it's unclear why.

16 months ago[test] Add some interesting cases to MC/RISCV/riscv64-64b-pcrel.s
Fangrui Song [Sat, 11 Mar 2023 05:10:40 +0000 (21:10 -0800)]
[test] Add some interesting cases to MC/RISCV/riscv64-64b-pcrel.s

16 months ago[mlir][sparse] Improve quick sort by using a loop to sort the bigger partition.
bixia1 [Wed, 8 Mar 2023 14:56:19 +0000 (06:56 -0800)]
[mlir][sparse] Improve quick sort by using a loop to sort the bigger partition.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D145440

16 months ago[RISCV] Adjust how -1.0 is handled in RISCVLoadFPImm. NFC
Craig Topper [Sat, 11 Mar 2023 04:26:00 +0000 (20:26 -0800)]
[RISCV] Adjust how -1.0 is handled in RISCVLoadFPImm. NFC

Instead of hardcoding the -1.0 exponent and mantissa separately from the
table, reuse the table entry for 1.0.

When searching the table we can change index 16 to index 0 if the sign
is negative. Or when indexing we can change index 0 to index 16 and remember
that we need to flip the sign.

I'm going to make another patch that has a f16 and f64 table and
this makes the code for those more similar.

16 months agoclang/cmake: Use installed gtest libraries for stand-alone builds
Tom Stellard [Sat, 11 Mar 2023 02:00:06 +0000 (18:00 -0800)]
clang/cmake: Use installed gtest libraries for stand-alone builds

(re-commit of cb38df4c4d3aee53107219a68749dc94fe70ff68 with the correct commit message)

Reviewed By: phosek, kwk

Differential Revision: https://reviews.llvm.org/D138472

16 months agoRevert "Add install targets for gtest"
Tom Stellard [Sat, 11 Mar 2023 03:59:15 +0000 (19:59 -0800)]
Revert "Add install targets for gtest"

This reverts commit cb38df4c4d3aee53107219a68749dc94fe70ff68.

I accidentally committed this with the wrong commit message.

16 months agoAdd install targets for gtest
Tom Stellard [Sat, 11 Mar 2023 01:22:14 +0000 (17:22 -0800)]
Add install targets for gtest

Stand-alone builds need an installed version of gtest in order to run
the unittests.

Reviewed By: mgorny, kwk

Differential Revision: https://reviews.llvm.org/D137890

16 months ago[X86] Add unwind for base pointer test case.
Luo, Yuanke [Sat, 11 Mar 2023 03:36:02 +0000 (11:36 +0800)]
[X86] Add unwind for base pointer test case.

16 months ago[polly][test] Fix after 7c3c98144
Arthur Eubanks [Sat, 11 Mar 2023 03:28:59 +0000 (19:28 -0800)]
[polly][test] Fix after 7c3c98144

16 months ago[RISCV] Remove one bit of mantissa in RISCVLoadFPImm related code.
Craig Topper [Sat, 11 Mar 2023 03:14:44 +0000 (19:14 -0800)]
[RISCV] Remove one bit of mantissa in RISCVLoadFPImm related code.

We only need 2 bits of mantissa. The third bit was always 0.

16 months ago[X86] Add regcall CC test case for base pointer register.
Luo, Yuanke [Sat, 11 Mar 2023 02:55:12 +0000 (10:55 +0800)]
[X86] Add regcall CC test case for base pointer register.

16 months ago[lld] Pass random.randint stop parameter as int.
Jacek Caban [Sat, 11 Mar 2023 02:54:14 +0000 (21:54 -0500)]
[lld] Pass random.randint stop parameter as int.

It's required by Python 3.12, from https://docs.python.org/3.12/library/random.html "Changed in version 3.12: Automatic conversion of non-integer types is no longer supported."

Reviewed By: #lld-macho, int3

Differential Revision: https://reviews.llvm.org/D145826

16 months ago[NVPTX] Sync generation of parameter names in a function signature with the function...
Pavel Kopyl [Mon, 20 Feb 2023 15:31:58 +0000 (16:31 +0100)]
[NVPTX] Sync generation of parameter names in a function signature with the function body.

This fixes parameter names mismatch in anonymous functions.

Differential Revision: https://reviews.llvm.org/D144407

16 months ago[NFC] fix typo `funciton` -> `function`
Yuanfang Chen [Sat, 11 Mar 2023 02:03:26 +0000 (18:03 -0800)]
[NFC] fix typo `funciton` -> `function`

credits to @jmagee

16 months agoAdd install targets for gtest
Tom Stellard [Sat, 11 Mar 2023 01:22:14 +0000 (17:22 -0800)]
Add install targets for gtest

Stand-alone builds need an installed version of gtest in order to run
the unittests.

Reviewed By: mgorny, kwk

Differential Revision: https://reviews.llvm.org/D137890

16 months ago[Passes] Remove some legacy passes
Arthur Eubanks [Wed, 8 Mar 2023 23:07:17 +0000 (15:07 -0800)]
[Passes] Remove some legacy passes

DFAJumpThreading
JumpThreading
LibCallsShrink
LoopVectorize
SLPVectorizer
DeadStoreElimination
AggressiveDCE
CorrelatedValuePropagation
IndVarSimplify

These are part of the optimization pipeline, of which the legacy version is deprecated and being removed.

16 months ago[lldb][NFC] Use UnixSignal::CreateForHost in Process
Alex Langford [Sat, 11 Mar 2023 00:56:52 +0000 (16:56 -0800)]
[lldb][NFC] Use UnixSignal::CreateForHost in Process

These do the same thing but we have a specific function for it.

16 months ago[hwasan] Provide aliases for c allocation functions for Fuchsia
Leonard Chan [Sat, 11 Mar 2023 00:31:04 +0000 (00:31 +0000)]
[hwasan] Provide aliases for c allocation functions for Fuchsia

"Interceptors" in this file aren't like the traditional interceptors
used by other sanitizers like asan. They're simply aliases to the
equivalent __sanitizer_* functions.

This also removes the WRAP(FN) declaration since it just creates
declarations for __interceptor_* functions but they seem to be unused.

Differential Revision: https://reviews.llvm.org/D145718

16 months ago[ASAN] Support memory checks on scalable vector typed masked load and store
Philip Reames [Sat, 11 Mar 2023 00:05:22 +0000 (16:05 -0800)]
[ASAN] Support memory checks on scalable vector typed masked load and store

This takes the approach of using the loop based formation for scalable vectors only. We could potentially use the loop form for fixed vectors only, but we'd loose the unroll and specialize on constant vector logic which is already present. I don't have a strong opinion on whether the existing logic is worthwhile, I kept it mostly to minimize test churn.

Worth noting is that there is a better lowering available. The plain vector lowering appears to check only the first and last byte. By analogy, we should be able to check only the first active and last active byte in the masked op. This is a more invasive change to asan, and I decided simply supporting scalable vectors at all was a better starting place.

Differential Revision: https://reviews.llvm.org/D145198

16 months ago[HWASAN][LSAN] Exclude crash-recovery-modules.m from HWASAN tests
Kirill Stoimenov [Fri, 10 Mar 2023 21:03:43 +0000 (21:03 +0000)]
[HWASAN][LSAN] Exclude crash-recovery-modules.m from HWASAN tests

This is a reland of a single file from D145727, which was reverted in 25ba9dcf1807. This test is using exact line number in the checks so if anything is rearranged the test fails. Moving hwasan on the same line fixes that issue.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D145822

16 months ago[llvm-tblgen] Support conditional definitions using !casts clauses
Philip Reames [Fri, 10 Mar 2023 23:49:27 +0000 (15:49 -0800)]
[llvm-tblgen] Support conditional definitions using !casts clauses

This is a follow on to D145108. This started as simply fixing the crash on an error case reported against that change, but I think this also ends up fixing the original reported issue (https://github.com/llvm/llvm-project/issues/49830) as well. More accurately, D145108 fixed the case where the cast resolves to an existing record, and this change fixes the case where the named record doesn't exist.

Differential Revision: https://reviews.llvm.org/D145711

16 months ago[NFC] [CMake] Add misssing dependencies
Chris Bieneman [Fri, 10 Mar 2023 23:13:00 +0000 (17:13 -0600)]
[NFC] [CMake] Add misssing dependencies

I missed adding these in my last cleanup change :(

16 months ago[mlir][sparse] support dynamic sparse tensor slices.
Peiming Liu [Tue, 10 Jan 2023 22:35:49 +0000 (22:35 +0000)]
[mlir][sparse] support dynamic sparse tensor slices.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D141532

16 months ago[libc] Fix common compile options not getting passed to GPU object
Joseph Huber [Fri, 10 Mar 2023 22:53:43 +0000 (16:53 -0600)]
[libc] Fix common compile options not getting passed to GPU object

Summary:
This variable was named incorrectly. We weren't getting needed flags
passed to object library builds.

16 months agoImplements MLIR Bytecode versioning capability
Matteo Franciolini [Tue, 14 Feb 2023 16:45:08 +0000 (08:45 -0800)]
Implements MLIR Bytecode versioning capability

A dialect can opt-in to handle versioning through the
`BytecodeDialectInterface`. Few hooks are exposed to the dialect to allow
managing a version encoded into the bytecode file. The version is loaded
lazily and allows to retrieve the version information while parsing the input
IR, and gives an opportunity to each dialect for which a version is present
to perform IR upgrades post-parsing through the `upgradeFromVersion` method.
Custom Attribute and Type encodings can also be upgraded according to the
dialect version using readAttribute and readType methods.

There is no restriction on what kind of information a dialect is allowed to
encode to model its versioning. Currently, versioning is supported only for
bytecode formats.

Reviewed By: rriddle, mehdi_amini

Differential Revision: https://reviews.llvm.org/D143647

16 months agoRevert "[X86] Drop single use check for freeze(undef) in LowerAVXCONCAT_VECTORS"
ManuelJBrito [Fri, 10 Mar 2023 22:23:28 +0000 (22:23 +0000)]
Revert "[X86] Drop single use check for freeze(undef) in LowerAVXCONCAT_VECTORS"

This reverts commit 1a4d0eb866be909fe16da5ebffe4122aa0693d8c.

16 months ago[cmake] Quote args when generating /libpath option specifying runtime dir for link...
Matthew Voss [Fri, 10 Mar 2023 22:11:37 +0000 (14:11 -0800)]
[cmake] Quote args when generating /libpath option specifying runtime dir for link/lld-link

When the runtime dir path includes whitespace (ex. when it's installed
under "Program Files" on Windows), the lack of quotes causes the linker
to interpret the path as one or more arguments. None of these path
fragments exist, so the link fails.

Differential Revision: https://reviews.llvm.org/D145827

16 months ago[flang] Add missing dependencies for flang/lib/Optimizer/Dialect
Peter Steinfeld [Fri, 10 Mar 2023 21:03:52 +0000 (13:03 -0800)]
[flang] Add missing dependencies for flang/lib/Optimizer/Dialect

Patch D145640 wasn't building for me because .cpp files in
flang/lib/Optimizer/Dialect depend on the files generated in
.../build/include/llfm/IR.  But the .cpp file compilations were being
done before the needed include files were generated.

This patch fixes that by adding dependencies on "intrinsics_gen" to the
CMake files in two directories.

Differential Revision: https://reviews.llvm.org/D145825

16 months agoRevert "[MergeICmps] Adapt to non-eq comparisons, fix bug for cases need be spilted"
Arthur Eubanks [Fri, 10 Mar 2023 21:22:17 +0000 (13:22 -0800)]
Revert "[MergeICmps] Adapt to non-eq comparisons, fix bug for cases need be spilted"

This reverts commit 818e554e251c1e07f133aeed9fe0473502ebfdae.

Causes miscompiles, see comments on D141188.

16 months ago[SLP]Initial support for reshuffling of non-starting buildvector/gather nodes.
Alexey Bataev [Mon, 20 Feb 2023 21:26:11 +0000 (13:26 -0800)]
[SLP]Initial support for reshuffling of non-starting buildvector/gather nodes.

Previously only the very first gather/buildvector node might be probed for reshuffling of other nodes.
But the compiler may do the same for other gather/buildvector nodes too, just need to check the
dependency and postpone the emission of the dependent nodes, if the origin nodes were not emitted yet.

Part of D110978

Differential Revision: https://reviews.llvm.org/D144958

16 months ago[clang][deps] Split lookupModuleOutput out of DependencyConsumer NFC
Ben Langmuir [Fri, 10 Mar 2023 17:48:56 +0000 (09:48 -0800)]
[clang][deps] Split lookupModuleOutput out of DependencyConsumer NFC

The idea is to split the callbacks that are used to consume dependency
information (DependencyConsumer) from callbacks that modify the scan
behaviour itself in any way (DependencyActionController). Currently this
is just lookupModuleOutput, but we have additional callbacks related to
CAS support that we intend to upstream in the future.

Differential Revision: https://reviews.llvm.org/D144058

16 months ago[Driver][FreeBSD] Simplify ARM handling
Brad Smith [Fri, 10 Mar 2023 21:10:44 +0000 (16:10 -0500)]
[Driver][FreeBSD] Simplify ARM handling

Since FreeBSD 8 / 9 support was dropped from the Driver there is room to simplify
things with the ARM handling.

The exception model handling function can be removed.

EABI is now the default.

Reviewed By: dim

Differential Revision: https://reviews.llvm.org/D144823

16 months ago[RISCV] Consistently place single quotes around extension names in error messages.
Craig Topper [Fri, 10 Mar 2023 20:19:10 +0000 (12:19 -0800)]
[RISCV] Consistently place single quotes around extension names in error messages.

Some extensions had them, some did not.

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D145817

16 months ago[SLP][NFC]Add a test with phi nodes in one tree node with different
Alexey Bataev [Fri, 10 Mar 2023 20:18:23 +0000 (12:18 -0800)]
[SLP][NFC]Add a test with phi nodes in one tree node with different
order of incoming basic blocks, NFC.

16 months ago[Debuginfod] Prune cache after fetch.
Daniel Thornburgh [Wed, 8 Mar 2023 22:03:09 +0000 (14:03 -0800)]
[Debuginfod] Prune cache after fetch.

Previously, the size of the debuginfod cache would grow without bound.
This change prunes the cache after a successful debuginfod lookup, as is
done in libdebuginfod.

The cache pruning behavior is configured by a new
DEBUGINFOD_CACHE_POLICY environment variable. The semantics of this are
the same as --thinlto_cache_policy.

Reviewed By: gulfem

Differential Revision: https://reviews.llvm.org/D145618

16 months ago[libc++][NFC] Use std::malloc and std::free instead of unqualified versions in tests
Louis Dionne [Fri, 10 Mar 2023 14:15:14 +0000 (09:15 -0500)]
[libc++][NFC] Use std::malloc and std::free instead of unqualified versions in tests

Differential Revision: https://reviews.llvm.org/D145789

16 months agoRevert "Currently the control of the eval-method is mixed with fast-math."
Zahira Ammarguellat [Thu, 9 Mar 2023 14:24:01 +0000 (09:24 -0500)]
Revert "Currently the control of the eval-method is mixed with fast-math."

Setting __FLT_EVAL_METHOD__ to -1 with fast-math will set
__GLIBC_FLT_EVAL_METHOD to 2 and long double ends up being used for
float_t and double_t. This creates some ABI breakage with various C libraries.
See details here: https://github.com/llvm/llvm-project/issues/60781

This reverts commit bbf0d1932a3c1be970ed8a580e51edf571b80fd5.

16 months ago[libc++] Remove conditional usage of rvalue references in C++03
Louis Dionne [Thu, 9 Mar 2023 17:30:08 +0000 (12:30 -0500)]
[libc++] Remove conditional usage of rvalue references in C++03

This one is easy -- Clang supports rvalue references in C++03 mode, so
we should be able to remove that conditional.

As a fly-by fix, turn a few static_casts to std::forward.

Differential Revision: https://reviews.llvm.org/D145701

16 months ago[CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag
Petr Hosek [Thu, 9 Mar 2023 18:23:04 +0000 (18:23 +0000)]
[CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag

These will be replaced by CMake's check_linker_flag once we update
the minimum CMake version 3.20.

Differential Revision: https://reviews.llvm.org/D145716

16 months ago[Fuchsia] Add LLDB to CLANG_BOOTSTRAP_TARGETS.
Daniel Thornburgh [Fri, 10 Mar 2023 19:08:36 +0000 (11:08 -0800)]
[Fuchsia] Add LLDB to CLANG_BOOTSTRAP_TARGETS.

stage2-check-lldb should be run in a 2-stage build to test the final
LLDB artifact, so it and related targets must be exported to the stage 1
project.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D145818

16 months ago[flang] Break shared library cyclic dependence
Peter Klausler [Fri, 10 Mar 2023 19:24:23 +0000 (11:24 -0800)]
[flang] Break shared library cyclic dependence

I inadvertently introduced a cycle of dependences between the Evaluate
and Semantics libraries; this patch breaks that cycle and reenables
the flang build bots that rely on shared library builds.

16 months ago[RISCV] Error if F and Zfinx extensions are specified together.
Craig Topper [Fri, 10 Mar 2023 19:26:00 +0000 (11:26 -0800)]
[RISCV] Error if F and Zfinx extensions are specified together.

Fixes #61277

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D145809

16 months agollvm-exegesis: Only run target specfic tests on native hosts
Tom Stellard [Fri, 10 Mar 2023 05:06:22 +0000 (00:06 -0500)]
llvm-exegesis: Only run target specfic tests on native hosts

These tests were failing on SystemZ hosts, I don't think JIT'ing non-SystemZ
modules on SystemZ is supported.

The tests were initiallay enabled on all arches by
7a76140220bd2c4730a2c39b6fd645402040f011.

Differential Revision: https://reviews.llvm.org/D145763

16 months ago[mlir][sparse] extend storage specifier operations for slices.
Peiming Liu [Tue, 10 Jan 2023 23:46:45 +0000 (23:46 +0000)]
[mlir][sparse] extend storage specifier operations for slices.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D141641

16 months ago[mlir][spirv][vector] Add pattern to convert reduction to SPIR-V dot prod
Jakub Kuderski [Fri, 10 Mar 2023 18:54:16 +0000 (13:54 -0500)]
[mlir][spirv][vector] Add pattern to convert reduction to SPIR-V dot prod

This converts a specific form of `vector.reduction` to SPIR-V integer
dot product ops.

Add a new test pass to excercise this outside of the main vector to
spirv conversion pass.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D145760

16 months ago[flang][runtime] EOF is recoverable only with END= or IOSTAT=
Peter Klausler [Thu, 9 Mar 2023 00:09:01 +0000 (16:09 -0800)]
[flang][runtime] EOF is recoverable only with END= or IOSTAT=

The runtime's I/O error handler was not crashing the program on an
end-of-file condition that arises for a data transfer statement with
at least one of ERR= or IOMSG= and none of END= or IOSTAT= control
items.  This turns out to be incorrect (per subclause 12.11);
an EOF is recoverable only for END= and/or IOSTAT=, and an
non-advancing end-of-record is recoverable only for EOR= and/or IOSTAT=.

Differential Revision: https://reviews.llvm.org/D145754

16 months ago[SLP][NFC]Add a test with multilevel dependency between buildvector
Alexey Bataev [Fri, 10 Mar 2023 18:28:19 +0000 (10:28 -0800)]
[SLP][NFC]Add a test with multilevel dependency between buildvector
nodes, NFC.

16 months ago[flang][runtime] Use Descriptor::Establish() in elemental derived type defined assign...
Peter Klausler [Wed, 8 Mar 2023 22:45:18 +0000 (14:45 -0800)]
[flang][runtime] Use Descriptor::Establish() in elemental derived type defined assignment calls

The code in DoElementalDefinedAssignment() needs to establish its
to & from per-element descriptors with Establish() rather than
copying an array's descriptor and then setting its rank to zero;
the current technique loses the information in the addendum.

Differential Revision: https://reviews.llvm.org/D145753

16 months ago[flang][runtime] Iterate over array elements in user-defined derived type I/O
Peter Klausler [Wed, 8 Mar 2023 19:56:33 +0000 (11:56 -0800)]
[flang][runtime] Iterate over array elements in user-defined derived type I/O

It was only handling scalars; change to iterate over all array elements.

Differential Revision: https://reviews.llvm.org/D145752

16 months ago[ConstraintElimination] UB reproducer for D145677
Vitaly Buka [Fri, 10 Mar 2023 18:06:50 +0000 (10:06 -0800)]
[ConstraintElimination] UB reproducer for D145677

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D145812

16 months agoMachO: support custom section names on global variables
Tim Northover [Fri, 10 Mar 2023 17:53:49 +0000 (17:53 +0000)]
MachO: support custom section names on global variables

These attributes have been accepted in ELF for a while, and are generated by
Clang in some places, so it makes sense to support them on MachO too.

https://reviews.llvm.org/D143173

16 months agoDon't produce a dynamic value if there was an error creating it.
Jim Ingham [Fri, 10 Mar 2023 18:08:26 +0000 (10:08 -0800)]
Don't produce a dynamic value if there was an error creating it.

We used to make a dynamic value that "pretended to be its parent"
but that's hard for some of the more complex ValueObject types, and
it's better in this case just to return no dynamic value.

Differential Revision: https://reviews.llvm.org/D145629

16 months ago[flang][runtime] Corrections to formatted child I/O
Peter Klausler [Wed, 8 Mar 2023 19:07:39 +0000 (11:07 -0800)]
[flang][runtime] Corrections to formatted child I/O

A handful of I/O statements (OPEN, CLOSE, positioning) are not allowed
on units during child I/O; catch violations and report errors.
Also finesse error handling during FORMAT runtime parsing of DT
derived type edit descriptors, and ensure that formatted child
I/O is nonadvancing.

Differential Revision: https://reviews.llvm.org/D145751

16 months ago[flang] Correct handling of USE-associated generic override in nested scope
Peter Klausler [Tue, 7 Mar 2023 21:29:32 +0000 (13:29 -0800)]
[flang] Correct handling of USE-associated generic override in nested scope

As the new test here shows by failing with the current compiler with
a bogus error message about indistinguishable specific procedures in
a generic interface, name resolution needs to take care to not
copy a USE-associated generic into the current scope for extension
when the USE association is actually into an enclosing scope.

Differential Revision: https://reviews.llvm.org/D145750

16 months ago[flang] Fix checking of TBP bindings
Peter Klausler [Tue, 7 Mar 2023 01:32:12 +0000 (17:32 -0800)]
[flang] Fix checking of TBP bindings

Non-DEFERRED procedure binding checking can't blindly accept
all procedures defined in modules -- they can't be ABSTRACT
interfaces.  And GetUltimate() must be used rather than
FindSubprogram(); the latter will resolve to a procedure's
interface in the case of "procedure(interface) :: external",
not "external".

Differential Revision: https://reviews.llvm.org/D145749

16 months ago[Flang] add space between number and character in print
Shao-Ce SUN [Fri, 10 Mar 2023 17:58:10 +0000 (01:58 +0800)]
[Flang] add space between number and character in print

```
print *, "123",456,"789"
```
before
```
123 456789
```
after
```
123 456 789
```

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D145768

16 months agoRevert "[LICM] Support logical AND/OR when hoisting min/max"
Vitaly Buka [Fri, 10 Mar 2023 17:52:57 +0000 (09:52 -0800)]
Revert "[LICM] Support logical AND/OR when hoisting min/max"

Breaks https://lab.llvm.org/buildbot/#/builders/37/builds/20720

This reverts commit 9e83d13c9f77e300ebb7b94a1400de3c2d47b3d5.

16 months ago[test][asan] Fix requirement formatting
Vitaly Buka [Fri, 10 Mar 2023 17:52:08 +0000 (09:52 -0800)]
[test][asan] Fix requirement formatting

16 months ago[flang] Detect obvious argument shape incompatibility when checking procedure compati...
Peter Klausler [Tue, 7 Mar 2023 00:07:24 +0000 (16:07 -0800)]
[flang] Detect obvious argument shape incompatibility when checking procedure compatibility

The compiler presently detects different dummy object array ranks;
extend the compatibility check to also note discrepancies in corresponding
constant dummy argument extents.

Differential Revision: https://reviews.llvm.org/D145748

16 months ago[flang] Diagnose ridiculously large kind parameters
Peter Klausler [Mon, 6 Mar 2023 23:10:47 +0000 (15:10 -0800)]
[flang] Diagnose ridiculously large kind parameters

Kind parameters on literals (1_4, 1.0_8, 4_"Unicode") are not
being caught as errors if they're extremely large integer values
that become valid when truncated to C++'s int type.

Differential Revision: https://reviews.llvm.org/D145747

16 months ago[flang] Check dummy arguments of BIND(C) procedures
Peter Klausler [Mon, 6 Mar 2023 22:29:53 +0000 (14:29 -0800)]
[flang] Check dummy arguments of BIND(C) procedures

Declaration checking in semantics was only examining symbols with
explicit BIND(C) attributes; extend it to also check dummy arguments
to such procedures.

Differential Revision: https://reviews.llvm.org/D145746

16 months ago[flang][runtime] Catch infinite unlimited format repetition better
Peter Klausler [Sun, 5 Mar 2023 22:01:28 +0000 (14:01 -0800)]
[flang][runtime] Catch infinite unlimited format repetition better

The runtime check for infinite unlimited format repetition is missing
the case of implicit unlimited format repetition at the top level
without finding the next data edit descriptor that corresponds with
a data list item.

Replace the check with a Boolean flag that detects unlimited
repetition hitting a right parenthesis and restarting, and fail
when it happens the second time.

Differential Revision: https://reviews.llvm.org/D145745

16 months ago[ConstraintElim] Update test to use variable start value.
Florian Hahn [Fri, 10 Mar 2023 17:29:50 +0000 (18:29 +0100)]
[ConstraintElim] Update test to use variable start value.

Otherwise %x <= 10 will be true on the first iteration, making the latch
dead. This makes the test more robust to CE becoming more powerful in
the future.

16 months ago[flang] Forward references to COMMON from specification expr under IMPLICIT NONE
Peter Klausler [Fri, 3 Mar 2023 19:43:55 +0000 (11:43 -0800)]
[flang] Forward references to COMMON from specification expr under IMPLICIT NONE

As a near-universal extension, Fortran compilers permit forward references
to dummy arguments and variables in COMMON blocks from specification expressions
before an explicit type-declaration-stmt appears for those variables
under IMPLICIT NONE, so long as those variables are later explicitly typed
with the types that regular implicit typing rules would have given them
(usually default INTEGER).

F18 implemented this extension for dummy arguments, but not variables in
COMMON blocks.  Extend the extension to also accept variables in COMMON.

Differential Revision: https://reviews.llvm.org/D145743

16 months ago[RISCV] Support Zfa fli instructions with vector splats.
Craig Topper [Fri, 10 Mar 2023 17:16:21 +0000 (09:16 -0800)]
[RISCV] Support Zfa fli instructions with vector splats.

-Return false from RISCVDAGToDAGISel::selectFPImm for fli
 constants so we don't try to use integer expansion.
-Support fli.h with Zvfh+Zfhmin.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D145766

16 months ago[mlir] Add mlir::LLVM::FastmathFlags to LLVM instrinsic vector reductions
Brandon Myers [Fri, 10 Mar 2023 17:12:50 +0000 (09:12 -0800)]
[mlir] Add mlir::LLVM::FastmathFlags to LLVM instrinsic vector reductions

Rationale:
The LLVM dialect supports passing fastmath flags from floating point ops to LLVMIR instructions. However, not all LLVM ops have the required attribute. This change adds support for fastmath flags to `llvm.intr.vector.reduce.{fmin,fmax}`. One scenario where this is useful is in lowering llvm.intr.vector.reduce.{fmax,fmin} to LLVMIR with `nnan` (NoNans) flag so it may be [[ https://github.com/llvm/llvm-project/blob/115c7beda74f3cfaf83b91d14bc97a39bff4cf19/llvm/lib/CodeGen/ExpandReductions.cpp#L159 | lowered to a shuffle reduction ]].

Changes:

  - Make `LLVM_VecReductionF` implement the `FastmathFlagsInterface`; change is modeled on `LLVM_UnaryIntrOpF`
  - Add an assembly format for `LLVM_VecReductionF` ops. The purpose is to keep existing functionality: avoid printing the fastmath flags attribute when it has its default value (`none`). Change is modeled on `LLVM_UnaryIntrOpBase`

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D145692

16 months ago[flang] Check that a SELECT TYPE selector is not a procedure
Peter Klausler [Fri, 3 Mar 2023 18:37:13 +0000 (10:37 -0800)]
[flang] Check that a SELECT TYPE selector is not a procedure

A SELECT TYPE statement's selector must be a variable or expression,
not a procedure; specifically, a function with a polymorphic result
is unacceptable.

Differential Revision: https://reviews.llvm.org/D145742

16 months ago[NFC] [CMake] Cleanup clang tool dependencies
Chris Bieneman [Fri, 10 Mar 2023 16:40:19 +0000 (10:40 -0600)]
[NFC] [CMake] Cleanup clang tool dependencies

None of these tools need to depend on clang to build, instead the test
target should depend on them.

This prevents rebuilding/linking these tools when building the `clang`
target directly.

16 months ago[flang] Ignore FINAL subroutines with mismatching type parameters
Peter Klausler [Thu, 2 Mar 2023 16:15:51 +0000 (08:15 -0800)]
[flang] Ignore FINAL subroutines with mismatching type parameters

When a parameterized derived type has FINAL subroutines, only
those FINAL subroutines whose dummy argument's type matches the
type parameter values of a particular instantiation are relevant
to that instantiation.

Differential Revision: https://reviews.llvm.org/D145741

16 months agoReland D144768 "[scudo] Mitigate page releasing thrashing"
Chia-hung Duan [Thu, 9 Mar 2023 16:20:08 +0000 (16:20 +0000)]
Reland D144768 "[scudo] Mitigate page releasing thrashing"

This reverts commit e64fabf51e882cc8e6157b7d139005162adb947c.

Reviewed By: cferris

Differential Revision: https://reviews.llvm.org/D145543

16 months ago[VPlan] Add VPWidenSelectRecipe::getCond() (NFC).
Florian Hahn [Fri, 10 Mar 2023 16:49:23 +0000 (17:49 +0100)]
[VPlan] Add VPWidenSelectRecipe::getCond() (NFC).

Add helper to access condition, as suggested in D144489.

16 months ago[flang] Fix crash in folding TRANSFER() with MOLD=substring
Peter Klausler [Thu, 2 Mar 2023 00:08:43 +0000 (16:08 -0800)]
[flang] Fix crash in folding TRANSFER() with MOLD=substring

When a substring appears as the MOLD= argument to TRANSFER(),
it's possible for the compiler to assert if it can't figure
out a constant length for the substring.  Fix.

Differential Revision: https://reviews.llvm.org/D145740

16 months ago[RISCV] Enable Zfa fli.h instruction in MC layer with Zfhmin and Zvfh.
Craig Topper [Fri, 10 Mar 2023 16:23:23 +0000 (08:23 -0800)]
[RISCV] Enable Zfa fli.h instruction in MC layer with Zfhmin and Zvfh.

According to the spec this instruction is can be enabled with Zfh
and Zvfh (which requires Zfhmin). The other instructions f16
instructions from Zfa require Zfh.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D145649

16 months ago[SLP][NFC]Update/simplify test to avoid dead code elimination.
Alexey Bataev [Wed, 8 Mar 2023 21:46:18 +0000 (13:46 -0800)]
[SLP][NFC]Update/simplify test to avoid dead code elimination.

16 months ago[RISCV] Print Zfa fli instruction FP values in a more adaptive way.
Craig Topper [Fri, 10 Mar 2023 15:57:44 +0000 (07:57 -0800)]
[RISCV] Print Zfa fli instruction FP values in a more adaptive way.

Previously, we printed all constants in scientific notation with
6 digits of precision. This is not enough to accurately display
the smallest value, but increasing the precision would be too much
for other values.

This patch prints values with fractional bits using only as many digits as
needed. 1*2^-15 and 1*2^-16 will be printed in scientific notation while
the others are printed without scientific notation. The integer values
are printed with a single 0 after the decimal point.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D145645

16 months ago[TargetParser] Disallow Global Constructors
Archibald Elliott [Sat, 4 Feb 2023 13:27:32 +0000 (13:27 +0000)]
[TargetParser] Disallow Global Constructors

Global Constructors are disallowed in the Support library. The
TargetParser library is likely to go along with the Support library in
most uses, because it contains llvm::Triple, so lets pre-emptively add
the same rule, rather than getting caught out later.

Differential Revision: https://reviews.llvm.org/D145249