Maksim Panchenko [Thu, 21 Jul 2022 01:51:08 +0000 (18:51 -0700)]
[BOLT] Add support for the latest perf tool
The latest perf tool can return non-empty buffer when executing
buildid-list command, even when perf.data was recorded with -B flag.
Some binaries will be listed without the ID, while others may have a
recorded ID. Allow invalid entires on the input, while checking the
valid ones for the match.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D130223
Malhar Jajoo [Fri, 22 Jul 2022 12:52:20 +0000 (13:52 +0100)]
[Costmodel] Add "type-based-intrinsic-cost" cli option
This patch adds a command line flag to be able to test
the type based cost-model analysis for Intrinsics.
Differential Revision: https://reviews.llvm.org/D129109
Tue Ly [Fri, 22 Jul 2022 14:43:01 +0000 (10:43 -0400)]
[libc] Temporarily disable arm32's sinf, cosf, sincosf entrypoints.
With correctly rounded implementations, these functions will be tested for all
rounding modes. Since fegetround and fesetround are not implemented for arm32,
these tests will fail in all non-default rounding modes. We will re-enable
these entrypoints and tests once fegetround and fesetround are implemented for
arm32.
Shubham Narlawar [Fri, 22 Jul 2022 14:20:53 +0000 (15:20 +0100)]
[AArch64] Move SeparateConstOffsetFromGEPPass before LSR and enable EnableGEPOpt by default.
GEP's across basic blocks were not getting splitted due to EnableGEPOpt
which was turned off by default. Hence, EarlyCSE missed the opportunity
to eliminate common part of GEP's. This can be achieved by simply
turning GEP pass on.
- This patch moves SeparateConstOffsetFromGEPPass() just before LSR.
- It enables EnableGEPOpt by default.
Resolves - https://github.com/llvm/llvm-project/issues/50528
Added an unit test.
Differential Revision: https://reviews.llvm.org/D128582
Jacques Pienaar [Fri, 22 Jul 2022 14:20:24 +0000 (07:20 -0700)]
[mlir][tosa] Split canonicalization and folders out of TosaOps.
Scope ops file to ops. Used canonicalization as grouping for canonicalization
patterns and folders (also considered OpTransforms but that felt too generic
and the former two are used together).
Reviewed By: silvas, rsuderman
Differential Revision: https://reviews.llvm.org/D130297
Sam Estep [Fri, 22 Jul 2022 14:10:15 +0000 (14:10 +0000)]
[clang][dataflow] Move NoopAnalysis from unittests to include
This patch moves `Analysis/FlowSensitive/NoopAnalysis.h` from `clang/unittests/` to `clang/include/clang/`, so that we can use it for doing context-sensitive analysis.
Reviewed By: ymandel, gribozavr2, sgatev
Differential Revision: https://reviews.llvm.org/D130304
Nikita Popov [Fri, 22 Jul 2022 14:06:40 +0000 (16:06 +0200)]
[AsmPrinter] Move lowerConstant() error code out of switch (NFC)
Move this out of the switch, so that different branches can
indicate an error by breaking out of the switch. This becomes
important if there are more than the two current error cases.
Tue Ly [Tue, 5 Apr 2022 20:17:18 +0000 (16:17 -0400)]
[libc] Implement sinf function that is correctly rounded to all rounding modes.
Implement sinf function that is correctly rounded to all rounding modes.
- We use a simple range reduction for `pi/16 < |x|` :
Let `k = round(x / pi)` and `y = (x/pi) - k`.
So `k` is an integer and `-0.5 <= y <= 0.5`.
Then
```
sin(x) = sin(y*pi + k*pi)
= (-1)^(k & 1) * sin(y*pi)
~ (-1)^(k & 1) * y * P(y^2)
```
where `y*P(y^2)` is a degree-15 minimax polynomial generated by Sollya with:
```
> P = fpminimax(sin(x*pi)/x, [|0, 2, 4, 6, 8, 10, 12, 14|], [|D...|], [0, 0.5]);
```
- Performance benchmark using perf tool from CORE-MATH project
(https://gitlab.inria.fr/core-math/core-math/-/tree/master) on Ryzen 1700:
Before this patch (not correctly rounded):
```
$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh sinf
CORE-MATH reciprocal throughput : 17.892
System LIBC reciprocal throughput : 25.559
LIBC reciprocal throughput : 29.381
```
After this patch (correctly rounded):
```
$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh sinf
CORE-MATH reciprocal throughput : 17.896
System LIBC reciprocal throughput : 25.740
LIBC reciprocal throughput : 27.872
LIBC reciprocal throughput : 20.012 (with `-msse4.2` flag)
LIBC reciprocal throughput : 14.244 (with `-mfma` flag)
```
Reviewed By: zimmermann6
Differential Revision: https://reviews.llvm.org/D123154
zhijian [Fri, 22 Jul 2022 13:55:21 +0000 (09:55 -0400)]
[llvm-ar] Add object mode option -X for AIX
Summary:
1. Added a new option object mode -X for llvm-ar. In AIX OS , there is a object mode option -X for ar command.
please see the "-X mode" part of https://www.ibm.com/docs/ko/aix/7.1?topic=ar-command
Specifies the type of object file ar should examine. The mode must be one of the following:
32
Processes only 32-bit object files
64
Processes only 64-bit object files
32_64
Processes both 32-bit and 64-bit object files
any
Processes all of the supported object files.
The default is to process 32-bit object files (ignore 64-bit objects). The mode can also be set with the OBJECT_MODE environment variable. For example, OBJECT_MODE=64 causes ar to process any 64-bit objects and ignore 32-bit objects. The -X flag overrides the OBJECT_MODE variable.
2. Before adding the new option -X, the default behaviors of llvm-ar like -Xany, but after the adding the new option -X, the default behaviors of llvm-ar change to -X32 ,in order to let some test cases which has 32bit and 64bit object file in the same llvm-ar command, we need to add the "export OBJECT_MODE=any" into test case to change the default behaviors of llvm-ar's object mode.
Reviewers: James Henderson, Owen Reynolds, Fangrui Song
Differential Revision: https://reviews.llvm.org/D127864
Joseph Huber [Thu, 21 Jul 2022 13:02:10 +0000 (09:02 -0400)]
[Libomptarget] Make the plugins link as LLVM libraries
Previously we made `libomptarget` link as an LLVM library so we have
access to the LLVM core libraries. After the initial patch stuck we can
now apply the same changes to the plugins. This will allow us to use
LLVM in all of `libomptarget` when we have uses for them. In the future
this should allow us to remove the dependencies on `libelf`, `libffi`,
and `dl`.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D130262
Egor Zhdan [Wed, 13 Jul 2022 15:40:24 +0000 (16:40 +0100)]
[Clang][Driver] Fix include paths for `--sysroot /` on OpenBSD/FreeBSD
This is the same change as https://reviews.llvm.org/D126289, but applied for OpenBSD & FreeBSD.
Differential Revision: https://reviews.llvm.org/D129654
Tue Ly [Sat, 16 Jul 2022 02:59:36 +0000 (22:59 -0400)]
[libc] Add float type and flag for nearest_integer to enable SSE4.2.
Add float type and flag for nearest integer to automatically test with
and without SSE4.2 flag.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D129916
Kiran Chandramohan [Fri, 22 Jul 2022 13:03:59 +0000 (13:03 +0000)]
[MLIR][OpenMP] Add a constraint to the Threadprivate Op
Add a constraint to ensure that the operand and result of the
threadprivate operation are the same.
Reviewed By: peixin
Differential Revision: https://reviews.llvm.org/D128609
Kiran Chandramohan [Fri, 22 Jul 2022 12:57:23 +0000 (12:57 +0000)]
[MLIR,OpenMP] : Add Conversion pattern for Critical Op
The Conversion pattern enables conversion of Critical Op with block
arguments.
Fixes https://github.com/llvm/llvm-project/issues/56629
Reviewed By: shraiysh
Differential Revision: https://reviews.llvm.org/D130343
Nikita Popov [Fri, 22 Jul 2022 12:46:01 +0000 (14:46 +0200)]
[LangRef] Update opaque pointers status (NFC)
Opaque pointers support is complete and default. Specify ptr as
the normal pointer type and i8* as something supported under
non-default options.
A larger update of examples in LangRef is still needed.
Kadir Cetinkaya [Thu, 21 Jul 2022 10:43:08 +0000 (12:43 +0200)]
[clangd] Make forwarding parameter detection logic resilient
This could crash when our heuristic picks the wrong function. Make sure
there is enough parameters in the candidate to prevent those crashes.
Also special case copy/move constructors to make the heuristic work in
presence of those.
Fixes https://github.com/llvm/llvm-project/issues/56620
Differential Revision: https://reviews.llvm.org/D130260
Louis Dionne [Wed, 20 Jul 2022 14:42:04 +0000 (10:42 -0400)]
[libc++] Take advantage of -fexperimental-library in libc++
When -fexperimental-library is passed, libc++ will now pick up the
appropriate __has_feature flag defined by Clang to enable the
experimental library features.
As a fly-by, also update the documentation for the various TSes.
Differential Revision: https://reviews.llvm.org/D130176
Louis Dionne [Wed, 1 Jun 2022 19:25:14 +0000 (15:25 -0400)]
[libc++] Support int8_t and uint8_t in integer distributions as an extension
In D125283, we ensured that integer distributions would not compile when
used with arbitrary unsupported types. This effectively enforced what
the Standard mentions here: http://eel.is/c++draft/rand#req.genl-1.5.
However, this also had the effect of breaking some users that were
using integer distributions with unsupported types like int8_t. Since we
already support using __int128_t in those distributions, it is reasonable
to also support smaller types like int8_t and its unsigned variant. This
commit implements that, adds tests and documents the extension. Note that
we voluntarily don't add support for instantiating these distributions
with bool and char, since those are not integer types. However, it is
trivial to replace uses of these random distributions on char using int8_t.
It is also interesting to note that in the process of adding tests
for smaller types, I discovered that our distributions sometimes don't
provide as faithful a distribution when instantiated with smaller types,
so I had to relax a couple of tests. In particular, we do a really bad
job at implementing the negative binomial, geometric and poisson distributions
for small types. I think this all boils down to the algorithm we use in
std::poisson_distribution, however I am running out of time to investigate
that and changing the algorithm would be an ABI break (which might be
reasonable).
As part of this patch, I also added a mitigation for a very likely
integer overflow bug we were hitting in our tests in negative_binomial_distribution.
I also filed http://llvm.org/PR56656 to track fixing the problematic
distributions with int8_t and uint8_t.
Supersedes D125283.
Differential Revision: https://reviews.llvm.org/D126823
Joseph Huber [Thu, 21 Jul 2022 18:38:11 +0000 (14:38 -0400)]
[Libomptarget] Only export needed definitions in the BC library
This patch adds the use of the `-internalize-public-api-file` option in
the internalization pass to internalize any definition that isn't
explicitly needed for the interface. This will allow us to perform more
optimizations on the file that normally would not have been possible
with functions internal to the library not being internal.
Depends on D130293
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D130298
Joseph Huber [Fri, 22 Jul 2022 00:45:32 +0000 (20:45 -0400)]
[Internalize] Support glob patterns for API lists
The internalize pass supports an option to provide a list of symbols
that should not be internalized. THis is useful retaining certain
defintions that should be kept alive. However, this interface is
somewhat difficult to use as it requires knowing every single symbol's
name and specifying it. Many APIs provide common prefixes for the
symbols exported by the library, so it would make sense to be able to
match these using a simple glob pattern. This patch changes the handling
from a simple string comparison to a glob pattern match.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D130319
Joseph Huber [Thu, 21 Jul 2022 18:12:01 +0000 (14:12 -0400)]
[Libomptarget] Build the DeviceRTL BC using clang directly
Currently the bitcode library is build using the clang front-end
manually. This was originally done because we did not support device
only compilation. Now we support device only compilation, at least for a
single offloading toolchain, so we can instead use clang directly rather
than using the front-end. This saves us needing to define things like
`aux_triple`.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D130293
Nikita Popov [Fri, 22 Jul 2022 12:13:12 +0000 (14:13 +0200)]
[Docs] Add release notes for opaque pointers (NFC)
Ron Lieberman [Fri, 22 Jul 2022 12:04:33 +0000 (12:04 +0000)]
Revert "[Libomptarget] Stop testing CPU offloading with LTO"
This reverts commit
3e8d46921fbc51831f9ba775d6405812bfdd32c7.
Matthias Springer [Fri, 22 Jul 2022 11:27:02 +0000 (13:27 +0200)]
[mlir][linalg] Add tile-and-fuse with transform dialect example
Differential Revision: https://reviews.llvm.org/D130346
Matthias Springer [Fri, 22 Jul 2022 11:26:48 +0000 (13:26 +0200)]
[mlir][linalg] Add attribute matcher to structured.match transform op
This is useful for building small test cases and will be utilized in a subsequent commit that adds a fusion example.
Differential Revision: https://reviews.llvm.org/D130344
Matthias Springer [Fri, 22 Jul 2022 11:26:34 +0000 (13:26 +0200)]
[mlir][linalg][transform] Add fuse_into_containing op
This op fuses a given payload op into a given container op. Inside the container, all uses of the producer are replaced (fused) with the newly inserted op. If the producer is tileable and accessed via a tensor.extract_slice, the new op computes only the requested slice ("tile and fuse"). Otherwise, the entire tensor value is computed inside the container ("clone and fuse").
Differential Revision: https://reviews.llvm.org/D130244
Zhouyi Zhou [Fri, 22 Jul 2022 11:37:50 +0000 (12:37 +0100)]
[clang-tidy][NFC] Add preposition "of" to code annotation of ElseAfterReturnCheck
Reviewed By: njames93
Differential Revision: https://reviews.llvm.org/D129953
Jay Foad [Fri, 22 Jul 2022 11:08:14 +0000 (12:08 +0100)]
[AMDGPU] Add a test where regClassPriorityTrumpsGlobalness uses more vgprs
Ivan Butygin [Sat, 16 Jul 2022 10:05:03 +0000 (12:05 +0200)]
[mlir][arith] cmpi: move constant to the right side
Convert arith.cmpi to the canonical form with constants on the right side
to simplify further optimizations and open more opportunities for CSE.
Differential Revision: https://reviews.llvm.org/D129929
Petar Avramovic [Fri, 22 Jul 2022 09:43:09 +0000 (11:43 +0200)]
[AMDGPU] gfx11 Fix VOP3 dot instructions
Fix src modifiers for operands with bf16 type.
op_sel[0:1] are ignored.
Differential Revision: https://reviews.llvm.org/D129084
Ivan Butygin [Thu, 21 Jul 2022 23:09:22 +0000 (01:09 +0200)]
[mlir][linalg] Fix FoldTensorCastConsumerOp invalid folding
CastOp can be in conditionally reachable region, in which case this folding will be invalid.
Only conservatively fold ops in same block for now.
Fixes https://github.com/llvm/llvm-project/issues/56557
Differential Revision: https://reviews.llvm.org/D130314
David Spickett [Fri, 22 Jul 2022 09:33:43 +0000 (09:33 +0000)]
[lldb][ARM] Invert emulation test assert message
Previously you got:
AssertionError: False is not True : Emulation test succeeded.
Which is a bit of a head scratcher. The message is used when
the test fails, not when it succeeds.
Nathan James [Fri, 22 Jul 2022 09:32:27 +0000 (10:32 +0100)]
[ASTMatchers] Fix standalone build
Disable the tests and remove private include introduced in
d89f9e963e4979466193dc6a15fe091bf7ca5c47.
Hui Xie [Tue, 19 Jul 2022 19:54:35 +0000 (20:54 +0100)]
[libc++][ranges] implement `std::ranges::includes`
implement `std::ranges::includes` and delegate to `std::includes`
Differential Revision: https://reviews.llvm.org/D130116
Hui Xie [Thu, 14 Jul 2022 19:35:15 +0000 (20:35 +0100)]
[libc++][ranges] implement `std::ranges::equal_range`
implement `std::ranges::equal_range` which delegates to
`std::equal_range`
Differential Revision: https://reviews.llvm.org/D129796
Andy Yankovsky [Thu, 21 Jul 2022 16:41:32 +0000 (16:41 +0000)]
[lldb] Handle jumping to the end in DW_OP_skip/DW_OP_bra
DW_OP_skip/DW_OP_bra can move offset to the end of the data, which means that this was the last instruction to execute and the interpreter should terminate.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D130285
Benjamin Kramer [Fri, 22 Jul 2022 09:14:26 +0000 (11:14 +0200)]
Don't write to source directory in test
Chuanqi Xu [Fri, 22 Jul 2022 09:03:38 +0000 (17:03 +0800)]
[C++20] [Modules] Handle reachability for partial specialization
Previously we don't catch the reachability for partial specialization.
Handle them in this patch.
Sebastian Neubauer [Thu, 21 Jul 2022 12:06:42 +0000 (14:06 +0200)]
[CMake][Clang] Copy folder without permissions
Copying the folder keeps the original permissions by default. This
creates problems when the source folder is read-only, e.g. in a
packaging environment.
Then, the copied folder in the build directory is read-only as well.
Later on, with configure_file, ClangConfig.cmake is copied into that
directory (in the build tree), failing when the directory is read-only.
Fix that problem by copying the folder without keeping the original
permissions.
Differential Revision: https://reviews.llvm.org/D130254
Sam McCall [Fri, 22 Jul 2022 08:25:16 +0000 (10:25 +0200)]
[pseudo] Add ambiguity & unparseability metrics to -print-statistics
These can be used to quantify parsing improvements from a change.
Differential Revision: https://reviews.llvm.org/D130199
Benjamin Kramer [Fri, 22 Jul 2022 08:28:25 +0000 (10:28 +0200)]
[Symbolizer] Fix use-after-free
MarkupFilter keeps a reference to the last filtered StringRef. Just keep
it alive a bit longer. Found by asan.
Fangrui Song [Fri, 22 Jul 2022 08:26:11 +0000 (01:26 -0700)]
[ELF] Simplify createObjectFile/createLazyFile. NFC
And avoid redundant identify_magic test.
Kazu Hirata [Fri, 22 Jul 2022 08:05:17 +0000 (01:05 -0700)]
Use any_of (NFC)
Cullen Rhodes [Fri, 22 Jul 2022 07:27:12 +0000 (07:27 +0000)]
[AArch64] Emit vector FP cmp when LE is used with fast-math
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D130093
Cullen Rhodes [Fri, 22 Jul 2022 07:26:54 +0000 (07:26 +0000)]
[AArch64] Add fcmp fast math tests
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D130094
Nikita Popov [Fri, 22 Jul 2022 07:42:26 +0000 (09:42 +0200)]
[InstCombine] Slightly extend alloc optimization test (NFC)
Also test realloc, and dead writes to the allocation.
Iain Sandoe [Sun, 15 May 2022 13:47:54 +0000 (14:47 +0100)]
re-land [C++20][Modules] Build module static initializers per P1874R1.
The re-land fixes module map module dependencies seen on Greendragon, but
not in the clang test suite.
---
Currently we only implement this for the Itanium ABI since the correct
mangling for the initializers in other ABIs is not yet known.
Intended result:
For a module interface [which includes partition interface and implementation
units] (instead of the generic CXX initializer) we emit a module init that:
- wraps the contained initializations in a control variable to ensure that
the inits only happen once, even if a module is imported many times by
imports of the main unit.
- calls module initializers for imported modules first. Note that the
order of module import is not significant, and therefore neither is the
order of imported module initializers.
- We then call initializers for the Global Module Fragment (if present)
- We then call initializers for the current module.
- We then call initializers for the Private Module Fragment (if present)
For a module implementation unit, or a non-module TU that imports at least one
module we emit a regular CXX init that:
- Calls the initializers for any imported modules first.
- Then proceeds as normal with remaining inits.
For all module unit kinds we include a global constructor entry, this allows
for the (in most cases unusual) possibility that a module object could be
included in a final binary without a specific call to its initializer.
Implementation:
- We provide the module pointer in the AST Context so that CodeGen can act
on it and its sub-modules.
- We need to account for module build lines like this:
` clang -cc1 -std=c++20 Foo.pcm -emit-obj -o Foo.o` or
` clang -cc1 -std=c++20 -xc++-module Foo.cpp -emit-obj -o Foo.o`
- in order to do this, we add to ParseAST to set the module pointer in
the ASTContext, once we establish that this is a module build and we
know the module pointer. To be able to do this, we make the query for
current module public in Sema.
- In CodeGen, we determine if the current build requires a CXX20-style module
init and, if so, we defer any module initializers during the "Eagerly
Emitted" phase.
- We then walk the module initializers at the end of the TU but before
emitting deferred inits (which adds any hidden and static ones, fixing
https://github.com/llvm/llvm-project/issues/51873 ).
- We then proceed to emit the deferred inits and continue to emit the CXX
init function.
Differential Revision: https://reviews.llvm.org/D126189
Haojian Wu [Thu, 21 Jul 2022 08:18:33 +0000 (10:18 +0200)]
[pseudo] Eliminate the dangling-else syntax ambiguity.
- the grammar ambiguity is eliminated by a guard;
- modify the guard function signatures, now all parameters are folded in
to a single object, avoid a long parameter list (as we will add more
parameters in the near future);
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D130160
LLVM GN Syncbot [Fri, 22 Jul 2022 07:02:59 +0000 (07:02 +0000)]
[gn build] Port
8184b252cdab
Michael Buch [Tue, 12 Jul 2022 08:40:12 +0000 (09:40 +0100)]
[LLDB][ClangExpression] Allow expression evaluation from within C++ Lambdas
This patch adds support for evaluating expressions which reference
a captured `this` from within the context of a C++ lambda expression.
Currently LLDB doesn't provide Clang with enough information to
determine that we're inside a lambda expression and are allowed to
access variables on a captured `this`; instead Clang simply fails
to parse the expression.
There are two problems to solve here:
1. Make sure `clang::Sema` doesn't reject the expression due to an
illegal member access.
2. Materialize all the captured variables/member variables required
to evaluate the expression.
To address (1), we currently import the outer structure's AST context
onto `$__lldb_class`, making the `contextClass` and the `NamingClass`
match, a requirement by `clang::Sema::BuildPossibleImplicitMemberExpr`.
To address (2), we inject all captured variables as locals into the
expression source code.
**Testing**
* Added API test
Michael Buch [Thu, 7 Jul 2022 14:58:42 +0000 (15:58 +0100)]
[LLDB][Expression] Allow instantiation of IR Entity from ValueObject
This is required in preparation for the follow-up patch which adds
support for evaluating expressions from within C++ lambdas. In such
cases we need to materialize variables which are not part of the
current frame but instead are ivars on a 'this' pointer of the current
frame.
Michael Buch [Thu, 7 Jul 2022 14:53:30 +0000 (15:53 +0100)]
[LLDB][NFC] Create variable for hardcoded alignment/size constants in materializer
Haojian Wu [Thu, 21 Jul 2022 12:04:44 +0000 (14:04 +0200)]
[pseudo] Tweak the cli option messages, NFC.
Sam McCall [Fri, 22 Jul 2022 06:43:17 +0000 (08:43 +0200)]
[pseudo] Fix link error after
3132e9cd7c9fda63
Johannes Doerfert [Fri, 22 Jul 2022 06:23:55 +0000 (01:23 -0500)]
[Attributor][FIX] Also update the unit test to match expectations
Johannes Doerfert [Fri, 22 Jul 2022 06:04:53 +0000 (01:04 -0500)]
[Attributor][FIX] Update unit test after API change
Tarun Prabhu [Fri, 22 Jul 2022 06:03:09 +0000 (00:03 -0600)]
[flang] Lower F08 mask intrinsics
Lower F08 maskl and maskr intrinsics.
Differential Revision: https://reviews.llvm.org/D129296
Tarun Prabhu [Fri, 22 Jul 2022 05:36:08 +0000 (23:36 -0600)]
[flang] Lower F08 shift intrinsics
Lower F08 shift (shiftl, shiftr, shifta) and combined shift (dshiftl, dshiftr)
intrinsics. The combined shift intrinsics are implemented using the
definitions of shiftl and shiftr as described by the standard.
For non-conformant arguments to the shift intrinsics, the implementation tries
to replicate the behavior of other compilers if most of the other behave
consistently.
Differential Revision: https://reviews.llvm.org/D129316
Tarun Prabhu [Fri, 22 Jul 2022 05:30:38 +0000 (23:30 -0600)]
[flang][NFC] Test folding F08 mask intrinsics
Test compile-time folding of F08 maskl and maskr intrinsics.
Differential Revision: https://reviews.llvm.org/D129663
Tarun Prabhu [Fri, 22 Jul 2022 05:25:45 +0000 (23:25 -0600)]
[flang][NFC] Test folding of F08 shift intrinsics
Test compile-time folding of F08 shift (shiftl, shiftr, shifta) and combined shift (dshiftl, dshiftr) intrinsics.
Differential Revision: https://reviews.llvm.org/D129696
Tarun Prabhu [Fri, 22 Jul 2022 05:05:33 +0000 (23:05 -0600)]
[flang] Lower F08 bit population count intrinsics
Lower F08 bit population count intrinsics popcnt, poppar, leadz and trailz. popcnt, leadz and trailz are implemented using the corresponding MLIR math intrinsics. poppar is implemented in terms of popcnt.
Differential Revision: https://reviews.llvm.org/D129584
Johannes Doerfert [Tue, 12 Jul 2022 05:38:32 +0000 (00:38 -0500)]
[Attributor][FIX] Handle non-recursive but re-entrant functions properly
If a function is non-recursive we only performed intra-procedural
reasoning for reachability (via AA::isPotentiallyReachable). However,
if it is re-entrant that doesn't mean we can't reach. Instead of this
problematic logic in the reachability reasoning we utilize logic in
AAPointerInfo. If a location is for sure written by a function it can
be re-entrant or recursive we know only intra-procedural reasoning is
sufficient.
Max Kazantsev [Fri, 22 Jul 2022 04:29:29 +0000 (11:29 +0700)]
[RS4GC] Handle special cases in unreachable code for memcpy/memmov
The existing code doesn't expect dummy values (undef, poison, null-derived
constants etc) as arguments of these intrinsics. However, they can be there
in unreached code. Currently we fail trying to find base for them.
Handle these cases separately. Return null as base for them to be consistent
with the handling in the main algorithm in findBaseDefiningValue.
Differential Revision: https://reviews.llvm.org/D129561
Reviewed By: apilipenko
Uday Bondhugula [Tue, 19 Jul 2022 05:49:55 +0000 (11:19 +0530)]
[MLIR] Add affine.if canonicalization to compose in affine.apply ops
Add affine.if canonicalization to compose affine.apply ops into its set
and operands. This eliminates affine.apply ops feeding into affine.if
ops.
Differential Revision: https://reviews.llvm.org/D130242
Johannes Doerfert [Thu, 19 May 2022 22:20:48 +0000 (17:20 -0500)]
[Attributor] Dominating must-write accesses allow unknown initial values
If we have a dominating must-write access we do not need to know the
initial value of some object to perform reasoning about the potential
values. The dominating must-write has overwritten the initial value.
Johannes Doerfert [Sun, 10 Jul 2022 20:01:38 +0000 (15:01 -0500)]
[Intrinsics] Add `nocallback` to the memset/cpy/move intrinsics
These were forgotten when D118680 was applied. Similar to D125937.
Differential Revision: https://reviews.llvm.org/D129516
Ye Luo [Fri, 22 Jul 2022 02:58:15 +0000 (21:58 -0500)]
Revert "[OpenMP][OMPD] GDB plugin code to leverage libompd to provide debugging"
This reverts commit
51d3f421f48f7c888c37a13be049a4ca8b61436e.
Ye Luo [Fri, 22 Jul 2022 02:57:57 +0000 (21:57 -0500)]
Revert "Fixing build bot failure due to python-pip unavailability."
This reverts commit
9dc0d6aaa1e27b97e5d163f2590cf24b769a0c36.
Johannes Doerfert [Fri, 22 Jul 2022 00:29:18 +0000 (19:29 -0500)]
[OpenMP][FIX] Ensure thread and team state are defined properly
The namespaces were missing causing the symbols to have "C" mangling.
To avoid this in the future we qualify the names now fully.
Johannes Doerfert [Sun, 10 Jul 2022 19:59:01 +0000 (14:59 -0500)]
[Attributor][NFC] Remove unnecessary overwritten methods
Fangrui Song [Fri, 22 Jul 2022 02:41:24 +0000 (19:41 -0700)]
[Driver][test] Remove unused "-o %t.s" from frame-pointer*.c
Fangrui Song [Fri, 22 Jul 2022 02:37:56 +0000 (19:37 -0700)]
[LoongArch] Support load/store of dso_local PIC global values
lowerGlobalAddress added by D128427 can be used for PIC. The actual condition is
that the global value needs to be dso_local (a dso_preemptable one needs GOT
indirection).
load-store.ll has UB due to out-of-bounds load/store. Fix the UB in the variable
test and add an array test. Note: NOPIC array index is currently wrong.
Reviewed By: wangleiat
Differential Revision: https://reviews.llvm.org/D129977
Fangrui Song [Fri, 22 Jul 2022 01:41:28 +0000 (18:41 -0700)]
[verify-uselistorder] Hide unrelated options
Chenbing Zheng [Fri, 22 Jul 2022 01:24:24 +0000 (09:24 +0800)]
[InstCombine] remove useless ‘InstCombiner::’. nfc
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D130220
Fangrui Song [Fri, 22 Jul 2022 01:08:33 +0000 (18:08 -0700)]
[sanstats] Hide unrelated options
Fangrui Song [Fri, 22 Jul 2022 01:00:30 +0000 (18:00 -0700)]
[sancov] --help: hide unrelated options
Volodymyr Sapsai [Tue, 19 Jul 2022 21:27:02 +0000 (14:27 -0700)]
[modules] Replace `-Wauto-import` with `-Rmodule-include-translation`.
Diagnostic for `-Wauto-import` shouldn't be a warning because it doesn't
represent a potential problem in code that should be fixed. And the
emitted fix-it is likely to trigger `-Watimport-in-framework-header`
which makes it challenging to have a warning-free codebase. But it is
still useful to see how include directives are translated into modular
imports and which module a header belongs to, that's why keep it as a remark.
Keep `-Wauto-import` for now to allow a gradual migration for codebases
using `-Wno-auto-import`, e.g., `-Weverything -Wno-auto-import`.
rdar://
79594287
Differential Revision: https://reviews.llvm.org/D130138
Slava Gurevich [Thu, 21 Jul 2022 22:04:04 +0000 (15:04 -0700)]
[LLDB][Reliability] Fix accessing invalid iterator
Using invalidated vector iterator is at best a UB and could crash depending on STL implementation.
Fixing via minimal changes to preserve the existing code style.
Coverity warning 1454828 (scan.coverity.com)
Differential Revision: https://reviews.llvm.org/D130312
Phoebe Wang [Thu, 21 Jul 2022 23:56:29 +0000 (07:56 +0800)]
[X86][FP16] Do not split FP64->FP16 to FP64->FP32->FP16
Truncation from double to half is not always identical to truncating to float first and then to half. https://godbolt.org/z/56s9517hd
On the other hand, expanding to float and then to double is always identical to expanding to double directly. https://godbolt.org/z/Ye8vbYPnY
Reviewed By: RKSimon, skan
Differential Revision: https://reviews.llvm.org/D130151
Ryan Prichard [Thu, 21 Jul 2022 20:09:48 +0000 (13:09 -0700)]
[Frontend] Correct values of ATOMIC_*_LOCK_FREE to match builtin
Correct the logic used to set `ATOMIC_*_LOCK_FREE` preprocessor macros not
to rely on the ABI alignment of types. Instead, just assume all those
types are aligned correctly by default since clang uses safe alignment
for `_Atomic` types even if the underlying types are aligned to a lower
boundary by default.
For example, the `long long` and `double` types on x86 are aligned to
32-bit boundary by default. However, `_Atomic long long` and `_Atomic
double` are aligned to 64-bit boundary, therefore satisfying
the requirements of lock-free atomic operations.
This fixes PR #19355 by correcting the value of
`__GCC_ATOMIC_LLONG_LOCK_FREE` on x86, and therefore also fixing
the assumption made in libc++ tests. This also fixes PR #30581 by
applying a consistent logic between the functions used to implement
both interfaces.
Reviewed By: hfinkel, efriedma
Differential Revision: https://reviews.llvm.org/D28213
Ryan Prichard [Thu, 21 Jul 2022 20:09:39 +0000 (13:09 -0700)]
[CUDA] Ignore __CLANG_ATOMIC_LLONG_LOCK_FREE on i386
The default host CPU for an i386 triple is typically at least an i586,
which has cmpxchg8b (Clang feature, "cx8"). Therefore,
`__CLANG_ATOMIC_LLONG_LOCK_FREE` is 2 on the host, but the value should
be 1 for the device.
Also, grep for `__CLANG_ATOMIC_*` instead of `__GCC_ATOMIC_*`. The CLANG
macros are always emitted, but the GCC macros are omitted for the
*-windows-msvc targets. The `__GCC_HAVE_SYNC_COMPARE_AND_SWAP` macro
always has GCC in its name, not CLANG, however.
Reviewed By: tra
Differential Revision: https://reviews.llvm.org/D127465
Ilia Diachkov [Wed, 20 Jul 2022 15:48:16 +0000 (18:48 +0300)]
[SPIRV] add SPIRVPrepareFunctions pass and update other passes
The patch adds SPIRVPrepareFunctions pass, which modifies function
signatures containing aggregate arguments and/or return values before
IR translation. Information about the original signatures is stored in
metadata. It is used during call lowering to restore correct SPIR-V types
of function arguments and return values. This pass also substitutes some
llvm intrinsic calls to function calls, generating the necessary functions
in the module, as the SPIRV translator does.
The patch also includes changes in other modules, fixing errors and
enabling many SPIR-V features that were omitted earlier. And 15 LIT tests
are also added to demonstrate the new functionality.
Differential Revision: https://reviews.llvm.org/D129730
Co-authored-by: Aleksandr Bezzubikov <zuban32s@gmail.com>
Co-authored-by: Michal Paszkowski <michal.paszkowski@outlook.com>
Co-authored-by: Andrey Tretyakov <andrey1.tretyakov@intel.com>
Co-authored-by: Konrad Trifunovic <konrad.trifunovic@intel.com>
Nick Desaulniers [Fri, 22 Jul 2022 00:10:53 +0000 (17:10 -0700)]
precommit update_mir_test_checks run for D130316 NFC
Philip Reames [Thu, 21 Jul 2022 21:40:20 +0000 (14:40 -0700)]
[LV] Fix a conceptual mistake around meaning of uniform in isPredicatedInst
This code confuses LV's "Uniform" and LVL/LAI's "Uniform". Despite the
common name, these are different.
* LVs notion means that only the first lane *of each unrolled part* is
required. That is, lanes within a single unroll factor are considered
uniform. This allows e.g. widenable memory ops to be considered
uses of uniform computations.
* LVL and LAI's notion refers to all lanes across all unrollings.
IsUniformMem is in turn defined in terms of LAI's notion. Thus a
UniformMemOpmeans is a memory operation with a loop invariant address.
This means the same address is accessed in every iteration.
The tweaked piece of code was trying to match a uniform mem op (i.e.
fully loop invariant address), but instead checked for LV's notion of
uniformity. In theory, this meant with UF > 1, we could speculate
a load which wasn't safe to execute.
This ends up being mostly silent in current code as it is nearly
impossible to create the case where this difference is visible. The
closest I've come in the test case from 54cb87, but even then, the
incorrect result is only visible in the vplan debug output; before this
change we sink the unsafely speculated load back into the user's predicate
blocks before emitting IR. Both before and after IR are correct so the
differences aren't "interesting".
The other test changes are uninteresting. They're cases where LV's uniform
analysis is slightly weaker than SCEV isLoopInvariant.
Philip Reames [Thu, 21 Jul 2022 22:27:33 +0000 (15:27 -0700)]
[LV] Add a load focused version of the r45679 test
This a reproducer for bug in predicated instruction handling. The final result code is correct, but the reasoning by which we get there isn't.
Craig Topper [Thu, 21 Jul 2022 21:23:30 +0000 (14:23 -0700)]
[RISCV] Add sext.b/h and zext.b/h/w to RISCVInstrInfo::foldMemoryOperandImpl.
We can always fold zext.b since it is just andi. The others require
Zba/Zbb.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D130302
Alexander Shaposhnikov [Thu, 21 Jul 2022 21:29:39 +0000 (21:29 +0000)]
[GlobalOpt] Enable evaluation of atomic loads
Relax the check to allow evaluation of atomic loads
(but still skip volatile loads).
Test plan:
1/ ninja check-llvm check-clang
2/ Bootstrapped LLVM/Clang pass tests
Differential revision: https://reviews.llvm.org/D130211
LLVM GN Syncbot [Thu, 21 Jul 2022 21:26:59 +0000 (21:26 +0000)]
[gn build] Port
1d057a6d4306
Augusto Noronha [Thu, 21 Jul 2022 21:19:20 +0000 (14:19 -0700)]
Revert "[libc++] Use uninitialized algorithms for vector"
This reverts commit
23cf42e706fbc2a939ce1470da16599b42258aea.
LLVM GN Syncbot [Thu, 21 Jul 2022 20:54:39 +0000 (20:54 +0000)]
[gn build] Port
1dad6247d275
Daniel Thornburgh [Thu, 21 Jul 2022 20:52:15 +0000 (13:52 -0700)]
Fix use after free in MarkupFilter.cpp
Chi Chun Chen [Thu, 21 Jul 2022 20:50:22 +0000 (15:50 -0500)]
[OpenMP][NFC] Claim iterators in 'map' clause and motion clauses
Joseph Huber [Thu, 21 Jul 2022 19:29:58 +0000 (15:29 -0400)]
[Libomptarget] Stop testing CPU offloading with LTO
Summary:
Some of the buildbots don't find the libraries because they don't build
for the GPU. Although it should always be there it's unclear why these
buildbots are having problemsd. LTO is only interesting on the GPU and
these tests take extra time anyway so I'm just going to disable them for
now.
Teresa Johnson [Wed, 29 Jun 2022 20:25:58 +0000 (13:25 -0700)]
[MemProf] Add memprof metadata related analysis utilities
Adds a number of utilities that are used to help create and update
memprof related metadata. These will be used during profile matching
and annotation, as well as by the inliner when updating the metadata.
Also adds unit tests for the utilities.
See also related RFCs:
RFC: Sanitizer-based Heap Profiler [1]
RFC: A binary serialization format for MemProf [2]
RFC: IR metadata format for MemProf [3]
(Note that the IR metadata format has changed from the RFC during
implementation, as described in the preceeding patch adding the basic
metadata and verification support.)
Depends on D128141.
Differential Revision: https://reviews.llvm.org/D128854
Sam McCall [Tue, 19 Jul 2022 08:54:52 +0000 (10:54 +0200)]
[pseudo] Key guards by RuleID, add guards to literals (and 0).
After this, NUMERIC_CONSTANT and strings should parse only one way.
There are 8 types of literals, and 24 valid (literal, TokenKind) pairs.
This means adding 8 new named guards (or 24, if we want to assert the token).
It seems fairly clear to me at this point that the guard names are unneccesary
indirection: the guards are in fact coupled to the rule signature.
(Also add the zero guard I forgot in the previous patch.)
Differential Revision: https://reviews.llvm.org/D130066
Ziqing Luo [Thu, 21 Jul 2022 20:20:19 +0000 (13:20 -0700)]
[ASTMatchers] Adding a new matcher for callee declarations of Obj-C
message expressions
For an Obj-C message expression `[o m]`, the adding matcher will match
the declaration of the method `m`. This commit overloads the existing
`callee` ASTMatcher, which originally was only for C/C++ nodes but
also applies to Obj-C messages now.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D129398
Siva Chandra Reddy [Wed, 20 Jul 2022 21:02:53 +0000 (21:02 +0000)]
[libc] Add a convenience class and function for integer to string conversion.
Printf's integer converter has been modified to use the new converter. In
future, it will be used to implement other parts of the libc.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D130227
Martin Storsjö [Wed, 20 Jul 2022 10:39:33 +0000 (13:39 +0300)]
[MinGW] Don't currently set visibility=hidden when building for MinGW
If we build the Target libraries with -fvisibility=hidden, then
LLVM_EXTERNAL_VISIBILITY must also be able to override it back
to default visibility.
Currently, the LLVM_EXTERNAL_VISIBILITY define is a no-op for
mingw targets, thus set CMAKE_CXX_VISIBILITY_PRESET correspondingly.
This unbreaks the mingw dylib build, if the compiler actually
takes hidden visiblity into account (e.g. after D130121).
(Later, once hidden visiblity can be used for MinGW targets, we
can make LLVM_EXTERNAL_VISIBILITY and LLVM_LIBRARY_VISIBILITY expand
to actual attributes, and reverse this commit.)
Differential Revision: https://reviews.llvm.org/D130200
Philip Reames [Thu, 21 Jul 2022 19:52:48 +0000 (12:52 -0700)]
[LV][SVE] Autogen a test for ease of update
Jacques Pienaar [Thu, 21 Jul 2022 19:58:19 +0000 (12:58 -0700)]
[mlir] Explicitly mark dialect prefixing
Missed previously and needed to flip the default. Most of these just
flipped to _Raw to retain existing state/keep this small except for TOSA
dialect which got flipped to _Both as no further change was needed..