platform/upstream/llvm.git
16 months ago[clang][deps] Only cache files with specific extension
Jan Svoboda [Fri, 17 Mar 2023 20:19:12 +0000 (13:19 -0700)]
[clang][deps] Only cache files with specific extension

In the scanner's VFS, we cache all files by default and only avoid caching stat failures for certain files. This tanks the performance of scanning with pre-populated module cache. When there is a stale PCM file, it gets cached by the scanner at the start and the rebuilt version never makes it through the VFS again. The TU invocation that rebuilds the PCM only sees the copy in its InMemoryModuleCache, which is invisible to other invocations. This means the PCM gets rebuilt for every TU given to the scanner.

This patch fixes the situation by flipping the default, only caching files that are known to be important, and letting everything else fall through to the underlying VFS.

rdar://106376153

Reviewed By: Bigcheese

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

16 months ago[InstCombine] Add test for issue fixed by 50fe87a5c8597e.
Florian Hahn [Mon, 20 Mar 2023 17:59:36 +0000 (17:59 +0000)]
[InstCombine] Add test for issue fixed by 50fe87a5c8597e.

Extra test that was fixed by 50fe87a5c8597e to make sure it doesn't
regress again.

16 months ago[SLP][NFC]Add a test with missed buildvector node, matching the
Alexey Bataev [Mon, 20 Mar 2023 17:55:44 +0000 (10:55 -0700)]
[SLP][NFC]Add a test with missed buildvector node, matching the
vectorized node.

16 months agoRevert "[clangd] Fix AddUsing in the face of typo-correction"
Kadir Cetinkaya [Mon, 20 Mar 2023 17:57:40 +0000 (18:57 +0100)]
Revert "[clangd] Fix AddUsing in the face of typo-correction"

This reverts commit 6f23fee4ef98a695062aa128a177478ba7d742d4.
Breaks windows buildbots

16 months ago[AIX][Clang] Respect -r when invoking the linker
Michael Francis [Mon, 13 Mar 2023 06:53:54 +0000 (06:53 +0000)]
[AIX][Clang] Respect -r when invoking the linker

On AIX, libraries are still being linked when `-r` is passed to the driver. This patch corrects this error.

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

16 months ago[MLIR][Linalg] Generate unique LibraryCallName for LinalgOps.
Amy Wang [Mon, 20 Mar 2023 17:19:13 +0000 (13:19 -0400)]
[MLIR][Linalg] Generate unique LibraryCallName for LinalgOps.

When lowering LinalgToStandard for named UnaryFn/BinaryFn ops, ensure
the fun name appears in the generated library name. Further, for
linalg.copy to/from different address spaces, ensure the to/from
address spaces are appended onto the library name for uniqueness.
This fixes the lowering error with the linalg.copy testcase shown in
this patch.

Reviewed By: ftynse

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

16 months ago[PowerPC] Adding test coverage for vector compatibility warning
Maryam Moghadas [Thu, 23 Feb 2023 01:33:04 +0000 (19:33 -0600)]
[PowerPC] Adding test coverage for vector compatibility warning

This is to test D143210 patch to have the same vector
compatibility logic for error and warning diagnostics.

Reviewed By: lei

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

16 months ago[lldb] Introduce CMake variable LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS
Alex Langford [Fri, 17 Mar 2023 22:14:21 +0000 (15:14 -0700)]
[lldb] Introduce CMake variable LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS

The goal of this patch is to add the ability for the CMake configure to
fail when some optional test dependencies are not met. LLDB tries to be
flexible when test dependencies are not present but there are cases
where it would be useful to know that these dependencies are missing
before we run the test suite.

The intent here is to apply this setting on CI machines and make sure
that they have useful optional dependencies installed. We recently hit a
case where some CI machines were timing out while running the test suite
because a few tests were hanging. With this option, we'll be able to
know if the machine does not have psutil installed so we can install it
and avoid the timeout scenario altogether.

rdar://103194447

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

16 months ago[LSR] Rewrite IV match for term-fold using existing utilities
Philip Reames [Mon, 20 Mar 2023 16:54:56 +0000 (09:54 -0700)]
[LSR] Rewrite IV match for term-fold using existing utilities

Main benefit here is making the logic easier to follow, slightly more efficient, and more in line with LFTR.  This is not NFC.  There are three semantic changes here.

First, we drop handling for constants on the LHS of the comparison.  These are non-canonical, and we're very late in the optimization pipeline here, so there's no point in supporting this.  I removed a test which covered this case.

Second, we don't need the almost dead IV to be an addrec.  We just need SCEV to be able to compute a trip count for it.

Third, we require a simple IV for the almost dead IV.  In theory, this removes cases we could have previously handled, but given a) zero testing and b) multiple known correctness issues, I'm adopting an attidute of narrowing this down to something which works correctly, and *then* expanding.

16 months ago[Serialization] Place command line defines in the correct file
John Brawn [Tue, 21 Feb 2023 11:09:26 +0000 (11:09 +0000)]
[Serialization] Place command line defines in the correct file

Fix several problems related to serialization causing command line
defines to be reported as being built-in defines:
 * When serializing the <built-in> and <command line> files don't
   convert them into absolute paths.
 * When deserializing SM_SLOC_BUFFER_ENTRY we need to call
   setHasLineDirectives in the same way as we do for
   SM_SLOC_FILE_ENTRY.
 * When created suggested predefines based on the current command line
   options we need to add line markers in the same way that
   InitializePreprocessor does.
 * Adjust a place in clangd where it was implicitly relying on command
   line defines being treated as builtin.

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

16 months ago[clang][dataflow] Fix indentation in a test
Dmitri Gribenko [Mon, 20 Mar 2023 17:33:40 +0000 (18:33 +0100)]
[clang][dataflow] Fix indentation in a test

16 months ago[lldb] Sidestep -Wformat warning by using LLDB_LOG instead of LLDB_LOGF
Jonas Devlieghere [Mon, 20 Mar 2023 17:30:42 +0000 (10:30 -0700)]
[lldb] Sidestep -Wformat warning by using LLDB_LOG instead of LLDB_LOGF

Fixes warning: format specifies type 'unsigned long' but the argument
has type 'DataType' (aka 'unsigned long long') [-Wformat]

16 months ago[libc] Make string tests compatible with the Fuchsia build
Roland McGrath [Sat, 18 Mar 2023 00:57:15 +0000 (17:57 -0700)]
[libc] Make string tests compatible with the Fuchsia build

Some test code was doing loose conversions caught by compiler
warnings in  the Fuchsia build.  This included duplicated code
in a few tests that was reconsolidated with the existing header
file copy of the same functions.

The MemoryMatcher abstraction presumes gtest-style matcher support,
which is not available in Fuchsia's zxtest library.  It's avoided
in favor of simpler memory-comparing assertions.

Reviewed By: abrachet

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

16 months ago[SimpleLoopUnswitch] Skip non-trivial unswitching of cold loop nests
Teresa Johnson [Sun, 19 Mar 2023 15:45:28 +0000 (08:45 -0700)]
[SimpleLoopUnswitch] Skip non-trivial unswitching of cold loop nests

This fixes a compile time issue due to guarding loop unswitching based
on whether the enclosing function is cold. That approach is very
inefficient in the case of large cold functions that contain numerous
loops, since the loop pass calls isFunctionColdInCallGraph once per
loop, and that function walks all BBs in the function (twice for Sample
PGO) looking for any non-cold blocks.

Originally, this code only checked if the current Loop's header was cold
(D129599). However, that apparently caused a slowdown on a SPEC
benchmark, and the example given was that of a cold inner loop nested in
a non-cold outer loop (see comments in D129599). The fix was to check if
the whole function is cold, done in D133275.

This is overkill, and we can simply check if the header of any loop in
the current loop's loop nest is non-cold (looking at both outer and
inner loops). This patch drops the compile time for a large module by
40% with this approach.

I also updated PGO-nontrivial-unswitch2.ll since it only had one cold
loop in a non-cold function, so that it instead had IR based off the
example given in the comments relating to the SPEC degradation in
D129599. I confirmed that the new version of the test fails with the
original check done in D129599 of only the current loop's header
coldness.

Similarly updated test PGO-nontrivial-unswitch.ll to contain a cold loop
in a cold loop nest, and created PGO-nontrivial-unswitch3.ll to contain
a non-cold loop in a non-cold loop nest.

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

16 months ago[RISCV] Make Zfh PseudoQuietFCMP definitions predicated on HasStdExtZfh
Alex Bradbury [Mon, 20 Mar 2023 17:05:48 +0000 (17:05 +0000)]
[RISCV] Make Zfh PseudoQuietFCMP definitions predicated on HasStdExtZfh

These are currently in a `Predicates = [HasStdExtZfhOrZfhmin]` block,
but Zfhmin has no fcmp instructions so the definition makes no sense for
Zfhmin.

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

16 months ago[Libomptarget] Add missing explicit moves on llvm::Error
Joseph Huber [Mon, 20 Mar 2023 17:00:01 +0000 (12:00 -0500)]
[Libomptarget] Add missing explicit moves on llvm::Error

Summary:
Some older compilers, which we still support, have problems handling the
copy elision that allows us to directly move an `Error` to an
`Expected`. This patch adds explicit moves to remove the error. Same as
last patch but I forgot this one.

16 months ago[Libomptarget] Add missing explicit moves on llvm::Error
Joseph Huber [Mon, 20 Mar 2023 16:49:10 +0000 (11:49 -0500)]
[Libomptarget] Add missing explicit moves on llvm::Error

Summary:
Some older compilers, which we still support, have problems handling the
copy elision that allows us to directly move an `Error` to an
`Expected`. This patch adds explicit moves to remove the error.

16 months ago[LSR] Regen tests to adjust for naming in SCEVExpander [nfc]
Philip Reames [Mon, 20 Mar 2023 16:34:57 +0000 (09:34 -0700)]
[LSR] Regen tests to adjust for naming in SCEVExpander [nfc]

16 months ago[AArch64] Regenerate neon-vcmla.ll tests and add tests for combining fadd with vcmla...
David Green [Mon, 20 Mar 2023 16:29:28 +0000 (16:29 +0000)]
[AArch64] Regenerate neon-vcmla.ll tests and add tests for combining fadd with vcmla. NFC

See D146407.

16 months ago[Internalize] Don't claim to preserve CallGraph
Arthur Eubanks [Mon, 20 Mar 2023 16:25:47 +0000 (09:25 -0700)]
[Internalize] Don't claim to preserve CallGraph

Follow up to c41c336ee065a

16 months ago[Internalize] Remove interaction with CallGraph
Arthur Eubanks [Mon, 20 Mar 2023 16:24:11 +0000 (09:24 -0700)]
[Internalize] Remove interaction with CallGraph

Internalize was trying to update CallGraph if the analysis was available, but the new PM doesn't really use it so there's little reason to update it.

16 months ago[mlir][nfc] Fix syntax to conform with the C++20 restrictions on error-prone redundancy
Eric Schweitz [Mon, 20 Mar 2023 15:10:26 +0000 (08:10 -0700)]
[mlir][nfc] Fix syntax to conform with the C++20 restrictions on error-prone redundancy

See: http://eel.is/c++draft/diff.cpp17.class#2

Reviewed By: springerm

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

16 months ago[LSR/LFTR] Move two utilities to common code for reuse [nfc]
Philip Reames [Mon, 20 Mar 2023 15:44:15 +0000 (08:44 -0700)]
[LSR/LFTR] Move two utilities to common code for reuse [nfc]

We're working on a transform in LSR which is essentiall an inverse of LFTR (in certain sub-cases).  Move utilties so that they can be reused.

16 months ago[clang][ExtractAPI] Add semicolons for enum, typedef, struct declaration fragments
NagaChaitanya Vellanki [Mon, 20 Mar 2023 15:42:04 +0000 (15:42 +0000)]
[clang][ExtractAPI] Add semicolons for enum, typedef, struct declaration fragments

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

Reviewed By: dang

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

16 months agoReland "[LSAN][HWASAN] Turn on leak sanitizer in HWASAN for Linux"
Kirill Stoimenov [Mon, 20 Mar 2023 15:41:05 +0000 (15:41 +0000)]
Reland "[LSAN][HWASAN] Turn on leak sanitizer in HWASAN for Linux"

This reverts commit 35c05f04e547100d03b6359d1f66950ff83350e0.

16 months agoRevert "[clang][ASTImport] Add support for import of empty records"
Pavel Kosov [Mon, 20 Mar 2023 15:20:41 +0000 (18:20 +0300)]
Revert "[clang][ASTImport] Add support for import of empty records"

This reverts commit 21cd04c46fe0a2bee224899f56518a09bce5306e.

16 months ago[x86][MemFold] Fix anon namespace in header
Felipe de Azevedo Piovezan [Mon, 20 Mar 2023 12:51:04 +0000 (08:51 -0400)]
[x86][MemFold] Fix anon namespace in header

D142084 moved an enumeration inside a header from the llvm namespace
into an anon namespace. Some of the bots started failing as a result.

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

16 months ago[mlir] Support bufferization of arith.constant to memref.global with memory space
Maya Amrami [Sun, 19 Mar 2023 14:28:23 +0000 (16:28 +0200)]
[mlir] Support bufferization of arith.constant to memref.global with memory space

Reviewed By: springerm

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

16 months ago[Flang] [PowerPC] Implement remaining PPC math operation intrinsics that do not requi...
Paul Scoropan [Wed, 15 Mar 2023 14:43:06 +0000 (14:43 +0000)]
[Flang] [PowerPC] Implement remaining PPC math operation intrinsics that do not require semantic error checks

This review implements the following PowerPC math operations that we care about:
- fnabs
- fre
- fres
- frsqrte
- frsqrtes

None of these intrinsics require additional error checks in semantics. The interfaces handle checking types and kinds

Reviewed By: kkwli0

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

16 months ago[IRSim] Ensure that assignment accurately reduces potential mapping between different...
Andrew Litteken [Tue, 13 Dec 2022 05:51:11 +0000 (23:51 -0600)]
[IRSim] Ensure that assignment accurately reduces potential mapping between different candidates

Previous:
When we do not make decisions about commutative operands, we can end up in a situation where two values have two potential canonical numbers between two regions. This ensures that an ordering is decided after the initial structure between two regions is determined.

Current:
Previously the outliner only checked that assignment to a value matched what was already known, this patch makes sure that it matches what has already been found, and creates a mapping between the two values where it is a one-to-one mapping.

Reviewer: paquette
Differential Revision: https://reviews.llvm.org/D139336

16 months ago[clang][ASTImport] Add support for import of empty records
Pavel Kosov [Mon, 20 Mar 2023 14:24:12 +0000 (17:24 +0300)]
[clang][ASTImport] Add support for import of empty records

Patch represents the clang part of changes in D143347

Reviewed By: balazske

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

16 months ago[libc][NFC] Add some missing comments to the RPC implementation
Joseph Huber [Mon, 20 Mar 2023 14:29:43 +0000 (09:29 -0500)]
[libc][NFC] Add some missing comments to the RPC implementation

Summary:
These comments were accidentally dropped from the committed version. Add
them back in.

16 months ago[mlir][Bazel] Adjust BUILD file for 930744fcdad7b326dd0337622b6e8dc99efcfa60
Adrian Kuegel [Mon, 20 Mar 2023 14:10:12 +0000 (15:10 +0100)]
[mlir][Bazel] Adjust BUILD file for 930744fcdad7b326dd0337622b6e8dc99efcfa60

16 months agoRevert "[mlir][Linalg][Transform] Avoid FunctionalStyleTransformOpTrait where unneces...
Nicolas Vasilache [Mon, 20 Mar 2023 14:06:57 +0000 (07:06 -0700)]
Revert "[mlir][Linalg][Transform] Avoid FunctionalStyleTransformOpTrait where unnecesseary to improve usability"

This reverts commit 31aa8ea252c0b6acdcb362c1d0f01cc4b810d6d0.

This is currently not in a good state as we have some footguns due to missing listeners.

16 months ago[clangd] Fix AddUsing in the face of typo-correction
Kadir Cetinkaya [Mon, 20 Mar 2023 11:12:10 +0000 (12:12 +0100)]
[clangd] Fix AddUsing in the face of typo-correction

Fixes https://github.com/clangd/clangd/issues/559

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

16 months agoFix MLIR build with shared library enabled
Mehdi Amini [Mon, 20 Mar 2023 13:03:32 +0000 (14:03 +0100)]
Fix MLIR build with shared library enabled

Broken by f406adf134c2f

16 months ago[libcxxabi] Fix for c9d36bd80760db14f14b33789e6cbc6cb8c64830
Dmitry Chernenkov [Mon, 20 Mar 2023 12:59:05 +0000 (12:59 +0000)]
[libcxxabi] Fix for c9d36bd80760db14f14b33789e6cbc6cb8c64830

Otherwise fails with LIBCPP_REMOVE_TRANSITIVE_INCLUDES

16 months agoAdd capture of "IRUnits" as context for an MLIR Action
Mehdi Amini [Mon, 20 Mar 2023 12:40:37 +0000 (13:40 +0100)]
Add capture of "IRUnits" as context for an MLIR Action

IRUnit is defined as:

  using IRUnit = PointerUnion<Operation *, Region *, Block *, Value>;

The tracing::Action is extended to take an ArrayRef<IRUnit> as context to
describe an Action. It is demonstrated in the "ActionLogging" observer.

Reviewed By: rriddle, Mogball

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

16 months agoAdd a `skipRegion()` feature to the OpPrintingFlags for MLIR ASM printer
Mehdi Amini [Mon, 13 Mar 2023 13:33:31 +0000 (14:33 +0100)]
Add a `skipRegion()` feature to the OpPrintingFlags for MLIR ASM printer

This is a convenient flag for context where we intend to summarize a top-level
operation without the full-blown regions it may hold.

Reviewed By: rriddle

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

16 months agoAdd an Observer for logging actions application to a stream
Mehdi Amini [Mon, 20 Mar 2023 11:56:30 +0000 (12:56 +0100)]
Add an Observer for logging actions application to a stream

Integrate the `tracing::ExecutionContext()` into mlir-opt with a new
--log-action-to=<file> option to demonstrate the feature.

Reviewed By: rriddle

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

16 months ago[mlir][Transform] Fix support for mapping to GPU warps and to linear ids
Nicolas Vasilache [Mon, 20 Mar 2023 12:17:39 +0000 (05:17 -0700)]
[mlir][Transform] Fix support for mapping to GPU warps and to linear ids

c59465e1203dd78d06e15f7ddf62141807dbd5a7 introduced mapping to warps and
linear GPU ids.

In the implementation, the delinearization basis is reversed from [x, y, z]
to [z, y x] order to properly compute the strides and allow delinearization.

Prior to this commit, we forgot to reverse it back to [x, y, z] order
before materializing the indices.

Fix this oversight.

16 months ago[lldb] Implement CrashReason using UnixSignals
David Spickett [Tue, 14 Mar 2023 11:52:36 +0000 (11:52 +0000)]
[lldb] Implement CrashReason using UnixSignals

By adding signal codes to UnixSignals and adding a new function
where you can get a string with optional address and bounds.

Added signal codes to the Linux, FreeBSD and NetBSD signal sets.
I've checked the numbers against the relevant sources.

Each signal code has a code number, description and printing options.
By default you just get the descripton, you can opt into adding either
a fault address or bounds information.

Bounds signals we'll use the description, unless we have the bounds
values in which case we say whether it is an upper or lower bound
issue.

GetCrashReasonString remains in CrashReason because we need it to
be compiled only for platforms with siginfo_t. Ideally it would
move into NativeProcessProtocol, but that is also used
by NativeRegisterContextWindows, where there would be no siginfo_t.

Reviewed By: JDevlieghere

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

16 months ago[DAG] visitTRUNCATE - use FoldConstantArithmetic to perform constant folding.
Simon Pilgrim [Mon, 20 Mar 2023 11:06:47 +0000 (11:06 +0000)]
[DAG] visitTRUNCATE - use FoldConstantArithmetic to perform constant folding.

Avoid needing to perform extra isConstantIntBuildVectorOrConstantInt checks

16 months ago[DAG] foldBinOpIntoSelect - remove !CanFoldNonConst check. NFC.
Simon Pilgrim [Mon, 20 Mar 2023 10:20:44 +0000 (10:20 +0000)]
[DAG] foldBinOpIntoSelect - remove !CanFoldNonConst check. NFC.

These checks are in an if-else chain where CanFoldNonConst is already guaranteed to be false.

16 months ago[llvm][Demangle][NFC] Fix demangle to work with LIBCPP_REMOVE_TRANSITIVE_INCLUDES
Dmitry Chernenkov [Mon, 20 Mar 2023 11:05:55 +0000 (11:05 +0000)]
[llvm][Demangle][NFC] Fix demangle to work with LIBCPP_REMOVE_TRANSITIVE_INCLUDES

16 months ago[NFC] Regenerate test file InstCombine/bit-checks.ll
luxufan [Mon, 20 Mar 2023 11:03:18 +0000 (19:03 +0800)]
[NFC] Regenerate test file InstCombine/bit-checks.ll

16 months ago[LSR] Fold terminating condition not only for eq and ne.
Mark Goncharov [Mon, 20 Mar 2023 10:42:24 +0000 (13:42 +0300)]
[LSR] Fold terminating condition not only for eq and ne.

Add opportunity to fold any icmp instruction.

16 months agoRevert "[JITLink][ELF] Don't skip debug info sections by default."
Muhammad Omair Javaid [Mon, 20 Mar 2023 10:32:21 +0000 (15:32 +0500)]
Revert "[JITLink][ELF] Don't skip debug info sections by default."

This reverts commit 57aeb305460406f7b822cfe6ab9fb4d730fc3b38.
Breaks buildbot https://lab.llvm.org/buildbot/#/builders/197/builds/4272

16 months agoRevert "Revert "[SVE] Add patterns for shift intrinsics with FalseLanesZero mode""
Muhammad Omair Javaid [Mon, 20 Mar 2023 10:15:36 +0000 (15:15 +0500)]
Revert "Revert "[SVE] Add patterns for shift intrinsics with FalseLanesZero mode""

This reverts commit 32bd1f562f835044d11b7ecfb36362a29eb00a02.

16 months ago[mlir][Linalg][Transform] Avoid FunctionalStyleTransformOpTrait where unnecesseary...
Nicolas Vasilache [Mon, 20 Mar 2023 09:02:23 +0000 (02:02 -0700)]
[mlir][Linalg][Transform] Avoid FunctionalStyleTransformOpTrait where unnecesseary to improve usability

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

16 months ago[gn build] Port 28997feb0c3a
LLVM GN Syncbot [Mon, 20 Mar 2023 10:07:45 +0000 (10:07 +0000)]
[gn build] Port 28997feb0c3a

16 months ago[SCEV] Preserve divisibility and min/max information in applyLoopGuards
Alon Kom [Tue, 31 Jan 2023 08:21:53 +0000 (10:21 +0200)]
[SCEV] Preserve divisibility and min/max information in applyLoopGuards

applyLoopGuards doesn't always preserve information when there are multiple assumes.

This patch tries to deal with multiple assumes regarding a SCEV's divisibility and min/max values, and rewrite it into a SCEV that still preserves all of the information.
For example, let the trip count of the loop be TC. Consider the 3 following assumes:

1. __builtin_assume(TC % 8 == 0);
2. __builtin_assume(TC > 0);
3. __builtin_assume(TC < 100);

Before this patch, depending on the assume processing order applyLoopGuards could create the following SCEV:
max(min((8 * (TC / 8)) , 99), 1)

Looking at this SCEV, it doesn't preserve the divisibility by 8 information.

After this patch, depending on the assume processing order applyLoopGuards could create the following SCEV:
max(min((8 * (TC / 8)) , 96), 8)

By aligning up 1 to 8, and aligning down 99 to 96, the new SCEV still preserves all of the original assumes.

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

16 months agoReland [clang-format] Add a space between an overloaded operator and '>'
Owen Pan [Fri, 10 Feb 2023 16:50:49 +0000 (08:50 -0800)]
Reland [clang-format] Add a space between an overloaded operator and '>'

The token annotator doesn't annotate the template opener and closer
as such if they enclose an overloaded operator. This causes the
space between the operator and the closer to be removed, resulting
in invalid C++ code.

Fixes #58602.

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

16 months ago[LLVM][OHOS] Clang toolchain and targets
Pavel Kosov [Mon, 20 Mar 2023 09:48:45 +0000 (12:48 +0300)]
[LLVM][OHOS] Clang toolchain and targets

Add a clang part of OpenHarmony target

Related LLVM part: D138202

~~~

Huawei RRI, OS Lab

Reviewed By: DavidSpickett

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

16 months ago[mlir][Bazel] Avoid __attribute__((weak)) for MSVC.
Adrian Kuegel [Mon, 20 Mar 2023 07:28:48 +0000 (08:28 +0100)]
[mlir][Bazel] Avoid __attribute__((weak)) for MSVC.

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

16 months ago[mlir] Apply ClangTidy performance finding (NFC).
Adrian Kuegel [Mon, 20 Mar 2023 09:14:02 +0000 (10:14 +0100)]
[mlir] Apply ClangTidy performance finding (NFC).

16 months ago[flang] Update allocate lowering to use AllocatableInit.*ForAllocate functions
Valentin Clement [Mon, 20 Mar 2023 09:01:01 +0000 (10:01 +0100)]
[flang] Update allocate lowering to use AllocatableInit.*ForAllocate functions

Update lowering of allocate statement to use the new
functions defined in D146290.

Depends on D146290

Reviewed By: PeteSteinfeld

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

16 months ago[flang] Add AllocatableInit functions for use in allocate lowering
Valentin Clement [Mon, 20 Mar 2023 09:00:08 +0000 (10:00 +0100)]
[flang] Add AllocatableInit functions for use in allocate lowering

`AllocatableInitIntrinsic`, `AllocatableInitCharacter` and
`AllocatableInitDerived` are meant to be used to initialize a
descriptor when it is instantiated and not to be used multiple
times in a scope.
Add `AllocatableInitDerivedForAllocate`, `AllocatableInitCharacterForAllocate`
and `AllocatableInitDerivedForAllocate` to be used for the allocation
in allocate statement.
These new functions are meant to be used on an initialized descriptor
and will return directly if the descriptor is allocated so the
error handling is done by the call to `AllocatableAllocate`.

Reviewed By: PeteSteinfeld

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

16 months ago[mlir][Bazel] Add missing dependencies.
Adrian Kuegel [Mon, 20 Mar 2023 08:28:25 +0000 (09:28 +0100)]
[mlir][Bazel] Add missing dependencies.

16 months agoRevert "[AsmParser] Avoid instantiating LLVMContext if not needed. NFC"
Yevgeny Rouban [Mon, 20 Mar 2023 08:04:21 +0000 (15:04 +0700)]
Revert "[AsmParser] Avoid instantiating LLVMContext if not needed. NFC"

This reverts commit c1888a370ada6e76d51cdb9c6eeefa2588a475eb
because of massive buildbolt failures.

16 months ago[mlir][Transform] Add support for mapping to GPU warps and to linear ids
Nicolas Vasilache [Mon, 20 Mar 2023 06:46:11 +0000 (23:46 -0700)]
[mlir][Transform] Add support for mapping to GPU warps and to linear ids

This revisions refactors the implementation of mapping to threads to additionally allow warps and linear ids to be specified.

`warp_dims` is currently specified along with `block_dims` as a transform attribute.

Linear ids on th other hand use the flattened block_dims to predicate on the first (linearized) k threads.
An additional GPULinearIdMappingAttr is added to the GPU dialect to allow specifying loops mapped to this new scheme.

Various implementation and transform op semantics cleanups are also applied.

Reviewed By: ThomasRaoux

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

16 months ago[AsmParser] Avoid instantiating LLVMContext if not needed. NFC
Yevgeny Rouban [Mon, 20 Mar 2023 07:54:10 +0000 (14:54 +0700)]
[AsmParser] Avoid instantiating LLVMContext if not needed. NFC

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

16 months agoRevert "[SVE] Add patterns for shift intrinsics with FalseLanesZero mode"
Muhammad Omair Javaid [Mon, 20 Mar 2023 07:38:38 +0000 (12:38 +0500)]
Revert "[SVE] Add patterns for shift intrinsics with FalseLanesZero mode"

This reverts commit 22c3ba4bb519e12395c676ffe436ea4b8400234a.

Breaks buildbot https://lab.llvm.org/buildbot/#/builders/197/builds/4272

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

16 months agoRevert "[clang-format] Add a space between an overloaded operator and '>'"
Kadir Cetinkaya [Mon, 20 Mar 2023 06:51:49 +0000 (07:51 +0100)]
Revert "[clang-format] Add a space between an overloaded operator and '>'"

This reverts commit b05dc1b8766a47482cae432011fd2faa04c83a3e.

Makes clang-format crash on `struct Foo { operator enum foo{} };`

16 months ago[RFC][X86][MemFold] Upgrade the mechanism of auto-generated Memory Folding Table
Bing1 Yu [Mon, 20 Mar 2023 05:48:01 +0000 (13:48 +0800)]
[RFC][X86][MemFold] Upgrade the mechanism of auto-generated Memory Folding Table

1. Align ManualMapSet with X86MemoryFoldTableEntry instead of using UnfoldStrategy
2. ManualMapSet able to update the existing record in auto-generated MemFold table

Reviewed By: skan

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

16 months ago[GuardWidening] Improve analysis of potential widening into hotter block
Max Kazantsev [Mon, 20 Mar 2023 05:38:37 +0000 (12:38 +0700)]
[GuardWidening] Improve analysis of potential widening into hotter block

There is a piece of logic in GuardWidening which is very limited, and it happens
to ignore implicit control flow, therefore it "works fine" with guards expressed as
intrinsic calls. However, when the guards are represented as branches, its limitations
create a lot of trouble.

The intent here is to make sure that we do not widen code across complex CFG,
so that it can end up being in hotter code than it used to be. The old logic was limited
to unique immediate successor and that's it.

This patch changes the logic there to work the following way: when we need to check
if we can widen from `DominatedBlock` into `DominatingBlock`, we first try to find the
lowest (by CFG) transitive successor  of `DominatingBlock` which is guaranteed to not
be significantly colder than the `DominatingBlock`. It means that every time we move
to either:

- Unique successor of the current block, if it only has one successor;
- The only taken successor, if the current block ends with `br(const)`;
- If one of successors ends with deopt, another one is taken;

If the lowest block we can find this way is the `DominatedBlock`, then it is safe to assume
that this widening won't move the code into a hotter location.

I did not touch the existing check with PDT. It looks fishy to me (post-dominance doesn't
really guarantee anything about hotness), but let's keep it as is and maybe fix later.

With this patch, Guard Widening can widen explicitly expressed branches across more than one
dominating guard if it's profitable.

Differential Revision: https://reviews.llvm.org/D146276
Reviewed By: skatkov

16 months ago[LICM] Do not hoist widenable conditions
Max Kazantsev [Mon, 20 Mar 2023 05:02:22 +0000 (12:02 +0700)]
[LICM] Do not hoist widenable conditions

Despite the fact that it is legal, it is not profitable. It may prevent
Loop Guard Widening to happen. Because of bug described at
https://github.com/llvm/llvm-project/issues/60234, now the guard widening is
only possible when condtion we want to add is available at the point of the
widenable_condition() of dominating guard. It means that, if all such calls are
hoisted out of loop, and the loop conditions depend on loop-variants, we cannot
widen. Hoisting is otherwise not helpful, because it does not introduce any
optimization opportunities.

Differential Revision: https://reviews.llvm.org/D146274
Reviewed By: apilipenko

16 months ago[AMDGPU] Add release note for ommited barrier waitcnt
Austin Kerbow [Sat, 18 Mar 2023 06:39:25 +0000 (23:39 -0700)]
[AMDGPU] Add release note for ommited barrier waitcnt

Reviewed By: arsenm

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

16 months ago[NFC] [C++20] [Modules] Add test for #pragma once
Chuanqi Xu [Mon, 20 Mar 2023 03:37:06 +0000 (11:37 +0800)]
[NFC] [C++20] [Modules] Add test for #pragma once

Close https://github.com/llvm/llvm-project/issues/38554
Close https://github.com/llvm/llvm-project/issues/58532

It looks like we can workaround the '#pragma once' problem automatically
after we force the lazily loading for named modules. Add a test to show
this.

16 months ago[ORC] Use ExecutorAddr instead of JITTargetAddress in JITDylib symbol table.
Lang Hames [Mon, 20 Mar 2023 00:31:52 +0000 (17:31 -0700)]
[ORC] Use ExecutorAddr instead of JITTargetAddress in JITDylib symbol table.

Update JITDylib's symbol table entry struct to use the newer ExecutorAddr type.

16 months ago[IRSim] Treat Branch OperVals different from regular operands to ensure correct ordering
Andrew Litteken [Sun, 2 Oct 2022 17:33:03 +0000 (12:33 -0500)]
[IRSim] Treat Branch OperVals different from regular operands to ensure correct ordering

Branch operands are different from regular instructions. They can have a mix of boolean values and branch instructions. This makes sure that branches are treated as more of a special case and makes sure that the successor blocks are always in the same order, and that they do not include the conditional argument.

Reviewer: paquette
Differential Revision: https://reviews.llvm.org/D139337

16 months ago[CGSCC] Allow creation of no-rerun CGSCC->function adaptor via textual pipeline
Arthur Eubanks [Thu, 2 Mar 2023 22:47:46 +0000 (14:47 -0800)]
[CGSCC] Allow creation of no-rerun CGSCC->function adaptor via textual pipeline

Reviewed By: asbirlea

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

16 months agoRevert "[ORC] Introduce SetUpExecutorNativePlatform utility."
Lang Hames [Sun, 19 Mar 2023 22:50:44 +0000 (15:50 -0700)]
Revert "[ORC] Introduce SetUpExecutorNativePlatform utility."

This reverts commit bdf5f9c3228d6ed1d7c6f87b3828a7d573b34c03, which was a work
in progress for https://reviews.llvm.org/D144276 and accidentally committed
early.

16 months agoRevert "[SimplifyCFG] Check if the return instruction causes undefined behavior"
DianQK [Sun, 19 Mar 2023 22:42:19 +0000 (06:42 +0800)]
Revert "[SimplifyCFG] Check if the return instruction causes undefined behavior"

This reverts commit b6a0be8ce3114d0c57e7a7d6c3c222986ca506ad.

16 months agoRevert "[SimplifyCFG] Improve the precision of `PtrValueMayBeModified`"
DianQK [Sun, 19 Mar 2023 22:42:07 +0000 (06:42 +0800)]
Revert "[SimplifyCFG] Improve the precision of `PtrValueMayBeModified`"

This reverts commit f890f010f6a70addbd885acd0c8d1b9578b6246f.

16 months ago[ORC] Introduce SetUpExecutorNativePlatform utility.
Lang Hames [Sun, 19 Mar 2023 22:27:46 +0000 (15:27 -0700)]
[ORC] Introduce SetUpExecutorNativePlatform utility.

Simplifies the process of building an LLJIT instance that supports the native
platform features (initializers, TLV, etc.).

SetUpExecutorNativePlatform can be passed to LLJITBuilder::setPlatformSetUp
method. It takes a reference to the ORC runtime (as a path or an in-memory
archive) and automatically sets the platform for LLJIT's ExecutionSession based
on the executor process's triple.

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

16 months agollvm/test/TableGen/intrinsic-*.td: Use Intrinsics.td instead of mock
NAKAMURA Takumi [Tue, 14 Mar 2023 13:37:08 +0000 (22:37 +0900)]
llvm/test/TableGen/intrinsic-*.td: Use Intrinsics.td instead of mock

- `intrinsic-pointer-to-any.td`
- `intrinsic-varargs.td`

They used their own mock.

I have introduced `TEST_INTRINSICS_SUPPRESS_DEFS` in `Intrinsics.td`.
Tests of intrinsics may use it.

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

16 months ago[clang-format] Fix non-case colons in Verilog case lines
sstwcw [Sun, 19 Mar 2023 21:32:44 +0000 (21:32 +0000)]
[clang-format] Fix non-case colons in Verilog case lines

Back in D128714, we should have replaced the old rule about colons when
we added the new one.  Because we didn't, all colons got mistaken as
case colons as long as the line began with `case` or `default`.  Now we
remove the rule that we forgot to remove.

Reviewed By: MyDeveloperDay, rymiel

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

16 months ago[GlobalOpt] Collect initializer when building GlobalPart.
Florian Hahn [Sun, 19 Mar 2023 20:47:59 +0000 (20:47 +0000)]
[GlobalOpt] Collect initializer when building GlobalPart.

Update the code to collect the initializer when collecting the types for
a global, as suggested by @nikic in D144476.

This replaces code which bailed out if *any* part doesn't have an
initializer with a continue to just skip parts which don't have an
initializer.

Depends on D145489.

Reviewed By: nikic

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

16 months ago[InstCombine] Precommit tests
Kazu Hirata [Sun, 19 Mar 2023 20:44:43 +0000 (13:44 -0700)]
[InstCombine] Precommit tests

This patch precommits tests for:

https://github.com/llvm/llvm-project/issues/60802

16 months ago[libc++] Change linkage for some functions.
Mark de Wever [Sun, 19 Mar 2023 17:06:47 +0000 (18:06 +0100)]
[libc++] Change linkage for some functions.

Internal linkages fails when building libc++ with modules. Using
internal linkage is headers seems questionable to change the linkage.

Reviewed By: #libc, philnik

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

16 months ago[libc++] Assert that lengths fit in difference_type
David Benjamin [Sun, 19 Mar 2023 17:41:04 +0000 (18:41 +0100)]
[libc++] Assert that lengths fit in difference_type

This can help flag accidentally passing in negative values into the  `string_view` constructor. This aligns with a similar check in `absl::string_view`.

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

Reviewed By: #libc, Mordante

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

16 months ago[libc++][test] Adds a missing include.
Mark de Wever [Sun, 19 Mar 2023 17:03:25 +0000 (18:03 +0100)]
[libc++][test] Adds a missing include.

16 months ago[libc++] Inline small constructors into basic_string
Nikolas Klauser [Wed, 22 Feb 2023 19:11:03 +0000 (20:11 +0100)]
[libc++] Inline small constructors into basic_string

This allows the compiler to inline the constructors.

Reviewed By: ldionne, #libc

Spies: mikhail.ramalho, libcxx-commits

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

16 months ago[C++2x][Modules] Amend module purview constant linkage [P2788R0].
Iain Sandoe [Sun, 12 Mar 2023 20:45:26 +0000 (20:45 +0000)]
[C++2x][Modules] Amend module purview constant linkage [P2788R0].

This paper has been applied to the working draft and is believed to be
a DR against C++20, so that the patch here makes the change unconditionally.

for:
```
export module A;

const int mod_cst = 10;
```
Before the change, mod_cst would have internal linkage; after the change it
has module linkage.

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

16 months ago[Flang][RISCV] Fix 9f93b71f20ea
Shao-Ce SUN [Sun, 19 Mar 2023 15:25:52 +0000 (23:25 +0800)]
[Flang][RISCV] Fix 9f93b71f20ea

16 months ago[libc++][NFC] Clean up the ABI changelog
Louis Dionne [Sun, 19 Mar 2023 14:35:20 +0000 (10:35 -0400)]
[libc++][NFC] Clean up the ABI changelog

Fix a few typos and remove TODOs

16 months ago[libc++][Apple] Update availability markup for std::to_chars(floating-point)
Louis Dionne [Sat, 18 Mar 2023 20:46:54 +0000 (16:46 -0400)]
[libc++][Apple] Update availability markup for std::to_chars(floating-point)

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

16 months ago[libc++] Remove C++03 extensions for std::allocator_arg & friends
Louis Dionne [Mon, 6 Mar 2023 20:43:26 +0000 (15:43 -0500)]
[libc++] Remove C++03 extensions for std::allocator_arg & friends

As explained in the release note, libc++ used to provide various
global variables as an extension in C++03 mode. Unfortunately, that
made our definition non-conforming in all standard modes. This was
never a big problem until recently, since we are trying to support
C++20 Modules in libc++, and that requires cleaning up the definition
of these variables.

This change is the first in a series of changes to achieve our end goal.
This patch removes the ability for users to rely on the (incorrect)
definition of those global variables inside the shared library. The
plan is to then remove those definitions from the shared library
(which is an ABI break but I don't think it will have impact), and
finally to make our definition of those variables conforming in all
standard modes.

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

16 months ago[sancov] fix coverage-report-server cannot display coverage detail
Congcong Cai [Sun, 19 Mar 2023 13:08:37 +0000 (21:08 +0800)]
[sancov] fix coverage-report-server cannot display coverage detail

This patch make following change for coverage-report-server.py
- using uri `./{name}` from root in the old version python http.server can be handled as `//{name}`. But due to https://github.com/python/cpython/pull/93879, it will be handled as `/{name}` now.

So I want to use a prefix to avoid double slashes issue.

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

16 months ago[runtimes] Don't use -Wall on clang-cl builds
Nikolas Klauser [Sun, 19 Mar 2023 09:15:14 +0000 (10:15 +0100)]
[runtimes] Don't use -Wall on clang-cl builds

`-Wall` on clang-cl is equivalent to `-Weverything` on clang. We already add the correct warning flag depending whether we are in an MSVC-like environment, so just remove it from the list of flags that get passed unconditionally.

Spies: libcxx-commits

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

16 months ago[libcxxabi][Demangle] Don't drop ctor/dtor name for abi-tagged structures
Michael Buch [Tue, 7 Mar 2023 13:18:07 +0000 (13:18 +0000)]
[libcxxabi][Demangle] Don't drop ctor/dtor name for abi-tagged structures

Before this patch we would demangle abi-tagged structures as follows:
```
$ c++filt -n _ZN1SB5OuterC2Ev
S[abi:Outer]:()

$ c++filt -n _ZN1SB5OuterD2Ev
S[abi:Outer]::~()
```

This is because `Node::getBaseName` was unimplemented for the
`AbiTagAttr` node, which meant that when we tried printing `CtorDtorName`
where its `Basename` `Node` was an `AbiTagAttr`, we'd drop the
name.

Addresses https://github.com/llvm/llvm-project/issues/61213

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

16 months ago[llvm][Demangle][NFC] Sync latest libcxxabi/demangle
Michael Buch [Thu, 9 Mar 2023 16:10:00 +0000 (16:10 +0000)]
[llvm][Demangle][NFC] Sync latest libcxxabi/demangle

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

16 months ago[libc++] Granularize <exception> includes
Nikolas Klauser [Wed, 1 Mar 2023 19:49:22 +0000 (20:49 +0100)]
[libc++] Granularize <exception> includes

Reviewed By: ldionne, #libc

Spies: mikhail.ramalho, smeenai, libcxx-commits

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

16 months ago[libc++][NFC] Refactor the __enable_ifs in <string>
Nikolas Klauser [Wed, 22 Feb 2023 17:01:23 +0000 (18:01 +0100)]
[libc++][NFC] Refactor the __enable_ifs in <string>

This changes all `__enable_if`s inside `<string>` to a common pattern. Specifically, it's always inside the `template <>` and uses the `, int> = 0` style.

Reviewed By: ldionne, #libc

Spies: mikhail.ramalho, EricWF, libcxx-commits

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

16 months ago[libc++abi] Improve performance of __dynamic_cast
Sirui Mu [Sun, 19 Mar 2023 09:03:38 +0000 (10:03 +0100)]
[libc++abi] Improve performance of __dynamic_cast

The original `__dynamic_cast` implementation does not use the ABI-provided `src2dst_offset` parameter which helps improve performance on the hot paths. This patch improves the performance on the hot paths in `__dynamic_cast` by leveraging hints provided by the `src2dst_offset` parameter. This patch also includes a performance benchmark suite for the `__dynamic_cast` implementation.

Reviewed By: philnik, ldionne, #libc, #libc_abi, avogelsgesang

Spies: mikhail.ramalho, avogelsgesang, xingxue, libcxx-commits

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

16 months ago[compiler-rt] Add missing #else clause to fix the build on NetBSD.
Frederic Cambus [Sun, 19 Mar 2023 08:44:55 +0000 (09:44 +0100)]
[compiler-rt] Add missing #else clause to fix the build on NetBSD.

An #elif SANITIZER_SOLARIS clause was removed in D120048, but it also
removed the #else clause for the error fallback, causing the build to
fail on NetBSD.

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

16 months ago[clangd] Fix test failure in SemanticHighlighting.GetsCorrectTokens
Nathan Ridge [Sun, 19 Mar 2023 08:43:24 +0000 (04:43 -0400)]
[clangd] Fix test failure in SemanticHighlighting.GetsCorrectTokens

16 months ago[clangd] Avoid recursion on UnresolvedUsingValueDecl during semantic highlighting
Nathan Ridge [Wed, 28 Sep 2022 19:57:56 +0000 (09:57 -1000)]
[clangd] Avoid recursion on UnresolvedUsingValueDecl during semantic highlighting

Fixes https://github.com/clangd/clangd/issues/1313

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

16 months ago[Sanitizer] [Scudo] Add riscv64 support for scudo
Jun Sha (Joshua) [Sun, 19 Mar 2023 06:37:46 +0000 (23:37 -0700)]
[Sanitizer] [Scudo] Add riscv64 support for scudo

Enable Scudo on RISCV64 on both clang side and compiler-rt side.

Reviewers: cryptoad, eugenis, vitalybuka, luismarques, hiraditya

Reviewed By: vitalybuka, luismarques
Differential Revision: https://reviews.llvm.org/D137397