ibricchi [Mon, 3 Apr 2023 12:13:46 +0000 (14:13 +0200)]
[Pass Builder] Allow Module Inliner for full LTO
Currently there is no way to enable the module inliner when
linking with full lto. This patch enables that option.
Differential Revision: https://reviews.llvm.org/D146805
Timm Bäder [Tue, 7 Feb 2023 07:20:59 +0000 (08:20 +0100)]
[clang][Interp] Fix initializing base class members
For the given test case, we were trying to initialize a member of C,
which doesn't have any. Get the proper base pointer instead and
initialize the members there.
Differential Revision: https://reviews.llvm.org/D143466
Florian Hahn [Mon, 3 Apr 2023 11:50:01 +0000 (12:50 +0100)]
[Matrix] Fix shapes in dot product tests.
The shape arguments for the @llvm.matrix.column.major.load where
incorrect. Flip them so they are in sync with the shape of the
multiplications.
Dmitri Gribenko [Mon, 3 Apr 2023 11:04:17 +0000 (13:04 +0200)]
[bazel][libc] Add a missing string_view dependency
The dependency was introduced in
https://github.com/llvm/llvm-project/commit/
9a99afb455601aaa3a28d307c7bbcfdaad3fa4fc
Dmitri Gribenko [Mon, 3 Apr 2023 11:03:14 +0000 (13:03 +0200)]
[bazel] Run an autoformatter on libc/BUILD.bazel
Congcong Cai [Mon, 3 Apr 2023 10:41:29 +0000 (12:41 +0200)]
[clang-tidy] support unscoped enumerations in readability-static-accessed-through-instance
fixed [60810](https://github.com/llvm/llvm-project/issues/60810)
unscoped enumerations in class can also be checked by `readability-static-accessed-through-instance`
add matcher for `enumConstantDecl` to match format
```
struct {
enum { E1 };
};
```
The filter of member expression and the fix hint should be same as other condition.
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D147315
Adrian Kuegel [Mon, 3 Apr 2023 10:52:49 +0000 (12:52 +0200)]
[mlir][spirv-cpu-runner] Add missing call to registerPassManagerCLOptions().
Also fix tests, they were not calling FileCheck.
Serguei Katkov [Mon, 3 Apr 2023 09:29:39 +0000 (16:29 +0700)]
[GuardWidening] Fix the crash while replacing the users of poison.
When we replace poison with freeze poison it might appear
that user of poison is a constant (for example vector constant).
In this case we will get that constant will get non-constant operand.
Moreover replacing poison and GlobalValue everywhere in module seems
to be overkill. So the solution will be just make a replacement
only in instructions we visited (contributing to hoisted condition).
Moreover if user of posion is constant, this constant also should need
a freeze and it does not make sense to replace poison with frozen version,
just freeze another constant.
Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D147429
Nikita Popov [Mon, 3 Apr 2023 10:06:01 +0000 (12:06 +0200)]
Revert "Reland "[compiler-rt] Drop -Werror in compiler flag checks""
This reverts commit
cc90ca6f0fb8e29c8a12d15c93abb9e3839a23ca.
This still breaks the GCC build in the same way as the previous
version.
Nikita Popov [Mon, 3 Apr 2023 10:01:53 +0000 (12:01 +0200)]
[LICM] Extract helper for getClobberingMemoryAccess()
Extract a helper that does the clobber walk while taking into
account the cap. Slightly reflow things to check this first in
the store case, before we start walking over all accesses in the
loop.
Jingu Kang [Mon, 3 Apr 2023 08:25:09 +0000 (09:25 +0100)]
[AArch64] Remove redundant `mov 0` instruction for high 64-bits
If MI sets zero for high 64-bits implicitly, remove `mov 0` for high 64-bits.
For example,
%1:fpr64 = nofpexcept FCVTNv4i16 %0:fpr128, implicit $fpcr
%2:fpr64 = MOVID 0
%4:fpr128 = IMPLICIT_DEF
%3:fpr128 = INSERT_SUBREG %4:fpr128(tied-def 0), killed %2:fpr64, %subreg.dsub
%6:fpr128 = IMPLICIT_DEF
%5:fpr128 = INSERT_SUBREG %6:fpr128(tied-def 0), killed %1:fpr64, %subreg.dsub
%7:fpr128 = INSvi64lane %5:fpr128(tied-def 0), 1, killed %3:fpr128, 0
==>
%1:fpr64 = nofpexcept FCVTNv4i16 %0:fpr128, implicit $fpcr
%6:fpr128 = IMPLICIT_DEF
%7:fpr128 = INSERT_SUBREG %6:fpr128(tied-def 0), killed %1:fpr64, %subreg.dsub
Differential Revision: https://reviews.llvm.org/D147235
Stefan Gränitz [Fri, 31 Mar 2023 12:27:55 +0000 (14:27 +0200)]
[Orc] Print section load-addresses for debug objects as hex again
Apparently, the refactor in
8b1771bd9f304be39d4dcbdcccedb6d3bcd18200 broke the logic behind formatv here:
```
140736272011264 .rodata
140736272015360 .text
140736272011424 .eh_frame
```
Timm Bäder [Tue, 7 Feb 2023 09:56:53 +0000 (10:56 +0100)]
[clang][Interp] Fix derived-to-base casts for >1 levels
The GetPtrBasePop op we were using only works for direct base classes.
Differential Revision: https://reviews.llvm.org/D143480
Johannes de Fine Licht [Mon, 3 Apr 2023 09:07:55 +0000 (09:07 +0000)]
[MLIR][LLVM] Put byval static allocas in the entry block.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D147311
Sergei Barannikov [Sat, 1 Apr 2023 15:40:47 +0000 (18:40 +0300)]
Reland "[compiler-rt] Drop -Werror in compiler flag checks"
-Werror is redundant because CMake not only checks the
exit status, but also parses the output of try_compile.
-Wformat-security is a special case, because specifying it
without -Wformat causes gcc to emit a warning in a format
not recognized by CMake, which makes the check pass.
Jun Zhang [Mon, 3 Apr 2023 08:22:38 +0000 (16:22 +0800)]
[DAGCombiner] Fold avg(x, x) --> x
Signed-off-by: Jun Zhang <jun@junz.org>
Differential Revision: https://reviews.llvm.org/D147404
Jun Zhang [Sun, 2 Apr 2023 09:34:20 +0000 (17:34 +0800)]
Add baseline tests for D147404
Differential Revision: https://reviews.llvm.org/D147409
Signed-off-by: Jun Zhang <jun@junz.org>
Victor Perez [Fri, 31 Mar 2023 17:01:06 +0000 (18:01 +0100)]
[mlir][llvm] Drop `ResumeOp::verify()` function
In patch https://reviews.llvm.org/rG478bd0735fc094d3af37e9791df5118a402ae7a7,
this function was changed so that it always returns `success()`. Drop this
and explicitly state it won't be generated in the `.td` file and explain
`llvm.resume` restrictions will be checked in `LLVMFuncOp::verify()`.
Differential Revision: https://reviews.llvm.org/D147342
Martin Braenne [Mon, 3 Apr 2023 07:02:48 +0000 (07:02 +0000)]
[clang][dataflow][NFC] Share code between Environment ctor and pushCallInternal().
The deduplicated code is moved into initVars().
As an added bonus, pushCallInternal() now also gets the "Add all fields
mentioned in default member initializers" behavior, which apparently had been
added to the Environment ctor but not pushCallInternal().
Reviewed By: xazax.hun, ymandel
Differential Revision: https://reviews.llvm.org/D147326
Nikita Popov [Mon, 3 Apr 2023 08:17:38 +0000 (10:17 +0200)]
Revert "[compiler-rt] Quote multiple warning flags in check_cxx_compiler_flag invocation"
This reverts commit
88c744e7dfaa9ce67dc2b30dea7713e054399d17.
This breaks the GCC build and is already discussed on the revision.
Guillaume Chatelet [Mon, 3 Apr 2023 07:47:15 +0000 (07:47 +0000)]
Revert D147231 "[reland][libc] Adds string and TestLogger classes, use them in LibcTest"
Build bot detected a memory leak.
This reverts commit
b82d04ea4b4f26037be369f101ae7011975df486.
Guillaume Chatelet [Mon, 3 Apr 2023 07:34:35 +0000 (07:34 +0000)]
[reland][libc] Adds string and TestLogger classes, use them in LibcTest
This is an implementation of https://discourse.llvm.org/t/rfc-running-libc-unit-tests-as-integration-tests/69461.
Differential Revision: https://reviews.llvm.org/D147231
Job Noorman [Mon, 3 Apr 2023 07:30:32 +0000 (09:30 +0200)]
[JITLink][NFC] Make Block const in alignToBlock
Block is not mutated so can be made const.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D147316
Jean Perier [Mon, 3 Apr 2023 07:21:01 +0000 (09:21 +0200)]
[flang] Add TODO for creation of polymorphic temporary
The current code is wrong: it is doing an alloca with the declared
type instead of the dynamic type, leading to undefined behavior
when the dynamic type and declared type differ and the temporary
is later used.
This also introduces some `fir.alloca none` for unlimited polymorphic that
are not allocating the right thing at all.
Add TODOs for now, the correct thing to do will probably be to use the
runtime (like AssignTemporary), but since this happens in code doing
"mold" temp allocation, I first need to check if there is a need for "mold"
temporary creation not followed by an assign, or if this can be combined
with the assign instead (for HLFIR, it is pretty easy combine this from as_expr
codegen, not sure for the current lowering).
Differential Revision: https://reviews.llvm.org/D147333
Jean Perier [Mon, 3 Apr 2023 07:18:41 +0000 (09:18 +0200)]
[flang] preserve pointer rank in polymorphic_pointer => NULL()
The current lowering for polymorphic pointer association was not
dealing with NULL in a "context aware" fashion: it was calling the
`PointerAssociate` runtime entry point with a fir.box<none> target.
But the fir.box<none> is a descriptor for a scalar, this lead the
runtime to set the pointer rank to zero, regardless of its actual
rank.
I do not think there is a way to expose this problem with the Fortran
code currently supported by flang, because most further manipulation of
the pointer would either set the rank correctly, or do not rely on the
rank in the runtime descriptor.
However, this is incorrect, and when assumed rank are supported, the
following would have failed:
```
subroutine check_rank(p)
class(*), pointer :: p(..)
p => null()
select rank(p)
rank (1)
print *, "OK"
rank default
print *, "FAILED"
end select
end subroutine
class(*), pointer :: p(:)
p => null()
call check_rank(p)
end
```
Instead, detect NULL() in polymorphic pointer lowering and trigger the
deallocation of the pointer.
Differential Revision: https://reviews.llvm.org/D147317
Tobias Gysi [Mon, 3 Apr 2023 06:38:04 +0000 (06:38 +0000)]
[mlir] Add stack alignment to the data layout dialect.
The revision adds the stack alignment to the
data layout dialect and it extends the LLVM dialect
import and export to support the new data layout
entry.
One possible use case for the flag is the LLVM dialect
inliner. The LLVM inliner queries the flag to
determine if it is safe to update the alignment of an
existing alloca. We may want to perform the same
optimization inside of MLIR.
Reviewed By: Dinistro
Differential Revision: https://reviews.llvm.org/D147332
Ben Shi [Mon, 3 Apr 2023 05:14:43 +0000 (13:14 +0800)]
[LoongArch] Optimize 32-bit addition with ALSL_W on LoongArch64
Optimize 32-bit 'x+(y<<i)' to (ALSL_W y, x, i) on LoongArch64,
in which 'i' is in [1, 2, 3, 4].
Reviewed By: xen0n, SixWeining
Differential Revision: https://reviews.llvm.org/D147423
Adrian Kuegel [Mon, 3 Apr 2023 06:27:29 +0000 (08:27 +0200)]
[mlir] Fix ignoring return value warning.
Sheng [Mon, 3 Apr 2023 05:56:25 +0000 (13:56 +0800)]
[m68k][NFC] Remove out-of-date comment
Ben Shi [Mon, 3 Apr 2023 01:54:43 +0000 (09:54 +0800)]
[LoongArch] Optimize bitwise and with immediates
Optimize bitfield extractions retaining bit positions
from 'lu12i + addi + and' to 'bstrpick + slli'.
Reviewed By: xen0n, SixWeining
Differential Revision: https://reviews.llvm.org/D147368
Ben Shi [Sat, 1 Apr 2023 03:57:49 +0000 (11:57 +0800)]
[LoongArch][NFC] Add tests of bitwise and with immediates (for D147368)
Reviewed By: SixWeining, xen0n
Differential Revision: https://reviews.llvm.org/D147367
Qiu Chaofan [Mon, 3 Apr 2023 03:37:17 +0000 (11:37 +0800)]
[PowerPC] Lower IS_FPCLASS by test data class instruction
Power ISA 3.0 introduced new 'test data class' instructions, which
accept flags for: NaN/Infinity/Zero/Denormal. This instruction can be
used to implement custom lowering for llvm.is.fpclass, but some extra
bits provided by the intrinsic are missing (normal and QNaN/SNaN).
For those categories not natively supported, this patch uses a two-way
or three-way combination to implement correct behavior.
Reviewed By: sepavloff, shchenz
Differential Revision: https://reviews.llvm.org/D140381
Ben Shi [Sun, 2 Apr 2023 08:47:37 +0000 (16:47 +0800)]
[LoongArch] Optimize multiplication with immediates
Optimize 'x * c' to (ALSL x, (SLLI x, i0), i1) in which
c = (1 << i0) | (1 << i1).
Reviewed By: xen0n, SixWeining
Differential Revision: https://reviews.llvm.org/D147406
Ben Shi [Sun, 2 Apr 2023 08:04:23 +0000 (16:04 +0800)]
[LoongArch][NFC] Add tests of multiplication with immediates
Reviewed By: xen0n, SixWeining
Differential Revision: https://reviews.llvm.org/D147405
Craig Topper [Mon, 3 Apr 2023 02:45:36 +0000 (19:45 -0700)]
[SelectionDAG] Rename Flag->Glue. NFC
Craig Topper [Mon, 3 Apr 2023 02:14:31 +0000 (19:14 -0700)]
[Targets] Rename Flag->Glue. NFC
Long long ago Glue was called Flag, and it was never completely
renamed.
Craig Topper [Mon, 3 Apr 2023 02:14:22 +0000 (19:14 -0700)]
[X86] Rename Flag->Glue in SelectionDAG. NFC
Long long ago Glue was called Flag, and it was never completely
renamed.
More patches for other targets will follow.
Differential Revision: https://reviews.llvm.org/D147418
Kai Sasaki [Sun, 2 Apr 2023 21:36:56 +0000 (06:36 +0900)]
[mlir] Fix ignoring return value warning for Toy CLIs
After [the change](https://github.com/llvm/llvm-project/commit/
470f3cee3557974bb1820722bf82d86b8909199b) returning LogicalResult from applyPassManagerCLIOptions, the warning message is shown in the Toy CLIs saying it's not using the returned values. We can check the result and return non-zero value as the pass failure.
```
/Users/sasaki/dev/llvm-project/mlir/examples/toy/Ch3/toyc.cpp:118:5: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]
applyPassManagerCLOptions(pm);
^~~~~~~~~~~~~~~~~~~~~~~~~ ~~
1 warning generated.
[473/485] Building CXX object tools/mlir/examples/toy/Ch4/CMakeFiles/toyc-ch4.dir/toyc.cpp.o
/Users/sasaki/dev/llvm-project/mlir/examples/toy/Ch4/toyc.cpp:119:5: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]
applyPassManagerCLOptions(pm);
^~~~~~~~~~~~~~~~~~~~~~~~~ ~~
1 warning generated.
[477/485] Building CXX object tools/mlir/examples/toy/Ch5/CMakeFiles/toyc-ch5.dir/toyc.cpp.o
/Users/sasaki/dev/llvm-project/mlir/examples/toy/Ch5/toyc.cpp:122:3: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]
applyPassManagerCLOptions(pm);
^~~~~~~~~~~~~~~~~~~~~~~~~ ~~
1 warning generated.
[479/485] Building CXX object tools/mlir/examples/toy/Ch6/CMakeFiles/toyc-ch6.dir/toyc.cpp.o
/Users/sasaki/dev/llvm-project/mlir/examples/toy/Ch6/toyc.cpp:139:3: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]
applyPassManagerCLOptions(pm);
^~~~~~~~~~~~~~~~~~~~~~~~~ ~~
1 warning generated.
[481/485] Building CXX object tools/mlir/examples/toy/Ch7/CMakeFiles/toyc-ch7.dir/toyc.cpp.o
/Users/sasaki/dev/llvm-project/mlir/examples/toy/Ch7/toyc.cpp:139:3: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]
applyPassManagerCLOptions(pm);
^~~~~~~~~~~~~~~~~~~~~~~~~ ~~
1 warning generated.
```
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D147402
Craig Topper [Sun, 2 Apr 2023 21:12:08 +0000 (14:12 -0700)]
[TableGen] Rename InFlag/OutFlag->InGlue/OutGlue. NFC
Flag was renamed to Glue a long time ago, but rename was incomplete.
Craig Topper [Sun, 2 Apr 2023 21:04:56 +0000 (14:04 -0700)]
[TableGen] clang-format DAGISelMatcherOpt.cpp. NFC
Joshua Cao [Sun, 2 Apr 2023 20:58:51 +0000 (13:58 -0700)]
[mlir][doc] rename MemRefDataFlowOpt -> AffineScalarReplacement
Renamed in https://reviews.llvm.org/D104190, but missed in docs
Felix Schneider [Sun, 2 Apr 2023 20:24:36 +0000 (13:24 -0700)]
[mlir] [Linalg] Limit Detensorize pass to FunctionOpInterface
The linalg-detensorize Pass can only be run on FunctionOpInterface Ops and will crash when run on other ops. The TableGen definition of the pass did not enforce that.
Github issue here: https://github.com/llvm/llvm-project/issues/61845
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D147384
Simon Pilgrim [Sun, 2 Apr 2023 19:56:54 +0000 (20:56 +0100)]
[X86] truncateAVX512SetCCNoBWI - pass SDLoc argument by const-ref
Craig Topper [Sun, 2 Apr 2023 18:38:26 +0000 (11:38 -0700)]
[TableGen] Avoid creating a ScopeMatcher full of nullptrs.
The call to FactorNodes will catch it and remove it, but it's easy
to catch at creation.
Remove the now unnecessary null checks from a loop in factor nodes.
Simon Pilgrim [Sun, 2 Apr 2023 18:16:24 +0000 (19:16 +0100)]
[X86] combineX86ShufflesConstants - move hasOneUse check as late as possible. NFC.
We only need to check hasOneUse if we're optimizing for size, so move the call at the end of the if check.
Simon Pilgrim [Sun, 2 Apr 2023 17:29:37 +0000 (18:29 +0100)]
[X86] lowerShuffleOfExtractsAsVperm - move hasOneUse checks to the end of the match. NFCI.
Check the cheap parts of the pattern first, and make the more expensive hasOneUse() call as late as possible.
Prem Chintalapudi [Sun, 2 Apr 2023 17:29:52 +0000 (10:29 -0700)]
[MCJIT] Set VMA to code address in PerfJITEventListener.
VMA should default to CodeAddr, not 0, as specified here:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/Documentation/jitdump-specification.txt
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D146496
Simon Pilgrim [Sun, 2 Apr 2023 17:07:01 +0000 (18:07 +0100)]
[X86] Move hasOneUse check on PCMPGT(X,-1) -> PCMPGT(0,X) inversion folds to the end of the match. NFCI.
Check the cheap parts of the pattern first, and make the more expensive hasOneUse() call as late as possible.
Lang Hames [Sun, 2 Apr 2023 16:41:47 +0000 (09:41 -0700)]
[ORC] Add a generic bootstrap key-value store to SimpleRemoteEPC.
SimpleRemoteEPC already included a "bootstrap symbols map" that could be used
to communicate the addresses of symbols needed for JIT bootstrap. The new
bootstrap map can be used to communicate arbitrary bootstrap values (encoded as
SPS buffers).
The bootstrap symbols map is kept as distinct becasue bootstrap symbols are
significant, and having a known value type for them allows for better debug
logging (we know how to render the values) and tooling (e.g. utils for adding
all bootstrap symbols to a JITDylib).
Simon Pilgrim [Sun, 2 Apr 2023 16:43:16 +0000 (17:43 +0100)]
[X86] combineExtractVectorElt - call hasOneUse() as late as possible. NFCI.
MMX conversion is very unlikely, so check the value types first, and make the more expensive hasOneUse() call as late as possible.
Piotr Zegar [Sun, 2 Apr 2023 15:49:27 +0000 (15:49 +0000)]
[clang-tidy] Fix findNextTokenSkippingComments & rangeContainsExpansionsOrDirectives
findNextTokenSkippingComments is actually a endless loop,
implementing it correctly.
rangeContainsExpansionsOrDirectives were skiping every second
token, if there were no whitespaces bettwen tokens.
Reviewed By: carlosgalvezp
Differential Revision: https://reviews.llvm.org/D146881
Guillaume Chatelet [Sun, 2 Apr 2023 16:02:00 +0000 (16:02 +0000)]
Revert D147231 "[libc] Adds string and TestLogger classes, use them in LibcTest"
Does not build with gcc.
This reverts commit
fc5ae0a7a45bdb5251f3dad3fc07047f987ca447.
Luke Lau [Wed, 1 Mar 2023 18:25:48 +0000 (18:25 +0000)]
[RISCV] Lower fixed length interleaved accesses via vssegN/vlsegN
This enables the interleaved access pass on O1 and above, and causes
interleaving/deinterleaving shuffles of fixed length vectors with
stores/loads to be lowered into vssegN/vlsegN.
We need to be careful and make sure that we only lower vsseg/vlseg
whenever we know the fixed vector type will fit within the minimum vlen,
and that the interleaving factor is supported for the given LMUL.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D145085
Alexandre Ganea [Sun, 2 Apr 2023 15:38:58 +0000 (11:38 -0400)]
[mlir][StorageUniquer] Fix build with LLVM_ENABLE_THREADS=OFF
Sergei Barannikov [Sun, 2 Apr 2023 15:33:27 +0000 (18:33 +0300)]
[compiler-rt] Avoid double-prefixing aliases with __USER_LABEL_PREFIX__
The prefix is added by DECLARE_SYMBOL_VISIBILITY. Calling SYMBOL_NAME
resulted in adding the prefix twice.
Reviewed By: dim
Differential Revision: https://reviews.llvm.org/D147077
Guillaume Chatelet [Thu, 30 Mar 2023 13:13:27 +0000 (13:13 +0000)]
[libc] Adds string and TestLogger classes, use them in LibcTest
This is an implementation of https://discourse.llvm.org/t/rfc-running-libc-unit-tests-as-integration-tests/69461.
Differential Revision: https://reviews.llvm.org/D147231
Simon Pilgrim [Sun, 2 Apr 2023 15:28:20 +0000 (16:28 +0100)]
[DAG] canCreateUndefOrPoison - add ISD::INSERT_VECTOR_ELT handling
If the inserted element index is guaranteed to be inbounds then a ISD::INSERT_VECTOR_ELT will not create poison/undef.
Simon Pilgrim [Sun, 2 Apr 2023 15:03:14 +0000 (16:03 +0100)]
[X86] Add test case showing failure to fold freeze through a ISD::INSERT_VECTOR_ELT node
Guillaume Chatelet [Sun, 2 Apr 2023 15:06:15 +0000 (15:06 +0000)]
[libc] Fix missing include for pthread tests
Luke Lau [Sun, 2 Apr 2023 14:56:02 +0000 (15:56 +0100)]
Revert "[RISCV] Lower fixed length interleaved accesses via vssegN/vlsegN"
This reverts commit
b95913e8c3a3521b85d689a358e620d89a4e83de.
Guillaume Chatelet [Sat, 1 Apr 2023 11:30:34 +0000 (11:30 +0000)]
[libc] Use string_view for write_to_stderr
This patch makes use of `cpp::string_view` instead of `const char*` for `write_to_stderr`. This helps sending non null-terminated buffers such as a single character, `cpp::string_view` or `cpp::string`.
It also fizes the gpu version that had several bugs (See https://reviews.llvm.org/D145913#4236641).
Differential Revision: https://reviews.llvm.org/D147375
Luke Lau [Wed, 1 Mar 2023 18:25:48 +0000 (18:25 +0000)]
[RISCV] Lower fixed length interleaved accesses via vssegN/vlsegN
This enables the interleaved access pass on O1 and above, and causes
interleaving/deinterleaving shuffles of fixed length vectors with
stores/loads to be lowered into vssegN/vlsegN.
We need to be careful and make sure that we only lower vsseg/vlseg
whenever we know the fixed vector type will fit within the minimum vlen,
and that the interleaving factor is supported for the given LMUL.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D145085
Ben Shi [Sun, 2 Apr 2023 05:06:11 +0000 (13:06 +0800)]
[LoongArch] Optimize multiplication with immediates
Optimize multiplication with some specific immediates to
a pair of `alsl`.
Reviewed By: SixWeining, xen0n
Differential Revision: https://reviews.llvm.org/D147400
Ben Shi [Sun, 2 Apr 2023 04:35:43 +0000 (12:35 +0800)]
[LoongArch][NFC] Add tests of multiplication with immediates
Reviewed By: xen0n, SixWeining
Differential Revision: https://reviews.llvm.org/D147398
Yaxun (Sam) Liu [Mon, 6 Mar 2023 15:52:47 +0000 (10:52 -0500)]
[HIP] Supports env var HIP_PATH
Currently HIP toolchain recognize env var ROCM_PATH and option --rocm-path
but only recognize --hip-path.
Some package management tools e.g. Spack relies on env var HIP_PATH to
be able to load different version of HIP dynamically.
(https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/hip/package.py#L446)
Therefore add support of env var HIP_PATH.
Reviewed by: Artem Belevich, Fangrui Song
Differential Revision: https://reviews.llvm.org/D145391
Yaxun (Sam) Liu [Thu, 9 Mar 2023 20:41:54 +0000 (15:41 -0500)]
[HIP] clang should pass `-mno-amdgpu-ieee` to -cc1
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D145721
Florian Hahn [Sun, 2 Apr 2023 11:33:43 +0000 (12:33 +0100)]
[Loads] Support SCEVAddExpr as start for pointer AddRec.
Extend handling to support `%base + offset` as start for AddRecs in
isDereferenceableAndAlignedInLoop. This is done by adjusting AccessSize
by the offset and effectively checking if the full object starting from
%base to %base + offset + access-size is dereferenceable.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D147260
Richard Smith [Sun, 2 Apr 2023 08:11:30 +0000 (01:11 -0700)]
Stop modifying trailing return types.
This change reverts the functional change from D144626 but retains its
test. Instead of dealing with the possibility that a trailing requires
clause might have been rewritten into some other incorrect form, just
stop rewriting it.
No functionality changes intended.
Reviewed By: erichkeane, ChuanqiXu
Differential Revision: https://reviews.llvm.org/D147281
Jie Fu [Sun, 2 Apr 2023 08:30:33 +0000 (16:30 +0800)]
[mlir][flang] Fix -Wunused-result after D146785 (NFC)
/data/llvm-project/mlir/examples/toy/Ch4/toyc.cpp:119:5: error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]
applyPassManagerCLOptions(pm);
^~~~~~~~~~~~~~~~~~~~~~~~~ ~~
1 error generated.
/data/llvm-project/flang/lib/Frontend/FrontendActions.cpp:669:3: error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]
mlir::applyPassManagerCLOptions(pm);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~
1 error generated.
Alvin Wong [Sat, 1 Apr 2023 18:16:07 +0000 (02:16 +0800)]
[asan][test][win] Make report_after_syminitialize test less brittle
Instead of relying on one of the two commands failing on MinGW target,
just use the `%if` conditional substitution feature from lit, which is
much less brittle.
Amends
5888a47914f44ffaf102fcb7afd3500706fe753f
Differential Revision: https://reviews.llvm.org/D147382
Joshua Cao [Sun, 2 Apr 2023 07:19:49 +0000 (00:19 -0700)]
[LoopInterchange] Add GEP with 3 indices test for pr57148
Motivated by https://reviews.llvm.org/D147117. Need a test with
BackedgeTakenCount=False and a 3 index GEP.
Kai Sasaki [Sun, 2 Apr 2023 06:39:27 +0000 (15:39 +0900)]
[mlir] Catch the case using ir print without disabling multithread
-mlir-print-ir-module-scope option cannot be used without disabling multithread for pass manager. For the usability, we can throw a validation error in mlir-opt instead of assertion failure.
Issue: https://github.com/llvm/llvm-project/issues/61578
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D146785
Min-Yih Hsu [Mon, 27 Mar 2023 17:27:27 +0000 (10:27 -0700)]
[M68k] Add support for lowering atomic fence
Ideally we want to lower ATOMIC_FENCE into `__sync_synchronize`.
However, libgcc doesn't implement that builtin as GCC simply generates an
inline assembly barrier whenever there needs to be a fence.
We use a similar way to lower ATOMIC_FENCE.
Differential Revision: https://reviews.llvm.org/D146996
Jon Phillips [Sun, 2 Apr 2023 02:21:41 +0000 (19:21 -0700)]
[clang-format][NFC] Refactor unit tests for "LambdaBodyIndentation: OuterScope"
Differential Revision: https://reviews.llvm.org/D146995
Craig Topper [Sun, 2 Apr 2023 01:53:19 +0000 (18:53 -0700)]
[RISCV] Add special case for i32 uaddo X, -1 on RV64.
uaddo X, -1 over flows if X is non-zero.
Matches what we do i32 uaddo X, -1 on RV32.
Fixes #61891.
Craig Topper [Sun, 2 Apr 2023 01:49:30 +0000 (18:49 -0700)]
[RISCV] Add i32 uaddo X, -1 test case. NFC
Craig Topper [Sat, 1 Apr 2023 22:40:53 +0000 (15:40 -0700)]
[TableGen] Move some vectors into place instead of copying them.
Roy Jacobson [Sat, 11 Mar 2023 16:39:33 +0000 (18:39 +0200)]
[Clang][AST] Fix __has_unique_object_representations computation for unnamed bitfields.
As pointed out in https://github.com/llvm/llvm-project/issues/61336, objects with
unnamed bitfields aren't be uniquely representable.
Reviewed By: shafik, Endill
Differential Revision: https://reviews.llvm.org/D145852
Peter Klausler [Sat, 1 Apr 2023 21:05:06 +0000 (14:05 -0700)]
[flang][docs] Document module name extension
Add an entry to the Extensions document describing how we
don't care about conflicts between module names and non-global
items. (This is a case where it would be a nontrivial amount
of work to catch an "error" that is only a standard conformance
issue, not anything that would prevent a program from working.)
Differential Revision: https://reviews.llvm.org/D147387
Peter Klausler [Tue, 28 Mar 2023 20:38:44 +0000 (13:38 -0700)]
[flang] Fix checks for USE-associated UDDTIO & their character argument kinds
Call GetUltimate() before checking a user-defined derived type I/O specific
procedure so that the checks work on a USE-associated procedure. And
require their character arguments to have the default CHARACTER kind.
Differential Revision: https://reviews.llvm.org/D147386
Simon Pilgrim [Sat, 1 Apr 2023 20:53:03 +0000 (21:53 +0100)]
[X86] vector-compare-any_of.ll - add AVX1OR2 check-prefix and make AVX a common check-prefix
Simon Pilgrim [Sat, 1 Apr 2023 19:28:25 +0000 (20:28 +0100)]
[X86] combinePTESTCC - fold TESTC(X,~X) -> TESTC(X,-1)
Partial fix for Issue #59998
Simon Pilgrim [Sat, 1 Apr 2023 19:19:27 +0000 (20:19 +0100)]
[X86] Add test showing failure to fold testc(X,~X) -> testc(X,-1)
Carlos Galvez [Sat, 1 Apr 2023 15:14:22 +0000 (15:14 +0000)]
[clang-tidy] Disable misc-definitions-in-headers for declarations in anonymous namespaces
Anonymous namespaces are another way of providing internal linkage,
and the check already ignores other cases of internal linkage in
headers, via "static" or "const".
Anonymous namespaces in headers are definitely a source of pitfalls,
but it's not the responsibility of this check to cover that. Instead,
google-build-namespaces will specifically warn about this issue.
Fixes https://github.com/llvm/llvm-project/issues/61471
Differential Revision: https://reviews.llvm.org/D147379
Simon Pilgrim [Sat, 1 Apr 2023 17:45:53 +0000 (18:45 +0100)]
[X86] combineSetCCMOVMSK - fold PTEST(XOR(X,Y),XOR(X,Y)) instead of PTEST(SUB(X,Y),SUB(X,Y))
Consistently use the PTEST(XOR(X,Y),XOR(X,Y)) pattern for all-vector comparisons
sstwcw [Sat, 1 Apr 2023 17:10:06 +0000 (17:10 +0000)]
[clang-format] Handle Verilog struct literals
Previously `isVerilogIdentifier` was mistaking the apostrophe used in
struct literals as an identifier. It is fixed.
Reviewed By: HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D147329
sstwcw [Sat, 1 Apr 2023 17:08:31 +0000 (17:08 +0000)]
[clang-format] Handle enum in Verilog
Verilog has enum just like C.
Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D147328
Alvin Wong [Tue, 28 Mar 2023 09:03:10 +0000 (17:03 +0800)]
[asan][test] Fix tests or mark XFAIL for MinGW target
After this change, `check-asan-dynamic` should pass on x86_64 MinGW
target, using the llvm-mingw toolchain.
The following is a list of issues fixed:
* `asan_str_test.cpp`: Exclude unintercepted functions on MinGW.
* `asan_test.cpp`: Work around regex limitation of gtest on Windows,
which only affects MinGW target because `long double` has different
size to `double`.
* `TestCases/Windows/report_after_syminitialize.cpp`: Added build
command specifically for MinGW.
* Other tests: Mark XFAIL for various reasons. Some of them need
further investigation.
Differential Revision: https://reviews.llvm.org/D147059
Alvin Wong [Thu, 30 Mar 2023 11:21:56 +0000 (19:21 +0800)]
[asan][test] Fix `TestCases/alloca_*` ptr-to-long cast on Windows
64-bit Windows uses 32-bit long so these casts fail to compile with the
error "cast from pointer to smaller type". Change to instead use
uintptr_t like other tests.
Differential Revision: https://reviews.llvm.org/D147232
Alvin Wong [Mon, 27 Mar 2023 14:48:17 +0000 (22:48 +0800)]
[compiler-rt][asan][test] Fix lit test config on MinGW
MinGW is GCC-like and does not support clang-cl, so clean up the lit cfg
to reflect that. Also mark all Windows test cases using clang-cl as
UNSUPPORTED for now. We should probably adapt most of these test cases
to use the GCC-like clang driver, but that will be for later.
Differential Revision: https://reviews.llvm.org/D147057
Simon Pilgrim [Sat, 1 Apr 2023 16:16:31 +0000 (17:16 +0100)]
[X86] LowerVectorAllEqual - handle i64 comparisons on 32-bit targets
Cyndy Ishida [Sat, 1 Apr 2023 15:28:48 +0000 (08:28 -0700)]
[llvm][TextAPI] only compare deployment version for InterfaceFile.
Simon Pilgrim [Sat, 1 Apr 2023 15:37:28 +0000 (16:37 +0100)]
[X86] MatchVectorAllEqualTest - support for sub-128-bit vector icmp(and/or(extract(X,0),extract(X,1)),-1/0) reduction patterns
LowerVectorAllEqual already has full support for this
Simon Pilgrim [Sat, 1 Apr 2023 15:29:54 +0000 (16:29 +0100)]
[X86] MatchVectorAllEqualTest - add support for icmp(and(extract(X,0),extract(X,1)),-1) allof reduction patterns
Simon Pilgrim [Sat, 1 Apr 2023 15:09:52 +0000 (16:09 +0100)]
[X86] Add vector-reduce-and-scalar.ll to test and(extract(v,0),extract(v,1)) style reduction patterns
Aaron Ballman [Sat, 1 Apr 2023 14:49:59 +0000 (10:49 -0400)]
Revert "AMDGPU: Created a subclass for the return address operand in the tail call return instruction"
This reverts commit
7a98934fadc3581ff024a77dc696b62f1a538ad5.
This appears to have broken several bots, including:
https://lab.llvm.org/buildbot/#/builders/42/builds/9472
Simon Pilgrim [Sat, 1 Apr 2023 14:38:38 +0000 (15:38 +0100)]
[X86] MatchVectorAllEqualTest - add support for icmp(reduce_and(X),-1) allof reduction patterns
Also, improve codegen in LowerVectorAllEqual for X == -1 cases to reduce over sized vector using a AND reduction
Simon Pilgrim [Sat, 1 Apr 2023 14:19:56 +0000 (15:19 +0100)]
[X86] Add AVX1OR2 common check-prefix to vector-reduce-and-cmp.ll and vector-reduce-or-cmp.ll
Emilia Dreamer [Sat, 1 Apr 2023 13:51:10 +0000 (16:51 +0300)]
[clang-format] Don't format typename template parameters as expression
bb4f6c4dca98a47054117708015bb2724256ee83 made it so that template
parameter defaults are seen akin to assignments and formatted as
expressions, however, the patch did this for all template parameters,
even for `typename` template parameters.
This patch formats `typename` and `class` template parameters as types.
Fixes https://github.com/llvm/llvm-project/issues/61841
Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D147318
Simon Pilgrim [Sat, 1 Apr 2023 13:28:41 +0000 (14:28 +0100)]
[X86] Add AVX512F test coverage to vector-reduce-and-cmp.ll and vector-reduce-or-cmp.ll