Commit Graph

455385 Commits

Author SHA1 Message Date
Teresa Johnson
dfb40d3fd7 [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
2023-03-20 10:14:50 -07:00
Alex Bradbury
34f1da3468 [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
2023-03-20 17:05:48 +00:00
Joseph Huber
ad9f751a6e [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.
2023-03-20 12:00:01 -05:00
Joseph Huber
edc0355006 [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.
2023-03-20 11:49:59 -05:00
Philip Reames
67089a39a2 [LSR] Regen tests to adjust for naming in SCEVExpander [nfc] 2023-03-20 09:39:29 -07:00
David Green
cd22e7c3ad [AArch64] Regenerate neon-vcmla.ll tests and add tests for combining fadd with vcmla. NFC
See D146407.
2023-03-20 16:29:28 +00:00
Arthur Eubanks
313365add2 [Internalize] Don't claim to preserve CallGraph
Follow up to c41c336ee0
2023-03-20 09:25:47 -07:00
Arthur Eubanks
c41c336ee0 [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.
2023-03-20 09:24:11 -07:00
Eric Schweitz
fc7b860e5e [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
2023-03-20 09:11:06 -07:00
Philip Reames
54539fa8b3 [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.
2023-03-20 09:05:38 -07:00
NagaChaitanya Vellanki
afce10c5b6 [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
2023-03-20 15:43:00 +00:00
Kirill Stoimenov
b33437c969 Reland "[LSAN][HWASAN] Turn on leak sanitizer in HWASAN for Linux"
This reverts commit 35c05f04e5.
2023-03-20 15:41:05 +00:00
Pavel Kosov
fa326c2191 Revert "[clang][ASTImport] Add support for import of empty records"
This reverts commit 21cd04c46f.
2023-03-20 18:20:41 +03:00
Felipe de Azevedo Piovezan
dc521b9a10 [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
2023-03-20 11:16:44 -04:00
Maya Amrami
8bb5ca5832 [mlir] Support bufferization of arith.constant to memref.global with memory space
Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D146381
2023-03-20 17:09:51 +02:00
Paul Scoropan
5a222c0b82 [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
2023-03-20 15:04:16 +00:00
Andrew Litteken
47f528217e [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
2023-03-20 09:40:16 -05:00
Pavel Kosov
21cd04c46f [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
2023-03-20 17:33:04 +03:00
Joseph Huber
ae30ae23aa [libc][NFC] Add some missing comments to the RPC implementation
Summary:
These comments were accidentally dropped from the committed version. Add
them back in.
2023-03-20 09:30:12 -05:00
Adrian Kuegel
cc69d58d79 [mlir][Bazel] Adjust BUILD file for 930744fcda 2023-03-20 15:11:01 +01:00
Nicolas Vasilache
015cd84d3c Revert "[mlir][Linalg][Transform] Avoid FunctionalStyleTransformOpTrait where unnecesseary to improve usability"
This reverts commit 31aa8ea252.

This is currently not in a good state as we have some footguns due to missing listeners.
2023-03-20 07:07:27 -07:00
Kadir Cetinkaya
6f23fee4ef
[clangd] Fix AddUsing in the face of typo-correction
Fixes https://github.com/clangd/clangd/issues/559

Differential Revision: https://reviews.llvm.org/D146417
2023-03-20 14:30:36 +01:00
Mehdi Amini
46c6166d33 Fix MLIR build with shared library enabled
Broken by f406adf134
2023-03-20 14:04:15 +01:00
Dmitry Chernenkov
95d6365ff0 [libcxxabi] Fix for c9d36bd807
Otherwise fails with LIBCPP_REMOVE_TRANSITIVE_INCLUDES
2023-03-20 13:00:33 +00:00
Mehdi Amini
f406adf134 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
2023-03-20 13:40:55 +01:00
Mehdi Amini
5736a8a2da 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
2023-03-20 13:40:55 +01:00
Mehdi Amini
930744fcda 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
2023-03-20 13:39:01 +01:00
Nicolas Vasilache
ba7f3e1d1e [mlir][Transform] Fix support for mapping to GPU warps and to linear ids
c59465e120 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.
2023-03-20 05:23:17 -07:00
David Spickett
0107513fe7 [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
2023-03-20 11:39:32 +00:00
Simon Pilgrim
2d4042f4b7 [DAG] visitTRUNCATE - use FoldConstantArithmetic to perform constant folding.
Avoid needing to perform extra isConstantIntBuildVectorOrConstantInt checks
2023-03-20 11:14:14 +00:00
Simon Pilgrim
e9a86b7813 [DAG] foldBinOpIntoSelect - remove !CanFoldNonConst check. NFC.
These checks are in an if-else chain where CanFoldNonConst is already guaranteed to be false.
2023-03-20 11:14:14 +00:00
Dmitry Chernenkov
e62d0e1520 [llvm][Demangle][NFC] Fix demangle to work with LIBCPP_REMOVE_TRANSITIVE_INCLUDES 2023-03-20 11:07:37 +00:00
luxufan
b0c854b016 [NFC] Regenerate test file InstCombine/bit-checks.ll 2023-03-20 19:04:30 +08:00
Mark Goncharov
e4dd7ec39f [LSR] Fold terminating condition not only for eq and ne.
Add opportunity to fold any icmp instruction.
2023-03-20 13:42:27 +03:00
Muhammad Omair Javaid
f721fcb6ed Revert "[JITLink][ELF] Don't skip debug info sections by default."
This reverts commit 57aeb30546.
Breaks buildbot https://lab.llvm.org/buildbot/#/builders/197/builds/4272
2023-03-20 15:33:20 +05:00
Muhammad Omair Javaid
8d6ab7d519 Revert "Revert "[SVE] Add patterns for shift intrinsics with FalseLanesZero mode""
This reverts commit 32bd1f562f.
2023-03-20 15:33:20 +05:00
Nicolas Vasilache
31aa8ea252 [mlir][Linalg][Transform] Avoid FunctionalStyleTransformOpTrait where unnecesseary to improve usability
Differential Revision: https://reviews.llvm.org/D146305
2023-03-20 03:17:44 -07:00
LLVM GN Syncbot
e0f8f1fce6 [gn build] Port 28997feb0c 2023-03-20 10:07:45 +00:00
Alon Kom
8e5aa969d0 [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
2023-03-20 12:04:05 +02:00
Owen Pan
682808d9c9 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
2023-03-20 03:01:22 -07:00
Pavel Kosov
28997feb0c [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
2023-03-20 12:53:24 +03:00
Adrian Kuegel
a348ba21f8 [mlir][Bazel] Avoid __attribute__((weak)) for MSVC.
Differential Revision: https://reviews.llvm.org/D146405
2023-03-20 10:17:24 +01:00
Adrian Kuegel
499e1a54f5 [mlir] Apply ClangTidy performance finding (NFC). 2023-03-20 10:14:02 +01:00
Valentin Clement
029313cc97
[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
2023-03-20 10:01:51 +01:00
Valentin Clement
52e239794f
[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
2023-03-20 10:00:43 +01:00
Adrian Kuegel
257f4fd3b9 [mlir][Bazel] Add missing dependencies. 2023-03-20 09:28:25 +01:00
Yevgeny Rouban
e735620612 Revert "[AsmParser] Avoid instantiating LLVMContext if not needed. NFC"
This reverts commit c1888a370a
because of massive buildbolt failures.
2023-03-20 15:07:33 +07:00
Nicolas Vasilache
c59465e120 [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
2023-03-20 01:05:32 -07:00
Yevgeny Rouban
c1888a370a [AsmParser] Avoid instantiating LLVMContext if not needed. NFC
Differential Revision: https://reviews.llvm.org/D142699
2023-03-20 14:56:57 +07:00
Muhammad Omair Javaid
32bd1f562f Revert "[SVE] Add patterns for shift intrinsics with FalseLanesZero mode"
This reverts commit 22c3ba4bb5.

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

Differential Revision: https://reviews.llvm.org/D145551
2023-03-20 12:39:39 +05:00