platform/upstream/llvm.git
16 months agoRevert "[Modules] Don't check [temp.friend]p9 in ASTContext::isSameEntity"
Mark de Wever [Tue, 28 Feb 2023 18:36:56 +0000 (19:36 +0100)]
Revert "[Modules] Don't check [temp.friend]p9 in ASTContext::isSameEntity"

This commits breaks the libc++ modular build in the precommit CI.

This reverts commit 74565c3add6d683559618973863e78a5e6836e48.

16 months ago[libc++] Run clang-tidy in all configurations that are run in the Docker container
Nikolas Klauser [Sun, 5 Feb 2023 10:09:23 +0000 (11:09 +0100)]
[libc++] Run clang-tidy in all configurations that are run in the Docker container

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits, arichardson

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

16 months ago[flang] Block construct
V Donaldson [Mon, 27 Feb 2023 22:05:53 +0000 (14:05 -0800)]
[flang] Block construct

A block construct is an execution control construct that supports
declaration scopes contained within a parent subprogram scope or another
block scope. (blocks may be nested.) This is implemented by applying
basic scope processing to the block level.

Name uniquing/mangling is extended to support this. The term "block" is
heavily overloaded in Fortran standards. Prior name uniquing used tag `B`
for common block objects. Existing tag choices were modified to free up `B`
for block construct entities, and `C` for common blocks, and resolve
additional issues with other tags. The "old tag -> new tag" changes can
be summarized as:

     -> B  -- block construct -> new
  B  -> C  -- common block
  C  -> YI -- intrinsic type descriptor; not currently generated
  CT -> Y  -- nonintrinsic type descriptor; not currently generated
  G  -> N  -- namelist group
  L  ->    -- block data; not needed -> deleted

Existing name uniquing components consist of a tag followed by a name
from user source code, such as a module, subprogram, or variable name.
Block constructs are different in that they may be anonymous. (Like other
constructs, a block may have a `block-construct-name` that can be used
in exit statements, but this name is optional.) So blocks are given a
numeric compiler-generated preorder index starting with `B1`, `B2`,
and so on, on a per-procedure basis.

Name uniquing is also modified to include component names for all
containing procedures rather than for just the immediate host. This
fixes an existing name clash bug with same-named entities in same-named
host subprograms contained in different-named containing subprograms,
and variations of the bug involving modules and submodules.

F18 clause 9.7.3.1 (Deallocation of allocatable variables) paragraph 1
has a requirement that an allocated, unsaved allocatable local variable
must be deallocated on procedure exit. The following paragraph 2 states:

  When a BLOCK construct terminates, any unsaved allocated allocatable
  local variable of the construct is deallocated.

Similarly, F18 clause 7.5.6.3 (When finalization occurs) paragraph 3
has a requirement that a nonpointer, nonallocatable object must be
finalized on procedure exit. The following paragraph 4 states:

  A nonpointer nonallocatable local variable of a BLOCK construct
  is finalized immediately before it would become undefined due to
  termination of the BLOCK construct.

These deallocation and finalization requirements, along with stack
restoration requirements, require knowledge of block exits. In addition
to normal block termination at an end-block-stmt, a block may be
terminated by executing a branching statement that targets a statement
outside of the block. This includes

Single-target branch statements:
 - goto
 - exit
 - cycle
 - return

Bounded multiple-target branch statements:
 - arithmetic goto
 - IO statement with END, EOR, or ERR specifiers

Unbounded multiple-target branch statements:
 - call with alternate return specs
 - computed goto
 - assigned goto

Lowering code is extended to determine if one of these branches exits
one or more relevant blocks or other constructs, and adds a mechanism to
insert any necessary deallocation, finalization, or stack restoration
code at the source of the branch. For a single-target branch it suffices
to generate the exit code just prior to taking the indicated branch.
Each target of a multiple-target branch must be analyzed individually.
Where necessary, the code must first branch to an intermediate basic
block that contains exit code, followed by a branch to the original target
statement.

This patch implements an `activeConstructStack` construct exit mechanism
that queries a new `activeConstruct` PFT bit to insert stack restoration
code at block exits. It ties in to existing code in ConvertVariable.cpp
routine `instantiateLocal` which has code for finalization, making block
exit finalization on par with subprogram exit finalization. Deallocation
is as yet unimplemented for subprograms or blocks. This may result in
memory leaks for affected objects at either the subprogram or block level.
Deallocation cases can be addressed uniformly for both scopes in a future
patch, presumably with code insertion in routine `instantiateLocal`.

The exit code mechanism is not limited to block construct exits. It is
also available for use with other constructs. In particular, it is used
to replace custom deallocation code for a select case construct character
selector expression where applicable. This functionality is also added
to select type and associate constructs. It is available for use with
other constructs, such as select rank and image control constructs,
if that turns out to be necessary.

Overlapping nonfunctional changes include eliminating "FIR" from some
routine names and eliminating obsolete spaces in comments.

16 months ago[SimplifyCFG] Do not hoist/sink convergent function calls
Yaxun (Sam) Liu [Fri, 24 Feb 2023 20:32:57 +0000 (15:32 -0500)]
[SimplifyCFG] Do not hoist/sink convergent function calls

Currently SimplifyCFG hoists/sink common instructions in then/else basic blocks
when certain options are enabled, which is the case for default clang optimization
pipelines for -O3. It tries to hoist/sink convergent function calls in divergent
control flow, which causes incorrect ISA generated for GPU, e.g.
https://github.com/ROCm-Developer-Tools/HIP/issues/3172

This patch fixes that by conservatively disable hoisting/sinking common
convergent function calls in then/else blocks.

Reviewed by: Artem Belevich

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

16 months ago[gn build] Manually port D140588
Arthur Eubanks [Tue, 28 Feb 2023 17:35:58 +0000 (09:35 -0800)]
[gn build] Manually port D140588

16 months ago[libc++] Addresses LWG3782.
Mark de Wever [Sat, 21 Jan 2023 12:38:44 +0000 (13:38 +0100)]
[libc++] Addresses LWG3782.

  3782. Should <math.h> declare ::lerp?

Libc++ doesn't declare ::lerp, adds tests to validate the requirement.

Reviewed By: #libc, philnik

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

16 months ago[RISCV] Use !listremove for LMUL lists in V scheduling info [nfc]
Philip Reames [Tue, 28 Feb 2023 17:21:56 +0000 (09:21 -0800)]
[RISCV] Use !listremove for LMUL lists in V scheduling info [nfc]

Using listremove makes it easier to confirm that the code matches the comments.  The only in tree users of these lists are not order sensative.

16 months ago[libc++] Refactor allocator_mismatch.compile.fail.cpp -> .verify.cpp
Arthur O'Dwyer [Fri, 20 Jan 2023 19:49:55 +0000 (14:49 -0500)]
[libc++] Refactor allocator_mismatch.compile.fail.cpp -> .verify.cpp

compile.fail.cpp tests are an anti-feature since they are too easy to
break when evolving code. This patch moves various allocator_mismatch
tests to .verify.cpp and normalizes the error messages from various
containers.

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

16 months ago[clang] Documents clang-scan-deps requirements.
Mark de Wever [Mon, 27 Feb 2023 18:35:20 +0000 (19:35 +0100)]
[clang] Documents clang-scan-deps requirements.

This was discussed in https://llvm.org/PR61006.

Reviewed By: ChuanqiXu

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

16 months ago[flang] Fix a bug with simplified minloc that treated logicals with even values ...
Sacha Ballantyne [Tue, 28 Feb 2023 16:42:18 +0000 (16:42 +0000)]
[flang] Fix a bug with simplified minloc that treated logicals with even values > 1 as 0

Previously the mask would be loaded as the appropriate integer type and cast to I1 to pass to
fir.if, however this truncates the integer and so would cast 6 to 0. By loading values as logicals
and casting to I1 this problem is avoided.

Reviewed By: Leporacanthicus

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

16 months ago[X86] Add DwarfRegNums for segment registers
Alex Brachet [Tue, 28 Feb 2023 17:09:33 +0000 (17:09 +0000)]
[X86] Add DwarfRegNums for segment registers

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

16 months ago[RISCV] Factor out multiclass definitions for V scheduling info [nfc]
Philip Reames [Tue, 28 Feb 2023 16:49:25 +0000 (08:49 -0800)]
[RISCV] Factor out multiclass definitions for V scheduling info [nfc]

Factoring out a shared multiclass imply makes it easier to see that all of these do the same thing, just on different lists. It also makes it easier to see differences - such as we don't define read related pieces for FWRed.

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

16 months ago[MLIR][AMDGPU][ROCDL] Adding raw.buffer.atomic.fmax/smax/umin support
Manupa Karunaratne [Tue, 28 Feb 2023 16:24:41 +0000 (16:24 +0000)]
[MLIR][AMDGPU][ROCDL] Adding raw.buffer.atomic.fmax/smax/umin support

This commit adds support for atomic fmax/smax/umin support
for AMDGPU dialect and the dependent dialects to allow such
a lowering.

Reviewed By: krzysz00

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

16 months agoRevert "Revert "[scudo] Only prepare PageMap entry for partial region""
Chia-hung Duan [Tue, 28 Feb 2023 03:28:12 +0000 (03:28 +0000)]
Revert "Revert "[scudo] Only prepare PageMap entry for partial region""

Fixed the bug in merging BatchGroups back to the FreeList. Added DCHECKs
to ensure the order of BatchGroups

This reverts commit 387452ec591c81def6d8869b23c2ab2f1c56f999.

Reviewed By: cferris

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

16 months ago[Orc] Try to fix linker error
Nikita Popov [Tue, 28 Feb 2023 16:41:43 +0000 (17:41 +0100)]
[Orc] Try to fix linker error

Try to fix flang-aarch64-sharedlibs build.

7344f8a8442a9c3cef159445f71b4f2886ed2798 introduced a use of
LLVMCreatePassBuilderOptions(), which is part of the Passes
library, while previously only InstCombine was linked.

16 months ago[unittest] Restructure plugin cmake target
ibricchi [Tue, 28 Feb 2023 16:19:48 +0000 (08:19 -0800)]
[unittest] Restructure plugin cmake target

Move plugin source and cmake files into separate directory.
Typically cmake targets in LLVM have a single target per directory.
This change brings this unittest more inline with that structure.

Reviewed By: thakis

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

16 months ago[mlir][sparse] Add runtime support for reading a COO tensor and writing the data...
bixia1 [Tue, 28 Feb 2023 15:45:27 +0000 (07:45 -0800)]
[mlir][sparse] Add runtime support for reading a COO tensor and writing the data to the given indices and values buffers.

Reviewed By: aartbik

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

16 months ago[Clang] Implement CWG2518 - static_assert(false)
Corentin Jabot [Fri, 17 Feb 2023 18:45:30 +0000 (19:45 +0100)]
[Clang] Implement CWG2518 - static_assert(false)

This allows `static_assert(false)` to not be ill-formed
in template definitions.

This change is applied as a DR in all C++ modes.

Of notes, a couple of tests were relying of the eager nature
of static_assert

* test/SemaTemplate/instantiation-dependence.cpp
* test/SemaTemplate/instantiate-var-template.cpp

I don't know if the changes to `static_assert`
still allow that sort of tests to be expressed.

Reviewed By: #clang-language-wg, erichkeane, aaron.ballman

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

16 months ago[Orc] Use new pass manager in example
Nikita Popov [Tue, 28 Feb 2023 15:51:06 +0000 (16:51 +0100)]
[Orc] Use new pass manager in example

Invoke InstCombine via the new pass manager, instead of the
legacy pass manager.

16 months ago[SLP]Fix PR61050: Assertion `I->use_empty() && "trying to erase instruction with...
Alexey Bataev [Tue, 28 Feb 2023 14:56:25 +0000 (06:56 -0800)]
[SLP]Fix PR61050: Assertion `I->use_empty() && "trying to erase instruction with users."

When gathering the counter for the reused scalars, need to use reduced
value, not the original reduced value. Same values counter is gathered
for reduced values, not original ones.

16 months ago[Flang] Fix ALLOCATE with MOLD for scalars
Peter Steinfeld [Fri, 24 Feb 2023 22:40:20 +0000 (14:40 -0800)]
[Flang] Fix ALLOCATE with MOLD for scalars

When we allocate a variable using a MOLD argument, the function that
applies the type of the MOLD argument first checks to see if the
variable is already allocated by looking at its descriptor.  But in the
case of allocating a scalar, the descriptor was not yet been created and
the associated memory is uninitialized.  This change fixes that.

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

16 months ago[clang][dataflow] unnamed bitfields should be discarded in InitListExpr
Paul Semel [Mon, 27 Feb 2023 18:15:39 +0000 (18:15 +0000)]
[clang][dataflow] unnamed bitfields should be discarded in InitListExpr

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

16 months ago[C++20] [Modules] Trying to compare the trailing require clause from the primary...
Chuanqi Xu [Tue, 28 Feb 2023 15:14:51 +0000 (23:14 +0800)]
[C++20] [Modules] Trying to compare the trailing require clause from the primary template function

Close https://github.com/llvm/llvm-project/issues/60890.

For the following example:

```
export module a;

export template<typename T>
struct a {
friend void aa(a) requires(true) {
}
};
```

```
export module b;

import a;

struct b {
a<int> m;
};
```

```
export module c;

import a;

struct c {
void f() const {
aa(a<int>());
}
};
```

```
import a;
import b;
import c;

void d() {
aa(a<int>());
}
```

The current clang will reject this incorrectly. The reason is that the
require clause  will be replaced with the evaluated version
(https://github.com/llvm/llvm-project/blob/efae3174f09560353fb0f3d528bcbffe060d5438/clang/lib/Sema/SemaConcept.cpp#L664-L665).
In module 'b', the friend function is instantiated but not used so the
require clause of the friend function is `(true)`. However, in module
'c', the friend function is used so the require clause is `true`. So
deserializer classify these two function to two different functions
instead of one. Then here is the bug report.

The proposed solution is to try to compare the trailing require clause
of the primary template when performing ODR checking.

Reviewed By: erichkeane

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

16 months ago[clang][Interp][NFC] Clean up InterpState.cpp
Timm Bäder [Mon, 6 Feb 2023 14:23:39 +0000 (15:23 +0100)]
[clang][Interp][NFC] Clean up InterpState.cpp

Remove unused includes, an unused using alias and braces in single-line
if statements.

16 months ago[flang] lower hlfir.transpose into fir runtime call
Tom Eccles [Tue, 28 Feb 2023 15:21:00 +0000 (15:21 +0000)]
[flang] lower hlfir.transpose into fir runtime call

Depends on D144881

Reviewed By: jeanPerier

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

16 months ago[flang] lower transpose intrinsic to hlfir.transpose operation
Tom Eccles [Mon, 27 Feb 2023 14:31:39 +0000 (14:31 +0000)]
[flang] lower transpose intrinsic to hlfir.transpose operation

Depends on D144880

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

16 months ago[flang] add hlfir.transpose operation
Tom Eccles [Mon, 27 Feb 2023 13:49:29 +0000 (13:49 +0000)]
[flang] add hlfir.transpose operation

Add a HLFIR operation for the TRANSPOSE transformational intrinsic,
according to the design set out in flang/doc/HighLevelFIR.md

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

16 months ago[clang][Interp][NFC] Use qualified name in Function::getName()
Timm Bäder [Thu, 16 Feb 2023 07:22:26 +0000 (08:22 +0100)]
[clang][Interp][NFC] Use qualified name in Function::getName()

16 months ago[InstCombine] use demanded vector elements to eliminate partially redundant instructions
Sanjay Patel [Tue, 28 Feb 2023 14:15:24 +0000 (09:15 -0500)]
[InstCombine] use demanded vector elements to eliminate partially redundant instructions

In issue #60632, we have vector math ops that differ because an
operand is shuffled, but the math has limited demanded elements,
so it can be replaced by another instruction:
https://alive2.llvm.org/ce/z/TKqq7H

I don't think we have anything like this yet - it's like a
CSE/GVN fold, but driven by demanded elements of a vector op.
This is limited to splat-0 as a first step to keep it simple.

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

16 months ago[flang] Allow `to` argument of move_alloc to be class(*)
David Truby [Tue, 28 Feb 2023 14:32:37 +0000 (14:32 +0000)]
[flang] Allow `to` argument of move_alloc to be class(*)

This patch expands the runtime check in move_alloc to allow the
destination to be unlimited polymorphic.

Reviewed By: clementval

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

16 months ago[CGProfile] Don't fetch BFI without profile (NFCI)
Nikita Popov [Tue, 28 Feb 2023 13:49:38 +0000 (14:49 +0100)]
[CGProfile] Don't fetch BFI without profile (NFCI)

Don't fetch BFI if the function has no entry count. Peculiarly,
the implementation was already doing this for the (no longer
existing) legacy PM implementation, but the same principle applies
to the new pass manager. The only reason why the new PM doesn't
have LazyBFI is that with the new pass manager all passes are
lazy.

This improves compile-time for non-PGO builds.

16 months ago[flang][hlfir] Support type descriptor for initialized character component
Jean Perier [Tue, 28 Feb 2023 14:15:29 +0000 (15:15 +0100)]
[flang][hlfir] Support type descriptor for initialized character component

These compiler generated component descriptor include designators packaged
as CLASS(*) for simplicity. HLFIR hit an assert in an std::get trying to
recover an Expr<SomeChar> while translating the expression type.
Use the dynamic type of the CLASS(*) expr in that case to recover the
compiler length.

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

16 months ago[libc++][spaceship] Implement `operator<=>` for `list`
Adrian Vogelsgesang [Sat, 20 Aug 2022 20:27:32 +0000 (13:27 -0700)]
[libc++][spaceship] Implement `operator<=>` for `list`

Implements part of P1614R2 "The Mothership has Landed"

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

16 months ago[AArch64][SME2] Add multi-vector uunpk and sunpk intrinsics
David Sherwood [Tue, 31 Jan 2023 09:39:06 +0000 (09:39 +0000)]
[AArch64][SME2] Add multi-vector uunpk and sunpk intrinsics

This patch adds the LLVM IR intrinsics for the following:

* uunpk (2 and 4 vectors)
* sunpk (2 and 4 vectors)

I have named the tests sve2p1-intrinsics-* because although
the instructions are added as part of the SME2 feature they
only operate on SVE vectors.

NOTE: These intrinsics are still in development and are subject to future changes.

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

16 months ago[CGProfile] Remove unnecessary analysis callbacks (NFC)
Nikita Popov [Tue, 28 Feb 2023 13:49:38 +0000 (14:49 +0100)]
[CGProfile] Remove unnecessary analysis callbacks (NFC)

These were used to abstract between NewPM and LegacyPM. Now that
the LegacyPM implementation is gone, we can fetch the analyses
directly from the FAM.

16 months ago[LoopSink] Don't fetch analyses without profile data (NFCI)
Nikita Popov [Tue, 28 Feb 2023 13:21:46 +0000 (14:21 +0100)]
[LoopSink] Don't fetch analyses without profile data (NFCI)

The loop sink pass only does something if the function has
profile data. Move the check for that before analyses are fetched,
to avoid computing things like BFI or MSSA unnecessarily.

16 months ago[flang] Use unsigned to avoid comparison warning
Valentin Clement [Tue, 28 Feb 2023 13:26:43 +0000 (14:26 +0100)]
[flang] Use unsigned to avoid comparison warning

16 months ago[mlir][Linalg] Refactor HoistPadding and add support for hoisting in the absence...
Nicolas Vasilache [Mon, 27 Feb 2023 09:28:56 +0000 (01:28 -0800)]
[mlir][Linalg] Refactor HoistPadding and add support for hoisting in the absence of packing loops.

This revision cleans up the implementation of hoist padding and extends it to also work in the
absence of packing loops.
This allows better composition when hoisting the padded result of a DPS operation.

A systematic usage of RewriterBase is applied to the implementation.

Depends on: D144856

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

16 months ago[LoopVectorize] Only fetch BFI if profile summary available
Nikita Popov [Tue, 28 Feb 2023 10:49:26 +0000 (11:49 +0100)]
[LoopVectorize] Only fetch BFI if profile summary available

BlockFrequencyInfo should generally only be fetched in PGO builds
where a PSI profile summary is available. However, LoopVectorize
was fetching it unconditionally.

This results in a small compile-time improvement for non-PGO builds.

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

16 months ago[flang][hlfir] Support type bound procedure in type descriptors
Jean Perier [Tue, 28 Feb 2023 13:11:39 +0000 (14:11 +0100)]
[flang][hlfir] Support type bound procedure in type descriptors

In hlfir, procedure designators are propagated as fir.box_proc.
Derived type descriptors are compiler generated constant structure
constructors. They contain CFPTR components for the type bound
procedure addresses.
Before being cast to an integer type so that they can be stored
in the CFPTR components, the fir.box_proc addresses must be
obtained with a fir.box_addr.

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

16 months ago[flang][hlfir] Lower parent component references
Jean Perier [Tue, 28 Feb 2023 13:09:27 +0000 (14:09 +0100)]
[flang][hlfir] Lower parent component references

Skip the parent components when they are not at the end of
designators.
Generate an hlfir.parent_comp for parent component at the end
of designators.

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

16 months ago[flang][hlfir] Add hlfir.parent_comp for leaf parent component references
Jean Perier [Tue, 28 Feb 2023 13:08:08 +0000 (14:08 +0100)]
[flang][hlfir] Add hlfir.parent_comp for leaf parent component references

In Fortran, it is possible to refer to the "parent part" of a derived
type as if it were a component:

```Fortran
type t1
 integer :: i
end type
type t2
 integer :: j
end type
type(t2) :: a
  print *, a%t1%i ! "inner" parent component reference
  print *, a%t1   ! "leaf" parent component reference
end
```

Inner parent component references can be dropped on the floor in
lowering: "a%t1%i" is equivalent to "a%i".
Leaf parent component references, however, must be taken care of. For
scalars, "a%t1" is a simple addressc ast to "t1", for arrays, however,
this creates an array section that must be represented with a descriptor
(fir.box).

hlfir.designate could have been extended to deal with this, but I think
it would make hlfir.designate too complex and hard to manipulate.

This patch adds an hlfir.parent_comp op that represents and implements
leaf parent component references.

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

16 months ago[flang] Fix potential segfault in PointerAssociateRemapping
Valentin Clement [Tue, 28 Feb 2023 13:01:10 +0000 (14:01 +0100)]
[flang] Fix potential segfault in PointerAssociateRemapping

The bounds descriptor passed to the function is an array of [2, newRank]
size. Update the code so the rank is retrieved from the second dimension
and not the rank of the descriptor directly as it will be 2 in any case.

Reviewed By: jeanPerier

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

16 months ago[AMDGPU][AsmParser] Distinguish literal and modifier SMEM offsets.
Ivan Kosarev [Tue, 28 Feb 2023 12:48:10 +0000 (12:48 +0000)]
[AMDGPU][AsmParser] Distinguish literal and modifier SMEM offsets.

Reviewed By: foad

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

16 months ago[LV] Reland testcase in 0ec4cae
sgokhale [Tue, 28 Feb 2023 12:44:18 +0000 (18:14 +0530)]
[LV] Reland testcase in 0ec4cae

16 months ago[OpenMP][AMDGPU] More detail in AMDGPU kernel launch info
JP Lehr [Tue, 28 Feb 2023 12:15:22 +0000 (07:15 -0500)]
[OpenMP][AMDGPU] More detail in AMDGPU kernel launch info

Makes the info that is printed for kernel launches configurable for
different plugins. Adds all machinery to print the detailed launch
info that the current AMD plugin provides and includes e.g. register
spill counts.

The files msgpack.cpp, msgpack.def, and msgpack.h are copied from the old plugin
and are untouched. The contents of UtilitiesHSA.cpp and .h are copied together from
various files from the old plugin. The code was originally written by
Jon Chesterfield. I updated the function and type names visible to the outside, i.e.
in headers, to respect the LLVM conventions.

Reviewed By: jhuber6

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

16 months ago[LV] Modify test case for commit 4f9a544
sgokhale [Tue, 28 Feb 2023 12:37:36 +0000 (18:07 +0530)]
[LV] Modify test case for commit 4f9a544

Was observing test failure. Relanding the test

16 months agoRevert "[mlir][linalg] Vectorize tensor.extract using contiguous loads"
Benjamin Kramer [Tue, 28 Feb 2023 12:22:10 +0000 (13:22 +0100)]
Revert "[mlir][linalg] Vectorize tensor.extract using contiguous loads"

This reverts commit 89b144ece330b363713bec369d2d89dc85f715f5. See
https://reviews.llvm.org/D141998 for a test case where this goes wrong.

16 months ago[flang] Change COUNT intrinsic to support different kind logicals
Sacha Ballantyne [Tue, 28 Feb 2023 11:56:23 +0000 (11:56 +0000)]
[flang] Change COUNT intrinsic to support different kind logicals

Previously COUNT would cast the mask input to logical<4> before passing it
to the runtime function, this has been changed to allow different types of logical.

Reviewed By: tblah

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

16 months ago[AMDGPU][NFC] Eliminate the u32imm operand definition.
Ivan Kosarev [Tue, 28 Feb 2023 11:50:50 +0000 (11:50 +0000)]
[AMDGPU][NFC] Eliminate the u32imm operand definition.

It is only used to infer the types of offset parameters in isel patterns,
which we can specify directly.

Reviewed By: piotr

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

16 months ago[SCEV][NFC] Introduce utility function to get power of 2
dbakunevich [Mon, 20 Feb 2023 12:18:03 +0000 (19:18 +0700)]
[SCEV][NFC] Introduce utility function to get power of 2

The new function has been added to SCEV that allows to raise the number 2
to the desired power.

Authored-by: Dmitry Bakunevich
Differential Revision: https://reviews.llvm.org/D144381

16 months ago[LV] Reland "Update logic for calculating register usage due to invariants"
sgokhale [Tue, 28 Feb 2023 12:02:39 +0000 (17:32 +0530)]
[LV] Reland "Update logic for calculating register usage due to invariants"

Previously, while calculating register usage due to invariants, it was assumed that invariant would always be part of widening
instructions. This resulted in calculating vector register types for vectors which cant be legalized(check the newly added test for more details).

An invariant might not always need a vector register. For e.g., invariant might just be used for iteration check.

This patch checks if the invariant is part of any widening instruction and considers register usage accordingly. Fixes issue 60493

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

16 months ago[mlir][Linalg] Refactor transform.structured.pad to separate out hoisting
Nicolas Vasilache [Fri, 24 Feb 2023 11:59:08 +0000 (03:59 -0800)]
[mlir][Linalg] Refactor transform.structured.pad to separate out hoisting

Depends on: D144717

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

16 months ago[mlir][Linalg] NFC - Apply cleanups to transforms
Nicolas Vasilache [Fri, 24 Feb 2023 11:05:41 +0000 (03:05 -0800)]
[mlir][Linalg] NFC - Apply cleanups to transforms

Depends on: D144656

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

16 months ago[Clang] Do not emit exception diagnostics from coroutines and coroutine lambdas
Deniz Evrenci [Tue, 28 Feb 2023 10:36:46 +0000 (11:36 +0100)]
[Clang] Do not emit exception diagnostics from coroutines and coroutine lambdas

All exceptions thrown in coroutine bodies are caught and
unhandled_exception member of the coroutine promise type is called.
In accordance with the existing rules of diagnostics related to
exceptions thrown in functions marked noexcept, even if the promise
type's constructor, get_return_object, or unhandled_exception
throws, diagnostics should not be emitted.

Fixes #48797.

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

16 months ago[GlobalOpt] Split CleanupPointerRootUsers test with constant exprs.
Florian Hahn [Tue, 28 Feb 2023 10:40:36 +0000 (11:40 +0100)]
[GlobalOpt] Split CleanupPointerRootUsers test with constant exprs.

Split tests for D144468. Adding a test with an icmp constant expression
stopped CleanupPointerRootUsers from being called. Move it to a
separate test.

16 months ago[CHR] Do not fetch BFI without profile summary (NFCI)
Nikita Popov [Tue, 28 Feb 2023 09:17:03 +0000 (10:17 +0100)]
[CHR] Do not fetch BFI without profile summary (NFCI)

Do not compute BFI if PGO is not used. This addresses the
compile-time regression from https://reviews.llvm.org/D144769.

16 months agoRevert "[LV] Update logic for calculating register usage due to invariants"
sgokhale [Tue, 28 Feb 2023 10:16:59 +0000 (15:46 +0530)]
Revert "[LV] Update logic for calculating register usage due to invariants"

Observing test failure for llvm/test/Transforms/LoopVectorize/AArch64/reg-usage.ll

This reverts commit d1628266946fdddb44bdad2b3ccf3cd5fc769f42.

16 months ago[Local][InstCombine] Handle MD_noundef in combineMetadataCSE
luxufan [Tue, 28 Feb 2023 09:59:02 +0000 (17:59 +0800)]
[Local][InstCombine] Handle MD_noundef in combineMetadataCSE

Reviewed By: nikic

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

16 months ago[LICM][NFC] Don't preserve DT and loop analyzes separately
Max Kazantsev [Tue, 28 Feb 2023 09:16:01 +0000 (16:16 +0700)]
[LICM][NFC] Don't preserve DT and loop analyzes separately

This is already implied by getLoopPassPreservedAnalyses.

Differential Revision: https://reviews.llvm.org/D144860
Reviewed By: nikic, skatkov

16 months ago[GuardWidening] Rename 'isAvailableAt' -> 'canBeHoistedTo' (NFC)
Dmitry Makogon [Tue, 28 Feb 2023 09:21:58 +0000 (16:21 +0700)]
[GuardWidening] Rename 'isAvailableAt' -> 'canBeHoistedTo' (NFC)

This better describes what this method does.

16 months ago[GuardWidening] Make sure widened condition operands are available at insertion point
Dmitry Makogon [Tue, 28 Feb 2023 08:14:37 +0000 (15:14 +0700)]
[GuardWidening] Make sure widened condition operands are available at insertion point

This fixes a possible issue when we could hoist an instruction up to a widenable
condition intrinsic call without making sure its operands are available at
hoisiting point.

Recently insertion point finding algorithm changed a bit, so this availability
check became necessary.

Verifier would crash after we handled the following special case:
  L >u C0 && L >u C1  ->  L >u max(C0, C1),
Previously we would insert the new condition right before the widenable condition
branch where all L operands were available.
Now we may choose the widenable condition intrinsic call as insertion point and it may
happen so that the L operands are computed after the call, so we have to make sure that
L operands are available at the point we want to insert it.

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

16 months ago[mlir] Fix the missing mlir test BUILD.bazel for 3948f0a0b5e5fecddf315b8de321c6a44ee7ff5c
Haojian Wu [Tue, 28 Feb 2023 09:15:28 +0000 (10:15 +0100)]
[mlir] Fix the missing mlir test BUILD.bazel for 3948f0a0b5e5fecddf315b8de321c6a44ee7ff5c

16 months ago[mlir] Port bazel for 3948f0a0b5e5fecddf315b8de321c6a44ee7ff5c
Haojian Wu [Tue, 28 Feb 2023 08:32:30 +0000 (09:32 +0100)]
[mlir] Port bazel for 3948f0a0b5e5fecddf315b8de321c6a44ee7ff5c

16 months ago[mlir][Affine][NFC] Improve FlatAffineValueConstraint dump
Matthias Springer [Mon, 27 Feb 2023 09:37:02 +0000 (10:37 +0100)]
[mlir][Affine][NFC] Improve FlatAffineValueConstraint dump

Improve indentation for better readability.

Before:
```
Domain: 0, Range: 2, Symbols: 2, Locals: 1
5 constraints
(None Value Value Value Local const)
1 1 0 -1 0 0 = 0
0 1 -1 0 0 0 >= 0
0 0 1 -1 2 2 >= 0
0 0 -1 1 -2 -1 >= 0
0 -1 1 0 2 0 >= 0
```

After:
```
Domain: 0, Range: 2, Symbols: 2, Locals: 1
5 constraints
(None Value Value Value Local const)
 1 1 0 -1 0 0 = 0
 0 1 -1 0 0 0 >= 0
 0 0 1 -1 2 2 >= 0
 0 0 -1 1 -2 -1 >= 0
 0 -1 1 0 2 0 >= 0
```

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

16 months ago[Test] Add test exposing hoisting bug in GuardWidening (NFC)
Dmitry Makogon [Tue, 28 Feb 2023 06:30:15 +0000 (13:30 +0700)]
[Test] Add test exposing hoisting bug in GuardWidening (NFC)

It hoits instruction without making sure its operands are
available at hoisiting point.

16 months ago[mlir][llvm] Rename LLVMOpsInterfaces.td to LLVMInterfaces.td (NFC).
Tobias Gysi [Tue, 28 Feb 2023 07:44:57 +0000 (08:44 +0100)]
[mlir][llvm] Rename LLVMOpsInterfaces.td to LLVMInterfaces.td (NFC).

The revision renames LLVMOpsInterfaces.td since the the tablegen file
contains op and type interfaces.

Reviewed By: ftynse, Dinistro

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

16 months ago[InstCombine] Fold signbit test of a pow2 or zero
Jun Zhang [Sat, 25 Feb 2023 06:23:01 +0000 (14:23 +0800)]
[InstCombine] Fold signbit test of a pow2 or zero

(X & X) <  0 --> X == MinSignedC
(X & X) > -1 --> X != MinSignedC

Alive2: https://alive2.llvm.org/ce/z/_J5q3S
Closes: https://github.com/llvm/llvm-project/issues/60957

Signed-off-by: Jun Zhang <jun@junz.org>
Differential Revision: https://reviews.llvm.org/D144777

16 months ago[TableGen] Replace a StringMap keyed by Record name with a DenseMap.
Craig Topper [Tue, 28 Feb 2023 06:33:41 +0000 (22:33 -0800)]
[TableGen] Replace a StringMap keyed by Record name with a DenseMap.

We can use the Record* to uniquely identify the Record without using
its name.

16 months ago[RISCV] Enable preferZeroCompareBranch to optimize branch on zero in codegenprepare
LiaoChunyu [Tue, 28 Feb 2023 06:07:25 +0000 (14:07 +0800)]
[RISCV] Enable preferZeroCompareBranch to optimize branch on zero in codegenprepare

Similar to ARM and SystemZ.

Related Patchs: D101778(preferZeroCompareBranch)
https://reviews.llvm.org/rG9a9421a461166482465e786a46f8cced63cd2e9f   ( == 0 to u< 1)

Reviewed By: craig.topper

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

16 months ago[NFC] Add a test about template pack for C++20 Modules
Chuanqi Xu [Tue, 28 Feb 2023 06:37:08 +0000 (14:37 +0800)]
[NFC] Add a test about template pack for C++20 Modules

I found the issue in a donwstream project. But the case looks fine in
the upstream. Add the test to make sure that it wouldn't happen in the
upstream.

16 months ago[llvm][Uniformity] provide overloads for Instruction* and Value*
Sameer Sahasrabuddhe [Tue, 28 Feb 2023 05:59:19 +0000 (11:29 +0530)]
[llvm][Uniformity] provide overloads for Instruction* and Value*

Uniformity analysis is mainly concerned with the uniformity of values. But it is
sometimes useful to ask if an instruction is uniform, for example, if the
instruction is a terminator. On LLVM IR, every Instruction is a Value, so the
queries like isUniform() need to be overloaded so that the most derived class
always wins.

Reviewed By: ruiling

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

16 months ago[LV] Update logic for calculating register usage due to invariants
sgokhale [Mon, 27 Feb 2023 07:50:52 +0000 (13:20 +0530)]
[LV] Update logic for calculating register usage due to invariants

Previously, while calculating register usage due to invariants, it was assumed that invariant would always be part of widening
instructions. This resulted in calculating vector register types for vectors which cant be legalized(check the newly added test for more details).

An invariant might not always need a vector register. For e.g., invariant might just be used for iteration check.

This patch checks if the invariant is part of any widening instruction and considers register usage accordingly. Fixes issue 60493

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

16 months ago[MLIR] Fix bug in addAffineParallelOpDomain upper bound constraint
Uday Bondhugula [Sun, 26 Feb 2023 14:56:08 +0000 (20:26 +0530)]
[MLIR] Fix bug in addAffineParallelOpDomain upper bound constraint

Fix upper bound constraint addition in addAffineParallelOpDomain; it was
off by one in the case of constants.

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

16 months ago[scudo] Set name for reserved regions in SizeClassAllocator64
Chia-hung Duan [Tue, 28 Feb 2023 03:20:38 +0000 (03:20 +0000)]
[scudo] Set name for reserved regions in SizeClassAllocator64

This improves the readability of address space

Reviewed By: enh

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

16 months ago[AVR] Fix incorrect flags of livein registers when spilling them
Ben Shi [Fri, 24 Feb 2023 03:11:00 +0000 (11:11 +0800)]
[AVR] Fix incorrect flags of livein registers when spilling them

In AVRFrameLowering::spillCalleeSavedRegisters(), when a 16-bit
livein register is spilled, two PUSH instructions are generated
for the higher and lower 8-bit registers. But these two 8-bit
registers are marked as killed in the two PUSH instructions, so
any future use of them will cause a crash.

This patch fixes the above issue by adding the two sub 8-bit
registers to the livein list.

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

Reviewed By: jacquesguan

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

16 months ago[IPO] Remove various legacy passes
Arthur Eubanks [Tue, 28 Feb 2023 03:00:37 +0000 (19:00 -0800)]
[IPO] Remove various legacy passes

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

16 months ago[X86] Fix for offsets of CFA directives
Theodoros Kasampalis [Tue, 28 Feb 2023 02:27:59 +0000 (10:27 +0800)]
[X86] Fix for offsets of CFA directives

`emitPrologue` may insert stack pointer adjustment in tail call optimized functions where the callee argument stack size is bigger than the caller's. In such a case, the adjustment must be taken into account when generating CFA directives.

Reviewed By: pengfei

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

16 months ago[CodeGen] Use LLVM_ATTRIBUTE_UNUSED instead of LLVM_DUMP_METHOD on a raw_ostream...
Craig Topper [Tue, 28 Feb 2023 02:12:18 +0000 (18:12 -0800)]
[CodeGen] Use LLVM_ATTRIBUTE_UNUSED instead of LLVM_DUMP_METHOD on a raw_ostream operator<<.

LLVM_DUMP_METHOD includes ATTRIBUTE_NOINLINE. operator<< isn't
what we normally consider a dump method so it should be ok to inline.

This fixes a warning from gcc that some other declaration for some
other class was inline but this one is noinline. Seems like a bogus
warning from gcc really.

16 months ago[gn build] Port 58ec6e09abe8
LLVM GN Syncbot [Tue, 28 Feb 2023 01:47:13 +0000 (01:47 +0000)]
[gn build] Port 58ec6e09abe8

16 months ago[AArch64] Use isSVESizelessBuiltinType instead of isSizelessBuiltinType in SVE specif...
Craig Topper [Tue, 28 Feb 2023 01:39:50 +0000 (17:39 -0800)]
[AArch64] Use isSVESizelessBuiltinType instead of isSizelessBuiltinType in SVE specific code.

isSizelessBuiltinType includes RISC-V vector and WebAssembly reference
types. This code is not applicable to those types.

16 months ago[OpenMP][FIX] Properly align firstprivate variables
Johannes Doerfert [Mon, 27 Feb 2023 21:31:05 +0000 (13:31 -0800)]
[OpenMP][FIX] Properly align firstprivate variables

The old code didn't actually align the values, and it added padding even
when none was necessary. This approach will pad entries if necessary
and, similar to the struct case, use the host pointer as guidance.

NOTE: This does still not align them as the host has, but it's unclear
      if the user really should use the alignment bits anyway. For now
      this is a reasonable compromise, only if we have host alignment
      information (explicitly not implicitly via the host pointer), we
      could do it completely right without wasting lots of resources for
      >99% of the cases.

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

16 months ago[ADT] Fix definition of `adl_begin`/`adl_end` and `Iter`/`ValueOfRange`
Jakub Kuderski [Tue, 28 Feb 2023 01:25:20 +0000 (20:25 -0500)]
[ADT] Fix definition of `adl_begin`/`adl_end` and `Iter`/`ValueOfRange`

- Make `IterOfRange` and `ValueOfRange` work with types that require
  custom `begin`/`end` functions.
- Allow for `adl_begin`/`adl_end` to be used in constant-evaluated
  contexts.
- Use SFINAE-friendly trailing return type deductions `adl_begin`/`adl_end` so that they are useable in template argument deduction.
- Add missing documentation comments.

This is required for future work in https://reviews.llvm.org/D144503.

Reviewed By: dblaikie, zero9178

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

16 months ago[NFC] [clang] Forward forwarding reference
Chris Cotter [Tue, 28 Feb 2023 01:26:45 +0000 (01:26 +0000)]
[NFC] [clang] Forward forwarding reference

Update function bodies to forward forwarding references.
I spotted this while authoring a clang-tidy tool for CppCoreGuideline F.19

Reviewed By: dblaikie

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

16 months agoDebugInfo: Disable ctor homing for types with only deleted (non copy/move) ctors
David Blaikie [Tue, 28 Feb 2023 00:54:24 +0000 (00:54 +0000)]
DebugInfo: Disable ctor homing for types with only deleted (non copy/move) ctors

Such a type is never going to have a ctor home, and may be used for type
punning or other ways of creating objects.

May be a more generally acceptable solution in some cases compared to
attributing with [[clang::standalone_debug]].

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

16 months agoAdd tests for replacing `{v}unpck{l|h}pd` -> `{v}shufps`; NFC
Noah Goldstein [Tue, 28 Feb 2023 00:22:22 +0000 (18:22 -0600)]
Add tests for replacing `{v}unpck{l|h}pd` -> `{v}shufps`; NFC

Reviewed By: RKSimon

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

16 months agoAdd new pass `X86FixupInstTuning` for fixing up machine-instruction selection.
Noah Goldstein [Thu, 16 Feb 2023 17:57:12 +0000 (11:57 -0600)]
Add new pass `X86FixupInstTuning` for fixing up machine-instruction selection.

There are a variety of cases where we want more control over the exact
instruction emitted. This commit creates a new pass to fixup
instructions after the DAG has been lowered. The pass is only meant to
replace instructions that are guranteed to be interchangable, not to
do analysis for special cases.

Handling these instruction changes in in X86ISelLowering of
X86ISelDAGToDAG isn't ideal, as its liable to either break existing
patterns that expected a certain instruction or generate infinite
loops.

As well, operating as the MachineInstruction level allows us to access
scheduling/code size information for making the decisions.

Currently only implements `{v}permilps` -> `{v}shufps/{v}shufd` but
more transforms can be added.

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

16 months agoAdd tests for replacing `{v}permilps` -> `{v}shufps/{v}pshufd`; NFC
Noah Goldstein [Sat, 25 Feb 2023 03:05:10 +0000 (21:05 -0600)]
Add tests for replacing `{v}permilps` -> `{v}shufps/{v}pshufd`; NFC

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

16 months agoAdding tuning flags for int <-> fp domain switching penalties; NFC
Noah Goldstein [Thu, 16 Feb 2023 17:56:48 +0000 (11:56 -0600)]
Adding tuning flags for int <-> fp domain switching penalties; NFC

Atom
    - No domain switching penalties
Nehalem+
    - No penalty on moves
Haswell+
    - No penalty on moves / shuffles
Skylake+
    - No penality on moves / shuffles / blends

Reviewed By: RKSimon

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

16 months ago[ELF][PPC64] Actually implement --no-power10-stubs
Fangrui Song [Tue, 28 Feb 2023 00:19:13 +0000 (16:19 -0800)]
[ELF][PPC64] Actually implement --no-power10-stubs

When a caller that does not use TOC calls a function, a call stub is needed if
the function may use TOC. --no-power10-stubs avoids PC-relative instructions in
the code sequence.

The --no-power10-stubs=no implementation added in D94627 is wrong.
First, the first instruction incorrectly uses `mflr 0` (instead of `mflr 12`).
Second, for the PLT case, it uses addis+addi with getVA instead of addis+ld with
getGotPltVA.

16 months ago[BOLT][NFC] Simplify BinaryFunction::setTrapOnEntry
Amir Ayupov [Mon, 27 Feb 2023 23:40:45 +0000 (15:40 -0800)]
[BOLT][NFC] Simplify BinaryFunction::setTrapOnEntry

Reviewed By: #bolt, maksfb

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

16 months ago[polly] Remove unnecessary -enable-new-pm flags
Arthur Eubanks [Mon, 27 Feb 2023 23:38:39 +0000 (15:38 -0800)]
[polly] Remove unnecessary -enable-new-pm flags

16 months ago[BOLT][NFC] Log reversing splitting decision
Amir Ayupov [Mon, 27 Feb 2023 23:26:14 +0000 (15:26 -0800)]
[BOLT][NFC] Log reversing splitting decision

Expose log for testing purposes.

Reviewed By: #bolt, maksfb

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

16 months ago[BOLT] Prevent unsetting unknown control flow for split jump table
Amir Ayupov [Mon, 27 Feb 2023 23:21:23 +0000 (15:21 -0800)]
[BOLT] Prevent unsetting unknown control flow for split jump table

In case of a function with unknown control flow but with a single jump
table and a single jump table site, we attempt to match the jump table
and a site and update block successors using jump table targets.
Restrict this behavior for split jump tables which have targets in a
fragment function.

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

Reviewed By: #bolt, rafauler

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

16 months ago[BOLT][NFC] Const-ify analyzeJumpTable
Amir Ayupov [Wed, 22 Feb 2023 06:09:17 +0000 (22:09 -0800)]
[BOLT][NFC] Const-ify analyzeJumpTable

Avoid modifying `BF`, instead set extra output parameter and modify BF in caller
scope.

Reviewed By: #bolt, rafauler

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

16 months ago[BOLT] Change call count output for ICF
Maksim Panchenko [Fri, 24 Feb 2023 23:45:21 +0000 (15:45 -0800)]
[BOLT] Change call count output for ICF

ICF optimization runs multiple passes and the order in which functions
are folded could be dependent on the order they are being processed.
This order is indeterministic as functions are intermediately stored in
std::unordered_map<>. Note that this order is mostly stable, but is not
guaranteed to be and can change e.g. after switching to a different C++
library implementation.

Because the processing (and folding) order is indeterministic, the
previous way of calculating merged function call count could produce
different results.

Change the way we calculate the ICF call count to make it independent of
the function folding/processing order.

Mostly NFC as the output binary should remain the same, the change
affects only the console output.

Reviewed By: yota9

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

16 months ago[mlir][core] Fix ValueRange printing in AsmPrinter
wpmed92 [Mon, 27 Feb 2023 20:51:28 +0000 (12:51 -0800)]
[mlir][core] Fix ValueRange printing in AsmPrinter

The ValueRange printing behaviour of `OpAsmPrinter` and `AsmPrinter` is different, as reported [[ https://github.com/llvm/llvm-project/issues/59334 | here ]]

```
static void testPrint(AsmPrinter &p, Operation *op, ValueRange operands) {
  p << '(' << operands << ')';
}
```
Although the base `AsmPrinter` is passed as the first parameter (and not `OpAsmPrinter`), the code compiles fine. However, instead of the SSA values, the types for the operands will be printed. This is a violation of the Liskov Substitution Principle.
The desired behaviour would be that the above code does not compile. The reason it compiles, is that for the above code, the `TypeRange` version will be selected for the `<<` operator, since `ValueRange` is implicitly converted to `TypeRange`:
```
template <typename AsmPrinterT>
inline std::enable_if_t<std::is_base_of<AsmPrinter, AsmPrinterT>::value,
                        AsmPrinterT &>
operator<<(AsmPrinterT &p, const TypeRange &types) {
  llvm::interleaveComma(types, p);
  return p;
}
```

16 months ago[AArch64][GlobalISel] Legalize G_SHUFFLE_VECTOR with smaller dest size
Vladislav Dzhidzhoev [Tue, 7 Feb 2023 20:32:50 +0000 (21:32 +0100)]
[AArch64][GlobalISel] Legalize G_SHUFFLE_VECTOR with smaller dest size

Legalize G_SHUFFLE_VECTOR having destination vector length smaller than
source vector length by reshaping destination vector.

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

16 months ago[ELF][PPC64] Merge PPC64R12SetupStub and PPC64PCRelPLTStub. NFC
Fangrui Song [Mon, 27 Feb 2023 22:33:18 +0000 (14:33 -0800)]
[ELF][PPC64] Merge PPC64R12SetupStub and PPC64PCRelPLTStub. NFC

PPC64PCRelPLTStub (from D83669) duplicates lot of code from
PPC64R12SetupStub. Just merge them.

Note: PPC64R12SetupStub does not correctly handle long branch to a
non-preemptible non-TOC code.

16 months ago[lld][WebAssembly] Fix handling of mixed strong and weak references
Sam Clegg [Fri, 24 Feb 2023 18:09:07 +0000 (10:09 -0800)]
[lld][WebAssembly] Fix handling of mixed strong and weak references

When adding a undefined symbols to the symbol table, if the existing
reference is weak replace the symbol flags with (potentially) non-weak
binding.

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

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