Commit Graph

475011 Commits

Author SHA1 Message Date
Matthias Springer
64839fbd45
[mlir][bufferization] Empty tensor elimination for materialize_in_destination (#65468)
This revision adds support for empty tensor elimination to
"bufferization.materialize_in_destination" by implementing the
`SubsetInsertionOpInterface`.

Furthermore, the One-Shot Bufferize conflict detection is improved for
"bufferization.materialize_in_destination".
2023-09-18 15:34:28 +02:00
Yingwei Zheng
be2723da5c
[InstSimplify] Fold icmp of X and/or C1 and X and/or C2 into constant (#65905)
This patch simplifies the pattern `icmp X and/or C1, X and/or C2` when
one constant mask is the subset of the other.
If `C1 & C2 == C1`, `A = X and/or C1`, `B = X and/or C2`, we can do the
following folds:
`icmp ule A, B -> true`
`icmp ugt A, B -> false`
We can apply similar folds for signed predicates when `C1` and `C2` are
the same sign:
`icmp sle A, B -> true`
`icmp sgt A, B -> false`

Alive2: https://alive2.llvm.org/ce/z/Q4ekP5
Fixes #65833.
2023-09-18 21:32:48 +08:00
Sergio Afonso
fb4bdf361f
[Flang][OpenMP] Run Flang-specific OpenMP MLIR passes in bbc
This patch moves the group of OpenMP MLIR passes using after lowering of
Fortran to MLIR into a pipeline to be shared by `flang-new` and `bbc`.
Currently, the `bbc` tool does not produce the expected FIR for offloading-
enabled OpenMP codes due to not running these passes.

Unit tests exercising these passes are updated to check `bbc` output as well.
2023-09-18 14:10:04 +01:00
Nicolas Vasilache
bf7c490ab7
[mlir][Vector] Add a rewrite pattern for better low-precision bitcast… (#66387)
…(trunci) expansion

This revision adds a rewrite for sequences of vector `bitcast(trunci)`
to use a more efficient sequence of vector operations comprising
`shuffle` and `bitwise` ops.

Such patterns appear naturally when writing quantization /
dequantization functionality with the vector dialect.

The rewrite performs a simple enumeration of each of the bits in the
result vector and determines its provenance in the pre-trunci vector.
The enumeration is used to generate the proper sequence of `shuffle`,
`andi`, `ori` followed by an optional final `trunci`/`extui`.

The rewrite currently only applies to 1-D non-scalable vectors and bails
out if the final vector element type is not a multiple of 8. This is a
failsafe heuristic determined empirically: if the resulting type is not
an even number of bytes, further complexities arise that are not
improved by this pattern: the heavy lifting still needs to be done by
LLVM.
2023-09-18 15:08:18 +02:00
Joseph Huber
b8f64431ea
[libc] Add GPU config file using the new format (#66635)
Summary:
This patch copies a config file for the GPU similar to the
baremetal/embedded implementation. This will configure the
implementations of functions like `sprintf` and `snprintf` to be
compiled into more simple versions that can be run on the GPU. These
functions cannot be enabled yet as Vararg support hasn't landed, but it
will be used then.
2023-09-18 08:06:59 -05:00
jeanPerier
99a54b839a
[flang] Lower PRIVATE component names safely (#66076)
It is possible for a derived type extending a type with private
components to define components with the same name as the private
components.

This was not properly handled by lowering where several fir.record type
component names could end-up being the same, leading to bad generated
code (only the first component was accessed via fir.field_index, leading
to bad generated code).

This patch handles the situation by adding the derived type mangled name
to private component.
2023-09-18 14:59:56 +02:00
Nikita Popov
4491f0b969 [IR] Remove unnecessary bitcast from CreateMalloc()
This bitcast is no longer necessary with opaque pointers. This
results in some annoying variable name changes in tests.
2023-09-18 14:58:16 +02:00
Paul Walker
162bafc8b7 [SVE] Fix crash when costing getelementptr with scalable target type.
Fixes #66594
2023-09-18 12:48:30 +00:00
Fabio D'Urso
b3ca0f34cf [scudo] Use MemMap in Vector
Reviewed By: Chia-hungDuan

Differential Revision: https://reviews.llvm.org/D159449
2023-09-18 14:47:39 +02:00
Daniel Cheng
078651b6de
[libc++] Implement LWG3545: std::pointer_traits should be SFINAE-friendly. (#65177)
See https://wg21.link/LWG3545 for background and details.

Differential Revision: https://reviews.llvm.org/D158922
2023-09-18 08:46:59 -04:00
Kohei Asano
baf031a853
[MemCpyOpt] fix miscompile for non-dominated use of src alloca for stack-move optimization (#66618)
Stack-move optimization, the optimization that merges src and dest
alloca of the full-size copy, replaces all uses of the dest alloca with
src alloca. For safety, we needed to check all uses of the dest alloca
locations are dominated by src alloca, to be replaced. This PR adds the
check for that.

Fixes #65225
2023-09-18 21:29:10 +09:00
David Spickett
1a8b36b16c [lldb][Docs] Link up the newly restored data formatters page
In the place it used to be linked from.
2023-09-18 13:20:42 +01:00
Sinan Lin
7b4b09a59a [Bolt] fix a relocation bug for R_AARCH64_CALL26
If the R_AARCH64_CALL26 against a symbol that has a lower address, then
encodeValueAArch64 will return a wrong value.

Reviewed By: Kepontry, yota9

Differential Revision: https://reviews.llvm.org/D159513
2023-09-18 19:55:35 +08:00
Sergei Barannikov
caaf61eb6e
[SDag] Fold saddo[_carry] with bitwise-not argument to ssubo[_carry] (#66571)
Fold `(saddo (not a), 1)` to `(ssubo 0, a)` and
`(saddo_carry (not a), b, c)` to `(ssubo_carry b, a, !c)`.

Proof: https://alive2.llvm.org/ce/z/Lj49YM

This is the same as https://reviews.llvm.org/D46505 and
https://reviews.llvm.org/D59208, but for signed opcodes.
2023-09-18 14:45:41 +03:00
Jay Foad
102838d3f6
update_mir_test_checks.py: match undef vreg subreg definitions (#66627)
Following on from D139466 which added support for dead vreg defs, this
patch adds support for "undef" defs of subregs.

Use this to regenerate checks for amx-greedy-ra-spill-shape.ll which
previously required manual tweaks to the autogenerated checks to fix an
EXPENSIVE_CHECKS failure; see commit
8b7c1fbd96
2023-09-18 12:14:46 +01:00
Matthias Springer
08d2ea372f
[mlir][Interfaces][NFC] LoopLikeOpInterface: Consistent TD formatting (#66097)
Format the interface methods consistently in the TableGen file. Also
mention more details about this interface in the description.
2023-09-18 12:45:33 +02:00
Martin Erhart
1a4dd8d362
[mlir][bufferization] Switch tests to new deallocation pass pipeline (#66517)
Use the new ownership based deallocation pass pipeline in the regression
and integration tests. Some one-shot bufferization tests tested one-shot
bufferize and deallocation at the same time. I removed the deallocation
pass there because the deallocation pass is already thoroughly tested by
itself.

Fixed version of #66471
2023-09-18 12:00:27 +02:00
Sugar Noodle
7a472a0473
[llvm][documentation] Fix coroutines documentation (#66420)
Co-authored-by: NoodleSugar <noodle@Noodle-PC.localdomain>
Co-authored-by: Chuanqi Xu <yedeng.yd@linux.alibaba.com>
2023-09-18 17:44:30 +08:00
Takuya Shimizu
b2cd9db589 [clang][Sema] Remove irrelevant diagnostics from constraint satisfaction failure
BEFORE this patch, when clang handles constraints like C1 || C2 where C1 evaluates to false and C2 evaluates to true, it emitted irrelevant diagnostics about the falsity of C1.
This patch removes the irrelevant diagnostic information generated during the evaluation of C1 if C2 evaluates to true.

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

Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D157526
2023-09-18 18:14:44 +09:00
Nikita Popov
dd55ece638 [ValueTracking] Remove unused Depth parameter (NFC)
Clarify that the Depth is always 0 in this function for a future
change.
2023-09-18 11:12:12 +02:00
Timm Bäder
52a55a7178 [clang][Interp] Allow zero-init of primitives with an empty init list
Differential Revision: https://reviews.llvm.org/D158595
2023-09-18 11:09:30 +02:00
David Stuttard
ce031fc17a
[AMDGPU] Fix non-deterministic iteration order in SIFixSGPRCopies (#66617)
Use of DenseSet was causing some non-deteminism in SIFixSGPRSopies. Changing
to SetVector fixes the problem.
2023-09-18 10:08:53 +01:00
Kinuko Yasuda
03be486ecc
[clang][dataflow] Model the fields that are accessed via inline accessors (#66368)
So that the values that are accessed via such accessors can be analyzed
as a limited version of context-sensitive analysis. We can potentially
do this only when some option is set, but doing additional modeling like
this won't be expensive and intrusive, so we do it by default for now.
2023-09-18 10:46:36 +02:00
Clement Courbet
75b76c4b47
[clang-transformer] Allow stencils to read from system headers. (#66480)
We were previously checking that stencil input ranges were writable. It
suffices for them to be readable.
2023-09-18 10:07:30 +02:00
Matthias Springer
0f952cfe24
[mlir][IR] Change MutableOperandRange::operator[] to return an OpOperand & (#66515)
`operator[]` returns `OpOperand &` instead of `Value`.

* This allows users to get OpOperands by name instead of "magic" number.
E.g., `extractSliceOp->getOpOperand(0)` can be written as
`extractSliceOp.getSourceMutable()[0]`.
* `OperandRange` provides a read-only API to operands: `operator[]`
returns `Value`. `MutableOperandRange` now provides a mutable API:
`operator[]` returns `OpOperand &`, which can be used to set operands.

Note: The TableGen code generator could be changed to return `OpOperand
&` (instead of `MutableOperandRange`) for non-variadic and non-optional
arguments in a subsequent change. Then the `[0]` part in the above
example would no longer be necessary.
2023-09-18 09:43:03 +02:00
Yeting Kuo
9ea083f2d4
[Clang][test] Replace legacy -target with --target=. (#66572) 2023-09-18 15:35:57 +08:00
Piyou Chen
b83a1ed594 [RISCV] Only emit .option when extension is supported
It maybe emit the .option directive without any follow up. Only emit the .option push/pop when there are supported extension difference between function and module.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D159399
2023-09-18 00:30:13 -07:00
Piyou Chen
d861b3183c [RISCV][NFC] precommit for D159399
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D159400
2023-09-18 00:18:08 -07:00
Matthias Springer
5cf714bb2f
[mlir][SCF] scf.for: Consistent API around initArgs (#66512)
* Always use the auto-generated `getInitArgs` function. Remove the
hand-written `getInitOperands` duplicate.
* Remove `hasIterOperands` and `getNumIterOperands`. The names were
inconsistent because the "arg" is called `initArgs` in TableGen. Use
`getInitArgs().size()` instead.
* Fix verification around ops with no results.
2023-09-18 09:13:43 +02:00
Ben Shi
87143ff9f2 [VectorCombine] Fix a spot in commit 068357d9b0
My previous commit leads to a crash in "Builders/sanitizer-x86_64-linux-fast"
as https://lab.llvm.org/buildbot/#/builders/5/builds/36746. And this patch
fixes it.
2023-09-18 15:01:47 +08:00
Haojian Wu
5eabbde6d9 [bazel] Port for 88e3358f33 2023-09-18 08:58:07 +02:00
jeanPerier
79508db494
[flang][runtime] zero size allocation in source allocation (#66124)
Source allocation with a zero sized array is legal, and the resulting
allocatable/pointer should be allocated/associated.

The current code skipped the actual allocation, leading the allocatable
or pointer to look unallocated/disassociated.
2023-09-18 08:51:07 +02:00
Dudeldu
ed8bd7176d
[MLIR] Allow comparison of opaque properties (#66378)
Add capabilities for comparing opaque properties. This is useful when
dealing with arbitrary operations which can be compare based on their
OperationName. Now you can furthermore compare their properties without
the need to determine their actual type.
2023-09-17 23:46:31 -07:00
Nikita Popov
efe4e7a026
[SCEV] Fix incorrect nsw inference for multiply of addrec (#66500)
SCEV currently preserves the nsw flag when performing an nsw multiply of
an nsw addrec. While this is legal for nuw, this is not generally the
case for nsw.

This is because nsw mul does not distribute over nsw add:
https://alive2.llvm.org/ce/z/mergCt

Instead, we need either both nuw and nsw to be set
(https://alive2.llvm.org/ce/z/7wpgGc) or explicitly prove that the
distributed multiplications are also nsw
(https://alive2.llvm.org/ce/z/wef9su).

Fixes https://github.com/llvm/llvm-project/issues/66066.
2023-09-18 08:23:10 +02:00
Jie Fu
54a38c9c9c [ORC] Fix -Wunused-but-set-variable in JITLoaderPerf.cpp (NFC)
/data/llvm-project/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp:118:10: error: variable 'Written' set but not used [-Werror,-Wunused-but-set-variable]
  size_t Written = 0;
         ^
1 error generated.
2023-09-18 13:06:16 +08:00
LLVM GN Syncbot
b8fbc3c01c [gn build] Port 88e3358f33 2023-09-18 04:11:08 +00:00
Prem Chintalapudi
88e3358f33 [ORC][JITLink] Non-debuginfo JITLink perf jitdump support.
This patch ports PerfJITEventListener to a JITLink plugin, but adds unwind
record support and drops debuginfo support temporarily. Debuginfo can be
enabled in the future by providing a way to obtain a DWARFContext from a
LinkGraph.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D146169
2023-09-18 04:10:29 +00:00
wangpc
cedf2ea7b5 [RISCV] Teach RISCVMergeBaseOffset to handle BlockAddress
We can get `BlockAddress` in user code via `Labels as Values` so
we should be able to merge the access to `BlockAddress`.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D159429
2023-09-18 11:47:14 +08:00
wangpc
28efe4d38e [RISCV] Add tests for merging base offset of BlockAddress
We can get `BlockAddress` in user code via `Labels as Values`.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D159428
2023-09-18 11:47:13 +08:00
Ben Shi
068357d9b0
[VectorCombine] Enable transform 'scalarizeLoadExtract' for scalable vector types (#65443)
The transform 'scalarizeLoadExtract' can be applied to scalable
vector types if the index is less than the minimum number of elements.

The check whether the index is less than the minimum number of elements
locates at line 1175~1180. 'scalarizeLoadExtract' will call
'canScalarizeAccess' and check the returned result if this transform is safe.

At the beginning of the function 'canScalarizeAccess', the index will be
checked
1. If it is less than the number of elements of a fixed vector type.
2. If it is less than the minimum number of elements of a scalable vector type.

Otherwise 'canScalarizeAccess' will return unsafe and this transform
will be prevented.
2023-09-18 10:49:18 +08:00
Fangrui Song
b4d4146db3 [WholeProgramDevirt] Use llvm:: qualifier to implement declared functions. NFC 2023-09-17 19:31:42 -07:00
Kai Luo
7d9039e11d [JITLink][PowerPC][RFC] Make JITLink default in LLJIT for ppc64 elfv2abi
JITLink for ppc64 has implemented all relocations implemented in rtdyld for ppc64 and has passed all existed lit tests and unittests in llvm/clang/compiler-rt. I propose making JITLink for ppc64 default in LLJIT.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D159175
2023-09-18 02:18:23 +00:00
vabridgers
4b5366c951
[clang-tidy] Avoid checking magic numbers if _BitInt (#65888)
Recent changes to add _BitInt support have caused our internal random
testing to fail. This change just avoids a readability magic numbers
check for now if a _BitInt. The crash seen (edited for clarity) is shown
below.

<src-root>/llvm/include/llvm/ADT/APInt.h:1488:
  uint64_t llvm::APInt::getZExtValue() const: Assertion `getActiveBits()
  <= 64 && "Too many bits for uint64_t"' failed.

...
 #9 <address> llvm::APInt::getZExtValue() const
      <src-root>/llvm/include/llvm/ADT/APInt.h:1488:5
      clang::IntegerLiteral const*) const

<src-root>/clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp:198:47
<clang::IntegerLiteral>(clang::ast_matchers::MatchFinder::MatchResult
      const&, char const*)

<src-root>/clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.h:67:5
      clang::ast_matchers::MatchFinder::MatchResult const&)

<src-root>/clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp:152:35
...

Reviewed By: donat.nagy
2023-09-17 14:00:57 -05:00
Craig Topper
e6a007f6b5 [RISCV] Use getConstantOperandVal. NFC 2023-09-17 10:53:50 -07:00
Craig Topper
d76e96b627 [RISCV] Reuse existing XLenVT variable. NFC 2023-09-17 10:46:53 -07:00
Yingwei Zheng
1679b20cd0
[InstCombine] Fix transforms of two select patterns (#65845)
This patch fixes transforms of `select (~a | c), a, b` and `select (c &
b), a, b` as discussed in [D158983](https://reviews.llvm.org/D158983).
Alive2: https://alive2.llvm.org/ce/z/ft6TDw
2023-09-18 01:28:37 +08:00
Yingwei Zheng
a054d89cd4
[InstSimplify] Add signed version of pre-commit tests for PR65905. NFC. 2023-09-17 22:36:01 +08:00
Bharathi Ramana Joshi
ccf194b845
[MLIR][Presburger] Implement convertVarKind for PresburgerRelation 2023-09-17 20:02:16 +05:30
Yingwei Zheng
2f45b56728
[InstSimplify] Add pre-commit tests for PR65905. NFC. 2023-09-17 20:40:19 +08:00
Christian Sigg
1c8c365de2
[mlir][bytecode] Check that bytecode source buffer is sufficiently aligned. (#66380)
Before this change, the `ByteCode` test failed on CentOS 7 with
devtoolset-9, because strings happen to be only 8 byte aligned. In
general though, strings have no alignment guarantee.

Increase resource alignment in test to 32 bytes. 
Adjust test to sufficiently align buffer.
Add test to check error when buffer is insufficiently aligned.
2023-09-17 13:46:01 +02:00