Commit Graph

455365 Commits

Author SHA1 Message Date
Craig Topper
a37df84f99 [SelectionDAG][RISCV] Remove code for handling too small shift type from SimplifyDemandedBits.
This code detected that the type returned from getShiftAmountTy was
too small to hold the constant shift amount. But it used the full
type size instead of scalar type size leading it to crash for
scalable vectors.

This code was necessary when getShiftAmountTy would always
return the target preferred shift amount type for scalars even when
the type was an illegal type larger than the target supported. For
vectors, getShiftAmountTy has always returned the vector type.

Fortunately, getShiftAmountTy was fixed a while ago to detect that
the target's preferred size for scalars is not large enough for the
type. So we can delete this code.

Switched to use getShiftAmountConstant to further simplify the code.

Fixs PR61561.
2023-03-21 11:08:19 -07:00
Hristo Hristov
83542e4764 [libc++][spaceship] Implement operator<=> for duration
Implements parts of [[ https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1614r2.html | P1614R2 ]]
Implemented `operator<=>` for `std::chrono::duration`

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D145881
2023-03-21 20:06:42 +02:00
Stefan Gränitz
32baf5c1c2 [lldb][expr] Propagate ClangDynamicCheckerFunctions::Install() errors to caller
I came accross this, because a lot of regression tests were saying:
```
(lldb) p argc
error: expression failed to parse:
error: couldn't install checkers, unknown error
```

With this change, error messages provide more detail:
```
(lldb) p argc
error: expression failed to parse:
error: couldn't install checkers:
error: Couldn't lookup symbols:
  __objc_load
```

I didn't find a case where `Diagnostics()` is not empty. Also it looks like this isn't covered in any test (yet).

Reviewed By: bulbazord, Michael137

Differential Revision: https://reviews.llvm.org/D146541
2023-03-21 19:05:23 +01:00
Arthur Eubanks
fa6ea7a419 [AlwaysInliner] Make legacy pass like the new pass
The legacy pass is only used in AMDGPU codegen, which doesn't care about running it in call graph order (it actually has to work around that fact).

Make the legacy pass a module pass and share code with the new pass.

This allows us to remove the legacy inliner infrastructure.

Reviewed By: mtrofin

Differential Revision: https://reviews.llvm.org/D146446
2023-03-21 11:04:22 -07:00
Alex Langford
2356bf27f7 [lldb][CMake] Enforce not letting lldbUtility link against any other lldb libs
lldbUtility is not supposed to depend on anything else in lldb. Let's
enforce that constraint in CMake rather than hoping something doesn't
slip in under the radar.

Differential Revision: https://reviews.llvm.org/D146473
2023-03-21 11:03:51 -07:00
Arthur Eubanks
2b34d59858 [test] Change DAG to NEXT in pipeline tests
These were made consistent in 951a980dc7.
2023-03-21 10:44:33 -07:00
Dave Lee
3854963854 Recommit [lldb] Change dwim-print to default to disabled persistent results
Change `dwim-print` to now disable persistent results by default, unless requested by
the user with the `--persistent-result` flag.

Ex:

```
(lldb) dwim-print 1 + 1
(int) 2
(lldb) dwim-print --persistent-result on -- 1 + 1
(int) $0 = 2
```

Users who wish to enable persistent results can make and use an alias that includes
`--persistent-result on`.

Updates: To recommit this, both TestPersistentResult.py and TestPAlias.py needed to be
updated, as well as the changes in D146230.

Differential Revision: https://reviews.llvm.org/D145609
2023-03-21 10:42:24 -07:00
Paul Kirth
c819257b7f [llvm][support] Fix ScopedPrinterTest on AIX
The test strings we used for infinity and NAN were not correct on AIX.
This patch creates those dynamically instead of hard-coded.

Reviewed By: abhina.sreeskantharajan

Differential Revision: https://reviews.llvm.org/D146542
2023-03-21 17:36:20 +00:00
Simon Pilgrim
651b4054a0 [DAG] visitABS - use FoldConstantArithmetic to perform constant folding.
Avoid needing to perform extra isConstantIntBuildVectorOrConstantInt checks
2023-03-21 17:23:27 +00:00
Dave Lee
75fdf7fd15 [lldb] Test direct ivar access in objc++ (NFC)
Add an Objective-C++ specific test for direct ivar access. This adds to the existing C++ and ObjC tests, and tests against regression for future refactoring.

Differential Revision: https://reviews.llvm.org/D146320
2023-03-21 10:14:42 -07:00
Arthur Eubanks
006230e10d [test] Remove redundant check prefix from new-pm-thinlto-prelink-pgo-defaults.ll 2023-03-21 10:12:09 -07:00
Jakub Kuderski
2981832501 [ADT] Add llvm::range_size function for generic ranges
This function follows `std::ranges::size` from C++20. It is intended
mainly for generic code that does not know the exact range type.
I did not modify the existing `llvm::size` function because it has a strict
guarantee of O(1) running time, and we cannot guarantee that when we delegate
size check to user-defined size functions.

Use `range_size` to optimize size checks in `zip`* and `enumerate`
functions. Before that, we would have to perform linear scans for ranges
without random access iterators.

This is the last change I have planned in the series that overhauls
`zip`* and `enumerate`.

Reviewed By: dblaikie, zero9178

Differential Revision: https://reviews.llvm.org/D146231
2023-03-21 12:58:18 -04:00
Aaron Ballman
b904e68f13 No longer issue static lambda pedantic warning for pre-c++2b compat
We were accidentally issuing "static lambdas are incompatible with C++
standards before C++2b" with -pedantic because it was an ExtWarn
diagnostic rather than a Warning. This corrects the diagnostic category
and adds some test coverage.

Fixes #61582
2023-03-21 12:49:45 -04:00
Craig Topper
24caf0196d [IndVarSimplify] Remove duplicate call to getSCEV. NFC
We already did this same call on the line before.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D146444
2023-03-21 09:47:07 -07:00
Mark de Wever
fb855eb941 [libc++] Qualifies size_t.
This has been done using the following command

  find libcxx/test -type f -exec perl -pi -e 's|^([^/]+?)((?<!::)size_t)|\1std::\2|' \{} \;

And manually removed some false positives in std/depr/depr.c.headers.

The `std` module doesn't export `::size_t`, this is a preparation for that module.

Reviewed By: ldionne, #libc, EricWF, philnik

Differential Revision: https://reviews.llvm.org/D146088
2023-03-21 17:41:36 +01:00
Philip Reames
00fdd2cb6c [LSR] Don't crash on non-branch terminator in -lsr-term-fold
Reported in https://reviews.llvm.org/D146415.  I rewrote the patch and aded the test case.  Per that report, spec2006.483.xalancbmk crashes without this fix.
2023-03-21 09:30:01 -07:00
Philip Reames
e9df5d62c8 [LSR] Remove a couple stale comments in lsr-term-fold 2023-03-21 09:21:30 -07:00
Arthur Eubanks
511ddfe265 [test] Split up new-pm-thinlto-defaults.ll into prelink and postlink pipelines
They're becoming different enough that it's getting annoying to figure out how allocate check prefixes.

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D146486
2023-03-21 09:18:09 -07:00
Congcong Cai
ec2a726a63 [Webassembly][multivalue] update libcall signature for f128 when multivalue feature enabled
further update for [D146271](https://reviews.llvm.org/D146271)

Reviewed By: tlively

Differential Revision: https://reviews.llvm.org/D146499
2023-03-22 00:16:29 +08:00
Andrew Litteken
9baaf4fb26 Revert "[IRSim] Check largest sections first when analyzing similarity"
llvm-sim test still misbehaving on other platforms.

This reverts commit 082ec26758.
2023-03-21 11:12:06 -05:00
Anna Thomas
4277d932ef [LV] Use speculatability within entire loop to avoid strided load predication
Use existing functionality for identifying total access size by strided
loads. If we can speculate the load across all vector iterations, we can
avoid predication for these strided loads (or masked gathers in
architectures which support it).

Differential Revision: https://reviews.llvm.org/D145616
2023-03-21 12:08:25 -04:00
Mirko Brkusanin
586ad89638 [AMDGPU][NFC] Update GFX11 test checks 2023-03-21 17:01:15 +01:00
Andrew Litteken
082ec26758 [IRSim] Check largest sections first when analyzing similarity
When we check for similarity, right now there is no order to how it is checked, except for via the suffix tree ordering.

We can reduce how much structural analysis we perform by checking the the regions in decreasing size. In doing so, we know that if two large sections match, each of their contained regions also match. This allows us to skip the structural checking for each smaller section. IT does require that we use the large regions as a "bridge" to create the canonical mapping between the two regions.

This reduces compile time significantly for some benchmarks. It will not perform as well for programs with many small items.

Recommit fixes the IRSimilarity tests.

Recommit of: 805ec19d7d

Reviewer: paquette
Differential Revision: https://reviews.llvm.org/D139338
2023-03-21 11:00:55 -05:00
Luke Lau
e69f8bac42 [RISCV][NFC] Add test case for SLP reduction vectorization failure
Horizontal reductions still occur on RISC-V, despite the maximum SLP VF
reported back by TTI being 1, to disable SLP.
This can cause the cost model to think it can vectorize a gather into
smaller, widened loads, when it will actually fail to do so.
This should ultimately be fixed whenever SLP is re-enabled for RISC-V at
some point.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D146529
2023-03-21 15:57:52 +00:00
Erich Keane
67852bff58 Fix switch warning from 514e4359a 2023-03-21 08:52:15 -07:00
Adam Paszke
9125996380 Support retrieving the splat value from DenseElementsAttrs in Python
This is especially convenient when trying to resize the splat.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D146510
2023-03-21 08:43:17 -07:00
Carl Ritson
e7c1b4b64c [SystemZ] Fix modelling of composed subreg indices.
A rare case where coalescing resulted in a hh32 (high32 of high64 of vector
register) subreg usage caused getSubReg() to fail as the vector reg does not
have that subreg in its subregs list, but rather h32 which was expected to
also act as hh32. See link below for the discussion when solving this.

Patch By: critson

Reviewed By: uweigand

Fixes: https://github.com/llvm/llvm-project/issues/61390
2023-03-21 16:39:22 +01:00
Erich Keane
01d05bd407 Add warning test to make buildbots happy after 514e4359 2023-03-21 08:34:48 -07:00
David Spickett
e73dd6254e [lldb] Fix a 32 bit warning in ScriptedProcessInterface
../llvm-project/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h:61:12:
warning: implicit conversion from 'unsigned long long' to 'size_t' (aka 'unsigned int')
changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
../llvm-project/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp:275:39:
warning: result of comparison of constant 18446744073709551615 with expression
of type 'size_t' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]

This happens because size_t on 32 bit is 32 bit, but LLDB_INVALID_OFFSET is
UINT64_MAX. Return lldb::offset_t instead, which is 64 bit everywhere.

DoWriteMemory still returns size_t but this is because every other
Process derived thing does that. As long as the failure check works I think
it should be fine.

Reviewed By: mib

Differential Revision: https://reviews.llvm.org/D146124
2023-03-21 15:34:17 +00:00
Max Kazantsev
68685a7f6a Revert "[GuardWidening] Improve analysis of potential widening into hotter block"
This reverts commit 8d2885c2ef.

I accidentally introduced an infinite loop in this patch, will return when this is fixed.
2023-03-21 22:32:12 +07:00
Philip Reames
53e9a5ddc0 [LSR] Fix "new use of poison" problem in lsr-term-fold
This models the approach used in LFTR. The short summary is that we need to prove the IV is not dead first, and then we have to either prove the poison flag is valid after the new user or delete it.

There are two key differences between this and LFTR.

First, I allow a non-concrete start to the IV. The goal of LFTR is to canonicalize and IVs with constant starts are canonical, so the very restrictive definition there is mostly okay. Here on the other hand, we're explicitly moving *away* from the canonical form, and thus need to handle non-constant starts.

Second, LFTR bails out instead of removing inbounds on a GEP. This is a pragmatic tradeoff since inbounds is hard to infer and assists aliasing. This pass runs very late, and I think the tradeoff runs the other way.

A different approach we could take for the post-inc check would be to perform a pre-inc check instead of a post-inc check. We would still have to check the pre-inc IV, but that would avoid the need to drop inbounds. Doing the pre-inc check would basically trade killing a whole IV for an extra register move in the loop. I'm open to suggestions on the right approach here.

Note that this analysis is quite expensive compile time wise. I have made no effort to optimize (yet).

Differential Revision: https://reviews.llvm.org/D146464
2023-03-21 08:23:40 -07:00
Nikita Popov
b4307437e5 [ModuleUtils] Handle globals_ctors/dtors with non-literal type (PR56809)
If the global already exists, use its existing type, so we don't
try to mix literal and non-literal structs among the elements.

Fixes https://github.com/llvm/llvm-project/issues/56809.
2023-03-21 16:19:05 +01:00
Erich Keane
514e4359a5 inline stmt attribute diagnosing in templates
D146089's author discovered that our diagnostics for always/no inline
would null-dereference when used in a template. He fixed that by
skipping in the dependent case.

This patch makes sure we diagnose these after a template instantiation.
It also adds infrastructure for other statement attributes to add
checking/transformation.

Differential Revision: https://reviews.llvm.org/D146323
2023-03-21 08:16:52 -07:00
Philip Reames
b33f5e7ed3 [LSR] Use evaluateAtIteration in lsr-term-fold
This is a follow up to one of the side discussions on D146429.  There are two semantic changes contained here.

The motivation for the change to the legality condition introduced in D146429 comes from the fact that we only check the post-inc form. As such, as long as the values of the post-inc variable don't self wrap, it's actually okay if we wrap past the starting value of the pre-inc IV.

Second, Nikic noticed during review that the test changes changed behavior for TC=0 (i.e. N=0 in the tests).  On more careful inspection, it became apparent that the previous manual expansion code was incorrect in the case where the primary IV could wrap without poison, and started with the limit value (i.e. i8 post-inc starts at 255 for 0 exit test, implying pre-inc starts with 0).  See @wrap_around test for an example of the (previous) miscompile.

Differential Revision: https://reviews.llvm.org/D146457
2023-03-21 08:11:36 -07:00
Philip Reames
b7af34c303 [LSR] Add a test case for (another) miscompile in lsr-term-fold
Derived from an observation by @nikic on D146457.
2023-03-21 08:11:36 -07:00
Valentin Clement
faa1043144
[flang] Carry over dynamic type information when creating an unlimited polymorphic temp
The dyanmic type must be carried over in a PolymorphicValue when the address is
loaded from an unlimited polymorphic allocatable.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D146525
2023-03-21 16:08:07 +01:00
Maya Amrami
fd004a4986 [mlir] tosa.concat - Add InferTensorType interface
When this interface is used, a call to inferReturnTypeComponents()
is generated on creation and verification of the op.
A few changes were required in inferReturnTypeComponents():
- Emit error when it fails.
  The verifier calls this method now, and it is preferable to
  indicate what caused the failure.
- Fix the inferred return shapes so they have a type too.

Reviewed By: rsuderman

Differential Revision: https://reviews.llvm.org/D146132
2023-03-21 17:01:08 +02:00
Alex Zinenko
fb409a2822 [mlir] Transform dialect: add named sequences
Named sequences introduce an additional abstraction and reuse capability
to the transform dialect. They can be though of as macros parameterized
with handles that can be invoked in places where a transform dialect
operation is expected. Such reuse was previously not possible in the
dialect and required dynamic construction of the transform IR from the
client language. Named sequences are intentionally restricted to
disallow recursion, as it could make the dialect accidentally
Turing-complete, which isn't desired at this point.

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D146433
2023-03-21 14:53:54 +00:00
Aaron Ballman
270a6a2824 No longer issue pedantic warning about pre-c++2b compat
We were accidentally issuing "overloaded 'operator[]' with more than
one parameter is a C++2b extension" with -pedantic because it was an
ExtWarn diagnostic rather than a Warning. This corrects the diagnostic
category and adds some test coverage.

Fixes #61582
2023-03-21 10:51:53 -04:00
Daniel Kiss
83dc4734ba Fix -fsplit-lto-unit with ifuncs
ifuncs can't take part of the whole-program devirtualization so no need them to be copied to the merged module.
The corresponding resolver function also kept out which caused the crash.

Fixes #60962 #57870

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D144982
2023-03-21 15:36:13 +01:00
Philip Reames
042783f556 [LFTR] Assert and simplify under assumption exit counts are integers [nfc]
This invariant was introduced in 8f3d16905d.

Differential Revision: https://reviews.llvm.org/D146470
2023-03-21 07:35:05 -07:00
David Spickett
392d9eb03a [lldb] For native compiles, check signal numbers are correct when adding codes
Reviewed By: arichardson, emaste

Differential Revision: https://reviews.llvm.org/D146285
2023-03-21 14:31:21 +00:00
Pavel Kosov
88e5206f2c Reland [clang][ASTImport] Add support for import of empty records
Patch represents the clang part of changes in D143347

Reviewed By: balazske

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

~~

Huawei RRI, OS Lab
2023-03-21 17:26:36 +03:00
Adrian Kuegel
dc9d2e588d [mlir] Add missing registrations to runners. 2023-03-21 15:17:21 +01:00
Adrian Kuegel
16b192f497 [mlir][Bazel] Adjust BUILD files to 0e9523efda 2023-03-21 15:00:23 +01:00
Maryam Moghadas
155abd0678 [PowerPC] Emit warn_deprecated_lax_vec_conv_all warning only for PPC
This patch is to isolate the lax vector conversions warning only for PPC,
the reason is that SystemZ wants different logic in terms of
vector bool compatibility.

Reviewed By: lei

Differential Revision: https://reviews.llvm.org/D145506
2023-03-21 08:51:25 -05:00
Jan Sjodin
382eb7c2c7 [mlir] Add alloca address space handling to the data layout subsystem
This patch adds alloca address space information to the data layout interface
and implementation in the DLTI dialect. This is needed for targets that use
separate address spaces for local/stack data.

Reviewed By: ftynse, krzysz00

Differential Revision: https://reviews.llvm.org/D144657
2023-03-21 09:37:08 -04:00
Simon Pilgrim
8022ff5f19 [X86] Add verify-machineinstrs checks to baseptr tests
Help catch regressions from D145650 that were only noticed on EXPENSIVE_CHECKS builds
2023-03-21 13:24:47 +00:00
Nicolas Vasilache
20294bf6c1 [mlir][Transform] NFC - Add more advanced debug spew to help hunt down potential misuses
Differential Revision: https://reviews.llvm.org/D146509
2023-03-21 06:12:07 -07:00
Ilya Biryukov
282cae0b9a [Sema] Fix crash on __fp16 parameters in template instantiations
Fixes #61441.

Currently, Clang stores `nullptr` in the parameter lists inside
`FunctionProtoTypeLoc` if `__fp16` is used without pointer qualifiers.

Any code path that calls `Declarator::setInvalidType()` before
`GetFullTypeForDeclarator` will lead to the same problem downstream.

The relevant code is:
```cpp
if (D.isInvalidType())
  return Context.getTrivialTypeSourceInfo(T);

return GetTypeSourceInfoForDeclarator(state, T, TInfo);
```

`GetTypeSourceInfoForDeclarator` sets the parameter `Decl`, but we can't
call it when `isInvalidType() == true` as this causes other assertion
failures that seem harder to fix.

Reviewed By: kadircet

Differential Revision: https://reviews.llvm.org/D146426
2023-03-21 14:06:46 +01:00