Commit Graph

475445 Commits

Author SHA1 Message Date
Vladislav Dzhidzhoev
fb8f59156f [AArch64][GlobalISel] Adopt dup(load) -> LD1R patterns from SelectionDAG
Follow-up of #65630.
2023-09-20 18:22:54 +02:00
Alex Voicu
de018f5ca4
[clang][CodeGen] The eh_typeid_for intrinsic needs special care too (#65699)
This change is symmetric with the one reviewed in
<https://reviews.llvm.org/D157452> and handles the exception handling
specific intrinsic, which slipped through the cracks, in the same way,
by inserting an address-space cast iff RTTI is in a non-default AS.
2023-09-20 17:12:19 +01:00
Fangrui Song
0de0b6dded
[ELF] Postpone "unable to move location counter backward" error (#66854)
The size of .ARM.exidx may shrink across `assignAddress` calls. It is
possible
that the initial iteration has a larger location counter, causing
`__code_size =
__code_end - .; osec : { . += __code_size; }` to report an error, while
the error would
have been suppressed for subsequent `assignAddress` iterations.

Other sections like .relr.dyn may change sizes across `assignAddress`
calls as
well. However, their initial size is zero, so it is difficiult to
trigger a
similar error.

Similar to https://reviews.llvm.org/D152170, postpone the error
reporting.
Fix #66836. While here, add more information to the error message.
2023-09-20 09:06:45 -07:00
Scott Linder
434907e474
[NFC][AsmPrinter] Refactor FrameIndexExprs as a std::set (#66433)
This avoids the need for a mutable member to implement deferred sorting,
and some bespoke code to maintain a SmallVector as a set.

The performance impact seems to be negligible in some small tests, and
so seems acceptable to greatly simplify the code.

An old FIXME and accompanying workaround are dropped. It is ostensibly
dead-code within the current codebase.
2023-09-20 12:05:05 -04:00
Fangrui Song
309d1c43bd [ELF][test] Add a test to demonstrate #66836 2023-09-20 09:04:41 -07:00
Simon Pilgrim
ad762f2a9f [X86] Regenerate pr39098.ll 2023-09-20 16:58:00 +01:00
Simon Pilgrim
2ec697b4c7 [AMDGPU] Regenerate always-uniform.ll 2023-09-20 16:58:00 +01:00
Slava Zakharin
69d9ad1cee
[flang][hlfir] Fixed cleanup code placement indeterminism in OrderedAssignments. (#66811)
I had to remove test3() case in 73086dab9e
to fix the buildbots. This patch brings it back with proper fix.
2023-09-20 08:34:11 -07:00
Natalie Chouinard
47a377d5e0 [SPIRV] Fix OpConstant float and double printing
Print OpConstant floats as formatted decimal floating points, with
special case exceptions to print infinity and NaN as hexfloats.

This change follows from the fixes in
https://github.com/llvm/llvm-project/pull/66686 to correct how
constant values are printed generally.

Differential Revision: https://reviews.llvm.org/D159376
2023-09-20 15:26:41 +00:00
Nico Weber
2ed813ff26 [gn] Add dummy build file for VETests
sync_source_lists_from_cmake.py checks that every unittest in CMake
also exists in the GN build. 4f330b7f75 added VETests, but the GN
build doesn't include the VE target. So add a dummy target for this
to placate the check.
2023-09-20 11:08:36 -04:00
David Spickett
fdc265be26 [lldb][AArch64] Invalidate cached VG value before reconfiguring SVE registers
This fixes 46b961f36b.

Prior to the SME changes the steps were:
* Invalidate all registers.
* Update value of VG and use that to reconfigure the registers.
* Invalidate all registers again.

With the changes for SME I removed the initial invalidate thinking
that it didn't make sense to do if we were going to invalidate them
all anyway after reconfiguring.

Well the reason it made sense was that it forced us to get the
latest value of vg which we needed to reconfigure properly.

Not doing so caused a test failure on our Graviton bot which has SVE
(https://lab.llvm.org/buildbot/#/builders/96/builds/45722). It was
flaky and looping it locally would always fail within a few minutes.
Presumably it was using an invalid value of vg, which caused some offsets
to be calculated incorrectly.

To fix this I've invalided vg in AArch64Reconfigure just before we read
it. This is the same as the fix I have in review for SME's svg register.

Pushing this directly to fix the ongoing test failure.
2023-09-20 16:05:34 +01:00
Nicolas Vasilache
1b8b556443
[mlir][Vector] Add fastmath flags to vector.reduction (#66905)
This revision pipes the fastmath attribute support through the
vector.reduction op. This seemingly simple first step already requires
quite some genuflexions, file and builder reorganization. In the
process, retire the boolean reassoc flag deep in the LLVM dialect
builders and just use the fastmath attribute.

During conversions, templated builders for predicated intrinsics are
partially cleaned up. In the future, to finalize the cleanups, one
should consider adding fastmath to the VPIntrinsic ops.
2023-09-20 16:57:20 +02:00
Fraser Cormack
ebefe83c09 [NFC] Fix spelling 'constanst' -> 'constants' 2023-09-20 15:33:03 +01:00
Joe Nash
2c0f2b510c
[AMDGPU] Convert tests rotr.ll and rotl.ll to be auto-generated (#66828)
and add GFX11 coverage. NFC
2023-09-20 10:32:04 -04:00
Hans Wennborg
700f683f9d Revert "[clang] Don't inherit dllimport/dllexport to exclude_from_explicit_instantiation members during explicit instantiation (#65961)"
This uncovered a problem with virtual methods and
exclude_from_explicit_instantiation, see
https://github.com/llvm/llvm-project/issues/66909

Reverting until that's fixed.

> This is a continuation of https://reviews.llvm.org/D155713
>
> Fixes https://github.com/llvm/llvm-project/issues/40363

This reverts commit 84216d1735.
2023-09-20 16:31:12 +02:00
Walter Erquinigo
96b1784ac8
[lldb-vscode] Use auto summaries whenever variables don't have a summary (#66551)
Auto summaries were only being used when non-pointer/reference variables
didn't have values nor summaries. Greg pointed out that it should be
better to simply use auto summaries when the variable doesn't have a
summary of its own, regardless of other conditions.

This led to code simplification and correct visualization of auto
summaries for pointer/reference types, as seen in this screenshot.

<img width="310" alt="Screenshot 2023-09-19 at 7 04 55 PM"
src="https://github.com/llvm/llvm-project/assets/1613874/d356d579-13f2-487b-ae3a-f3443dce778f">
2023-09-20 10:23:41 -04:00
Alex Bradbury
feb5c5779c [VE] Add TargetParser to CMakeLists.txt for VE unittest
This fixes the -DBUILD_SHARED_LIBS=True build, which broke after #66730.
2023-09-20 15:22:10 +01:00
Luís Marques
40d4837037
Warn on align directive with non-zero fill value in virtual sections (#66792)
This patch warns when an align directive with a non-zero fill value is
used in a virtual section. The fill value is also set to zero,
preventing an assertion in `MCAssembler::writeSectionData` for the case
of `MCFragment::FT_Align` from tripping.
2023-09-20 15:17:50 +01:00
Benjamin Maxwell
2f11ce5579
[mlir][VectorOps] Extend vector.constant_mask to support 'all true' scalable dims (#66638)
This extends `vector.constant_mask` so that mask dim sizes that
correspond to a scalable dimension are treated as if they're implicitly
multiplied by vscale. Currently this is limited to mask dim sizes of 0
or the size of the dim/vscale. This allows constant masks to represent
all true and all false scalable masks (and some variations):

```
// All true scalable mask
%mask = vector.constant_mask [8] : vector<[8]xi1>

// All false scalable mask
%mask = vector.constant_mask [0] : vector<[8]xi1>

// First two scalable rows
%mask = vector.constant_mask [2,4] : vector<4x[4]xi1>
```
2023-09-20 14:54:42 +01:00
Louis Dionne
e3b166229f [libc++] Sort available features before printing them
This makes it easier to compare the features available in two adjacent
runs of lit.
2023-09-20 09:53:07 -04:00
Simon Pilgrim
27d4f229ad [X86] X86DAGToDAGISel::matchIndexRecursively - replace hard coded recursion limit with SelectionDAG::MaxRecursionDepth. NFCI. 2023-09-20 14:52:01 +01:00
Matt Devereau
d297399b35 [AArch64][SME] Enable TPIDR2 lazy-save for za_preserved
This change makes callees with the __arm_preserves_za
type attribute comply with the dormant state requirements
when it's caller has the __arm_shared_za type attribute.
Several external SME functions also do not need to lazy
save.

5e67092434/aapcs64/aapcs64.rst (L1381)

Differential Revision: https://reviews.llvm.org/D159186
2023-09-20 13:34:41 +00:00
Louis Dionne
257eb74524
[libc++] Simplify how the global stream tests are written (#66842)
Instead of relying on Bash, use the builtin Lit commands whenever
possible. The motivation is to stop running %t.exe behind Bash, which
breaks on macOS 13.5 with SIP enabled because DYLD_LIBRARY_PATH isn't
forwarded to the underlying process when running through a protected
process.

For more details, see [1].

[1]: https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/RuntimeProtections/RuntimeProtections.html
2023-09-20 09:33:16 -04:00
Natalie Chouinard
f7bfa583b7
[SPIR-V] Fix 64-bit integer literal printing (#66686)
Previously, the SPIR-V instruction printer was always printing the first
operand of an `OpConstant`'s literal value as one of the fixed operands.
This is incorrect for 64-bit values, where the first operand is actually
the value's lower-order word and should be combined with the following
higher-order word before printing.

This change fixes that issue by waiting to print the last fixed operand
of `OpConstant` instructions until the variadic operands are ready to be
printed, then using `NumFixedOps - 1` as the starting operand index for
the literal value operands.

Depends on D156049
2023-09-20 09:31:14 -04:00
Abhinav271828
c1b997464b
[MLIR][Presburger] Template Matrix to allow MPInt and Fraction; use IntMatrix for integer matrices (#66897)
Matrix has been templated to Matrix (for MPInt and Fraction) with
explicit instantiation for both these types.
IntMatrix, inheriting from Matrix<MPInt>, has been created to allow for
integer-only methods.
makeMatrix has been duplicated to makeIntMatrix and makeFracMatrix.

This was already landed previously but was reverted in
98c994c8e2 due to build failure. This
fixes the failure.
2023-09-20 14:29:33 +01:00
martinboehme
ed65ced22a
[clang][dataflow] Identify post-visit state changes in the HTML logger. (#66746)
Previously, post-visit state changes were indistinguishable from
ordinary
iterations, which could give a confusing picture of how many iterations
a block
needs to converge.

Now, post-visit state changes are marked with "post-visit" instead of an
iteration number:


![screenshot](https://github.com/llvm/llvm-project/assets/29098113/5e9553d6-dfaa-45d3-8ea4-e623a14ee4c5))
2023-09-20 15:18:57 +02:00
Freddy Ye
cf1d2e4f94
[X86] Fix an assembler bug of CMPCCXADD. (#66748) 2023-09-20 21:01:07 +08:00
Freddy Ye
632d13ce84
[X86] Align other variants to use void * as 512 variants. (#66310)
For *_stream_* series intrinsics
2023-09-20 20:59:25 +08:00
Martin Erhart
65341b09b0
[mlir][bufferization][NFC] Move memref specific implementation of AllocationOpInterface to memref dialect directory (#66637)
Follow-up on #65578
2023-09-20 14:49:52 +02:00
Nikita Popov
e88a64f7ab [Docs] Update ExceptionHandling example (NFC)
Fix some syntax errors and use opaque pointers.
2023-09-20 14:36:52 +02:00
Timm Bäder
765b38fbf1 [clang][Interp][NFC] Small code refactoring 2023-09-20 14:33:46 +02:00
Luke Lau
450dfab8c3
[RISCV] Add tests where bin ops of splats could be scalarized. NFC (#65747)
This adds tests for fixed and scalable vectors where we have a binary op
on two splats that could be scalarized. Normally this would be
scalarized in the middle-end by VectorCombine, but as noted in
https://reviews.llvm.org/D159190, this pattern can crop up during
CodeGen afterwards.

Note that a combine already exists for this, but on RISC-V currently it
only works on scalable vectors where the element type == XLEN. See
#65068 and #65072
2023-09-20 13:23:56 +01:00
Martin Erhart
ba727ac219
[mlir][bufferization][scf] Implement BufferDeallocationOpInterface for scf.reduce.return (#66886)
This is necessary to run the new buffer deallocation pipeline as part of
the sparse compiler pipeline.
2023-09-20 14:19:13 +02:00
Nikita Popov
57a554800b [SROA] Don't shrink volatile load past end
For volatile atomic, this may result in a verifier errors, if the
new alloca type is not legal for atomic accesses.

I've opted to disable this special case for volatile accesses in
general, as changing the size of the volatile access seems
dubious in any case.

Fixes https://github.com/llvm/llvm-project/issues/64721.
2023-09-20 14:12:31 +02:00
Juan Manuel MARTINEZ CAAMAÑO
24f437f31e [NFC][AMDGPU] Remove redundant hasSideEffects=1 2023-09-20 14:02:04 +02:00
Juan Manuel MARTINEZ CAAMAÑO
356494c36e [NFC][AMDGPU] Perform a single lookup in map in SIInsertWaitcnts::isPreheaderToFlush 2023-09-20 14:02:04 +02:00
Kazushi Marukawa
4f330b7f75
[VE] Add unittest for intrinsics (#66730)
Add unittest for VE intrinsics instructions.
2023-09-20 20:56:35 +09:00
Balazs Benics
73dcbd411b
[analyzer] Fix StackAddrEscapeChecker crash on temporary object fields (#66493)
Basically, the issue was that we should have unwrapped the
base region before we special handle temp object regions.

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

I also decided to add some extra range information to the diagnostics
to make it consistent with the other reporting path.
2023-09-20 13:54:21 +02:00
Juan Manuel Martinez Caamaño
69183f8eb9
[NFC][Clang] Address reviews about overrideFunctionFeaturesWithTargetFeatures (#65938)
Addressing remarks after merge of D159257

* Add comment
* Remove irrelevant CHECKs from test
* Simplify function
* Use llvm::sort before setting target-features as it is done in
CodeGenModeule
2023-09-20 13:37:13 +02:00
Simon Pilgrim
3b7dfda79d [X86] Add test cases for gnux32 large constants Issue #55061
Test file showing current codegen for D124406
2023-09-20 12:24:51 +01:00
Simon Pilgrim
170ba6ee12 [X86] combineINSERT_SUBVECTOR - attempt to combine concatenated shuffles
If all the concatenated subvectors are targets shuffle nodes, then call combineX86ShufflesRecursively to attempt to combine them.

Unlike the existing shuffle concatenation in collectConcatOps, this isn't limited to splat cases and won't attempt to concat the source nodes prior to creating the larger shuffle node, so will usually only combine to create cross-lane shuffles.

This exposed a hidden issue in matchBinaryShuffle that wasn't limiting v64i8/v32i16 UNPACK nodes to AVX512BW targets.
2023-09-20 12:17:51 +01:00
Simon Pilgrim
0662791a13 [X86] vector-interleaved tests - add AVX512-SLOW/AVX512-FAST common prefixes to reduce duplication
These aren't always used but its lot more manageable to keep the vector-interleaved files using the same RUN lines wherever possible
2023-09-20 12:17:51 +01:00
Liqiang Tao
85ec68d69b [IR] Fix a memory leak if Function::dropAllReferences() is followed by setHungoffOperand
This patch fixes a memory leak if Function::dropAllReferences() is followed by setHungoffOperand (e.g. setPersonality)
If NumUserOperands changes from 3 to 0 before calling allocHungoffUselist() to allocate memory,
the memory leaks which are allocated when NumUserOperands is changed from 0 to 3.
e.g.
```
llvm::Function* func = ...;
func->setPersonalityFn(foo);  // (1). call allocHungoffUselist() to allocate memory for uses
func->deleteBody();  // (2). call dropAllReferences(), and it changes NumUserOperands from 3 to 0
// (3). at this point, NumUserOperands is 0, the next line will allocate memory by allocHungoffUselist()
func->setPersonalityFn(bar);  // (4). call allocHungoffUselist(), so memory allocated in (1) leaks.
```

Reviewed By: dexonsmith, MaskRay

Differential Revision: https://reviews.llvm.org/D156618
2023-09-20 19:13:28 +08:00
vabridgers
da26500aa8
[analyzer] Fix crash analyzing _BitInt() in evalIntegralCast (#66782)
evalIntegralCast was using makeIntVal, and when _BitInt() types were
introduced this exposed a crash in evalIntegralCast as a result.

This is a reapply of a previous patch that failed post merge on the arm
buildbots, because arm cannot handle large
BitInts. Pinning the triple for the testcase solves that problem. 

Improve evalIntegralCast to use makeIntVal more efficiently to avoid the
crash exposed by use of _BitInt.

This was caught with our internal randomized testing.

<src-root>/llvm/include/llvm/ADT/APInt.h:1510:
  int64_t llvm::APInt::getSExtValue() const: Assertion
  `getSignificantBits() <= 64 && "Too many bits for int64_t"' failed.a

...
 #9 <address> llvm::APInt::getSExtValue() const
  <src-root>/llvm/include/llvm/ADT/APInt.h:1510:5
  llvm::IntrusiveRefCntPtr<clang::ento::ProgramState const>,
  clang::ento::SVal, clang::QualType, clang::QualType)
  <src-root>/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:607:24
clang::Expr const*, clang::ento::ExplodedNode*,
clang::ento::ExplodedNodeSet&)
  <src-root>/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp:413:61
...

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

 Reviewed By: donat.nagy
2023-09-20 06:11:39 -05:00
Martin Erhart
522c1d0eea
[mlir][gpu][bufferization] Implement BufferDeallocationOpInterface for gpu.terminator (#66880)
This is necessary to support deallocation of IR with gpu.launch
operations because it does not implement the RegionBranchOpInterface.
Implementing the interface would require it to support regions with
unstructured control flow and produced arguments/results.
2023-09-20 12:28:28 +02:00
Brandon Wu
97ae760825
[RISCV] Add missing V extensions for zvk-invalid-features.c (#66875)
If we don't include riscv_vector.h, even we add the target-feature,
it still can't find the intrinsic interface.
2023-09-20 18:23:32 +08:00
Kiran Chandramohan
c366e61b59
[Flang][OpenMP] Move FIR lowering tests to a separate directory (#66779)
As part of preparing for the switch to HLFIR lowering, all OpenMP FIR
lowering tests are moved to a subdirectory in the OpenMP directory.
Copies of these tests that work with HLFIR will be created during this
week. After the switch the FIR lowering tests will be removed.

All new tests should be added with the HLFIR flow.
2023-09-20 11:11:07 +01:00
vabridgers
1c05651426
[clang] [C23] Fix crash with _BitInt running clang-tidy (#65889)
This crash was exposed recently in our randomized testing. _BitInts were
not being handled properly during IntegerLiteral visitation. This patch
addresses the problem for now.

The BitIntType has no getKind() method, so the FoldingSetID is taken
from the APInt value representing the _BitInt(), similar to other
methods in StmtProfile.cpp.

Crash seen (summary form):

clang-tidy: <src-root>/llvm/include/llvm/Support/Casting.h:566:
decltype(auto) llvm::cast(const From&) [with To = clang::BuiltinType;
From = clang::QualType]: Assertion `isa<To>(Val) && "cast<Ty>() argument
of incompatible type!"' failed

```
  #9 <address> decltype(auto) llvm::cast<clang::BuiltinType,
       clang::QualType>(clang::QualType const&)
       <src-root>/llvm/include/llvm/Support/Casting.h:566:3
 #10 <address> clang::BuiltinType const* clang::Type::castAs<clang::BuiltinType>() const
       <bin-root>/tools/clang/include/clang/AST/TypeNodes.inc:86:1
 #11 <address> (anonymous namespace)::StmtProfiler::VisitIntegerLiteral(
       clang::IntegerLiteral const*)
       <src-root>/clang/lib/AST/StmtProfile.cpp:1362:64
 #12 <address> clang::StmtVisitorBase<llvm::make_const_ptr,
       (anonymous namespace)::StmtProfiler, void>::Visit(clang::Stmt const*)
       <src-root>/clang/include/clang/AST/StmtNodes.inc:1225:1
```

Reviewed By: donat.nagy
2023-09-20 05:06:45 -05:00
David Spickett
3d422c4682 [lldb][API] Remove debug print in TestRunLocker.py 2023-09-20 10:01:32 +00:00
Sameer Sahasrabuddhe
ee4945329f
[LLVM] convergence verifier should visit all instructions (#66200)
The entry and loop intrinsics for convergence control cannot be preceded
by convergent operations in their respective basic blocks. To check
that, the verifier needs to reset its state at the start of the block.
This was missed in the previous commit
fa6dd7a24af2b02f236ec3b980d9407e86c2c4aa.
2023-09-20 15:31:03 +05:30