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
Pavel Kopyl [Sat, 22 Apr 2023 00:52:04 +0000 (02:52 +0200)]
[NVPTX] Unforce minimum alignment of 4 for byval arguments of device-side functions.
Minimum alignment of 4 for byval arguments was forced to workaround
a bug in old versions of ptxas. Details: https://reviews.llvm.org/D22428.
Recent ptxas versions (> 9.0) do not seem to have this bug, so alignment
requirement was relaxed. To force again minimum alignment of 4, use
'-force-min-byval-param-align' option.
Mehdi Amini [Mon, 24 Apr 2023 22:13:15 +0000 (15:13 -0700)]
Fix MLIR build when shared library mode is enabled
Emilio Cota [Mon, 24 Apr 2023 22:00:35 +0000 (18:00 -0400)]
[bazel][mlir] BreakpointManager fixes for
7f069f5ef4fe
Siva Chandra Reddy [Mon, 24 Apr 2023 16:39:52 +0000 (16:39 +0000)]
[libc][Obvious] Add include.stdlib as missing dep for CPP.string.
string.h includes stdlib.h to get free and realloc. This change
adds the missing dep on stdlib.h.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/
D149075
Manna, Soumi [Mon, 24 Apr 2023 21:16:32 +0000 (14:16 -0700)]
[NFC][clang] Fix Coverity bugs with AUTO_CAUSES_COPY
Reported by Coverity:
AUTO_CAUSES_COPY
Unnecessary object copies can affect performance.
1. Inside "ExtractAPIVisitor.h" file, in clang::extractapi::impl::ExtractAPIVisitorBase<<unnamed>::BatchExtractAPIVisitor>::VisitFunctionDecl(clang::FunctionDecl const *): Using the auto keyword without an & causes the copy of an object of type DynTypedNode.
2. Inside "NeonEmitter.cpp" file, in <unnamed>::Intrinsic::Intrinsic(llvm::Record *, llvm::StringRef, llvm::StringRef, <unnamed>::TypeSpec, <unnamed>::TypeSpec, <unnamed>::ClassKind, llvm::ListInit *, <unnamed>::NeonEmitter &, llvm::StringRef, llvm::StringRef, bool, bool): Using the auto keyword without an & causes the copy of an object of type Type.
3. Inside "MicrosoftCXXABI.cpp" file, in <unnamed>::MSRTTIBuilder::getClassHierarchyDescriptor(): Using the auto keyword without an & causes the copy of an object of type MSRTTIClass.
4. Inside "CGGPUBuiltin.cpp" file, in clang::CodeGen::CodeGenFunction::EmitAMDGPUDevicePrintfCallExpr(clang::CallExpr const *): Using the auto keyword without an & causes the copy of an object of type CallArg.
5. Inside "SemaDeclAttr.cpp" file, in threadSafetyCheckIsSmartPointer(clang::Sema &, clang::RecordType const *): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.
6. Inside "ComputeDependence.cpp" file, in clang::computeDependence(clang::DesignatedInitExpr *): Using the auto keyword without an & causes the copy of an object of type Designator.
7. Inside "Format.cpp" file, In clang::format::affectsRange(llvm::ArrayRef<clang::tooling::Range>, unsigned int, unsigned int): Using the auto keyword without an & causes the copy of an object of type Range.
Reviewed By: tahonermann
Differential Revision: https://reviews.llvm.org/
D149074
Mehdi Amini [Mon, 24 Apr 2023 21:41:23 +0000 (14:41 -0700)]
[MLIR] Fix build, obivous typos in
cca510640
Mehdi Amini [Mon, 24 Apr 2023 21:38:58 +0000 (14:38 -0700)]
[MLIR][doc] Minor fixes the Action documentation
Fix some reviews comments missed when pushing the initial version of the doc.
Mehdi Amini [Mon, 24 Apr 2023 05:24:52 +0000 (22:24 -0700)]
Remove deprecated `preloadDialectInContext` flag for MlirOptMain that has been deprecated for 2 years
See https://discourse.llvm.org/t/psa-preloaddialectincontext-has-been-deprecated-for-1y-and-will-be-removed/68992
Differential Revision: https://reviews.llvm.org/
D149039
Mehdi Amini [Mon, 24 Apr 2023 05:15:32 +0000 (22:15 -0700)]
Remove deprecated entry point for MlirOptMain
See: https://discourse.llvm.org/t/psa-migrating-mlir-opt-like-tools-to-use-mliroptmainconfig/68991
Differential Revision: https://reviews.llvm.org/
D149038
Mehdi Amini [Sun, 26 Feb 2023 06:01:18 +0000 (01:01 -0500)]
Refactor the mlir-opt command line options related to debugging in a helper
This makes it reusable across various tooling and reduces the amount of
boilerplate needed.
Differential Revision: https://reviews.llvm.org/
D144818
Mehdi Amini [Sun, 23 Apr 2023 22:55:15 +0000 (16:55 -0600)]
Add user doc on the website for the Action framework
The old DebugAction documentation is deleted: the code in-tree does not
match it anymore.
Differential Revision: https://reviews.llvm.org/
D149037
Mehdi Amini [Wed, 15 Feb 2023 23:56:08 +0000 (15:56 -0800)]
Add a GDB/LLDB interface for interactive debugging of MLIR Actions
This includes a small runtime acting as callback for the ExecutionEngine
and a C API that makes it possible to control from the debugger.
A python script for LLDB is included that hook a new `mlir` subcommand
and allows to set breakpoints and inspect the current action, the context
and the stack.
Differential Revision: https://reviews.llvm.org/
D144817
David Green [Mon, 24 Apr 2023 21:02:30 +0000 (22:02 +0100)]
[LV] Use the known trip count when costing non-tail folded VFs
Now that we store the ScalarCost in the VectorizationFactor it is possible to
use it to get a slightly more accurate cost in isMoreProfitable between two
vector factors. This extends the logic added in
D101726 to non-tail-folded
cases, using the costs of `VecCost * (TripCount / VF) + ScalarCost * (TripCount % VF)`
to compare VFs where the TripCount is known and we are not folding the tail.
This shouldn't alter very much as small trip counts are usually not vectorized,
but does seem to help in the testcase where 4 * VF4 is chosen as profitable
compared to 2 * VF8 + 4 * scalar.
Differential Revision: https://reviews.llvm.org/
D147720
Joseph Huber [Mon, 24 Apr 2023 20:49:16 +0000 (15:49 -0500)]
Revert "[OpenMP] Fix GCC build issues and restore "Additional APIs used by the"
This patch caused failures on the OpenMP buildbots as discussed in
https://reviews.llvm.org/
D149010. We will need to investigate why we are
seeing unresolved references to the standard C++ library.
This reverts commit
5a15ca7f10bcba55a2f51281b1562cf5095ae015.
Han Zhu [Thu, 20 Apr 2023 20:41:46 +0000 (13:41 -0700)]
[X86 isel] Fix permute mask calculation in lowerShuffleAsUNPCKAndPermute
This fixes [issue 62242](https://github.com/llvm/llvm-project/issues/62242)
This code block can potentially swap the order of V1 and V2 in Ops and therefore
also in the unpck instruction generated.
```
SDValue &Op = Ops[Elt & 1];
if (M < NumElts && (Op.isUndef() || Op == V1))
Op = V1;
else if (NumElts <= M && (Op.isUndef() || Op == V2)) {
Op = V2;
NormM -= NumElts;
} else
return SDValue();
```
But the permute mask is calculated assuming the first operand being V1 and
second V2, therefore causing a mis-compile.
First check if the input operands are swapped, and then calculate the permute
mask based on that.
Differential Revision: https://reviews.llvm.org/
D148843
Joseph Huber [Fri, 21 Apr 2023 22:59:00 +0000 (17:59 -0500)]
[libc] Adjust the `cpp:function` type to support lambdas
The current function type does not support generic lambdas because it
relies on the lambda being implicitly convertible to a function pointer.
This patch adds support for this by copying the existing lightweight
`function_ref` type.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/
D148971
Joseph Huber [Thu, 20 Apr 2023 16:16:01 +0000 (11:16 -0500)]
[libc] Add more utility functions for the GPU
This patch adds extra intrinsics for the GPU. Some of these are unused
for now but will be used later. We use these currently to update the
`RPC` handling. Currently, every thread can update the RPC client, which
isn't correct. This patch adds code neccesary to allow a single thread
to perfrom the write while the others wait.
Feedback is welcome for the naming of these functions. I'm copying the
OpenMP nomenclature where we call an AMD `wavefront` or NVIDIA `warp` a
`lane`.
Reviewed By: tra
Differential Revision: https://reviews.llvm.org/
D148810
Louis Dionne [Fri, 21 Apr 2023 17:47:18 +0000 (13:47 -0400)]
[clang] Remove workaround for old LLVM_ENABLE_PROJECTS=libcxx build
We don't support the LLVM_ENABLE_PROJECTS=libcxx build anymore (and have
not for over a year), so it should be fine to remove this workaround now.
Differential Revision: https://reviews.llvm.org/
D148945
Slava Zakharin [Mon, 24 Apr 2023 20:16:55 +0000 (13:16 -0700)]
[NFC][flang] Fixed typo in AVOID_NATIVE_UINT128_T macro.
Differential Revision: https://reviews.llvm.org/
D149097
Tomasz Kuchta [Mon, 24 Apr 2023 19:02:52 +0000 (19:02 +0000)]
[DFSAN] Add support for strsep.
Reviewed-by: browneee
Differential Revision: https://reviews.llvm.org/
D141389
Aiden Grossman [Mon, 24 Apr 2023 19:40:21 +0000 (19:40 +0000)]
[Docs] Fix minor issues in AdvancedBuilds documentation
This patch modifies the commands under the Bootstrap builds section so
that they include the -DLLVM_ENABLE_PROJECTS flag with the value "clang"
so that the Clang build will actually get picked up. Without this patch
they error out as the CLANG_BOOTSTRAP_PASSTHROUGH variable is processed
in /clang/CMakeLists.txt which isn't picked up without the
LLVM_ENABLE_PROJECTS variable being set appropriately.
This patch also changes any remaining dangling <path to source>
references to <path to source>/llvm to better match the rest of the
file.
Reviewed By: thieta
Differential Revision: https://reviews.llvm.org/
D148451
Pavel Kosov [Mon, 24 Apr 2023 19:31:40 +0000 (22:31 +0300)]
[llvm-exegesis] Fix ifdefs in X86/Target.cpp
As discussed in https://reviews.llvm.org/D96498, the correct macro
to check together with _MSC_VER is _M_X64. Testing for _MSC_VER with
__x86_64__ made tests fail on Windows in https://reviews.llvm.org/
D146301.
Additionally, this commit replaces a few calls to llvm_unreachable() with
report_fatal_error() because it is actually reached even on Linux/i686,
causing obscure segfaults when expanded to __builtin_unreachable().
~~
Huawei RRI, OS Lab
Reviewed By: courbet
Differential Revision: https://reviews.llvm.org/
D147926
Haowei Wu [Thu, 23 Feb 2023 00:50:30 +0000 (16:50 -0800)]
Disable compiler launcher on external projects and multi stage clang
When using compiler caching program like ccache, there is no point to
use them on external projects or multi-stage clang builds. As these
builds uses fresh from source code toolchain and will pollute the build
cache. If a compiler launcher is still required, a user can explicity
define `CMAKE_C_COMPILER_LAUNCHER` and `CMAKE_CXX_COMPILER_LAUNCHER` in
`CLANG_BOOTSTRAP_PASSTHROUGH` and `LLVM_EXTERNAL_PROJECT_PASSTHROUGH`
flags to enable compiler launcher in these builds.
Differential Revision: https://reviews.llvm.org/
D144603
Ádám Kallai [Thu, 13 Apr 2023 11:26:00 +0000 (06:26 -0500)]
[clang][tests] Fix Flang driver tests for Windows
Updated the regular expression in order to match '.exe' suffix,
if these Flang tests are running on Windows.
Differential Revision: https://reviews.llvm.org/
D148211
Craig Topper [Mon, 24 Apr 2023 19:02:04 +0000 (12:02 -0700)]
[RISCV] Rename WriteFCvtF32ToF32 sched class to WriteFRoundF32.
Round better matches the instructions this is used for.
Do the same for F16 and F64 as well as the Read classes.
Natalia Glagoleva [Mon, 24 Apr 2023 17:49:25 +0000 (10:49 -0700)]
[OpenMP] Fix GCC build issues and restore "Additional APIs used by the
MSVC compiler for loop collapse (rectangular and non-rectangular loops)"
Fixes a GCC build issue (unallowed typename keyword use) in and restores
https://reviews.llvm.org/
D148393
Differential Revision: https://reviews.llvm.org/
D149010
Job Noorman [Mon, 24 Apr 2023 18:54:23 +0000 (20:54 +0200)]
[BOLT][Wrapper] Fix off-by-one when parsing 'cmp' output
The byte offsets in the output of 'cmp' start from 1, not from 0 as the
current parser assumes. This caused mismatched bytes to sometimes be
attributed to the wrong section.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/
D149046
Jacques Pienaar [Mon, 24 Apr 2023 18:53:58 +0000 (11:53 -0700)]
[mlir] Dialect type/attr bytecode read/write generator.
Tool to help generate dialect bytecode Attribute & Type reader/writing.
Show usage by flipping builtin dialect.
It helps reduce boilerplate when writing dialect bytecode attribute and
type readers/writers. It is not an attempt at a generic spec mechanism
but rather practically focussing on boilerplate reduction while also
considering that it need not be the only in memory format and make it
relatively easy to change.
There should be some cleanup in follow up as we expand to more dialects.
Differential Revision: https://reviews.llvm.org/
D144820
Craig Topper [Mon, 24 Apr 2023 18:45:27 +0000 (11:45 -0700)]
[RISCV] Prefer vmsle.vi vX, vY, -1 over vslt.vx vX, vY, x0.
If a target hasn't optimized scalar to vector transfers for x0,
using an immediate may be more efficient.
Job Noorman [Mon, 24 Apr 2023 18:38:42 +0000 (11:38 -0700)]
[BOLT] Fix many tests detected as unsupported
Since
D148847, many tests are detected as being unsupported. This is
caused by BOLT_TARGETS_TO_BUILD being ;-separated whereas the previously
used TARGETS_TO_BUILD is space-separated.
This patch fixes this by creating config.targets lit.cfg.py by splitting
on ';'.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/
D149026
Matt Arsenault [Sun, 9 Apr 2023 11:16:34 +0000 (07:16 -0400)]
ValueTracking: Implement computeKnownFPClass for fma/fmuladd
Copy handling from CannotBeOrderedLessThanZero
Matt Arsenault [Mon, 24 Apr 2023 13:02:34 +0000 (09:02 -0400)]
InstCombine: Add some baseline is.fpclass combine tests
Add tests for converting is.fpclass > or < 0 to fcmp with 0.
Matt Arsenault [Sun, 9 Apr 2023 11:15:45 +0000 (07:15 -0400)]
ValueTracking: Handle exp/exp2 in computeKnownFPClass
Matt Arsenault [Wed, 19 Apr 2023 02:49:37 +0000 (22:49 -0400)]
ValueTracking: Fix computeKnownFPClass for fabs
The fabs utility functions have the opposite purpose and
probably should not be a general utility.
Matt Arsenault [Mon, 10 Apr 2023 13:40:54 +0000 (09:40 -0400)]
ValueTracking: Add computeKnownFPClass baseline tests for exp
Quinn Dawkins [Wed, 5 Apr 2023 04:36:51 +0000 (00:36 -0400)]
[mlir][vector] Add unroll pattern for vector.gather
This pattern is useful for SPIR-V to unroll to a supported vector size
before later lowerings. The unrolling pattern is closer to an
elementwise op than the transfer ops because the index values from which
to extract elements are captured by the index vector and thus there is
no need to update the base offsets when unrolling gather.
Differential Revision: https://reviews.llvm.org/
D149066
Jakub Kuderski [Mon, 24 Apr 2023 17:56:21 +0000 (13:56 -0400)]
[mlir][spirv] Fix OOB error in TestModuleCombiner
Also fix a typo in the surrounding code.
Fixes: https://github.com/llvm/llvm-project/issues/62318
Reviewed By: qedawkins
Differential Revision: https://reviews.llvm.org/
D149069
Hanhan Wang [Fri, 21 Apr 2023 20:32:54 +0000 (13:32 -0700)]
[mlir][linalg] Add support for lowering pack with outer_dims_perm.
Reviewed By: chelini, qcolombet
Differential Revision: https://reviews.llvm.org/
D148845
Valentin Clement [Mon, 24 Apr 2023 17:12:07 +0000 (10:12 -0700)]
[flang][openacc] Support array section with non constant bounds
Add lowering for non constant lower and upper bounds
in array section.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/
D148840
Fangrui Song [Mon, 24 Apr 2023 17:02:06 +0000 (10:02 -0700)]
[PPCMIPeephole] Fix incorrect compare elimination
D38236 moves a redundant compare instruction from the loop body to the
preheader.
It has a bug: when `MBB1 == &MBB2`, there may be only one compare instruction in the
loop. The code will lift the compare instruction to the preheader, failing to
account for the change of the compare result in a tail call, leading to a miscompile.
Suppress the compare elimination to fix https://github.com/llvm/llvm-project/issues/62294
Reviewed By: #powerpc, nemanjai
Differential Revision: https://reviews.llvm.org/
D149030
Florian Hahn [Mon, 24 Apr 2023 16:51:11 +0000 (17:51 +0100)]
[VPlan] Add VPValue::isLiveIn() (NFC).
This helps to clarify checks in multiple places.
Suggested as cleanup in
D147892.
Min-Yih Hsu [Mon, 24 Apr 2023 16:32:49 +0000 (09:32 -0700)]
[M68k] Add basic Clang support for M68881/2
- Add the `-m68881` flag
- Add floating point feature detection
- Macro definitions
Differential Revision: https://reviews.llvm.org/
D147481
LLVM GN Syncbot [Mon, 24 Apr 2023 16:19:57 +0000 (16:19 +0000)]
[gn build] Port
afa13ba18d9e
max [Mon, 24 Apr 2023 16:17:08 +0000 (11:17 -0500)]
[MLIR][python bindings][fix] implement `replace_all_uses_with` on `PyValue`
Differential Revision: https://reviews.llvm.org/
D148816