platform/upstream/llvm.git
22 months agoSupport: Try to fix msan error in sys::Wait
Matt Arsenault [Wed, 14 Dec 2022 19:09:09 +0000 (14:09 -0500)]
Support: Try to fix msan error in sys::Wait

22 months ago[mlir][SparseTensor] Add a few tests for sparse vectorization
Quentin Colombet [Thu, 8 Dec 2022 11:45:19 +0000 (11:45 +0000)]
[mlir][SparseTensor] Add a few tests for sparse vectorization

These tests covers mulf, ori, and subi.

NFC

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

22 months ago[RISCV] Avoid generate large LMUL vmv.s.x or fvmv.s.f
Philip Reames [Wed, 14 Dec 2022 15:27:53 +0000 (07:27 -0800)]
[RISCV] Avoid generate large LMUL vmv.s.x or fvmv.s.f

This is a follow up to patch discussion on D139656. As noted there, M2/M4/M8 versions of these instructions don't actually exist, and using them results in overly constrained register allocation.

In that review, we'd talked about moving towards a variant of the instructions which ignored LMUL. I decided to see what happened if we just stopped generating the high LMUL variants, and the results are surprisingly neutral. I only see one minor thing which looks like a real regression among all the churn. I think this is worth doing now to loosen register allocation constraints, and avoid digging our hole around these instructions deeper while thinking about the right model change.

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

22 months ago[IR] Adds Function::splice() member functions
Vasileios Porpodas [Tue, 13 Dec 2022 21:22:04 +0000 (13:22 -0800)]
[IR] Adds Function::splice() member functions

This is part of a series of patches that aim at making Function::getBasicBlockList() private.

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

22 months ago[FileCheck] llvm::Optional => std::optional
Fangrui Song [Wed, 14 Dec 2022 18:44:30 +0000 (18:44 +0000)]
[FileCheck] llvm::Optional => std::optional

Don't touch FileCheck.cpp:698 StringSwitch<Optional<binop_eval_t>>(FuncName).
MSVC and older GCC may report errors:

error C2664: 'llvm::StringSwitch<std::optional<llvm::binop_eval_t>,T> &llvm::StringSwitch<T,T>::Case(llvm::StringLiteral,T)': cannot convert argument 2 from 'overloaded-function' to 'T'
        with
        [
            T=std::optional<llvm::binop_eval_t>
        ]

llvm/lib/FileCheck/FileCheck.cpp:699:44: error: no matching function for call to ‘llvm::StringSwitch<std::optional<llvm::Expected<llvm::ExpressionValue> (*)(const llvm::ExpressionValue&, const llvm::ExpressionValue&)> >::Case(const char [4], <unresolved overloaded function type>)’
                      .Case("add", operator+)
                                            ^

22 months ago[CodeComplete] Provide designated-init completions in (const) reference context
Sam McCall [Wed, 14 Dec 2022 16:26:14 +0000 (17:26 +0100)]
[CodeComplete] Provide designated-init completions in (const) reference context

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

22 months ago[RISCV] Add a bit to TSFlags to mark SignExtendingOpW instructions for SExtWRemoval.
Craig Topper [Wed, 14 Dec 2022 18:30:59 +0000 (10:30 -0800)]
[RISCV] Add a bit to TSFlags to mark SignExtendingOpW instructions for SExtWRemoval.

Instead of switching on the opcode in SExtWRemoval, we can use a
bit in TSFlags. This reduces the amount of code that needs to be
generated to implement the switch. The opcodes are scattered throughout
the opcode enum, so the switch isn't very densely packed.

Reviewed By: asb

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

22 months ago[ADT] Remove Optional<T>::create
Kazu Hirata [Wed, 14 Dec 2022 18:34:34 +0000 (10:34 -0800)]
[ADT] Remove Optional<T>::create

The last use of Optional<T>::create was removed on December 10, 2022
in commit 1cb7fba3e57d6c31f05c7a2bda1634da49dd1d18.

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

22 months ago[scudo] Reland: Fix and enable more warnings for standalone build
Dominic Chen [Sat, 10 Dec 2022 01:15:47 +0000 (17:15 -0800)]
[scudo] Reland: Fix and enable more warnings for standalone build

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

22 months ago[clang-format][NFC] Don't run any passes if Environment::make fails
Owen Pan [Wed, 14 Dec 2022 07:37:58 +0000 (23:37 -0800)]
[clang-format][NFC] Don't run any passes if Environment::make fails

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

22 months ago[Hexagon] Handle rounding beyond low 32 bits
Krzysztof Parzyszek [Wed, 14 Dec 2022 17:32:34 +0000 (09:32 -0800)]
[Hexagon] Handle rounding beyond low 32 bits

22 months ago[NFC] Cleanup: BasicBlock::getInstList() and BasicBlock::getSublistAccess() are now...
Vasileios Porpodas [Mon, 28 Nov 2022 22:59:35 +0000 (14:59 -0800)]
[NFC] Cleanup: BasicBlock::getInstList() and BasicBlock::getSublistAccess() are now private

We now have an adequate set of API functions, including BasicBlock::splice(),
BasicBlock::erase(), Instruction::insertAt() etc. that we shouldn't need access
to the underlying instruction list.

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

22 months ago[mlir][math] Added math::FPowI conversion to LLVM dialect.
Slava Zakharin [Wed, 14 Dec 2022 05:45:07 +0000 (21:45 -0800)]
[mlir][math] Added math::FPowI conversion to LLVM dialect.

The operations are converted into LLVM::PowIOp.

Reviewed By: Mogball

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

22 months ago[Attributor][FIX] Allow negative offsets for ranges
Johannes Doerfert [Wed, 14 Dec 2022 18:10:01 +0000 (10:10 -0800)]
[Attributor][FIX] Allow negative offsets for ranges

In https://reviews.llvm.org/D136745 we introduced the "pre-condition"
that offsets should not be -1 or -2. This can easily break. The new
special values are INT32_MAX and INT32_MIN, which we might want to
replace with std::optional or flags instead.

22 months agoAttributes: Add function getter to parse integer string attributes
Matt Arsenault [Thu, 8 Dec 2022 15:53:17 +0000 (10:53 -0500)]
Attributes: Add function getter to parse integer string attributes

The most common case for string attributes parses them as integers. We
don't have a convenient way to do this, and as a result we have
inconsistent missing attribute and invalid attribute handling
scattered around. We also have inconsistent radix usage to
getAsInteger; some places use the default 0 and others use base 10.

Update a few of the uses, but there are quite a lot of these.

22 months agoRevert "[FileCheck] llvm::Optional => std::optional"
Douglas Yung [Wed, 14 Dec 2022 18:05:01 +0000 (10:05 -0800)]
Revert "[FileCheck] llvm::Optional => std::optional"

This reverts commit 13fd37c931c26ec07613dcad67b5ab2a593cd416.

This change is causing bot failures on some Windows and older GCC bots:
- https://lab.llvm.org/buildbot/#/builders/123/builds/14678
- https://lab.llvm.org/buildbot/#/builders/216/builds/14436
- https://lab.llvm.org/staging/#/builders/235/builds/993

22 months ago[VPlan] Sink non-uniform recieps for scalar plans.
Florian Hahn [Wed, 14 Dec 2022 17:55:30 +0000 (17:55 +0000)]
[VPlan] Sink non-uniform recieps for scalar plans.

In scalar plans, replicate recipes will only generate a single value per
UF, independent of whether they are uniform or not. So don't consider
uniformity for plans with scalar VFs only.

This allows us to handle a few additional cases in VPlan sinking instead
of non-VPlan sinkScalarOperands.

Depends on D133762.

Reviewed By: Ayal

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

22 months ago[MLIR] Generalize affine fusion to work on `Block` instead of `FuncOp`
Uday Bondhugula [Wed, 14 Dec 2022 17:25:20 +0000 (22:55 +0530)]
[MLIR] Generalize affine fusion to work on `Block` instead of `FuncOp`

The affine fusion pass can actually work on the top-level of a `Block`
and doesn't require to be called on a `FuncOp`. Remove this restriction
and generalize the pass to work on any `Block`. This allows fusion to be
performed, for example, on multiple blocks of a FuncOp or any
region-holding op like an scf.while, scf.if or even at an inner depth of
an affine.for or affine.if op. This generalization has no effect on
existing functionality. No changes to the fusion logic or its
transformational power were needed.

Update fusion pass to be a generic operation pass (instead of FuncOp
pass) and remove references and assumptions on the parent being a
FuncOp.

Reviewed By: dcaballe

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

22 months ago[MLIR] Fix/check for aliases for escaping memrefs in affine fusion
Uday Bondhugula [Tue, 13 Dec 2022 09:13:41 +0000 (14:43 +0530)]
[MLIR] Fix/check for aliases for escaping memrefs in affine fusion

Check for aliases for escaping memrefs check in affine fusion pass.  Fix
`isEscapingMemRef` to handle unknown defining ops for the memref.

Reviewed By: dcaballe

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

22 months ago[OpenMP] Add non-blocking support for target nowait regions
Guilherme Valarini [Wed, 14 Dec 2022 16:46:23 +0000 (13:46 -0300)]
[OpenMP] Add non-blocking support for target nowait regions

This patch better integrates the target nowait functions with the tasking runtime. It splits the nowait execution into two stages: a dispatch stage, which triggers all the necessary asynchronous device operations and stores a set of post-processing procedures that must be executed after said ops; and a synchronization stage, responsible for synchronizing the previous operations in a non-blocking manner and running the appropriate post-processing functions. Suppose during the synchronization stage the operations are not completed. In that case, the attached hidden helper task is re-enqueued to any hidden helper thread to be later synchronized, allowing other target nowait regions to be concurrently dispatched.

Reviewed By: jdoerfert, tianshilei1992

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

22 months ago[BOLT][DWARF] Fix for Handle zero size DW_TAG_inlined_subroutine
Alexander Yermolovich [Wed, 14 Dec 2022 17:00:33 +0000 (09:00 -0800)]
[BOLT][DWARF] Fix for Handle zero size DW_TAG_inlined_subroutine

Managed to introduce an error when changing code to fix other tests and the unit
test was no adequate due to --nostdlib being passed in in llvm testing
enviroment.
Original diff: https://reviews.llvm.org/D132059

Updated a test to make sure that original address and the new address are
different.

Reviewed By: maksfb, #bolt

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

22 months agobolt: Update more sys::Wait calls
Matt Arsenault [Wed, 14 Dec 2022 17:00:02 +0000 (12:00 -0500)]
bolt: Update more sys::Wait calls

22 months ago[Attributor][NFCI] Update tests according to last commit
Johannes Doerfert [Wed, 14 Dec 2022 16:59:20 +0000 (08:59 -0800)]
[Attributor][NFCI] Update tests according to last commit

Will look into the difference now, this is to apease the bots.

22 months agobolt: Try to fix build after sys::Program API change
Matt Arsenault [Wed, 14 Dec 2022 16:56:13 +0000 (11:56 -0500)]
bolt: Try to fix build after sys::Program API change

Hopefully fixes build after 15a6e3c636977dc962a415c067182e6d57242116

22 months ago[Attributor][FIX] Try to prevent a potential memory leak
Johannes Doerfert [Wed, 14 Dec 2022 16:40:17 +0000 (08:40 -0800)]
[Attributor][FIX] Try to prevent a potential memory leak

We might not have registered an AA allocated via the bump allocator
and consequently not deallocated it properly.

22 months ago[Flang] Convert a test to check 'target=...'
Paul Robinson [Tue, 13 Dec 2022 16:52:31 +0000 (08:52 -0800)]
[Flang] Convert a test to check 'target=...'

Part of the project to eliminate special handling for triples in lit
expressions.

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

22 months ago[gn build] Port e356f681f6c4
LLVM GN Syncbot [Wed, 14 Dec 2022 16:17:52 +0000 (16:17 +0000)]
[gn build] Port e356f681f6c4

22 months ago[XCOFF] Decode the relocation entries of loader section of xcoff for llvm-readobj
zhijian [Wed, 14 Dec 2022 16:16:20 +0000 (11:16 -0500)]
[XCOFF] Decode the relocation entries of loader section of xcoff for llvm-readobj

Summary:

support decoding the relocation entries of loader section of xcoff for llvm-readobj

https://www.ibm.com/docs/en/aix/7.2?topic=formats-xcoff-object-file-format#XCOFF__vra3i31ejbau

Reviewers: James Henderson, Esme Yi
Differential Revision: https://reviews.llvm.org/D136787

22 months ago[mlir] Fix bazel build for https://reviews.llvm.org/D139187.
Oleg Shyshkov [Wed, 14 Dec 2022 16:03:09 +0000 (17:03 +0100)]
[mlir] Fix bazel build for https://reviews.llvm.org/D139187.

22 months ago[Clang] Convert test to opaque pointers (NFC)
Nikita Popov [Wed, 14 Dec 2022 15:50:30 +0000 (16:50 +0100)]
[Clang] Convert test to opaque pointers (NFC)

Required a lot of manual, but uninteresting, fixup.

22 months ago[AMDGPU] Clean up SReg classes
Jay Foad [Wed, 14 Dec 2022 12:04:28 +0000 (12:04 +0000)]
[AMDGPU] Clean up SReg classes

Remove unused LO16 classes SReg_LO16_XM0_XEXEC, SReg_LO16_XEXEC_HI and
SReg_LO16_XM0.

Simplify the definition of SReg_32.

Add SReg_32_XEXEC and use it to improve SReg_1_XEXEC which previously
excluded M0 for no good reason.

Improve SReg_1 which previously excluded EXEC_HI for no good reason.

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

22 months ago[libc++] Refactor .compile.fail.cpp tests for std::function
Louis Dionne [Fri, 25 Nov 2022 19:20:04 +0000 (14:20 -0500)]
[libc++] Refactor .compile.fail.cpp tests for std::function

Some of those .compile.fail.cpp tests had become incorrect and they
were not testing anything. In general, .compile.fail.cpp tests are
bad because they make it way too easy to write garbage tests. Indeed,
the test could fail to compile due to any reason whatsoever (even a
typo) and it would appear to work correctly.

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

22 months ago[clang][C++20] P0960R3 and P1975R0: Allow initializing aggregates from a parenthesize...
Alan Zhao [Mon, 3 Oct 2022 17:46:46 +0000 (10:46 -0700)]
[clang][C++20] P0960R3 and P1975R0: Allow initializing aggregates from a parenthesized list of values

This patch implements P0960R3, which allows initialization of aggregates
via parentheses.

As an example:

```
struct S { int i, j; };
S s1(1, 1);

int arr1[2](1, 2);
```

This patch also implements P1975R0, which fixes the wording of P0960R3
for single-argument parenthesized lists so that statements like the
following are allowed:

```
S s2(1);
S s3 = static_cast<S>(1);
S s4 = (S)1;

int (&&arr2)[] = static_cast<int[]>(1);
int (&&arr3)[2] = static_cast<int[2]>(1);
```

This patch was originally authored by @0x59616e and completed by
@ayzhao.

Fixes #54040, Fixes #54041

Co-authored-by: Sheng <ox59616e@gmail.com>
Full write up : https://discourse.llvm.org/t/c-20-rfc-suggestion-desired-regarding-the-implementation-of-p0960r3/63744

Reviewed By: ilya-biryukov

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

22 months ago[TargetLowering] Teach DemandedBits about VSCALE
Benjamin Maxwell [Mon, 12 Dec 2022 16:26:20 +0000 (16:26 +0000)]
[TargetLowering] Teach DemandedBits about VSCALE

This allows DemandedBits to see the result of VSCALE will be at most
VScaleMax * some compile-time constant. This relies on the vscale_range()
attribute being present on the function, with a max set. (This is done by
default when clang is targeting AArch64+SVE).

Using this various redundant operations (zexts, sexts, ands, ors, etc)
can be eliminated.

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

22 months ago[NFC][OpenMP] Add missing LLVM headers on utility file
Guilherme Valarini [Mon, 7 Nov 2022 16:07:27 +0000 (13:07 -0300)]
[NFC][OpenMP] Add missing LLVM headers on utility file

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

22 months ago[compiler-rt] Convert profile tests to opaque pointers (NFC)
Nikita Popov [Wed, 14 Dec 2022 15:45:05 +0000 (16:45 +0100)]
[compiler-rt] Convert profile tests to opaque pointers (NFC)

22 months ago[libc++] Implement `std::expected` P0323R12
Hui Xie [Fri, 4 Nov 2022 11:42:42 +0000 (11:42 +0000)]
[libc++] Implement `std::expected` P0323R12

Implement `std::expected` https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0323r12.html

Added tests

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

address comment

22 months ago[FuncSpec] Global ranking of specialisations
Momchil Velikov [Wed, 14 Dec 2022 14:55:59 +0000 (14:55 +0000)]
[FuncSpec] Global ranking of specialisations

The `FunctionSpecialization` pass chooses specializations among the
opportunities presented by a single function and its calls,
progressively penalizing subsequent specialization attempts by
artificially increasing the cost of a specialization, depending on how
many specialization were applied before. Thus the chosen
specializations are sensitive to the order the functions appear in the
module and may be worse than others, had those others been considered
earlier.

This patch makes the `FunctionSpecialization` pass rank the
specializations globally, i.e.  choose the "best" specializations
among the all possible specializations in the module, for all
functions.

Since this involved quite a bit of redesign of the pass data
structures, this patch also carries:

  * removal of duplicate specializations

  * optimization of call sites update, by collecting per
    specialization the list of call sites that can be directly
    rewritten, without prior expensive check if the call constants and
    their positions match those of the specialized function.

A bit of a write-up up about the FuncSpec data structures and
operation:

Each potential function specialisation is kept in a single vector
(`AllSpecs` in `FunctionSpecializer::run`).  This vector is populated
by `FunctionSpecializer::findSpecializations`.

The `findSpecializations` member function has a local `DenseMap` to
eliminate duplicates - with each call to the current function,
`findSpecializations` builds a specialisation signature (`SpecSig`)
and looks it in the duplicates map. If the signature is present, the
function records the call to rewrite into the existing specialisation
instance.  If the signature is absent, it means we have a new
specialisation instance - the function calculates the gain and creates
a new entry in `AllSpecs`. Negative gain specialisation are ignored at
this point, unless forced.

The potential specialisations for a function form a contiguous range
in the `AllSpecs` [1]. This range is recorded in `SpecMap SM`, so we
can quickly find all specialisations for a function.

Once we have all the potential specialisations with their gains we
need to choose the best ones, which fit in the module specialisation
budget. This is done by using a max-heap (`std::make_heap`,
`std::push_heap`, etc) to find the best `NSpec` specialisations with a
single traversal of the `AllSpecs` vector. The heap itself is
contained with a small vector (`BestSpecs`) of indices into
`AllSpecs`, since elements of `AllSpecs` are a bit too heavy to
shuffle around.

Next the chosen specialisation are performed, that is, functions
cloned, `SCCPSolver` primed, and known call sites updated.

Then we run the `SCCPSolver` to propagate constants in the cloned
functions, after which we walk the calls of the original functions to
update them to call the specialised functions.

---

[1] This range may contain specialisation that were discarded and is
not ordered in any way. One alternative design is to keep a vector
indices of all specialisations for this function (which would
initially be, `i`, `i+1`, `i+2`, etc) and later sort them by gain,
pushing non-applied ones to the back. This has the potential to speed
`updateCallSites` up.

Reviewed By: ChuanqiXu, labrinea

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

Change-Id: I708851eb38f07c42066637085b833ca91b195998

22 months agoAllow inline of all pure ops from the LLVM dialect.
Ingo Müller [Wed, 14 Dec 2022 15:16:06 +0000 (15:16 +0000)]
Allow inline of all pure ops from the LLVM dialect.

This allows to inline regions containing pure LLVM ops into their call
sites. (Note that this is not related to inlining of llvm.func but to
any the inlining of any Callable.) For now, we only allow the inlining
of Pure ops to be conservative but other ops may be considered inlinable
in the future.

Testing for purity of ops requires the C++ equivalent of the Pure trait
from SideEffectInterfaces.td, which this patch also provide. Its
implementation calls the C++ equivalents of the two traits that the Pure
trait is based on and, thus, has to be kept with the tablegen trait.

Reviewed By: ftynse

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

22 months agoSupport: Make Wait's SecondsToWait be std::optional [NFC]
Matt Arsenault [Tue, 29 Nov 2022 18:24:58 +0000 (13:24 -0500)]
Support: Make Wait's SecondsToWait be std::optional [NFC]

I found the interaction between SecondsToWait and
WaitUntilChildTerminates confusing. Rather than have a boolean to
ignore the value of SecondsToWait, combine these into one Optional
parameter.

22 months agoInstCombine: Add baseline tests for is.fpclass with fcmp
Matt Arsenault [Mon, 12 Dec 2022 02:48:41 +0000 (21:48 -0500)]
InstCombine: Add baseline tests for is.fpclass with fcmp

22 months ago[NFC] Fixup checkline confusion
Roman Lebedev [Wed, 14 Dec 2022 14:52:35 +0000 (17:52 +0300)]
[NFC] Fixup checkline confusion

22 months ago[OpenMP] Add API for pinned memory
Carlo Bertolli [Wed, 14 Dec 2022 14:50:10 +0000 (08:50 -0600)]
[OpenMP] Add API for pinned memory

This patch adds API support for the atk_pinned trait for omp_alloc.
It does not implement kmp_target_lock_mem and kmp_target_unlock_mem in libomptarget,
but prepares libomp for it. Patches to libomptarget to implement
lock/unlock coming after this one.

Reviewed by: jlpeyton, jdoerfert

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

22 months ago[NFC][IndVar] Autogenerate checklines in one test
Roman Lebedev [Wed, 14 Dec 2022 14:38:58 +0000 (17:38 +0300)]
[NFC][IndVar] Autogenerate checklines in one test

22 months ago[IndVarSimplify] Convert more tests to opaque pointers (NFC)
Nikita Popov [Wed, 14 Dec 2022 14:31:34 +0000 (15:31 +0100)]
[IndVarSimplify] Convert more tests to opaque pointers (NFC)

22 months ago[IndVarSimplify] Regenerate test checks (NFC)
Nikita Popov [Wed, 14 Dec 2022 14:35:42 +0000 (15:35 +0100)]
[IndVarSimplify] Regenerate test checks (NFC)

22 months ago[RISC-V][HWASAN] Enable HWASAN for RISC-V architecture
Alexey Baturo [Tue, 5 Jul 2022 16:07:50 +0000 (19:07 +0300)]
[RISC-V][HWASAN] Enable HWASAN for RISC-V architecture

Reviewed by: vitalybuka, kito-cheng

These changes will allow to use HWASAN with RISCV64 architecture.

The majority of existing tests are passing with a few exceptions(see below).
The tests were running on QEMU, since currently there're no hardware with support
for J-extension.

For this feature to work the system must support PR_{SET,GET}_TAGGED_ADDR_CTRL
syscall. For now this is only available for a patched Linux kernel and QEMU with
enabled experimental J-extension.

Results of running HWASAN lit tests for RISC-V:
```
  Unsupported      :  6
  Passed           : 79
  Expectedly Failed:  2
```

Tests are marked as expected to fail or unsupported either because of:
- android platform not being supported
- no support for legacy hwasan v1 mode
- test config explicitly uses aarch64 option
```
UNSUPPORTED: HWAddressSanitizer-riscv64 :: TestCases/abort-message-android.cpp
UNSUPPORTED: HWAddressSanitizer-riscv64 :: TestCases/cfi.cpp
UNSUPPORTED: HWAddressSanitizer-riscv64 :: TestCases/lto.c
UNSUPPORTED: HWAddressSanitizer-riscv64 :: TestCases/print-memory-usage-android.c
UNSUPPORTED: HWAddressSanitizer-riscv64 :: TestCases/register-dump-read.c
UNSUPPORTED: HWAddressSanitizer-riscv64 :: TestCases/try-catch.cpp
XFAIL: HWAddressSanitizer-riscv64 :: TestCases/stack-oob.c
XFAIL: HWAddressSanitizer-riscv64 :: TestCases/exported-tagged-global.c
```

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

22 months ago[LoopVectorize] Convert some tests to opaque pointers (NFC)
Nikita Popov [Wed, 14 Dec 2022 14:22:49 +0000 (15:22 +0100)]
[LoopVectorize] Convert some tests to opaque pointers (NFC)

For these tests update_test_checks.py had to be rerun.

22 months ago[mlir][Linalg] Better builders for transform ops
Nicolas Vasilache [Wed, 14 Dec 2022 11:25:28 +0000 (03:25 -0800)]
[mlir][Linalg] Better builders for transform ops

Also adopt DenseI64ArrayAttr in those transform ops.

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

22 months ago[LoopVectorize] Convert some tests to opaque pointers (NFC)
Nikita Popov [Wed, 14 Dec 2022 14:15:18 +0000 (15:15 +0100)]
[LoopVectorize] Convert some tests to opaque pointers (NFC)

22 months ago[SimplifyCFG] Convert tests to opaque pointers (NFC)
Nikita Popov [Wed, 14 Dec 2022 13:40:50 +0000 (14:40 +0100)]
[SimplifyCFG] Convert tests to opaque pointers (NFC)

22 months agoLTO: always parse modules in opaque pointer mode.
Tim Northover [Tue, 13 Dec 2022 09:10:56 +0000 (09:10 +0000)]
LTO: always parse modules in opaque pointer mode.

Once an LLVMContext has been told it needs to track pointer types, it can no
longer be used to parse opaque modules. However, we are likely  (at least for a
while) to have old LTO .o files in the SDK that need to interoperate with
just-generated ones, so deciding opaqueness based on the first module read
causes linker failures.

This makes the llvm-c LTO interface parse any object it sees in opaque mode,
even if type data is present, which guarantees compatibility.

22 months ago[Docs] Added my office hours
Phoebe Wang [Wed, 14 Dec 2022 13:54:20 +0000 (21:54 +0800)]
[Docs] Added my office hours

22 months ago[AMDGPU] Stop using make_pair and make_tuple. NFC.
Jay Foad [Mon, 12 Dec 2022 10:58:06 +0000 (10:58 +0000)]
[AMDGPU] Stop using make_pair and make_tuple. NFC.

C++17 allows us to call constructors pair and tuple instead of helper
functions make_pair and make_tuple.

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

22 months ago[RISC-V][HWASAN] Adjust lit test support for RISC-V HWASAN feature
Alexey Baturo [Sun, 31 Jul 2022 10:41:49 +0000 (13:41 +0300)]
[RISC-V][HWASAN] Adjust lit test support for RISC-V HWASAN feature

Reviewed by: vitalybuka

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

22 months ago[mlir][linalg] Add option to generate rank-reducing slices in DropUnitDims
Matthias Springer [Wed, 14 Dec 2022 13:02:13 +0000 (14:02 +0100)]
[mlir][linalg] Add option to generate rank-reducing slices in DropUnitDims

This change extends the `ReplaceUnitExtents` pattern so that users can choose between of two strategies for generating rank reductions:
* CollapseShapeOp / ExpandShapeOp (was already implemented but code was cleaned up; default strategy)
* rank-reducing ExtractSliceOp / InsertSliceOp

Also add helper functions to the memref dialect that we already have on the tensor dialect: `getMixedSizes`, `createCanonicalRankReducingSubViewOp`, `rankReduceIfNeeded`.

We are using ReassociationIndices instead of ReassoicationExprs in many other places and this makes the code easier to read. Also adding a new test case (that also passed before).

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

22 months ago[mlir][gpu] Fix cuda integration tests
Ivan Butygin [Wed, 14 Dec 2022 12:50:44 +0000 (13:50 +0100)]
[mlir][gpu] Fix cuda integration tests

https://reviews.llvm.org/D138758 has added `uniform` flag to gpu reduce ops, update integration tests.

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

22 months ago[Bitcode] Remove auto-detection for typed pointers
Nikita Popov [Tue, 13 Dec 2022 10:58:06 +0000 (11:58 +0100)]
[Bitcode] Remove auto-detection for typed pointers

Always read bitcode according to the -opaque-pointers mode. Do not
perform auto-detection to implicitly switch to typed pointers.

This is a step towards removing typed pointer support, and also
eliminates the class of problems where linking may fail if a typed
pointer module is loaded before an opaque pointer module. (The
latest place where this was encountered is D139924, but this has
previously been fixed in other places doing bitcode linking as well.)

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

22 months ago[CodeGenCUDASPIRV] Convert tests to opaque pointers (NFC)
Nikita Popov [Wed, 14 Dec 2022 12:35:09 +0000 (13:35 +0100)]
[CodeGenCUDASPIRV] Convert tests to opaque pointers (NFC)

22 months ago[Flang] Remove some incorrect UNSUPPORTED clauses
Paul Robinson [Tue, 13 Dec 2022 16:53:07 +0000 (08:53 -0800)]
[Flang] Remove some incorrect UNSUPPORTED clauses

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

22 months ago[OpenMP] Add a missing dllexport for the new function __kmpc_fork_call_if
Martin Storsjö [Wed, 14 Dec 2022 08:19:11 +0000 (10:19 +0200)]
[OpenMP] Add a missing dllexport for the new function __kmpc_fork_call_if

This new function was added in b72f1ec9fbb14cd7d2f5112d2c52ef5cdd1aa94a,
but wasn't exported from the DLL on Windows.

This fixes the parallel/omp_parallel_if.c OpenMP testcase on
Windows.

22 months ago[OpenMP] Fix detecting warning options for GCC
Martin Storsjö [Tue, 13 Dec 2022 09:39:27 +0000 (11:39 +0200)]
[OpenMP] Fix detecting warning options for GCC

If testing for a warning option like -Wno-<foo> with GCC, GCC won't
print any diagnostic at all, leading to the options being accepted
incorrectly. However later, if compiling a file that actually prints
another warning, GCC will also print warnings about these -Wno-<foo>
options being unrecognized.

This avoids warning spam like this, for every OpenMP source file that
produces build warnings with GCC:

    cc1plus: warning: unrecognized command line option ‘-Wno-int-to-void-pointer-cast’
    cc1plus: warning: unrecognized command line option ‘-Wno-return-type-c-linkage’
    cc1plus: warning: unrecognized command line option ‘-Wno-covered-switch-default’
    cc1plus: warning: unrecognized command line option ‘-Wno-enum-constexpr-conversion’

This matches how such warning options are detected and added in
llvm/cmake/modules/HandleLLVMOptions.cmake, e.g. like this:

    check_cxx_compiler_flag("-Wclass-memaccess" CXX_SUPPORTS_CLASS_MEMACCESS_FLAG)
    append_if(CXX_SUPPORTS_CLASS_MEMACCESS_FLAG "-Wno-class-memaccess" CMAKE_CXX_FLAGS)

This also matches how LLDB warning options were restructured for
GCC compatibility in e546bbfda0ab91cf78c096d8c035851cc7c3b9f3.

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

22 months agoAArch64: use CAS instead of LDXR/STXR if available
Tim Northover [Mon, 20 Sep 2021 13:19:14 +0000 (14:19 +0100)]
AArch64: use CAS instead of LDXR/STXR if available

This covers 128-bit loads, and atomicrmw operations without a single native
instruction. Using CAS saves has a better chance of succeeding with high
contention on some systems.

22 months ago[mlir][gpu] Add `uniform` flag to gpu reduction ops
Ivan Butygin [Sun, 27 Nov 2022 14:19:56 +0000 (15:19 +0100)]
[mlir][gpu] Add `uniform` flag to gpu reduction ops

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

22 months agoRevert "[lld-macho][test][nfc] Update stabs.s to use touch -d instead of -t"
Nico Weber [Wed, 14 Dec 2022 12:14:29 +0000 (07:14 -0500)]
Revert "[lld-macho][test][nfc] Update stabs.s to use touch -d instead of -t"

This reverts commit 3c9f479a5e47d5f3de07ccac365589dd928bfd20.
Breaks tests on macOS, see e.g. https://reviews.llvm.org/D139980#3993989

22 months ago[WebAssembly][NFC] Add ComplexPattern for loads
Luke Lau [Wed, 14 Dec 2022 12:10:03 +0000 (12:10 +0000)]
[WebAssembly][NFC] Add ComplexPattern for loads

This refactors out the offset and address operand pattern matching into
a ComplexPattern, so that one pattern fragment can match the dynamic and
static (offset) addresses in all possible positions.

Split out from D139530, which also contained an improvement to global
address folding.

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

22 months ago[X86] Don't fold scalar_to_vector(i64 C) -> vzext_movl(scalar_to_vector(i32 C))
Simon Pilgrim [Wed, 14 Dec 2022 12:10:59 +0000 (12:10 +0000)]
[X86] Don't fold scalar_to_vector(i64 C) -> vzext_movl(scalar_to_vector(i32 C))

Fixes constant-folding infinite loop reported by @uabelho on rG5ca77541446d

22 months ago[InstCombine] return the result of the GEP of PHI transformation early
Danila Malyutin [Wed, 14 Dec 2022 10:31:15 +0000 (13:31 +0300)]
[InstCombine] return the result of the GEP of PHI transformation early

Without this change this function could return nullptr if no further
transformation took place making InstCombine pass incorrectly report no
IR changes preventing analyses invalidation.

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

22 months ago[Linker] Convert test to opaque pointers (NFC)
Nikita Popov [Wed, 14 Dec 2022 12:02:35 +0000 (13:02 +0100)]
[Linker] Convert test to opaque pointers (NFC)

To preserve test intent, remove a pointer indirection and use
a GEP instead of bitcast, so the type is still mentioned.

22 months ago[SCEV] Cache folded SExt SCEV expressions.
Florian Hahn [Wed, 14 Dec 2022 11:59:19 +0000 (11:59 +0000)]
[SCEV] Cache folded SExt SCEV expressions.

Use FoldID to cache SignExtendExprs that get folded to a different
SCEV.

Depends on D137505.

Reviewed By: mkazantsev

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

22 months ago[Linker] Convert test to opaque pointers (NFC)
Nikita Popov [Wed, 14 Dec 2022 11:57:59 +0000 (12:57 +0100)]
[Linker] Convert test to opaque pointers (NFC)

To preserve test intent, drop the pointer type.

22 months agore-land [RISC-V][HWASAN] Add support for HWASAN code instrumentation for RISC-V
Alexey Baturo [Wed, 10 Aug 2022 05:41:26 +0000 (08:41 +0300)]
re-land [RISC-V][HWASAN] Add support for HWASAN code instrumentation for RISC-V

now with the fixed warning and updated lit tests
---
[RISC-V][HWASAN] Add support for HWASAN code instrumentation for RISC-V

Reviewed By: vitalybuka

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

22 months ago[Linker] Convert test to opaque pointers (NFC)
Nikita Popov [Wed, 14 Dec 2022 11:48:21 +0000 (12:48 +0100)]
[Linker] Convert test to opaque pointers (NFC)

All the pointer-indirected cases are no longer relevant with
opaque pointers. To preserve at least some of the test intent,
switch to by value passing of the unnamed types. Otherwise we
wouldn't be testing anything at all.

22 months ago[mlir][tensor][bufferize] Improve bufferization of DimOp/RankOp
Matthias Springer [Wed, 14 Dec 2022 11:26:29 +0000 (12:26 +0100)]
[mlir][tensor][bufferize] Improve bufferization of DimOp/RankOp

The tensor operands do not bufferize to a memory read.

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

22 months ago[mlir][memref] Fold no-op subview(subview(x)) ops
Matthias Springer [Wed, 14 Dec 2022 11:26:41 +0000 (12:26 +0100)]
[mlir][memref] Fold no-op subview(subview(x)) ops

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

22 months ago[LTO] Convert tests to opaque pointers (NFC)
Nikita Popov [Wed, 14 Dec 2022 11:32:45 +0000 (12:32 +0100)]
[LTO] Convert tests to opaque pointers (NFC)

22 months ago[X86] lowerShuffleAsVTRUNC - bit shift the offset elements into place instead of...
Simon Pilgrim [Wed, 14 Dec 2022 11:41:14 +0000 (11:41 +0000)]
[X86] lowerShuffleAsVTRUNC - bit shift the offset elements into place instead of shuffle

This helps avoid issues on non-BWI targets which can end up splitting the shuffles to 2 x 256-bit bitshifts of a smaller scalar width

22 months ago[llvm-link] Convert test to opaque pointers (NFC)
Nikita Popov [Wed, 14 Dec 2022 11:29:44 +0000 (12:29 +0100)]
[llvm-link] Convert test to opaque pointers (NFC)

To preserve test intent, remove the pointer types and replace by
value types, otherwise this wouldn't be testing anything at all.

22 months agomlir/ods-gen: use bash from env in shell script
Ramkumar Ramachandra [Tue, 13 Dec 2022 16:27:50 +0000 (17:27 +0100)]
mlir/ods-gen: use bash from env in shell script

On macOS, hardcoding the path of bash leads to a failure in executing
update_core_linalg_named_ops.sh, due to an old version of bash being
present in that location.

Signed-off-by: Ramkumar Ramachandra <r@artagnon.com>
Differential Revision: https://reviews.llvm.org/D139942

22 months ago[mlir][NFC] Make test-lower-to-llvm a named pipeline
Quentin Colombet [Mon, 12 Dec 2022 13:36:39 +0000 (13:36 +0000)]
[mlir][NFC] Make test-lower-to-llvm a named pipeline

This patch changes the `test-lower-to-llvm` pass into a named pipeline.
The functionality is unchanged but thanks to this change, we don't have
to pull the dependencies of all the passes that this pass calls.
In other words, `TestLowerToLLVMPass::getDependDialects` was supposed to
transitively declare all the dialects that were used in the union of all
the invoked passes.

NFC

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

22 months agoRevert "[InstCombine] Handle logical op in simplifyRangeCheck() (PR59484)"
Nikita Popov [Wed, 14 Dec 2022 11:01:30 +0000 (12:01 +0100)]
Revert "[InstCombine] Handle logical op in simplifyRangeCheck() (PR59484)"

This reverts commit 492c471839a66e354ebe696bd3e15f7477c63613.

As pointed out by nloped, the transform in f2 is not correct: If
%shr is poison, then freeze may result in a negative value. The
transform is correct in the case where the freeze is pushed through
the operation in a way that guarantees the result is non-negative,
which is the case I had tested.

22 months ago[X86] lowerShuffleAsVTRUNC - improve detection of cheap/free vector concatenation
Simon Pilgrim [Tue, 13 Dec 2022 17:48:39 +0000 (17:48 +0000)]
[X86] lowerShuffleAsVTRUNC - improve detection of cheap/free vector concatenation

Handle the case where the lo/hi subvectors are a split load.

22 months ago[AArch64][SVE][ISel] Combine dup of load to replicating load
Peter Waller [Thu, 8 Dec 2022 12:00:35 +0000 (12:00 +0000)]
[AArch64][SVE][ISel] Combine dup of load to replicating load

(dup (load) z_or_x_passthrough) => (replicating load)

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

22 months ago[bazel] add some more deps to libc BUILD files
Krasimir Georgiev [Wed, 14 Dec 2022 10:25:54 +0000 (10:25 +0000)]
[bazel] add some more deps to libc BUILD files

22 months ago[llvm-readobj] llvm::Optional => std::optional
Fangrui Song [Wed, 14 Dec 2022 10:24:52 +0000 (10:24 +0000)]
[llvm-readobj] llvm::Optional => std::optional

Temporarily add expectedToStdOptional to llvm/Support/Error.h for migration.

22 months ago[ExecutionEngine] llvm::Optional => std::optional
Fangrui Song [Wed, 14 Dec 2022 10:18:07 +0000 (10:18 +0000)]
[ExecutionEngine] llvm::Optional => std::optional

22 months ago[bazel] Add __support_common dep
Krasimir Georgiev [Wed, 14 Dec 2022 10:16:17 +0000 (10:16 +0000)]
[bazel] Add __support_common dep

22 months ago[FileCheck] llvm::Optional => std::optional
Fangrui Song [Wed, 14 Dec 2022 10:07:47 +0000 (10:07 +0000)]
[FileCheck] llvm::Optional => std::optional

22 months ago[include-cleaner] Print the line number of removal #includes.
Haojian Wu [Wed, 14 Dec 2022 09:45:56 +0000 (10:45 +0100)]
[include-cleaner] Print the line number of removal #includes.

I found that this information is helpful when using this tool.

Reviewed By: kadircet

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

22 months ago[mlir][llvm] Add inbounds attriubte to the gep op.
Tobias Gysi [Wed, 14 Dec 2022 09:44:11 +0000 (10:44 +0100)]
[mlir][llvm] Add inbounds attriubte to the gep op.

The revision adds an inbounds attribute to the LLVM dialect
GEP operation. It extends the builders and the import and export
to support the optional inbounds attribute.

As all builders set inbounds to false by default, existing lowerings
from higher-level dialects to LLVM dialect are not affected by the
change. Canonicalization/folding remains untouched since it currently
does not implement any simplifications in case of undefined behavior
(the handling of undefined behavior is deferred to LLVM).

Reviewed By: ftynse

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

22 months ago[clangd] Correct the local variable names to match the code style, NFC
Haojian Wu [Tue, 13 Dec 2022 12:38:36 +0000 (13:38 +0100)]
[clangd] Correct the local variable names to match the code style, NFC

22 months ago[mlir][llvm] Fix bug in the LLVM IR constant import.
Tobias Gysi [Wed, 14 Dec 2022 09:27:01 +0000 (10:27 +0100)]
[mlir][llvm] Fix bug in the LLVM IR constant import.

The recently introduced iterative constant import
(https://reviews.llvm.org/D137559) fails for programs that
subsequently import constant expressions with duplicate
subexpressions. The reason is a broken duplicate check
in getConstantsToConvert. The revision fixes the bug and
adds a test case that imports two constant expressions
with duplicates.

Reviewed By: ftynse

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

22 months ago[AArch64][SVE] Add hadd and rhadd support
David Green [Wed, 14 Dec 2022 09:24:54 +0000 (09:24 +0000)]
[AArch64][SVE] Add hadd and rhadd support

This adds basic HADD and RHADD support for SVE, by marking the AVGFLOOR
and AVGCEIL as custom and converting those to HADD_PRED/RHADD_PRED
AArch64 nodes. Both the existing intrinsics and the _PRED nodes are then
lowered to the _ZPmZ instructions.

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

22 months agoRevert "Implement CWG2631"
Krasimir Georgiev [Wed, 14 Dec 2022 08:41:51 +0000 (08:41 +0000)]
Revert "Implement CWG2631"

This reverts commit f1f1b60c7ba607e9ffe3bc012161d43ef95ac773.

Temporary revert, possibly triggers a new assertion failure on
QualType::getCommonPtr.
We're working on a reproducer, to follow-up on
https://reviews.llvm.org/D136554.

22 months ago[clang][analyzer] No new nodes when bug is detected in StdLibraryFunctionsChecker.
Balázs Kéri [Wed, 14 Dec 2022 08:25:06 +0000 (09:25 +0100)]
[clang][analyzer] No new nodes when bug is detected in StdLibraryFunctionsChecker.

The checker applies constraints in a sequence and adds new nodes for these states.
If a constraint violation is found this sequence should be stopped with a sink
(error) node. Instead the `generateErrorNode` did add a new error node as a new
branch that is parallel to the other node sequence, the other branch was not
stopped and analysis was continuing on that invalid branch.
To add an error node after any previous node a new version of `generateErrorNode`
is needed, this function is added here and used by `StdLibraryFunctionsChecker`.
The added test executes a situation where the checker adds a number of
constraints before it finds a constraint violation.

Reviewed By: NoQ

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

22 months ago[RISCV] Add Syntacore SCR1 CPU model
Dmitrii Petrov [Wed, 14 Dec 2022 08:12:23 +0000 (11:12 +0300)]
[RISCV] Add Syntacore SCR1 CPU model

SCR1 is available at https://github.com/syntacore/scr1

'syntacore-scr1-base' corresponds to SCR1_CFG_RV32IC_BASE,
'syntacore-scr1-max' corresponds to SCR1_CFG_RV32IMC_MAX.

SCR1_CFG_RV32EC_MIN is RV32EC, which is currently unsupported.

Reviewed By: craig.topper

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

22 months ago[Bitcode] Use std::nullopt_t instead of NoneType (NFC)
Kazu Hirata [Wed, 14 Dec 2022 08:39:45 +0000 (00:39 -0800)]
[Bitcode] Use std::nullopt_t instead of NoneType (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

22 months ago[llvm-pdbutil] Update #includes (NFC)
Kazu Hirata [Wed, 14 Dec 2022 08:32:06 +0000 (00:32 -0800)]
[llvm-pdbutil] Update #includes (NFC)

The header file uses std::optional, but it's realying a transitive
inclusion of <optional>.  Meanwhile, it no longer uses llvm::Optional.

22 months ago[libunwind] Use .irp directives. NFC
Fangrui Song [Wed, 14 Dec 2022 08:24:22 +0000 (08:24 +0000)]
[libunwind] Use .irp directives. NFC

The repeated instructions make the file long and difficult to read.
Simplify them with .irp directives.

Skip PowerPC since AIX assembler doesn't support .irp

Reviewed By: #libunwind, compnerd

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

22 months ago[tools] llvm::Optional => std::optional
Fangrui Song [Wed, 14 Dec 2022 08:01:04 +0000 (08:01 +0000)]
[tools] llvm::Optional => std::optional