Commit Graph

471906 Commits

Author SHA1 Message Date
Timm Bäder
6dfe55569d [clang][Interp] Rework initializers
Before this patch, we had visitRecordInitializer() and
visitArrayInitializer(), which were different from the regular visit()
in that they expected a pointer on the top of the stack, which they
initialized. For example, visitArrayInitializer handled InitListExprs by
looping over the members and initializing the elements of that pointer.

However, this had a few corner cases and problems. For example, in
visitLambdaExpr() (a lambda is always of record type), it was not clear
whether we should always create a new local variable to save the lambda
to, or not. This is why https://reviews.llvm.org/D153616 changed
things around.

This patch changes the visiting functions to:

 - visit(): Always leaves a new value on the stack. If the expression
   can be mapped to a primitive type, it's just visited and the value is
   put on the stack. If it's of composite type, this function will
   create a local variable for the expression value and call
   visitInitializer(). The pointer to the local variable will stay on
   the stack.

 - visitInitializer(): Visits the given expression, assuming there is a
   pointer on top of the stack that will be initialized by it.

 - discard(): Visit the expression for side-effects, but don't leave a
   value on the stack.

It also adds an additional Initializing flag to differentiate between the initializing and non-initializing case.

Differential Revision: https://reviews.llvm.org/D156027
2023-08-20 13:33:08 +02:00
Sergei Barannikov
0e79111e4d [AVR][BPF][Lanai][Xtensa] Replace OperandMatchResultTy with ParseStatus (NFC)
ParseStatus is slightly more convenient to use due to implicit
conversion from bool, which allows to do something like:
```
  return Error(L, "msg");
```
when with MatchOperandResultTy it had to be:
```
  Error(L, "msg");
  return MatchOperand_ParseFail;
```
It also has more appropriate name since parse* methods are not only for
parsing operands.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D158275
2023-08-20 14:20:28 +03:00
Filipp Zhinkin
08d0b558f5 [SwiftError] Use IMPLICIT_DEF as a definition for unreachable VReg uses
SwiftErrorValueTracking creates vregs at swifterror use sites and then
connects it with appropriate definitions after instruction selection.
To propagate swifterror values SwiftErrorValueTracking::propagateVRegs
iterates over basic blocks in RPO, but some vregs previously created
at use sites may be located in blocks that became unreachable after
instruction selection. Because of that there will no definition for
such vregs and that may cause issues down the pipeline.

To ensure that all vregs created by the SwiftErrorValueTracking will
be defined propagateVRegs was updated to insert IMPLICIT_DEF at the
beginning of unreachable blocks containing swifterror uses.

Related issue: https://github.com/llvm/llvm-project/issues/59751

Reviewed By: compnerd

Differential Revision: https://reviews.llvm.org/D141053
2023-08-20 13:00:31 +02:00
Simon Pilgrim
1b95661616 [AArch64] Regenerate sve-fixed-length-fp-minmax.ll
Should remove the D158053 diffs
2023-08-20 11:46:44 +01:00
Timm Bäder
39236e9c60 [clang][Interp] Fix lifetime diagnostics for dead records
This used to crash the interpreter, either because we ran into the
assertion in CheckMutable() or because we accessed a Descriptor* pointer
preceding the field of a record. Those are preceded by an
InlineDescriptor though.

Differential Revision: https://reviews.llvm.org/D152132
2023-08-20 11:38:29 +02:00
Timm Bäder
8a58f0d370 [clang][Interp] Handle global composite temporaries
We only did this for primitive temporaries.

Unfortunately, the existing Pointer::toAPValue() won't do here, since
we're expected to set an rvalue on the LifetimeExtendedTemporaryDecl.

Differential Revision: https://reviews.llvm.org/D144457
2023-08-20 11:15:17 +02:00
Timm Bäder
ebbedc46f1 [clang][Sema][NFC] Remove TileLoc parameter from getDestructorName()
It's unused.
2023-08-20 11:02:12 +02:00
Timm Bäder
e1dfbc4e24 [clang][Sema][NFC] Modernize ActOnCallExpr 2023-08-20 10:37:58 +02:00
Qihan Cai
fe42682e78 [RISCV][NFC] Rename CVROR, NFC
Previous commit on ALU made an error by changing CV_ROR to CVROR. Revert it.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D158261
2023-08-20 16:36:03 +10:00
Craig Topper
d6cd49dd9a [RISCV][GISel] Add legalizer tests for G_SEXT/ZEXT from s32 to s64 for rv64. 2023-08-19 21:28:48 -07:00
Aiden Grossman
8b6f09e257 Revert "[clang][X86] Add __cpuidex function to cpuid.h"
This reverts commit 58696d2f5b.

Accidentally had this in my branch for my structural hash patch.
2023-08-19 17:18:10 -07:00
Aiden Grossman
64da0be1fc Reland "[NFCi][MergeFunctions] Consolidate Hashing Functions"
This is a reland of 28134a29fd which was
reverted due to behavioral differences between 32 and 64 bit builds that
have since been fixed.

Differential Revision: https://reviews.llvm.org/D158217
2023-08-19 17:14:08 -07:00
Aiden Grossman
58696d2f5b [clang][X86] Add __cpuidex function to cpuid.h
MSVC has a __cpuidex function implemented to call the underlying cpuid
instruction which accepts a leaf, subleaf, and data array that the output
data is written into. This patch adds this functionality into clang
under the cpuid.h header. This also makes clang match GCC's behavior.
GCC has had __cpuidex in its cpuid.h since 2020.
2023-08-19 17:12:23 -07:00
Fangrui Song
6521c40fb1 [MC] Remove an unneeded Darwin x86_64 workaround
The workaround (relocation suppression) from
7b46bb8e32 (2011) has been unneeded after
bfd0f01dd7 (2014) removed
`if (!A_base) return false;` and `if (!B_base) return false;`
2023-08-19 16:16:24 -07:00
Nikolas Klauser
cd34e89cfa [libc++][NFC] Remove __has_keyword
__has_keyword is almost not used anymore. There are only two cases. One can be replaced by __has_builtin and the other seems entirely redundant, so we can remove the definition.

Reviewed By: #libc, Mordante

Spies: Mordante, libcxx-commits

Differential Revision: https://reviews.llvm.org/D158215
2023-08-19 15:46:13 -07:00
Nikolas Klauser
3583bf3ad8 [libc++] Make everything in namespace std have default type visibility and hidden visibility and remove _LIBCPP_ENUM_VIS
This avoids having to add `_LIBCPP_ENUM_VIS`, since that is handled through `type_visibility` and GCC always makes the visibility of enums default. It also fixes and missing `_LIBCPP_EXPORTED_FROM_ABI` on classes when using Clang.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D153658
2023-08-19 15:16:04 -07:00
Craig Topper
46eded75cd [LoopVectorize] Replace dyn_cast with isa to suppress an unused variable warning. NFC 2023-08-19 14:41:00 -07:00
Aiden Grossman
7ff7df1c62 Revert "[NFCi][MergeFunctions] Consolidate Hashing Functions"
This reverts commit 28134a29fd.

This patch was causing build failures on multiple buildbots on 32-bit
architectures. Reverting now so I can deboug out-of-trunk and resubmit
later.
2023-08-19 12:23:16 -07:00
Craig Topper
b41e75c8a4 [RISCV][GISel] Make s32 a legal type for RV64 for any operation that has a W version.
My thought is that we can directly select W instructions using s32.

This will likely require combines and other optimizations eventually,
but this makes a simple starting point.

I'm slowly prototyping a similar approach for SelectionDAG.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D157770
2023-08-19 11:20:42 -07:00
Benjamin Kramer
e940926f3a [bazel] Make transitive OpBase.td inclusions visible to pdll tests 2023-08-19 20:02:02 +02:00
Benjamin Kramer
e51b21a1ff [bazel] Add new files from b448fe0c12 2023-08-19 19:56:24 +02:00
Mark de Wever
1eb90b9a4e [libc++] Fixes disabling wide character.
While testing the std module with -DLIBCXX_ENABLE_WIDE_CHARACTERS=OFF
the build failed. These functions are not exported from the module since
they use wchar_t. Disable them in the headers too.

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D158199
2023-08-19 19:09:16 +02:00
Groverkss
b448fe0c12 [mlir][NFC] Split OpBase.td into multiple smaller units
This patch splits OpBase.td into smaller files, focusing on individual,
implementations of functionalities.

This patch is marked NFC, as it just splits the implementation into multiple
files and includes them back into OpBase.td, so it doesn't break anything.

Most of the patch is mechanical, with chunks of implementation being shifted
into indvidual files. The main things to look out are:
  - Classes and Definations added to Utils.td
  - Headers of files
  - Any thing that should have been split but isn't

Reviewed By: rriddle, Mogball

Differential Revision: https://reviews.llvm.org/D156067
2023-08-19 22:19:39 +05:30
Florian Hahn
622b611f23
[VPlan] Inline buildScalarSteps in single user (NFC).
Other users have been refactored, remove the uneeded function.
2023-08-19 17:02:31 +01:00
Kazu Hirata
5675f44ceb [Transforms] Remove unnecessary const from a return type (NFC) 2023-08-19 08:29:51 -07:00
Kazu Hirata
d85993d28f [llvm] Remove redundant control flow statements (NFC) 2023-08-19 08:07:30 -07:00
Kazu Hirata
d27614e1d3 [llvm-profdata] Modernize SampleOverlapStats (NFC) 2023-08-19 07:56:37 -07:00
Kazu Hirata
5fcecea88b [llvm-diff] Modernize DiffEntry (NFC) 2023-08-19 07:56:35 -07:00
Kazu Hirata
f10125b1b8 [SystemZ] Modernize GPRRegs (NFC) 2023-08-19 07:56:34 -07:00
Kazu Hirata
c74b20602a [TableGen] Modernize SubMultiClassReference (NFC) 2023-08-19 07:56:32 -07:00
Kazu Hirata
9517afe21e [TableGen] Modernize SubClassReference (NFC) 2023-08-19 07:56:31 -07:00
Nico Weber
960881a7f3 clang: Make rewrite-includes-macros.cpp runnable on non-Win
As far as I can tell, there's nothing Windows-specific about the
test and it passes fine on other platforms.

I found this test when running

    rg clang_cl clang/test | rg '%s' | rg -v -- ' -- ' | rg -v not

after 547ee1c81f to see if other tests were missing `--`
before `%s` in `%clang_cl` invocations. This was the only one.
Since it used to run only on Windows, it wasn't needed, but as far
as I can tell there's no reason to run it only on Windows.

Differential Revision: https://reviews.llvm.org/D158279
2023-08-19 10:47:37 -04:00
Takuya Shimizu
985a72b6b3 [clang][Diagnostics] Provide source range to integer-overflow warnings
BEFORE:

```
overflow.cpp:1:21: warning: overflow in expression; result is -2147483648 with type 'int' [-Winteger-overflow]
    1 | int x = __INT_MAX__ + 1 + 3;
      |                     ^
overflow.cpp:2:9: warning: overflow in expression; result is -2147483648 with type 'int' [-Winteger-overflow]
    2 | int a = -(1 << 31) + 1;
      |         ^
```
AFTER:

```
overflow.cpp:1:21: warning: overflow in expression; result is -2147483648 with type 'int' [-Winteger-overflow]
    1 | int x = __INT_MAX__ + 1 + 3;
      |         ~~~~~~~~~~~~^~~
overflow.cpp:2:9: warning: overflow in expression; result is -2147483648 with type 'int' [-Winteger-overflow]
    2 | int a = -(1 << 31) + 1;
      |         ^~~~~~~~~~
```

Reviewed By: tbaeder
Differential Revision: https://reviews.llvm.org/D157383
2023-08-19 22:05:12 +09:00
Mark de Wever
f471b4975f [NFC][libc++] Removes no longer existing define.
_LIBCPP_HAS_NO_INCOMPLETE_FORMAT has been removed from libc++ for a
while now.
2023-08-19 14:06:42 +02:00
Kim Gräsman
eac0b67ed1 [docs] Fix include-what-you-use example
The --mapping_file switch was missing; the example would have been
rejected.

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D157785
2023-08-19 13:33:07 +02:00
Younan Zhang
69a8636c4d [clang][NFC] Remove redundant whitespaces
This breaks the clang check-format on CI.

+ grep -rnI '[[:blank:]]$' clang/lib clang/include clang/docs
clang/lib/Analysis/UnsafeBufferUsage.cpp:2277:#endif
2023-08-19 19:25:32 +08:00
iambrj
866391580b [MLIR][Presburger] Implement getDomainSet and getRangeSet for PresburgerRelation
This patch implements getDomainSet and getRangeSet for PresburgerRelation

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D158263
2023-08-19 16:12:43 +05:30
LLVM GN Syncbot
65f2596f79 [gn build] Port 0229dd0626 2023-08-19 10:21:24 +00:00
Alexey Lapshin
0229dd0626 [Reland][DWARFLinkerParallel] Add limited functionality to DWARFLinkerParallel.
This patch is extracted from D96035, it adds support for the existing
DWARFLinker functionality. What is not supported yet:

1. Types deduplication(--odr mode).
2. Modules deduplication.
3. Generation of index tables.

Differential Revision: https://reviews.llvm.org/D153268
2023-08-19 12:19:39 +02:00
iambrj
a67072eeee [MLIR][Presburger] Fix incorrect doc comment and add const 2023-08-19 15:42:48 +05:30
Groverkss
9aaf007a98 [SCF][Transform] Add transform.loop.fuse_sibling
This patch adds a new transform operation `transform.loop.fuse_sibling`,
which given two loops, fuses them, assuming that they are independent.
The transform operation itself performs very basic checks to ensure
IR legality, and leaves the responsibility of ensuring independence on the user.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D157069
2023-08-19 15:24:23 +05:30
chenli
d163ae8c25 [LoongArch][MC] Add invalid immediate testcases for LASX instructions
Reviewed By: SixWeining

Differential Revision: https://reviews.llvm.org/D157574
2023-08-19 17:16:12 +08:00
chenli
2f4b669583 [LoongArch][MC] Add invalid immediate testcases for LSX instructions
Reviewed By: SixWeining

Differential Revision: https://reviews.llvm.org/D157573
2023-08-19 17:15:22 +08:00
chenli
82bbf7003c [LoongArch] Add testcases of LASX intrinsics with immediates
The testcases mainly cover three situations:
- the arguments which should be immediates are non immediates.
- the immediate is out of upper limit of the argument type.
- the immediate is out of lower limit of the argument type.

Depends on D155830

Reviewed By: SixWeining

Differential Revision: https://reviews.llvm.org/D157571
2023-08-19 17:14:16 +08:00
chenli
83311b2b5d [LoongArch] Add LASX intrinsic testcases
Depends on D155830

Reviewed By: SixWeining

Differential Revision: https://reviews.llvm.org/D155835
2023-08-19 17:12:31 +08:00
chenli
f3aa441631 [LoongArch] Add LSX intrinsic testcases
Depends on D155829

Reviewed By: SixWeining

Differential Revision: https://reviews.llvm.org/D155834
2023-08-19 17:10:46 +08:00
wanglei
691f0d00b8 [LoongArch] Add LASX intrinsic support
This patch is similar to D155829.

Depends on D155829

Reviewed By: SixWeining

Differential Revision: https://reviews.llvm.org/D155830
2023-08-19 16:53:55 +08:00
wanglei
53141b2fcf [LoongArch] Add LSX intrinsic support
For handling intrinsics, our approach is not simply to match them
one-to-one with instructions. Instead, we lower some intrinsics
to common nodes and then perform matching. The advantage of this
approach is that it allows us to fully utilize the passes available
at the common layer for optimizing purposes.

We perform error checks on the immediate operand of all intrinsics,
rather than waiting until the end to throw exceptions.

Reviewed By: SixWeining

Differential Revision: https://reviews.llvm.org/D155829
2023-08-19 16:52:46 +08:00
Justin Bogner
d1889167b1 [Driver][DXC] Accept -f{no-,}discard-value-names in the DXC driver 2023-08-19 01:47:16 -07:00
Kazu Hirata
b627bde4d5 [Interp] Modernize State (NFC) 2023-08-19 00:27:12 -07:00