platform/upstream/llvm.git
23 months ago[NFC] Remove no-op code from x86AssemblyInspectionEngine::jmp_to_reg_p
Jason Molenda [Tue, 2 Aug 2022 23:26:46 +0000 (16:26 -0700)]
[NFC] Remove no-op code from x86AssemblyInspectionEngine::jmp_to_reg_p

Slava Gurevich noticed this dead code I wrote in jmp_to_reg_p
is never executed, is duplicated, and has comments that seem to
describe the opposite behavior.  Remove the dead code that cannot
be executed.

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

23 months agoRevert "[lldb][modules] Disable Clang Modules in source/Host directory on macOS"
Jonas Devlieghere [Tue, 2 Aug 2022 22:51:25 +0000 (15:51 -0700)]
Revert "[lldb][modules] Disable Clang Modules in source/Host directory on macOS"

This reverts commit 7cf4ab13af8aa3183e551b3319399cddd9384948 as it was a
temporary workaround that's no longer needed.

23 months ago[LLDB][NFC] Fix incorrect return status Some functions always return 'false' for...
Slava Gurevich [Tue, 2 Aug 2022 18:54:52 +0000 (11:54 -0700)]
[LLDB][NFC] Fix incorrect return status Some functions always return 'false' for both success and fail return paths.

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

23 months ago[LLDB] Add SBInstruction::GetControlFlowKind()
Jakob Johnson [Tue, 2 Aug 2022 18:26:24 +0000 (11:26 -0700)]
[LLDB] Add SBInstruction::GetControlFlowKind()

D128477 adds the control flow kind for `Instruction` and displays this
in the `thread trace dump instruction -k` command.

This diff exposes the control flow kind via the new
`SBInstruction::GetControlFlowKind` method.

I've expanded `TestDisassembleRawData` to test this method, but please
let me know if there are any other unittests that should also be updated.

Test Plan:
`./bin/lldb-dotest -p TestDisassembleRawData`

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

23 months agoFix use-after-free in SymbolTable::replaceAllSymbolUses
Mehdi Amini [Tue, 2 Aug 2022 22:18:36 +0000 (22:18 +0000)]
Fix use-after-free in SymbolTable::replaceAllSymbolUses

In some cases the recursion will grow the `visited` hash table and
invalidate the cached iterator.
(caught with ASAN)

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

23 months ago[RISCV] Fix operand number in debug message in RISCVMergeBaseOffset.
Craig Topper [Tue, 2 Aug 2022 22:26:25 +0000 (15:26 -0700)]
[RISCV] Fix operand number in debug message in RISCVMergeBaseOffset.

This used to print from the ADDI where the operand number was
correct. It recently changed to print from the LUI or AUIPC which
needs to use operand 1 instead of 2.

This shows up as a crash with -debug.

23 months ago[Libomptarget] Deinitialize AMDGPU global state more intentionally
Joseph Huber [Tue, 2 Aug 2022 18:52:47 +0000 (14:52 -0400)]
[Libomptarget] Deinitialize AMDGPU global state more intentionally

A previous patch made the destruction of the HSA plugin more
deterministic. However, there were still other global values that are not
handled this way. When attempting to call a destructor kernel, the
device would have already been uninitialized and we could not find the
appropriate kernel to call. This is because they were stored in global
containers that had their destructors called already. Merges this global
state into the rest of the info state by putting those global values
inside of the global pointer already allocated and deallocated by the
constructor and destructor. This should allow the AMDGPU plugin to
correctly identify the destructors if we were to run them.

Reviewed By: JonChesterfield

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

23 months ago[OpenMP][libomp] Detect if test compiler has omp.h
Jonathan Peyton [Mon, 1 Aug 2022 18:43:18 +0000 (13:43 -0500)]
[OpenMP][libomp] Detect if test compiler has omp.h

omp50_taskdep_depobj.c relies on the test compiler's omp.h file.
If the test compiler does not have an omp.h file, then use the one
within the build tree.

Fixes: https://github.com/llvm/llvm-project/issues/56820
Differential Revision: https://reviews.llvm.org/D131000

23 months ago[DX] Remove IntrNoMem from create handle intrinsic
Chris Bieneman [Tue, 2 Aug 2022 21:55:46 +0000 (16:55 -0500)]
[DX] Remove IntrNoMem from create handle intrinsic

The create handle intrinsic calls can't be removed, so it was incorrect
to mark them as IntrNoMem.

23 months agoCommandLine: add and use cl::SubCommand::get{All,TopLevel}
Nicolai Hähnle [Wed, 29 Jun 2022 10:32:45 +0000 (12:32 +0200)]
CommandLine: add and use cl::SubCommand::get{All,TopLevel}

Prefer using these accessors to access the special sub-commands
corresponding to the top-level (no subcommand) and all sub-commands.

This is a preparatory step towards removing the use of ManagedStatic:
with a subsequent change, these global instances will be moved to
be regular function-scope statics.

It is split up to give downstream projects a (albeit short) window in
which they can switch to using the accessors in a forward-compatible
way.

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

23 months ago[flang] Add semantics test for ERROR STOP statement
Naje George [Sat, 16 Jul 2022 00:39:00 +0000 (17:39 -0700)]
[flang] Add semantics test for ERROR STOP statement

Reviewed By: ktras

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

23 months agoInline my uuid_is_null() implementation in a header file
Jason Molenda [Tue, 2 Aug 2022 21:23:00 +0000 (14:23 -0700)]
Inline my uuid_is_null() implementation in a header file

This either needs to be static, or forced inline, or in a separate
source file.  Given that we only have one function in this
UuidCompatibility.h, I think forced inline for the handful of uses
of it may be best.

23 months ago[LLD] [MachO] Fix GCC build warnings
Martin Storsjö [Tue, 2 Aug 2022 07:29:01 +0000 (10:29 +0300)]
[LLD] [MachO] Fix GCC build warnings

This fixes the following warnings produced by GCC 9:

    ../tools/lld/MachO/Arch/ARM64.cpp: In member function ‘void {anonymous}::OptimizationHintContext::applyAdrpLdr(const lld::macho::OptimizationHint&)’:
    ../tools/lld/MachO/Arch/ARM64.cpp:448:18: warning: comparison of integer expressions of different signedness: ‘int64_t’ {aka ‘long int’} and ‘uint64_t’ {aka ‘long unsigned int’} [-Wsign-compare]
      448 |   if (ldr.offset != (rel1->referentVA & 0xfff))
          |       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../tools/lld/MachO/UnwindInfoSection.cpp: In function ‘bool canFoldEncoding(compact_unwind_encoding_t)’:
    ../tools/lld/MachO/UnwindInfoSection.cpp:404:44: warning: comparison between ‘enum<unnamed>’ and ‘enum<unnamed>’ [-Wenum-compare]
      404 |   static_assert(UNWIND_X86_64_MODE_MASK == UNWIND_X86_MODE_MASK, "");
          |                                            ^~~~~~~~~~~~~~~~~~~~
    ../tools/lld/MachO/UnwindInfoSection.cpp:405:49: warning: comparison between ‘enum<unnamed>’ and ‘enum<unnamed>’ [-Wenum-compare]
      405 |   static_assert(UNWIND_X86_64_MODE_STACK_IND == UNWIND_X86_MODE_STACK_IND, "");
          |                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~

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

23 months agoAllow firmware binaries to be specified only by load address
Jason Molenda [Tue, 2 Aug 2022 21:13:20 +0000 (14:13 -0700)]
Allow firmware binaries to be specified only by load address

Add support to Mach-O corefiles and to live gdb remote serial protocol
connections for the corefile/remote stub to provide a list of load
addresses of binaries that should be found & loaded by lldb, and nothing
else.  lldb will try to parse the binary out of memory, and if it can
find a UUID, try to find a binary & its debug information based on the
UUID, falling back to using the memory image if it must.

A bit of code unification from three parts of lldb that were loading
individual binaries already, so there is a shared method in
DynamicLoader to handle all of the variations they were doing.

Re-landing this with a uuid_is_null() implementation added to
Utility/UuidCompatibility.h for non-Darwin systems.

Differential Revision: https://reviews.llvm.org/D130813
rdar://94249937
rdar://94249384

23 months agoworkflows: Release Workflow - Avoid selecting random reviewers when no phab review
Tom Stellard [Tue, 2 Aug 2022 16:35:36 +0000 (16:35 +0000)]
workflows: Release Workflow - Avoid selecting random reviewers when no phab review

If you pass a NULL reivew ID to the differential.revision.search API,
it returns all revisions and we were just taking the first one and
assuming it was associated with the commit in the PR.

We need to exit early if we can't find a Phabricator review associated
with a commit.

23 months ago[gn build] Port 95a92995d45f
LLVM GN Syncbot [Tue, 2 Aug 2022 21:01:56 +0000 (21:01 +0000)]
[gn build] Port 95a92995d45f

23 months ago[mlir][GPU] Allow bare pointer memrefs when calling GPU kernels
Krzysztof Drewniak [Mon, 11 Jul 2022 18:29:01 +0000 (18:29 +0000)]
[mlir][GPU] Allow bare pointer memrefs when calling GPU kernels

In the ROCm runtime (and probably CUDA as well), all kernel arguments
are aligned. Therefore, enable using bare pointers for memref
arguments to kernels when these memrefs have static shape and a
trivial layout.

This is a substantial optimization to launching kernels that use
memrefs with known, static sizes, since it causes the kernel launch
packet to no longer include information already known to the kernel,
which can enable packing the kernel launch arguments into launch
packets instead of having to allocate an entire separate structure to
hold unneeded memref information.

Reviewed By: ftynse

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

23 months agoAdds the NSDateFormatter checker to clang-tidy
Rashmi Mudduluru [Tue, 2 Aug 2022 20:53:50 +0000 (13:53 -0700)]
Adds the NSDateFormatter checker to clang-tidy

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

23 months agoRevert "Allow firmware binaries to be specified only by load address"
Jason Molenda [Tue, 2 Aug 2022 20:53:34 +0000 (13:53 -0700)]
Revert "Allow firmware binaries to be specified only by load address"

This reverts commit d8879fba8825b9799166ba0ea552d4027bfb8ad1.

Debian bot failure; I included <uuid/uuid.h> to get uuid_is_null() but
don't get it there.  Will memcmp or whatever & recommit.

23 months agoAllow firmware binaries to be specified only by load address
Jason Molenda [Tue, 2 Aug 2022 20:46:18 +0000 (13:46 -0700)]
Allow firmware binaries to be specified only by load address

Add support to Mach-O corefiles and to live gdb remote serial protocol
connections for the corefile/remote stub to provide a list of load
addresses of binaries that should be found & loaded by lldb, and nothing
else.  lldb will try to parse the binary out of memory, and if it can
find a UUID, try to find a binary & its debug information based on the
UUID, falling back to using the memory image if it must.

A bit of code unification from three parts of lldb that were loading
individual binaries already, so there is a shared method in
DynamicLoader to handle all of the variations they were doing.

Differential Revision: https://reviews.llvm.org/D130813
rdar://94249937
rdar://94249384

23 months ago[AMDGPU] Add llvm_unreachable to switch statement added in d7100b398.
Austin Kerbow [Tue, 2 Aug 2022 20:41:02 +0000 (13:41 -0700)]
[AMDGPU] Add llvm_unreachable to switch statement added in d7100b398.

23 months ago[nfc] Remove unused parameter in TailDuplicator::duplicateSimpleBB
Mircea Trofin [Tue, 2 Aug 2022 19:14:24 +0000 (12:14 -0700)]
[nfc] Remove unused parameter in TailDuplicator::duplicateSimpleBB

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

23 months agoFix use-after-free in clang-apply-replacements
Ben Langmuir [Tue, 2 Aug 2022 20:33:12 +0000 (13:33 -0700)]
Fix use-after-free in clang-apply-replacements

Accidentally introduced a dangling StringRef in b4c6dc2e6637.

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

23 months ago[AMDGPU] Add GCNMaxILPSchedStrategy
Austin Kerbow [Sat, 30 Jul 2022 14:40:11 +0000 (07:40 -0700)]
[AMDGPU] Add GCNMaxILPSchedStrategy

Creates a new scheduling strategy that attempts to maximize ILP for a single
wave.

Reviewed By: rampitec

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

23 months ago[libc++] Update documentation on testing libc++
Louis Dionne [Tue, 2 Aug 2022 20:15:55 +0000 (16:15 -0400)]
[libc++] Update documentation on testing libc++

23 months ago[LLDB][NFC] Fix LLDB_WATCH_TYPE_IS_VALID macro
Slava Gurevich [Tue, 2 Aug 2022 08:33:01 +0000 (01:33 -0700)]
[LLDB][NFC] Fix LLDB_WATCH_TYPE_IS_VALID macro

LLDB_WATCH_TYPE_IS_VALID would always return true when validating watchpoint type
by using bitwise-or instead of bitwise-and to apply validation flags.

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

23 months ago[mlir][sparse] enable SDDMM-flavored fusion
Aart Bik [Tue, 2 Aug 2022 16:37:44 +0000 (09:37 -0700)]
[mlir][sparse] enable SDDMM-flavored fusion

This rewriting was no longer functional after recent migration to one shot
bufferization. However, this revision makes it work again, with a CHECK test
to ensure fusion happens. Note that functionality is tested by several
integration tests.

Reviewed By: Peiming

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

23 months ago[NFC][DirectX backend] Fix crash when emit_obj for DirectX backend.
Xiang Li [Sun, 31 Jul 2022 21:15:28 +0000 (14:15 -0700)]
[NFC][DirectX backend] Fix crash when emit_obj for DirectX backend.

When emit-obj from clang directly, DirectX backend will hit assert caused by not initialize passes for AsmPrinter.
The fix will initialize the passes by calling createPassConfig.
Also ignore global variable which not has section in DXILAsmPrinter::emitGlobalVariable to avoid hit llvm_unreachable in DXILTargetObjectFile::SelectSectionForGlobal.

Reviewed By: beanz

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

23 months ago[libcxx][test] Test code should inspect `TEST_STD_VER`, not `_LIBCPP_STD_VER`.
Casey Carter [Tue, 2 Aug 2022 19:03:25 +0000 (12:03 -0700)]
[libcxx][test] Test code should inspect `TEST_STD_VER`, not `_LIBCPP_STD_VER`.

23 months ago[SemaCXX] Validate destructor is valid for dependent classes
Roy Jacobson [Mon, 1 Aug 2022 20:47:30 +0000 (23:47 +0300)]
[SemaCXX] Validate destructor is valid for dependent classes

We didn't check that a destructor's name matches the directly enclosing class if the class was dependent.
I enabled the check we already had for non-dependent types, which seems to work. Added appropriate tests.

Fixes GitHub issue #56772

Reviewed By: erichkeane

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

23 months ago[CodeGen][inlineasm] assume the flag output of inline asm is boolean value
Yuanfang Chen [Fri, 29 Jul 2022 21:50:40 +0000 (14:50 -0700)]
[CodeGen][inlineasm] assume the flag output of inline asm is boolean value

GCC inline asm document says that
"... the general rule is that the output variable must be a scalar
integer, and the value is boolean."

Commit e5c37958f901cc9bec50624dbee85d40143e4bca lowers flag output of
inline asm on X86 with setcc, hence it is guaranteed that the flag
is of boolean value. Clang does not support ARM inline asm flag output
yet so nothing need to be worried about ARM.

See "Flag Output" section at
https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#OutputOperands

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

Reviewed By: nikic

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

23 months ago[mlir][sparse] remove singleton dimension level type (for now)
Aart Bik [Tue, 2 Aug 2022 17:36:05 +0000 (10:36 -0700)]
[mlir][sparse] remove singleton dimension level type (for now)

Although we have plans to support this, and many other, dimension level type(s), currently the tag is not supported. It will be easy to add this back once support is added.

NOTE: based on discussion in https://discourse.llvm.org/t/overcoming-sparsification-limitation-on-level-types/62585

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

Reviewed By: Peiming

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

23 months ago[libc++][format] Exposes basic-format-string
Mark de Wever [Fri, 15 Jul 2022 05:42:17 +0000 (07:42 +0200)]
[libc++][format] Exposes basic-format-string

This paper was accepted during the last plenary and is intended to be
backported to LLVM 15. When backporting the release notes in the branch
should be updated too.

Note the feature-test macro isn't updated since this will change; three
papers have updated the same macro in the same plenary.

Implements:
- P2508R1 Exposing std::basic-format-string

Reviewed By: ldionne, #libc

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

23 months agoThis patch fixes these errors while building BOLT.
Sriraman Tallam [Tue, 2 Aug 2022 18:21:36 +0000 (11:21 -0700)]
This patch fixes these errors while building BOLT.

Compiling llvm/llvm-project/bolt/include/bolt/Passes/RegReAssign.h failed:
...: error: invalid application of 'sizeof' to an incomplete type 'llvm::bolt::BinaryFunctionCallGraph'

static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type");
error: type 'llvm::bolt::BinaryBasicBlock *' cannot be used prior to '::' because it has no members

using NodeRef = typename GraphType::UnknownGraphTypeError;
BinaryDomTree.h:31:14: error: no template named 'DomTreeGraphTraitsBase'

: public DomTreeGraphTraitsBase<bolt::BinaryDomTreeNode,

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

23 months ago[MLIR] Rename the generic LLVM allocation and deallocation functions
Michele Scuttari [Tue, 2 Aug 2022 18:21:05 +0000 (18:21 +0000)]
[MLIR] Rename the generic LLVM allocation and deallocation functions

The generic allocation and deallocation instructions, which are optionally used during the MemRef -> LLVM conversion, should have a name that is specifically bound to their origin, that is the conversion pass itself.

Reviewed By: silvas

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

23 months ago[libc++][doc] Update spaceship status page
Adrian Vogelsgesang [Tue, 2 Aug 2022 18:08:18 +0000 (20:08 +0200)]
[libc++][doc] Update spaceship status page

    * `operator<=>` for `iota_view::iterator` was enabled in 8320017b79eb8
    * Removed P2405R0 which was not accepted and seems inactive
      (https://github.com/cplusplus/papers/issues/1075)
    * Added the previously missing `operator==` for `filesystem::space_info`
      to the tracking list.
    * Updated the "Assignee" for `string_view`, `string` as Mark de Wever
      mentioned he is working on them in Discord
    * Updated the status of the items for which I sent review requests
      yesterday.

Reviewed By: #libc, Mordante

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

23 months ago[StandardInstrumentations] Assign names to basic blocks without names
Arthur Eubanks [Tue, 26 Jul 2022 17:18:57 +0000 (10:18 -0700)]
[StandardInstrumentations] Assign names to basic blocks without names

Fixes code in OrderedChangedData<T>::report which assumes that a string will only appear once in Before/After.

Reviewed By: jamieschmeiser

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

23 months ago[test] Update BoundsChecking/simple.ll
Arthur Eubanks [Tue, 2 Aug 2022 16:45:58 +0000 (09:45 -0700)]
[test] Update BoundsChecking/simple.ll

Use opaque pointers and update_test_checks.py

Precommit a test

23 months ago[GIsel] Add missing libcall for G_MUL to LegalizerHelper
Kai Nacke [Tue, 2 Aug 2022 17:12:38 +0000 (13:12 -0400)]
[GIsel] Add missing libcall for G_MUL to LegalizerHelper

The LegalizerHelper misses the code to lower G_MUL to a library call,
which this change adds.

Reviewed By: arsenm

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

23 months ago[GIsel] Add missing space between type and name in GICombinerHelperArg
Kai Nacke [Tue, 2 Aug 2022 17:08:54 +0000 (13:08 -0400)]
[GIsel] Add missing space between type and name in GICombinerHelperArg

When using AdditionalArguments in a GICombinerHelper, the generator
does not put a space between the type and the name.

E.g.

let AdditionalArguments = [GICombinerHelperArg<"bool", "IsSomething">];

ends up as

boolIsSomething) const;

in the generated file. This change adds a space between the type and the name.

Reviewed By: aemerson

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

23 months ago[AArch64] Treat x18 as callee-saved in functions with Windows calling convention...
Vladislav Dzhidzhoev [Wed, 27 Jul 2022 20:54:56 +0000 (23:54 +0300)]
[AArch64] Treat x18 as callee-saved in functions with Windows calling convention on Darwin

rGcf97e0ec42b8 makes $x18 to be treated as callee-saved in functions with
Windows calling convention on non-Windows OSes.

Here we mark $x18 as callee-saved for functions with Windows calling
convention on Darwin, as well as on other non-Windows platforms, in
order to prevent some miscompilations (like miscompilation of
win64cc-darwin-backup-x18.ll).

Since getCalleeSavedRegs doesn't return x18 in list of callee-saved
registers, assignCalleeSavedSpillSlots and determineCalleeSaves
consider different sets of registers as callee-saved. It causes an
error:
```
Assertion failed: ((!HasCalleeSavedStackSize || getCalleeSavedStackSize() == Size) && "Invalid size calculated for callee saves"), function getCalleeSavedStackSize, file
AArch64MachineFunctionInfo.h, line 292.
```

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

23 months ago[RISCV][Clang] Support policy functions for Vector Mask Instructions.
Zakk Chen [Tue, 2 Aug 2022 16:57:40 +0000 (16:57 +0000)]
[RISCV][Clang] Support policy functions for Vector Mask Instructions.

We will switch all UndefValue to PoisonValue in follow up patches.

Reviewed By: kito-cheng

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

23 months ago[RISCV][Clang] Support policy functions for Vector Reduction
Zakk Chen [Tue, 2 Aug 2022 16:39:17 +0000 (16:39 +0000)]
[RISCV][Clang] Support policy functions for Vector Reduction
Instructions.

We will switch all UndefValue to PoisonValue in follow up patches.

Thanks for Kito to help on verification with their interanl testsuite.

Reviewed By: kito-cheng

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

23 months ago[RISCV][Clang] Support policy functions for Vector Comparison
Zakk Chen [Tue, 2 Aug 2022 16:27:29 +0000 (16:27 +0000)]
[RISCV][Clang] Support policy functions for Vector Comparison
Instructions.

We will switch all UndefValue to PoisonValue in follow up patches.

Reviewed By: kito-cheng

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

23 months ago[RISCV][Clang] Support policy functions for vmerge, vfmerge and
Zakk Chen [Mon, 1 Aug 2022 17:59:53 +0000 (17:59 +0000)]
[RISCV][Clang] Support policy functions for vmerge, vfmerge and
vcompress.

We will switch all UndefValue to PoisonValue in follow up patches.

Reviewed By: kito-cheng

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

23 months ago[RISCV][Clang] Support policy functions for vneg, vnot, vncvt, vwcvt,
Zakk Chen [Mon, 1 Aug 2022 18:24:30 +0000 (18:24 +0000)]
[RISCV][Clang] Support policy functions for vneg, vnot, vncvt, vwcvt,
vwcvtu, vfabs and vfneg.

We will switch all UndefValue to PoisonValue in follow up patches.

Reviewed By: kito-cheng

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

23 months ago[test] Remove -fsanitize-coverage-whitelist=
Fangrui Song [Tue, 2 Aug 2022 17:25:44 +0000 (10:25 -0700)]
[test] Remove -fsanitize-coverage-whitelist=

23 months ago[SPIRV] Add tests to improve test coverage
Andrey Tretyakov [Tue, 2 Aug 2022 17:18:51 +0000 (20:18 +0300)]
[SPIRV] Add tests to improve test coverage

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

23 months ago[DebugInfo] Test commit: update irrelevant comments
Vladislav Dzhidzhoev [Tue, 2 Aug 2022 17:18:47 +0000 (20:18 +0300)]
[DebugInfo] Test commit: update irrelevant comments

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

23 months ago[LLDB][Reliability] Remove dead code.
Slava Gurevich [Mon, 1 Aug 2022 19:36:38 +0000 (12:36 -0700)]
[LLDB][Reliability] Remove dead code.

Remove redundant code that can never execute due to preceeding logic checks in the code.

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

23 months ago[MIPS] Expose the ZERO register as a constant physical register
Guozhi Wei [Tue, 2 Aug 2022 17:04:52 +0000 (17:04 +0000)]
[MIPS] Expose the ZERO register as a constant physical register

The ZERO register should be exposed as a constant physical register through the interface TargetRegisterInfo::isConstantPhysReg.

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

23 months ago[libc++][format] Improves generated files.
Mark de Wever [Mon, 1 Aug 2022 15:55:51 +0000 (17:55 +0200)]
[libc++][format] Improves generated files.

This improves the formatting of the generated files. That allows it to
remove the clang-format step in D129668.

Reviewed By: ldionne, #libc

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

23 months ago[libc++][format] Enables feature-test macro.
Mark de Wever [Fri, 29 Jul 2022 18:35:43 +0000 (20:35 +0200)]
[libc++][format] Enables feature-test macro.

The macro is only enabled when the Clang is used with
-fexperimental-library.

Reviewed By: ldionne, #libc

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

23 months ago[RISCV] Add scheduler classes to PseudoVMV*R_V.
Craig Topper [Tue, 2 Aug 2022 16:29:39 +0000 (09:29 -0700)]
[RISCV] Add scheduler classes to PseudoVMV*R_V.

I think these pseudos will exist when the post-RA scheduler runs
so they should have sched classes.

Reviewed By: monkchiang

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

23 months ago[RISCV] Add scheduler class to PseudoReadVLENB.
Craig Topper [Tue, 2 Aug 2022 16:29:22 +0000 (09:29 -0700)]
[RISCV] Add scheduler class to PseudoReadVLENB.

Reviewed By: monkchiang

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

23 months ago[AMDGPU] avoid blind converting to VALU REG_SEQUENCE and PHIs
Alexander Timofeev [Mon, 1 Aug 2022 18:15:48 +0000 (20:15 +0200)]
[AMDGPU] avoid blind converting to VALU REG_SEQUENCE and PHIs

In the 2e29b0138ca243 we introduce a specific solving algorithm
that analyzes the VGPR to SGPR copies use chains and either lowers
the copy to v_readfirstlane_b32 or converts the whole chain to VALU forms.
Same time we still have the code that blindly converts to VALU REG_SEQUENCE and PHIs
in case they produce SGPR but have VGPRs input operands. In case the REG_SEQUENCE and PHIs
are in the VGPR to SGPR copy use chain, and this chain was considered long enough to convert
copy to v_readfistlane_b32, further lowering them to VALU leads to several kinds of issues.
At first, we have v_readfistlane_b32 which is completely useless because most parts of its use chain
were moved to VALU forms. Second, we may encounter subtle bugs related to the EXEC-dependent CF
because of the weird mixing of SALU and VALU instructions.
This change removes the code that moves REG_SEQUENCE and PHIs to VALU. Instead, we use the fact
that both REG_SEQUENCE and PHIs have copy semantics. That is, if they define SGPR but have VGPR inputs,
we insert VGPR to SGPR copies to make them pure SGPR. Then, the new copies are processed by the common
VGPR to SGPR lowering algorithm.
This is Part 2 in the series of commits aiming at the massive refactoring of the SIFixSGPRCopies pass.

Reviewed By: rampitec

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

23 months ago[AMDGPU] Remove IR SpeculativeExecution pass from codegen pipeline
Jay Foad [Thu, 21 Jul 2022 12:14:06 +0000 (13:14 +0100)]
[AMDGPU] Remove IR SpeculativeExecution pass from codegen pipeline

This pass seems to have very little effect because all it does is hoist
some instructions, but it is followed later in the codegen pipeline by
the IR CodeSinking pass which does the opposite.

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

23 months agollvm-reduce: reorder passes to run the ones first that delete function bodies; this...
John Regehr [Tue, 2 Aug 2022 16:32:49 +0000 (10:32 -0600)]
llvm-reduce: reorder passes to run the ones first that delete function bodies; this makes reductions go faster

23 months ago[AMDGPU] Take advantage of VOP3 literals in convertToThreeAddress
Jay Foad [Tue, 2 Aug 2022 16:09:58 +0000 (17:09 +0100)]
[AMDGPU] Take advantage of VOP3 literals in convertToThreeAddress

This improves a corner case where v_fmac can be converted to v_fma on
GFX10+ even if it has a literal operand.

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

23 months ago[clang][OpenMP][DebugInfo] Mark OpenMP generated functions as artificial
Alok Kumar Sharma [Mon, 11 Oct 2021 05:52:28 +0000 (11:22 +0530)]
[clang][OpenMP][DebugInfo] Mark OpenMP generated functions as artificial

The Clang compiler generates internal functions for OpenMP. Current
patch marks these functions as artificial.

Reviewed By: aprantl

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

23 months ago[LV] Recognize store of invariant value to invariant address as uniform
Philip Reames [Tue, 2 Aug 2022 15:03:01 +0000 (08:03 -0700)]
[LV] Recognize store of invariant value to invariant address as uniform

This extends the handling of uniform memory operations to handle the case where a store is storing a loop invariant value. Unlike the general case of a store to an invariant address where we must use the last active lane, in this case we can use any lane since all lanes must produce the same result.

For context, the basic structure of the existing code and how the change fits in:
* First, we select a widening strategy. (The result is irrelevant for this patch.)
* Then we determine if a computation is uniform within all lanes of VF. (Note this is the uniform-per-part definition, not LAI's uniform across all unrolled iterations definition.)
* If it is, we overrule the widening strategy, and unconditionally scalarize.
* VPReplicationRecipe - which is what actually does the scalarization - knows how to handle unform-per-part values including for scalable vectors. However, we do need to know that the expression is safe to execute without predication - e.g. the uniform mem op was unconditional in the original loop. (This part was split off and already landed.)

An obvious question is why not simply implement the generic case? The answer is that I'm going to, but doing so without a canonicalization towards uniform causes regressions due to bad interaction with scalarization/uniformity of values feeding the uniform mem-op. This patch is needed to avoid those regressions.

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

23 months ago[flang] Add some semantic checks for derived type with BIND attribute
Peixin Qiao [Tue, 2 Aug 2022 15:07:02 +0000 (23:07 +0800)]
[flang] Add some semantic checks for derived type with BIND attribute

This supports checks in C1801-C1805 for derived type with BIND attribute.
The other compilers such as 'gfortran' and 'ifort' do not report error
for C1802 and C1805, so emit warnings for them.

Reviewed By: klausler

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

23 months ago[flang] Support extention intrinsic ABORT
Peixin Qiao [Tue, 2 Aug 2022 15:02:12 +0000 (23:02 +0800)]
[flang] Support extention intrinsic ABORT

The semantic checks and runtime have been supported. This supports the
lowering of intrinsic ABORT.

`gfortran` prints a backtrace before abort, unless `-fno-backtrace` is
given. This is good to use. The intrinsic BACKTRACE is not supported
yet, so add TODO in the runtime.

This extention is needed in SPEC2017 521.wrf_r in
https://github.com/llvm/llvm-project/issues/55955.

Reviewed By: klausler

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

23 months ago[flang] Support lowering of intrinsic module procedure `c_loc`
Peixin Qiao [Tue, 2 Aug 2022 14:59:28 +0000 (22:59 +0800)]
[flang] Support lowering of intrinsic module procedure `c_loc`

As Fortran 2018 18.2.3.6, the intrinsic `c_loc(x)` gets the C address
of argument `x`. It returns the scalar of type C_PTR. As defined in
iso_c_binding in `flang/module/__fortran_builtins.f90`, C_PTR is the
derived type with only one component of integer 64.

This supports the lowering of intrinsic module procedure `c_loc` by
converting the address of argument into integer 64, where the argument
is lowered as Box and the address is generated using fir.box_addr.

The lowering of intrinsic `c_funloc` has the similar characteristic and
will be supported later.

The execution tests for various data types are in issue
https://github.com/llvm/llvm-project/issues/56552.

Reviewed By: Jean Perier

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

23 months ago[X86][FP16] Fix vector_shuffle and lowering without f16c feature problems
Phoebe Wang [Tue, 2 Aug 2022 13:58:15 +0000 (21:58 +0800)]
[X86][FP16] Fix vector_shuffle and lowering without f16c feature problems

The problem Alexander reported on D127982 was caused by an optimization
for AVX512-FP16 instruction. We must limit it to the feature enabled only.

During the investigation, I found we didn't expand for fp_round/fp_extend
without F16C. This may result runtime crash, so change them too.

Reviewed By: RKSimon

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

23 months ago[lldb] Create an enum to specify the kind of ArchSpec matching
Pavel Labath [Wed, 9 Mar 2022 15:00:26 +0000 (16:00 +0100)]
[lldb] Create an enum to specify the kind of ArchSpec matching

s/true/ArchSpec::ExactMatch
s/false/ArchSpec::CompatibleMatch

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

23 months ago[lld] Fixed a number of typos
Gabriel Ravier [Tue, 2 Aug 2022 13:52:31 +0000 (09:52 -0400)]
[lld] Fixed a number of typos

I went over the output of the following mess of a command:

`(ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel --xargs -0 cat | aspell list --mode=none --ignore-case | grep -E '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n | grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' -f2 | less)`

and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).

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

23 months agoRevert "Missing tautological compare warnings due to unary operators"
Aaron Ballman [Tue, 2 Aug 2022 13:39:36 +0000 (09:39 -0400)]
Revert "Missing tautological compare warnings due to unary operators"

This reverts commit 0cc3c184c784d5f0d55de8ad0a9eeee876acd149.

The changes did not account for templated code where one instantiation
may trigger the diagnostic but other instantiations will not, as in:
```
template <int I, class T>
void foo(int x) {
    bool b1 = (x & sizeof(T)) == 8;
    bool b2 = (x & I) == 8;
    bool b3 = (x & 4) == 8;
}

void run(int x) {
    foo<4, int>(8);
}
```

23 months ago[yaml2obj] Add a `-E` flag to preprocess only.
Simon Tatham [Tue, 2 Aug 2022 09:24:30 +0000 (10:24 +0100)]
[yaml2obj] Add a `-E` flag to preprocess only.

If you're having trouble getting a yaml2obj macro expansion to do what
you want, it's useful to be able to print the output of the
preprocessing to see what your macros expanded to //before// going
into the YAML processing phase.

yaml2obj has its own preprocessing system which isn't the same as any
other well-known thing like cpp. So there's no way to do this macro
expansion via another tool: yaml2obj will have to do it itself.

In this commit I add an `-E` flag to yaml2obj to do that.

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

23 months ago[IRBuilder] CreateIntrinsic with implicit mangling
Jay Foad [Fri, 29 Jul 2022 10:40:11 +0000 (11:40 +0100)]
[IRBuilder] CreateIntrinsic with implicit mangling

Add a new IRBuilderBase::CreateIntrinsic which takes the return type and
argument values for the intrinsic call but does not take an explicit
list of types to mangle. Instead the builder works this out from the
intrinsic declaration and the types of the supplied arguments.

This means that the mangling is hidden from the client, which in turn
means that intrinsic definitions can change which arguments are mangled
without requiring any changes to the client code.

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

23 months ago[AArch64] Fold Mul(And(Srl(X, 15), 0x10001), 0xffff) to CMLTz
David Green [Tue, 2 Aug 2022 12:01:59 +0000 (13:01 +0100)]
[AArch64] Fold Mul(And(Srl(X, 15), 0x10001), 0xffff) to CMLTz

This folds a v4i32 Mul(And(Srl(X, 15), 0x10001), 0xffff) into a v8i16
CMLTz instruction. The Srl and And extract the top bit (whether the
input is negative) and the Mul sets all values in the i16 half to all
1/0 depending on if that top bit was set. This is equivalent to a v8i16
CMLTz instruction. The same applies to other sizes with equivalent
constants.

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

23 months ago[LLDB] Skip buildbot failures AArch64/Windows
Muhammad Omair Javaid [Tue, 2 Aug 2022 11:57:05 +0000 (16:57 +0500)]
[LLDB] Skip buildbot failures AArch64/Windows

TestInlineStepping.py is flaky while TestUseSourceCache.py fails on
Windows 11 only. Marked them skipped to make buildbot happy.

23 months ago[mlir][Math] Add constant folder for TanhOp.
jacquesguan [Tue, 2 Aug 2022 03:36:50 +0000 (11:36 +0800)]
[mlir][Math] Add constant folder for TanhOp.

This patch adds constant folder for TanhOp which only supports single and double precision floating-point.

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

23 months ago[AArch64] Mul fold tests for D130874. NFC
David Green [Tue, 2 Aug 2022 11:29:40 +0000 (12:29 +0100)]
[AArch64] Mul fold tests for D130874. NFC

23 months ago[mlir] add TOC to top-level documents
Alex Zinenko [Tue, 2 Aug 2022 11:22:40 +0000 (13:22 +0200)]
[mlir] add TOC to top-level documents

Multiple top-level MLIR documents did not have a table of contents tag,
making them harder to nagivate.

23 months ago[libc++] Implement P2499R0 (`string_view` range constructor should be `explicit`)
Igor Zhukov [Tue, 2 Aug 2022 10:46:31 +0000 (12:46 +0200)]
[libc++] Implement P2499R0 (`string_view` range constructor should be `explicit`)

Reviewed By: #libc, philnik, Mordante

Spies: Mordante, jloser, philnik, libcxx-commits

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

23 months ago[libcxx] Fixed a number of typos
Gabriel Ravier [Tue, 2 Aug 2022 10:42:04 +0000 (12:42 +0200)]
[libcxx] Fixed a number of typos

I went over the output of the following mess of a command:

`(ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel --xargs -0 cat | aspell list --mode=none --ignore-case | grep -E '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n | grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' -f2 | less)`

and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).

Reviewed By: #libc, philnik

Spies: philnik, libcxx-commits, mgorny, arichardson

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

23 months ago[DAG] matchRotateSub - ensure the (pre-extended) shift amount is wide enough for...
Simon Pilgrim [Tue, 2 Aug 2022 10:38:47 +0000 (11:38 +0100)]
[DAG] matchRotateSub - ensure the (pre-extended) shift amount is wide enough for the amount mask (PR56859)

matchRotateSub is given shift amounts that will already have stripped any/zero-extend nodes from - so make sure those values are wide enough to take a mask.

23 months ago[mlir] Update comment now that DenseArrayAttr has Tensor type.
Adrian Kuegel [Tue, 2 Aug 2022 10:31:22 +0000 (12:31 +0200)]
[mlir] Update comment now that DenseArrayAttr has Tensor type.

23 months ago[flang][docs][nfc] Refine FlangOptionsDocs.td
Andrzej Warzynski [Tue, 26 Jul 2022 09:49:29 +0000 (09:49 +0000)]
[flang][docs][nfc] Refine FlangOptionsDocs.td

Currently, FlangOptionsDocs.td doesn't specify `ExcludedFlags` which
means that in the generated documentation file we expose flags that:
  * we don't necessarily won't to advertise to our users (e.g. hidden flags), or
  * are not supported altogether (e.g. CL options).
This patch defines `ExcludeFlags` to fix that. The definition of
`ExcludeFlags` was copied from Clang so that LLVM frontends have
consistent documentation.

It might be a bit counter-intuitive that IncludeFlags alone is not
sufficient here. However, the current logic in ClangOptionDocEmitter.cpp
will parse IncludeFlags and print all options that contains one of the
included flags, as well as their aliases. So, for example, for -fopenmp
(which is a supported Flang option), one would also get /fopenmp (i.e.
CL mode equivalent for -fopenmp). By adding ExcludeFlags, we make sure
that such aliases are excluded.

I've also taken the liberty and moved FlangOptionsDocs.td. Originally it
was located in Flang's "flang/include" directory, but there shouldn't be
any implementation/documentation files there. Instead, I'm moving it to
the "flang/docs" directory.

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

23 months ago[NFC] Remove some boilerplate from SmallVector header
Dawid Jurczak [Tue, 2 Aug 2022 08:17:50 +0000 (10:17 +0200)]
[NFC] Remove some boilerplate from SmallVector header

In SmallVector header we use couple of times exactly same enable_if,
in this change we de-duplicate it and declare only once.

Extracted from: https://reviews.llvm.org/D129990

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

23 months ago[mlir] Use EXPECT_DEBUG_DEATH in unit test
Stephan Herhut [Tue, 2 Aug 2022 08:21:02 +0000 (10:21 +0200)]
[mlir] Use EXPECT_DEBUG_DEATH in unit test

This allows the tests to also pass when compiled in opt mode.

23 months ago[AArch64][LoopVectorize] Disable tail-folding for SVE when loop has interleaved accesses
David Sherwood [Mon, 18 Jul 2022 09:36:11 +0000 (10:36 +0100)]
[AArch64][LoopVectorize] Disable tail-folding for SVE when loop has interleaved accesses

If we have interleave groups in the loop we want to vectorise then
we should fall back on normal vectorisation with a scalar epilogue. In
such cases when tail-folding is enabled we'll almost certainly go on to
create vplans with very high costs for all vector VFs and fall back on
VF=1 anyway. This is likely to be worse than if we'd just used an
unpredicated vector loop in the first place.

Once the vectoriser has proper support for analysing all the costs
for each combination of VF and vectorisation style, then we should
be able to remove this.

Added an extra test here:

  Transforms/LoopVectorize/AArch64/sve-tail-folding-option.ll

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

23 months ago[RISCV][NFCI] Set TransientStackAlignment and rely on it rather than RVV-specific...
Alex Bradbury [Tue, 2 Aug 2022 08:43:32 +0000 (09:43 +0100)]
[RISCV][NFCI] Set TransientStackAlignment and rely on it rather than RVV-specific logic on RVV-less functions

* TargetFrameLowering has a TransientStackAlignment field that "returns
  the number of bytes to which the stack pointer must be aligned at all
  times, even between calls.
  * As explained in the [RISC-V calling
    convention](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc),
    the stack pointer must remain fully aligned throughout execution for
    compliant code. This is important for embedded targets that might avoid
    realigning the stack pointer for interrupt service routines. Systems
    running full OSes may always realign the stack anyway.
* TransientStackAlignment is used in estimateStackSize in
  MachineFrameInfo and in PEI::calculateFrameObjectOffsets.
  * estimateStackSize is only used in the RISC-V backend for scavenging
    slots. It may be possible to craft a function where the difference
    is observable, but it wouldn't be a meaningful test.
  * calculateFrameObjectOffsets makes use of TransientStackAlignment,
    but then sets the stack alignment to the max of that alignment and
    MaxAlign, which is unconditionally set to 16 in
    RISCVFrameLowering::processFunctionBeforeFrameFinalized
  * I've changed this logic to only set MaxAlign if there are RVV frame
    objects. There should be no functional change here for either RVV
    targets (MaxAlign is set as before) or non-RVV targets
    (TransientStackAlign is now 16 anyway).

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

23 months agoOutliner: add "target-cpu" feature from source function to outlined
Tim Northover [Fri, 29 Jul 2022 13:39:44 +0000 (14:39 +0100)]
Outliner: add "target-cpu" feature from source function to outlined

The CPU is used to determine which inline asm instructions are allowed, so
needs to be copied across in case the outlined function contains any.

23 months ago[RISCV][NFC] Use defined variable instead some code.
wanglian [Tue, 2 Aug 2022 07:59:27 +0000 (15:59 +0800)]
[RISCV][NFC] Use defined variable instead some code.

Reviewed By: asb

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

23 months ago[OpenMP] Fix warnings about unused expressions when OMPT_LOOP_DISPATCH is a no-op...
Martin Storsjö [Tue, 2 Aug 2022 08:15:02 +0000 (11:15 +0300)]
[OpenMP] Fix warnings about unused expressions when OMPT_LOOP_DISPATCH is a no-op. NFC.

This fixes warnings like these:

../runtime/src/kmp_dispatch.cpp:2159:24: warning: left operand of comma operator has no effect [-Wunused-value]
    OMPT_LOOP_DISPATCH(*p_lb, *p_ub, pr->u.p.st, status);
                       ^~~~~
../runtime/src/kmp_dispatch.cpp:2159:31: warning: left operand of comma operator has no effect [-Wunused-value]
    OMPT_LOOP_DISPATCH(*p_lb, *p_ub, pr->u.p.st, status);
                              ^~~~~
../runtime/src/kmp_dispatch.cpp:2159:46: warning: left operand of comma operator has no effect [-Wunused-value]
    OMPT_LOOP_DISPATCH(*p_lb, *p_ub, pr->u.p.st, status);
                                     ~~~~~~~ ^~
../runtime/src/kmp_dispatch.cpp:2159:50: warning: expression result unused [-Wunused-value]
    OMPT_LOOP_DISPATCH(*p_lb, *p_ub, pr->u.p.st, status);
                                                 ^~~~~~

23 months agoworkflows: Fix error when searching for backport reviewers
Tom Stellard [Fri, 29 Jul 2022 20:26:29 +0000 (20:26 +0000)]
workflows: Fix error when searching for backport reviewers

23 months ago[LV] Refactor getExtendedAddReductionCost to support other extended reduction more...
jacquesguan [Mon, 1 Aug 2022 03:31:57 +0000 (11:31 +0800)]
[LV] Refactor getExtendedAddReductionCost to support other extended reduction more than Add.

Now the API getExtendedAddReductionCost is used to determine the cost of extended Add reduction with optional Mul. For Arm, it could cover the cases. But for other target, for example: RISCV, they support other kinds of extended recution, such as FAdd.

This patch does the following changes:
1, Split getExtendedAddReductionCost into 2 new API: getExtendedReductionCost which handles the extended reduction with addtional input of Opcode; getMulAccReductionCost which handle the MLA cases the getExtendedAddReductionCost.
2, Refactor getReductionPatternCost, add some contraint condition to make sure the getMulAccReductionCost should only handle the reuction of Add + Mul.

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

23 months ago[mlir] Fix calling the native mlir-tblgen tool when cross compiling flang
Martin Storsjö [Fri, 15 Jul 2022 21:11:00 +0000 (00:11 +0300)]
[mlir] Fix calling the native mlir-tblgen tool when cross compiling flang

When the mlir-tblgen tool is set up, the `MLIR_TABLEGEN_EXE` variable
is set, which either points to the mlir-tblgen tool built in the current
cmake build, or points to one built in a nested cmake build (if cross
conpiling, or if building with e.g. `LLVM_OPTIMIZED_TABLEGEN`.

The `MLIR_TABLEGEN_EXE` variable is only set within the scope of the
mlir/CMakeLists.txt file, so it's unavailable in sibling level projects
such as flang.

Set the `MLIR_TABLEGEN_EXE` and the `MLIR_TABLEGEN_TARGET` variables
as global, so that flang can use them properly without guessing.

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

23 months ago[flang] Don't try to run the newly built flang-new when cross compiling
Martin Storsjö [Fri, 15 Jul 2022 21:14:02 +0000 (00:14 +0300)]
[flang] Don't try to run the newly built flang-new when cross compiling

If CMAKE_CROSSCOMPILING, then the newly built flang-new executable was
cross compiled and thus can't be executed on the build system, and thus
can't be used for generating module files.

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

23 months ago[lldb] Silence a GCC warning about missing returns after a fully covered switch....
Martin Storsjö [Tue, 2 Aug 2022 07:28:12 +0000 (10:28 +0300)]
[lldb] Silence a GCC warning about missing returns after a fully covered switch. NFC.

23 months ago[OpenMP] Only include CMAKE_DL_LIBS on unix platforms
Martin Storsjö [Mon, 1 Aug 2022 08:50:44 +0000 (11:50 +0300)]
[OpenMP] Only include CMAKE_DL_LIBS on unix platforms

CMAKE_DL_LIBS is documented as "Name of library containing dlopen
and dlclose".

On Windows platforms, there's no system provided dlopen/dlclose, but
it can be argued that if you really intend to call dlopen/dlclose,
you're going to be using a third party compat library like
https://github.com/dlfcn-win32/dlfcn-win32, and CMAKE_DL_LIBS should
expand to its name.

This has been argued upstream in CMake in
https://gitlab.kitware.com/cmake/cmake/-/issues/17600 and
https://gitlab.kitware.com/cmake/cmake/-/merge_requests/1642, that
CMAKE_DL_LIBS should expand to "dl" on mingw platforms.

The merge request wasn't merged though, as it caused some amount of
breakage, but in practice, Fedora still carries a custom CMake patch
with the same effect.

Thus, this patch fixes cross compiling OpenMP for mingw targets
on Fedora with their custom-patched CMake.

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

23 months ago[Driver] Remove Separate form for XRay options
Fangrui Song [Tue, 2 Aug 2022 07:47:36 +0000 (00:47 -0700)]
[Driver] Remove Separate form for XRay options

Supporting something like `-fxray-instruction-threshold= 1` is not intended.

23 months ago[LangRef] Fix typo in GEP docs
Nikita Popov [Tue, 2 Aug 2022 07:29:25 +0000 (09:29 +0200)]
[LangRef] Fix typo in GEP docs

Introduced in D130356, reported here:
https://reviews.llvm.org/rG7ac7ec820296#inline-7690

23 months ago[mlir][Bazel] Fix typo in file name.
Adrian Kuegel [Tue, 2 Aug 2022 07:27:20 +0000 (09:27 +0200)]
[mlir][Bazel] Fix typo in file name.

23 months ago[mlir][Bazel] Add missing dependency.
Adrian Kuegel [Tue, 2 Aug 2022 07:23:03 +0000 (09:23 +0200)]
[mlir][Bazel] Add missing dependency.

23 months ago[mlir][Bazel] Add yet another missing dependency.
Adrian Kuegel [Tue, 2 Aug 2022 07:15:43 +0000 (09:15 +0200)]
[mlir][Bazel] Add yet another missing dependency.

23 months ago[mlir][Bazel] Add missing dependency.
Adrian Kuegel [Tue, 2 Aug 2022 07:10:18 +0000 (09:10 +0200)]
[mlir][Bazel] Add missing dependency.

23 months ago[mlir][Bazel] Update bazel build after 14d79afeae63d78de9483f750fafaba13c7ae2dc
Adrian Kuegel [Tue, 2 Aug 2022 06:53:31 +0000 (08:53 +0200)]
[mlir][Bazel] Update bazel build after 14d79afeae63d78de9483f750fafaba13c7ae2dc

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