platform/upstream/llvm.git
21 months ago[VE] Fix useDeprecatedPositionallyEncodedOperands errors.
James Y Knight [Tue, 31 Jan 2023 21:33:31 +0000 (16:33 -0500)]
[VE] Fix useDeprecatedPositionallyEncodedOperands errors.

This is a follow-on to https://reviews.llvm.org/D134073.

Behavior is unchanged by this cleanup, except that previously the
'CVTRDm' pattern was accidentally getting the top bit of 'sz' from the
'sx' input, instead of setting it to 0.

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

21 months ago[ORC] Further improvements to SymbolStringPtr & NonOwningSymbolStringPtr.
Lang Hames [Tue, 31 Jan 2023 22:43:11 +0000 (14:43 -0800)]
[ORC] Further improvements to SymbolStringPtr & NonOwningSymbolStringPtr.

A follow-up to https://reviews.llvm.org/D142314:

* Make SymbolStringPtrs constructible from NonOwningSymbolStringPtrs.

* Move and rename getRefCount and isValid (now poolEntryIsAlive) to improve
readability. Also updates these routines to make them safe for use with
sentinel values (null, empty, tombstone).

* Move ref-counting operations into their own incRef and decRef methods.

21 months ago[hexagon] add a -mcabac flag
Brian Cain [Tue, 31 Jan 2023 02:25:42 +0000 (18:25 -0800)]
[hexagon] add a -mcabac flag

For v73 and later, clang users who wish to use the cabac instructions need
a way to add the 'cabac' target feature.

Reviewed By: kparzysz

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

21 months ago[mlir] Register tensor dialect for transfer_read conversion
Kai Sasaki [Tue, 31 Jan 2023 23:58:58 +0000 (08:58 +0900)]
[mlir] Register tensor dialect for transfer_read conversion

Make sure to register tensor dialect as tensor.transfer_read can be dependent on its parameter. It resolves the issue causing the unregisterd dialect error to convert vector to SCF reported https://github.com/llvm/llvm-project/issues/60197.

Reviewed By: ftynse

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

21 months ago[RISCV][NFC] Update RISCVUsage.rst to sort vendor extensions
Philipp Tomsich [Tue, 31 Jan 2023 20:34:06 +0000 (21:34 +0100)]
[RISCV][NFC] Update RISCVUsage.rst to sort vendor extensions

21 months ago[GlobalISel] Don't combine instructions with unknown type in hoist_logic_op_with_same...
Vladislav Dzhidzhoev [Fri, 27 Jan 2023 02:01:22 +0000 (03:01 +0100)]
[GlobalISel] Don't combine instructions with unknown type in hoist_logic_op_with_same_opcode_hands.

This fixes failure for some LLVM IR.

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

21 months ago[lld][WebAssembly] Apply relocations to TLS data
Sam Clegg [Tue, 31 Jan 2023 21:33:29 +0000 (13:33 -0800)]
[lld][WebAssembly] Apply relocations to TLS data

This is only needed in the case of dynamic linking and pthreads.
Previously these relocations were simply not being applied.

Verified that this works using a more real world emscripten test:
https://github.com/emscripten-core/emscripten/pull/18641

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

21 months ago[lldb] Use ${CMAKE_COMMAND} -E remove instead of remove_directory
Jonas Devlieghere [Tue, 31 Jan 2023 23:33:46 +0000 (15:33 -0800)]
[lldb] Use ${CMAKE_COMMAND} -E remove instead of remove_directory

We no longer need to remove a directory downstream and also contrary to
my previous observations, remove_directory isn't sufficient to remove a
regular file.

Differential revision: https://reviews.llvm.org/D143024

21 months ago[libc++][ranges] Fix incorrect integer typedef in `elements_view` test.
Konstantin Varlamov [Tue, 31 Jan 2023 23:27:07 +0000 (15:27 -0800)]
[libc++][ranges] Fix incorrect integer typedef in `elements_view` test.

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

21 months ago[libc++] Use bounded iterators in std::string_view when the debug mode is enabled
Louis Dionne [Mon, 30 Jan 2023 15:57:26 +0000 (10:57 -0500)]
[libc++] Use bounded iterators in std::string_view when the debug mode is enabled

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

21 months agocompiler-rt/lib: Add .Linterceptor_sigsetjmp
H.J. Lu [Tue, 31 Jan 2023 22:30:55 +0000 (14:30 -0800)]
compiler-rt/lib: Add .Linterceptor_sigsetjmp

Older GNU assemblers generate R_X86_64_PC32 relocation against
defined non-weak global branch targets with default visibility.  A
linker may issue an error when building a shared library.  Add a local
alias, .Linterceptor_sigsetjmp, to __interceptor_sigsetjmp to avoid
R_X86_64_PC32 relocation for "jmp __interceptor_sigsetjmp" with older
GNU assemblers.

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

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

21 months ago[ORC] Add a NonOwningSymbolStringPtr utility.
Lang Hames [Sun, 22 Jan 2023 18:30:15 +0000 (10:30 -0800)]
[ORC] Add a NonOwningSymbolStringPtr utility.

Introduces a non-owning SymbolStringPool entry pointer. Instances of the new
type can be compared with SymbolStringPtr instances, but do not participate in
ref-counting and are therefore cheaper to copy. This makes it efficient to use
in algorithms that use symbol-strings as ids, e.g. ORC's waiting-on graph. A
future commit will rewrite ORC's waiting-on graph.

Reviewed By: dblaikie

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

21 months ago[DWARF] Fix handling of .debug_aranges with -g1
Alex Yermolovich [Tue, 31 Jan 2023 22:12:02 +0000 (14:12 -0800)]
[DWARF] Fix handling of .debug_aranges with -g1

Old behavior was to add to .debug_aranges only when we create a DIE. As the
result we could end up in situation where DW_AT_ranges have addresses that are
not in .debug_aranges. This has caused issues for LLDB: D136395.

Changed it to add addresses to .debug_aranges even when DIE is not created.

Reviewed By: dblaikie

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

21 months agoFix two warnings introduced by 69011a2ad0ce "[mlir][Linalg] Make Elementwise op fusio...
Jorge Gorbe Moya [Tue, 31 Jan 2023 21:49:07 +0000 (13:49 -0800)]
Fix two warnings introduced by 69011a2ad0ce "[mlir][Linalg] Make Elementwise op fusion return a map from existing values to values in the fused op." (NFCI)

- a -Wunused-result from ignoring a LogicalResult return value.
- an unused variable

21 months ago[VPlan] VPPredInstPHIRecipe does not read from memory.
Florian Hahn [Tue, 31 Jan 2023 21:51:03 +0000 (21:51 +0000)]
[VPlan] VPPredInstPHIRecipe does not read from memory.

VPPredInstPHIRecipe just merges the incoming values and does not write
to memory.

21 months ago[libc] Build two different static archives libc.a and libm.a under full build.
Siva Chandra Reddy [Tue, 31 Jan 2023 05:31:18 +0000 (05:31 +0000)]
[libc] Build two different static archives libc.a and libm.a under full build.

We currently put everything in one single archive libc.a which breaks in
certain situations where the compiler drivers expect libm.a also. With
this change, we separate out libc.a and libm.a functions as is done
conventionally and put them in two different static archives.

One will now have to build two targets, `libc` and `libm` which produce
`libc.a` and `libm.a` respectively. Under default build, one still builds only
one target named `libc` which produces `libllvmlibc.a`.

Reviewed By: jhuber6

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

21 months ago[lld][WebAssembly] Renamed a few tests to conform to naming convention. NFC
Sam Clegg [Tue, 31 Jan 2023 20:17:18 +0000 (12:17 -0800)]
[lld][WebAssembly] Renamed a few tests to conform to naming convention. NFC

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

21 months ago[gn build] Port 486729ce06c1
LLVM GN Syncbot [Tue, 31 Jan 2023 21:17:27 +0000 (21:17 +0000)]
[gn build] Port 486729ce06c1

21 months ago[RISCV] Move RISCVELFStreamer::getRelocPairForSize to RISCVFixUpKinds.h and reuse...
Craig Topper [Tue, 31 Jan 2023 21:09:56 +0000 (13:09 -0800)]
[RISCV] Move RISCVELFStreamer::getRelocPairForSize to RISCVFixUpKinds.h and reuse it. NFC

Reuse it for RISCVAsmBackend.cpp.
While there make the function return a pair of MCFixupKind to
remove static_casts elsewhere.

Reviewed By: reames

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

21 months ago[RISCV] Remove unneeded code from TTI::isLegalMaskedLoadStore/isLegalMaskedGatherScatter.
Craig Topper [Tue, 31 Jan 2023 20:44:42 +0000 (12:44 -0800)]
[RISCV] Remove unneeded code from TTI::isLegalMaskedLoadStore/isLegalMaskedGatherScatter.

We don't need to explicitly check ELEN. It's already handled by
isLegalElementTypeForRVV.

This is a leftover from before we had Zve32/64 extensions and used
a command line option for fixed vectors.

21 months ago[GVN] Don't count debug instructions when limit the number of checked instructions
Guozhi Wei [Tue, 31 Jan 2023 21:01:02 +0000 (21:01 +0000)]
[GVN] Don't count debug instructions when limit the number of checked instructions

Don't count debug instructions when limit the number of checked instructions.
Otherwise the debug information may impact optimization like the test case
shows.

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

21 months agoRe-land: [MTE] Add AArch64GlobalsTagging Pass
Mitch Phillips [Tue, 31 Jan 2023 20:28:28 +0000 (12:28 -0800)]
Re-land: [MTE] Add AArch64GlobalsTagging Pass

Adds an IR pass for -fsanitize=memtag-globals. This pass goes over the
tag-capable global variables, and replaces them with a tagged global
variable of the same contents. This new global variable will have its
size and alignment adjusted if neccesary so that they're both a multiple
of the tag granule size (16 bytes).

Global merge must also be suppressed for tagged globals, as each global
variable must have a unique tag. This can possibly be relaxed in future;
globals that are identical in size, alignment, and content can possibly
be merged. The major problem comes from tail- or head-merging, which if
left unchecked, could have partially-overlapping global variables with
different memory tags, leading to crashes at runtime.

Reviewed By: fmayer, eugenis

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

21 months ago[lldb][NFC] Remove copy of debugserver entitlements plist
Alex Langford [Tue, 31 Jan 2023 20:57:12 +0000 (12:57 -0800)]
[lldb][NFC] Remove copy of debugserver entitlements plist

An exact copy of this file exists in debugserver's resource directory
and this one is unused.

21 months agoFix Clang sphinx build
Aaron Ballman [Tue, 31 Jan 2023 20:41:09 +0000 (15:41 -0500)]
Fix Clang sphinx build

This addresses the issue found by:
https://lab.llvm.org/buildbot/#/builders/92/builds/39458

and it also fixes a follow-on error with building the RST.

21 months ago[gn build] Port e9c49901a43f
LLVM GN Syncbot [Tue, 31 Jan 2023 20:34:50 +0000 (20:34 +0000)]
[gn build] Port e9c49901a43f

21 months ago[gn build] Port 04ed86ff1b72
LLVM GN Syncbot [Tue, 31 Jan 2023 20:34:49 +0000 (20:34 +0000)]
[gn build] Port 04ed86ff1b72

21 months ago[gn] prepare for 40025761564 (awkward AMDGPUGenRegisterBank.inc include)
Nico Weber [Tue, 31 Jan 2023 20:34:18 +0000 (15:34 -0500)]
[gn] prepare for 40025761564 (awkward AMDGPUGenRegisterBank.inc include)

21 months ago[mlir][Linalg] Make Elementwise op fusion return a map from existing values to values...
Mahesh Ravishankar [Tue, 31 Jan 2023 20:33:19 +0000 (20:33 +0000)]
[mlir][Linalg] Make Elementwise op fusion return a map from existing values to values in the fused op.

This replacement can be used to eliminate all uses of the
producer/consumer for case where producer/consumer has other uses
outside of the producer/consumer pair. This makes the
producer/consumer dead.

Add test and minor fixup to the test harness.

Reviewed By: hanchung

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

21 months ago[Clang] Adjust PIC handling for the AMDGPU ToolChain
Joseph Huber [Tue, 31 Jan 2023 18:52:02 +0000 (12:52 -0600)]
[Clang] Adjust PIC handling for the AMDGPU ToolChain

The AMDGPU target only emits shared libraries currently. This patch
changes the handling of the PIC level to be managed in the
AMDGPUToolChain rather than having a special case for it. This causes
`--target=amdgcn--` to no longer set the PIC. This should be an
acceptable change since that doesn't use a correct toolchain anyway.

Reviewed By: arsenm

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

21 months agoRevert "[MTE] Add AArch64GlobalsTagging Pass"
Mitch Phillips [Tue, 31 Jan 2023 20:25:58 +0000 (12:25 -0800)]
Revert "[MTE] Add AArch64GlobalsTagging Pass"

This reverts commit 4edfcff71e150770675a19576f698c7bbe788ee2.

Broke the non-aarch64-containing target builds.
https://reviews.llvm.org/D133392 has more context.

21 months ago[gn] port 226c444b3882e
Nico Weber [Tue, 31 Jan 2023 20:17:46 +0000 (15:17 -0500)]
[gn] port 226c444b3882e

21 months ago[llvm-c-test] Fix warnings
Kazu Hirata [Tue, 31 Jan 2023 20:15:04 +0000 (12:15 -0800)]
[llvm-c-test] Fix warnings

This patch fixes:

  llvm/tools/llvm-c-test/metadata.c:49:16: error: unused variable
  'tmp' [-Werror,-Wunused-variable]

  llvm-project/llvm/tools/llvm-c-test/metadata.c:70:16: error: unused
  variable 'md' [-Werror,-Wunused-variable]

  llvm/tools/llvm-c-test/metadata.c:74:16: error: unused variable
  'md2' [-Werror,-Wunused-variable]

21 months agoRevert "[OpenMP][OMPIRBuilder]Move SIMD alignment calculation to LLVM Frontend"
Argyrios Kyrtzidis [Tue, 31 Jan 2023 20:01:32 +0000 (12:01 -0800)]
Revert "[OpenMP][OMPIRBuilder]Move SIMD alignment calculation to LLVM Frontend"

Causes clang build failures, see https://reviews.llvm.org/D141910#4089465 for details.

This reverts commit ca446037af019d1aa01b1352a30a18df33038359.

21 months ago[clang-format] Fix use after free in FormatTokenSource test
Benjamin Kramer [Tue, 31 Jan 2023 19:59:42 +0000 (20:59 +0100)]
[clang-format] Fix use after free in FormatTokenSource test

Add a lifetime annotation to IndexedTokenSource so we get a warning for
this pattern.

21 months ago[InstCombine] reduce icmp_ne0-of-and-of-select-of-constants
Sanjay Patel [Tue, 31 Jan 2023 19:29:57 +0000 (14:29 -0500)]
[InstCombine] reduce icmp_ne0-of-and-of-select-of-constants

Follow-up to:
D142847 / 98855059674c

This handles the 'ne' variant by inverting the result.

https://alive2.llvm.org/ce/z/D229jS

21 months ago[InstCombine] add tests for icmp-ne0-of-and-of-select-of-constants; NFC
Sanjay Patel [Tue, 31 Jan 2023 19:13:00 +0000 (14:13 -0500)]
[InstCombine] add tests for icmp-ne0-of-and-of-select-of-constants; NFC

21 months ago[-Wunsafe-buffer-usage] Introduce the unsafe_buffer_usage attribute
Rashmi Mudduluru [Tue, 31 Jan 2023 19:43:34 +0000 (11:43 -0800)]
[-Wunsafe-buffer-usage] Introduce the unsafe_buffer_usage attribute

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

21 months ago[AArch64] Make nosimd imply nocrypto
David Green [Tue, 31 Jan 2023 19:17:22 +0000 (19:17 +0000)]
[AArch64] Make nosimd imply nocrypto

This adds a quick check for -neon, making it imply the same as -crypto,
which helps get some features correct in more cases.

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

21 months ago[MemProf] Make test more resilient to cpu scheduling
Teresa Johnson [Tue, 31 Jan 2023 19:01:42 +0000 (11:01 -0800)]
[MemProf] Make test more resilient to cpu scheduling

Loosen up the matching so that occasional cpu migrations don't break the
test. This showed up occasionally in internal testing.

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

21 months ago[flang] Use fir.type_desc and delay type desc address resolution
Valentin Clement [Tue, 31 Jan 2023 19:09:56 +0000 (20:09 +0100)]
[flang] Use fir.type_desc and delay type desc address resolution

Makes use of fir.type_desc in order to delay the type desc address
resolution. The lowering inserts fir.type_desc operation instead of fir.addr_of
operation pointing to the fir.global type descriptor. The fir.type_desc
operation is then lowered in code gen to an address of operation in the LLVM
dialect. At this stage, the type descriptor is generated in all cases.

Reviewed By: vdonaldson

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

21 months ago[NFC][libc++] Addresses LWG3781.
Mark de Wever [Mon, 30 Jan 2023 18:09:30 +0000 (19:09 +0100)]
[NFC][libc++] Addresses LWG3781.

  LWG3781 The exposition-only alias templates cont-key-type and
  cont-mapped-type should be removed

Libc++ never implemented these aliases.

Reviewed By: #libc, philnik, ldionne

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

21 months ago[libc++] Addresses LWG3755.
Mark de Wever [Mon, 30 Jan 2023 17:30:03 +0000 (18:30 +0100)]
[libc++] Addresses LWG3755.

  LWG3755 tuple-for-each can call user-defined operator,

Reviewed By: #libc, ldionne, philnik

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

21 months ago[libc++] Marks LWG2970 as complete.
Mark de Wever [Sun, 29 Jan 2023 14:11:56 +0000 (15:11 +0100)]
[libc++] Marks LWG2970 as complete.

  LWG2970 Return type of std::visit misspecified

Was applied in D86006 including tests.

Reviewed By: #libc, ldionne

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

21 months ago[libc++] Partly addresses LWG3798.
Mark de Wever [Sat, 21 Jan 2023 12:38:43 +0000 (13:38 +0100)]
[libc++] Partly addresses LWG3798.

  LWG3798 Rvalue reference and iterator_category

The changes are only applied to `ranges::transform_view`, the other
views haven't been implemented yet.

Reviewed By: #libc, ldionne

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

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

  LWG3764 reference_wrapper::operator() should propagate noexcept

As drive-by adds constexpr to the synopsis, since it has already been
implemented.

Reviewed By: #libc, ldionne

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

21 months ago[NFC][libc++][format] Uses retarget buffer.
Mark de Wever [Sun, 29 Jan 2023 12:40:58 +0000 (13:40 +0100)]
[NFC][libc++][format] Uses retarget buffer.

Lets the tuple formatter use the retarget buffer added for the range
formatter.

Reviewed By: #libc, ldionne

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

21 months ago[lldb] Fix warning about unhandled enum value `WasmExternRef` (NFC).
Jorge Gorbe Moya [Tue, 31 Jan 2023 18:25:15 +0000 (10:25 -0800)]
[lldb] Fix warning about unhandled enum value `WasmExternRef` (NFC).

21 months ago[mlir][sparse] Extend sorting function generator to support operand beyond (lo, hi...
bixia1 [Tue, 31 Jan 2023 16:36:29 +0000 (08:36 -0800)]
[mlir][sparse] Extend sorting function generator to support operand beyond (lo, hi, xs, ys).

This is to prepare for implementing a hybrid quick sort, which switches to heap
sort when the recursive depth exceeds certain limits.

Reviewed By: aartbik

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

21 months ago[libc++] Fixes the Clang modular build.
Mark de Wever [Fri, 27 Jan 2023 07:02:09 +0000 (08:02 +0100)]
[libc++] Fixes the Clang modular build.

The patch
430b397f6715d4d2f2569716c93fcd6292ace3dc ("[libc++] Granularize <type_traits> includes in <iterator>") missed some exports in the modulemap with became apparent in the reverting commit 12cb1cb3720d.

This fixes the issue by updating the modulemap. Note that the Clang ICE is not fixed by this change.

Reviewed By: #libc, ldionne

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

21 months ago[mlir][Linalg] Add a transform.structured.lower_pack op
Nicolas Vasilache [Fri, 27 Jan 2023 16:24:14 +0000 (08:24 -0800)]
[mlir][Linalg] Add a transform.structured.lower_pack op

This revision introduces `transform.structured.lower_pack` which allows
rewriting a `tensor.pack` to `tensor.pad` + `tensor.expand_shape` + `linalg.transpose`.

The implementation is currently limited to static pack ops that do not have outer_dims permutations.

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

21 months ago[Kaleidoscope] Update code snippets in text to match full code listings
Dhruv Chawla [Tue, 31 Jan 2023 17:56:53 +0000 (23:26 +0530)]
[Kaleidoscope] Update code snippets in text to match full code listings

There were quite a few places in the tutorial where the snippets were not up to date with the full code listings given. I have updated all of the ones I could find, which mostly involves changing `.` to `->` when accessing through a `std::unique_ptr`, changing `while (1)` to `while (true)`, and other such small changes.

There are still however a few places where I am not sure what to do, such as:
- Chapter 4: `ParseTopLevelExpr()` in chapter 3 sets the ProtoTypeAST
             name to "", however it is referred to as "__anon_expr"
             in chapter 4. Would it be required to mention this change
             in chapter 4?
- Chapter 9: The code snippets refer to the top level expression as
             "main", however the full code listing refers to it as
             "__anon_expr". I think given the context of the chapter
             it makes sense to refer to it as "main", so I have
             updated the code listing to reflect that.
- Chapter 9: In chapter 9 the diff given for `HandleTopLevelExpression()`
             deletes code that is not mentioned anywhere else, so I am
             not sure what is to be done there.
- Miscellaneous: I don't think this is very important, however the
                 casing used for the first word of error messages
                 tends to vary between upper and lower case between
                 chapters and I do not know if it is worth reconciling
                 these differences.

Reviewed By: xgupta

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

21 months ago[llvm-c] add LLVMReplaceMDNodeOperandWith
Davide Bertola [Tue, 31 Jan 2023 17:02:50 +0000 (09:02 -0800)]
[llvm-c] add LLVMReplaceMDNodeOperandWith

I'm working on a tool that visits debug info and massages it using the
llvm-c API. I noticed that LLVMGetOperand special cases MDNodes so I
can get their operands, but I can't replace them. This patch adds
LLVMReplaceMDNodeOperandWith which boils down to
MDNode::replaceOperandWith.

The name was chosen for consistency with LLVMGetMDNodeOperands and
LLVMGetMDNodeNumOperands.

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

21 months ago[AST] assert(false) -> llvm_unreachable
Benjamin Kramer [Tue, 31 Jan 2023 17:55:58 +0000 (18:55 +0100)]
[AST] assert(false) -> llvm_unreachable

Has the advantage of not triggering missing return warnings even in
NDEBUG builds.

21 months ago[Clang] Do not attempt to directly link arch tools in 32-bit mode
Joseph Huber [Tue, 31 Jan 2023 17:55:05 +0000 (11:55 -0600)]
[Clang] Do not attempt to directly link arch tools in 32-bit mode

Summary:
We offer almost no support for offloading on 32-bit systems. This causes
some problems when cross-compiling for 32-bit machines as it will find
the CUDA from the host that is incompatible. Instead we force these to
always use the dynamically loaded version, which should always compile.

21 months ago[Clang] Add machinery to catch overflow in unary minus outside of a constant expressi...
Shafik Yaghmour [Tue, 31 Jan 2023 17:33:06 +0000 (09:33 -0800)]
[Clang] Add machinery to catch overflow in unary minus outside of a constant expression context

We provide several diagnostics for various undefined behaviors due to signed
integer overflow outside of a constant expression context. We were missing the
machinery to catch overflows due to unary minus.

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

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

21 months ago[llvm-ifs] Add support for --target=riscv
Alex Brachet [Tue, 31 Jan 2023 17:31:35 +0000 (17:31 +0000)]
[llvm-ifs] Add support for --target=riscv

21 months ago[MTE] Add AArch64GlobalsTagging Pass
Mitch Phillips [Tue, 31 Jan 2023 17:24:13 +0000 (09:24 -0800)]
[MTE] Add AArch64GlobalsTagging Pass

Adds an IR pass for -fsanitize=memtag-globals. This pass goes over the
tag-capable global variables, and replaces them with a tagged global
variable of the same contents. This new global variable will have its
size and alignment adjusted if neccesary so that they're both a multiple
of the tag granule size (16 bytes).

Global merge must also be suppressed for tagged globals, as each global
variable must have a unique tag. This can possibly be relaxed in future;
globals that are identical in size, alignment, and content can possibly
be merged. The major problem comes from tail- or head-merging, which if
left unchecked, could have partially-overlapping global variables with
different memory tags, leading to crashes at runtime.

Reviewed By: fmayer, eugenis

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

21 months ago[RISCV] Handle FRMArg as an optional operand instead of using InstAliases.
Craig Topper [Tue, 31 Jan 2023 17:08:13 +0000 (09:08 -0800)]
[RISCV] Handle FRMArg as an optional operand instead of using InstAliases.

Instead of having InstAliases without operand. Use the optional
operand infrastructure.

Still use the PrintAliases/NoAlias controls to determine if we
print "dyn" or not.

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

21 months ago[clang][WebAssembly] Initial support for reference type externref in clang
Paulo Matos [Mon, 9 Jan 2023 14:15:12 +0000 (15:15 +0100)]
[clang][WebAssembly] Initial support for reference type externref in clang

This patch introduces a new type __externref_t that denotes a WebAssembly opaque
reference type. It also implements builtin __builtin_wasm_ref_null_extern(),
that returns a null value of __externref_t. This lays the ground work
for further builtins and reference types.

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

21 months ago[flang] Single entry point for GET_ENVIRONMENT_VARIABLE
Leandro Lupori [Thu, 19 Jan 2023 17:45:19 +0000 (17:45 +0000)]
[flang] Single entry point for GET_ENVIRONMENT_VARIABLE

This patch refactors the runtime support for GET_ENVIRONMENT_VARIABLE
to have a single entry point instead of 2. It also updates lowering
accordingly.

This makes it easier to handle dynamically optional arguments.
See also https://reviews.llvm.org/D118777

Reviewed By: jeanPerier

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

21 months ago[SanitizerBinaryMetadata] Pretend compiler-generated loads/stores are atomic
Marco Elver [Tue, 31 Jan 2023 16:28:23 +0000 (17:28 +0100)]
[SanitizerBinaryMetadata] Pretend compiler-generated loads/stores are atomic

Profiling and GCOV generate known data-racy loads/stores. Pretend they
are atomic so that analysis using PC-keyed metadata for atomics do not
report them as data races (which would look like false positives).

Reviewed By: dvyukov

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

21 months ago[flang] Suppress a warning in D118631 [-Wunused-result]
Shao-Ce SUN [Tue, 31 Jan 2023 16:24:43 +0000 (00:24 +0800)]
[flang] Suppress a warning in D118631 [-Wunused-result]

Reviewed By: klausler

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

21 months ago[flang] More subscript triplet checking at compilation time
Peter Klausler [Mon, 30 Jan 2023 22:37:48 +0000 (14:37 -0800)]
[flang] More subscript triplet checking at compilation time

When a triplet's lower and upper bounds are the same, we can
check them without requiring a constant stride.

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

21 months ago[flang] Handle missing substring upper bound better when folding
Peter Klausler [Tue, 31 Jan 2023 00:06:09 +0000 (16:06 -0800)]
[flang] Handle missing substring upper bound better when folding

When folding a substring of a named constant or character literal,
acquire the value of a missing upper bound from the base object.

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

21 months ago[clangd] Add semantic token for angle brackets
Christian Kandeler [Wed, 20 Jul 2022 08:57:59 +0000 (10:57 +0200)]
[clangd] Add semantic token for angle brackets

This is needed for clients that would like to visualize matching
opening and closing angle brackets, which can be valuable in non-trivial
template declarations or instantiations.
It is not possible to do this with simple lexing, as the tokens
could also refer to operators.

Reviewed By: kadircet

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

21 months ago[clang-format][NFC] Bring FormatTokenSource under test.
Manuel Klimek [Tue, 31 Jan 2023 16:03:26 +0000 (16:03 +0000)]
[clang-format][NFC] Bring FormatTokenSource under test.

Add tests for FormatTokenSource and harden it against edge cases.

21 months ago[BranchRelaxation] Strengthen post condition assertions
Philip Reames [Tue, 31 Jan 2023 15:50:40 +0000 (07:50 -0800)]
[BranchRelaxation] Strengthen post condition assertions

The whole point of this pass is to rewrite branches so that branches are in bounds. We should assert that we succeeded rather than just that we kept our internal data structure in sync.

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

21 months ago[flang][driver] Add support for -embed-offload-object flag in flang
Jan Sjodin [Fri, 20 Jan 2023 19:33:22 +0000 (14:33 -0500)]
[flang][driver] Add support for -embed-offload-object flag in flang

This patch adds support for the -embed-offload-object flag to embed offloading
binaries in host code. This flag is identical to the clang flag with the same name.

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

Reviewed By: awarzynski, jhuber6

21 months ago[mlir][SubElements] Disambiguate cast<> call for MSVC
Benjamin Kramer [Tue, 31 Jan 2023 15:34:41 +0000 (16:34 +0100)]
[mlir][SubElements] Disambiguate cast<> call for MSVC

For some reason MSVC selects Attribute::cast here, and then fails to
call it because it takes no arguments. Feels like a generic lambda compiler
bug.

mlir/include\mlir/IR/StorageUniquerSupport.h(135): error C2672: 'mlir::Attribute::cast': no matching overloaded function found

21 months ago[PowerPC] Do not convert lwz to lwa if the offset is not a multiple of 4
Nemanja Ivanovic [Tue, 31 Jan 2023 15:52:13 +0000 (09:52 -0600)]
[PowerPC] Do not convert lwz to lwa if the offset is not a multiple of 4

The transform that converts this checks the alignment of the global
object being accessed. However, there was no check for the offset
within the global object which caused the compiler to produce a
DS relocation for an unaligned address.

21 months ago[RISCV] Add asserts that we don't increase codesize during pseudo expansion
Philip Reames [Tue, 31 Jan 2023 15:44:53 +0000 (07:44 -0800)]
[RISCV] Add asserts that we don't increase codesize during pseudo expansion

We currently assume that pseudo expansion doesn't increase the distance between a branch and it's label. This patch adds some asserts to catch violations of this property in pseudo expansion.

I chose to only do the assertion at the function level as we have to scan the whole function for size changes (since expansion can create multiple blocks). We could cache individual block sizes, and thus make the check cheap enough to do after every expansion, but that requires more complex code.

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

21 months ago[LLDB] Do not dereference promise pointer in `coroutine_handle` pretty printer
Adrian Vogelsgesang [Tue, 31 Jan 2023 13:16:04 +0000 (05:16 -0800)]
[LLDB] Do not dereference promise pointer in `coroutine_handle` pretty printer

So far, the pretty printer for `std::coroutine_handle` internally
dereferenced the contained frame pointer displayed the `promise`
as a sub-value. As noticed in https://reviews.llvm.org/D132624
by @labath, this can lead to an endless loop in lldb during printing
if the coroutine frame pointers form a cycle.

This commit breaks the cycle by exposing the `promise` as a pointer
type instead of a value type. The depth to which the `frame variable`
and the `expression` commands dereference those pointers can be
controlled using the `--ptr-depth` argument.

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

21 months ago[AArch64][SME2] Add LLVM IR intrinsics for multi-single dots
David Sherwood [Tue, 31 Jan 2023 15:18:58 +0000 (15:18 +0000)]
[AArch64][SME2] Add LLVM IR intrinsics for multi-single dots

Adds intrinsics for the following SME2 instructions:

* sdot (multi-single, 2 and 4 vectors, 32-bit and 64-bit ZA)
* udot (multi-single, 2 and 4 vectors, 32-bit and 64-bit ZA)
* usdot (multi-single, 2 and 4 vectors)
* sudot (multi-single, 2 and 4 vectors)
* fdot (multi-single, 2 and 4 vectors)
* bfdot (multi-single, 2 and 4 vectors)

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

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

21 months ago[clang][CGCall] Remove header file not used. [NFCI]
Francesco Petrogalli [Tue, 31 Jan 2023 15:11:58 +0000 (16:11 +0100)]
[clang][CGCall] Remove header file not used. [NFCI]

Reviewed By: fpetrogalli

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

21 months ago[reland][NFC] Transition GlobalObject alignment from MaybeAlign to Align
Guillaume Chatelet [Tue, 31 Jan 2023 15:02:46 +0000 (15:02 +0000)]
[reland][NFC] Transition GlobalObject alignment from MaybeAlign to Align

This is a follow up on https://reviews.llvm.org/D142459#4081179.
This first patch adds an overload to `GlobalObject::setAlignment` that accepts an `Align` type.
This already handles most of the calls.

This patch also converts a few call sites to the new type when this is safe.

Here is the list of the remaining call sites:

 - [clang/lib/CodeGen/CodeGenModule.cpp:1688](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/clang/lib/CodeGen/CodeGenModule.cpp#L1688)
 - [llvm/lib/AsmParser/LLParser.cpp:1309](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/AsmParser/LLParser.cpp#L1309)
 - [llvm/lib/AsmParser/LLParser.cpp:6050](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/AsmParser/LLParser.cpp#L6050)
 - [llvm/lib/Bitcode/Reader/BitcodeReader.cpp:3871](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Bitcode/Reader/BitcodeReader.cpp#L3871)
 - [llvm/lib/Bitcode/Reader/BitcodeReader.cpp:4030](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Bitcode/Reader/BitcodeReader.cpp#L4030)
 - [llvm/lib/IR/Core.cpp:2018](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/IR/Core.cpp#L2018)
 - [llvm/lib/IR/Globals.cpp:141](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/IR/Globals.cpp#L141)
 - [llvm/lib/Linker/IRMover.cpp:660](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Linker/IRMover.cpp#L660)
 - [llvm/lib/Linker/LinkModules.cpp:361](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Linker/LinkModules.cpp#L361)
 - [llvm/lib/Linker/LinkModules.cpp:362](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Linker/LinkModules.cpp#L362)
 - [llvm/lib/Transforms/IPO/MergeFunctions.cpp:782](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Transforms/IPO/MergeFunctions.cpp#L782)
 - [llvm/lib/Transforms/IPO/MergeFunctions.cpp:840](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Transforms/IPO/MergeFunctions.cpp#L840)
 - [llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp:1813](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp#L1813)
 - [llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp:27](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp#L27)

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

21 months ago[clang-format][NFC] Move IndexedTokenSource to FormatTokenSource header.
Manuel Klimek [Tue, 31 Jan 2023 15:06:20 +0000 (15:06 +0000)]
[clang-format][NFC] Move IndexedTokenSource to FormatTokenSource header.

Finish refactoring of the token sources towards a single location.

21 months ago[flang] Improve error message for move_alloc
David Truby [Mon, 30 Jan 2023 15:48:45 +0000 (15:48 +0000)]
[flang] Improve error message for move_alloc

This patch improves the error message when MOVE_ALLOC is passed the same
allocated allocatable as both the to and from arguments.

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

21 months ago[Clang] Improve error message for violations of -fmodules-decluse.
James Y Knight [Mon, 30 Jan 2023 20:05:29 +0000 (15:05 -0500)]
[Clang] Improve error message for violations of -fmodules-decluse.

Now it reports the name of the indirectly-used module which is
missing.

Reviewed By: ChuanqiXu

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

21 months ago[LiveDebugValues] Allow EntryValue with OP_deref expressions
Felipe de Azevedo Piovezan [Thu, 26 Jan 2023 17:47:03 +0000 (12:47 -0500)]
[LiveDebugValues] Allow EntryValue with OP_deref expressions

With D68945, more DBG_VALUEs were created without the indirect operand,
instead relying on OP_deref to accomplish the same effect.

At the time, however, we were not able to handle arbitrary expressions
in combination with OP_LLVM_entry_value, so D71416 prevented the use of
such operation in the presence of expressions.

As per the comment in DIExpression::isValid, "we support only entry
values of a simple register location." As such, a simple deref operation
should be supported. In fact, D80345 added support for indirect
DBG_VALUEs.

Taken the patches above into consideration, this commit relaxes the
restrictions on which expressions are allowed for entry value
candidates: the expression must be either empty or a single dereference
operator.

This patch is useful for D141381, which adds support for storing the
address of ABI-indirect parameters on the stack.

Depends on D142160

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

21 months ago[clang-format][NFC] Pull FormatTokenSource into its own header.
Manuel Klimek [Tue, 31 Jan 2023 13:55:44 +0000 (13:55 +0000)]
[clang-format][NFC] Pull FormatTokenSource into its own header.

Prepare getting FormatTokenSource under unit testing.

21 months ago[mlir] multi-argument binding for top-level transform ops
Alex Zinenko [Wed, 25 Jan 2023 16:53:25 +0000 (16:53 +0000)]
[mlir] multi-argument binding for top-level transform ops

`applyTransforms` now takes an optional mapping to be associated with
trailing block arguments of the top-level transform op, in addition to
the payload root. This allows for more advanced forms of communication
between C++ code and the transform dialect interpreter, in particular
supplying operations without having to re-match them during
interpretation.

Reviewed By: shabalin

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

21 months ago[OpenMP][FIX] Properly check assume only uses
Johannes Doerfert [Tue, 31 Jan 2023 11:33:49 +0000 (03:33 -0800)]
[OpenMP][FIX] Properly check assume only uses

We improved our simplification and this exposed a bug in the store
elimination. A load that had dead uses and assume uses was thought to be
used by assumes only. Consequently we also deleted the "dead use users".
This was a problem because a dead use just means we will not use the
load there. The user might still be needed.

Exposed by OvO, reported by @ye-luo.

21 months agoRevert D142708 "[NFC] Transition GlobalObject alignment from MaybeAlign to Align"
Guillaume Chatelet [Tue, 31 Jan 2023 14:10:25 +0000 (14:10 +0000)]
Revert D142708 "[NFC] Transition GlobalObject alignment from MaybeAlign to Align"

This is breaking the build bots. e.g.,
https://lab.llvm.org/buildbot/#/builders/121/builds/27549

This reverts commit 6717efe74da825214cb4d307ad35e5fbda353301.

21 months ago[NFC] Transition GlobalObject alignment from MaybeAlign to Align
Guillaume Chatelet [Fri, 27 Jan 2023 12:53:40 +0000 (12:53 +0000)]
[NFC] Transition GlobalObject alignment from MaybeAlign to Align

This is a follow up on https://reviews.llvm.org/D142459#4081179.
This first patch adds an overload to `GlobalObject::setAlignment` that accepts an `Align` type.
This already handles most of the calls.

This patch also converts a few call sites to the new type when this is safe.

Here is the list of the remaining call sites:

 - [clang/lib/CodeGen/CodeGenModule.cpp:1688](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/clang/lib/CodeGen/CodeGenModule.cpp#L1688)
 - [llvm/lib/AsmParser/LLParser.cpp:1309](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/AsmParser/LLParser.cpp#L1309)
 - [llvm/lib/AsmParser/LLParser.cpp:6050](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/AsmParser/LLParser.cpp#L6050)
 - [llvm/lib/Bitcode/Reader/BitcodeReader.cpp:3871](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Bitcode/Reader/BitcodeReader.cpp#L3871)
 - [llvm/lib/Bitcode/Reader/BitcodeReader.cpp:4030](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Bitcode/Reader/BitcodeReader.cpp#L4030)
 - [llvm/lib/IR/Core.cpp:2018](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/IR/Core.cpp#L2018)
 - [llvm/lib/IR/Globals.cpp:141](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/IR/Globals.cpp#L141)
 - [llvm/lib/Linker/IRMover.cpp:660](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Linker/IRMover.cpp#L660)
 - [llvm/lib/Linker/LinkModules.cpp:361](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Linker/LinkModules.cpp#L361)
 - [llvm/lib/Linker/LinkModules.cpp:362](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Linker/LinkModules.cpp#L362)
 - [llvm/lib/Transforms/IPO/MergeFunctions.cpp:782](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Transforms/IPO/MergeFunctions.cpp#L782)
 - [llvm/lib/Transforms/IPO/MergeFunctions.cpp:840](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Transforms/IPO/MergeFunctions.cpp#L840)
 - [llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp:1813](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp#L1813)
 - [llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp:27](https://github.com/llvm/llvm-project/blob/e195e6bad6706230a4b5fd4b5cc13de1f16f25cc/llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp#L27)

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

21 months ago[MLIR] Split `generalize-tensor-pack.mlir` (NFC)
Lorenzo Chelini [Mon, 30 Jan 2023 07:06:28 +0000 (08:06 +0100)]
[MLIR] Split `generalize-tensor-pack.mlir` (NFC)

Follow a suggestion after landing https://reviews.llvm.org/D140060.
Having RUN in the middle of the file is difficult to find; split the
test into two.

Reviewed By: hanchung

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

21 months ago[GuardWidening] Choose right point for generating wide condition for branches. PR6023...
Max Kazantsev [Tue, 31 Jan 2023 11:41:25 +0000 (18:41 +0700)]
[GuardWidening] Choose right point for generating wide condition for branches. PR60234. Take 2

There was a crash because there was inconsistency between 'isAvailableAt'
and 'makeAvailableAt' queries. 'makeAvailableAt' is called on conditions
of both guards (dominating and dominated) and 'isAvailableAt' is called
only for dominated guard's condition. Before this patch, it didn't matter
because insertion point always matched the dominating guard. Now, because
they are different, this inconsistency leads to incorrect transforms which
are caught by assert.

The fix is to check 'isAvailableAt' for both conditions.

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

21 months ago[RISCV] Implement isMultiStoresCheaperThanBitsMerge hook
Alex Bradbury [Tue, 31 Jan 2023 12:46:52 +0000 (12:46 +0000)]
[RISCV] Implement isMultiStoresCheaperThanBitsMerge hook

Grabs the same logic and reasoning from the X86 implementation of the
hook. The benefit is slightly less clear for when the soft float ABI is
used (i.e. there's no transfer from an FPR to a GPR), but I've opted not
to gate it based on ABI.

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

21 months ago[flang] derived-type finalization
Valentin Clement [Tue, 31 Jan 2023 12:46:12 +0000 (13:46 +0100)]
[flang] derived-type finalization

This patch implements the derived-type finalization for
monomorphic and polymorphic derived-type.

The finalization is done through a call to the `Destroy`
runtime function so the allocatable component object are also
finalized correctly when needed. It would be possible to finalize
monomorphic derived-type with non finalizable component with a
direct call to their finalize subroutine.

7.5.6.3 point 1: LHS nonallocatable object and LHS allocatable
object finalization. Done with call to `Destroy` for monomorphic
derived-type and through `Assign` for polymorphic entities.

7.5.6.3 point 2: Done within the deallocation calls.

7.5.6.3 point 3: A function context is added to the bridge to
attach finalization that need to happen on function/subroutine
exit.

7.5.6.3 point 4: BLOCK construct not yet implemented.

7.5.6.3 point 5/6: Finalization attach to the stmtCtx in a
similar way than 9.7.3.2 point 4.

7.5.6.3 point 7: INTENT(OUT) finalization done with a
call to `Destroy` runtime function call.

This patch passes 9/10 tests in the proposed test-suite
https://github.com/llvm/llvm-test-suite/pull/13

- The case with BLOCK construct will be implemented later when
  BLOCK are implemented upstream.

- Automatic deallocation is not yet implemented. Finalization triggered
  by automatic deallocation is then not triggered.

Reviewed By: jeanPerier, PeteSteinfeld

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

21 months ago[RISCV][test] Add tests ahead of isMultiStoresCheaperThanBitsMerge hook implementation
Alex Bradbury [Tue, 31 Jan 2023 12:40:47 +0000 (12:40 +0000)]
[RISCV][test] Add tests ahead of isMultiStoresCheaperThanBitsMerge hook implementation

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

21 months agoDAG: Remove redundant check for return alignment
Matt Arsenault [Mon, 30 Jan 2023 22:51:01 +0000 (18:51 -0400)]
DAG: Remove redundant check for return alignment

This is already what the CallBase getRetAlign does

21 months ago[AMDGPU] Use tablegen to list uniform intrinsics
Yashwant Singh [Tue, 31 Jan 2023 12:13:42 +0000 (17:43 +0530)]
[AMDGPU] Use tablegen to list uniform intrinsics

Right now we do opcode wise matching to identify uniform/non-divergent
AMDGPU intrinsics. It is duplicated at 2 places once at IR level uniformity analysis
and at MIR level. Moving them to single tablegen table for consistency and adding
and API rapper to access them.

Reviewed By: arsenm, #amdgpu

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

21 months ago[AArch64][SME2] Add multi-vector min/max intrinsics
Kerry McLaughlin [Tue, 31 Jan 2023 11:47:56 +0000 (11:47 +0000)]
[AArch64][SME2] Add multi-vector min/max intrinsics

Adds intrinsics for the following SME2 instructions:
 - smax, umax, fmax (single, 2 & 4 vector)
 - smax, umax, fmax (multi, 2 & 4 vector)
 - smin, umin, fmin (single, 2 & 4 vector)
 - smin, umin, fmin (multi, 2 & 4 vector)

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

Reviewed By: david-arm

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

21 months ago[LoongArch] Add baseline test for (X & Y) == Y and (X & Y) != Y
gonglingqin [Tue, 31 Jan 2023 09:47:54 +0000 (17:47 +0800)]
[LoongArch] Add baseline test for (X & Y) == Y and (X & Y) != Y

Add baseline testing for upcoming optimization patches according the
guideline https://reviews.llvm.org/rG1d6d1ecca7ec.

21 months ago[AArch64][SME2] Add SME2 outer product intrinsics
Kerry McLaughlin [Tue, 31 Jan 2023 10:50:51 +0000 (10:50 +0000)]
[AArch64][SME2] Add SME2 outer product intrinsics

Adds intrinsics for the following:
 - smopa / smops
 - umopa / umops
 - bmopa / bmops

Tests for existing SME mopa/mops intrinsics have also been updated
to use the maximum allowed ZA tile number.

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

Reviewed By: david-arm

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

21 months ago[3/3][Clang][RISCV] Add `__riscv_` for overloaded intrinsics
eopXD [Fri, 27 Jan 2023 09:46:11 +0000 (01:46 -0800)]
[3/3][Clang][RISCV] Add `__riscv_` for overloaded intrinsics

This commit adds prefix for the overloaded RVV intrinsics.

This is the 3rd commit of a patch-set to add __riscv_ for all RVV
intrinsics.

This follows the naming guideline under riscv-c-api-doc to add the
`__riscv_` suffix for all RVV intrinsics.

Pull Request:
riscv-non-isa/riscv-c-api-doc#31
riscv-non-isa/rvv-intrinsic-doc#189

Depends on D142644.

Reviewed By: kito-cheng

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

21 months ago[Test] Add motivating test for revert of fix of PR60234
Max Kazantsev [Tue, 31 Jan 2023 11:33:19 +0000 (18:33 +0700)]
[Test] Add motivating test for revert of fix of PR60234

21 months ago[mlir][bufferization] Fix failing lit test
Maya Amrami [Tue, 31 Jan 2023 10:56:59 +0000 (12:56 +0200)]
[mlir][bufferization] Fix failing lit test

Checks were too strict and by the time the patch was submitted,
the output of the test changed.

Reviewed By: springerm

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

21 months ago[Polly] Fix tests (NFC)
Nikita Popov [Tue, 31 Jan 2023 11:05:14 +0000 (12:05 +0100)]
[Polly] Fix tests (NFC)

Missed in 5f01a626dd0615df49773d419c75aeb33666ee83.

21 months ago[PowerPC] Improve materialization for immediates which is almost a 32 bit splat.
esmeyi [Tue, 31 Jan 2023 11:02:17 +0000 (06:02 -0500)]
[PowerPC] Improve materialization for immediates which is almost a 32 bit splat.

Summary: Some 64 bit constants can be materialized with fewer instructions than we currently use. We consider a 64 bit immediate value divided into four parts, Hi16OfHi32 (bits 48...63), Lo16OfHi32 (bits 32...47), Hi16OfLo32 (bits 16...31), Lo16OfLo32 (bits 0...15). When any three parts are equal, the immediate can be treated as "almost" a splat of a 32 bit value in a 64 bit register. For such case, we can use 3 instructions to generate the splat and use 1 instruction to modify the different part:

Reviewed By: shchenz

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

21 months ago[bazel] Add missing includes for 5212058
Goran Flegar [Tue, 31 Jan 2023 10:41:35 +0000 (11:41 +0100)]
[bazel] Add missing includes for 5212058