Florian Hahn [Tue, 25 Apr 2023 19:33:29 +0000 (20:33 +0100)]
[ConstraintElim] Split up test case to it easier for Alive2 to verify.
Split up larger test functions into 2 versions, one with the checks in
the then and one with the checks in the else block.
The original versions of the function caused timeouts even with larger
thresholds. The new versions verify very quickly.
Julian Lettner [Fri, 21 Apr 2023 22:14:42 +0000 (15:14 -0700)]
[MachO] Disable atexit()-based lowering when LTO'ing kernel/kext code
The kernel and kext environments do not provide the `__cxa_atexit()`
function, so we can't use it for lowering global module destructors.
Unfortunately, just querying for "compiling for kernel/kext?" in the LTO
pipeline isn't possible (kernel/kext identifier isn't part of the triple
yet) so we need to pass down a CodeGen flag.
rdar://
93536111
Differential Revision: https://reviews.llvm.org/D148967
Philip Reames [Tue, 25 Apr 2023 18:57:46 +0000 (11:57 -0700)]
[SCEV] Common code for computing trip count in a fixed type [NFC-ish]
This is a follow on to D147117 and D147355. In both cases, we were adding special cases to compute zext(BTC+1) instead of zext(BTC)+1 when the BTC+1 computation was known not to overflow.
Differential Revision: https://reviews.llvm.org/D148661
Florian Hahn [Tue, 25 Apr 2023 18:51:23 +0000 (19:51 +0100)]
[ConstraintElim] Add tests for mul nsw and signed predicates.
Joseph Huber [Tue, 25 Apr 2023 18:32:17 +0000 (13:32 -0500)]
[libc] Fix including 'libc_errno.h' incorrectly
Summary:
This causes problems when included. Fix this to hopefully get the bots
working again.
Joseph Huber [Tue, 25 Apr 2023 18:25:45 +0000 (13:25 -0500)]
[libc][fix] Add missing 'errno' header for the GPU libc
Summary:
The previous GPU `libc` patch added support for `atoi`. However, it
didn't also enable generating the errno header. This caused including it
to use the system's header which invariably will cause compiler
problems.
Martin Storsjö [Sun, 23 Apr 2023 19:51:59 +0000 (22:51 +0300)]
[compiler-rt] [test] Add an .exe suffix for unit test executables on MinGW
Previously, an .exe suffix was only added for MSVC configurations.
In practice, an .exe suffix is added implicitly by MinGW toolchains
if the output is a suffixless file name. However this can cause lots
of subtle build system confusion, when it's not generating the file it
expected.
Differential Revision: https://reviews.llvm.org/D149029
Craig Topper [Tue, 25 Apr 2023 17:49:57 +0000 (10:49 -0700)]
[RISCV] Rename hasNonZeroAVL->isNonZeroAVL. NFC
The argument is the AVL itself, not some operation that has an AVL.
Thus "is" instead of "has" is a better name.
Jorge Gorbe Moya [Tue, 25 Apr 2023 17:46:58 +0000 (10:46 -0700)]
Joseph Huber [Mon, 24 Apr 2023 23:28:54 +0000 (18:28 -0500)]
[libc] Ignore 'errno' on the GPU and support 'atoi'
The 'errno' value is most likely not useful on the GPU and it prevents
us from providing certain functions on the GPU that depend on it, like
`atoi`. This patch makes the necessary changes to support `errno` by
simple replacing it with a consumer class.
Supporting `errno` on the GPU is possible in some aspects. The first
approach would be to use a buffer of shared memory that has enough space
for all threads. Another option would be to change code generation to
support `thread_local` using `address_space(5)` memory allocated at
kernel launch. The former could look like the following, which could be
implemented in a later patch:
```
template <typename T>
using SharedBuffer = T[gpu::MAX_THREADS] [[clang::address_space(3)]];
template <typename T> struct ErrnoSetter {
constexpr ErrnoSetter(SharedBuffer<T> &storage) : storage(storage) {}
SharedBuffer<T> &storage;
void operator=(const T &val) { storage[gpu::get_thread_id()] = val; }
};
static SharedBuffer<int> thread_local_buffer [[clang::loader_uninitialized]];
ErrnoSetter<int> __llvmlibc_internal_errno(thread_local_buffer);
```
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D149107
Markus Mützel [Tue, 25 Apr 2023 17:09:20 +0000 (10:09 -0700)]
[flang] Avoid dependency of runtime library on pthread for MinGW
When building the Fortran runtime on MinGW, `clock_gettime` is currently used. That function is provided by the `pthread` library on that platform. That means that all programs that link `libFortranRuntime` also require to be linked with `pthread` on that platform.
There is already a code path (for MSVC) that doesn't use `clock_gettime` in the implementation of the Fortran library.
Use the same code path also on MinGW by undefining `CLOCKID`.
Reviewed By: vzakhari
Differential Revision: https://reviews.llvm.org/D149051
Slava Zakharin [Tue, 25 Apr 2023 16:45:45 +0000 (09:45 -0700)]
[flang] Account for .exe suffix in test/Driver/omp-driver-offload.f90.
I believe this test started failing pre-commit testing after D148038.
For example:
https://buildkite.com/llvm-project/premerge-checks/builds/148654#
0187b72b-7360-4c52-be94-
93eefcb269f4
https://buildkite.com/llvm-project/premerge-checks/builds/148642#
0187b691-15a7-44c4-ae23-
c7e97ec67755
On Windows the .exe suffix is used for clang-offload-packager tool:
"c:\\program files\\llvm\\bin\\clang-offload-packager.exe" ...
At the same time, I believe I have seen this test sporadically fail before,
meaning that the .exe suffix is not added consistently. I am not sure
why this might be happening. I decided just to allow the suffix.
Alex Bradbury [Tue, 25 Apr 2023 16:53:12 +0000 (17:53 +0100)]
[RISCV][NFC] Pull select->binop identities used in lowerSelect to a helper function
This will allow reusing the same logic for a select combine.
Tobias Hieta [Tue, 25 Apr 2023 07:54:33 +0000 (09:54 +0200)]
[docs] Update HowToReleaseLLVM documentation.
There was a bunch of references to bugzilla and other old
instructions in there. I have updated it to match the current
reality.
Reviewed By: tstellar
Differential Revision: https://reviews.llvm.org/D149131
Cullen Rhodes [Tue, 25 Apr 2023 16:45:38 +0000 (16:45 +0000)]
[AArch64][SME] NFC: Fix comment in enum class
Slava Zakharin [Mon, 24 Apr 2023 18:09:57 +0000 (11:09 -0700)]
[flang][runtime] Added Clang CMake modules include path.
Fortran runtime standalone build is broken after D140998
because of the missing CMake modules path. This is a fix.
Differential Revision: https://reviews.llvm.org/D149090
OCHyams [Tue, 25 Apr 2023 15:21:42 +0000 (16:21 +0100)]
[DebugInfo] Treat empty metadata operands the same as undef operands
A `ValueAsMetadata` may be replaced with nullptr for several reasons including
deleting values and value remapping a use-before-def. In the case of a
`MetadataAsValue` user, `handleChangedOperand` intercepts and replaces the
metadata with an empty tuple (`!{}`).
At the moment, an empty metadata operand in a debug intrinsics signals that it
can be deleted.
Given that we end up with empty metadata operands in circumstances where the
Value has been "lost" the current behaviour can lead to incorrect variable
locations. Instead, we should treat empty metadata as meaning "there is no
location for the variable" (the same as we currently treat undef operands).
This patch changes `isKillLocation` to take this into account.
Related to https://discourse.llvm.org/t/auto-undef-debug-uses-of-a-deleted-value
Reviewed By: StephenTozer
Differential Revision: https://reviews.llvm.org/D140902
Aaron Ballman [Tue, 25 Apr 2023 15:29:22 +0000 (11:29 -0400)]
Fix codegen for initialization of global atomics
This amends
2e275e24355cb224981f9beb2b026a3169fc7232. That commit added
a null to pointer cast kind when determining whether the expression can
be a valid constant initializer, but failed to update the constant
expression evaluator to perform the evaluation. This commit updates the
constant expression evaluator to handle that cast kind.
OCHyams [Tue, 25 Apr 2023 14:39:31 +0000 (15:39 +0100)]
[DebugInfo] Replace UndefValue with PoisonValue in DIArgList::handleChangedOperand
This helps towards the effort to remove UndefValue from LLVM.
Related to https://discourse.llvm.org/t/auto-undef-debug-uses-of-a-deleted-value
Reviewed By: nlopes
Differential Revision: https://reviews.llvm.org/D140991
Emilio Cota [Tue, 25 Apr 2023 14:26:02 +0000 (10:26 -0400)]
[mlir] ActionTracing: require ASSERTS for debugcounter test
While at it, fix some typos.
Differential Revision: https://reviews.llvm.org/D149159
Jay Foad [Tue, 25 Apr 2023 09:26:46 +0000 (10:26 +0100)]
[AMDGPU] Do not handle _SGPR SMEM instructions in SILoadStoreOptimizer
After D147334 we never select _SGPR forms of SMEM instructions on
subtargets that also support the _SGPR_IMM form, so there is no need to
handle them here.
Differential Revision: https://reviews.llvm.org/D149139
Doru Bercea [Tue, 25 Apr 2023 14:05:07 +0000 (10:05 -0400)]
Disable private mapping test for AMD GPU due to intermittent fails.
Victor Perez [Mon, 24 Apr 2023 08:51:11 +0000 (09:51 +0100)]
[mlir][llvm][test] Move exception-related tests to their own file
Move mlir-translate exception-related tests from basic.ll to exception.ll.
Signed-off-by: Victor Perez <victor.perez@codeplay.com>
Differential Revision: https://reviews.llvm.org/D149043
Zhongyunde [Tue, 25 Apr 2023 13:47:41 +0000 (21:47 +0800)]
[InstSimplify] with logical ops: (X | Y) ? 0 : X --> 0
Use simplifySelectWithICmpEq to handle the implied equalities from the icmp-or,
then both of ICMP_NE and ICMP_EQ will be addressed
(X | Y) == 0 ? X : 0 --> 0 (commuted 2 ways)
(X | Y) != 0 ? 0 : X --> 0 (commuted 2 ways)
Fixes https://github.com/llvm/llvm-project/issues/62263
Reviewed By: nikic, RKSimon
Differential Revision: https://reviews.llvm.org/D148986
Nikita Popov [Mon, 24 Apr 2023 13:22:20 +0000 (15:22 +0200)]
Reapply [InstSimplify] Support all instructions in simplifyWithOpReplaced()
Relative to the previous attempt, this includes a bailout for phi
nodes, whose arguments might refer to a previous cycle iteration.
We did not hit this before by a fortunate deficiency of the
ConstantFoldInstOperands() API, which doesn't handle phi nodes,
unlike ConstantFoldInstruction().
-----
Instead of hardcoding a few instruction kinds, use the generic
interface now that we have it.
The primary effect of this is that intrinsics are now supported.
It's worth noting that this is still limited in that it does not
support vectors, so we can't remove e.g. existing fshl special
cases.
Zhongyunde [Tue, 25 Apr 2023 13:39:06 +0000 (21:39 +0800)]
[tests] precommit tests for D148986
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149115
Nikita Popov [Tue, 25 Apr 2023 13:40:43 +0000 (15:40 +0200)]
[InstSimplify] Add test for select op replacement in phi (NFC)
NAKAMURA Takumi [Wed, 1 Mar 2023 22:16:44 +0000 (07:16 +0900)]
TableGen: Introduce `!range` operator for half-opened interval
`!range(a, b)` generates a list `[a,b)`. `a` is optional and `0` by default.
- `!range(-1, 4)` generates `[-1, 0, 1, 2, 3]`
- `!range(4)` generates `[0, 1, 2, 3]`
- `!range(2, 2)` generates `[]<list<int>>`
`!range(list)` is equivalent to `!range(0, !size(list))`.
Differential Revision: https://reviews.llvm.org/D145871
NAKAMURA Takumi [Tue, 25 Apr 2023 13:35:33 +0000 (22:35 +0900)]
Reformat
OCHyams [Tue, 25 Apr 2023 13:36:38 +0000 (14:36 +0100)]
Revert "[DebugInfo] Print empty MDTuples wrapped in MetadataAsValue inline"
This reverts commit
1e6fe677f8aa98518e05218affa16e468819f5ed (D140900).
Buildbot: https://lab.llvm.org/buildbot/#/builders/196/builds/29937
Nikita Popov [Tue, 25 Apr 2023 13:20:36 +0000 (15:20 +0200)]
[LoopVectorize] Convert test to opaque pointers (NFC)
Jeremy Morse [Tue, 25 Apr 2023 13:04:41 +0000 (14:04 +0100)]
[DebugInfo][CSInfo] Avoid crash when defining super-regs
In rare situations involving AVX intrinsics, it seems LLVM can be coaxed
into generating copies to arguments that look like this:
$xmm0 = VMOVAPSrr $xmm1, implicit-def $ymm0
CALL64 @something ymm0
This particular form of copy implicitly zeros the upper lanes of ymm0,
hence there's an implicit-def for the register in the copy. The X86
implementation of describeLoadedValue doesn't attempt to describe this sort
of copy which causes the generic implementation in
TargetInstrInfo::describeLoadedValue to fire an assertion saying it
expected the target hook to handle it.
Play it safe in the generic implementation and return the "no location /
value" return value, rather than asserting.
Differential Revision: https://reviews.llvm.org/D148626
OCHyams [Tue, 25 Apr 2023 10:24:30 +0000 (11:24 +0100)]
[DebugInfo] Print empty MDTuples wrapped in MetadataAsValue inline
This improves the readability of debugging intrinsics. Instead of:
call void @llvm.dbg.value(metadata !2, ...)
!2 = !{}
We will see:
call void @llvm.dbg.value(metadata !{}, ...)
!2 = !{}
Note that we still get a numbered metadata entry for the node even if it's not
used elsewhere. This is to avoid adding more context to the print functions.
This is already legal IR - LLVM can parse and understand it - so there is no
need to update the parser.
The next patches in this stack will make such empty metadata operands more
common and semantically important.
Related to https://discourse.llvm.org/t/auto-undef-debug-uses-of-a-deleted-value
Reviewed By: StephenTozer
Differential Revision: https://reviews.llvm.org/D140900
Benjamin Kramer [Tue, 25 Apr 2023 12:57:09 +0000 (14:57 +0200)]
[MC] Eagerly skip zero-sized .fill fragments
This doesn't change the output in any way, but we have a bunch of
emitFill for padding. When emitting an array of floats we'd end up with
DataFragment float1
FillFragment 0
DataFragment float2
FillFragment 0
... and so on
We never actually emit anything for those fills, neither in asm nor obj
emission mode, they just consume RAM for no reason.
Jay Foad [Tue, 25 Apr 2023 11:07:00 +0000 (12:07 +0100)]
[AMDGPU] Move GCN-specific stuff out of AMDGPUISelLowering. NFC.
Differential Revision: https://reviews.llvm.org/D149145
Tom Eccles [Tue, 25 Apr 2023 12:24:46 +0000 (12:24 +0000)]
[flang][hlfir] inline hlfir.transpose as hlfir.elemental
Inlining as a hlfir.elemental will allow the transpose to be inlined
into subsequent operations in some cases. For example,
y = TRANSPOSE(x)
z = y * 2
Will operate in a single loop without creating a temporary for the
TRANSPOSE (unlike the runtime call, which always allocates).
This is in a new SimplifyHLFIRIntriniscs pass. The intention is that some
day that pass might replace the FIR SimplifyIntrinsics pass.
Depends On: D149060
Reviewed By: jeanPerier, vzakhari
Differential Revision: https://reviews.llvm.org/D149067
Tom Eccles [Tue, 25 Apr 2023 12:24:08 +0000 (12:24 +0000)]
[flang][hlfir] get constant extents when possible
If we know the extent at compile time, it is better to generate an
arith.constant than hlfir.get_extent. This gives more information earlier
in compilation (before hflir.get_extent is lowered).
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D149060
Mikhail Goncharov [Tue, 25 Apr 2023 12:37:23 +0000 (14:37 +0200)]
Nikita Popov [Tue, 25 Apr 2023 12:25:57 +0000 (14:25 +0200)]
[SCEV] Regenerate test checks (NFC)
I was very confused by this change while working on a patch --
turns out that it's pre-existing, and we currently just match the
"1" part of "13".
Zhongyunde [Tue, 25 Apr 2023 11:36:12 +0000 (19:36 +0800)]
[MergeICmps] Adapt to non-eq comparisons, bugfix
Fix the last runtime issue as some sequent comparisons need be spilted.
For the origin equal comparisons chain, the new spilted Icmp chain will
still be end with equal, while for the new not-equal comparisons chain,
the new spilted Icmp chain will still be end with equal, so should address
this carefully, see detail wih case partial_sequent_ne
Thanks for @aeubanks, @glandium and @ayzhao report the runtime issue
and carefully examine.
Fix https://github.com/llvm/llvm-project/issues/59740.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D141188
Alex Bradbury [Tue, 25 Apr 2023 11:38:04 +0000 (12:38 +0100)]
[RISCV][NFC] Fix typo in comment in RISCVISelLowering
SELECT_CC is expanded to SETT and SELECT.
Alvin Wong [Sat, 22 Apr 2023 14:38:53 +0000 (22:38 +0800)]
[compiler-rt][test] Add `--large-address-aware` link flag for MinGW
The interception tests rely on the test binary being large address
aware. This has already been set for MSVC builds. Now we do the same for
MinGW.
This fixes the interception unit tests for i686-w64-windows-gnu target.
Differential Revision: https://reviews.llvm.org/D148996
Alvin Wong [Sat, 22 Apr 2023 11:33:53 +0000 (19:33 +0800)]
[compiler-rt][asan] Add report on intercept fail to more places
Use `ASAN_INTERCEPT_FUNC` instead of `INTERCEPT_FUNCTION` so it checks
the return value and reports a message if verbosity >= 1.
Differential Revision: https://reviews.llvm.org/D148989
Haojian Wu [Wed, 19 Apr 2023 21:54:22 +0000 (23:54 +0200)]
[clangd] Add support TextDocumentEdit.
This is an initial patch to add TextDocumentEdit (versioned edits) support in
clangd, the scope is minimal:
- add and extend the corresponding protocol structures
- propagate the documentChanges for diagnostic codeactions (our motivated case)
Differential Revision: https://reviews.llvm.org/D148783
Nikita Popov [Tue, 25 Apr 2023 10:55:36 +0000 (12:55 +0200)]
[LoopReroll] Convert tests to opaque pointers (NFC)
Nikita Popov [Tue, 25 Apr 2023 10:55:21 +0000 (12:55 +0200)]
[LoopReroll] Regenerate test checks (NFC)
Max Kazantsev [Tue, 25 Apr 2023 09:40:37 +0000 (16:40 +0700)]
[SCEV] Support sub in and negative constants willNotOverflow
This lifts two TODOs from this function, allowing us to prove
no-overflow whether it happens through max int (up) or through
min int (down) for both and and sub.
Differential Revision: https://reviews.llvm.org/D148618
Reviewed By: dmakogon
Nikita Popov [Tue, 25 Apr 2023 08:51:25 +0000 (10:51 +0200)]
[LICM] Add additional "free instruction" tests (NFC)
Luke Lau [Fri, 21 Apr 2023 13:50:35 +0000 (14:50 +0100)]
[SLP] Deduplicate loads subkey generator. NFCI
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D148923
Luke Lau [Tue, 18 Apr 2023 17:29:20 +0000 (18:29 +0100)]
[RISCV] Fix interleave crash on unary interleaves
We were crashing when lowering interleave shuffles like
(shuffle <0,3,1,4>, x:v4i8, y:v4i8)
Where it was technically an unary shuffle (both EvenSrc and OddSrc point
to the first operand), but the resulting extract_subvectors were out of
bounds.
This checks to make sure that the vectors being extracted are within
range.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D148647
Nikita Popov [Tue, 25 Apr 2023 08:07:30 +0000 (10:07 +0200)]
[LICM] Remove redundant test (NFC)
Drop the separate opaque pointers test now that the original one
uses opaque pointers as well.
Nikita Popov [Tue, 25 Apr 2023 08:06:39 +0000 (10:06 +0200)]
[LICM] Regenerate test checks (NFC)
Nikita Popov [Tue, 25 Apr 2023 07:57:39 +0000 (09:57 +0200)]
[LICM] Only forget loop/block dispositions
As we are moving the instruction without changing its value, it
is sufficient to only invalidate the loop/block dispositions.
This is the same we do in LoopSink.
Cullen Rhodes [Tue, 25 Apr 2023 07:38:09 +0000 (07:38 +0000)]
[mlir][ArmSME] Add tests for Streaming SVE
This patch adds a couple of tests for targeting Arm Streaming SVE (SSVE)
mode, part of the Arm Scalable Matrix Extension (SME).
SSVE is enabled in the backend at the function boundary by specifying
the `aarch64_pstate_sm_enabled` attribute, as documented here [1]. SSVE
can be targeted from MLIR by specifying this in the passthrough
attributes [2] and compiling with
-mattr=+sme,+sve -force-streaming-compatible-sve
The passthrough will propagate to the backend where `smstart/smstop`
will be emitted around the call to the SSVE function.
The set of legal instructions changes in SSVE,
`-force-streaming-compatible-sve` avoids the use of NEON entirely and
instead lowers to (streaming-compatible) SVE. The behaviour this flag
predicates will be hooked up to the function attribute in the future
such that simply specifying this (should) lead to correct
code-generation.
Two tests are added:
* A basic LLVMIR test verifying the attribute is passed through.
* An integration test calling a SSVE function.
The integration test can be run with QEMU.
[1] https://llvm.org/docs/AArch64SME.html
[2] https://mlir.llvm.org/docs/Dialects/LLVM/#attribute-pass-through
Reviewed By: awarzynski, aartbik
Differential Revision: https://reviews.llvm.org/D148111
Bing1 Yu [Tue, 25 Apr 2023 07:47:33 +0000 (15:47 +0800)]
[ValueMapper] allow mapping ConstantTargetNone to its layout type
zeroinitializer is allowed for spirv TargetExtType.
This PR allows ValueMapper to map TargetExtType ConstantTargetNone to '0' constant of its layout type.
Reviewed By: jcranmer-intel
Differential Revision: https://reviews.llvm.org/D148774
Mehdi Amini [Tue, 25 Apr 2023 07:08:20 +0000 (00:08 -0700)]
[MLIR][doc] Fix the [TOC] tag in two doc
Somehow it was escaped in these documents.
Jean Perier [Tue, 25 Apr 2023 07:05:37 +0000 (09:05 +0200)]
[flang][runtime] Fix padding in CHARACTER(4) assignments.
One piece of pointer arithmetic was adding the number of bytes instead
of the number of characters. This caused failures in CHARACTER(KIND>1)
that required padding.
This was caught using HLFIR that currently uses the runtime for array
assignment where the current lowering does everything inline.
Reviewed By: vzakhari, klausler
Differential Revision: https://reviews.llvm.org/D149062
Jean Perier [Tue, 25 Apr 2023 07:03:55 +0000 (09:03 +0200)]
[flang][hlfir] Support fir.declare in AbstractResult pass
The AbstractResult pass replaces allocation of function result on the callee
side per an extra argument so that the allocation of the result can be
done on the caller stack.
It looks for the result allocation from the fir.return op, so it needs
to handle (in a transparent way) a fir.declare in the chain between the
allocation and the fir.return.
Reviewed By: vzakhari, clementval
Differential Revision: https://reviews.llvm.org/D149057
Jean Perier [Tue, 25 Apr 2023 07:02:18 +0000 (09:02 +0200)]
[flang][hlfir] Lower NULL(MOLD) to a variable
HLFIR lowering promotes intrinsic results lowered in memory to
hlfir.expr to underline their read-only aspect once they are created.
NULL(MOLD) should not be promoted to an hlfir.expr, it is the NULL
variable (we need to see it as an address).
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D149053
Timm Bäder [Mon, 24 Apr 2023 12:30:54 +0000 (14:30 +0200)]
[clang][Interp] Fix zero-init of float and pointer arrays
Our Zero opcode only exists for integer types. Use
visitZeroInitializer() here as well so it works for floats and pointers.
Differential Revision: https://reviews.llvm.org/D149059
Kazu Hirata [Tue, 25 Apr 2023 06:31:48 +0000 (23:31 -0700)]
[libc] Fix typos in documentation
Fangrui Song [Tue, 25 Apr 2023 06:18:59 +0000 (23:18 -0700)]
[Driver] Remove no-op -frewrite-map-file=
This option has been a no-op since D99707.
Kazu Hirata [Tue, 25 Apr 2023 06:15:55 +0000 (23:15 -0700)]
[clang] Modernize SkipBodyInfo (NFC)
Piyou Chen [Tue, 25 Apr 2023 06:09:56 +0000 (23:09 -0700)]
[RISCV][NFC] skip non-RISCV target test riscv32-zihintntl.c
Reviewed By: kito-cheng
Differential Revision: https://reviews.llvm.org/D149126
Timm Bäder [Sat, 22 Apr 2023 04:40:54 +0000 (06:40 +0200)]
[clang][Interp] PointerToBoolean casts
Just emit e != nullptr for these.
Differential Revision: https://reviews.llvm.org/D148981
Vlad Serebrennikov [Tue, 25 Apr 2023 06:03:14 +0000 (09:03 +0300)]
[clang] Add test for CWG1821
[[https://wg21.link/p1787 | P1787]]: My clarification in [[ http://lists.isocpp.org/core/2019/06/6614.php | “Where can namespace-scope functions and variables be redeclared?” ]] is applied, resolving CWG1821.
Wording: (If the declaration is not a friend declaration:) If the id-expression in a declarator-id is a qualified-id Q, let S be its lookup context; the declaration shall inhabit a namespace scope. ([dcl.meaning]/1)
Reviewed By: shafik, #clang-language-wg
Differential Revision: https://reviews.llvm.org/D149003
Fangrui Song [Tue, 25 Apr 2023 05:59:54 +0000 (22:59 -0700)]
[Driver] Simplify handling of -mabi=vec-default -mabi=vec-extabi
And fix a minor issue that -mabi=vec-extabi -mabi=vec-default should not pass
"-bplugin_opt:-vec-extabi" to ld.
Owen Anderson [Tue, 25 Apr 2023 05:52:18 +0000 (22:52 -0700)]
Revert "Remove code only needed to detect a pre-4.0 API break."
This reverts commit
17a3fbf2a3683f862de52e0058110eb8b356be56
due to build failures in llvm/unittests/ADT/IListTest.cpp
Owen Anderson [Tue, 25 Apr 2023 05:23:38 +0000 (22:23 -0700)]
Remove code only needed to detect a pre-4.0 API break.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D149122
Timm Bäder [Sun, 23 Apr 2023 08:08:44 +0000 (10:08 +0200)]
[clang][AST][NFC] Turn some single-line comments into doc comments
Emilio Cota [Tue, 25 Apr 2023 04:53:03 +0000 (00:53 -0400)]
[bazel][mlir] Fold :Observers and :BreakpointManagers into :Debug
To avoid circular deps.
While at it, add missing dep on CAPIIR.
Ethan Luis McDonough [Tue, 25 Apr 2023 04:35:19 +0000 (23:35 -0500)]
[flang] Feature list plugin
Plugin that counts the number of times each tree node occurs in a given program. Used for test coverage.
Updated to fix build issues.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D143704
Jie Fu [Tue, 25 Apr 2023 03:54:16 +0000 (11:54 +0800)]
[RISCV] Fix -Wdeprecated-declarations in RISCVInstrInfo.cpp (NFC)
/Users/jiefu/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp:2636:10: error: 'makeArrayRef<std::pair<llvm::MachineMemOperand::Flags, const char *>, 2UL>' is deprecated: Use deduction guide instead [-Werror,-Wdeprecated-declarations]
return makeArrayRef(TargetFlags);
^~~~~~~~~~~~
ArrayRef
/Users/jiefu/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:572:3: note: 'makeArrayRef<std::pair<llvm::MachineMemOperand::Flags, const char *>, 2UL>' has been explicitly marked deprecated here
LLVM_DEPRECATED("Use deduction guide instead", "ArrayRef")
^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/Compiler.h:143:50: note: expanded from macro 'LLVM_DEPRECATED'
^
1 error generated.
Alex Zinenko [Sat, 22 Apr 2023 08:57:10 +0000 (08:57 +0000)]
[mlir] detensorize: don't accidentally convert function entry blocks
In the Linalg detensorize pass, dialect conversion could accidentally
trigger signature conversion of the function entry block after inlining
the body of a Linalg generic into it. Such a conversion is not desirable
because it would break the internal validity of the function op, that is
futhermore not supposed to be detensorized at the boundary. Mitigate
this by creating a dummy (empty) entry block so Linalg operations are
never inlined into it and the conversion is never triggered.
Closes #62249.
Reviewed By: silvas
Differential Revision: https://reviews.llvm.org/D148983
LLVM GN Syncbot [Tue, 25 Apr 2023 03:20:33 +0000 (03:20 +0000)]
[gn build] Port
8a3950510f81
Piyou Chen [Tue, 25 Apr 2023 02:58:38 +0000 (19:58 -0700)]
[RISCV] Support scalar/fix-length vector NTLH intrinsic with different domain
This commit implements the two NTLH intrinsic functions.
```
type __riscv_ntl_load (type *ptr, int domain);
void __riscv_ntl_store (type *ptr, type val, int domain);
```
```
enum {
__RISCV_NTLH_INNERMOST_PRIVATE = 2,
__RISCV_NTLH_ALL_PRIVATE,
__RISCV_NTLH_INNERMOST_SHARED,
__RISCV_NTLH_ALL
};
```
We encode the non-temporal domain into MachineMemOperand flags.
1. Create the RISC-V built-in function with custom semantic checking.
2. Assume the domain argument is a compile time constant,
and make it as LLVM IR metadata (nontemp_node).
3. Encode domain value as two bits MachineMemOperand TargetMMOflag.
4. According to MachineMemOperand TargetMMOflag, select corrsponding ntlh instruction.
Currently, it supports scalar type and fixed-length vector type.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D143364
Fangrui Song [Tue, 25 Apr 2023 03:11:21 +0000 (20:11 -0700)]
-Wframe-larger-than=: improve error with an invalid argument
Remove a FIXME. For simplicity, the error message for the missing argument case
has changed from err_drv_missing_argument to err_drv_invalid_argument_to_option,
which should be fine.
Matt Arsenault [Mon, 17 Apr 2023 19:01:11 +0000 (15:01 -0400)]
ValueTracking: Add ordered negative handling for fmul to computeKnownFPClass
Port from the existing handling in cannotBeOrderedLessThanZero
Matt Arsenault [Sun, 9 Apr 2023 11:16:56 +0000 (07:16 -0400)]
ValueTracking: Handle fptrunc_round in computeKnownFPClass
Emilio Cota [Tue, 25 Apr 2023 02:11:22 +0000 (22:11 -0400)]
[bazel][mlir] Build Debug/BreakpointManagers only from a single target
When writing
5f2b0892d "[bazel][mlir] BreakpointManager fixes for 7f069f5",
I did not notice that
17c6de3f1 "[bazel] Fix bazel build for
7f069f5ef.."
had added Debug/BreakpointManagers globs to the Debug target. But these
are already being built in the "BreakpointManagers" target; remove them
from "Debug".
Craig Topper [Tue, 25 Apr 2023 01:11:05 +0000 (18:11 -0700)]
[RISCV] Ensure extract_vector_elt has a single use in combineBinOpToReduce.
Without this, the original reduction will not be removed and we'll
end up with a second reduction. Reductions are expensive operations so
we should avoid that.
Craig Topper [Tue, 25 Apr 2023 01:09:14 +0000 (18:09 -0700)]
[RISCV] Add test case showing duplicated reduction due to missing one use check. NFC
We don't check that the extract_vector_elt has one use in combineBinOpToReduce.
Robert Suderman [Tue, 25 Apr 2023 00:55:47 +0000 (00:55 +0000)]
[mlir][tosa] Fix `tosa.reshape` folder for quantized constants
It is possible for `tosa.const` to have a quantized return type.
In these cases we need to retain the expected result type to avoid
potential type mismatches further in the model.
Reviewed By: cota
Differential Revision: https://reviews.llvm.org/D149109
Craig Topper [Tue, 25 Apr 2023 00:30:35 +0000 (17:30 -0700)]
[RISCV] Strengthen INSERT_SUBVECTOR check in combineBinOpToReduce.
It's not enough for the vector we're inserting into to be undef.
We also need to be inserting into the lowest subvector.
Spotted by inspection while trying to figure out why this doesn't
work for vp.reduce.fadd.
LLVM GN Syncbot [Mon, 24 Apr 2023 23:56:11 +0000 (23:56 +0000)]
[gn build] Port
d45fae601067
NAKAMURA Takumi [Wed, 8 Mar 2023 22:25:11 +0000 (07:25 +0900)]
Migrate `IIT_Info` into `Intrinsics.td`
- Define `IIT_Info` in `Intrinsics.td`
- Implement `EmitIITInfo` in `IntrinsicEmitter.cpp`
- Use generated `IIT_Info` in `Function.cpp`
Depends on D145873 and D146179
Differential Revision: https://reviews.llvm.org/D146914
NAKAMURA Takumi [Sun, 26 Mar 2023 07:39:01 +0000 (16:39 +0900)]
Fully generate `MachineValueType.h`
Part of D146914
NAKAMURA Takumi [Wed, 8 Mar 2023 16:20:57 +0000 (01:20 +0900)]
ValueTypes.td: Reorganize ValueType
Introduce VTAny as `isOverloaded = true`. ValueType.isOverloaded` is used for;
- Define `iPTRAny`, `vAny`, `fAny`, and `Any`
- Reflect `ValueType.isOverloaded` to `LLVMType.isAny` in `Intrinsics.td`
- (Planninig) Reflect the condition to `MVT::isOverloaded()`
Introduce some fields in `ValueType`
- LLVMName
- isInteger
- isFP
- isVector
- isScalable
- nElem
- ElementType
Introduce `VTVec<int nelem, ValueType elt, int value>` to represent
the element type. VTVec.Size may be calculated by `!mul(nelem, elt.Size)`.
Introduce `list<ValueType> ValueTypes` as convention for lookup.
Differential Revision: https://reviews.llvm.org/D146179
NAKAMURA Takumi [Wed, 8 Mar 2023 15:37:00 +0000 (00:37 +0900)]
ValueTypes.td: Introduce VTAny as `isOverloaded = true`
`ValueType.isOverloaded` is used for;
- Define `iPTRAny`, `vAny`, `fAny`, and `Any`
- Reflect `ValueType.isOverloaded` to `LLVMType.isAny` in `Intrinsics.td`
- (Planninig) Reflect the condition to `MVT::isOverloaded()`
Part of D146179
NAKAMURA Takumi [Mon, 24 Apr 2023 22:07:19 +0000 (07:07 +0900)]
SupportTests/MachineValueType.h: Catch up llvmorg-17-init-8340-gb68b94f6f40b
NAKAMURA Takumi [Sun, 23 Apr 2023 12:46:09 +0000 (21:46 +0900)]
Move CodeGen/LowLevelType => CodeGen/LowLevelTypeUtils
Before restoring `CodeGen/LowLevelType`, rename this to `LowLevelTypeUtils`.
Differential Revision: https://reviews.llvm.org/D148768
MalavikaSamak [Mon, 24 Apr 2023 23:49:13 +0000 (16:49 -0700)]
Reland "[-Wunsafe-buffer-usage] Bug fix: Handles the assertion violations for code within macros"
This reverts commit
84ec1f7725d4f4575474b59467e598d7c5528a4e.
MalavikaSamak [Mon, 24 Apr 2023 23:48:14 +0000 (16:48 -0700)]
Revert "[-Wunsafe-buffer-usage] Bug fix: Handles the assertion violations for code within macros"
This reverts commit
9bd0db80784e30d40a4a65f1b47109c833f05b54.
Siva Chandra Reddy [Mon, 24 Apr 2023 23:40:23 +0000 (23:40 +0000)]
[libc][Obvious] Add NO_RUN_POSTBUILD to sqrtf exhaustive test.
The bots are timing out because they are trying to run this test.
Differential Revision: https://reviews.llvm.org/D149108
Jie Fu [Mon, 24 Apr 2023 23:34:39 +0000 (07:34 +0800)]
[clang] Fix -Wimplicit-fallthrough in UnsafeBufferUsage.cpp [NFC]
/Users/jiefu/llvm-project/clang/lib/Analysis/UnsafeBufferUsage.cpp:1272:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
case Strategy::Kind::Wontfix:
^
/Users/jiefu/llvm-project/clang/lib/Analysis/UnsafeBufferUsage.cpp:1272:5: note: insert 'LLVM_FALLTHROUGH;' to silence this warning
case Strategy::Kind::Wontfix:
^
LLVM_FALLTHROUGH;
/Users/jiefu/llvm-project/clang/lib/Analysis/UnsafeBufferUsage.cpp:1272:5: note: insert 'break;' to avoid fall-through
case Strategy::Kind::Wontfix:
^
break;
1 error generated.
Siva Chandra Reddy [Mon, 24 Apr 2023 23:07:22 +0000 (23:07 +0000)]
[libc][Obvious] Enable hermetic tests only under full build.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D149105
Shubham Sandeep Rastogi [Tue, 18 Apr 2023 21:09:12 +0000 (14:09 -0700)]
Move DBG_VALUE's that depend on loads to after a
load if the load is moved due to the pre register allocation ld/st
optimization pass
The issue here is that there can be a scenario where debug information
is lost because of the pre register allocation load store optimization
pass, where a load who's result describes the debug infomation for a
local variable gets moved below the load and that causes the debug
information for that load to get lost.
Example:
Before the Pre Register Allocation Load Store Pass
inst_a
%2 = ld ...
inst_b
DBG_VALUE %2, "x", ...
%3 = ld ...
After the Pass:
inst_a
inst_b
DBG_VALUE %2, "x", ...
%2 = ld ...
%3 = ld ...
The load has now been moved to after the DBG_VAL that uses its result
and the debug info for "x" has been lost. What we want is:
inst_a
inst_b
%2 = ld ...
DBG_VALUE %2, "x", ...
%3 = ld ...
Which is what this patch addresses
Differential Revision: https://reviews.llvm.org/D145168
MalavikaSamak [Fri, 21 Apr 2023 17:55:01 +0000 (10:55 -0700)]
[-Wunsafe-buffer-usage] Bug fix: Handles the assertion violations for code within macros
When macros get expanded, the source location for the expanded code received by the Fixable
gadgets is invalid. We do not want to emit fixits for macro expanded code and it currently
crashes the analysis. This patch fixes the assertion violations that were introduced for
handling code with such invalid locations.
Reviewed by: NoQ, ziqingluo-90, jkorous
Differential revision: https://reviews.llvm.org/D146450
Siva Chandra Reddy [Tue, 18 Apr 2023 22:50:26 +0000 (22:50 +0000)]
[libc] Add rule named `add_libc_hermetic_test` which adds a hermetic test.
A convenience wrapper name `add_libc_test` is also added which adds both
a unit test and a hermetic test. The ctype tests have been switched over
to use add_libc_test.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D148756
Siva Chandra Reddy [Thu, 20 Apr 2023 07:18:43 +0000 (07:18 +0000)]
[libc] Run all unit tests, irrespective of whether they belong to a test suite.
Previously, only those unit tests which belonged to a suite were run as
part of libc-unit-tests. It meant that unit tests not part of any suite
were not being tested. This change makes all unit tests run as part of
libc-unit-tests. The convenience function to add a libc unit test suite
has been removed and add_custom_target is used in its place. One of the
bit-rotting test has along been fixed. Math exhaustive and differential
tests are skipped under full build.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D148784