platform/upstream/llvm.git
21 months ago[scudo] Fix implicitly narrow casting (NFC)
Chia-hung Duan [Fri, 14 Oct 2022 06:36:47 +0000 (06:36 +0000)]
[scudo] Fix implicitly narrow casting (NFC)

u16 may be promoted to int by arithmetic type conversion. Do an explicit
cast to avoid certain compiler's warning.

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

21 months ago[LV] Simplify register usage code and avoid double map lookups. NFC
Craig Topper [Fri, 14 Oct 2022 18:46:42 +0000 (11:46 -0700)]
[LV] Simplify register usage code and avoid double map lookups. NFC

Instead of checking whether a map entry exists to decide if we should
initialize it or add to it, we can rely on the map entry being constructed
and initialized to 0 before the addition happens.

For the std::max case, I've made a reference to the map entry to
avoid looking it up twice.

Reviewed By: reames

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

21 months ago[NFC][mlir][MemRef] Make use of InferTypeOpInterface
Quentin Colombet [Tue, 11 Oct 2022 20:53:25 +0000 (20:53 +0000)]
[NFC][mlir][MemRef] Make use of InferTypeOpInterface

The `InferTypeOpInterface` generates builders for things it can infer
the types.
Thanks to that interface we can:
- Eliminate a builder for DimOp, and
- Describe how to infer the result types of `extract_strided_metadata`
  from its source, and get a simpler builder as a result

NFC

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

21 months ago[X86] Use unsigned int for return type of __get_cpuid_max.
Craig Topper [Fri, 14 Oct 2022 18:37:28 +0000 (11:37 -0700)]
[X86] Use unsigned int for return type of __get_cpuid_max.

It looks like gcc's header already uses unsigned int and we should
match.

Fixes PR58359.

Reviewed By: RKSimon

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

21 months ago[NFC] [HLSL] Move common metadata to LLVMFrontend
Chris Bieneman [Fri, 14 Oct 2022 18:33:25 +0000 (13:33 -0500)]
[NFC] [HLSL] Move common metadata to LLVMFrontend

This change pulls some code from the DirectX backend into a new
LLVMFrontendHLSL library to share utility data structures between the
HLSL code generation in Clang and the backend in LLVM.

This is a small refactoring as a first start to get code into the
right structure and get the library built and dependencies correct.

Fixes #58000 (https://github.com/llvm/llvm-project/issues/58000)

Reviewed By: python3kgae

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

21 months ago[RISCV] Correct RISCVTTIImpl::getRegUsageForType for vectors of pointers.
Craig Topper [Fri, 14 Oct 2022 18:30:48 +0000 (11:30 -0700)]
[RISCV] Correct RISCVTTIImpl::getRegUsageForType for vectors of pointers.

getPrimitiveSizeInBits returns 0 for pointers, we need to query
the size via DataLayout instead.

Reviewed By: reames

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

21 months ago[gn build] port 6ce872724877
Nico Weber [Fri, 14 Oct 2022 18:33:24 +0000 (14:33 -0400)]
[gn build] port 6ce872724877

21 months ago[DX] Add pass to pretty-print DXIL metadata in asm
Chris Bieneman [Thu, 13 Oct 2022 18:35:55 +0000 (13:35 -0500)]
[DX] Add pass to pretty-print DXIL metadata in asm

When DXC prints IR output it adds a bunch of IR comments in a header
that describe the DXIL metadata in a more human-readable format. This
pass will serve that purpose for LLVM by printing out ahead of the IR
printer.

Reviewed By: python3kgae

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

21 months ago[PowerPC] Fix parameters for __builtin_crypto_vsbox
Stefan Pintilie [Fri, 14 Oct 2022 14:51:06 +0000 (09:51 -0500)]
[PowerPC] Fix parameters for __builtin_crypto_vsbox

The documentation specifies that the input and ouput for the builtin
__builtin_crypto_vsbox should be vector unsigned char.

This patch fixes this type for the builtin.

Reviewed By: amyk

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

21 months ago[SimplifyCFG] Add tests for simpilfycfg, switch to lookup table with i2 types; NFC
chenglin.bi [Fri, 14 Oct 2022 18:24:46 +0000 (02:24 +0800)]
[SimplifyCFG] Add tests for simpilfycfg, switch to lookup table with i2 types; NFC

21 months ago[BranchRelaxation] Fix test for duplicate branch instruction
Anshil Gandhi [Fri, 14 Oct 2022 17:56:07 +0000 (11:56 -0600)]
[BranchRelaxation] Fix test for duplicate branch instruction

This patch is a follow up for D134557, inserting a check
for a duplicate unconditional branch to fall through.

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

21 months ago[Attributes] Improve writing `ExprArgument` value.
Volodymyr Sapsai [Fri, 14 Oct 2022 02:22:11 +0000 (19:22 -0700)]
[Attributes] Improve writing `ExprArgument` value.

Instead of dumping `Expr*` memory address, output `Expr` representation.

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

21 months ago[lldb] Start from end of previous substr when checking ordered substrs
Arthur Eubanks [Wed, 12 Oct 2022 23:07:44 +0000 (16:07 -0700)]
[lldb] Start from end of previous substr when checking ordered substrs

I'm trying to add a test which tests that the same substr occurs twice in a row, but it matches even if only one of the substr occurs.

This found a bug in concurrent_base.py.

Reviewed By: DavidSpickett

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

21 months ago[ADT] Fix Incorrect rounding for APFixedPoint::getIntPart
Tyker [Mon, 10 Oct 2022 08:35:47 +0000 (10:35 +0200)]
[ADT] Fix Incorrect rounding for APFixedPoint::getIntPart

21 months ago[AArch64]Change printVectorList to print SVE vector range
Caroline Concatto [Thu, 13 Oct 2022 18:26:14 +0000 (19:26 +0100)]
[AArch64]Change printVectorList to print SVE vector range

This patch has the prefered disassembly changed for SVE vector list.
For instance, instead of printing this assembly:
  ld4d { z1.d, z2.d, z3.d, z4.d }, p0/z, [x0]
it will print this:
  ld4d { z1.d-z4.d }, p0/z, [x0]

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

21 months ago[clang-dataflow][NFC] Mark test analysis classes as `final`.
Yitzhak Mandelbaum [Thu, 13 Oct 2022 22:36:35 +0000 (22:36 +0000)]
[clang-dataflow][NFC] Mark test analysis classes as `final`.

Change from marking individual methods as `final` to marking the whole class.

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

21 months ago[ARM] Fix for MVE i128 vector icmp costs.
David Green [Fri, 14 Oct 2022 17:49:25 +0000 (18:49 +0100)]
[ARM] Fix for MVE i128 vector icmp costs.

We were hitting an assert as the legalied type needn't be a vector.

Fixes #58364

21 months ago[AArch64-SVE]: Force generating code compatible to streaming mode.
Hassnaa Hamdi [Wed, 7 Sep 2022 00:56:55 +0000 (00:56 +0000)]
[AArch64-SVE]: Force generating code compatible to streaming mode.

Add a compile-time flag for enabling streaming mode.
When streaming mode is enabled, lower basic loads and stores of fixed-width vectors;
to generate code that is compatible to streaming mode.

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

21 months ago[clang][dataflow] Add support for a Top value in boolean formulas.
Yitzhak Mandelbaum [Thu, 6 Oct 2022 17:56:41 +0000 (17:56 +0000)]
[clang][dataflow] Add support for a Top value in boolean formulas.

Currently, our boolean formulas (`BoolValue`) don't form a lattice, since they
have no Top element. This patch adds such an element, thereby "completing" the
built-in model of bools to be a proper semi-lattice. It still has infinite
height, which is its own problem, but that can be solved separately, through
widening and the like.

Patch 1 for Issue #56931.

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

21 months ago[CodeGen][ObjC] Call synthesized copy constructor/assignment operator
Akira Hatanaka [Fri, 14 Oct 2022 17:40:24 +0000 (10:40 -0700)]
[CodeGen][ObjC] Call synthesized copy constructor/assignment operator
functions in getter/setter functions of non-trivial C struct properties

This fixes a bug where the getter/setter functions were doing a trivial
copy instead of calling the synthesized functions that copy non-trivial
C struct types.

This fixes https://github.com/llvm/llvm-project/issues/56680.

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

21 months agoFix llvm/lib/ObjCopy, llvm/llvm-ifs: c++20 compatibility
Angelo Matni [Fri, 14 Oct 2022 17:28:46 +0000 (10:28 -0700)]
Fix llvm/lib/ObjCopy, llvm/llvm-ifs: c++20 compatibility

Cleanup: avoid referring to `std::vector<T>` members when `T` is incomplete.

This is [not legal](https://timsong-cpp.github.io/cppwp/n4868/vector#overview-4)
according to the C++ standard, and causes build errors in particular in C++20
mode. Fix it by defining the vector's type before using the vector.

Reviewed By: saugustine, MaskRay

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

21 months ago[DAGCombiner] Fix crash for the merge stores with different value type
chenglin.bi [Fri, 14 Oct 2022 17:16:19 +0000 (01:16 +0800)]
[DAGCombiner] Fix crash for the merge stores with different value type

The crash case comes from #58350. It have two stores, one store is type f32 and the other is v1f32.
When we try to merge these two stores on v1f32, the memVT is vector type so the old code will use ISD::EXTRACT_SUBVECTOR for type f32 also then compiler crash.
So this patch insert a build_vector for f32 store to generate v1f32 also when memVT is v1f32.

Reviewed By: RKSimon

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

21 months ago[mlir] Update Values to use new casting infra
Nick Kreeger [Fri, 14 Oct 2022 16:56:35 +0000 (11:56 -0500)]
[mlir] Update Values to use new casting infra

This allows for using the llvm namespace cast methods instead of the ones on the Value class. The Value class method are kept for now, but we'll want to remove these eventually (with a really long lead time).

Related change: https://reviews.llvm.org/D134327

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

21 months ago[NFC] Fix typo in DAGCombiner
Nicola Lancellotti [Fri, 14 Oct 2022 16:29:49 +0000 (17:29 +0100)]
[NFC] Fix typo in DAGCombiner

21 months ago[AMDGPU][MC][GFX8+] Correct v_cndmask modifiers
Dmitry Preobrazhensky [Fri, 14 Oct 2022 16:36:29 +0000 (19:36 +0300)]
[AMDGPU][MC][GFX8+] Correct v_cndmask modifiers

Correct v_cndmask_b32 to support abs/neg modifiers in dpp/sdwa/e64 variants.
Correct v_cndmask_b16 for proper disassembly of abs/neg modifiers in e64_dpp variants.

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

21 months ago[mlir][ods] Fix substitutions for op custom string literals
Jeff Niu [Thu, 13 Oct 2022 03:03:54 +0000 (20:03 -0700)]
[mlir][ods] Fix substitutions for op custom string literals

The context and builder did not receive the correct substitutes in the
printers. Also, the tests were incorrect (d'oh!)

Reviewed By: rriddle

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

21 months ago[libc] Add implementation of the POSIX getcwd function.
Siva Chandra Reddy [Thu, 13 Oct 2022 07:43:05 +0000 (07:43 +0000)]
[libc] Add implementation of the POSIX getcwd function.

Reviewed By: michaelrj

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

21 months ago[flang][nfc] Rename `AddOtherOptions` as `ForwardOptions`
Andrzej Warzynski [Fri, 14 Oct 2022 16:12:44 +0000 (16:12 +0000)]
[flang][nfc] Rename `AddOtherOptions` as `ForwardOptions`

The updated name better reflects what this hook is intended for.

Reviewed By: tarunprabhu

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

21 months ago[clang-tidy] Use std::underlying_type_t (NFC)
Kazu Hirata [Fri, 14 Oct 2022 16:10:09 +0000 (09:10 -0700)]
[clang-tidy] Use std::underlying_type_t (NFC)

21 months ago[ConstraintElim] Add test cases for shl and mul.
Florian Hahn [Fri, 14 Oct 2022 15:59:13 +0000 (16:59 +0100)]
[ConstraintElim] Add test cases for shl and mul.

21 months agoAdd missing include to fix the modules build
Adrian Prantl [Fri, 14 Oct 2022 15:51:34 +0000 (08:51 -0700)]
Add missing include to fix the modules build

21 months ago[flang] Fix a warning
Kazu Hirata [Fri, 14 Oct 2022 15:51:37 +0000 (08:51 -0700)]
[flang] Fix a warning

This patch fixes:

  flang/lib/Lower/ConvertExpr.cpp:2733:14: error: variable
  'callNumResults' set but not used
  [-Werror,-Wunused-but-set-variable]

21 months ago[mlir][memref] Add initial Wide Int Emulation pass and patterns
Jakub Kuderski [Fri, 14 Oct 2022 15:36:47 +0000 (11:36 -0400)]
[mlir][memref] Add initial Wide Int Emulation pass and patterns

Add a new pass and conversions to emulate wide integer operations over memrefs.
The emulation is implemented on top of the existing pass to emulate wide integer arith ops.

Improve naming in the arith pass to avoid potential name clashes.

Reviewed By: antiagainst

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

21 months ago[clang] Fix a warning
Kazu Hirata [Fri, 14 Oct 2022 15:36:59 +0000 (08:36 -0700)]
[clang] Fix a warning

This patch fixes:

  clang/lib/CodeGen/CGCall.cpp:1867:64: error: '&&' within '||'
  [-Werror,-Wlogical-op-parentheses]

21 months ago[AArch64] Make ACLE intrinsics always available part1
Daniel Kiss [Fri, 14 Oct 2022 15:21:17 +0000 (17:21 +0200)]
[AArch64] Make ACLE intrinsics always available part1

A given arch feature might enabled by a pragma or a function attribute so in this cases would be nice to use intrinsics.
Today GCC offers the intrinsics without the march flag[1].
PR[2] for ACLE to clarify the intention and remove the need for -march flag for a given intrinsics.

This is going to be more useful when D127812 lands.

[1] https://godbolt.org/z/bxcMhav3z
[2] https://github.com/ARM-software/acle/pull/214

Reviewed By: dmgreen

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

21 months ago[PowerPC][NFC] Pre-commit case for lowering vector shuffles to xxsplti32dx (64 bit)
Amy Kwan [Fri, 14 Oct 2022 15:15:04 +0000 (10:15 -0500)]
[PowerPC][NFC] Pre-commit case for lowering vector shuffles to xxsplti32dx (64 bit)

This patch adds a test case for lowering vector shuffles to xxsplti32dx in
preparation for D135024. The test case added in this patch only adds the
64-bit CHECKs, as the 32-bit CHECKs cannot be generated (in which D135024
aims to fix).

21 months ago[SaveAndRestore] Upgrade this to support non-copyable types.
Chris Lattner [Fri, 14 Oct 2022 05:01:14 +0000 (22:01 -0700)]
[SaveAndRestore] Upgrade this to support non-copyable types.

This adds a constructor and upgrades the dtor to work with
move-only types.

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

21 months agoRemove redundant option -menable-unsafe-fp-math.
Zahira Ammarguellat [Mon, 3 Oct 2022 19:15:48 +0000 (15:15 -0400)]
Remove redundant option -menable-unsafe-fp-math.

There are currently two options that are used to tell the compiler to perform
unsafe floating-point optimizations:
'-ffast-math' and '-funsafe-math-optimizations'.

'-ffast-math' is enabled by default. It automatically enables the driver option
'-menable-unsafe-fp-math'.
Below is a table illustrating the special operations enabled automatically by
'-ffast-math', '-funsafe-math-optimizations' and '-menable-unsafe-fp-math'
respectively.

Special Operations -ffast-math -funsafe-math-optimizations -menable-unsafe-fp-math
MathErrno        0          1                     1
FiniteMathOnly         1           0                          0
AllowFPReassoc        1           1                          1
NoSignedZero        1                 1                          1
AllowRecip             1                 1                          1
ApproxFunc             1                 1                          1
RoundingMath        0                 0                          0
UnsafeFPMath        1                 0                          1
FPContract        fast          on                     on

'-ffast-math' enables '-fno-math-errno', '-ffinite-math-only',
'-funsafe-math-optimzations' and sets 'FpContract' to 'fast'. The driver option
'-menable-unsafe-fp-math' enables the same special options than
'-funsafe-math-optimizations'. This is redundant.
We propose to remove the driver option '-menable-unsafe-fp-math' and use
instead, the setting of the special operations to set the function attribute
'unsafe-fp-math'. This attribute will be enabled only if those special
operations are enabled and if 'FPContract' is either 'fast' or set to the
default value.

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

21 months ago[cmake] Remove LLVM_INCLUDE_GO_TESTS variable
Nikita Popov [Fri, 14 Oct 2022 14:32:22 +0000 (16:32 +0200)]
[cmake] Remove LLVM_INCLUDE_GO_TESTS variable

As pointed out by thakis in https://reviews.llvm.org/D135436#3858463,
this variable can be dropped now that the Go bindings have been
removed.

21 months ago[C2x] Implement support for nullptr and nullptr_t
Aaron Ballman [Fri, 14 Oct 2022 14:04:34 +0000 (10:04 -0400)]
[C2x] Implement support for nullptr and nullptr_t

This introduces support for nullptr and nullptr_t in C2x mode. The
proposal accepted by WG14 is:
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3042.htm

Note, there are quite a few incompatibilities with the C++ feature in
some of the edge cases of this feature. Therefore, there are some FIXME
comments in tests for testing behavior that might change after WG14 has
resolved national body comments (a process we've not yet started). So
this implementation might change slightly depending on the resolution
of comments. This is called out explicitly in the release notes as
well.

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

21 months ago[Libomptarget] Fix missing semicolon in exports
Joseph Huber [Fri, 14 Oct 2022 14:02:42 +0000 (09:02 -0500)]
[Libomptarget] Fix missing semicolon in exports

21 months ago[Libomptarget] Don't use full names for exported plugin symbols
Joseph Huber [Fri, 14 Oct 2022 13:39:04 +0000 (08:39 -0500)]
[Libomptarget] Don't use full names for exported plugin symbols

Summary:
This patch changes the `exports` file to export all `__tgt_rtl`
functions. This is a better option as not each plugin implements all of
these functions, furthermore any new functions added will be
automatically included.

21 months ago[AArch64][SME] Add support for arm_locally_streaming functions.
Sander de Smalen [Fri, 14 Oct 2022 08:51:13 +0000 (08:51 +0000)]
[AArch64][SME] Add support for arm_locally_streaming functions.

Functions with `aarch64_sme_pstatesm_body` will emit a SMSTART at the start
of the function, and a SMSTOP at the end of the function, such that all
operations use the right value for vscale.

Because the placement of these nodes is critically important (i.e. no
vscale-dependent operations should be done before SMSTART has been issued),
we require glueing the CopyFromReg to the Entry node such that we can
insert the SMSTART as part of that glued chain.

More details about the SME attributes and design can be found
in D131562.

Reviewed By: aemerson

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

21 months ago[libc] New version of the mem* framework
Guillaume Chatelet [Fri, 14 Oct 2022 13:46:27 +0000 (13:46 +0000)]
[libc] New version of the mem* framework

    This version is more composable and also simpler at the expense of being more explicit and more verbose. It also provides minimal implementations for ARM platforms.

    Codegen can be checked here https://godbolt.org/z/chf1Y6eGM

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

21 months ago[OpenMP] Extend the lit test for uses_allocators in target region
Animesh Kumar [Fri, 14 Oct 2022 11:06:03 +0000 (16:36 +0530)]
[OpenMP] Extend the lit test for uses_allocators in target region

This patch improves the LIT tests on the following :

1. The test on `uses_allocators` clause in the `target` region by
adding the respective CHECK lines. Allocator `omp_thread_mem_alloc`
is also added in the test.
2. The `defaultmap` clause wasn't being tested for the variable-
category `scalar` and the implicit-behavior `tofrom` with respect
to the OpenMP default version.

These improvements are inspired from SOLLVE tests.
SOLLVE repo: https://github.com/SOLLVE/sollve_vv

Reviewed By: jdoerfert

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

21 months ago[AArch64] Select to CCMN when the CCMP's second operator is negative constant
chenglin.bi [Fri, 14 Oct 2022 13:40:55 +0000 (21:40 +0800)]
[AArch64] Select to CCMN when the CCMP's second operator is negative constant

CCMP/CCMN's second operator support const from 0 to 31. When the CCMP's second operator is in the range [-31, -1] we can replace it with CCMN to avoid extra mov.

Fix: #57034

Reviewed By: efriedma

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

21 months agoRevert "[libc] New version of the mem* framework"
Guillaume Chatelet [Fri, 14 Oct 2022 13:21:52 +0000 (13:21 +0000)]
Revert "[libc] New version of the mem* framework"

This reverts commit 9721687835a7df5da0c9482cf684c11b8ba97f75.

21 months agoRevert "[libc] Fix embedded version of bcmp / memcmp"
Guillaume Chatelet [Fri, 14 Oct 2022 13:21:19 +0000 (13:21 +0000)]
Revert "[libc] Fix embedded version of bcmp / memcmp"

This reverts commit 7c9b8fa6d2d921569a1ebeb4816edb7b05a37cdd.

21 months ago[libc] Fix embedded version of bcmp / memcmp
Guillaume Chatelet [Fri, 14 Oct 2022 13:09:28 +0000 (13:09 +0000)]
[libc] Fix embedded version of bcmp / memcmp

21 months ago[lld/ELF] Convert undef-spell-corrector.s test to split-file
Nico Weber [Thu, 13 Oct 2022 14:55:24 +0000 (10:55 -0400)]
[lld/ELF] Convert undef-spell-corrector.s test to split-file

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

21 months agoFix the ExtractAPI tests
Aaron Ballman [Fri, 14 Oct 2022 12:57:01 +0000 (08:57 -0400)]
Fix the ExtractAPI tests

This should address the issues found by:
https://lab.llvm.org/buildbot/#/builders/139/builds/29568
https://lab.llvm.org/buildbot/#/builders/109/builds/48658

21 months agoAdd f16 type support in math.erf op.
Prashant Kumar [Wed, 12 Oct 2022 12:41:16 +0000 (12:41 +0000)]
Add f16 type support in math.erf op.

f16 type support was missing in the math.erf op.

Reviewed By: ezhulenev

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

21 months ago[libc] New version of the mem* framework
Guillaume Chatelet [Fri, 14 Oct 2022 12:42:34 +0000 (12:42 +0000)]
[libc] New version of the mem* framework

This version is more composable and also simpler at the expense of being more explicit and more verbose. It also provides minimal implementations for ARM platforms.

Codegen can be checked here https://godbolt.org/z/x19zvE59v

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

21 months ago[clang][Interp] Implement while and do-while loops
Timm Bäder [Fri, 7 Oct 2022 09:37:12 +0000 (11:37 +0200)]
[clang][Interp] Implement while and do-while loops

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

21 months ago[clang][Interp][NFC] Remove unused parameter from emitConst()
Timm Bäder [Fri, 7 Oct 2022 06:12:05 +0000 (08:12 +0200)]
[clang][Interp][NFC] Remove unused parameter from emitConst()

21 months ago[clang][Interp][NFC] Add some tests for invalid array access
Timm Bäder [Mon, 10 Oct 2022 10:58:47 +0000 (12:58 +0200)]
[clang][Interp][NFC] Add some tests for invalid array access

21 months agoSpeculatively fix the lldb test bots
Aaron Ballman [Fri, 14 Oct 2022 12:36:04 +0000 (08:36 -0400)]
Speculatively fix the lldb test bots

This should fix the issue found by:
https://lab.llvm.org/buildbot/#/builders/68/builds/41100

21 months agoRevert "[libc] New version of the mem* framework"
Guillaume Chatelet [Fri, 14 Oct 2022 12:26:38 +0000 (12:26 +0000)]
Revert "[libc] New version of the mem* framework"

This reverts commit 98bf836f3127a346a81da5ae3e27246935298de4.

21 months ago[mlir][llvm] Use tablegen to import atomic ops from LLVM IR.
Tobias Gysi [Fri, 14 Oct 2022 12:00:44 +0000 (15:00 +0300)]
[mlir][llvm] Use tablegen to import atomic ops from LLVM IR.

The revision imports the atomic operations using
tablegen generated builders. Additionally, it moves their tests to
the instructions.ll test file.

Depends on D135880

Reviewed By: ftynse

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

21 months ago[libc] New version of the mem* framework
Guillaume Chatelet [Thu, 13 Oct 2022 14:59:41 +0000 (14:59 +0000)]
[libc] New version of the mem* framework

This version is more composable and also simpler at the expense of being more explicit and more verbose. It also provides minimal implementations for ARM platforms.

Codegen can be checked here https://godbolt.org/z/x19zvE59v

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

21 months agoProperly print unnamed TagDecl objects in diagnostics
Aaron Ballman [Fri, 14 Oct 2022 12:17:16 +0000 (08:17 -0400)]
Properly print unnamed TagDecl objects in diagnostics

The diagnostics engine is very smart about being passed a NamedDecl to
print as part of a diagnostic; it gets the "right" form of the name,
quotes it properly, etc. However, the result of using an unnamed tag
declaration was to print '' instead of anything useful.

This patch causes us to print the same information we'd have gotten if
we had printed the type of the declaration rather than the name of it,
as that's the most relevant information we can display.

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

21 months ago[clang][Interp] Implement bitwise Or operations
Timm Bäder [Thu, 6 Oct 2022 13:13:11 +0000 (15:13 +0200)]
[clang][Interp] Implement bitwise Or operations

Analogous to the bitAnd implementation, do the same for bitwise or.

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

21 months ago[clang][Interp] Implement bitwise and operations
Timm Bäder [Fri, 30 Sep 2022 14:59:50 +0000 (16:59 +0200)]
[clang][Interp] Implement bitwise and operations

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

21 months ago[mlir][llvm] Use tablegen to import shufflevector from LLVM IR.
Tobias Gysi [Fri, 14 Oct 2022 11:45:32 +0000 (14:45 +0300)]
[mlir][llvm] Use tablegen to import shufflevector from LLVM IR.

The revision imports the shuffle vector operation using
tablegen generated builders. Additionally, it moves its test to
the instructions.ll test file.

Depends on D135874

Reviewed By: ftynse

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

21 months ago[clang][Interp][NFC] Remove an unnecessary local variable
Timm Bäder [Wed, 5 Oct 2022 04:17:40 +0000 (06:17 +0200)]
[clang][Interp][NFC] Remove an unnecessary local variable

21 months ago[clang][Interp][NFC] Zero-initialize Function::FrameSize
Timm Bäder [Wed, 5 Oct 2022 04:11:57 +0000 (06:11 +0200)]
[clang][Interp][NFC] Zero-initialize Function::FrameSize

It's never going to be used since it's only uninitialized if the
function is invalid, but let's zero it for readbility of
Function::dump().

21 months ago[clang][Interp][NFC] Rename a parameter to be more descriptive
Timm Bäder [Tue, 4 Oct 2022 16:26:25 +0000 (18:26 +0200)]
[clang][Interp][NFC] Rename a parameter to be more descriptive

21 months ago[clang][Interp][NFC] Remove unused function
Timm Bäder [Tue, 4 Oct 2022 15:24:55 +0000 (17:24 +0200)]
[clang][Interp][NFC] Remove unused function

21 months ago[clang][Interp][NFC] Add a failing test case
Timm Bäder [Fri, 30 Sep 2022 10:04:28 +0000 (12:04 +0200)]
[clang][Interp][NFC] Add a failing test case

21 months ago[clang][Interp] Implement ConditionalOperators
Timm Bäder [Wed, 28 Sep 2022 04:51:17 +0000 (06:51 +0200)]
[clang][Interp] Implement ConditionalOperators

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

21 months ago[clang][Interp] Implement div opcode
Timm Bäder [Tue, 27 Sep 2022 16:17:52 +0000 (18:17 +0200)]
[clang][Interp] Implement div opcode

Implement an opcode for division of two integrals.

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

21 months ago[clang][Interp] Implement rem opcode
Timm Bäder [Tue, 27 Sep 2022 15:40:55 +0000 (17:40 +0200)]
[clang][Interp] Implement rem opcode

Implement an opcode to get the remainder of the divison between LHS and
RHS.

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

21 months ago[clang][Interp] Implement bitwise not operations
Timm Bäder [Wed, 28 Sep 2022 12:30:44 +0000 (14:30 +0200)]
[clang][Interp] Implement bitwise not operations

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

21 months ago[mlir][Linalg] Support multi-output fusion in FuseIntoContainingOp
Nicolas Vasilache [Fri, 30 Sep 2022 11:09:37 +0000 (04:09 -0700)]
[mlir][Linalg] Support multi-output fusion in FuseIntoContainingOp

This revision adds the ability to fuse tileable ops with multiple results to
the transform.fuse_into_containing_op.

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

21 months ago[clang][Interp][NFC] Simplify Integral using constexpr if
Timm Bäder [Tue, 27 Sep 2022 15:10:20 +0000 (17:10 +0200)]
[clang][Interp][NFC] Simplify Integral using constexpr if

Just keep one version of the function and differentiate between
std::is_signed() and unsigned using a constexpr if, instead of having
two different versions for the signed and unsigned cases.

21 months ago[clang][Interp][NFC] Use a SourceRange for errors
Timm Bäder [Tue, 27 Sep 2022 10:40:12 +0000 (12:40 +0200)]
[clang][Interp][NFC] Use a SourceRange for errors

This makes the error message generated by bail() a bit more pleasant to
read.

21 months ago[mlir][spirv] GPUToSPIRVPass: support case when `TargetEnv` attribute attached to...
Ivan Butygin [Thu, 13 Oct 2022 19:16:26 +0000 (21:16 +0200)]
[mlir][spirv] GPUToSPIRVPass: support case when `TargetEnv` attribute attached to the `gpu.module`

Previously, only case when `TargetEnv` was attached to the top level `ModuleOp` was supported.

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

21 months ago[clang][Interp] Fix Pointer::toAPValue() LValuePath order
Timm Bäder [Mon, 26 Sep 2022 06:44:09 +0000 (08:44 +0200)]
[clang][Interp] Fix Pointer::toAPValue() LValuePath order

21 months ago[clang][Interp][NFC] Pass Function* pointers around as const
Timm Bäder [Fri, 23 Sep 2022 13:15:09 +0000 (15:15 +0200)]
[clang][Interp][NFC] Pass Function* pointers around as const

21 months ago[ConstraintElim] Add debug message when decomposition fails.
Florian Hahn [Fri, 14 Oct 2022 10:01:53 +0000 (11:01 +0100)]
[ConstraintElim] Add debug message when decomposition fails.

21 months ago[clang][Interp] Fix copy constructors with record array members
Timm Bäder [Fri, 23 Sep 2022 09:29:33 +0000 (11:29 +0200)]
[clang][Interp] Fix copy constructors with record array members

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

21 months ago[clang][Interp][NFC] Explain why tests are disabled
Timm Bäder [Fri, 14 Oct 2022 09:44:23 +0000 (11:44 +0200)]
[clang][Interp][NFC] Explain why tests are disabled

Disabled to make the buildbots happy in
c004d7534dcefcfebc3e07a7fa12f5492be80279. In C++14, the functions here
use a MaterializeTemporaryExpr, which the new constant interpreter
doesn't support yet. Add comments for this and two new RUN lines.

21 months ago[clang][Interp][NFC] Run record tests on i686 as well
Timm Bäder [Fri, 14 Oct 2022 09:19:24 +0000 (11:19 +0200)]
[clang][Interp][NFC] Run record tests on i686 as well

So we have some test coverage on a 32bit arch.

21 months ago[clang][Interp] Classify ArrayInitIndexExpr type
Timm Bäder [Fri, 14 Oct 2022 09:08:57 +0000 (11:08 +0200)]
[clang][Interp] Classify ArrayInitIndexExpr type

We can't just push a uint64 unconditionally here, since on 32bit arches
we later expect a different type, e.g. uint32.

This broke e.g. these builders:
https://lab.llvm.org/buildbot#builders/171/builds/21514
https://lab.llvm.org/buildbot#builders/38/builds/6643

21 months ago[MemorySSA] Add test for select with cross-iteration dependency (NFC)
Nikita Popov [Fri, 14 Oct 2022 09:02:23 +0000 (11:02 +0200)]
[MemorySSA] Add test for select with cross-iteration dependency (NFC)

This is currently miscompiled.

21 months agoRevert "[AArch64] Fix aligning the stack after calling __chkstk"
Martin Storsjö [Fri, 14 Oct 2022 08:27:39 +0000 (11:27 +0300)]
Revert "[AArch64] Fix aligning the stack after calling __chkstk"

This reverts commit 50e0aced4521260af842dba73f1d8c50d36314ea.

This could accidentally start producing invalid code in some
cases (in particular, if compiling with -mstack-alignment=16, which
one could expect to be a no-op for a target where the stack always
is aligned to 16 bytes anyway).

21 months ago[clang][Interp] Disable some RVO tests
Timm Bäder [Fri, 14 Oct 2022 08:44:39 +0000 (10:44 +0200)]
[clang][Interp] Disable some RVO tests

Apparently this breaks a couple of builders:
https://lab.llvm.org/buildbot/#/builders/139/builds/29552
https://lab.llvm.org/buildbot/#/builders/216/builds/11240

21 months ago[Interp] Silence warning in release builds. NFC.
Benjamin Kramer [Fri, 14 Oct 2022 08:35:48 +0000 (10:35 +0200)]
[Interp] Silence warning in release builds. NFC.

21 months agoAdd missing `override`s after aad013de41c0
Benjamin Kramer [Fri, 14 Oct 2022 08:34:17 +0000 (10:34 +0200)]
Add missing `override`s after aad013de41c0

21 months ago[BasicAA] Account for cycles when checking for same select condition
Nikita Popov [Fri, 14 Oct 2022 08:35:36 +0000 (10:35 +0200)]
[BasicAA] Account for cycles when checking for same select condition

If we have translated across a cycle backedge, the same SSA value
for the condition might be referring to two different loop iterations.
Use the isValueEqualInPotentialCycles() helper to avoid assuming
equality in that case.

21 months ago[BasicAA] Add test for select with loop carried dependency (NFC)
Nikita Popov [Fri, 14 Oct 2022 08:31:44 +0000 (10:31 +0200)]
[BasicAA] Add test for select with loop carried dependency (NFC)

21 months ago[mlir] add missing markdown delimiters in SCFOps.td
Oleksandr "Alex" Zinenko [Fri, 14 Oct 2022 08:30:34 +0000 (10:30 +0200)]
[mlir] add missing markdown delimiters in SCFOps.td

21 months ago[clang][Interp] Fix using default copy constructors
Timm Bäder [Wed, 21 Sep 2022 14:05:30 +0000 (16:05 +0200)]
[clang][Interp] Fix using default copy constructors

Implement ArrayInitLoopExprs, which are used in copy constructors to
copy arrays. Also fix problems encountered while doing that.

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

21 months ago[clang][Interp] Implement nested struct initialization
Timm Bäder [Mon, 19 Sep 2022 11:16:47 +0000 (13:16 +0200)]
[clang][Interp] Implement nested struct initialization

Recurse into visitInitializer() if necessary.

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

21 months ago[clang][Interp] Implement This pointer passing to methods
Timm Bäder [Sun, 18 Sep 2022 18:40:27 +0000 (20:40 +0200)]
[clang][Interp] Implement This pointer passing to methods

Implement passing the this pointer to member functions and constructors.
The this pointer is passed via the stack. This changes the functions to
explicitly track whether they have a RVO pointer and a this pointer.

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

21 months ago[clang][Interp] Start implementing record types
Timm Bäder [Fri, 16 Sep 2022 17:11:58 +0000 (19:11 +0200)]
[clang][Interp] Start implementing record types

Implement simple constructors as well as member access expressions.

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

21 months ago[clang][Interp] Don't run functions immediately after compiling them
Timm Bäder [Mon, 10 Oct 2022 11:02:15 +0000 (13:02 +0200)]
[clang][Interp] Don't run functions immediately after compiling them

This doesn't make much sense with functions that expect valid parameters
and/or a certain call stack on the caller side like This/RVO pointers.

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

21 months ago[clang][Interp][NFC] Add more tests for if expressions
Timm Bäder [Fri, 7 Oct 2022 09:54:04 +0000 (11:54 +0200)]
[clang][Interp][NFC] Add more tests for if expressions

Rename the old if_consteval.cpp to just if.cpp and add tests for the
if declaration.

21 months ago[clang][Interp][NFC] Add a TODO comment
Timm Bäder [Fri, 7 Oct 2022 05:49:57 +0000 (07:49 +0200)]
[clang][Interp][NFC] Add a TODO comment

We can ignore casts where FromT and ToT are the same type. But that's a
performance optimization that I'd like to do later. For now, this code
is doing the right thing.

21 months ago[TBAA] Model call accessing immutable type as readnone
Nikita Popov [Thu, 13 Oct 2022 10:31:23 +0000 (12:31 +0200)]
[TBAA] Model call accessing immutable type as readnone

Accesses to constant memory are not observable and should be
reported as readnone, not readonly. This is consistent with what
we do for normal (non-call) instructions: For those, the TBAA
metadata will result in pointsToConstantMemory() returning true,
which will then result in a NoModRef result, not a Ref result.

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