platform/upstream/llvm.git
20 months ago[X86] Make `(shift X (xor/sub N-1, Y))` -> `(shift X, (not Y))` check for one use.
Noah Goldstein [Wed, 1 Mar 2023 04:21:53 +0000 (22:21 -0600)]
[X86] Make `(shift X (xor/sub N-1, Y))` -> `(shift X, (not Y))` check for one use.

`(xor/sub N-1, Y)` -> `(not Y)` is minorly preferable (especially for
`(sub N-1, Y)` where it saves an instruction), but isn't worth
potentially creating an extra instruction for.

So, only do the transformation if `(xor/sub N-1, Y)` has one use.

Reviewed By: RKSimon

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

20 months ago[X86] Fix `(shift X, (xor Y, N-1))` -> `(shift X, (not Y))` by properly inserting...
Noah Goldstein [Tue, 28 Feb 2023 17:00:35 +0000 (11:00 -0600)]
[X86] Fix `(shift X, (xor Y, N-1))` -> `(shift X, (not Y))` by properly inserting `not Y` into DAG. [#61038]

Previously not inserting the `-1` in `not Y` (`xor Y, -1`) into the
DAG. Not inserting `-1` as a DAG node comes up as a bug when doing
`(xor (shl 1, A), B)` -> `(btc A, B)`. `btc` requires `B` (dst) to be
a register.

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

20 months ago[PowerPC] update PPCTTIImpl::supportsTailCallFor() check conditions
Ting Wang [Wed, 1 Mar 2023 03:29:16 +0000 (22:29 -0500)]
[PowerPC] update PPCTTIImpl::supportsTailCallFor() check conditions

This patch reuse `PPCTargetLowering::isEligibleForTCO()` to check
`PPCTTIImpl::supportsTailCallFor()`.

Fixes #59315

Reviewed By: shchenz

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

20 months agoRevert "[Modules] Don't check [temp.friend]p9 in ASTContext::isSameEntity"
Chuanqi Xu [Wed, 1 Mar 2023 03:18:58 +0000 (11:18 +0800)]
Revert "[Modules] Don't check [temp.friend]p9 in ASTContext::isSameEntity"

This reverts commit 74565c3add6d683559618973863e78a5e6836e48.

Since it looks like this one causes the modular libcxx build fails.

20 months agoRevert "[C++20] [Modules] Trying to compare the trailing require clause from the...
Chuanqi Xu [Wed, 1 Mar 2023 03:03:37 +0000 (11:03 +0800)]
Revert "[C++20] [Modules] Trying to compare the trailing require clause from the primary template function"

This reverts commit 9e50578ba43c49ee13ac3bb7d4868565824f9b29. Since it
looks like this one prevents us to fix the modular build for libcxx.

20 months ago[Doc][NFC] Add template type when use MachinePassRegistry.
Lian Wang [Wed, 1 Mar 2023 02:31:11 +0000 (02:31 +0000)]
[Doc][NFC] Add template type when use MachinePassRegistry.

Reviewed By: serge-sans-paille

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

20 months ago[COFF][X86_64] Put jump table in .rdata for Windows
Wei Xiao [Fri, 24 Feb 2023 06:33:15 +0000 (14:33 +0800)]
[COFF][X86_64] Put jump table in .rdata for Windows

Put jump table in .rdata for Windows to align with that for Linux.
It can avoid loading the same code page into I$ and D$ simultaneously
and thus favor performance.

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

20 months agoRevert "[ControlHeightReduction] Don't combine a "poison" branch"
Kazu Hirata [Wed, 1 Mar 2023 01:58:45 +0000 (17:58 -0800)]
Revert "[ControlHeightReduction] Don't combine a "poison" branch"

This reverts commit 38a64aab4a3fbaaeb383638ff654247902796556.

llvm-clang-x86_64-expensive-checks-debian is failing:

https://lab.llvm.org/buildbot/#/builders/16/builds/44249

20 months agoFix failed libcxx test build on the Windows to Linux cross builders. NFC.
Vladimir Vereschaka [Tue, 28 Feb 2023 19:47:59 +0000 (11:47 -0800)]
Fix failed libcxx test build on the Windows to Linux cross builders. NFC.

Disable `modules_include.sh.cpp` test on Windows build hosts,
it cannot be executed there anymore.

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

20 months agoFix the run locker setting for async launches that don't stop at the
Jim Ingham [Wed, 1 Mar 2023 01:14:46 +0000 (17:14 -0800)]
Fix the run locker setting for async launches that don't stop at the
initial stop.  The code was using PrivateResume when it should have
used Resume.

This was allowing expression evaluation while the target was running,
and though that was caught a litle later on, we should never have gotten
that far.  To make sure that this is caught immediately I made an error
SBValue when this happens, and test that we get this error.

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

20 months ago[mlir][math] Math expansion for math.tan
Robert Suderman [Wed, 1 Mar 2023 01:13:42 +0000 (01:13 +0000)]
[mlir][math] Math expansion for math.tan

We can implement a polynomial approximation of math.tan by
decomposing to `math.sin` and `math.cos`. While it is not
technically a polynomial approximation it should be the most
straight forward approximation.

Reviewed By: jpienaar

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

20 months ago[mlir][NFC] Address filecheck_lint findings in tosa-to-linalg-named.mlir.
Benjamin Chetioui [Wed, 1 Mar 2023 01:02:49 +0000 (01:02 +0000)]
[mlir][NFC] Address filecheck_lint findings in tosa-to-linalg-named.mlir.

Reviewed By: rsuderman

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

20 months agoFix typos in the test command for D144929
Jim Ingham [Wed, 1 Mar 2023 00:57:03 +0000 (16:57 -0800)]
Fix typos in the test command for D144929

20 months agoPut the arch-dep debugserver files in main CMakeLists.txt
Jason Molenda [Wed, 1 Mar 2023 00:55:29 +0000 (16:55 -0800)]
Put the arch-dep debugserver files in main CMakeLists.txt

The architecture dependent files for debugserver were
built out of their own separate CMakeLists.txt for historical
reasons; it's not necessary any longer.  Remove that file
and put them in the main debugserver CMakeLists.txt.

Differential Revision: https://reviews.llvm.org/D145020
rdar://105993317

20 months ago[Clang][CodeGen] Fix this argument type for certain destructors
Jacob Young [Wed, 1 Mar 2023 00:42:32 +0000 (16:42 -0800)]
[Clang][CodeGen] Fix this argument type for certain destructors

With the Microsoft ABI, some destructors need to offset a parameter to
get the derived this pointer, in which case the type of that parameter
should not be a pointer to the derived type.

Fixes #60465

20 months agoAn SBValue whose underlying ValueObject has no valid value, but does
Jim Ingham [Wed, 1 Mar 2023 00:38:50 +0000 (16:38 -0800)]
An SBValue whose underlying ValueObject has no valid value, but does
hold an error should:

(a) return false for IsValid, since that's the current behavior and is
    a convenient way to check "should I get the value for this".
(b) preserve the error when an SBValue is made from it, and print the
    error in the ValueObjectPrinter.

Make that happen.

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

20 months ago[builtins] Add option to always build int128 routines
Shoaib Meenai [Tue, 28 Feb 2023 21:13:45 +0000 (13:13 -0800)]
[builtins] Add option to always build int128 routines

32-bit targets don't build these by default, but e.g. armv7 and x86 can
build them just fine, and it's useful to have the int128 routines
available for certain applications. Add a CMake option to let us include
the int128 routines for architectures which would otherwise lack them.

Reviewed By: compnerd, MaskRay, phosek

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

20 months ago[ControlHeightReduction] Don't combine a "poison" branch
Kazu Hirata [Tue, 28 Feb 2023 20:35:55 +0000 (12:35 -0800)]
[ControlHeightReduction] Don't combine a "poison" branch

Without this patch, the control height reduction pass would combine a
"poison" branch with an earlier well-defined branch, turning the
earlier branch into a "poison" branch also.

This patch fixes the problem by rejecting "poison" conditional
branches.

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

20 months agoAdd SBCommandInterpreter::UserCommandExists parallel to CommandExists.
Jim Ingham [Tue, 28 Feb 2023 23:58:14 +0000 (15:58 -0800)]
Add SBCommandInterpreter::UserCommandExists parallel to CommandExists.

The latter only checks built-in commands.  I also added some docs to
make the distinction clear and a test.

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

20 months ago[OCaml] Migrate from naked pointers to prepare for OCaml 5
Alan Hu [Tue, 28 Feb 2023 22:22:27 +0000 (22:22 +0000)]
[OCaml] Migrate from naked pointers to prepare for OCaml 5

The OCaml bindings currently return pointers to LLVM objects as-is to
OCaml. These "naked pointers" end up appearing as values of local
variables in OCaml code, stored as part of other OCaml values,
etc. The safety of this design relies on the OCaml runtime system's
ability to distinguish these pointers from pointers to memory on the
OCaml garbage collected heap. In particular, when the OCaml GC
encounters a pointer to memory known to not be part of the OCaml heap,
it does not follow it.

In OCaml 4.02 an optimized "no naked pointers" mode was introduced
where the runtime system does not perform such checks and requires
that no such naked pointers be passed to OCaml code, instead one of
several encodings needs to be used. In OCaml 5, the no naked pointers
mode is now the only mode. This diff uses one of the potential
encodings to eliminate naked pointers, making the LLVM OCaml bindings
compatible with the "no naked pointers" mode of OCaml >= 4.02 and 5.

The encoding implemented in this diff relies on LLVM objects to be at
least 2-byte aligned, meaning that the lsb of pointers will
necessarily be clear. The encoding sets the lsb when passing LLVM
pointers to OCaml, and clears it on the return path. Setting the lsb
causes the OCaml runtime system to interpret the resulting value as a
tagged integer, which does not participate in garbage collection.

In some cases, particularly functions that receive an OCaml array of
LLVM pointers, this encoding requires allocation of a temporary array,
but otherwise this diff aims to preserve the existing performance
characteristics of the OCaml bindings.

Reviewed By: jberdine

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

20 months ago[X86] Revise Alderlake P-Core schedule model
Haohai Wen [Mon, 27 Feb 2023 06:42:56 +0000 (14:42 +0800)]
[X86] Revise Alderlake P-Core schedule model

The previous Alderlake P-Core model prefer data from uops.info than intel doc.
Some measures latency from uops.info is larger than real latency. e.g. addpd
latency is 3 in uops.info while 2 in intel doc. This patch adjust the priority
of those two data source so that intel doc is more preferable.

Reviewed By: RKSimon

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

20 months ago[Coroutines] Avoid creating conditional cleanup markers in suspend block
Wei Wang [Thu, 23 Feb 2023 22:53:49 +0000 (14:53 -0800)]
[Coroutines] Avoid creating conditional cleanup markers in suspend block

We shouldn't access coro frame after returning from `await_suspend()` and before `llvm.coro.suspend()`.
Make sure we always hoist conditional cleanup markers when inside the `await.suspend` block.

Fix https://github.com/llvm/llvm-project/issues/59181

Reviewed By: ChuanqiXu

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

20 months ago[Fuchsia] Enable LLVM_USE_RELATIVE_PATHS_IN_FILES in bootstrap
Haowei Wu [Tue, 28 Feb 2023 23:12:13 +0000 (15:12 -0800)]
[Fuchsia] Enable LLVM_USE_RELATIVE_PATHS_IN_FILES in bootstrap

This patch enables LLVM_USE_RELATIVE_PATHS_IN_FILES when building the
bootstrap toolchain for 2 stages build.

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

20 months ago[X86] Improve select of constants
Kazu Hirata [Sun, 5 Feb 2023 05:42:15 +0000 (21:42 -0800)]
[X86] Improve select of constants

Without this patch:

  %cmp = icmp eq i32 %a, %b
  %cond = select i1 %cmp, i32 1, i32 2

is compiled as:

  31 c9                      xor    %ecx,%ecx
  39 f7                      cmp    %esi,%edi
  0f 94 c1                   sete   %cl
  b8 02 00 00 00             mov    $0x2,%eax
  29 c8                      sub    %ecx,%eax

With this patch, the compiler generates:

  31 c0                      xor    %eax,%eax
  39 f7                      cmp    %esi,%edi
  0f 95 c0                   setne  %al
  ff c0                      inc    %eax

saving 5 bytes while reducing register usage.

This patch transforms C - setcc into inverted_setcc + (C-1) if C is a
nonzero constant.

This patch fixes:

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

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

20 months ago[GWP-ASan] Handle wild touches of the guarded pool.
Mitch Phillips [Tue, 28 Feb 2023 22:05:42 +0000 (14:05 -0800)]
[GWP-ASan] Handle wild touches of the guarded pool.

AllocMeta could be null when returned from __gwp_asan_get_metadata() for
a bad access into the GuardedPagePool that was never allocated.
Currently, then we dereference the null pointer, oops.

Hoist the check up and print a message (only once in recoverable mode)
about the bad memory access.

Reviewed By: fmayer

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

20 months agoRevert "[X86] Drop single use check for freeze(undef) in LowerAVXCONCAT_VECTORS"
ManuelJBrito [Tue, 28 Feb 2023 21:50:36 +0000 (21:50 +0000)]
Revert "[X86] Drop single use check for freeze(undef) in LowerAVXCONCAT_VECTORS"

This reverts commit 9e58182d6446bb61dbd13c0e6314f291e50d4d7c.

20 months ago[X86] Drop single use check for freeze(undef) in LowerAVXCONCAT_VECTORS
ManuelJBrito [Tue, 28 Feb 2023 21:37:30 +0000 (21:37 +0000)]
[X86] Drop single use check for freeze(undef) in LowerAVXCONCAT_VECTORS

Ignoring freeze(undef) if it has multiple uses in LowerAVXCONCAT_VECTORS
causes the custom INSERT_SUBVECTOR for vector widening to be ignored.

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

20 months agoUpdate debugserver xcode proj to build with c++17
Jason Molenda [Tue, 28 Feb 2023 21:36:12 +0000 (13:36 -0800)]
Update debugserver xcode proj to build with c++17

Also a few small fixes for building debugserver on iOS
in c++17.

20 months ago[ADT] Fix const-correctness issues in `zippy`
Jakub Kuderski [Tue, 28 Feb 2023 21:24:10 +0000 (16:24 -0500)]
[ADT] Fix const-correctness issues in `zippy`

This defines the iterator tuple based on the storage type of `zippy`,
instead of its type arguments. This way, we can support temporaries that
gets passed in and allow for them to be modified during iteration.

Because the iterator types to the tuple storage can have different types
when the storage is and isn't const, this defines a const iterator type
and non-const `begin`/`end` functions. This way we avoid unintentional
casts, e.g., trying to cast `vector<bool>::reference` to
`vector<bool>::const_reference`, which may be unrelated types that are
not convertible.

This patch is a general and free-standing improvement but my primary use
is in the implemention a version of `enumerate` that accepts multiple ranges:
D144583.

Reviewed By: dblaikie, zero9178

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

20 months ago[clang-format] Only add pragma continuation indentation for 'omp' clauses
Joseph Huber [Mon, 27 Feb 2023 16:35:30 +0000 (10:35 -0600)]
[clang-format] Only add pragma continuation indentation for 'omp' clauses

The patch in D136100 added custom handling for pragmas to assist in
formatting OpenMP clauses correctly. One of these changes added extra
indentation. This is desirable for OpenMP pragmas as they are several
complete tokens that would otherwise we on the exact same line. However,
this is not desired for the other pragmas.

This solution is extremely hacky, I'm not overly familiar with the
`clang-format` codebase. A better solution would probably require
actually parsing these as tokens, but I just wanted to propose a
solution.

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

Reviewed By: HazardyKnusperkeks

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

20 months ago[mlir][sparse] fix performance bug in matmul with a sparse rhs due to suboptimal...
Peiming Liu [Tue, 28 Feb 2023 01:18:12 +0000 (01:18 +0000)]
[mlir][sparse] fix performance bug in matmul with a sparse rhs due to suboptimal iteration graphs.

While dense tensors support random accesses, it is critical to visit them in a row-major order for better cache locality. However, we previously consider dense inputs and outputs together when computing constraints for building iteration graph, it could lead us to less efficient iteration graphs.

This patch adds a new `SortMask::kIncludeDenseInput` to treat dense inputs/outputs separately when building iteration graph, thus increasing the chance for use to construct a better iteration graph.

A more fine-grained approach is to treat each input separately.

Note, related to:
 https://github.com/llvm/llvm-project/issues/51651

Reviewed By: aartbik

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

20 months ago[lldb] Remove const qualifier on bool argument passed by value
Med Ismail Bennani [Tue, 28 Feb 2023 20:52:21 +0000 (12:52 -0800)]
[lldb] Remove const qualifier on bool argument passed by value

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
20 months ago[libc][NFC] Refactor internal errno.
Siva Chandra Reddy [Mon, 27 Feb 2023 22:27:35 +0000 (22:27 +0000)]
[libc][NFC] Refactor internal errno.

This is in preparation for the transition to a solution to make libc tests
hermetic with respect to their use of errno. The implementation of strdup
has been switched over to libc_errno as an example of what the code looks
like in the new way.

See #61037 for more information.

Reviewed By: lntue

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

20 months ago[OpenMP]Emit captured decls for target data if no devices were specified.
Alexey Bataev [Tue, 28 Feb 2023 19:17:21 +0000 (11:17 -0800)]
[OpenMP]Emit captured decls for target data if no devices were specified.

If use_device_ptr/use_device_addr clauses are used on target data
directive and no device was specified during the compilation, only host
part should be emitted. But it still required to emit captured decls for
partially mapped data fields.

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

20 months ago[test] Add missing -### to Driver/config-file3.c
Fangrui Song [Tue, 28 Feb 2023 20:16:28 +0000 (12:16 -0800)]
[test] Add missing -### to Driver/config-file3.c

Otherwise clang may invoke ld. If ld is a shell script using `~`, the
command will fail since `HOME` is changed.

20 months ago[Driver] Revert -mcpu=?/-mtune=? and make -mcpu=help/-mtune=help unnamed
Fangrui Song [Tue, 28 Feb 2023 20:06:36 +0000 (12:06 -0800)]
[Driver] Revert -mcpu=?/-mtune=? and make -mcpu=help/-mtune=help unnamed

Follow-up to D144914.
-mcpu=help seems fine as a Clang extension not in GCC, because llc supports -mcpu=help.
-mcpu=? is a bad choice as ? may be expanded by the shell.

20 months ago[AMDGPU] Replace LegacyDA with Uniformity Analysis in AnnotateUniformValues
Anshil Gandhi [Tue, 28 Feb 2023 20:03:44 +0000 (13:03 -0700)]
[AMDGPU] Replace LegacyDA with Uniformity Analysis in AnnotateUniformValues

Reviewed By: sameerds

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

20 months agoFix SimplifyAllocConst pattern when we have alloc of negative sizes
Mehdi Amini [Tue, 28 Feb 2023 20:00:45 +0000 (15:00 -0500)]
Fix SimplifyAllocConst pattern when we have alloc of negative sizes

This is UB, but we shouldn't crash the compiler either.

Fixes #61056

Reviewed By: jpienaar

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

20 months ago[lldb] Fix {break,watch}point command function stopping behaviour
Med Ismail Bennani [Tue, 28 Feb 2023 17:24:46 +0000 (09:24 -0800)]
[lldb] Fix {break,watch}point command function stopping behaviour

In order to run a {break,watch}point command, lldb can resolve to the
script interpreter to run an arbitrary piece of code or call into a
user-provided function. To do so, we will generate a wrapping function,
where we first copy lldb's internal dictionary keys into the
interpreter's global dictionary, copied inline the user code before
resetting the global dictionary to its previous state.

However, {break,watch}point commands can optionally return a value that
would tell lldb whether we should stop or not. This feature was
only implemented for breakpoint commands and since we inlined the user
code directly into the wrapping function, introducing an early return,
that caused lldb to let the interpreter global dictionary tinted with the
internal dictionary keys.

This patch fixes that issue while also adding the stopping behaviour to
watchpoint commands.

To do so, this patch refactors the {break,watch}point command creation
method, to let the lldb wrapper function generator know if the user code is
a function call or a arbitrary expression.

Then the wrapper generator, if the user input was a function call, the
wrapper function will call the user function and save the return value into
a variable. If the user input was an arbitrary expression, the wrapper  will
inline it into a nested function, call the nested function and save the
return value into the same variable. After resetting the interpreter global
dictionary to its previous state, the generated wrapper function will return
the varible containing the return value.

rdar://105461140

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
20 months ago[SLP] Add banner argument to SLP costs debug printer method - NFC.
Valery N Dmitriev [Tue, 28 Feb 2023 18:55:00 +0000 (10:55 -0800)]
[SLP] Add banner argument to SLP costs debug printer method - NFC.

Removed unnecessary warning workaround.

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

20 months ago[InstCombine] reassociate subtract-from-constant to add-constant
Sanjay Patel [Tue, 28 Feb 2023 19:18:28 +0000 (14:18 -0500)]
[InstCombine] reassociate subtract-from-constant to add-constant

(C - X) + Y --> (Y - X) + C

Moving the constant operand to an 'add' gives more
flexibility to subsequent reassociation patterns,
and it may be better for codegen on targets that
don't have subtract-from-immediate instructions.

20 months ago[IR] fix spelling/formatting; NFC
Sanjay Patel [Tue, 28 Feb 2023 16:14:11 +0000 (11:14 -0500)]
[IR] fix spelling/formatting; NFC

Even within this file, the usual spelling is 'Opcode',
so make it consistent.

20 months ago[InstCombine] simplify test for div/rem; NFC
Sanjay Patel [Tue, 28 Feb 2023 15:07:54 +0000 (10:07 -0500)]
[InstCombine] simplify test for div/rem; NFC

This is too conservative as noted in the TODO comment.

20 months ago[Sema] Add missing entries to the arrays in GetImplicitConversionName and GetConversi...
Craig Topper [Tue, 28 Feb 2023 19:16:45 +0000 (11:16 -0800)]
[Sema] Add missing entries to the arrays in GetImplicitConversionName and GetConversionRank.

It appears that ICK_Zero_Queue_Conversion was inserted into the ICK
enum without updating this table. Easy to do since the table size
was set to ICK_Num_Conversion_Kinds.

I've used ICR_Exact_Match to match what was previously done for
ICK_Zero_Event_Conversion that last time someone noticed this had happened.

To prevent this from happening again, I've removed the explicit size
and used a static_assert to check the size against ICK_Num_Conversion_Kinds.

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

20 months agoRevert "Revert "[Modules] Don't check [temp.friend]p9 in ASTContext::isSameEntity""
Mark de Wever [Tue, 28 Feb 2023 19:03:54 +0000 (20:03 +0100)]
Revert "Revert "[Modules] Don't check [temp.friend]p9 in ASTContext::isSameEntity""

This fixes the Clang modular CI, but breaks other CIs.

This reverts commit 2ae39902506f38d6368a7dbe3d64109f57ad6f99.

20 months ago[libc] fix strtofloat test with 128 bit floats
Michael Jones [Tue, 28 Feb 2023 18:58:02 +0000 (10:58 -0800)]
[libc] fix strtofloat test with 128 bit floats

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

20 months ago[clang][dataflow] Fix missed fields in field set construction.
Yitzhak Mandelbaum [Tue, 28 Feb 2023 18:19:40 +0000 (18:19 +0000)]
[clang][dataflow] Fix missed fields in field set construction.

When building the set of referenced fields for the `DataflowAnalysisContext`,
include fields referenced only in default member initializers. These
initializers are visited in the CFGs of constructors and so the fields must be
included when analysing constructor bodies.

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

20 months ago[libc] Refactor string to float return values
Michael Jones [Fri, 17 Feb 2023 19:14:37 +0000 (11:14 -0800)]
[libc] Refactor string to float return values

The internal implementation of the string to float function previously
used pointer arguments for returning several values. Additionally it
set errno in several unexpected places. Now all of that goes through
return structs. For readability I also moved the function away from raw
pointer arithmetic towards proper indexing. I also added support for
rounding modes.

Reviewed By: sivachandra

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

20 months ago[Clang][Driver] Add -mcpu=help and -mtune=help to clang
Michael Maitland [Mon, 27 Feb 2023 21:54:06 +0000 (13:54 -0800)]
[Clang][Driver] Add -mcpu=help and -mtune=help to clang

Clang currently uses `-mcpu=?` and `-mtune=?`. The `?` causes errors on some
shells such as zsh since it is a special character. In order for it to work on
shells such as zsh, the option must be passed in quotes or escaped. This patch
adds `-mcpu=help` and `-mtune=help` as another alias for `--print-supported-cpus`.
In llc, `-mcpu=help` is an alias to print supported cpus.

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

20 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.

20 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

20 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.

20 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

20 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

20 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

20 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.

20 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

20 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

20 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

20 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

20 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

20 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

20 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

20 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.

20 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

20 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

20 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

20 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.

20 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.

20 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

20 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

20 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

20 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.

20 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

20 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

20 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

20 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()

20 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

20 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

20 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.

20 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

20 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

20 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

20 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.

20 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.

20 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

20 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

20 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

20 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

20 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

20 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

20 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

20 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

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

20 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

20 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

20 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.

20 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

20 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

20 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