platform/upstream/llvm.git
22 months ago[mlir][spirv] Add StreamingInterfaceINTEL to SPIRVBase.td
Mark Mendell [Thu, 22 Dec 2022 18:14:10 +0000 (10:14 -0800)]
[mlir][spirv] Add StreamingInterfaceINTEL to SPIRVBase.td

StreamingInterfaceINTEL has been recently added to the SPIR-V headers:
https://github.com/KhronosGroup/SPIRV-Headers/commit/70ff9d939cd7fd0c758756ac57ab0c7c6d6c64d6

Reviewed By: antiagainst

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

22 months ago[Sanitizer] Fix page alignment for mmap calls
Blue Gaston [Mon, 19 Dec 2022 21:50:07 +0000 (16:50 -0500)]
[Sanitizer] Fix page alignment for mmap calls

We are in the process of enabling sanitizer_common unit tests on arm64 for apple devices. rdar://101436019

The test `CompactRingBuffer.int64` is failing on arm64 with the error:

```==17265==ERROR: SanitizerTool failed to deallocate 0xfffffffffffff000 (-4096) bytes at address 0x000105c30000
SanitizerTool: CHECK failed: sanitizer_posix.cpp:63 "(("unable to unmap" && 0)) != (0)" (0x0, 0x0) (tid=157296)```

If page size is sufficiently larger than alignment then this code:
   UnmapOrDie((void*)end, map_end - end);
end is will be greater than map_end causing the value passed to UnmapOrDie to be negative.

This is caused when GetPageSizeCached returns 16k and alignment is 8k.
map_size and what is mapped by mmap uses size and alignment which is smaller than what is calculated by end using the actual page size.
Therefore, map_end ends up being less than end.
The call to mmap is allocating sufficent page-aligned memory, because it calls RoundUp within MmapOrDieOnFatalError.
But this size is not being captured by map_size.

We can address this by rounding up map_size here to be page-aligned. This ensures that map_end will be greater than or equal to end and that it will match mmaps use of page-aligned value, and the
subsequent call to munmap will also be page-aligned.

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

22 months ago[IR/MachineOutliner] Add a "nooutline" function attr and respect it
Jessica Paquette [Tue, 20 Dec 2022 23:16:18 +0000 (15:16 -0800)]
[IR/MachineOutliner] Add a "nooutline" function attr and respect it

Add `nooutline` + update LangRef to say it exists.

This makes it possible to say "don't outline from this function ever."

We want to be able to toggle whether or not a function should be in the search
set regardless of default behaviour.

Add testcases for the IR Outliner + Machine Outliner.

Also remove an unnecessary check for an empty function in the Machine Outliner.

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

22 months ago[libc] add exponent format to printf
Michael Jones [Thu, 1 Dec 2022 23:29:15 +0000 (15:29 -0800)]
[libc] add exponent format to printf

Add support for the %e/E conversion in printf, as well as unit tests. It
does not yet support long doubles.

Reviewed By: sivachandra

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

22 months ago[lldb] Add LTO dependency to lldb test suite
Augusto Noronha [Wed, 14 Dec 2022 21:21:57 +0000 (13:21 -0800)]
[lldb] Add LTO dependency to lldb test suite

Make the lldb test target depend on LTO, since TestFullLtoStepping
needs it (prior to this patch, running "ninja check-lldb" would not
build libLTO).

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

22 months agoAMDGPU: Modernize sqrt f64 test
Matt Arsenault [Mon, 21 Nov 2022 15:54:50 +0000 (10:54 -0500)]
AMDGPU: Modernize sqrt f64 test

Use the readfirstlane hack for the scalar cases as a hack to
combine globalisel and sdag tests. gfx6 stores are a bit broken
in globalisel, and scalar returns are totally broken in sdag.

22 months agoAdd aligned_alloc to symbolizer symbols list.
Mitch Phillips [Thu, 22 Dec 2022 17:52:40 +0000 (09:52 -0800)]
Add aligned_alloc to symbolizer symbols list.

New symbol used by libcxx as of https://reviews.llvm.org/D138196, needs
to be added to the symbol deps list.

22 months agoSupport: Add polling option to sys::Wait
Matt Arsenault [Tue, 29 Nov 2022 19:09:08 +0000 (14:09 -0500)]
Support: Add polling option to sys::Wait

Currently the process is terminated after the timeout. Add an option
to let the process resume after the timeout instead.

https://reviews.llvm.org/D138952

22 months agoAMDGPU: Update constant address spaces used in printf test
Matt Arsenault [Thu, 22 Dec 2022 15:22:11 +0000 (10:22 -0500)]
AMDGPU: Update constant address spaces used in printf test

This was never updated for the address space number shuffle.

22 months agoAMDGPU: Use early continue to reduce indentation
Matt Arsenault [Thu, 22 Dec 2022 15:20:33 +0000 (10:20 -0500)]
AMDGPU: Use early continue to reduce indentation

22 months ago[mlir] Allow specifying benefit for C func ptr style patterns.
Chenguang Wang [Thu, 22 Dec 2022 17:10:15 +0000 (09:10 -0800)]
[mlir] Allow specifying benefit for C func ptr style patterns.

Reviewed By: rriddle

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

22 months ago[AArch64] Add RSHRN and RSHRN2 patterns
David Green [Thu, 22 Dec 2022 16:49:19 +0000 (16:49 +0000)]
[AArch64] Add RSHRN and RSHRN2 patterns

This adds some tablegen patterns for RSHRN, which performs a rounding
shift with narrow. This is similar to the existing SHRN patterns with an
extra addition to perform the rounding, that adds 1<<(shift-1) before
the right shift. Because the round immediate and the shift amount are
tied, it goes via a ComplexPattern that uses a SelectRoundingVLShr
method to perform the selection checks.

aarch64_neon_rshrn are expanded into the sequence of equivalent
instructions (trunc(shr(add(x, 1<<(sht-1)), sht))) so that they can be
converted back into RSHRN. Which also allows us to match raddhn through
the adjusted patterns that previously used aarch64_neon_rshrn.

DIfferential Revision: https://reviews.llvm.org/D140297

22 months agoSmall fixes to creduce-clang-crash.py script.
Amy Huang [Wed, 21 Dec 2022 23:02:43 +0000 (23:02 +0000)]
Small fixes to creduce-clang-crash.py script.

Specify python3, and replace / with // to do integer division.

22 months agomlir/tblgen test: add a test for EnumAttr customAssemblyFormat
Ramkumar Ramachandra [Wed, 14 Dec 2022 17:55:07 +0000 (18:55 +0100)]
mlir/tblgen test: add a test for EnumAttr customAssemblyFormat

attr-or-type-format.td contains tests for various attributes and types,
but nowhere in the testsuite is the customAssemblyFormat for an EnumAttr
(enum class in C++) exercised. Fix this by adding a test.

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

22 months ago[GlobalISel][Legalizer] add minScalarIf action
Ties Stuij [Thu, 22 Dec 2022 15:32:34 +0000 (15:32 +0000)]
[GlobalISel][Legalizer] add minScalarIf action

Ensure scalar is at least as wide as type, but only if the specified condition
is met.

Reviewed By: paquette

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

22 months ago[AVR] Do not emit instructions invalid for attiny10
Ayke van Laethem [Wed, 23 Nov 2022 18:14:01 +0000 (19:14 +0100)]
[AVR] Do not emit instructions invalid for attiny10

The attiny4/attiny5/attiny9/attiny10 have a slightly modified
instruction set that drops a number of useful instructions. This patch
makes sure to not emit them on these "reduced tiny" cores.

The affected instructions are:

  * lds and sts (load/store directly from data)
  * ldd and std (load/store with displacement)
  * adiw and sbiw (add/sub register pairs)
  * various other instructions that were emitted without checking
    whether the chip actually supports them (movw, adiw, etc)

There is a variant on lds and sts on these chips, but it can only
address a limited portion of the address space and is mainly useful to
load/store I/O registers (as an extension to the in and out
instructions). I have not implemented it here, implementing it can be
done in a separate patch.

This patch is not optimal. I'm sure it can be improved a lot. For
example, we could teach the instruction selector to not select lddw/stdw
instructions so that the weird pointer adjustments are not necessary.
But for now I've focused just on correctness, not on code quality.

Updates: https://github.com/llvm/llvm-project/issues/53459

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

22 months ago[AMDGPU] Remove permlane discard vdst_in optimization from isel
Jay Foad [Thu, 22 Dec 2022 12:02:11 +0000 (12:02 +0000)]
[AMDGPU] Remove permlane discard vdst_in optimization from isel

D72845 implemented the equivalent IR optimization in InstCombine so it
seems that there's no advantage to doing it during isel too.

This partially reverts D72844.

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

22 months agoApply clang-tidy fixes for llvm-else-after-return in TensorOps.cpp (NFC)
Mehdi Amini [Sat, 10 Dec 2022 12:22:49 +0000 (12:22 +0000)]
Apply clang-tidy fixes for llvm-else-after-return in TensorOps.cpp (NFC)

22 months agoApply clang-tidy fixes for llvm-else-after-return in SparseVectorization.cpp (NFC)
Mehdi Amini [Sat, 10 Dec 2022 12:01:27 +0000 (12:01 +0000)]
Apply clang-tidy fixes for llvm-else-after-return in SparseVectorization.cpp (NFC)

22 months ago[SampleProfile] Regenerate test checks (NFC)
Nikita Popov [Thu, 22 Dec 2022 15:24:03 +0000 (16:24 +0100)]
[SampleProfile] Regenerate test checks (NFC)

22 months ago[Util] Regenerate test checks (NFC)
Nikita Popov [Thu, 22 Dec 2022 15:20:55 +0000 (16:20 +0100)]
[Util] Regenerate test checks (NFC)

22 months ago[InstCombine] Regenerate test checks (NFC)
Nikita Popov [Thu, 22 Dec 2022 15:13:36 +0000 (16:13 +0100)]
[InstCombine] Regenerate test checks (NFC)

22 months ago[mlir][linalg] Reuploading: add a shortened printing/parsing form for linalg.map...
Aliia Khasanova [Thu, 22 Dec 2022 10:14:24 +0000 (11:14 +0100)]
[mlir][linalg] Reuploading: add a shortened printing/parsing form for linalg.map and linalg.reduce.

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

22 months ago[libc++] Use aligned_alloc instead of posix_memalign for C++17
Alex Richardson [Thu, 17 Nov 2022 10:19:28 +0000 (10:19 +0000)]
[libc++] Use aligned_alloc instead of posix_memalign for C++17

C++17 defines the C11 `aligned_alloc`, so we can use that instead of
posix_memalign. This change allows building against picolibc without
defining _DEFAULT_SOURCE/_GNU_SOURCE.
The C11 `aligned_alloc` function should be available on all supported
non-Windows platforms except for macOS where we need version 10.15.

There is one caveat: aligned_alloc() requires that __size is a multiple of
__alignment, but [new.delete.general] only states "if the value of an
alignment argument passed to any of these functions is not a valid
alignment value, the behavior is undefined".
To handle calls such as ::operator new(1, std::align_val_t(128)), we
round up __size to __alignment (and check for wrap-around).
This is required at least for macOS where aligned_alloc(128, 1) returns
an error instead of allocating memory (glibc ignores the specification).

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

22 months ago[SystemZ] Convert test to opaque pointers (NFC)
Nikita Popov [Thu, 22 Dec 2022 14:58:18 +0000 (15:58 +0100)]
[SystemZ] Convert test to opaque pointers (NFC)

22 months ago[RISCV] Convert test to opaque pointers (NFC)
Nikita Popov [Thu, 22 Dec 2022 14:55:38 +0000 (15:55 +0100)]
[RISCV] Convert test to opaque pointers (NFC)

There is a minor change in operand order (of a commutative
instruction).

22 months ago[RISCV] Convert some tests to opaque pointers (NFC)
Nikita Popov [Thu, 22 Dec 2022 14:47:32 +0000 (15:47 +0100)]
[RISCV] Convert some tests to opaque pointers (NFC)

The asm test has minor differences in instruction scheduling only.

22 months ago[clang][dataflow] Fix bug in handling of `return` statements.
Yitzhak Mandelbaum [Tue, 20 Dec 2022 19:41:19 +0000 (19:41 +0000)]
[clang][dataflow] Fix bug in handling of `return` statements.

The handling of return statements, added in support of context-sensitive
analysis, has a bug relating to functions that return reference
types. Specifically, interpretation of such functions can result in a crash from
a bad cast. This patch fixes the bug and guards all of that code with the
context-sensitive option, since there's no reason to execute at all when
context-sensitive analysis is off.

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

22 months agoInstSimplify: Split isKnownNeverInfinity tests into separate file
Matt Arsenault [Thu, 22 Dec 2022 13:51:07 +0000 (08:51 -0500)]
InstSimplify: Split isKnownNeverInfinity tests into separate file

This fixes an annoying assymmetry in the test organization. We have
known-never-nan.ll for dedicated isKnownNeverNaN handling tests, but
the isKnownNeverInfinity were in floating-point-compare.ll. Move the
more targeted tests into a separate file to match.

22 months agoValueTracking: Add test for isKnownNeverInfinity for fptrunc
Matt Arsenault [Sun, 4 Dec 2022 14:09:41 +0000 (09:09 -0500)]
ValueTracking: Add test for isKnownNeverInfinity for fptrunc

22 months agoValueTracking: Add test for fneg isKnownNeverNaN handling
Matt Arsenault [Thu, 17 Nov 2022 16:02:14 +0000 (08:02 -0800)]
ValueTracking: Add test for fneg isKnownNeverNaN handling

This didn't have a negative test.

22 months ago[clang][dataflow] Account for global variables in constructor initializers.
Yitzhak Mandelbaum [Wed, 21 Dec 2022 22:05:09 +0000 (22:05 +0000)]
[clang][dataflow] Account for global variables in constructor initializers.

Previously, the analysis modeled global variables appearing in the _body_ of
any function (including constructors). But, that misses those appearing in
constructor _initializers_. This patch adds the initializers to the set of
expressions used to determine which globals to model.

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

22 months ago[clang][dataflow] Simplify handling of nullopt-optionals.
Yitzhak Mandelbaum [Wed, 21 Dec 2022 22:48:04 +0000 (22:48 +0000)]
[clang][dataflow] Simplify handling of nullopt-optionals.

Previously, in the case of an optional constructed from `nullopt`, we relied on
the value constructed for the `nullopt`. This complicates the implementation and
exposes it to bugs (indeed, one such was found), yet doesn't improve the
engine. Instead, this patch constructs a fresh optional representation, rather
than relying on the underlying nullopt representation.

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

22 months agoMIR: Fix test error message
Matt Arsenault [Thu, 22 Dec 2022 13:57:16 +0000 (08:57 -0500)]
MIR: Fix test error message

22 months ago[mlir][vector] Add additional scalar vector transfer foldings
Matthias Springer [Thu, 22 Dec 2022 13:05:51 +0000 (14:05 +0100)]
[mlir][vector] Add additional scalar vector transfer foldings

* Rewrite vector.transfer_write of vectors with 1 element to
  memref.store
* Rewrite vector.extract(vector.transfer_read) to memref.load

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

22 months agoclang/HIP: Fix missing test for __frsqrt_rn
Matt Arsenault [Tue, 22 Nov 2022 16:21:18 +0000 (11:21 -0500)]
clang/HIP: Fix missing test for __frsqrt_rn

22 months ago[RISCV] Name instructions in tests (NFC)
Nikita Popov [Thu, 22 Dec 2022 13:30:38 +0000 (14:30 +0100)]
[RISCV] Name instructions in tests (NFC)

22 months ago[test][lldb-vscode] Relax assertion to allow multiple compile units returned.
Jordan Rupprecht [Thu, 22 Dec 2022 13:19:29 +0000 (05:19 -0800)]
[test][lldb-vscode] Relax assertion to allow multiple compile units returned.

I don't think the intent of this test is to make sure we only have one compile unit; it's to make sure request_compileUnits returns something sensible. Relax the test case to just make sure that the main source file is one of the compile units returned, even if there are others.

Fixes llvm.org/pr49418.

Reviewed By: labath

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

22 months agoMIR: Don't assert if a virtual register uses a non-allocatable class
Matt Arsenault [Thu, 22 Dec 2022 12:31:05 +0000 (07:31 -0500)]
MIR: Don't assert if a virtual register uses a non-allocatable class

22 months ago[VPlan] Move VF and UF string generation to getName() (NFC).
Florian Hahn [Thu, 22 Dec 2022 13:15:01 +0000 (13:15 +0000)]
[VPlan] Move VF and UF string generation to getName() (NFC).

The VFs and UFs may be more constrained as the plans are transformed
(e.g. see D135017 for an example).

To make sure the VFs/UFs included in the VPlan dump are accurate,
generate them when accessing a plan's name, rather than include them in
the name string set after initial construction.

22 months ago[mlir][Tosa] Apply ClangTidy performance findings (NFC)
Adrian Kuegel [Thu, 22 Dec 2022 13:13:30 +0000 (14:13 +0100)]
[mlir][Tosa] Apply ClangTidy performance findings (NFC)

22 months ago[NVPTX] Convert test to opaque pointers (NFC)
Nikita Popov [Thu, 22 Dec 2022 13:01:56 +0000 (14:01 +0100)]
[NVPTX] Convert test to opaque pointers (NFC)

22 months ago[MIR] Convert tests to opaque pointers (NFC)
Nikita Popov [Thu, 22 Dec 2022 12:58:29 +0000 (13:58 +0100)]
[MIR] Convert tests to opaque pointers (NFC)

22 months ago[CodeGen] Convert test to opaque pointers (NFC)
Nikita Popov [Thu, 22 Dec 2022 12:57:14 +0000 (13:57 +0100)]
[CodeGen] Convert test to opaque pointers (NFC)

22 months agoclang/HIP: Fix broken implementations of __make_mantissa* functions
Matt Arsenault [Mon, 21 Nov 2022 03:30:09 +0000 (19:30 -0800)]
clang/HIP: Fix broken implementations of __make_mantissa* functions

The optimizer was folding the entire function to return 0. This
meant to be checking the character content of the pointer is the
string terminator, not null.

Also just make null inputs undefined. My docs for nanf say the
behavior of the argument is unspecified and segfaults on my system.

22 months ago[BPF] Convert test to opaque pointers (NFC)
Nikita Popov [Thu, 22 Dec 2022 11:56:50 +0000 (12:56 +0100)]
[BPF] Convert test to opaque pointers (NFC)

22 months ago[AMDGPU] Simplify simplifyAMDGCNMemoryIntrinsicDemanded. NFC.
Jay Foad [Thu, 22 Dec 2022 11:21:11 +0000 (11:21 +0000)]
[AMDGPU] Simplify simplifyAMDGCNMemoryIntrinsicDemanded. NFC.

22 months ago[Clang][LoongArch] Add intrinsic for rdtime_d, rdtimeh_w and rdtimel_w
gonglingqin [Thu, 22 Dec 2022 11:18:22 +0000 (19:18 +0800)]
[Clang][LoongArch] Add intrinsic for rdtime_d, rdtimeh_w and rdtimel_w

Add these intrinsics to keep consistent with GCC [1].

[1]: https://github.com/gcc-mirror/gcc/blob/master/gcc/config/loongarch/larchintrin.h#L33

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

22 months ago[Clang][LoongArch] Add intrinsic for asrtle, asrtgt, lddir, ldpte and cpucfg
gonglingqin [Thu, 22 Dec 2022 08:59:56 +0000 (16:59 +0800)]
[Clang][LoongArch] Add intrinsic for asrtle, asrtgt, lddir, ldpte and cpucfg

`__cpucfg` is required by Linux [1].

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/loongarch/include/asm/loongarch.h#n59

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

22 months ago[clang-format] Add InsertBraces to operator== in Format.h
Owen Pan [Thu, 22 Dec 2022 10:24:01 +0000 (02:24 -0800)]
[clang-format] Add InsertBraces to operator== in Format.h

22 months ago[AArch64][SVE] Remove dso_local and local_unnamed_addr from muladdsub.ll
Matt Devereau [Thu, 22 Dec 2022 10:00:57 +0000 (10:00 +0000)]
[AArch64][SVE] Remove dso_local and local_unnamed_addr from muladdsub.ll

22 months ago[clang-format] Add 'friend' to QualifierOrder
Micah Weston [Thu, 22 Dec 2022 09:54:04 +0000 (01:54 -0800)]
[clang-format] Add 'friend' to QualifierOrder

For cases of defining friend functions, qualifier ordering can
allow multiple positions for the 'friend' token.

Closes #59450.

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

22 months ago[AArch64][InstCombine] Fuse ADD+MUL and SUB+MUL AArch64 instrinsics
Matt Devereau [Thu, 15 Dec 2022 16:09:13 +0000 (16:09 +0000)]
[AArch64][InstCombine] Fuse ADD+MUL and SUB+MUL AArch64 instrinsics

Fold (ADD p c (MUL p a b)) into (MAD p a b c)
Fold (FADD p c (FMUL p a b)) into (FMAD p a b c)
Fold (FSUB p c (FMUL p a b)) into (FNMSB p a b c)

Fold (ADD p (MUL p a b) c) into (MLA p c a b)
Fold (FADD p (FMUL p a b) c) into (FMLA p c a b)
Fold (SUB p (MUL p a b) C) into (MLS p c a b)
Fold (FSUB p (FMUL p a b) c) into (FMLS p c a b)

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

22 months ago[mlir][vector] Fold vector.extractelement(vector.broadcast)
Matthias Springer [Thu, 22 Dec 2022 09:22:37 +0000 (10:22 +0100)]
[mlir][vector] Fold vector.extractelement(vector.broadcast)

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

22 months ago[X86] Support ANDNP combine through vector_shuffle
Evgenii Kudriashov [Wed, 21 Dec 2022 12:45:41 +0000 (20:45 +0800)]
[X86] Support ANDNP combine through vector_shuffle

Combine
```
   and (vector_shuffle<Z,...,Z>
            (insert_vector_elt undef, (xor X, -1), Z), undef), Y
   ->
   andnp (vector_shuffle<Z,...,Z>
              (insert_vector_elt undef, X, Z), undef), Y
```

Reviewed By: RKSimon, pengfei

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

22 months agoRevert "Revert "[DebugInfo] Correctly recognize bitfields when emitting dwarf""
Juan Manuel MARTINEZ CAAMAÑO [Thu, 22 Dec 2022 08:31:36 +0000 (03:31 -0500)]
Revert "Revert "[DebugInfo] Correctly recognize bitfields when emitting dwarf""

https://reviews.llvm.org/D140195 should have fixed the fail in
green-dragon that was reported in https://reviews.llvm.org/D96334 and
resulted in the revert.

This reverts commit 920de9c94caff0b3ac21bf637487b07cb9aea98a.

22 months ago[bazel] Fix some --features=layering_check issues
Fangrui Song [Thu, 22 Dec 2022 08:12:58 +0000 (00:12 -0800)]
[bazel] Fix some --features=layering_check issues

22 months ago[mlir][llvm] Cleanup LLVM IR control flow import test (NFC).
Tobias Gysi [Thu, 22 Dec 2022 07:49:00 +0000 (08:49 +0100)]
[mlir][llvm] Cleanup LLVM IR control flow import test (NFC).

Use a FileCheck variable to match the switch op argument
instead of hardcoding the argument name.

Reviewed By: ftynse, Dinistro

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

22 months ago[bazel] Make TargetParser depend on config to fix --features=layering_check
Fangrui Song [Thu, 22 Dec 2022 06:59:36 +0000 (22:59 -0800)]
[bazel] Make TargetParser depend on config to fix --features=layering_check

While here, apply `buidifier`.

22 months ago[RISCV] Add more abs+zext test cases. NFC
Craig Topper [Wed, 21 Dec 2022 23:08:12 +0000 (15:08 -0800)]
[RISCV] Add more abs+zext test cases. NFC

22 months ago[clang][C++20] Add test for crash in NestedRequirement.
Utkarsh Saxena [Thu, 22 Dec 2022 05:49:29 +0000 (06:49 +0100)]
[clang][C++20] Add test for crash in NestedRequirement.

22 months ago[RISCV] Merge Masked and unMasked RVV manual codegen
Piyou Chen [Thu, 22 Dec 2022 04:27:44 +0000 (20:27 -0800)]
[RISCV] Merge Masked and unMasked RVV manual codegen

RVV intrinsic function will generate riscv_vector_builtin_cg.inc for CGBuiltin.cpp to produce the corresponding RVV intrinsic LLVM IR.

In this stage, riscv_vector.td will describe the bunch of manual codegen C++ code to tell CGBuiltin how to handle these instructions.

In this patch, we merge the masked RVV manual codegen and unmasked RVV manual codegen to reduce the number of manual codegen, and make more policy addition easier in the future.

This is a clean-up job that will not affect the RVV intrinsic functionality.

Reviewed By: kito-cheng

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

22 months agoFix out-of-bound access in TransformNestedRequirement.
Utkarsh Saxena [Thu, 22 Dec 2022 04:18:45 +0000 (05:18 +0100)]
Fix out-of-bound access in TransformNestedRequirement.

22 months ago[AMDGPU][Test] Update perfhint test to use opaque pointers
Yashwant Singh [Thu, 22 Dec 2022 04:17:28 +0000 (09:47 +0530)]
[AMDGPU][Test] Update perfhint test to use opaque pointers

Reviewed By: arsenm

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

22 months agoLinker: Disallow linking appending globals with different addrspaces
Matt Arsenault [Wed, 21 Dec 2022 17:35:42 +0000 (12:35 -0500)]
Linker: Disallow linking appending globals with different addrspaces

The current appending linkage handling implicitly assumes this by
using a basic ConstantExpr::getBitCast to resolve type
mismatches. Avoid this edge case so we don't need to keep the type
mismatch replacement code around after opaque pointers.

22 months ago[RISCV][NFC] Use Arrayref in TargetLowering functions.
ping.deng [Wed, 21 Dec 2022 12:25:00 +0000 (20:25 +0800)]
[RISCV][NFC] Use Arrayref in TargetLowering functions.

Reviewed By: kito-cheng

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

22 months ago[NFC] Rename Function::isDebugInfoForProfiling to shouldEmit[...]
Mircea Trofin [Thu, 22 Dec 2022 02:36:59 +0000 (18:36 -0800)]
[NFC] Rename Function::isDebugInfoForProfiling to shouldEmit[...]

The function name was misleading - the expectation set both by the name
and by other members of Function (like isDeclaration or isIntrinsic)
would be that the function somehow would "be" "debug info for
profiling". But that's not the case - the property indicates (as the
comment over the declaration also explains) whether debug info should be
emitted (for profiling).

22 months ago[M68k] Fix MachineFunctionInfo initialization after 69e75ae695d9ef1360a2a1fbefd6e0e04...
Fangrui Song [Thu, 22 Dec 2022 02:07:39 +0000 (18:07 -0800)]
[M68k] Fix MachineFunctionInfo initialization after 69e75ae695d9ef1360a2a1fbefd6e0e0456c3f7b

22 months ago[ARC][M68k] Fix INITIALIZE_PASS after D140364
Fangrui Song [Thu, 22 Dec 2022 01:53:11 +0000 (17:53 -0800)]
[ARC][M68k] Fix INITIALIZE_PASS after D140364

22 months agoAMDGPU: Use DenormalMode type in FP mode tracking
Matt Arsenault [Tue, 6 Dec 2022 16:59:49 +0000 (11:59 -0500)]
AMDGPU: Use DenormalMode type in FP mode tracking

This simplies a future patch. The MIR handling should be fixed. We're
still printing these in custom MachineFunctionInfo as bools (plus the
inverted meaning is hard to follow).

22 months ago[bazel] fix bazel file
Peiming Liu [Thu, 22 Dec 2022 01:24:52 +0000 (01:24 +0000)]
[bazel] fix bazel file

Reviewed By: yijia1212

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

22 months ago[LoongArch] Fix build after createMachineFunctionInfo change c774fd55008dbd2be51bc25f...
wanglei [Thu, 22 Dec 2022 01:13:42 +0000 (09:13 +0800)]
[LoongArch] Fix build after createMachineFunctionInfo change c774fd55008dbd2be51bc25f4c6f534978e73d95

22 months ago[OpenMP][libomptarget] Centralize host pinned buffers map to NextGen's PluginInterface
Kevin Sala [Wed, 21 Dec 2022 22:04:13 +0000 (23:04 +0100)]
[OpenMP][libomptarget] Centralize host pinned buffers map to NextGen's PluginInterface

This patch moves the management/tracking of host pinned buffers to the common PluginInterface
in NextGen plugins. For the moment, the management consists of tracking the host pinned
allocations into a map in each device.

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

22 months ago[mlir] Gate test checking statistics on their availability.
Will Dietz [Thu, 22 Dec 2022 00:46:27 +0000 (18:46 -0600)]
[mlir] Gate test checking statistics on their availability.

Fixes #59620.

22 months ago[NFC][OpenMP][libomptarget] Return null if error detected during allocation in NextGe...
Kevin Sala [Thu, 22 Dec 2022 00:41:50 +0000 (01:41 +0100)]
[NFC][OpenMP][libomptarget] Return null if error detected during allocation in NextGen AMDGPU

22 months agoRevert "Revert "[mlir][py] Enable building ops with raw inputs""
Jacques Pienaar [Thu, 22 Dec 2022 00:22:39 +0000 (16:22 -0800)]
Revert "Revert "[mlir][py] Enable building ops with raw inputs""

Fix Python 3.6.9 issue encountered due to type checking here. Will
add back in follow up.

This reverts commit 1f47fee2948ef48781084afe0426171d000d7997.

22 months ago[mlir] Fix a warning
Kazu Hirata [Thu, 22 Dec 2022 00:15:09 +0000 (16:15 -0800)]
[mlir] Fix a warning

This patch fixes:

  mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp:33:12:
  error: variable 'foundDynamicDim' set but not used
  [-Werror,-Wunused-but-set-variable]

22 months ago[NFC][SROA] More tests for variable indexed promotion
Roman Lebedev [Thu, 22 Dec 2022 00:12:17 +0000 (03:12 +0300)]
[NFC][SROA] More tests for variable indexed promotion

22 months ago[mlir] Fix a warning
Kazu Hirata [Thu, 22 Dec 2022 00:10:28 +0000 (16:10 -0800)]
[mlir] Fix a warning

This patch fixes:

  mlir/include/mlir/Analysis/AliasAnalysis/LocalAliasAnalysis.h:24:7:
  error: 'mlir::LocalAliasAnalysis' has virtual functions but
  non-virtual destructor [-Werror,-Wnon-virtual-dtor]

22 months ago[libc][obvious] fix bazel after removing vector
Michael Jones [Wed, 21 Dec 2022 23:22:27 +0000 (15:22 -0800)]
[libc][obvious] fix bazel after removing vector

The vector class was removed from the source code and cmake but not from
the bazel which caused bazel issues. This patch fixes that.

Reviewed By: sivachandra

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

22 months ago[gn build] Port ec11388b3342
LLVM GN Syncbot [Wed, 21 Dec 2022 23:32:10 +0000 (23:32 +0000)]
[gn build] Port ec11388b3342

22 months ago[gn] another fixup for 47df55f3ef5 -- LoongArch is experimental, not RISCV
Nico Weber [Wed, 21 Dec 2022 23:31:39 +0000 (18:31 -0500)]
[gn] another fixup for 47df55f3ef5 -- LoongArch is experimental, not RISCV

22 months ago[gn] fixup for 47df55f3ef5
Nico Weber [Wed, 21 Dec 2022 23:25:45 +0000 (18:25 -0500)]
[gn] fixup for 47df55f3ef5

22 months ago[gn] Don't include RISCV in targets build for 'all'
Nico Weber [Wed, 21 Dec 2022 23:23:47 +0000 (18:23 -0500)]
[gn] Don't include RISCV in targets build for 'all'

RISCV build and tests are often broken.

You can use `llvm_targets_to_build = "experimental"` to enable
_all_ targets, including the experimental ones. If RISCV is listed
in llvm_targets_to_build, it's built as before.

22 months ago[NFC] test commit
Nilay Vaish [Wed, 21 Dec 2022 22:54:25 +0000 (14:54 -0800)]
[NFC] test commit

22 months ago[LiveDebugValues] Remove LexicalScope param from VarLoc (NFC)
Heejin Ahn [Thu, 15 Dec 2022 21:58:51 +0000 (13:58 -0800)]
[LiveDebugValues] Remove LexicalScope param from VarLoc (NFC)

It doesn't seem to be used anymore.

Reviewed By: dschuff

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

22 months agoclang: Add __builtin_elementwise canonicalize and copysign
Matt Arsenault [Thu, 8 Dec 2022 03:48:27 +0000 (22:48 -0500)]
clang: Add __builtin_elementwise canonicalize and copysign

Just copy paste from the other functions. I also need fma, but
the current code seems to assume 1 or 2 arguments.

22 months agoRevert "[mlir][py] Enable building ops with raw inputs"
Jacques Pienaar [Wed, 21 Dec 2022 22:53:12 +0000 (14:53 -0800)]
Revert "[mlir][py] Enable building ops with raw inputs"

Reverting to fix build bot.

This reverts commit 3781b7905d8d808e5d4e97d597263f8ac48541b8.

22 months ago[NFC][SROA] More tests for variable indexed promotion
Roman Lebedev [Wed, 21 Dec 2022 22:35:23 +0000 (01:35 +0300)]
[NFC][SROA] More tests for variable indexed promotion

22 months ago[clangd] Fix crashing race in ClangdServer shutdown with stdlib indexing
Sam McCall [Wed, 21 Dec 2022 18:16:14 +0000 (19:16 +0100)]
[clangd] Fix crashing race in ClangdServer shutdown with stdlib indexing

In principle it's OK for stdlib-indexing tasks to run after the TUScheduler is
destroyed, as mostly they just update the dynamic index. We do drain the
stdlib-indexing queue before destroying the index.

However the task captures references to the PreambleCallbacks object, which is
owned by the TUScheduler. Once this is destroyed (explicitly, early in
~ClangdServer) an outstanding stdlib-indexing task may use-after-free.

The fix here is to avoid capturing references to the PreambleCallbacks.
Alternatives would be to have TUScheduler (exclusively) not own its callbacks
so they could live longer, or explicitly stopping the TUScheduler instead of
early-destroying it. These both seem more invasive.

See https://reviews.llvm.org/D115232 for some more context.

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

22 months ago[lld-macho] Emit map file entries for more synthetic sections
Jez Ng [Wed, 21 Dec 2022 22:26:02 +0000 (17:26 -0500)]
[lld-macho] Emit map file entries for more synthetic sections

We now handle the GOT, TLV, and stubs/lazy pointer sections.

Reviewed By: #lld-macho, thevinster, thakis

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

22 months agoLoongArch: Update for MachineFunctionInfo construction change
Matt Arsenault [Wed, 21 Dec 2022 22:24:59 +0000 (17:24 -0500)]
LoongArch: Update for MachineFunctionInfo construction change

22 months ago[NFC][SROA] More tests for promotion with variable index
Roman Lebedev [Wed, 21 Dec 2022 21:59:56 +0000 (00:59 +0300)]
[NFC][SROA] More tests for promotion with variable index

Also, delete the InstCombine test, it's not going to be relevant.

22 months ago[LV] Add createTripCountSCEV helper (NFC).
Florian Hahn [Wed, 21 Dec 2022 22:02:31 +0000 (22:02 +0000)]
[LV] Add createTripCountSCEV helper (NFC).

Split off helper function in preparation for D135017.

22 months ago[SPIR-V] Add atomic_flag builtin implementation
Michal Paszkowski [Wed, 21 Dec 2022 21:51:59 +0000 (22:51 +0100)]
[SPIR-V] Add atomic_flag builtin implementation

This change provides implementation details for atomic_flag builtins and
adds an extended atomic_flag.ll test from the LLVM SPIR-V Translator.

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

22 months agoReland "[NFC][SROA] `speculateSelectInstLoads()`: play nice with typed pointers for...
Roman Lebedev [Wed, 21 Dec 2022 21:08:16 +0000 (00:08 +0300)]
Reland "[NFC][SROA] `speculateSelectInstLoads()`: play nice with typed pointers for now"

This reverts commit bf88ba0f8718c1e89e28e977839ad0a6186d44fe,
relands 9f27f4536e19e93349b0662338408efe6d1cb2fd, but without a bug:
we *REALLY* should not be defaulting to address space 0
when address space is not specified...

22 months ago[llvm][SelectionDAGISel] support -{start|stop}-{before|after}= for remaining targets
Nick Desaulniers [Wed, 21 Dec 2022 21:11:36 +0000 (13:11 -0800)]
[llvm][SelectionDAGISel] support -{start|stop}-{before|after}= for remaining targets

Follow up to the series:
1. https://reviews.llvm.org/D140161
2. https://reviews.llvm.org/D140349
3. https://reviews.llvm.org/D140331
4. https://reviews.llvm.org/D140323

Completes the work from the previous two for remaining targets.

This creates the following named passes that can be run via
`llc -{start|stop}-{before|after}`:
- arc-isel
- arm-isel
- avr-isel
- bpf-isel
- csky-isel
- hexagon-isel
- lanai-isel
- loongarch-isel
- m68k-isel
- msp430-isel
- mips-isel
- nvptx-isel
- ppc-codegen
- riscv-isel
- sparc-isel
- systemz-isel
- ve-isel
- wasm-isel
- xcore-isel

A nice way to write tests for SelectionDAGISel might be to use a RUN:
line like:
llc -mtriple=<triple> -start-before=<arch>-isel -stop-after=finalize-isel -o -

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

Reviewed By: asb, zixuan-wu

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

22 months ago[lld][COFF] Fix lld-link crash when several .obj files built with /Zi refer to a...
Sylvain Audi [Thu, 15 Dec 2022 15:56:47 +0000 (10:56 -0500)]
[lld][COFF] Fix lld-link crash when several .obj files built with /Zi refer to a .pdb file that failed to load

This patch relaxes the constraints on the error message saved in PDBInputFile when failing to load a pdb file.

Storing an `Error` member infers that it must be accessed exactly once, which doesn't fit in several scenarios:
- If an invalid PDB file is provided as input file but never used, a loading error is created but never handled, causing an assert at shutdown.
- PDB file created using MSVC's `/Zi` option : The loading error message must be displayed once per obj file.

Also, the state of `PDBInputFile` was altered when reading (taking) the `Error` member, causing issues:
 - accessing it (taking the `Error`) makes the object look valid whereas it's not properly initialized
 - read vs write concurrency on a same `PDBInputFile` in the ghash parallel algorithm

The solution adopted here was to instead store an optional error string, and generate Error objects from it on demand.

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

22 months ago[libc][Obvious] Fix an off-by-one error introduced by eb9cc253cb048b6dbf2fcd73ac55b5e...
Siva Chandra Reddy [Wed, 21 Dec 2022 21:10:42 +0000 (21:10 +0000)]
[libc][Obvious] Fix an off-by-one error introduced by eb9cc253cb048b6dbf2fcd73ac55b5eda0184ed3.

22 months ago[llvm][AArch64ISelDAGToDAG] support -{start|stop}-{before|after}=aarch64-isel
Nick Desaulniers [Wed, 21 Dec 2022 20:28:37 +0000 (12:28 -0800)]
[llvm][AArch64ISelDAGToDAG] support -{start|stop}-{before|after}=aarch64-isel

Follow a similar pattern as AMDGPUDAGToDAGISel's constructor so that we
can use INITIALIZE_PASS to register a pass. This allows for more fine
grain testability of SelectionDAGISel via:

   llc -stop-{before,after}=aarch64-isel

Link: https://github.com/llvm/llvm-project/issues/59538
See also: https://reviews.llvm.org/D140323

Reviewed By: MaskRay

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