Nikita Popov [Tue, 11 Oct 2022 09:01:29 +0000 (11:01 +0200)]
[Attributes] Return Optional from getAllocSizeArgs() (NFC)
As suggested on D135572, return Optional<> from getAllocSizeArgs()
rather than the peculiar pair(0, 0) sentinel.
The method on Attribute itself does not return Optional, because
the attribute must exist in that case.
Nikita Popov [Mon, 10 Oct 2022 11:57:24 +0000 (13:57 +0200)]
[Attributes] Support int attributes with zero value
This regularly comes up as a stumbling stone when adding int
attributes: They currently need to be encoded in a way to avoids
the zero value.
This adds support for zero-value int attributes by a) making the
ctor determine int/enum attribute based on attribute kind, not
whether the value is non-zero and b) switching getRawIntAttr()
to return an Optional, so that it's possible to distinguish a zero
value from non-existence.
Differential Revision: https://reviews.llvm.org/D135572
Nikita Popov [Tue, 11 Oct 2022 08:29:44 +0000 (10:29 +0200)]
[AttrBuilder] Remove unused vscale accessors (NFC)
These accessors are not used. Generally, nowadays it is preferable
to perform queries on AttributeSets/Lists, rather than the
AttrBuilder, which is optimized towards attribute construction now.
David Green [Tue, 11 Oct 2022 08:09:16 +0000 (09:09 +0100)]
[AArch64][ARM] Alter most of arm_neon.h to be target-based, not preprocessor based.
Similar to D131064, this alters most of the intrinsics in arm_neon.h to
be target based, not preprocessor based. The intrinsics that are changed
are the ones with obvious target features (fp16, fp16fml, cryptos, i8mm
and bf16). The ones that are not yet altered are the ones without target
features like rdma (8.1) and complex (8.3). Those will be switched in a
followup patch that allows targeting architecture versions.
The existing ArchGuard in arm_neon.td is split into ArchGuard that still
adds ifdef defines (for example for intrinsics that require __aarch64__),
and TargetGuards for intrinsics dependant on target features. From there
the TargetGuards are used in two ways:
- For intrinsics emitted as functions, __attribute__((target(TargetGuard)))
is added to the definition of the function. Along with the existing
always_inline intrinsic, this will give a compile time error if the
function is used in a context where the target feature is not available.
- For intrinsics emitted as macros, the __builtins are emitted into
arm_neon.inc using TARGET_BUILTIN as opposed to BUILTIN, which includes
the target feature and gives an error if the builtin is found in a
function without the required features, similar to arm_sve.h.
The second method requires that the intrinsics be separable from the
existing _v intrinsics used in other types. For example
__builtin_neon_splat_lane_bf16 is used as opposed to
__builtin_neon_splat_lane_v. There are some adjustments to the CGBuiltin
to account for intrinsics that can be treated similarly, except for
their target features.
Differential Revision: https://reviews.llvm.org/D132034
Nikita Popov [Tue, 11 Oct 2022 07:56:37 +0000 (09:56 +0200)]
[Attributes] Remove AttrBuilder::hasAlignmentAttr() method (NFC)
This was the odd one out, with similar methods not existing for
any other attributes. In the places where it is used, it is best
replaced by AttrBuilder::getAttribute(), which allows us to both
test for presence of the attribute and retrieve its value at the
same time. (To just check for presence, contains() could be used.)
Nikita Popov [Tue, 11 Oct 2022 07:53:08 +0000 (09:53 +0200)]
[AsmParser] Remove some redundant checks for align attributes
The verifier already has a more general check that the attribute is
legal for the position it is used in.
Nikita Popov [Tue, 11 Oct 2022 07:39:39 +0000 (09:39 +0200)]
[Attributes] Remove special SRet/ByVal attribute handling in C API
Proper construction functions for these have long since been
exposed, and these attributes require a type nowadays, so drop the
old compatibility code.
Nikita Popov [Tue, 20 Sep 2022 11:04:27 +0000 (13:04 +0200)]
[MustExec][LICM] Handle latch being part of an inner cycle (PR57780)
The algorithm in allLoopPathsLeadToBlock() does not handle the case
where the loop latch is part of the predecessor set correctly: In
this case, we may take the backedge (escaping to a different loop
iteration) and not execute other latch successors. This can happen
if the latch is part of an inner cycle.
Fixes https://github.com/llvm/llvm-project/issues/57780.
Differential Revision: https://reviews.llvm.org/D134279
Fangrui Song [Tue, 11 Oct 2022 05:27:26 +0000 (22:27 -0700)]
[test] Require aarch64-registered-target
Siva Chandra Reddy [Mon, 10 Oct 2022 08:35:21 +0000 (08:35 +0000)]
[libc] Add POSIX functions posix_spawn_file_actions_*.
Namely, posix_spawn_file_actions_addclose,
posix_spawn_file_actions_adddup2, posix_spawn_file_actions_addopen,
posix_spawn_file_actions_destroy, posix_spawn_file_actions_init have
been added.
Reviewed By: michaelrj, lntue
Differential Revision: https://reviews.llvm.org/D135603
Fangrui Song [Tue, 11 Oct 2022 04:10:35 +0000 (21:10 -0700)]
[MC][test] Add Mach-O .addrsig test
Jacob Abraham [Tue, 11 Oct 2022 02:57:17 +0000 (19:57 -0700)]
[clang-format] Fix mis-attributing preprocessor directives to macros
This solves the issue where a case statement inside a macro greedily
adds preprocessor lines such as #include to the macro even if they
are not a part of the macro to begin with.
Fixes #58214.
Differential Revision: https://reviews.llvm.org/D135422
Peixin-Qiao [Tue, 11 Oct 2022 02:29:23 +0000 (10:29 +0800)]
[flang] Support GNU extensions IARGC and GETARG in runtime
The GNU extension intrinsic IARGC is equivalent to
COMMAND_ARGUMENT_COUNT, and the GETARG is similar to
GET_COMMAND_ARGUMENT, but with less arguments. Reuse the runtime of
COMMAND_ARGUMENT_COUNT and GET_COMMAND_ARGUMENT for IARGC and GETARG.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D133558
Ye Luo [Mon, 10 Oct 2022 22:53:50 +0000 (17:53 -0500)]
[DeviceRTL] CMake fix using target-level dependency
File-level dependency should not be used on files generated during the build. The next command may execute before the generating command finishes writing the file. Use add_custom_target and use target-level dependency.
Differential Revision: https://reviews.llvm.org/D135630
Peixin-Qiao [Tue, 11 Oct 2022 01:51:36 +0000 (09:51 +0800)]
[flang][NFC] Fix typos in FIROps.td
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D135570
Peixin-Qiao [Tue, 11 Oct 2022 01:25:41 +0000 (09:25 +0800)]
[flang][NFC] Fix fir::ConvertOp description
According to the support of fir::ConvertOp conversion in CodeGen.cpp,
it also supports integer to pointer conversion and pointer to integer
conversion. The entity can be array, and the conversion type can be
pointer to array.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D135571
Christopher Di Bella [Thu, 6 Oct 2022 01:50:16 +0000 (01:50 +0000)]
[clang] makes `__is_destructible` KEYALL instead of KEYMS
This makes it possible to be used in all modes, instead of just when
`-fms-extensions` is enabled. Also moves the `-fms-extensions`-exclusive
traits into their own file so we can check the others aren't dependent
on this flag.
This is information that the compiler already has, and should be exposed
so that the library doesn't need to reimplement the exact same
functionality.
This was originally a part of D116280.
Depends on D135177.
Differential Revision: https://reviews.llvm.org/D135339
Christopher Di Bella [Tue, 4 Oct 2022 16:44:39 +0000 (16:44 +0000)]
[clang] adds `__is_scoped_enum`, `__is_nullptr`, and `__is_referenceable`
... as builtins.
This is information that the compiler already has, and should be exposed
so that the library doesn't need to reimplement the exact same
functionality.
This was originally a part of D116280.
Depends on D135175.
Differential Revision: https://reviews.llvm.org/D135177
Christopher Di Bella [Tue, 4 Oct 2022 15:49:20 +0000 (15:49 +0000)]
[clang] adds `__is_bounded_array` and `__is_unbounded_array` as builtins
This is information that the compiler already has, and should be exposed
so that the library doesn't need to reimplement the exact same
functionality.
This was originally a part of D116280.
Differential Revision: https://reviews.llvm.org/D135175
Jeff Niu [Tue, 11 Oct 2022 00:03:35 +0000 (17:03 -0700)]
[mlir][arith] Fix another file header (NFC)
Slava Zakharin [Mon, 10 Oct 2022 17:43:01 +0000 (10:43 -0700)]
[flang] Add type-specific runtime entries for Minloc/Maxloc.
We used to have a big switch statement over the type categories and kinds
inside Minloc/Maxloc. After D133051 the switch grew bigger, and this
changed inlining decisions made by GCC (the build compiler). Some of the
simple methods stopped being inlined, and this caused slight performance
regression in Polyhedron/gas_dyn2. This change adds separate entries
for real/integer data types to let them be optimized separately.
Differential Revision: https://reviews.llvm.org/D135610
Jeff Niu [Mon, 10 Oct 2022 23:51:04 +0000 (16:51 -0700)]
[mlir][arith] Fix header spacing (NFC)
Michael Jones [Mon, 10 Oct 2022 22:35:16 +0000 (15:35 -0700)]
[libc] fix header list for x86_64
Some headers hadn't been added, this fixes that and improves the
ordering.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D135629
Michael Jones [Mon, 10 Oct 2022 22:48:18 +0000 (15:48 -0700)]
[libc] reset errno in isatty tests
Errno wasn't getting reset between tests, causing cascading failures.
Differential Revision: https://reviews.llvm.org/D135627
AmosLewis [Mon, 10 Oct 2022 22:47:50 +0000 (15:47 -0700)]
[mlir][tosa] Fix tosa::Select to linalg::generic indexingMaps bug
The tosa to linalg generic ops indexingMaps rank use is wrong.
Find this bug in gpt2 pytorch model lowering to tosa.
issue link is here https://github.com/llvm/llvm-project/issues/58154
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D135343
Daniel Sanders [Mon, 10 Oct 2022 21:58:29 +0000 (14:58 -0700)]
[instcombine] (extelt (inselt Vec, Value, Index), Index) -> Value
When Index is variable but still trivially known to be equal we can use Value
from before the insertion, possibly eliminating the vector.
Reverts a functional change from:
Author: Philip Reames <listmail@philipreames.com>
Date: Wed Dec 8 12:21:10 2021 -0800
[instcombine] A couple style tweaks to visitExtractElementInst [nfc]
Thanks to Michele Scandale for identifying the bug
Differential Revision: https://reviews.llvm.org/D135625
Michael Jones [Mon, 10 Oct 2022 22:39:38 +0000 (15:39 -0700)]
[libc] handle case where /dev/tty doesn't exist
In the isatty test it was assumed that /dev/tty existed, but that's not
always the case. Now we check for that.
Differential Revision: https://reviews.llvm.org/D135626
Arthur Eubanks [Mon, 10 Oct 2022 22:18:43 +0000 (15:18 -0700)]
Revert "[gn build] Don't set LLVM_UNREACHABLE_OPTIMIZE when llvm_enable_assertions"
This reverts commit
0f19c603423e28ab663c1fdff2048c555abe5f6d.
This didn't actually do anything. llvm_unreachable() under `#ifndef NDEBUG` is always supposed to report an error regardless of LLVM_UNREACHABLE_OPTIMIZE. I can't reproduce the issue I was originally seeing with this reverted, not sure what was happening back then, manually verified by messing around with various binaries/configurations.
Michael Jones [Mon, 10 Oct 2022 21:37:21 +0000 (14:37 -0700)]
[libc] add isatty
The isatty function uses the side effects of an ioctl call to determine
if a specific file descriptor is a terminal. I chose TIOCGETD (get line
discipline of terminal) because it didn't require any new structs.
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/D135618
Aart Bik [Mon, 10 Oct 2022 22:10:25 +0000 (15:10 -0700)]
[mlir][sparse] fixed memory leak on sparse tensors
This was introduced by https://reviews.llvm.org/D134933
This change also cleans up a dump&release method which
had become a misnomer after prior bufferization improvement.
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D135623
Jorge Gorbe Moya [Thu, 22 Sep 2022 18:00:22 +0000 (11:00 -0700)]
[NFCI] More TypeCategoryImpl refactoring.
The main aim of this patch is to delete the remaining instances of code
reaching into the internals of `TypeCategoryImpl`. I made the following
changes:
- Add some more methods to `TieredFormatterContainer` and
`TypeCategoryImpl` to expose functionality that is implemented in
`FormattersContainer`.
- Add new overloads of `TypeCategoryImpl::AddTypeXXX` to make it easier
to add formatters to categories without reaching into the internal
`FormattersContainer` objects.
- Remove the `GetTypeXXXContainer` and `GetRegexTypeXXXContainer`
accessors from `TypeCategoryImpl` and update all call sites to use the
new methods instead.
Differential Revision: https://reviews.llvm.org/D135399
Michal Paszkowski [Thu, 6 Oct 2022 19:35:41 +0000 (21:35 +0200)]
[SPIRV] Fix call lowering of "anonymous" functions
The patch fixes lowering of anonymous functions, removes file/linkage
info for builtin call demangling, and adds relevant test demonstrating
a fixed problem.
Differential Revision: https://reviews.llvm.org/D135390
Craig Topper [Mon, 10 Oct 2022 21:50:06 +0000 (14:50 -0700)]
Revert "[TargetLowering][RISCV][X86] Support even divisors in expandDIVREMByConstant."
This reverts commit
d4facda414b6b9b8b1a34bc7e6b7c15172775318.
This has been reported to cause failures. Reverting while I investigate.
Michael Jones [Thu, 22 Sep 2022 20:35:49 +0000 (13:35 -0700)]
[libc] add sysconf with pagesize
The sysconf function has many options, this patch adds the basic funtion
and the pagesize option. More options will be added in future patches.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D135409
Diego Caballero [Mon, 10 Oct 2022 21:21:03 +0000 (21:21 +0000)]
[mlir][Vector] Introduce 'vector.mask' operation and MaskableOpInterface
This patch introduces the `vector.mask` operation and the MaskableOpInterface
as described in https://discourse.llvm.org/t/rfc-vector-masking-representation-in-mlir/64964.
The `vector.mask` operation is used to predicate the execution of operations
implementing the MaskableOpInterface. This interface will be implemented by maskable
operations and provides information about its masking constraints and semantics.
For now, only vector transfer and reduction ops implement the MaskableOpInterface
for illustration and testing purposes.
Reviewed By: nicolasvasilache, rriddle
Differential Revision: https://reviews.llvm.org/D134939
David Green [Mon, 10 Oct 2022 21:06:35 +0000 (22:06 +0100)]
[ARM] Add errors for MVE exclusive registers.
These instructions already had errors for operands that could not share
the same register:
VCMUL, VMULL, VQDMULL.
This extends that to a few others:
VREV64, VQDMULLqr, VCADD and VHCADD.
Only the i32 types require the error.
Differential Revision: https://reviews.llvm.org/D135560
Joseph Huber [Mon, 10 Oct 2022 20:55:55 +0000 (15:55 -0500)]
[LinkerWrapper] Fix failing linker wrapper save temps test
Summary:
This test started failing locally due to a misspelling of `-save-temps`
for the linker wrapper and the `ls` command not having the glob
arguments put in a string. This patch should fix it.
Sebastian Peryt [Mon, 10 Oct 2022 20:39:38 +0000 (13:39 -0700)]
[NFC][3/n] Remove enable-new-pm from Inline tests
This change is updating remaining Inline tests
by removing -enable-new-pm=0 flag and adjusting CHECKs
where it is required.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D135497
Joe Nash [Mon, 10 Oct 2022 18:37:18 +0000 (14:37 -0400)]
[AMDGPU] Fix True16 patterns for cmp on GFX11
These patterns should have a True16 version and a non-true16 version.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D135609
Stanley Winata [Mon, 10 Oct 2022 20:12:41 +0000 (13:12 -0700)]
[mlir][linalg] Remove redundant check on linalgOps to fix windows builder
One of the assertion is causing signed/unsigned mismatch. However this
assertion seems redundant and is no longer used.
Reviewed By: mravishankar, ThomasRaoux
Differential Revision: https://reviews.llvm.org/D135612
Keith Smiley [Sun, 9 Oct 2022 04:04:56 +0000 (21:04 -0700)]
[lld-macho] Flip ZERO_AR_DATE default
Previously unless ZERO_AR_DATE was set to any value, ld64.lld would
embed non-hermetic timestamps into the final binary. This flips that
default to zero those values unless ZERO_AR_DATE is set explicitly to 0.
As far as I know there isn't a downside to this, except that it differs
from ld64.
Differential Revision: https://reviews.llvm.org/D135529
Kazu Hirata [Mon, 10 Oct 2022 19:57:25 +0000 (12:57 -0700)]
[mlir] Fix a warning
This patch fixes:
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1051:40: error: comparison
of integers of different signs: 'int64_t' (aka 'long') and
'std::size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
Aaron Ballman [Mon, 10 Oct 2022 19:53:48 +0000 (15:53 -0400)]
Reword diagnostics for style; NFC
This removes the capital letter at the start of a few diagnostics and
reformats the nearby diagnostics to match the local style.
Tom Honermann [Fri, 7 Oct 2022 21:13:46 +0000 (14:13 -0700)]
[Clang] reject bit-fields as instruction operands in Microsoft style inline asm blocks.
MSVC allows bit-fields to be specified as instruction operands in inline asm
blocks. Such references are resolved to the address of the allocation unit that
the named bitfield is a part of. The result is that reads and writes of such
operands will read or mutate nearby bit-fields stored in the same allocation
unit. This is a surprising behavior for which MSVC issues warning C4401,
"'<identifier>': member is bit field". Intel's icc compiler also allows such
bit-field references, but does not issue a diagnostic.
Prior to this change, Clang fails the following assertion when a bit-field is
referenced in such instructions:
clang/lib/CodeGen/CGValue.h:338: llvm::Value* clang::CodeGen::LValue::getPointer(clang::CodeGen::CodeGenFunction&) const: Assertion `isSimple()' failed.
In non-assert enabled builds, Clang's behavior appears to match the behavior
of the MSVC and icc compilers, though it is unknown if that is by design or
happenstance.
Following this change, attempts to use a bit-field as an instruction operand
in Microsoft style asm blocks is diagnosed as an error due to the risk of
unintentionally reading or writing nearby bit-fields.
Fixes https://github.com/llvm/llvm-project/issues/57791
Reviewed By: erichkeane, aaron.ballman
Differential Revision: https://reviews.llvm.org/D135500
Sam James [Sun, 9 Oct 2022 22:39:23 +0000 (23:39 +0100)]
[clang] Mention -Werror changes revived for Clang 16
-Wimplicit-function-declaration and -Wimplicit-int become errors
by default in Clang 16 (originally in 15, but we reverted it in 15.0.1).
Mention it in the release notes like we did originally for Clang 15.
See https://discourse.llvm.org/t/configure-script-breakage-with-the-new-werror-implicit-function-declaration/65213 for more context.
Signed-off-by: Sam James <sam@gentoo.org>
Differential Revision: https://reviews.llvm.org/D135545
Florian Hahn [Mon, 10 Oct 2022 19:42:18 +0000 (20:42 +0100)]
[SCEV] Verify block disposition cache.
This extends the existing SCEV verification to catch cache invalidation
issues as in #57837.
The validation logic is similar to the recently added loop disposition
cache validation in
bb68b2402daa9.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D134531
Florian Hahn [Mon, 10 Oct 2022 19:23:24 +0000 (20:23 +0100)]
[ConstraintElimination] Regenerate check lines for test.
Thanks @nikic for spotting that!
Sanjay Patel [Mon, 10 Oct 2022 18:58:43 +0000 (14:58 -0400)]
[VectorCombine] convert scalar fneg with insert/extract to vector fneg
insertelt DestVec, (fneg (extractelt SrcVec, Index)), Index --> shuffle DestVec, (fneg SrcVec), Mask
This is a specialized form of what could be a more general fold for a binop.
It's also possible that fneg is overlooked by SLP in this kind of
insert/extract pattern since it's a unary op.
This shows up in the motivating example from #issue 58139, but it won't solve
it (that probably requires some x86-specific backend changes). There are also
some small enhancements (see TODO comments) that can be done as follow-up
patches.
Differential Revision: https://reviews.llvm.org/D135278
Sanjay Patel [Mon, 10 Oct 2022 18:36:34 +0000 (14:36 -0400)]
[VectorCombine] add test with out-of-bounds insert/extract index; NFC
D135278
Utkarsh Saxena [Mon, 10 Oct 2022 18:16:45 +0000 (20:16 +0200)]
Update implementation status of P2468R2
Differential Revision: https://reviews.llvm.org/D135608
Tony Tye [Tue, 4 Oct 2022 23:12:41 +0000 (23:12 +0000)]
[AMDGPU][NFC] Update DW_OP_LLVM_overlay documentation
Update DWARF Extensions For Heterogeneous Debugging proposal for the
DW_OP_LLVM_overlay operation:
1. Add an example.
2. Correct typo in definition of rbss.
3. Correct definition to specify both operands of the
DW_OP_bit_piece operations.
Reviewed By: zoran.zaric
Differential Revision: https://reviews.llvm.org/D135394
Stanley Winata [Mon, 10 Oct 2022 18:29:15 +0000 (11:29 -0700)]
[mlir][linalg] Remove unused payload related OutOpOperand
Some higher level operations such as torch.max generates linalg generic
that returns both the index and the value of the max operation. However
sometimes not all information is being used. This however blocks
vectorization for certain cases which causes performance degradation.
This patch aims to fix this issue.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D135388
Aaron Ballman [Mon, 10 Oct 2022 18:45:11 +0000 (14:45 -0400)]
Fix a typo in the Release Notes; NFC
Erich Keane [Mon, 10 Oct 2022 18:42:19 +0000 (11:42 -0700)]
Fix unused variable warning from D134529
Jordan Rupprecht [Mon, 10 Oct 2022 18:40:45 +0000 (11:40 -0700)]
Revert "[LTO] Make local linkage GlobalValue in non-prevailing COMDAT available_externally"
This reverts commit
4fbe33593c8132fdc48647c06f4d1455bfff1c88. It causes linking errors, with details provided internally. (Hopefully the author/reviewers will be able to upstream the internal repro).
Siva Chandra Reddy [Fri, 7 Oct 2022 08:07:59 +0000 (08:07 +0000)]
[libc] Add implementation of pthread_atfork.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D135432
Aaron Ballman [Mon, 10 Oct 2022 18:21:08 +0000 (14:21 -0400)]
Fix a typo in the docs; NFC
sence -> sense
Also re-flowed to the usual 80-col limit and added a comma.
wren romano [Sat, 8 Oct 2022 01:17:27 +0000 (18:17 -0700)]
[mlir][sparse] Removing DLL attributes from ExecutionEngine/SparseTensor/Enums.h
This differential attempts to resolve certain issues on Windows (e.g., https://reviews.llvm.org/D134933#3843372 and https://reviews.llvm.org/D133462#3844195).
Reviewed By: stella.stamenova, aganea
Differential Revision: https://reviews.llvm.org/D135502
Emilia Dreamer [Mon, 10 Oct 2022 17:54:48 +0000 (20:54 +0300)]
[clang-format][docs][NFC] Fix invalid syntax in ShortLambdaStyle examples.
Aaron Ballman [Mon, 10 Oct 2022 18:09:11 +0000 (14:09 -0400)]
Repair a confusing standards reference; NFC
There is no 6.9 in C++11, the quote actually lives in
[intro.multithread] for that revision. However, the words moved in
C++17 to [intro.progress] so I added that information as well.
Craig Topper [Mon, 10 Oct 2022 17:46:29 +0000 (10:46 -0700)]
[TargetLowering][RISCV][X86] Support even divisors in expandDIVREMByConstant.
If the divisor is even, we can first shift the dividend and divisor
right by the number of trailing zeros. Now the divisor is odd and we
can do the original algorithm to calculate a remainder. Then we shift
that remainder left by the number of trailing zeros and add the bits
that were shifted out of the dividend.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D135541
Schrodinger ZHU Yifan [Mon, 10 Oct 2022 18:00:13 +0000 (11:00 -0700)]
Implement `getrandom` function for linux targets.
Reviewed By: michaelrj, sivachandra
Differential Revision: https://reviews.llvm.org/D134665
Jason Molenda [Mon, 10 Oct 2022 17:15:43 +0000 (10:15 -0700)]
Allow DynamicLoaderDarwinKernel to activate without binary
In https://reviews.llvm.org/D133534 I made a little cleanup
to DynamicLoaderDarwinKernel::CreateInstance and unintentionally
changed the logic. Previously it would not create an instance
if there was a binary given to lldb and it was not a kernel.
With my change, the absence of any binary would also cause it
to not create. So connecting to a kernel without any binaries
would fail.
rdar://
100985097
Florian Hahn [Mon, 10 Oct 2022 17:08:34 +0000 (18:08 +0100)]
[LoopSimplifyCFG] Clear SCEV dispositions when removing dead blocks.
When removing loops & blocks we also need to clear the SCEV dispositions
as they may now contain incorrect values.
Fixes #58262.
Thomas Raoux [Fri, 7 Oct 2022 23:59:06 +0000 (23:59 +0000)]
[mlir][linalg] Expose pattern to collapse generic op dimensions
Add a pattern to be able to collapse dimensions in a linalg generic op.
Differential Revision: https://reviews.llvm.org/D135503
Michael Buch [Mon, 10 Oct 2022 13:31:29 +0000 (14:31 +0100)]
[lldb][test] Skip TestStepAvoidsRegexp.py on Windows
Evgeny Shulgin [Fri, 7 Oct 2022 21:46:18 +0000 (21:46 +0000)]
[Clang] Support constexpr builtin fmin
Support constexpr version of __builtin_fmin and its variations.
Reviewed By: jcranmer-intel
Differential Revision: https://reviews.llvm.org/D135493
Troy Johnson [Mon, 10 Oct 2022 15:34:14 +0000 (08:34 -0700)]
[Clang][Sema] Narrow inline namespace filtration for unqualified friend declarations
rG04ba1856 introduced a call to FilterLookupForScope that is expensive
for very large translation units where it was observed to cause a 6%
compile time degradation. As the comment states, the only effect is to
"remove declarations found in inline namespaces for friend declarations
with unqualified names." This change limits the call to that scenario.
The test that was added by rG04ba1856 continues to pass, but the
observed degradation is cut in half.
Differential Revision: https://reviews.llvm.org/D135370
bixia1 [Fri, 7 Oct 2022 19:01:38 +0000 (12:01 -0700)]
[mlir][sparse] Rename SparseTensorFile to SparseTensorReader.
This is to prepare for adding SparseTensorWriter.
Reviewed By: wrengr
Differential Revision: https://reviews.llvm.org/D135477
Florian Hahn [Mon, 10 Oct 2022 15:01:20 +0000 (16:01 +0100)]
[ConstraintElimination] Bail out for GEPs with scalable vectors.
This fixes a crash with scalable vectors, thanks @nikic for spotting
this!
Shubham Narlawar [Mon, 10 Oct 2022 14:47:14 +0000 (16:47 +0200)]
[LICM] Disable thread-safety checks in single-thread model
If the single-thread model is used, or the
-licm-force-thread-model-single flag is specified, skip checks
related to thread-safety. This means that store promotion for
conditionally executed stores only requires proof of
dereferenceability and writability, but not of thread-safety. For
example, this enables promotion of stores to (non-constant) globals,
as well as captured allocas.
Fixes https://github.com/llvm/llvm-project/issues/50537.
Differential Revision: https://reviews.llvm.org/D130466
Alex Brachet [Mon, 10 Oct 2022 14:37:59 +0000 (14:37 +0000)]
Revert "[PGO] Make emitted symbols hidden"
This reverts commit
4ea1a647ff0973c683dd71fec77e6fe7f6dfd2ca.
This breaks on Darwin which tries to export these symbols
https://github.com/llvm/llvm-project/blob/
ebb258d3b0785f6dcc65e1f277d0690891ddc94d/clang/lib/Driver/ToolChains/Darwin.cpp#L1363
I'll try to reland which that removed and approval from
Apple folks.
Joe Nash [Fri, 7 Oct 2022 18:56:36 +0000 (14:56 -0400)]
[AMDGPU] Make V_SAT_PK_U8_I16 a True16 Instruction
The return type is two u8 packed into a 16 bit VGPR, so this instruction
should be True16.
Reviewed By: dp
Differential Revision: https://reviews.llvm.org/D135478
Goran Flegar [Mon, 10 Oct 2022 14:27:53 +0000 (16:27 +0200)]
[mlir][Bazel] Fix for reviews.llvm.org/D135559
Erich Keane [Mon, 10 Oct 2022 14:22:41 +0000 (07:22 -0700)]
Possibly fix sphinx regression from
6685e56ceddf
It isn't clear that this is what it is complaining about, but looking
closer, I think this is what I got wrong here. So submitting this to
hope that the Sphinx build will be happy.
Erich Keane [Tue, 4 Oct 2022 19:41:43 +0000 (12:41 -0700)]
Disallow dereferencing of void* in C++.
as Discussed:
https://discourse.llvm.org/t/rfc-can-we-stop-the-extension-to-allow-dereferencing-void-in-c/65708
There is no good reason to allow this when the other compilers all
reject this, and it messes with SFINAE/constraint checking.
Differential Revision: https://reviews.llvm.org/D135287
Nicolas Vasilache [Mon, 10 Oct 2022 06:36:10 +0000 (23:36 -0700)]
[mlir][Linalg] Retire LinalgStrategyTileAndFusePass and filter-based pattern.
Context: https://discourse.llvm.org/t/psa-retire-linalg-filter-based-patterns/63785
In the process, also retire `tileConsumerAndFuseProducers` that is now replaced by `tileConsumerAndFuseProducerGreedilyUsingSCFForOp`.
Context: https://discourse.llvm.org/t/psa-retire-tileandfuselinalgops-method/63850
When performing this replacement, a change of behavior appeared: the older `tileConsumerAndFuseProducers` would split the parallel
and non-parallel dimensions automatically and perform a first level of tile-and-fuse on parallel dimensions only and then introduce a
second level of tiling-only on the reduction dimensions. The newer `tileConsumerAndFuseProducerGreedilyUsingSCFForOp` on the other hand
does not perform this breakdown. As a consequence, the transform specification is evolved to produce the same output.
Additionally, replace some uses of `unsigned` by `int64_t` where possible without pulling in larger interface changes (left for a future PR).
Context: https://www.youtube.com/watch?v=Puio5dly9N8
Lastly, tests that were performing tile and fuse and distribute on tensors are retired: the generated IR mixing scf.for, tensors and
distributed processor ids was racy at best ..
Differential Revision: https://reviews.llvm.org/D135559
Nico Weber [Mon, 10 Oct 2022 13:19:12 +0000 (09:19 -0400)]
[gn build] port
bc839b4b4e27
Sanjay Patel [Mon, 10 Oct 2022 11:21:23 +0000 (07:21 -0400)]
[InstCombine] fold udiv with common factor
((X *nuw Y) >> Z) / X --> Y >> Z
https://alive2.llvm.org/ce/z/x3kKnq
This is similar to
6b869be8100d /
8da2fa856f1b, but I have
not found a signed equivalent, so it's just an unsigned
match for now.
Sanjay Patel [Mon, 10 Oct 2022 11:08:38 +0000 (07:08 -0400)]
[InstCombine] add 'exact' to udiv test for more coverage; NFC
Sanjay Patel [Mon, 10 Oct 2022 10:51:43 +0000 (06:51 -0400)]
[PhaseOrdering] add test for sdiv with common factor; NFC
issue #58137
Aaron Ballman [Mon, 10 Oct 2022 11:53:52 +0000 (07:53 -0400)]
Fix clang-tools-extra Sphinx build
This should address the issues found in:
https://lab.llvm.org/buildbot/#/builders/115/builds/35504
Peter Rong [Mon, 10 Oct 2022 11:52:31 +0000 (12:52 +0100)]
[AArch64] Add index check before lowerInterleavedStore() uses ShuffleVectorInst's mask
This commit fixes https://github.com/llvm/llvm-project/issues/57326.
Currently we would take a Mask out and directly use it by doing
auto Mask = SVI->getShuffleMask();
However, if the mask is undef, this Mask is not initialized. It might be
a vector of -1 or random integers.
This would cause an Out-of-bound read later when trying to find a
StartMask.
This change checks if all indices in the Mask is in the allowed range,
and fixes the out-of-bound accesses.
Differential Revision: https://reviews.llvm.org/D132634
Michael Buch [Thu, 6 Oct 2022 23:35:05 +0000 (00:35 +0100)]
[lldb][CPlusPlusLanguage] Respect the step-avoid-regex for functions with auto return types
**Summary**
The primary motivation for this patch is to make sure we handle
the step-in behaviour for functions in the `std` namespace which
have an `auto` return type. Currently the default `step-avoid-regex`
setting is `^std::` but LLDB will still step into template functions
with `auto` return types in the `std` namespace.
**Details**
When we hit a breakpoint and check whether we should stop, we call
into `ThreadPlanStepInRange::FrameMatchesAvoidCriteria`. We then ask
for the frame function name via `SymbolContext::GetFunctionName(Mangled::ePreferDemangledWithoutArguments)`.
This ends up trying to parse the function name using `CPlusPlusLanguage::MethodName::GetBasename` which
parses the raw demangled name string.
`CPlusPlusNameParser::ParseFunctionImpl` calls `ConsumeTypename` to skip
the (in our case auto) return type of the demangled name (according to the
Itanium ABI this is a valid thing to encode into the mangled name). However,
`ConsumeTypename` doesn't strip out a plain `auto` identifier
(it will strip a `decltype(auto) return type though). So we are now left with
a basename that still has the return type in it, thus failing to match the `^std::`
regex.
Example frame where the return type is still part of the function name:
```
Process 1234 stopped
* thread #1, stop reason = step in
frame #0: 0x12345678 repro`auto std::test_return_auto<int>() at main.cpp:12:5
9
10 template <class>
11 auto test_return_auto() {
-> 12 return 42;
13 }
```
This is another case where the `CPlusPlusNameParser` breaks us in subtle ways
due to evolving C++ syntax. There are longer-term plans of replacing the hand-rolled
C++ parser with an alternative that uses the mangle tree API to do the parsing for us.
**Testing**
* Added API and unit-tests
* Adding support for ABI tags into the parser is a larger undertaking
which we would rather solve properly by using libcxxabi's mangle tree
parser
Differential Revision: https://reviews.llvm.org/D135413
David Spickett [Thu, 6 Oct 2022 10:41:42 +0000 (10:41 +0000)]
[LLDB] Complete set of char tests for static integral members
Previously we had a bit of a mix of "signed char" "unsigned char" and
"char".
This adds seperate min and max checks for all three types.
Depends on D135170
Reviewed By: Michael137
Differential Revision: https://reviews.llvm.org/D135352
Simon Giesecke [Mon, 10 Oct 2022 10:03:05 +0000 (12:03 +0200)]
Add llvm-gsymutil to the Bazel build files.
Differential Revision: https://reviews.llvm.org/D135568
Matt Devereau [Thu, 8 Sep 2022 11:22:11 +0000 (11:22 +0000)]
[AArch64][SVE] Fix AArch64_SVE_VectorCall calling convention
This fixes the case where callees with SVE arguments outside of the z0-z7
range were incorrectly deduced as SVE calling convention functions
Adeel Ahmad [Mon, 10 Oct 2022 08:31:50 +0000 (10:31 +0200)]
Extended Documentation of LLVM_TARGETS_TO_BUILD by listing all possible values
Differential Revision: https://reviews.llvm.org/D135431
Nikita Popov [Fri, 7 Oct 2022 09:54:17 +0000 (11:54 +0200)]
[Attributor] Use ConstantFoldLoadFromConst()
When determining the initial value of the object, use the constant
folding API to load a given type at a given offset in the global
initializer. This makes it work for cases where the load doesn't
directly correspond to an aggregate member.
Differential Revision: https://reviews.llvm.org/D135435
Nikita Popov [Fri, 7 Oct 2022 10:10:42 +0000 (12:10 +0200)]
[Bindings] Remove go bindings
Remove the unmaintained Go bindings per
https://discourse.llvm.org/t/rfc-remove-the-go-bindings/65725.
The tinygo project provides maintained Go bindings at
https://github.com/tinygo-org/go-llvm.
Differential Revision: https://reviews.llvm.org/D135436
Nikita Popov [Mon, 10 Oct 2022 07:53:34 +0000 (09:53 +0200)]
[AA] Remove deprecated ModRefInfo helpers (NFC)
Adrian Kuegel [Wed, 5 Oct 2022 08:08:18 +0000 (10:08 +0200)]
[mlir][Linalg] Use ConfinedAttr for dimensions of ReduceOp.
We can use the new DenseArrayStrictlySorted constraint.
Differential Revision: https://reviews.llvm.org/D135246
LLVM GN Syncbot [Mon, 10 Oct 2022 07:30:41 +0000 (07:30 +0000)]
[gn build] Port
1ae33bf42680
Carlos Galvez [Tue, 23 Aug 2022 06:14:03 +0000 (06:14 +0000)]
[clang-tidy] Add cppcoreguidelines-avoid-do-while check
Implements rule ES.75 of C++ Core Guidelines.
Differential Revision: https://reviews.llvm.org/D132461
Valentin Clement [Mon, 10 Oct 2022 06:58:20 +0000 (08:58 +0200)]
[flang] Allow conversion from boxed derived type to fir.class
This patch updates the fir.convert operation's verifier to allow
conversion from !fir.box<!fir.type<T>> to !fir.class<!fir.type<T>>.
Other conversion involving fir.class are likely needed but will
be added when lowering needs them.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D135445
LiaoChunyu [Sun, 9 Oct 2022 13:52:36 +0000 (21:52 +0800)]
[RISCV] Use hasAllWUsers to recover XORI/ORI
reference
0fbe71e91f44.
Also add testcase for addi.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D135538
Lang Hames [Mon, 10 Oct 2022 05:00:43 +0000 (22:00 -0700)]
[examples] Fix deprecated use of llvm::empty.
Lang Hames [Mon, 10 Oct 2022 04:54:35 +0000 (21:54 -0700)]
[ORC] Relax assertions in SimpleRemoteEPCTransport.
Null source/destination pointers are ok for zero-sized messages.
Lang Hames [Mon, 10 Oct 2022 04:54:09 +0000 (21:54 -0700)]
[LLJIT] Default to EPCEHFrameRegistrar rather than InProcessEHFrameRegistrar.
Now that ExecutionSession objects alway have ExecutorProcessControl (EPC)
objects attached we can use EPCEHFrameRegistrar by default, rather than
InProcessEHFrameRegistrar. This allows LLJIT to work out-of-the-box with remote
EPCs on platforms that use JITLink, without requiring a custom
ObjectLinkingLayerCreator to override the eh-frame registrar.
Craig Topper [Mon, 10 Oct 2022 03:40:38 +0000 (20:40 -0700)]
[RISCV] Remove some vsetvli intrinsics under Zve32*.
Zve32* does not support SEW=64. Or any LMUL smaller than 32/SEW.
Reviewed By: eopXD
Differential Revision: https://reviews.llvm.org/D135519