Simon Pilgrim [Sun, 23 Apr 2023 10:48:50 +0000 (11:48 +0100)]
[X86] X86FixupInstTunings - add VPERMILPDri -> VSHUFPDrri mapping
Similar to the original VPERMILPSri -> VSHUFPSrri mapping added in D143787, replacing VPERMILPDri -> VSHUFPDrri should never be any slower and saves an encoding byte.
The sibling VPERMILPDmi -> VPSHUFDmi mapping is trickier as we need the same shuffle mask in every lane (and it needs to be adjusted) - I haven't attempted that yet but we can investigate it in the future if there's interest.
Fixes #61060
Differential Revision: https://reviews.llvm.org/D148999
Lang Hames [Fri, 21 Apr 2023 04:45:46 +0000 (04:45 +0000)]
Re-apply "[ORC][LLJIT] Use JITLink by default on ELF/x86-64." with fixes.
This reapplies
85c649bc02a, which was reverted in
35767e43d62 due to failures
with some example programs. The fix was to add export_executable_symbols to the
example programs.
Simon Pilgrim [Sun, 23 Apr 2023 09:32:04 +0000 (10:32 +0100)]
[X86] X86FixupInstTuning.cpp - fix comment in ProcessVPERMILPSri. NFC.
PERMILPS is only available on AVX or later (VEX/EVEX encoding)
Luo, Yuanke [Sun, 23 Apr 2023 04:49:29 +0000 (12:49 +0800)]
[X86] Precommit test case for D148980.
Craig Topper [Sun, 23 Apr 2023 07:44:39 +0000 (00:44 -0700)]
[TableGen] Remove unused method form ScopeMatcher. NFC
Akshay Khadse [Sun, 23 Apr 2023 07:28:59 +0000 (15:28 +0800)]
[Coverity] Fix uninitialized scalar members in MC
This change fixes static code analysis errors
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D148814
Noah Goldstein [Sun, 23 Apr 2023 06:57:55 +0000 (01:57 -0500)]
[X86] Transform `(cmp eq/ne trunc(X), C)` -> `(cmp eq/ne X, Zext(C))`
This previously existed for `C == 0`, but is mostly beneficial for any
`C`.
There is a slight codesize cost as we get more imm32 (as opposed to
imm8) constants in some cases. But the benefit is was get less imm16
constants (LCP stalls) and save instructions in some vec -> scalar
codegen.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D148594
Serge Pavlov [Sun, 23 Apr 2023 06:35:35 +0000 (06:35 +0000)]
[symbolizer] Change error message if module not found (recommit)
This is a recommit of
75f1f158812d, reverted in
7a443b1c493d, because
it caused compilation error in
compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp.
The error was fixed by Kasimir Georgiev in
de4c038c7ba2, but this
commit was reverted in
de088dd3a0aa, because the initial commit was
reverted.
This commit reverts both the reverting commits,
7a443b1c493d and
de088dd3a0aa.
Original commit message is below.
If llvm-symbolize did not find module, the error looked like:
LLVMSymbolizer: error reading file: No such file or directory
This message does not follow common practice: LLVMSymbolizer is not an
utility name. Also the message did not not contain the name of missed file.
With this change the error message looks differently:
llvm-symbolizer: error: 'abc': No such file or directory
This format is closer to messages produced by other utilities and allow
proper coloring.
Differential Revision: https://reviews.llvm.org/D148032
Craig Topper [Sun, 23 Apr 2023 05:37:57 +0000 (22:37 -0700)]
[TableGen] Intialize vector with constructor instead of assign. NFC
Akshay Khadse [Sun, 23 Apr 2023 04:06:54 +0000 (12:06 +0800)]
[Coverity] Fix explicit null dereferences
This change fixes static code analysis errors
Reviewed By: skan
Differential Revision: https://reviews.llvm.org/D148912
Craig Topper [Sun, 23 Apr 2023 04:04:55 +0000 (21:04 -0700)]
[TableGen] Re-work FactorNodes to avoid an extra temporary vector.
Instead of copying elements to the NewOptionsToMatchVector, we
now shift down elements in OptionsToMatch as we create holes by
pulling out equal matchers. After we finish processing the vector,
we'll trim the size to just the elements that are still in use.
Jianjian GUAN [Fri, 21 Apr 2023 02:27:17 +0000 (10:27 +0800)]
[Driver][NFC] Simplify code.
Reviewed By: benshi001, jhuber6
Differential Revision: https://reviews.llvm.org/D148908
NAKAMURA Takumi [Wed, 19 Apr 2023 14:27:20 +0000 (23:27 +0900)]
[Bazel] Rename LLVMTableGenGlobalISel to TableGenGlobalISel
NAKAMURA Takumi [Sun, 23 Apr 2023 01:26:26 +0000 (10:26 +0900)]
[CMake] Target/DirectX: Update deps
NAKAMURA Takumi [Sun, 23 Apr 2023 02:07:22 +0000 (11:07 +0900)]
[CMake] Reorder deps and reformat
Shilei Tian [Sun, 23 Apr 2023 00:56:35 +0000 (20:56 -0400)]
Revert "[OpenMP] Introduce kernel environment"
This reverts commit
35cfadfbe2decd9633560b3046fa6c17523b2fa9.
It makes a couple of buildbots unhappy because of the following test failures:
- `Transforms/OpenMP/add_attributes.ll'`
- `mapping/declare_mapper_target_data.cpp` on AMDGPU
Shilei Tian [Sun, 23 Apr 2023 00:45:00 +0000 (20:45 -0400)]
[OpenMP] Introduce kernel environment
This patch introduces per kernel environment. Previously, flags such as execution mode are set through global variables with name like `__kernel_name_exec_mode`. They are accessible on the host by reading the corresponding global variable, but not from the device. Besides, some assumptions, such as no nested parallelism, are not per kernel basis, preventing us applying per kernel optimization in the device runtime.
This is a combination and refinement of patch series D116908, D116909, and D116910.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D142569
Martin Storsjö [Fri, 14 Apr 2023 09:26:14 +0000 (09:26 +0000)]
[compiler-rt] [test] [asan] Skip the static asan testsuites on mingw targets
Mingw only provides a dynamically linked CRT (contrary to
MSVC/clang-cl), so it is expected that the static asan test
configuration doesn't work.
Skip adding these test suites in mingw configurations.
Differential Revision: https://reviews.llvm.org/D148319
Martin Storsjö [Tue, 18 Apr 2023 12:42:35 +0000 (15:42 +0300)]
[libunwind] [SEH] Clear DISPATCHER_CONTEXT when initializing a cursor
We only initialize a few fields in DISPATCHER_CONTEXT - don't leave
the rest in an uninitialized state; make sure the whole struct is
in a deterministic state.
This makes nondeterministic failures deterministic, for some cases
relating to forced unwinding on aarch64/arm (which requires filling
in parsing of the xdata for finding the exception handler and LSDA).
Differential Revision: https://reviews.llvm.org/D148660
Ian Douglas Scott [Sat, 22 Apr 2023 19:01:28 +0000 (12:01 -0700)]
[M68k] Override `CanLowerReturn` to fix assertion with large return
If it couldn't fit the return value in two registers, this caused an
error during codegen. It seems this method is implemented in other
backends but not here, and allows it to pass return values in memory
when it isn't able to do so in registers.
Seems to fix compilation of Rust code with certain return types:
https://github.com/rust-lang/rust/issues/89498
Differential Revision: https://reviews.llvm.org/D148856
Simon Pilgrim [Sat, 22 Apr 2023 19:02:27 +0000 (20:02 +0100)]
[X86] Fold PSHUF(VSHIFT(X,Y)) -> VSHIFT(PSHUF(X),Y)
PSHUFD/PSHUFLW/PSHUFHW can act as a vector move / folded load, notably helping simplify pre-AVX cases in particular.
This is a much milder alternative to refactoring canonicalizeShuffleWithBinOps to support SSE shifts nodes.
Ian Anderson [Sat, 15 Apr 2023 00:51:41 +0000 (17:51 -0700)]
[libc++] Remove the chrono include from algorithm
algorithm's include of chrono causes include cycles:
```
algorithm -> chrono -> __chrono/convert_to_tm.h -> __chrono/statically_widen.h -> __format/concepts.h -> __format/format_parse_context.h -> string_view -> algorithm
algorithm -> chrono -> __chrono/convert_to_tm.h -> __chrono/statically_widen.h -> __format/concepts.h -> __format/format_parse_context.h -> string_view -> functional -> __functional/boyer_moore_searcher.h -> array -> algorithm
algorithm -> chrono -> __chrono/convert_to_tm.h -> __chrono/statically_widen.h -> __format/concepts.h -> __format/format_parse_context.h -> string_view -> functional -> __functional/boyer_moore_searcher.h -> unordered_map -> algorithm
algorithm -> chrono -> __chrono/convert_to_tm.h -> __chrono/statically_widen.h -> __format/concepts.h -> __format/format_parse_context.h -> string_view -> functional -> __functional/boyer_moore_searcher.h -> vector -> algorithm
```
This is a problem for clang modules after the std mega module is broken up, because it becomes a module cycle which is a hard error.
All of the includes in the `__chrono` and `__format` headers are being used and so can't be removed. algorithm's include of chrono is already removed in C++20, whereas the array, string_view, unordered_map, vector includes of algorithm aren't removed until C++23 (and it's 4x the includes that would need removing). Unconditionally remove the chrono include from algorithm in all versions, so that the module breakup can happen (the module has to apply to all C++ versions).
Reviewed By: Mordante, #libc
Differential Revision: https://reviews.llvm.org/D148405
Simon Pilgrim [Sat, 22 Apr 2023 16:49:51 +0000 (17:49 +0100)]
[X86] Add PERMILPD tuning test coverage for Issue #61060
Simon Pilgrim [Sat, 22 Apr 2023 16:00:35 +0000 (17:00 +0100)]
[X86] combineSetCCMOVMSK - fold allof movmskps/movmskpd -> testps/testpd
Fixes #60007
Simon Pilgrim [Sat, 22 Apr 2023 14:27:40 +0000 (15:27 +0100)]
[X86] LowerBUILD_VECTOR - narrow 256/512-bit vector containing undef/freeze(undef)/zero in the upper half
Fixes #62286
Simon Pilgrim [Sat, 22 Apr 2023 13:54:27 +0000 (14:54 +0100)]
[X86] LowerBUILD_VECTOR - fold build_vector(undef,freeze(undef)) -> freeze(undef)
Noticed while triaging #62286
Ramiro Leal-Cavazos [Sat, 22 Apr 2023 14:15:26 +0000 (07:15 -0700)]
Revert "Revert "Fix handling of special and large vals in expand pattern for `round`" and "Add pattern that expands `math.roundeven` into `math.round` + arith""
This reverts commit
87cef78fa1c7bf6efc544e990894a6062d56abec.
The issue in the original revert is that a lit test expecting a `-nan`
as an output was failing on M2. Since the IEEE 754-2008 standard does
not require the sign to be printed when displaying a `nan`, this
commit changes the `CHECK` for `-nan` to one that checks the result
value bitcasted to an `i32` to ensure that input is being left
unchanged. This check should now be independent of platform being used
to run test.
Reviewed By: jpienaar, mehdi_amini
Differential Revision: https://reviews.llvm.org/D148941
Luo, Yuanke [Sat, 22 Apr 2023 12:02:14 +0000 (20:02 +0800)]
[X86] Precommit test case for D148980.
There is no cross-loop dependency for this case.
Haojian Wu [Sat, 22 Apr 2023 11:59:45 +0000 (13:59 +0200)]
LLVM GN Syncbot [Sat, 22 Apr 2023 10:56:47 +0000 (10:56 +0000)]
[gn build] Port
cd893308b5d4
Piotr Zegar [Sat, 22 Apr 2023 10:54:51 +0000 (10:54 +0000)]
[clang-tidy][NFC] Fix documentation for performance-avoid-endl
Added missing new line after code block markup and before code.
AMS21 [Sat, 22 Apr 2023 10:50:42 +0000 (10:50 +0000)]
[clang-tidy] Add `performance-avoid-endl` check
This check flags uses of `std::endl` on streams and suggests using the newline character `'\n'` instead. `std::endl` performs two operations: it writes a newline character to the output stream and then flushes the stream buffer, which can be less efficient than writing a single newline character using `'\n'`.
This fixes llvm#35321
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D148318
Mark de Wever [Fri, 15 Jul 2022 06:21:19 +0000 (08:21 +0200)]
[libc++][regex] Uses operator<=> in sub_match.
The removal of operator!= in this header will be done in a separate
commit.
Note in the synopsis of P1614R2 there is a constexpr
template<class BiIter>
constexpr auto operator<=>(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
In the implementation of P1614R2 there isn't a constexpr
template<class BiIter>
auto operator<=>(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
There doesn't seem to be an LWG-issue, but it was fixed in the Standard
by removing the constexpr in
b050fd474f11441942c88ef69b8622c8036656ac.
Implements part of:
- P1614R2 The Mothership has Landed
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D132310
Akash Banerjee [Sat, 22 Apr 2023 09:50:35 +0000 (10:50 +0100)]
Fix use of unitialized variable 'mapperFunc' to prevent unexpected behaviour.
Luo, Yuanke [Sat, 22 Apr 2023 07:39:00 +0000 (15:39 +0800)]
[X86] Precommit test case for D148980.
Rishabh Bali [Sat, 22 Apr 2023 06:29:17 +0000 (08:29 +0200)]
[mlir] Fix i8/f32 confusion in comment
Fixes https://github.com/llvm/llvm-project/issues/62275
Differential Revision: https://reviews.llvm.org/D148952
Timm Bäder [Fri, 21 Apr 2023 06:20:51 +0000 (08:20 +0200)]
[clang][Sema][NFC] Add const where appropriate
Slava Zakharin [Sat, 22 Apr 2023 06:03:33 +0000 (23:03 -0700)]
Revert "[OpenMP] Additional APIs used by the MSVC compiler for loop collapse"
This reverts commit
7aa815fc782c5e39aefeec10d9c7c4cea7231975.
Buildbots are failing, e.g.:
https://lab.llvm.org/buildbot/#/builders/84/builds/36964
https://lab.llvm.org/buildbot/#/builders/193/builds/30096
Mehdi Amini [Mon, 6 Feb 2023 05:11:30 +0000 (21:11 -0800)]
Add a breakpoint manager that matches based on File/Line/Col Locations
This will match the locations attached to the IRunits passed in as context
with an action.
This is a recommit of
d09c80515d0e after fixing the test on Windows.
Differential Revision: https://reviews.llvm.org/D144815
Aviad Cohen [Mon, 17 Apr 2023 06:44:06 +0000 (09:44 +0300)]
[mlir] tosa.reshape - Add InferTensorType interface
When this interface is used, a call to inferReturnTypeComponents()
is generated on creation and verification of the op.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D148498
Mehdi Amini [Sat, 22 Apr 2023 05:24:05 +0000 (23:24 -0600)]
Revert "Add a breakpoint manager that matches based on File/Line/Col Locations"
This reverts commit
d09c80515d0e7b1f1a81d3f18a3e799565f5e969.
This is broken on Windows
luxufan [Wed, 19 Apr 2023 11:57:27 +0000 (19:57 +0800)]
[LVI][CVP] Don't compute CR at SelectInst Use if Cond value may not be well-defined
If the condition value of SelectInst may be a poison or undef value,
infer constant range at SelectInst use is in correct.
See https://alive2.llvm.org/ce/z/MWMTYn
Fixes: https://github.com/llvm/llvm-project/issues/62200
Differential Revision: https://reviews.llvm.org/D148709
Mehdi Amini [Mon, 6 Feb 2023 05:11:30 +0000 (21:11 -0800)]
Add a breakpoint manager that matches based on File/Line/Col Locations
This will match the locations attached to the IRunits passed in as context
with an action.
Differential Revision: https://reviews.llvm.org/D144815
Kai Sasaki [Sat, 22 Apr 2023 03:39:50 +0000 (12:39 +0900)]
[mlir] Check FunctionOpInterface castable type
As convertFuncOpTypes does not support other FuncOpInterface types, we should check the type to avoid assertion failure. The original issue was reported https://github.com/llvm/llvm-project/issues/61858.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D148873
Aaron Siddhartha Mondal [Sat, 22 Apr 2023 02:54:49 +0000 (04:54 +0200)]
[bazel] Update Bazel version to 6.1.2.
Reviewed By: #bazel_build, MaskRay, akuegel, rupprecht
Differential Revision: https://reviews.llvm.org/D148862
Teresa Johnson [Fri, 21 Apr 2023 21:49:35 +0000 (14:49 -0700)]
Restore "[MemProf] Context disambiguation cloning pass [patch 2/3]"
This restores
d0649a6ad8be778abf7569f502148d577f8bc6f1 (reverted in
commit
03bf59d275a16815dc5a2e3f279815554f7cd0ca), with fixes for bot
failures. Confirmed that gcc, which reproduced both failures, now
builds it fine.
Differential Revision: https://reviews.llvm.org/D140949
Joseph Huber [Sat, 22 Apr 2023 01:02:26 +0000 (20:02 -0500)]
[libc] Do not include the RPC targets if we're not in GPU mode.
Summary:
The RPC targets assume a GPU environment. Theoretically we can build
this in all cases, but it is unused in any other target so it shouldn't
be listed.
Natalia Glagoleva [Sat, 22 Apr 2023 00:47:00 +0000 (17:47 -0700)]
[OpenMP] Additional APIs used by the MSVC compiler for loop collapse
(rectangular and non-rectangular loops)
Submitting on behalf of Natalia Glagoleva <natgla@microsoft.com>
Differential Revision: https://reviews.llvm.org/D148393
Craig Topper [Sat, 22 Apr 2023 00:27:06 +0000 (17:27 -0700)]
[TableGen] Early exit from ExpandHwModeBasedTypes when there are no HwModes.
Most targets don't use HwModes. For these targets we can skip
collecting the HwModes and copying all the pattern pointers.
Raman Tenneti [Sat, 22 Apr 2023 00:02:04 +0000 (17:02 -0700)]
[libc] [NFC] Fixed comments formatting style.
Fixed comments formatting style.
Reviewed By: rtenneti
Differential Revision: https://reviews.llvm.org/D148973
Craig Topper [Sat, 22 Apr 2023 00:09:44 +0000 (17:09 -0700)]
[TableGen] Remove some unnecessary TreePatternNodePtrs. NFC
The patterns we're referring are still owned by the PatternToMatch
object. We don't need to increment their reference count here.
Jacek Caban [Fri, 21 Apr 2023 23:47:55 +0000 (23:47 +0000)]
[Object] Always initialized StartOfFile in Archive::Child::Child constructor.
Fixes uninitialized memory access revealed by https://reviews.llvm.org/D146534.
In empty archives, we use Child(nullptr,nullptr,nullptr) in Archive constructor in setFirstRegular. This copies unitialized StartOfFile to FirstRegularStartOfFile, which child_begin may use later.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D148955
Peter Rong [Fri, 21 Apr 2023 23:35:45 +0000 (16:35 -0700)]
[FuzzMutate] Correct type cast and add unit test for FCmp
This revision fixes an incorrect type cast from Instruction to ICmpInstr, which should have been to FCmpInstr instead. It turns out that StrategiesTest.cpp was missing a test case for InstModificationIRStrategy and FCmp, which is also now implemented in this revision. After this revision, [[ https://reviews.llvm.org/D148854 | llvm-stress in D148854 ]] no longer crashes randomly.
Reviewed By: Peter
Differential Revision: https://reviews.llvm.org/D148972
Aart Bik [Fri, 21 Apr 2023 21:40:31 +0000 (14:40 -0700)]
[mlir][sparse] avoid slice rewriting when conditions are not met
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D148964
Nitin John Raj [Wed, 19 Apr 2023 23:08:55 +0000 (16:08 -0700)]
[RISCV] Pass data EEW instead of index EEW to V*Sched for indexed loads and stores
Differential Revision: https://reviews.llvm.org/D148766
Nitin John Raj [Wed, 19 Apr 2023 23:28:29 +0000 (16:28 -0700)]
[RISCV] Rename some variables to improve code clarity
Nick Desaulniers [Fri, 21 Apr 2023 22:51:29 +0000 (15:51 -0700)]
[Demangle] replace std::string_view::substr which may throw
llvm/Demangle copies the implementation from libcxxabi/src/demangle/.
libcxxabi/ cannot use potentially-throwing std::string_view::substr, so
change llvm/Demangle to avoid these function calls.
I ran into linkage failures stemming from the usage of
std::string_view::substr. substr does a bounds check and may throw.
Fixes:
f198e0b594aa ("[StringView] remove dropFront")
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D148959
Nick Desaulniers [Fri, 21 Apr 2023 22:26:51 +0000 (15:26 -0700)]
[Demangle] remove unused params of microsoftDemangle
No call sites use these parameters, so drop them.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D148940
Petr Hosek [Fri, 21 Apr 2023 22:34:11 +0000 (22:34 +0000)]
[CMake] Add missing find_package for LibEdit
After building and installing LLVM with LibEdit as a dependency, it is
necessary to find it again when LLVM is consumed by another CMake
project, otherwise CMake will report an error about a missing target.
Note that the FindLibEdit.cmake file is in the "LLVM Common CMake
Utils" directory, outside of the LLVM sub-project source directory, so
the installed LLVMConfig.cmake relies on the user having installed the
LLVM common CMake modules or make available their own Find module.
Also note that the controlling HAVE_LIBEDIT CMake variable in
LLVMConfig.cmake.in has a different naming convention compared to
other similar variables like 'LLVM_ENABLE_TERMINFO'. Refactoring this
name would involve touching additional files and should be a follow-up
commit.
Patch By: ekilmer
Differential Revision: https://reviews.llvm.org/D147153
Razvan Lupusoru [Fri, 21 Apr 2023 22:14:22 +0000 (15:14 -0700)]
[mlir][openacc] NFC Fix acc.databounds description incorrect bullet
A dash used in description is an automatic bullet in documentation
if it is the first character of the line. The dash used in the
particular location being fixed was intended to be a separator.
Thus move it to previous line to fix incorrect bullet-ization.
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D148968
Hanhan Wang [Fri, 21 Apr 2023 20:25:33 +0000 (13:25 -0700)]
[mlir][linalg] Expose lowerPack and lowerUnPack utils.
Reviewed By: qcolombet
Differential Revision: https://reviews.llvm.org/D148867
Arthur Eubanks [Fri, 21 Apr 2023 21:52:37 +0000 (14:52 -0700)]
[Lint] Remove legacy pass
Louis Dionne [Mon, 6 Mar 2023 21:43:34 +0000 (16:43 -0500)]
[libc++] Make std::allocator_arg and friends conforming in C++17
This patch makes global tag variables like std::allocator_arg
conform to C++17 by defining them as inline constexpr variables.
This is possible without creating an ODR violation now that we don't
define strong definitions of those variables in the shared library
anymore.
Differential Revision: https://reviews.llvm.org/D145589
Arthur Eubanks [Fri, 21 Apr 2023 20:34:11 +0000 (13:34 -0700)]
[Inliner] Remove -update-return-attrs flag
This is by default on and I don't see any reason to turn it off. There's also no testing of it.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D148956
Teresa Johnson [Fri, 21 Apr 2023 21:37:42 +0000 (14:37 -0700)]
Revert "[MemProf] Context disambiguation cloning pass [patch 2/3]"
This reverts commit
d0649a6ad8be778abf7569f502148d577f8bc6f1.
Reverting due to a number of bot failures that need investigation.
Teresa Johnson [Wed, 4 Jan 2023 04:19:57 +0000 (20:19 -0800)]
[MemProf] Context disambiguation cloning pass [patch 2/3]
Performs cloning on the CallsiteContextGraph (not on the IR or summary
index), in order to uniquely identify the allocation behavior of an
allocation call given its context. In order to do this, the graph is
recursively traversed starting from the allocation nodes, until we
identify a point where the allocation behavior is unambiguous (the edges
have a single allocation type). Nodes are then cloned as we unwind the
recursion. We try to perform the minimal amount of cloning required to
disambiguate the contexts.
The follow-on patch will contain the support for applying the cloning to
the IR.
Depends on D140908 and D145836.
Differential Revision: https://reviews.llvm.org/D140949
Jim Ingham [Fri, 21 Apr 2023 20:49:01 +0000 (13:49 -0700)]
Make sure SelectMostRelevantFrame happens only when returning to the user.
This is a user facing action, it is meant to focus the user's attention on
something other than the 0th frame when you stop somewhere where that's
helpful. For instance, stopping in pthread_kill after an assert will select
the assert frame.
This is not something you want to have happen internally in lldb, both
because internally you really don't want the selected frame changing out
from under you, and because the recognizers can do arbitrary work, and that
can cause deadlocks or other unexpected behavior.
However, it's not something that the current code does
explicitly after a stop has been delivered, it's expected to happen implicitly
as part of stopping. I changing this to call SMRF explicitly after a user
stop, but that got pretty ugly quickly.
So I added a bool to control whether to run this and audited all the current
uses to determine whether we're returning to the user or not.
Differential Revision: https://reviews.llvm.org/D148863
Fangrui Song [Fri, 21 Apr 2023 20:46:20 +0000 (13:46 -0700)]
[ELF][test] Test .glink code sequence and DT_PPC64_GLINK
Valentin Clement [Fri, 21 Apr 2023 20:22:28 +0000 (13:22 -0700)]
[flang][openacc] Fix the value of lower bound, upper bound and extent
Update the lowering to match the intent of the newly added operation
as described here D148860.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D148932
Jason Molenda [Fri, 21 Apr 2023 20:16:50 +0000 (13:16 -0700)]
TestSTL was marked as skipped unconditionally in 2018, undo
It was avoiding a crash at the time on macOS, apparently, and
it skipped the test on all platforms. This test passes for me
now on macOS, let's remove the skip and see how the bots go.
Craig Topper [Fri, 21 Apr 2023 19:40:58 +0000 (12:40 -0700)]
[RISCV][Docs] Tweak the note about zicsr and zifencei since we now support version 2.1 of the base I specification.
Differential Revision: https://reviews.llvm.org/D148948
Diego Caballero [Fri, 21 Apr 2023 18:36:47 +0000 (18:36 +0000)]
[MLIR][Vector] Enable masked vectorizaton of contraction ops
This patch enables the vectorization of contraction ops using vector
masking. Support for vectorizing contractions is already there so this
is just adding contraction ops to the list of supported ops in
`vectorizeDynamicLinalgOpPrecondition` and adding a test.
Reviewed By: hanchung, awarzynski
Differential Revision: https://reviews.llvm.org/D148865
Sam McCall [Fri, 21 Apr 2023 19:07:17 +0000 (21:07 +0200)]
[dataflow] Don't crash in Environment::dump when decls have weird names
Joseph Huber [Fri, 21 Apr 2023 18:26:13 +0000 (13:26 -0500)]
[libc] Ignore unknown CUDA versions for `libc` targeting NVPTX
Summary:
We generally need a CUDA toolchain to build the tests for the GPU `libc`
targeting NVPTX. However, clang will commonly emit warnings on versions
that are too new. We can ignore these in `libc` since we are manually
specifying the `+ptx` version to use whenever we compile. So we do not
need to worry about unexpected changes and we do not depend on any newer
features. So this should not be problematic.
Joseph Huber [Fri, 21 Apr 2023 18:24:27 +0000 (13:24 -0500)]
[libc] Bump up sm_60's CUDA feature to +ptx63
Summary:
The sm_60 GPU is the oldest model that's supported for using the RPC
features of the `libc` GPU runtime. This also requires at least `+ptx63`
to enable use of the active mask. So, this patch sets that as the
minimum.
Shilei Tian [Fri, 21 Apr 2023 18:12:57 +0000 (14:12 -0400)]
[OpenMP] Enable the IDE support for the device runtime
Currently the device runtime is built as a custom target, which will not be included
in the compile commands. Those language servers using compile commands cannot
handle device runtime correctly.
In this patch, when `CMAKE_EXPORT_COMPILE_COMMANDS` is turned on, dummy
targets that will be excluded from all will be added. Those targets will not be
built or installed if we just simply do `make` or `make install`, but their
compilation will be included in the compile commands.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D148870
Nico Weber [Fri, 21 Apr 2023 18:07:17 +0000 (14:07 -0400)]
[gn] Port
f84ac48f1e83 (BOLT_TARGETS_TO_BUILD)
Alex Duran [Thu, 9 Mar 2023 23:46:24 +0000 (17:46 -0600)]
Fix an issue with th_task_state_memo_stack and proxy/helper tasks
When proxy or helper tasks were used in inactive parallel regions, no
memo of the th_task_state was stored in the stack, so th_task_state
became invalid. This change inserts an item in the memo stack to track
these th_task_states.
Patch by Alex Duran.
Differential Revision: https://reviews.llvm.org/D145736
Jan Svoboda [Fri, 21 Apr 2023 17:43:07 +0000 (10:43 -0700)]
[clang][deps] NFC: Refactor and comment ModuleDeps sorting
I once again stumbled across `IndexedModuleID` and was confused by the mutable `InputIndex` field.
This patch adds comments around that piece of code and unifies/simplifies related functions.
Reviewed By: Bigcheese
Differential Revision: https://reviews.llvm.org/D145197
Craig Topper [Fri, 21 Apr 2023 17:54:24 +0000 (10:54 -0700)]
[RISCV] Add Tag_RISCV_arch attribute by default when using clang as an assembler.
Can be disabled with -mno-default-build-attributes just like ARM.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D148817
Nathan Sidwell [Thu, 20 Apr 2023 22:11:54 +0000 (18:11 -0400)]
[BOLT] Remove unneeded dyncasts
These checks are unnecessary -- we've already bailed if the format was wrong.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D148848
Jan Svoboda [Fri, 21 Apr 2023 15:58:36 +0000 (08:58 -0700)]
[clang] NFCI: Optimize storage and lookup of analyzer options
This patch moves `llvm::sort()` from `AnalyzerOptions` constructor to initialization of local static variable in `isUnknownAnalyzerConfig()`.
This avoids unnecessary work, which can speed up Clang tools that initialize lots of `CompilerInvocation`s (and therefore `AnalyzerOptions`).
Reviewed By: steakhal
Differential Revision: https://reviews.llvm.org/D137258
David Green [Fri, 21 Apr 2023 17:35:58 +0000 (18:35 +0100)]
[DAG][AArch64] Limit preferIncOfAddToSubOfNot until after legalization if the node has wrap flags
If the add node has wrap flags then they will be destroyed by converting to
sub/not. The flags can be useful in converting to rhadd, for example, but that
may be required late if the node types need to be legalized. This limits the
preferIncOfAddToSubOfNot fold until after legalize DAG if the node have flags
to allow more folding.
Differential Revision: https://reviews.llvm.org/D148809
Aaron Ballman [Fri, 21 Apr 2023 17:33:39 +0000 (13:33 -0400)]
Revert "[clang] trigger -Wcast-qual on functional casts"
This reverts commit
7c0021923503a9a5fe1ba1f0b778b5b83c42aa43.
It broke post-commit buildbots:
https://lab.llvm.org/buildbot/#/builders/37/builds/21631
Jonas Devlieghere [Fri, 21 Apr 2023 17:06:12 +0000 (10:06 -0700)]
[lldb] Let Mangled decide whether a name is mangled or not
We have a handful of places in LLDB where we try to outsmart the logic
in Mangled to determine whether a string is mangled or not. There's at
least one place (*) where we are getting this wrong and causes a subtle
bug. The `cstring_is_mangled` is cheap enough that we should always rely
on it to determine whether a string is mangled or not.
(*) `ObjectFileMachO` assumes that a symbol that starts with a double
underscore (such as `__pthread_kill`) is mangled. That's mostly
harmless, until you use `function.name-without-args` in the frame
format. The formatter calls `Symbol::GetNameNoArguments()` which is a
wrapper around `Mangled::GetName(ePreferDemangledWithoutArguments)`. The
latter will first try using the appropriate language plugin to get the
demangled name without arguments, and if that fails, falls back to
returning the demangled name. Because we forced Mangled to treat the
symbol as a mangled name (even though it's not) there's no demangled
name. The result is that frames don't show any symbol at all.
Differential revision: https://reviews.llvm.org/D148846
Razvan Lupusoru [Thu, 20 Apr 2023 22:48:57 +0000 (15:48 -0700)]
[mlir][openacc] Add descriptions for new acc data operations
The acc.bounds operation now clarifies that it is meant to be
zero-based. I added example for both C++ and Fortran to
show the normalized representation.
I also added description for each operand in the data entry
and data exit operations.
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D148860
Momchil Velikov [Fri, 21 Apr 2023 16:34:54 +0000 (17:34 +0100)]
[NFC][CodeGenPrepare] Match against the correct instruction when checking profitability of folding an address
The "nested" `AddressingModeMatcher`s in
`AddressingModeMatcher::isProfitableToFoldIntoAddressingMode` are constructed
using the original memory instruction, even though they check whether the
address operand of a differrent memory instructon is foldable. The memory
instruction is used only for a dominance check (when not checking for
profitability), and using the wrong memory instruction does not change the
outcome of the test - if an address is foldable, the dominance test afects which
of the two possible ways to fold is chosen, but this result is discarded.
As an example, in
target triple = "x86_64-linux"
declare i1 @check(i64, i64)
define i32 @f(i1 %cc, ptr %p, ptr %q, i64 %n) {
entry:
br label %loop
loop:
%iv = phi i64 [ %i, %C ], [ 0, %entry ]
%offs = mul i64 %iv, 4
%c.0 = icmp ult i64 %iv, %n
br i1 %c.0, label %A, label %fail
A:
br i1 %cc, label %B, label %C
C:
%u = phi i32 [0, %A], [%w, %B]
%i = add i64 %iv, 1
%a.0 = getelementptr i8, ptr %p, i64 %offs
%a.1 = getelementptr i8, ptr %a.0, i64 4
%v = load i32, ptr %a.1
%c.1 = icmp eq i32 %v, %u
br i1 %c.1, label %exit, label %loop
B:
%a.2 = getelementptr i8, ptr %p, i64 %offs
%a.3 = getelementptr i8, ptr %a.2, i64 4
%w = load i32, ptr %a.3
br label %C
exit:
ret i32 -1
fail:
ret i32 0
}
the dominance test is perfomed between `%i = ...` and `%v = ...` at the moment
we're checking whether `%a3 = ...` is foldable
Using the memory instruction, which uses the interesting address is "more
correct" and this change is needed by a future patch.
Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D143896
Nathan Sidwell [Thu, 20 Apr 2023 19:22:18 +0000 (15:22 -0400)]
[BOLT] Add BOLT_TARGETS_TO_BUILD
Adds BOLT_TARGETS_TO_BUILD, which defaults to the intersection of
X86;AArch64 and LLVM_TARGETS_TO_BUILD, but allows configuration to
alter that -- for instance omitting one of those two targets even if
llvm supports both.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D148847
Lei Zhang [Fri, 21 Apr 2023 16:41:01 +0000 (09:41 -0700)]
[mlir][vector] NFC: Expose castAwayContractionLeadingOneDim
This commit exposes the transformation behind the pattern.
It is useful for more targeted application on a specific op
for once.
Reviewed By: kuhar
Differential Revision: https://reviews.llvm.org/D148758
Eric Gouriou [Fri, 21 Apr 2023 16:37:46 +0000 (17:37 +0100)]
[RISCV] NFC tweaks in extension descriptions, sorting
NFC changes in RISCISAInfo and RISCFeatures, and matching updates to the
MC tests.
- Drop the '.' in the parentheses section of the Zvk extension
descriptions. This is supported by
<https://www.masterclass.com/articles/period-inside-or-outside-parentheses#>,
- Remove an extraneous space in the description of Zvt,
- Reorder the ImpliedExts.* constant literals in RISCISAInfo.cpp, as
suggested in <https://reviews.llvm.org/D148483>.
Differential Revision: https://reviews.llvm.org/D148857
Nathan Sidwell [Wed, 19 Apr 2023 20:07:25 +0000 (16:07 -0400)]
[BOLT] Robustify compile-time config check
The BOLT runtime is specifically hard coded for x86_64 linux or x86_64
darwin. (Using x86_64 syscalls, hardcoding syscall numbers.)
Make it very clear this is for those specific pair of systems.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D148825
Zibi Sarbinowski [Fri, 21 Apr 2023 16:29:36 +0000 (11:29 -0500)]
[SystemZ][z/OS] Make LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL available for external unwind library.
On z/OS, we need to pass the location of unwind interface header when building cxxabi. The cmake macro `LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL` is available for this purpose but it is only used with conjunction with `LIBCXXABI_USE_LLVM_UNWINDER`. For the external unwind library we need to use LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL unconditionally whenever it is set.
Reviewed By: #libc_abi, muiez, phosek, SeanP
Differential Revision: https://reviews.llvm.org/D147460
Aart Bik [Wed, 19 Apr 2023 03:56:41 +0000 (20:56 -0700)]
[mlir][sparse][gpu] generate proper memcpy in/out host and device
The host registration is a convenient way to get CUDA kernels
running, but it may be slow and does not work for all buffer
(like global constants). This revision uses the proper alloc
copy dealloc chains for buffers, using asynchronous chains
to increase overlap. The host registration mechanism is
kept under a flag for the output, just for experimentation
purposes while this project ramps up.
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D148682
Alexey Bataev [Thu, 20 Apr 2023 14:11:48 +0000 (07:11 -0700)]
[SLP]Fix the cost for the extractelements, used in several nodes.
Currently the compiler calculates the compensation cost for the
extractelements, removed during vectorization. But if the extractelement
instruction is used in several nodes, we can calculate the compensation
for them several times.
Differential Revision: https://reviews.llvm.org/D148806
Nikita Popov [Fri, 21 Apr 2023 16:02:29 +0000 (18:02 +0200)]
[LV][IndVars] Move test to correct directory and regenerate (NFC)
For some reason, an IndVarSimplify test was in the LoopVectorize
directory.
LLVM GN Syncbot [Fri, 21 Apr 2023 15:51:37 +0000 (15:51 +0000)]
[gn build] Port
6c9066fe2ecc
Qiongsi Wu [Fri, 21 Apr 2023 15:31:46 +0000 (11:31 -0400)]
[CMake][AIX] Fixing AIX rpath
Recent commit https://github.com/llvm/llvm-project/commit/
8f833f88ab78265a8e0ebb0d1522771d67c708a9 modified the installation rpath and did not set `BUILD_WITH_INSTALL_RPATH` correctly on AIX, which led to installation failures on AIX. This patch sets `BUILD_WITH_INSTALL_RPATH` on AIX to fix the installation failures.
Reviewed By: buttaface, daltenty
Differential Revision: https://reviews.llvm.org/D148866
Florian Hahn [Fri, 21 Apr 2023 15:35:11 +0000 (16:35 +0100)]
[Matrix] Handle integer types when distributing transposes across adds.
The current code did not properly account for integer matrixes. Check
if the operands are floating point or integer matrixes and use FAdd/Add
accordingly.
This is already done for other cases, like multiplies.
Fixes #62281.
Adrian Prantl [Fri, 21 Apr 2023 15:20:39 +0000 (08:20 -0700)]
Make diagnostics API safer to use
I received a crash report in DiagnosticManager that was caused by a
nullptr diagnostic having been added. The API allows passing in a null
unique_ptr, but all the methods are written assuming that all pointers
a dereferencable. This patch makes it impossible to add a null
diagnostic.
rdar://
107633615
Differential Revision: https://reviews.llvm.org/D148823
Momchil Velikov [Fri, 21 Apr 2023 14:27:36 +0000 (15:27 +0100)]
Recommit "[AArch64] Fix incorrect `isLegalAddressingMode`"
This patch recommits
0827e2fa3fd15b49fd2d0fc676753f11abb60cab after
reverting it in
ed7ada259f665a742561b88e9e6c078e9ea85224. Added
workround for `Targetlowering::AddrMode` no longer being an aggregate
in C++20.
`AArch64TargetLowering::isLegalAddressingMode` has a number of
defects, including accepting an addressing mode, which consists of
only an immediate operand, or not checking the offset range for an
addressing mode in the form `1*ScaledReg + Offs`.
This patch fixes the above issues.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D143895
Change-Id: I41a520c13ce21da503ca45019979bfceb8b648fa