Philip Reames [Tue, 14 Mar 2023 18:11:27 +0000 (11:11 -0700)]
[MSAN] Add (fixed) vector load/store test coverage [nfc]
Alexander Shaposhnikov [Tue, 14 Mar 2023 18:12:19 +0000 (18:12 +0000)]
[Clang][CodeGen] Fix linkage and visibility of template parameter objects
This diff fixes linkage and visibility of template parameter objects.
The associated GitHub issue: https://github.com/llvm/llvm-project/issues/51571#
Test plan:
1/ ninja check-all
2/ bootstrapped Clang passes tests
Differential revision: https://reviews.llvm.org/D145859
Snehasish Kumar [Mon, 13 Mar 2023 20:11:58 +0000 (20:11 +0000)]
[memprof] Record BuildIDs in the raw profile.
This patch adds support for recording BuildIds usng the sanitizer
ListOfModules API. We add another entry to the SegmentEntry struct and
change the memprof raw version.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D145190
Joseph Huber [Mon, 13 Mar 2023 14:33:08 +0000 (09:33 -0500)]
[Clang] Always use --no-undefined when linking AMDGPU images
AMDGPU uses ELF shared libraries to implement their executable device
images. One downside to this method is that it disables regular warnings
on undefined symbols. This is because shared libraries expect these to
be resolves by later loads. However, the GPU images do not support
dynamic linking so any undefined symbol is going to cause a runtime
error. This patch adds `--no-undefined` to the `ld.lld` invocation to guarantee
that undefined symbols are always caught as linking errors rather than
runtime errors.
Reviewed By: arsenm, MaskRay, #amdgpu
Differential Revision: https://reviews.llvm.org/D145941
Teresa Johnson [Tue, 14 Mar 2023 03:29:02 +0000 (20:29 -0700)]
[docs] Document MemProf metadata in LangRef
Add documentation for memprof and callsite metadata in LangRef.
Differential Revision: https://reviews.llvm.org/D146007
Alex Bradbury [Tue, 14 Mar 2023 17:55:11 +0000 (17:55 +0000)]
[RISCV] Fix regression due to interaction of MachineOutliner and MachineCopyPropagation
D144535 enabled machine copy propagation for RISC-V and added it to the
pass pipeline in addPreEmitPass2 (after the MachineOutliner).
Unfortunately, the MachineCopyPropagation pass is unable to correctly
analyse outlined functions, and will delete copy instructions where a
register is set that is intended to be live-out.
RISCVInstrInfo::buildOutlinedFrame will directly insert a JALR, while a
similar function going through the normal codegen path would have a
PseudoRet with operands indicating registers that are live-out.
This patch does the simplest fix, which is to run MachineCopyPropagation
before the MachineOutliner.
Differential Revision: https://reviews.llvm.org/D146037
Mark de Wever [Fri, 17 Feb 2023 20:27:08 +0000 (21:27 +0100)]
[NFC][libc++][format] Improves diagnostics.
While implementing the tests for LWG3720 I noticed the std::format
errors for non-formattable types are not user friendly (and thus hard to
write a .verify test too).
The issue stems from using a deleted function for invalid types. By
using a function that returns an invalid value the diagnostics become a
lot better. Before this change the existing "invalid value"
static_assert could never trigger. Now it can be triggered by user
code, therefore a diagnostic message has been added.
Before this change using a non-formattable type resulted in list of
error messages along the line of
.../include/c++/v1/__format/format_arg_store.h:167:29: error: call to deleted function '__determine_arg_t'
constexpr __arg_t __arg = __determine_arg_t<_Context, remove_cvref_t<_Tp>>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../include/c++/v1/__format/format_arg_store.h:210:54: note: in instantiation of function template specialization 'std::__format::__create_format_arg<std::format_context, char16_t &>' requested here
basic_format_arg<_Context> __arg = __format::__create_format_arg<_Context>(__args);
^
.../include/c++/v1/__format/format_arg_store.h:246:19: note: in instantiation of function template specialization 'std::__format::__create_packed_storage<std::format_context, int &, char16_t &>' requested here
__format::__create_packed_storage(__storage.__types_, __storage.__values_, __args...);
^
.../include/c++/v1/__format/format_functions.h:73:10: note: in instantiation of member function 'std::__format_arg_store<std::format_context, int &, char16_t &>::__format_arg_store' requested here
return _VSTD::__format_arg_store<_Context, _Args...>(__args...);
^
.../include/c++/v1/__config:664:17: note: expanded from macro '_VSTD'
# define _VSTD std
^
.../libcxx/test/std/utilities/format/format.string/format.string.std/lwg3720_arg_id_width_precision_allowed_types.pass.cpp:46:50: note: in instantiation of function template specialization 'std::make_format_args<std::format_context, int &, char16_t &>' requested here
TEST_IGNORE_NODISCARD std::vformat(fmt, std::make_format_args<context_t<CharT>>(args...));
^
.../libcxx/test/std/utilities/format/format.string/format.string.std/lwg3720_arg_id_width_precision_allowed_types.pass.cpp:69:3: note: in instantiation of function template specialization 'test_exception<char, int, char16_t>' requested here
test_exception(SV("{:{}}"), 42, u'0');
^
.../libcxx/test/std/utilities/format/format.string/format.string.std/lwg3720_arg_id_width_precision_allowed_types.pass.cpp:97:3: note: in instantiation of function template specialization 'test<char>' requested here
test<char>();
^
.../include/c++/v1/__format/format_arg_store.h:154:19: note: candidate function [with _Context = std::format_context, _Tp = char16_t] has been explicitly deleted
consteval __arg_t __determine_arg_t()
^
.../include/c++/v1/__format/format_arg_store.h:148:19: note: candidate function [with _Context = std::format_context, _Tp = char16_t]
consteval __arg_t __determine_arg_t() {
<more errors omitted>
.../include/c++/v1/__format/format_arg_store.h:185:22: note: initializer of '__arg' is not a constant expression
.../include/c++/v1/__format/format_arg_store.h:167:21: note: declared here
constexpr __arg_t __arg = __determine_arg_t<_Context, remove_cvref_t<_Tp>>();
^
.../build/include/c++/v1/__format/format_arg_store.h:194:73: error: member reference base type 'char16_t' is not a structure or union
__arg, basic_string_view<typename _Context::char_type>{__value.data(), __value.size()}};
~~~~~~~^~~~~
11 errors generated.
After the change using the same non-formmatable type gives the following
diagnostics
.../include/c++/v1/__format/format_arg_store.h:168:3: error: static assertion failed due to requirement '__arg != __arg_t::__none': the supplied type is not formattable
static_assert(__arg != __arg_t::__none, "the supplied type is not formattable");
^ ~~~~~~~~~~~~~~~~~~~~~~~~
.../include/c++/v1/__format/format_arg_store.h:210:54: note: in instantiation of function template specialization 'std::__format::__create_format_arg<std::format_context, char16_t &>' requested here
basic_format_arg<_Context> __arg = __format::__create_format_arg<_Context>(__args);
^
.../include/c++/v1/__format/format_arg_store.h:246:19: note: in instantiation of function template specialization 'std::__format::__create_packed_storage<std::format_context, int &, char16_t &>' requested here
__format::__create_packed_storage(__storage.__types_, __storage.__values_, __args...);
^
.../include/c++/v1/__format/format_functions.h:73:10: note: in instantiation of member function 'std::__format_arg_store<std::format_context, int &, char16_t &>::__format_arg_store' requested here
return _VSTD::__format_arg_store<_Context, _Args...>(__args...);
^
.../include/c++/v1/__config:664:17: note: expanded from macro '_VSTD'
# define _VSTD std
^
.../libcxx/test/std/utilities/format/format.string/format.string.std/lwg3720_arg_id_width_precision_allowed_types.pass.cpp:46:50: note: in instantiation of function template specialization 'std::make_format_args<std::format_context, int &, char16_t &>' requested here
TEST_IGNORE_NODISCARD std::vformat(fmt, std::make_format_args<context_t<CharT>>(args...));
^
.../libcxx/test/std/utilities/format/format.string/format.string.std/lwg3720_arg_id_width_precision_allowed_types.pass.cpp:69:3: note: in instantiation of function template specialization 'test_exception<char, int, char16_t>' requested here
test_exception(SV("{:{}}"), 42, u'0');
^
.../libcxx/test/std/utilities/format/format.string/format.string.std/lwg3720_arg_id_width_precision_allowed_types.pass.cpp:97:3: note: in instantiation of function template specialization 'test<char>' requested here
test<char>();
^
.../include/c++/v1/__format/format_arg_store.h:168:23: note: expression evaluates to '0 != 0'
static_assert(__arg != __arg_t::__none, "the supplied type is not formattable");
~~~~~~^~~~~~~~~~~~~~~~~~
1 error generated.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D144325
Arthur Eubanks [Tue, 14 Mar 2023 17:48:10 +0000 (10:48 -0700)]
[StructuralHash][NFC] Use anonymous namespace
Philip Reames [Tue, 14 Mar 2023 15:39:19 +0000 (08:39 -0700)]
Move utility for acting on each lane of ElementCount to common code [nfc]
This was first written for AddressSanitizer, but I'm about to reuse it for MemorySanitizer as well.
Nico Weber [Tue, 14 Mar 2023 17:35:02 +0000 (18:35 +0100)]
[gn] reformat all gn files
I ran:
git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format
Nico Weber [Tue, 14 Mar 2023 17:34:25 +0000 (18:34 +0100)]
[gn] minor cleanup after
33a55c3d8c73
Mark de Wever [Sat, 18 Feb 2023 12:30:14 +0000 (13:30 +0100)]
[libc++][format] Addresses LWG3825.
LWG3825 Missing compile-time argument id check in
basic_format_parse_context::next_arg_id
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D144327
Alexey Bataev [Mon, 13 Mar 2023 21:40:54 +0000 (14:40 -0700)]
[SLP]Remove CreateShuffle lambda and reuse ShuffleBuilder functions.
After merging main part of the gather/buildvector code, CreateShuffle
lambda can removed and ShuffleBuilder add functions can be used instead.
Also, part of the code from CreateShuffle migrated to createShuffle of
the BaseShuffleAnalysis::createShuffle function for better code emission.
Differential Revision: https://reviews.llvm.org/D145988
Congcong Cai [Tue, 14 Mar 2023 17:07:55 +0000 (01:07 +0800)]
[SemaCXX]use CorrectDelayedTyposInExpr in ActOnCXXFoldExpr only when Diag
PR #61326
- fix clang crash when fold expression contains a delayed typos correction.
code snippet in `ActOnCXXFoldExpr`
``` if (!LHS || !RHS) {
Expr *Pack = LHS ? LHS : RHS;
assert(Pack && "fold expression with neither LHS nor RHS");
DiscardOperands();
if (!Pack->containsUnexpandedParameterPack())
return Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
<< Pack->getSourceRange();
}
```
`DiscardOperands` will be triggered when LHS/RHS is delayed typo correction expression.
It will output and clean all diagnose but still return a valid expression. (in else branch)
valid expression will be handled in caller function. When caller wants to output the diagnose, the diagnose in delayed typo correction expression has been consumed in `ActOnCXXFoldExpr`. It causes clang crash.
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D145892
Arthur Eubanks [Tue, 14 Mar 2023 17:04:16 +0000 (10:04 -0700)]
[StandardInstrumentations][NFC] Minor code cleanup
Paul Walker [Mon, 27 Feb 2023 20:16:07 +0000 (20:16 +0000)]
[LLVM] Remove support for constant scalable vector GEPs.
This work has fallen out from D134648 as a requirement to loosen
the "constness" of vscale.
Differential Revision: https://reviews.llvm.org/D145404
Nikita Popov [Tue, 14 Mar 2023 16:45:38 +0000 (17:45 +0100)]
Revert "[InstCombine] Return instruction from replaceUse()"
This reverts commit
27c4e233104ba765cd986b3f8b0dcd3a6c3a9f89.
I think I made a mistake with the use in RemoveConditionFromAssume(),
because the instruction being changed is not the current one, but
the next assume. Revert the change for now.
Alex Bradbury [Tue, 14 Mar 2023 16:36:16 +0000 (16:36 +0000)]
[RISCV][NFC] Small refactor in RISCVISAInfo::parseArchString
Slightly refactor handling of version extraction for the 'baseline' ISA,
to make an upcoming patch easier to review.
Arthur Eubanks [Tue, 14 Mar 2023 16:32:49 +0000 (09:32 -0700)]
[CoroCleanup] Invalidate analyses on changed functions before running SimplifyCFG
Or else the sub-FunctionPassManager may see out of date analyses.
Mark de Wever [Wed, 22 Feb 2023 18:48:01 +0000 (19:48 +0100)]
[libc++][CI] Improves Dockerfile
- Remove temporary apt files
- Removes LLVM16 TODO
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D144575
Mark de Wever [Sun, 12 Mar 2023 16:11:29 +0000 (17:11 +0100)]
[libc++] Qualifies uint32_t and friends.
This has been done using the following command
find libcxx/test -type f -exec perl -pi -e 's|^([^/]+?)((?<!::)(?<!::u)u?int(_[a-z]+)?[0-9]{1,2}_t)|\1std::\2|' \{} \;
And manually removed some false positives in std/depr/depr.c.headers.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D145880
Arthur Eubanks [Tue, 14 Mar 2023 16:22:38 +0000 (09:22 -0700)]
[AssumeBundleBuilder] Fix PreservedAnalyses reporting
These weren't properly reporting changes.
Kiran Chandramohan [Tue, 14 Mar 2023 16:26:58 +0000 (16:26 +0000)]
Revert "[Flang][OpenMP] Add support for OpenMP max reduction"
Reverting to fix a buildbot failure.
This reverts commit
a7d80f43cb8d3a2deb09f57d0904732d40020752.
Arthur Eubanks [Tue, 14 Mar 2023 16:21:20 +0000 (09:21 -0700)]
[gn build] Fix gn build
Jennifer Yu [Mon, 13 Mar 2023 21:12:06 +0000 (14:12 -0700)]
[OpenMP]Skip generating this[:1] map info for non-member variable.
My change of D14093 is only fixed problem for "pragma target data".
The problem still here for "pragma target"
what I am missing is:
When processing "pragma target data", the VD is passed when call to
emitCombinedEntry, so check VD is null as map for this pointer.
But when processing "pragma target" the VD is passed as nullptr, so
check VD is null is not working.
To fix this I add a new parameter IsMapThis. During the call to
emitCombinedEntry passes true if it is capturing this pointer and use
that instead check of "!VD".
Differential Revision: https://reviews.llvm.org/D146000
Alex Bradbury [Tue, 14 Mar 2023 16:05:14 +0000 (16:05 +0000)]
[RISCV][test][llvm-objdump] Add test cases for objdump's handling of RISCV arch attributes
In preparation for a follow-up patch to adjust the policy. The error for
an unrecognized version of the base ISA is particularly problematic, as
binaries produced from a current GCC are rejected.
The testing approach is modeled on the riscv-attributes.s file in
lld/test/ELF.
Kiran Chandramohan [Tue, 14 Mar 2023 15:26:24 +0000 (15:26 +0000)]
[Flang][OpenMP] Add support for OpenMP max reduction
This patch adds support for reduction of max-intrinsic for scalar
types. Max is lowered as a compare-select in the default lowering
flow for Flang. This pattern is matched and replaced with the
OpenMP dialect reduction operation.
Note: This is a temporary flow. The plan is to move to a flow where
the OpenMP reduction operation is inserted during lowering.
Reviewed By: do
Differential Revision: https://reviews.llvm.org/D145083
Arthur Eubanks [Mon, 13 Mar 2023 17:45:32 +0000 (10:45 -0700)]
[Pipeline] Move some GlobalOpt/GlobalDCE runs into simplification pipeline
These are very clearly more simplification than optimization.
Mostly NFC, except for some ordering around passes that don't really matter.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D145967
Nikita Popov [Tue, 14 Mar 2023 14:26:41 +0000 (15:26 +0100)]
[Pipelines] Restore old DAE position in LTO pipeline
This is a partial revert of D128830, restoring the previous
position of DeadArgElim in the fat LTO pipeline. The motivation
for this is a major code size regression observed in Rust and
illustrated in the PhaseOrdering test.
This is a conservative fix restoring the previous pipeline order.
The real problem is that the LTO pipeline is conceptually broken:
It doesn't have a CGSCC function simplification pipeline. The
inliner is just being run by itself. This wouldn't be a problem
if fat LTO used a standard design where ArgPromotion and DAE are
only run after functions have already been simplified by the
CGSCC inliner pipeline.
Differential Revision: https://reviews.llvm.org/D146051
Alex Zinenko [Fri, 3 Mar 2023 17:23:00 +0000 (17:23 +0000)]
[mlir] relax value handle updates when operation is replaced
The initial implementaiton of value handle update when the payload
operation defining the values associated with value handles was being
replaced required the replacement operation to have the same number of
results. This is not strictly necessary. The replacement operation may
have more results, or less results provided that there are no handles to
the results that have no equivalent in the replacement op.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D145254
Nikita Popov [Tue, 14 Mar 2023 15:50:31 +0000 (16:50 +0100)]
[InstCombine] Return instruction from replaceUse()
Same as with other replacement methods, it's generally necessary
to report a change on the instruction itself, e.g. by returning
it from the visit method (or possibly explicitly adding it to the
worklist).
Return Instruction * from replaceUse() to encourage the usual
"return replaceXYZ" pattern.
zhijian [Tue, 14 Mar 2023 15:50:20 +0000 (11:50 -0400)]
[AIX] change "llvm-ar" to "env OBJECT_MODE=any llvm-ar" in clang/test for AIX OS
Summary:
In patch https://reviews.llvm.org/D127864. we add a new option -X for AIX OS, and default value is -X32. In order not effect the test cases in clang/test. we need to change "llvm-ar" to "env OBJECT_MODE=any llvm-ar" in clang/test for AIX OS
Differential Revision: https://reviews.llvm.org/D145600
Nikita Popov [Tue, 14 Mar 2023 15:41:36 +0000 (16:41 +0100)]
[InstCombine] Fix infinite combine loop (PR61361)
In the degenerate case where the select is fed by an unsimplified
icmp with two constant operands, don't try to replace one constant
with another. Wait for the icmp to be simplified first instead.
Fixes https://github.com/llvm/llvm-project/issues/61361.
Aaron Ballman [Tue, 14 Mar 2023 15:31:45 +0000 (11:31 -0400)]
Remove an unused private data member; NFC
Joseph Huber [Tue, 14 Mar 2023 15:27:09 +0000 (10:27 -0500)]
[libc] Set the stub filename to the target name instead of the source
The GPU target requires some weird special case handling to create fat
binaries. CMake offers no way to set the name of an object library. The
only way to do this is to create a file with the desired name and use
that. Currently we name it after the source filename. However, this
breaks if there is more than a single source. This patch changes the
logic to instead look up the object target name and use that. E.g.
`src.__support.OSUtil.osutil` will be `osutil.cpp`.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D145912
Simon Pilgrim [Tue, 14 Mar 2023 15:26:35 +0000 (15:26 +0000)]
[X86] Add test coverage for D137388
Issue #58914 reported an example of the TwoAddressInstruction crash that was fixed (without test case) in D137388
aabhinavg [Tue, 14 Mar 2023 08:19:24 +0000 (13:49 +0530)]
[Docs] Added llvm-reduce docs in CommandGuide
[Docs] Added llvm-reduce docs in CommandGuide
Differential Revision: https://reviews.llvm.org/D146020
Simon Pilgrim [Tue, 14 Mar 2023 15:10:24 +0000 (15:10 +0000)]
[DAG] Match select(icmp(x,y),sub(x,y),sub(y,x)) -> abd(x,y) patterns
Pulled out of PowerPC, and added ABDS support as well (hence the additional v4i32 PPC matches)
Differential Revision: https://reviews.llvm.org/D144789
Aaron Ballman [Tue, 14 Mar 2023 15:07:14 +0000 (11:07 -0400)]
Fix false positive with unreachable C++ catch handlers
This addresses an issue found by WG21 and tracked by CWG2699 (which is
not yet publicly published). The basic problem is that Clang issues a
diagnostic about not being able to reach a handler, but that handler
*is* reached at runtime. Clang's diagnostic behavior was matching the
standard wording, and our runtime behavior was matching the standard's
intent.
This fixes the diagnostic so that it matches the runtime behavior more
closely, and reduces the number of false positives. This is the
direction of choice taken by Core for CWG2699 and it seems unlikely
that WG21 will change direction here.
Fixes https://github.com/llvm/llvm-project/issues/61177
Differential Revision: https://reviews.llvm.org/D145408
Kazu Hirata [Tue, 14 Mar 2023 15:07:42 +0000 (08:07 -0700)]
[CodeGen] Use *{Set,Map}::contains (NFC)
Jakub Kuderski [Tue, 14 Mar 2023 15:01:13 +0000 (11:01 -0400)]
[mlir][vector] Clarify OOB semantics of remaining load/store ops
This is a follow up for https://reviews.llvm.org/D145824 that clarifies
the out-of-bounds behavior for other masked load/store ops. It uses the
same wording and informal semantics syntax as `gather` and `scatter`.
Issue: https://github.com/llvm/llvm-project/issues/60905
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D145975
Valentin Clement [Tue, 14 Mar 2023 15:01:36 +0000 (16:01 +0100)]
[flang] Handle parent component on the LHS of intrinsic assignment
When the LHS is referring to a parent component the box need to be
reboxed to the parent component type so the runtime can handle the
assignment correctly.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D146046
Kevin Sala [Tue, 28 Feb 2023 16:20:21 +0000 (17:20 +0100)]
[OpenMP][libomptarget][NFC] Add documentation regarding NextGen plugins
Differential Revision: https://reviews.llvm.org/D144975
Jakub Kuderski [Tue, 14 Mar 2023 14:48:13 +0000 (10:48 -0400)]
[mlir][vector] Add gather lowering patterns
This is for targets that do not support gather-like ops, e.g., SPIR-V.
Gather is expanded into lower-level vector ops with memory accesses
guarded with `scf.if`.
I also considered generating `vector.maskedload`s, but decided against
it to keep the `memref` and `tensor` codepath closer together. There's a
good chance that if a target doesn't support gather it does not support
masked loads either.
Issue: https://github.com/llvm/llvm-project/issues/60905
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D145942
NAKAMURA Takumi [Tue, 14 Mar 2023 13:25:31 +0000 (22:25 +0900)]
llvm/test/TableGen/intrinsic-pointer-to-any.td: Rework D125247.
It should've updated the number of `def i8 : ValueType<8, 3>;` to `5`,
since it renumbered ValueTypes.
FYI, the number 3 is `i2` and `IIT_I2(57)` was chosen in IntrinsicEmitter.
Simon Pilgrim [Tue, 14 Mar 2023 14:41:11 +0000 (14:41 +0000)]
[DAG] Fold (bitcast (logicop (bitcast x), (c))) -> (logicop x, (bitcast c)) iff the current logicop type is illegal
Try to remove extra bitcasts around logicops if we're dealing with illegal types
Fixes the regressions in D145939
Differential Revision: https://reviews.llvm.org/D146032
Simon Pilgrim [Tue, 14 Mar 2023 14:32:05 +0000 (14:32 +0000)]
[X86] Fix typo in vXi64 ABDS/ABDU test cases
The select operands were commuted preventing D144789 from folding
Joseph Huber [Tue, 14 Mar 2023 13:15:20 +0000 (08:15 -0500)]
[libc] Remove dummy archive and file from integration test
This doesn't seem to be used anymore after recent changes that removed
the `--sysroot` method for the integration tests.
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/D146040
Jie Fu [Tue, 14 Mar 2023 14:24:37 +0000 (22:24 +0800)]
[lldb] Fix -Wswitch in TypeSystemClang.cpp ('SveBoolx2' and 'SveBoolx4' not handled in switch) (NFC)
/data/llvm-project/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:4859:13: error: enumeration values 'SveBoolx2' and 'SveBoolx4' not handled in switch [-Werror,-Wswitch]
switch (llvm::cast<clang::BuiltinType>(qual_type)->getKind()) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Nikita Popov [Tue, 14 Mar 2023 14:19:02 +0000 (15:19 +0100)]
[PhaseOrdering] Add test for DAE/GlobalDCE interaction (NFC)
Collin Baker [Tue, 14 Mar 2023 13:57:44 +0000 (09:57 -0400)]
[libclang] No longer attempt to get a dependent bit-width
Handle template parameter-dependent bit field widths in libclang
In a class template, a bit field's width may depend on a template
parameter. In this case the width expression cannot be evaluated.
Previously clang_getFieldDeclBitWidth() would assert, or cause memory
unsafety and return an invalid result if assertions are disabled.
This adds a check for this case which returns an error code.
This work was largely taken from an earlier patch which was reverted
due to an accidental API duplication
(https://reviews.llvm.org/D130303).
Fixes: https://github.com/llvm/llvm-project/issues/56644
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
Differential Revision: https://reviews.llvm.org/D146039
Max Kazantsev [Tue, 14 Mar 2023 13:26:29 +0000 (20:26 +0700)]
[TTI] Treat AND/OR with widenable conditions as free of cost
Because widenable conditions with eventually lower into a constant, such instructions
as `and`, `or` etc. will also be optimized away. Treat them as free.
This is an important thing to have if we want that guards represented as experimental.guard
calls and in their explicit form (branch by `and` with widenable condition) have the same cost
for unroller and other passes like this.
Differential Revision: https://reviews.llvm.org/D146034
Reviewed By: nikic
pvanhout [Mon, 13 Mar 2023 10:33:15 +0000 (11:33 +0100)]
Reland: [DAG/AMDGPU] Use UniformityAnalysis in DAGISel
Switch DAGISel over to UniformityAnalysis, which was one of the last remaining users of the DivergenceAnalysis.
No explosions seen during internal testing so this looks like a smooth transition.
Reviewed By: sameerds
Differential Revision: https://reviews.llvm.org/D145918
Alexey Bataev [Tue, 14 Mar 2023 12:29:01 +0000 (05:29 -0700)]
[SLP]Fix PR61395: need to adjust vector factor after emitting shuffle
operation for combined entries.
The vector factor after combining of the shuffle entries is defined by
the size of the mask, not by the vector factors of the original
entries. So, need to adjust it to emit correct code.
Joseph Huber [Tue, 14 Mar 2023 13:18:22 +0000 (08:18 -0500)]
[libc] Correctly pass the compile options to the internal GPU compilation
Summary:
We use an internal option to create the GPU binary used for testing.
This wasn't getting the proper flags passed to it due to a missing
variable name.
Pavel Kosov [Tue, 14 Mar 2023 13:14:47 +0000 (16:14 +0300)]
[NFC][OHOS] Temporarily switch off tests for windows
pvanhout [Tue, 14 Mar 2023 12:49:29 +0000 (13:49 +0100)]
[AMDGPU] Don't run `llc-pipeline.ll` when expensive_checks are enabled
AMDGPU ISel can add extra passes when expensive checks are enabled. This means the pipeline can be reordered and the checks may fail.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D146038
Guillaume Chatelet [Tue, 14 Mar 2023 12:46:21 +0000 (12:46 +0000)]
[reland][libc][NFC] Move memcmp implementations in subfolders
Guillaume Chatelet [Tue, 14 Mar 2023 13:00:07 +0000 (13:00 +0000)]
Revert "[libc][NFC] Move memcmp implementations in subfolders"
this broke arm32 build bots
This reverts commit
7f20e2a8d2ba73a8b05742903f4ae42afec82bff.
Aaron Ballman [Tue, 14 Mar 2023 12:57:25 +0000 (08:57 -0400)]
Revert "Fix include order in CXType.cpp"
This reverts commit
4d55a0b512a17dfaa2461b8803d37b79f6c9691d.
The addition of clang_isBitFieldDecl is not needed because
clang_Cursor_isBitField already exists.
Adrian Kuegel [Tue, 14 Mar 2023 12:54:01 +0000 (13:54 +0100)]
Leandro Lupori [Fri, 3 Mar 2023 12:49:23 +0000 (12:49 +0000)]
[flang] Handle mismatches of procedure type args
Fortran allows type mismatch when passing actual arguments to
procedures and most cases were already being handled correctly by
Flang. However, conversion of data types to and from procedures and
conversion between procedures and char procedures were not always
handled properly. The missing cases were added and these
conversions are supported now.
Fixes #60550
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D145601
Timm Bäder [Thu, 9 Mar 2023 17:55:25 +0000 (18:55 +0100)]
[clang][sema][NFC] Make a few functions const
Differential Revision: https://reviews.llvm.org/D145947
Adrian Kuegel [Tue, 14 Mar 2023 12:45:53 +0000 (13:45 +0100)]
Guillaume Chatelet [Tue, 14 Mar 2023 12:46:21 +0000 (12:46 +0000)]
[libc][NFC] Move memcmp implementations in subfolders
Alex Bradbury [Tue, 14 Mar 2023 12:46:13 +0000 (12:46 +0000)]
[RISCV] Reject 'g' with explicit version in parseArchString
There is no versioning scheme for the 'g' shorthand for imafd (or in
current ISA specs, imafd_zifencei_zicsr). As such, the only sensible
behaviour to me seems to be to reject a version for it.
Differential Revision: https://reviews.llvm.org/D145954
Takuya Shimizu [Tue, 14 Mar 2023 12:43:35 +0000 (08:43 -0400)]
[clang][Sema] Avoid duplicate diagnostics for unreachable fallthrough attribute
This patch checks whether -Wunreachable-code-fallthrough is enabled
when clang encounters unreachable fallthrough attributes and, if so,
suppresses code will never be executed warning to avoid duplicate
warnings.
Fixes https://github.com/llvm/llvm-project/issues/60416
Differential Revision: https://reviews.llvm.org/D145842
LiaoChunyu [Tue, 14 Mar 2023 11:44:26 +0000 (19:44 +0800)]
[RISCV] Return false from shouldFormOverflowOp when type is i8 and i16
i8 and i16 are not using overflow.
Reduce the number of zero extension instructions.
To reduce the uncertainty of the unknown,
most of the checks of the virtual function are kept
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D143646
Kadir Cetinkaya [Tue, 14 Mar 2023 09:13:28 +0000 (10:13 +0100)]
[clangd] Drop stale macro and mark ranges
I'll follow up with patching of those ranges, this is to stop bleeding
mentioned in https://github.com/clangd/clangd/issues/1537.
Differential Revision: https://reviews.llvm.org/D146024
Haojian Wu [Tue, 14 Mar 2023 08:37:18 +0000 (09:37 +0100)]
Remove an extra `//` in the IWYU pragma for gtest-matchers.h
Differential Revision: https://reviews.llvm.org/D146022
Nicholas Guy [Mon, 13 Mar 2023 14:46:30 +0000 (14:46 +0000)]
[Codegen][ARM][AArch64] Support symmetric operations on complex numbers
Differential Revision: https://reviews.llvm.org/D142482
Nicholas Guy [Mon, 13 Mar 2023 14:44:57 +0000 (14:44 +0000)]
Cleanup of Complex Deinterleaving pass (NFCI)
Differential Revision: https://reviews.llvm.org/D143177
Haojian Wu [Tue, 14 Mar 2023 08:34:39 +0000 (09:34 +0100)]
[Tooling/Inclusion] Index more sub std namespace symbols.
Fixes https://github.com/llvm/llvm-project/issues/61373
Differential Revision: https://reviews.llvm.org/D146021
Nicolas Vasilache [Mon, 13 Mar 2023 20:33:15 +0000 (13:33 -0700)]
[mlir][GPUTransforms] NFC - Refactor GPUTransforms.cpp in preparation for improvements.
Depends on: D145977
Differential Revision: https://reviews.llvm.org/D145980
Kadir Cetinkaya [Fri, 24 Feb 2023 08:36:07 +0000 (09:36 +0100)]
[Support][MemBuffer] Prevent UB on empty StringRefs
Empty StringRefs are usually identified by their length being zero, and
sometimes they'll have Data==nullptr (e.g. default constructed, or derived from
an operation like split/copy and result turned out to be empty).
If such StringRef objects are passed to llvm::MemoryBuffer::getMemBufferCopy,
it'll result in UB as neither src nor dst can be null, even if size is zero.
This patch prevents that UB by not issuing a copy whenever StringRef is empty.
Differential Revision: https://reviews.llvm.org/D144706
Nabeel Omer [Mon, 13 Mar 2023 16:17:03 +0000 (16:17 +0000)]
[X86] Fix encoding for ATOMIC_LOGIC_OP
Fixes PR#61384.
Differential Revision: https://reviews.llvm.org/D145930
Nabeel Omer [Mon, 13 Mar 2023 16:08:42 +0000 (16:08 +0000)]
[X86] Add negative test for D145930
This patch adds a negative test for the issue discovered in D145930.
Differential Revision: https://reviews.llvm.org/D145933
Nicolas Vasilache [Mon, 13 Mar 2023 19:35:14 +0000 (12:35 -0700)]
[mlir][Transform] NFC - Various API cleanups and use RewriterBase in lieu of PatternRewriter
Depends on: D145685
Differential Revision: https://reviews.llvm.org/D145977
Alex Bradbury [Tue, 14 Mar 2023 11:16:23 +0000 (11:16 +0000)]
[RISCV][test] Test case for regression when MachineOutliner and MachineCopyPropagation are both enabled
MachineCopyPropagation removes a register copy in the outlined function
as it doesn't see that it's live-out from the function.
Nicolas Vasilache [Mon, 13 Mar 2023 19:29:10 +0000 (12:29 -0700)]
[mlir][Affine] Add helper functions to allow reordering affine.apply operands and decompose the ops into smaller components
Care is taken to order operands from least hoistable to most hoistable and to process subexpressions in the same
order.
This allows exposing more oppportunities for licm, cse and strength reduction.
Such a step should typically be applied while we still have loops in the IR and just before lowering affine ops to arith.
This is because the affine.apply canonicalization currently tries to maximally compose chains of affine.apply operations
and could undo the effects of these decompositions.
Depends on: D145784
Differential Revision: https://reviews.llvm.org/D145685
Nikita Popov [Fri, 3 Mar 2023 15:22:41 +0000 (16:22 +0100)]
Reapply [LowerTypeTests] Avoid creation of select constant expression
Reapply with a fix for phi handling: For phis, we need to insert
into the incoming block, not above the phi. This is especially
tricky if there are multiple incoming values from the same
predecessor, because these must all use the same value.
-----
LowerTypeTests replaces weak declarations with an icmp+select
constant expressions. As this is not a relocatable expression,
it additionally promotes initializers using it to global ctors.
As part of https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179,
I would like to remove the select constant expression, of which LTT
is now the last user. This is a bit tricky, because we now need to
replace a constant with an instruction, which might require
converting intermediate constant expression users to instructions as
well.
We do this using the convertUsersOfConstantsToInstructions() helper.
However, it needs to be slightly extended to also support expansion
of ConstantAggregates. These are important in this context, because
the promotion of initializers to global ctors will produce stores
of such aggregates.
Differential Revision: https://reviews.llvm.org/D145247
Luke Lau [Mon, 13 Mar 2023 18:12:12 +0000 (18:12 +0000)]
[RISCV][NFC] Share interleave mask checking logic
This adds two new methods to ShuffleVectorInst, isInterleave and
isInterleaveMask, so that the logic to check if a shuffle mask is an
interleave can be shared across the TTI, codegen and the interleaved
access pass.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D145971
pvanhout [Tue, 14 Mar 2023 10:48:40 +0000 (11:48 +0100)]
Revert "[DAG/AMDGPU] Use UniformityAnalysis in DAGISel"
This reverts commit
0022b5803fd4f5a4e9fcf233267c0ffa1b88f763.
Emilia Dreamer [Tue, 14 Mar 2023 10:48:05 +0000 (12:48 +0200)]
[clang-format] Treat &/&& as reference when followed by requires clause
Previously, the token annotator would get confused and annotate a member
function's ref qualifier as a binary operator, if said function also had
a requires clause after it.
This patch accounts for that, treating requires clauses more similarly
to `noexcept`, which also comes after the ref qualifier.
Fixes https://github.com/llvm/llvm-project/issues/61270
Reviewed By: HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D145656
Nicolas Vasilache [Mon, 13 Mar 2023 19:24:58 +0000 (12:24 -0700)]
[mlir][DialectUtils] Cleanup IndexingUtils and provide more affine variants while reusing implementations
Differential Revision: https://reviews.llvm.org/D145784
Max Kazantsev [Tue, 14 Mar 2023 10:16:54 +0000 (17:16 +0700)]
[NFC] Drop NDEBUG around MSSA verification
Proposed on review of https://reviews.llvm.org/D145894.
Max Kazantsev [Tue, 14 Mar 2023 10:13:59 +0000 (17:13 +0700)]
[IndVars] Option verify-indvars is broken (and always has been), delete it
This option is switched off by default, and it seems that it has never worked correctly.
What it basically does is: it remembers current BECount SCEV, and after all transforms
tries to validate some facts for it. However, between these two points this SCEV may
become invalid (e.g. because some SCEVUnknown it references may be deleted as dead
code). So basically it may work with broken pointers.
Besides, its implementation does strange things (e.g. forgetLoop) which are invasive and
may affect behavior in other parts of the system (specifically verification), concealing some
other problems. Another issue is that it may use SCEVCouldNotCompute object without
checking this.
The option is not used in any unit tests, and if switched on by default, the following tests
fail:
```
********************
Failed Tests (14):
LLVM :: Transforms/IndVarSimplify/2005-06-15-InstMoveCrash.ll
LLVM :: Transforms/IndVarSimplify/2007-06-06-DeleteDanglesPtr.ll
LLVM :: Transforms/IndVarSimplify/2008-10-03-CouldNotCompute.ll
LLVM :: Transforms/IndVarSimplify/2009-05-24-useafterfree.ll
LLVM :: Transforms/IndVarSimplify/2011-10-27-lftrnull.ll
LLVM :: Transforms/IndVarSimplify/ARM/code-size.ll
LLVM :: Transforms/IndVarSimplify/X86/deterministic-scev-verify.ll
LLVM :: Transforms/IndVarSimplify/X86/pr57187.ll
LLVM :: Transforms/IndVarSimplify/X86/verify-scev.ll
LLVM :: Transforms/IndVarSimplify/bbi-63564.ll
LLVM :: Transforms/IndVarSimplify/invalidate-modified-lcssa-phi.ll
LLVM :: Transforms/IndVarSimplify/loop-predication.ll
LLVM :: Transforms/IndVarSimplify/post-inc-range.ll
LLVM :: Transforms/IndVarSimplify/turn-to-invariant.ll
********************
Unexpectedly Passed Tests (1):
LLVM :: Transforms/IndVarSimplify/pr55689.ll
```
None of these looks like real problems found by verification, these are
bugs in the verifying code itself (such as use of deleted SCEVs and
SCEVCouldNotCompute's).
I think it all gives enough justification for its removal.
https://github.com/llvm/llvm-project/issues/61302
Differential Revision: https://reviews.llvm.org/D145894
Reviewed By: nikic
pvanhout [Tue, 14 Mar 2023 10:25:22 +0000 (11:25 +0100)]
[StructurizeCFG] Correctly depend on UniformityAnalysis
Small oversight in https://reviews.llvm.org/D145688 - the pass' dependency was not updated to reflect the change to UA.
Also, change DivergenceAnalysis to UniformityAnalysis in a comment. That way, StructurizeCFG only refers to UA and not DA anymore.
pvanhout [Mon, 13 Mar 2023 10:33:15 +0000 (11:33 +0100)]
[DAG/AMDGPU] Use UniformityAnalysis in DAGISel
Switch DAGISel over to UniformityAnalysis, which was one of the last remaining users of the DivergenceAnalysis.
No explosions seen during internal testing so this looks like a smooth transition.
Reviewed By: sameerds
Differential Revision: https://reviews.llvm.org/D145918
Matt Devereau [Tue, 7 Mar 2023 15:12:31 +0000 (15:12 +0000)]
[AArch64] Add svboolx2_t and svboolx4_t tuple types
https://reviews.llvm.org/D145505
Max Kazantsev [Tue, 14 Mar 2023 10:09:50 +0000 (17:09 +0700)]
[TTI] Evaluate cost of experimental_widenable_condition as zero
This intrinsic is not supposed to live through lowering, eventually it should turn
into `true` constant and be optimized away.
Differential Revision: https://reviews.llvm.org/D146027
Reviewed By: skatkov
Nikita Popov [Tue, 14 Mar 2023 10:04:54 +0000 (11:04 +0100)]
[SCEV] Rename ControlsExit -> ControlsOnlyExit (NFC)
As suggested in https://reviews.llvm.org/D145510#4192162.
Nikita Popov [Tue, 7 Mar 2023 14:42:16 +0000 (15:42 +0100)]
[SCEV] Fix finite loop non-strict predicate simplification (PR60944)
There are a number of issues with the current code for converting
ule -> ult (etc) predicates for comparisons controlling finite loops:
* It sets nowrap flags, which may only hold for that particular
comparison, not globally. (PR60944)
* It doesn't check that the RHS is invariant. (I'm not sure this
can cause practical issues independently of the previous point.)
* It runs before simplifications that may be more profitable. (PR54191)
This patch moves the handling for this into computeExitLimitFromICmp(),
because it is somewhat tightly coupled with assumptions in that code,
and addresses the aforementioned issues.
Fixes https://github.com/llvm/llvm-project/issues/60944.
Fixes https://github.com/llvm/llvm-project/issues/54191.
Differential Revision: https://reviews.llvm.org/D145510
Nikita Popov [Tue, 14 Mar 2023 09:42:01 +0000 (10:42 +0100)]
[InstCombine] Regenerate test checks (NFC)
Nikita Popov [Tue, 14 Mar 2023 09:37:33 +0000 (10:37 +0100)]
[SCEV] Clarify ControlsExit comment (NFC)
ControlsExit implies a single exit branch.
Max Kazantsev [Tue, 14 Mar 2023 09:27:40 +0000 (16:27 +0700)]
[Test] Add missing REQUIRES: asserts in test
OCHyams [Tue, 14 Mar 2023 09:17:06 +0000 (09:17 +0000)]
[Assignment Tracking] getIntrinsicInstrCost: set dbg.assign cost to zero
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D144652
Pavel Kosov [Tue, 14 Mar 2023 09:12:35 +0000 (12:12 +0300)]
[LLVM][OHOS] Clang toolchain and targets
Add a clang part of OpenHarmony target
Related LLVM part: D138202
~~~
Huawei RRI, OS Lab
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D145227
Maya Amrami [Thu, 9 Mar 2023 15:30:54 +0000 (17:30 +0200)]
[mlir] Move tosa.concat lowering from TosaToLinalg to TosaToTensor
tosa.concat is lowered to tensor.insert_slice thus it should be in
TosaToTensor rather than in TosaToLinalg.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D145952
OCHyams [Tue, 14 Mar 2023 08:17:19 +0000 (08:17 +0000)]
NFC Fix cost model checks in tests for debug intrinsics
These tests don't have a "Debug Info Version" module flag causing the debug
intrinsics to be dropped with a warning `warning: ignoring debug info with an
invalid version (0)`. The test passes because there are no CHECK lines for
these intrinsics. Fix the issue and auto-update the test checks.
Reviewed By: jryans
Differential Revision: https://reviews.llvm.org/D145573