platform/upstream/llvm.git
20 months ago[mlir][llvm] Add atomic support to the LoadOp.
Tobias Gysi [Fri, 17 Feb 2023 08:20:08 +0000 (09:20 +0100)]
[mlir][llvm] Add atomic support to the LoadOp.

This revision adds atomic support to the LoadOp. It chooses
to print the atomic keywords together with the syncscope and
ordering arguments, which simplifies parsing and printing compared
to the LLVM IR printer that puts the atomic keyword at the beginning.
It uses the ordering attribute to check if the load is atomic.

The revision also implements verifiers to ensure the constraints
that apply to atomic load operations are checked.

Reviewed By: Dinistro

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

20 months ago[Clang] Convert some tests to opaque pointers (NFC)
Nikita Popov [Thu, 16 Feb 2023 16:06:50 +0000 (17:06 +0100)]
[Clang] Convert some tests to opaque pointers (NFC)

20 months ago[AMDGPU] Add cross-project-tests for WMMA builtins
Diana Picus [Thu, 16 Feb 2023 10:10:54 +0000 (11:10 +0100)]
[AMDGPU] Add cross-project-tests for WMMA builtins

Add a few tests to make sure we get the expected instruction for the
WMMA builtins (and generally that our builtins and intrinsics are on the
same page and won't blow up).

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

20 months ago[MLIR][LLVM] Only disallow inlining for selected function attributes.
Johannes de Fine Licht [Fri, 17 Feb 2023 08:04:43 +0000 (09:04 +0100)]
[MLIR][LLVM] Only disallow inlining for selected function attributes.

This loosens the requirement of no passthrough function attribute being
present to checking for specific attributes that prevent inlining. Since
these attributes are no longer strictly passthrough, they should
eventually be upgraded to some form of addressable attributes.

Drops the expensive StringSwitches over call and function attributes in
favor of selectively disallowing attributes that prevent inlining
(similiar to the LLVM inliner), thereby moving to a less conservative
approach.

Reviewed By: gysit

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

20 months ago[Clang] Convert update_cc_test_checks tests to opaque pointers (NFC)
Nikita Popov [Fri, 17 Feb 2023 08:06:02 +0000 (09:06 +0100)]
[Clang] Convert update_cc_test_checks tests to opaque pointers (NFC)

20 months ago[DAGCombiner] Teach MatchContextClass classes to use TargetLowering::isOperationLegal...
Yeting Kuo [Wed, 15 Feb 2023 07:17:26 +0000 (15:17 +0800)]
[DAGCombiner] Teach MatchContextClass classes to use TargetLowering::isOperationLegalOrCustom().

Some of TargetLowering functions needed opcodes are often used in DAGCombiner.
The patch make those MatchContextClass classes have TargetLowering members and
pass specific opcodes for those TargetLowering functions.

Reviewed By: RKSimon

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

20 months ago[mlir] Add loop bounds to scf.foreach_thread.
Alexander Belyaev [Fri, 17 Feb 2023 07:54:56 +0000 (08:54 +0100)]
[mlir] Add loop bounds to scf.foreach_thread.

https://discourse.llvm.org/t/rfc-parallel-loops-on-tensors-in-mlir/68332

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

20 months agoRevert "[Coroutines] Stop supportting std::experimental::coroutine_traits"
Chuanqi Xu [Fri, 17 Feb 2023 07:50:54 +0000 (15:50 +0800)]
Revert "[Coroutines] Stop supportting std::experimental::coroutine_traits"

This reverts commit c4e6e771f255fb1da3d505534997b6a88195b012.

Since clang-tools-extra contains the use for
std::experimental::coroutine_traits, the previsou commit breaks the
build bot. Revert this one to make the bot green.

20 months ago[Coroutines] Stop supportting std::experimental::coroutine_traits
Chuanqi Xu [Fri, 17 Feb 2023 07:22:04 +0000 (15:22 +0800)]
[Coroutines] Stop supportting std::experimental::coroutine_traits

As we discussed before, we should stop supporting
std::experimental::coroutine_traits in clang17. Now the clang16 is
branched so we can clean them now.

All the removed tests have been duplicated before.

20 months ago[NDF] Revert earlier nfc commit to test commit access
Ryan Guo [Fri, 17 Feb 2023 06:57:23 +0000 (22:57 -0800)]
[NDF] Revert earlier nfc commit to test commit access

This patch reverts 511d55060454 by removing the empty newline.

20 months ago[NFC] Testing new commit access by adding newline
Ryan Guo [Fri, 17 Feb 2023 06:52:31 +0000 (22:52 -0800)]
[NFC] Testing new commit access by adding newline

20 months ago[lldb] Add missing decorators import in TestPoPersistentResult.py
Dave Lee [Fri, 17 Feb 2023 05:45:24 +0000 (21:45 -0800)]
[lldb] Add missing decorators import in TestPoPersistentResult.py

20 months ago[lldb] Limit TestPoPersistentResult to darwin
Dave Lee [Fri, 17 Feb 2023 05:11:38 +0000 (21:11 -0800)]
[lldb] Limit TestPoPersistentResult to darwin

20 months ago[lldb] Suppress persistent result when running po
Dave Lee [Tue, 14 Feb 2023 21:48:07 +0000 (13:48 -0800)]
[lldb] Suppress persistent result when running po

Remove the persistent result variable after executing `po`.

Without this change, the following behavior happens:

```
(lldb) p thing
(NSObject *) $0 = 0x600000008000
(lldb) po thing
<NSObject: 0x600000008000>
(lldb) p thing
(NSObject *) $2 = 0x600000008000
(lldb) p $1
(NSObject *) $1 = 0x600000008000
```

Even though `po` hides the persistent result variable, it's still created - as $1 in
this example. It can be accessed even though its existence is not evident.

With this change, the persistent result is removed after the object description has
printed. Instead, this is the behavior:

```
(lldb) p thing
(NSObject *) $0 = 0x600000008000
(lldb) po thing
<NSObject: 0x600000008000>
(lldb) p thing
(NSObject *) $1 = 0x600000008000
```

The difference here is that the `po` doens't silently create a persistent result.

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

20 months ago[lldb] Rename SetResultIsInternal to SetSuppressPersistentResult (NFC)
Dave Lee [Tue, 14 Feb 2023 21:39:56 +0000 (13:39 -0800)]
[lldb] Rename SetResultIsInternal to SetSuppressPersistentResult (NFC)

Rename `SetResultIsInternal` and `GetResultIsInternal` to `SetSuppressPersistentResult`
and `GetSuppressPersistentResult` respectively.  Also rename `m_result_is_internal`.

This matches the naming in the SB API.

A separate change calls `SetSuppressPersistentResult`, where the name
`SetResultIsInternal` doesn't quite fit.

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

20 months ago[llvm][test] enable/disable -verify-machineinstrs where possible for callbr
Nick Desaulniers [Fri, 17 Feb 2023 04:25:34 +0000 (20:25 -0800)]
[llvm][test] enable/disable -verify-machineinstrs where possible for callbr

I introduced new tests in
commit 5cc1016a57b3 ("[llvm][SelectionDAGBuilder] codegen callbr.landingpad intrinsic")
https://reviews.llvm.org/D140160
that fails expensive checks. Disable -verify-machineinstrs in those
tests for now. Enable it in other tests for now, since MachineVerifier
isn't on by default for assertion builds.

Link: https://github.com/llvm/llvm-project/issues/60827
20 months ago[clang-format] Add a space between an overloaded operator and '>'
Owen Pan [Fri, 10 Feb 2023 16:50:49 +0000 (08:50 -0800)]
[clang-format] Add a space between an overloaded operator and '>'

The token annotator doesn't annotate the template opener and closer
as such if they enclose an overloaded operator. This causes the
space between the operator and the closer to be removed, resulting
in invalid C++ code.

Fixes #58602.

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

20 months ago[ADT] Provide C++20-style bit functions
Kazu Hirata [Fri, 17 Feb 2023 04:13:04 +0000 (20:13 -0800)]
[ADT] Provide C++20-style bit functions

Tihs patches adds APInt::count{l,r}_{zero,one} and APInt::popcount to
be consistent with those functions in ADT/bit.h.

Once this patch lands, I'll take care of the migration.

For now, I am intentionally leaving isPowerOf2 as is.

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

20 months ago[CodeGen] Fix warnings
Kazu Hirata [Fri, 17 Feb 2023 04:08:35 +0000 (20:08 -0800)]
[CodeGen] Fix warnings

This patch fixes:

  llvm/lib/CodeGen/CallBrPrepare.cpp:154:14: error: unused variable
  'IsDominated' [-Werror,-Wunused-variable]

  llvm/lib/CodeGen/CallBrPrepare.cpp:150:13: error: unused function
  'PrintDebugDomInfo' [-Werror,-Wunused-function]

20 months ago[mlir][gpu] NFC let user pick the threadID values when distributing foreach_thread
Thomas Raoux [Fri, 17 Feb 2023 00:15:12 +0000 (00:15 +0000)]
[mlir][gpu] NFC let user pick the threadID values when distributing foreach_thread

Reviewed By: nicolasvasilache

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

20 months agoRevert "[mlir][vector] Prevent duplicating operations during vector distribute"
Thomas Raoux [Fri, 17 Feb 2023 03:06:59 +0000 (03:06 +0000)]
Revert "[mlir][vector] Prevent duplicating operations during vector distribute"

This reverts commit 2fc3c5c34c4c0ce94a217717a469620e06325fb0.

20 months ago[Sema] Relax a failing assertion in TransformBlockExpr
Akira Hatanaka [Tue, 14 Feb 2023 05:06:07 +0000 (21:06 -0800)]
[Sema] Relax a failing assertion in TransformBlockExpr

The assertion fails when the expression causing the this pointer to be
captured is part of a constexpr if statement's branch and the branch
gets discarded when the enclosing method is instantiated.

Note that the test case is added to CodeGen instead of Sema since the
translation unit has to be free of errors in order for the assertion to
be checked.

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

20 months agoOpenMP: Regenerate test checks
Matt Arsenault [Thu, 16 Feb 2023 19:49:32 +0000 (15:49 -0400)]
OpenMP: Regenerate test checks

20 months agoRecommit "Remove incorrect comment around `truncateAVX512SetCCNoBWI`; NFC" (2nd Try)
Noah Goldstein [Thu, 16 Feb 2023 09:15:48 +0000 (03:15 -0600)]
Recommit "Remove incorrect comment around `truncateAVX512SetCCNoBWI`; NFC" (2nd Try)

No bug here, just needed to revert to revert
8bd0e9481cfcba53946433011d841280fd456caa which had a bug.

20 months agoRecommit "Transform vector SET{LE/ULT/ULE} -> SETLT and SET{GE/UGT/UGE} -> SETGT...
Noah Goldstein [Fri, 17 Feb 2023 01:41:11 +0000 (19:41 -0600)]
Recommit "Transform vector SET{LE/ULT/ULE} -> SETLT and SET{GE/UGT/UGE} -> SETGT if possible" (2nd Try)

Original version hit assert in `incDecVectorConstant` because VT could
be EVT (as opposed to MVT). Fix is to add check for VT.isSimple() in
`incDecVectorConstant`.

Reviewed By: saugustine

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

20 months ago[lldb] Stop generating swig bindings for SBLaunchInfo copy constructor
Alex Langford [Thu, 16 Feb 2023 23:38:56 +0000 (15:38 -0800)]
[lldb] Stop generating swig bindings for SBLaunchInfo copy constructor

Given the line
```
launch_info = lldb.SBLaunchInfo(None)
```

We see different behaviors across different versionf of swig. On some
older versions of swig (e.g. 3.0.2) this line fails because it attempts
to use the copy constructor and blows up with an invalid null reference.
On newer versions of swig, this is correctly routed to the constructor
taking a pointer.

Prior to generating the swig bindings with the API headers,
SBLaunchInfo's copy constructor was not exposed so we're effectively
going back to the old behavior anyway.

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

20 months ago[ThinLTO/WPD] Handle function alias in vtable correctly
Teresa Johnson [Thu, 16 Feb 2023 19:19:27 +0000 (11:19 -0800)]
[ThinLTO/WPD] Handle function alias in vtable correctly

We were not summarizing a function alias in the vtable, leading to
incorrect WPD in some cases, and missing WPD in others.

Specifically, we would end up ignoring function aliases as they aren't
summarized, so we could incorrectly devirtualize if there was a single
other non-alias function in a compatible vtable. And if there was only
one implementation, but it was an alias, we would not be able to
identify and perform the single implementation devirtualization.

Handling the alias summary correctly also required fixing the handling
in mustBeUnreachableFunction, so that it is not incorrectly ignored.

Regular LTO is conservatively correct because it will skip
devirtualizing when any pointer within a vtable is not a function.
However, it needs additional work to be able to take advantage of
function alias within the vtable that is in fact the only
implementation. For that reason, the Regular LTO testing in the second
test case is currently disabled, and will be enabled along with a follow
on enhancement fix for Regular LTO WPD.

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

20 months ago[clang] add __has_extension(gnu_asm_goto_with_outputs_full)
Nick Desaulniers [Fri, 17 Feb 2023 01:56:59 +0000 (17:56 -0800)]
[clang] add __has_extension(gnu_asm_goto_with_outputs_full)

Also move the line about __has_extension(gnu_asm_goto_with_outputs) so
that it is more generally about asm goto, not the paragraph on symbolic
references.

Reviewed By: efriedma, void

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

20 months ago[clang] fix -Wuninitialized for asm goto outputs on indirect edges.
Nick Desaulniers [Fri, 17 Feb 2023 01:50:34 +0000 (17:50 -0800)]
[clang] fix -Wuninitialized for asm goto outputs on indirect edges.

Now that we support outputs from asm goto along indirect edges, we can
remove/revert some code that was added to help warn about the previous
limitation that outputs were not supported along indirect edges.

Reverts some code added in:
commit 72aa619a7fe0 ("Warn of uninitialized variables on asm goto's indirect branch")
commit 3a604fdbcd5f ("[Clang][CFG] check children statements of asm goto")
But keeps+updates the tests.

Link: https://github.com/llvm/llvm-project/issues/53562
Reviewed By: void

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

20 months ago[Clang] support for outputs along indirect edges of asm goto
Nick Desaulniers [Fri, 17 Feb 2023 01:49:39 +0000 (17:49 -0800)]
[Clang] support for outputs along indirect edges of asm goto

Initial support for asm goto w/ outputs (D69876) only supported outputs
along the "default" (aka "fallthrough") edge.

We can support outputs along all edges by repeating the same pattern of
stores along the indirect edges that we allready do for the default
edge.  One complication is that these indirect edges may be critical
edges which would need to be split. Another issue is that mid-codgen of
LLVM IR, the control flow graph might not reflect the control flow of
the final function.

To avoid this "chicken and the egg" problem assume that any given
indirect edge may become a critical edge, and pro-actively split it.
This is unnecessary if the edge does not become critical, but LLVM will
optimize such cases via tail duplication.

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

Reviewed By: void

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

20 months ago[Clang] refactor CodeGenFunction::EmitAsmStmt NFC
Nick Desaulniers [Fri, 17 Feb 2023 01:49:16 +0000 (17:49 -0800)]
[Clang] refactor CodeGenFunction::EmitAsmStmt NFC

Prerequisite to further modifications in D136497.

Basically, there is a large body of code in CodeGenFunction::EmitAsmStmt
for emitting stores of outputs. We want to be able to repeat this logic,
for each destination of a callbr (rather than just the default
destination which is what the code currently does).

Also does some smaller cleanups like whitespace cleanups, and removing
pointless casts.

Reviewed By: void, jyknight

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

20 months ago[llvm] add CallBrPrepare pass to pipelines
Nick Desaulniers [Fri, 17 Feb 2023 01:48:14 +0000 (17:48 -0800)]
[llvm] add CallBrPrepare pass to pipelines

Capstone of
https://discourse.llvm.org/t/rfc-syncing-asm-goto-with-outputs-with-gcc/65453/8

Clang changes are still necessary to enable the use of outputs along
indirect edges of asm goto statements.

Link: https://github.com/llvm/llvm-project/issues/53562
Reviewed By: void

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

20 months ago[llvm][SelectionDAGBuilder] codegen callbr.landingpad intrinsic
Nick Desaulniers [Fri, 17 Feb 2023 01:47:37 +0000 (17:47 -0800)]
[llvm][SelectionDAGBuilder] codegen callbr.landingpad intrinsic

Given a CallBrInst, retain its first virtual register in SelectionDagBuilder's
FunctionLoweringInfo if there's corresponding landingpad. Walk the list
of COPY MachineInstr to find the original virtual and physical registers
defined by the INLINEASM_BR MachineInst.

Test cases from https://reviews.llvm.org/D139565.
Link: https://github.com/llvm/llvm-project/issues/59538
Part 3 from
https://discourse.llvm.org/t/rfc-syncing-asm-goto-with-outputs-with-gcc/65453/8

Follow up patches still need to wire up CallBrPrepare into the pass
pipelines.

Reviewed By: efriedma, void

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

20 months ago[llvm][CallBrPrepare] use SSAUpdater to use intrinsic value
Nick Desaulniers [Fri, 17 Feb 2023 01:47:13 +0000 (17:47 -0800)]
[llvm][CallBrPrepare] use SSAUpdater to use intrinsic value

Now that we've inserted a call to an intrinsic, we need to update
certain previous uses of CallBrInst values to use the value of this
intrinsic instead.

There are 3 cases to handle:
1. The @llvm.callbr.landingpad.<type>() intrinsic call is in the same
   BasicBlock as the use of the callbr we're replacing.
2. The use is dominated by the direct destination.
3. The use is not dominated by the direct destination, and may or may
   not be dominated by the indirect destination.

Part 2c of
https://discourse.llvm.org/t/rfc-syncing-asm-goto-with-outputs-with-gcc/65453/8.

Reviewed By: efriedma, void, jyknight

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

20 months ago[llvm][CallBrPrepare] add llvm.callbr.landingpad intrinsic
Nick Desaulniers [Fri, 17 Feb 2023 01:46:47 +0000 (17:46 -0800)]
[llvm][CallBrPrepare] add llvm.callbr.landingpad intrinsic

Insert a new intrinsic call after splitting critical edges, and verify
it. Later commits will update the SSA values to use this new value along
indirect branches rather than the callbr's value, and have SelectionDAG
consume this new value.

Part 2b of
https://discourse.llvm.org/t/rfc-syncing-asm-goto-with-outputs-with-gcc/65453/8.

Reviewed By: efriedma, jyknight

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

20 months ago[llvm][CallBrPrepare] split critical edges
Nick Desaulniers [Fri, 17 Feb 2023 01:46:21 +0000 (17:46 -0800)]
[llvm][CallBrPrepare] split critical edges

If we have a CallBrInst with output that's used, we need to split
critical edges so that we have some place to insert COPYs for physregs
to virtregs.

Part 2a of
https://discourse.llvm.org/t/rfc-syncing-asm-goto-with-outputs-with-gcc/65453/8.

Test cases and logic re-purposed from D138078.

Reviewed By: efriedma, void, jyknight

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

20 months ago[llvm] boilerplate for new callbrprepare codegen IR pass
Nick Desaulniers [Fri, 17 Feb 2023 01:45:50 +0000 (17:45 -0800)]
[llvm] boilerplate for new callbrprepare codegen IR pass

Because this pass is to be a codegen pass, it must use the legacy pass
manager.

Link: https://discourse.llvm.org/t/rfc-syncing-asm-goto-with-outputs-with-gcc/65453/8
Reviewed By: aeubanks, void

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

20 months ago[Dominators] check indirect branches of callbr
Nick Desaulniers [Fri, 17 Feb 2023 01:44:02 +0000 (17:44 -0800)]
[Dominators] check indirect branches of callbr

This will be necessary to support outputs from asm goto along indirect
edges.

Test via:
  $ pushd llvm/build; ninja IRTests; popd
  $ ./llvm/build/unittests/IR/IRTests \
    --gtest_filter=DominatorTree.CallBrDomination

Also, return nullptr in Instruction::getInsertionPointAfterDef for
CallBrInst as was recommened in
https://reviews.llvm.org/D135997#3991427.  The following phab review was
folded into this commit: https://reviews.llvm.org/D140166

Link: https://discourse.llvm.org/t/rfc-syncing-asm-goto-with-outputs-with-gcc/65453/8
Reviewed By: void, efriedma, ChuanqiXu, MaskRay

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

20 months ago[X86][MC] Fix the bug of -output-asm-variant=1 for intel syntax
Shengchen Kan [Thu, 16 Feb 2023 13:17:17 +0000 (21:17 +0800)]
[X86][MC] Fix the bug of -output-asm-variant=1 for intel syntax

Before this patch

```
$ echo "leal    (,%r15), %eax" | llvm-mc --show-encoding --output-asm-variant=1

        lea     eax, [r15]                      # encoding: [0x42,0x8d,0x04,0x3d,0x00,0x00,0x00,0x00]

$ echo "lea     eax, [r15]" | llvm-mc --show-encoding -x86-asm-syntax=intel --output-asm-variant=1

        lea     eax, [r15]                      # encoding: [0x41,0x8d,0x07]
```

MC printed the register r15 as a base in intel syntax even when it's an index.
Then we got a different encoding by using the assembly from the output of the
first command.

I believe the behavior is too weird to be called a feature.

After this patch, we get

```
$ echo "leal    (,%r15), %eax" | llvm-mc --show-encoding --output-asm-variant=1

        lea     eax, [1*r15]                    # encoding: [0x42,0x8d,0x04,0x3d,0x00,0x00,0x00,0x00]
```

Reviewed By: RKSimon, pengfei, MaskRay

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

20 months ago[Attributor][FIX] Ensure we adjust types properly
Johannes Doerfert [Fri, 17 Feb 2023 01:40:47 +0000 (17:40 -0800)]
[Attributor][FIX] Ensure we adjust types properly

When we simplify loads we need to adjust types (esp. null-values)
properly to avoid inconsinstencies down the line. Add a cast and an
error message.

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

20 months ago[LLDB] Remove unused variable 'lang_rt' in ClangExpressionParser.cpp (NFC)
Jie Fu [Fri, 17 Feb 2023 01:31:05 +0000 (09:31 +0800)]
[LLDB] Remove unused variable 'lang_rt' in ClangExpressionParser.cpp (NFC)

/data/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp:398:34: error: variable 'lang_rt' set but not used [-Werror,-Wunused-but-set-variable]
  lldb_private::LanguageRuntime *lang_rt = nullptr;
                                 ^
1 error generated.

20 months ago[ComplexLogicCombine] Precommit tests for complex logic combine init patch; NFC
chenglin.bi [Fri, 17 Feb 2023 01:34:04 +0000 (09:34 +0800)]
[ComplexLogicCombine] Precommit tests for complex logic combine init patch; NFC

20 months agoRevert "[LLDB] Enable 64 bit debug/type offset"
Alexander Yermolovich [Fri, 17 Feb 2023 01:20:27 +0000 (17:20 -0800)]
Revert "[LLDB] Enable 64 bit debug/type offset"

This reverts commit 2062e90aa531e8445e5dc0e16222c0f246af1bf4.

20 months ago[WebAssembly] Fix simd bit shift intrinsics codegen
Jun Ma [Thu, 16 Feb 2023 07:36:07 +0000 (15:36 +0800)]
[WebAssembly] Fix simd bit shift intrinsics codegen

According to github.com/WebAssembly/simd/blob/main/proposals/simd/SIMD.md,
the shift count of bit shift instructions is taken modulo lane width.
This patch adds such operation.

Fixes PR#60655

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

20 months ago[WebAssembly] Update wasm.c with update_cc_test_checks.py. NFC
Jun Ma [Thu, 16 Feb 2023 07:42:40 +0000 (15:42 +0800)]
[WebAssembly] Update wasm.c with update_cc_test_checks.py. NFC

20 months ago[mlir][sparse] comment out test cases in sparse_conversion with similiar behavior.
Peiming Liu [Fri, 17 Feb 2023 01:08:00 +0000 (01:08 +0000)]
[mlir][sparse] comment out test cases in sparse_conversion with similiar behavior.

Reviewed By: aartbik

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

20 months ago[flang][runtime] Allow record advancement in child I/O via '/' control edit descriptor
Peter Klausler [Thu, 16 Feb 2023 18:46:50 +0000 (10:46 -0800)]
[flang][runtime] Allow record advancement in child I/O via '/' control edit descriptor

My earlier misreading of the Fortran standards had convinced me that child I/O
-- meaning the use of user-defined subroutines via generic interfaces to implement
data transfer statements -- was not allowed to advance the current record in the
ultimate unit of the original (non-child parent) data transfer statement.
This turns out to be wrong, so forward AdvanceRecord() from ChildFormattedIoStatement<>
to its parent I/O statement rather than implementing it as a no-op.

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

20 months ago[PowerPC] remove XXSWAPD after load from CP which is a splat value
Ting Wang [Fri, 17 Feb 2023 00:21:35 +0000 (19:21 -0500)]
[PowerPC] remove XXSWAPD after load from CP which is a splat value

If the value from constant-pool is a splat value of vector type, do not
need swap after load from constant-pool.

Reviewed By: shchenz

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

20 months ago[AArch64][ISel] Always use pre-inc/post-inc addressing mode for auto-indexed load...
Huihui Zhang [Thu, 16 Feb 2023 23:40:43 +0000 (15:40 -0800)]
[AArch64][ISel] Always use pre-inc/post-inc addressing mode for auto-indexed load/store with constant offset.

Unlike ARM target, current AArch64 target doesn't have facility to encode the
operation bit: whether to add an offset to base pointer for pre-inc/post-inc
addressing mode, or to subtract an offset from base pointer for
pre-dec/post-dec addressing mode.

A mis-compile (https://github.com/llvm/llvm-project/issues/60645) was noticed
due to this limitation.

Therefore, for AArch64 auto-indexed load/store with constant offset, always
use pre-inc/post-inc addressing mode. The constant offset is negated for
pre-dec/post-dec addressing mode.
An auto-indexed address with non-constant offset is currently not split into
base and offset parts. If we are to handle non-constant offset in the future,
offset node will need to take a negate.

Reviewed By: efriedma

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

20 months ago[mlir][sparse] split reshape.mlir into expand/collapse_shape.mlir.
Peiming Liu [Thu, 16 Feb 2023 23:58:02 +0000 (23:58 +0000)]
[mlir][sparse] split reshape.mlir into expand/collapse_shape.mlir.

Reviewed By: aartbik

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

20 months ago[MLIR][OpenMP] Add Conversion for Atomic Update Op
Kiran Chandramohan [Thu, 16 Feb 2023 18:48:49 +0000 (18:48 +0000)]
[MLIR][OpenMP] Add Conversion for Atomic Update Op

Reviewed By: TIFitis

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

20 months ago[Pipeline] Move ControlHeightReduction to module optimization pipeline
Arthur Eubanks [Mon, 6 Feb 2023 19:04:32 +0000 (11:04 -0800)]
[Pipeline] Move ControlHeightReduction to module optimization pipeline

This pass isn't a simplification, it's a non-canonical optimization.

This makes it only run once in a (Thin)LTO pipeline during postlink, just like all the other optimization pipeline passes.

Reviewed By: xur

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

20 months ago[mlir][sparse] allow foreach operation to generate out-of-order loop on non-annotated...
Peiming Liu [Thu, 16 Feb 2023 20:24:01 +0000 (20:24 +0000)]
[mlir][sparse] allow foreach operation to generate out-of-order loop on non-annotated tensor.

No need for a temp COO and sort even when converting dense -> CSC, we can instead rotate the loop to yield a ordered coordinates at beginning.

Reviewed By: aartbik

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

20 months ago[LLDB] Enable 64 bit debug/type offset
Alexander Yermolovich [Thu, 16 Feb 2023 22:46:13 +0000 (14:46 -0800)]
[LLDB] Enable 64 bit debug/type offset

This came out of from https://discourse.llvm.org/t/dwarf-dwp-4gb-limit/63902
With big binaries we can have .dwp files where .debug_info.dwo section can grow
beyond 4GB. We would like to support this in LLVM and in LLDB.

The plan is to enable manual parsing of cu/tu index in DWARF library
(https://reviews.llvm.org/D137882), and then
switch internal index data structure to 64 bit.
For the second part is to enable 64bit offset support in LLDB with
this patch.

Depends on D139955

Reviewed By: labath

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

20 months ago[gn build] Manually port D143983
Arthur Eubanks [Thu, 16 Feb 2023 21:41:05 +0000 (13:41 -0800)]
[gn build] Manually port D143983

20 months ago[Object][NFC] Remove unneeded llvm_unreachable
Gregory Alfonso [Thu, 16 Feb 2023 21:20:41 +0000 (13:20 -0800)]
[Object][NFC] Remove unneeded llvm_unreachable

Reviewed By: MaskRay

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

20 months ago[PowerPC] Bail out of FISel when lowering long calls
Nemanja Ivanovic [Thu, 16 Feb 2023 21:15:25 +0000 (16:15 -0500)]
[PowerPC] Bail out of FISel when lowering long calls

We currently don't handle tail calls in fast-isel but
we continue with the lowering when -mlongcall is
specified and lower the calls normally. We should
defer to SDISel for this so that it is lowered correctly.

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

20 months ago[mlir][sparse] Remove the expansion of symmetric MTX in the sparse tensor storage.
bixia1 [Thu, 16 Feb 2023 17:52:01 +0000 (09:52 -0800)]
[mlir][sparse] Remove the expansion of symmetric MTX in the sparse tensor storage.

We will support symmetric MTX without expanding the data in the sparse tensor
storage.

Reviewed By: aartbik

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

20 months ago[Libomptarget] Check errors when synchronizing the async queue
Joseph Huber [Thu, 16 Feb 2023 20:50:56 +0000 (14:50 -0600)]
[Libomptarget] Check errors when synchronizing the async queue

Summary:
Currently when we synchronize the asynchronous queue for the plugins, we
ignore the return value. This is problematic because we will continue on
like nothing happened if the kernel fails.

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

Reviewed By: jdoerfert

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

20 months agoRevert "[Libomptarget] Check errors when synchronizing the async queue"
Joseph Huber [Thu, 16 Feb 2023 20:50:31 +0000 (14:50 -0600)]
Revert "[Libomptarget] Check errors when synchronizing the async queue"

This reverts commit 861709107b43d40ad366e0efd225cb804be3b44d.

Reverting this to reland as it will make it easier to backport.

20 months agoRenderScript still exists as a clang language, so handle as invalid
Sterling Augustine [Thu, 16 Feb 2023 20:19:26 +0000 (12:19 -0800)]
RenderScript still exists as a clang language, so handle as invalid

20 months ago[Bazel][mlir] Fix build errors
Pranav Kant [Thu, 16 Feb 2023 19:57:18 +0000 (19:57 +0000)]
[Bazel][mlir] Fix build errors

Fallback from https://reviews.llvm.org/D143925

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

20 months ago[flang] Handle expression in SELECT TYPE selector
Valentin Clement [Thu, 16 Feb 2023 19:59:54 +0000 (20:59 +0100)]
[flang] Handle expression in SELECT TYPE selector

Expression in selector were raising an error. In some
cases expression can be found in selector. This patch
updates the code to accept expression and adds a lowering
test.

Reviewed By: PeteSteinfeld, vdonaldson

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

20 months agoRemove now unused enum.
Sterling Augustine [Thu, 16 Feb 2023 19:54:35 +0000 (11:54 -0800)]
Remove now unused enum.

20 months ago[Pipeline] Remove -enable-npm-O3-nontrivial-unswitch flag
Arthur Eubanks [Thu, 16 Feb 2023 19:35:18 +0000 (11:35 -0800)]
[Pipeline] Remove -enable-npm-O3-nontrivial-unswitch flag

This was added to help debugging performance issues, no longer needed.

Reviewed By: asbirlea

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

20 months ago[Pipeline] Remove -enable-no-rerun-simplification-pipeline flag
Arthur Eubanks [Wed, 15 Feb 2023 19:19:48 +0000 (11:19 -0800)]
[Pipeline] Remove -enable-no-rerun-simplification-pipeline flag

This has been on without complaint for a while.

Reviewed By: asbirlea

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

20 months ago[libc][bazel] add string to float targets
Michael Jones [Wed, 15 Feb 2023 22:26:30 +0000 (14:26 -0800)]
[libc][bazel] add string to float targets

This patch adds atof, strtof, strtod, and strtold to the bazel build, as
well as their tests.

Reviewed By: sivachandra

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

20 months ago[lldb] Replace SB swig interfaces with API headers
Alex Langford [Fri, 27 Jan 2023 01:33:33 +0000 (17:33 -0800)]
[lldb] Replace SB swig interfaces with API headers

Instead of maintaining separate swig interface files, we can use the API
headers directly. They implement the exact same C++ APIs and we can
conditionally include the python extensions as needed. To remove the
swig extensions from the API headers when building the LLDB
framework, we can use the unifdef tool when it is available. Otherwise
we just copy them as-is.

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

20 months ago[libc++] Add regression test for std::hash implementation in ABI v1
Louis Dionne [Wed, 15 Feb 2023 15:49:45 +0000 (10:49 -0500)]
[libc++] Add regression test for std::hash implementation in ABI v1

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

20 months ago[mlir][linalg][tensor] Delete duplicate tests and fix typo in filename
Hanhan Wang [Thu, 16 Feb 2023 01:38:46 +0000 (17:38 -0800)]
[mlir][linalg][tensor] Delete duplicate tests and fix typo in filename

These two files contain the identical tests. The commit deletes one of
the files, and fix a typo in filename for the other one.

Reviewed By: chelini

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

20 months agoRemove Renderscript LLDB
Yi Kong [Tue, 14 Feb 2023 06:55:57 +0000 (14:55 +0800)]
Remove Renderscript LLDB

Renderscript is deprecated from Android, we no longer support LLDB for
Renderscript.

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

20 months ago[RISCV] Accept zicsr and zifencei command line options
Philip Reames [Thu, 16 Feb 2023 18:27:52 +0000 (10:27 -0800)]
[RISCV] Accept zicsr and zifencei command line options

This change adds the definition of the two extensions, but does not either a) make any instruction conditional on them or b) enabled the extensions by default. (The *instructions* do remain enabled by default per ISA version 2.0 which is our current default.)

This is meant to be a building block towards something like https://reviews.llvm.org/D141666, and in the meantime, address one of the most surprising of the current user experience warts. The current behavior of rejecting the extensions at the command line despite emitting code which appears to use them is surprising to anyone not deeply versed in the details of this situation.

Between versions 2.0 and 2.1 of the base I specification, a backwards incompatible change was made to remove selected instructions and CSRs from the base ISA. These instructions were grouped into a set of new extensions (these), but were no longer required by the base ISA. This change is described in “Preface to Document Version 20190608-Base-Ratified” from the specification document.

As LLVM currently implements only version 2.0 of the base specification, accepting these extensions at the command line introduces a configuration which doesn't actually match any spec version. It's a pretty harmless variant since the 2.0 extension definitions, to my knowledge, exactly match the text from the 2.0 I text before they were moved into standalone extensions in 2.1 of I. (The version numbering in that sentence is a tad confusing to say the least. Hopefully I got it right.)

It is worth noting that we already have numerous examples of accepting extensions in the march string which didn't exist in version of the spec document corresponding to our current base I version, so this doesn't set any new precedent.

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

20 months ago[libunwind][PowerPC] Fix saving/restoring VSX registers on LE systems
Nemanja Ivanovic [Thu, 16 Feb 2023 18:37:31 +0000 (13:37 -0500)]
[libunwind][PowerPC] Fix saving/restoring VSX registers on LE systems

Currently, libunwind just uses stxvd2x/lxvd2x to save/restore
VSX registers respectively. This puts the registers in
doubleword-reversed order into memory on little endian systems.
If both the save and restore are done the same way, this
isn't a problem. However if the unwinder is just restoring
a callee-saved register, it will restore it in the wrong
order (since function prologues save them in the correct order).
This patch adds the necessary swaps before the saves and after
the restores.

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

20 months ago[libc] Implement htonl and htons
Raman Tenneti [Thu, 16 Feb 2023 17:56:36 +0000 (09:56 -0800)]
[libc] Implement htonl and htons

Per spec:
* https://pubs.opengroup.org/onlinepubs/9699919799/functions/htonl.html
* https://pubs.opengroup.org/onlinepubs/9699919799/functions/htons.html

Also adds UInt16Type and UInt32Type to spec.td

Co-authored-by: Jeff Bailey <jbailey@google.com>
Reviewed By: sivachandra, jeffbailey, rtenneti

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

20 months ago[Hexagon] Fix number of arguments in call to DAG.getNode for VINSERTW0
Krzysztof Parzyszek [Wed, 15 Feb 2023 21:59:54 +0000 (13:59 -0800)]
[Hexagon] Fix number of arguments in call to DAG.getNode for VINSERTW0

HexagonISD::VINSERTW0 takes two inputs, but only one was provided.

20 months ago[HLSL] add log library functions
Joshua Batista [Thu, 16 Feb 2023 17:28:33 +0000 (09:28 -0800)]
[HLSL] add log library functions

This change exposes the log library functions for HLSL,excluding long, int, and long long doubles. The log functions are supported for all scalar, vector, and matrix types.
Long and long long double support is missing in this patch because those types
don't exist in HLSL. Int is missing because the log functions only work on floating type arguments.

The full documentation of the HLSL log functions are available here:
https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-log
https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-log2
https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-log10

Reviewed By: python3kgae

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

20 months agoRevert "[RISCV][MC] Add support for experimental zfa extension (FLI instruction not...
Philip Reames [Thu, 16 Feb 2023 17:30:14 +0000 (09:30 -0800)]
Revert "[RISCV][MC] Add support for experimental zfa extension (FLI instruction not included)"

This reverts commit f6fa5a66d8a8190002d3eb542e4b5a99deb53004.  Several buildbots are failing.  An example:
https://lab.llvm.org/buildbot#builders/196/builds/26601

20 months agoAMDGPU: Add a regression test case for D143963
Jay Foad [Thu, 16 Feb 2023 17:09:26 +0000 (17:09 +0000)]
AMDGPU: Add a regression test case for D143963

20 months agoRevert "AMDGPU: Override getNegatedExpression constant handling"
Jay Foad [Thu, 16 Feb 2023 17:05:33 +0000 (17:05 +0000)]
Revert "AMDGPU: Override getNegatedExpression constant handling"

This reverts commit 11c3cead23783e65fb30e673d62771352078ff05.

It was causing infinite loops in the DAG combiner.

20 months agoRevert "[LowerTypeTests] Support generating Armv6-M jump tables."
Simon Tatham [Thu, 16 Feb 2023 17:05:43 +0000 (17:05 +0000)]
Revert "[LowerTypeTests] Support generating Armv6-M jump tables."

This reverts commit f6ddf7781471b71243fa3c3ae7c93073f95c7dff.

Eight buildbots reported that the two test files changed by that
commit had started failing. The buildbots in question all had in
common that they build with a very restricted `LLVM_TARGETS_TO_BUILD`,
such as only X86 or AArch64 or Hexagon. I didn't notice this before
commit because my own build has the full default set of targets, and
in that circumstance, the tests pass.

I assume the problem has something to do with the attempt to query
TargetTransformInfo: if you can't make a valid TTI for the target
triple then you can't ask it what kind of inline assembler you should
be emitting, and so `opt` without the Arm backend can't get the Arm
cases of these tests right.

I don't have time to fix this until next week, so I'll revert the
change for now to keep the buildbots happy.

20 months ago[AMDGPU] Add another G_UNMERGE_VALUES legalization test case
Jay Foad [Thu, 16 Feb 2023 16:41:25 +0000 (16:41 +0000)]
[AMDGPU] Add another G_UNMERGE_VALUES legalization test case

20 months ago[libc] Support running tests for Pigweed
Alex Brachet [Thu, 16 Feb 2023 16:38:19 +0000 (16:38 +0000)]
[libc] Support running tests for Pigweed

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

20 months ago[AMDGPU] Regenerate check lines to enable updating for D144050.
Florian Hahn [Thu, 16 Feb 2023 16:38:15 +0000 (16:38 +0000)]
[AMDGPU] Regenerate check lines to enable updating for D144050.

20 months ago[XCore] Adapt Clang tests to opaque pointers.
Nigel Perks [Wed, 15 Feb 2023 14:44:57 +0000 (14:44 +0000)]
[XCore] Adapt Clang tests to opaque pointers.

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

20 months ago[flang] Always incorporate parent types' special generic bindings
Peter Klausler [Thu, 16 Feb 2023 00:39:14 +0000 (16:39 -0800)]
[flang] Always incorporate parent types' special generic bindings

The runtime type information table generator was broken when dealing
with an extension derived type that didn't include a special generic
procedure binding for ASSIGNMENT(=) or user-defined I/O, but one of
whose ancestor types did.  Ensure that the runtime derived type info
tables have complete subtables for all of these special bindings,
and respect any overrides that may have been defined.

Motivating example:
  type parent
   contains
    procedure :: dtWrite => dtWrite1
    generic :: write(formatted) => dtWrite
  end type
  type, extends(parent) :: extended
   contains
    procedure :: dtWrite => dtWrite2
  end type

The runtime derived type information table for "extended" must include
a special generic procedure entry for "write(formatted)" that points
to "dtWrite2" even though "extend" has no generic procedure for
"write(formatted)".

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

20 months ago[LSR] Add test case which shows additional LSR with D144050.
Florian Hahn [Thu, 16 Feb 2023 16:12:07 +0000 (16:12 +0000)]
[LSR] Add test case which shows additional LSR with D144050.

20 months ago[Libomptarget] Check errors when synchronizing the async queue
Joseph Huber [Thu, 16 Feb 2023 15:51:21 +0000 (09:51 -0600)]
[Libomptarget] Check errors when synchronizing the async queue

Currently when we synchronize the asynchronous queue for the plugins, we
ignore the return value. This is problematic because we will continue on
like nothing happened if the kernel fails.

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

Reviewed By: jdoerfert

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

20 months ago[RISCV][MC] Add support for experimental zfa extension (FLI instruction not included)
Jun Sha (Joshua) [Thu, 16 Feb 2023 15:51:34 +0000 (07:51 -0800)]
[RISCV][MC] Add support for experimental zfa extension (FLI instruction not included)

This implements experimental support for the RISCV Zfa extension as specified here: https://github.com/riscv/riscv-isa-manual/releases/download/draft-20221119-5234c63/riscv-spec.pdf, Ch. 25. This extension has not been ratified. Once ratified, it'll move out of experimental status.

This change adds assembly support for all instructions except load-immediate instructions (fli.s/fli.d/fli.h).  Assembly support for that instruction and codegen support will follow in separate patches.

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

20 months ago[Clang] Convert some tests to opaque pointers (NFC)
Nikita Popov [Thu, 16 Feb 2023 15:53:59 +0000 (16:53 +0100)]
[Clang] Convert some tests to opaque pointers (NFC)

20 months ago[Clang] Regenerate check lines (NFC)
Nikita Popov [Thu, 16 Feb 2023 15:49:30 +0000 (16:49 +0100)]
[Clang] Regenerate check lines (NFC)

Convert test to use update_cc_test_checks.

20 months agoRevert "[RISCV][MC] Add support for experimental zfa extension(FLI instruction not...
Philip Reames [Thu, 16 Feb 2023 15:22:51 +0000 (07:22 -0800)]
Revert "[RISCV][MC] Add support for experimental zfa extension(FLI instruction not included)"

This reverts commit 54c136e6c630966255293d42c882eab116437834. It was submitted without an appropriate patch description.  Will reapply shortly.

20 months agoRevert "Update: [RISCV][MC] Add support for experimental zfa extension(FLI instructio...
Philip Reames [Thu, 16 Feb 2023 15:22:46 +0000 (07:22 -0800)]
Revert "Update: [RISCV][MC] Add support for experimental zfa extension(FLI instruction not included)"

This reverts commit 321cd52ba2647259f58b0d38cdb62528a9ded9a1. It was submitted without an appropriate patch description.  Will reapply shortly.

20 months agoRevert "[RISCV][CodeGen] Add codegen pattern for experimental zfa extension (FLI...
Philip Reames [Thu, 16 Feb 2023 15:22:15 +0000 (07:22 -0800)]
Revert "[RISCV][CodeGen] Add codegen pattern for experimental zfa extension (FLI and FCVTMOD not included)"

This reverts commit fc6d517e2f335c2ab2b14a34eb747a4703aca7e4.  It was submitted without an appropriate patch description.  Will reapply shortly.

20 months ago[LSR] Improve filtered uses in NarrowSearchSpaceByPickingWinnerRegs
David Green [Thu, 16 Feb 2023 15:48:12 +0000 (15:48 +0000)]
[LSR] Improve filtered uses in NarrowSearchSpaceByPickingWinnerRegs

NarrowSearchSpaceByPickingWinnerRegs has an aggressive filtering method to
reduce the complexity of the search space down by picking a best formula with
the highest number of reuses and assuming it will yield profitable reuse. In
certain cases we can find a best formula like {X+30,+,1} and later check a
formula like {X,+,1} with the same number of Uses. On some architectures it
can be better to pick {X,+,1}, especially if an offset of 30 can be used as a
legal addressing mode, but -30 cannot. That happens under Thumb1 code, which
has fairly limited addressing modes. This patch adds a check to see if it can
pick the simpler formula, if it looks more profitable.

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

20 months ago[Clang] Convert some tests to opaque pointers (NFC)
Nikita Popov [Thu, 16 Feb 2023 15:37:20 +0000 (16:37 +0100)]
[Clang] Convert some tests to opaque pointers (NFC)

20 months ago[LowerTypeTests] Support generating Armv6-M jump tables.
Simon Tatham [Thu, 16 Feb 2023 15:34:33 +0000 (15:34 +0000)]
[LowerTypeTests] Support generating Armv6-M jump tables.

The LowerTypeTests pass emits a jump table in the form of an
`inlineasm` IR node containing a string representation of some
assembly. It tests the target triple to see what architecture it
should be generating assembly for. But that's not good enough for
`Triple::thumb`, because the 32-bit PC-relative `b.w` branch
instruction isn't available in all supported architecture versions. In
particular, Armv6-M doesn't support that instruction (although the
similar Armv8-M Baseline does).

Most of this patch is concerned with working out whether the
compilation target is Armv6-M or not, which I'm doing by going through
all the functions in the module, retrieving a TargetTransformInfo for
each one, and querying it via a new method I've added to check its
SubtargetInfo. If any function's TTI indicates that it's targeting an
architecture supporting B.W, then we assume we're also allowed to use
B.W in the jump table.

The Armv6-M compatible jump table format requires a temporary
register, and therefore also has to use the stack in order to restore
that register.

Another consequence of this change is that jump tables on Arm/Thumb
are no longer always the same size. In particular, on an architecture
that supports Arm and Thumb-1 but not Thumb-2, the Arm and Thumb
tables are different sizes from //each other//. As a consequence,
``getJumpTableEntrySize`` can no longer base its answer on the target
triple's architecture: it has to take into account the decision that
``selectJumpTableArmEncoding`` made, which meant I had to move that
function to an earlier point in the code and store its answer in the
``LowerTypeTestsModule`` class.

Reviewed By: lenary

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

20 months agollvm-tblgen: Apply IWYU partially
NAKAMURA Takumi [Thu, 16 Feb 2023 15:28:07 +0000 (00:28 +0900)]
llvm-tblgen: Apply IWYU partially

20 months ago[flang] lower hlfir.matmul into fir runtime call
Tom Eccles [Tue, 14 Feb 2023 18:09:35 +0000 (18:09 +0000)]
[flang] lower hlfir.matmul into fir runtime call

We can't test lowering calls with hlfir.expr arguments yet because this
hits a not yet implemented: "get shape form HLFIR expr without producer
holding the shape".

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

20 months ago[flang] lower matmul intrinsic to hlfir.matmul operation
Tom Eccles [Tue, 14 Feb 2023 12:04:52 +0000 (12:04 +0000)]
[flang] lower matmul intrinsic to hlfir.matmul operation

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

20 months ago[flang] add hlfir.matmul operation
Tom Eccles [Mon, 13 Feb 2023 18:04:46 +0000 (18:04 +0000)]
[flang] add hlfir.matmul operation

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

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