Joseph Huber [Tue, 14 Mar 2023 20:11:30 +0000 (15:11 -0500)]
[libc] Remove leftover debug prints
Kazu Hirata [Tue, 14 Mar 2023 20:13:56 +0000 (13:13 -0700)]
[InlineOrder] Plugin Inline Order
This allows developing and distributing inlining heuristics
outside of tree. And together with the inline advisor plugins
allows for fine grained control of the inliner.
The PluginInlineOrderAnalysis class serves as the entry point
for dynamic advisors. Plugins must register instances of this
class to provide their own InlineOrder.
I'm checking in this patch on behalf of ibricchi
<ibricchi@student.ethz.ch>.
Differential Revision: https://reviews.llvm.org/D140637
Craig Topper [Tue, 14 Mar 2023 20:04:44 +0000 (13:04 -0700)]
[RISCV] Merge getLoadFP*Imm into a single function.
We currently have 3 functions and 3 lookup tables. This was the
most expediant and obvious way to fix several bugs.
This patch uses a single function and single lookup
table. It uses APFloat::convert to convert from the half or double
to single precision. If the conversion doesn't have any errors or
lose any information we use the f32 table to finish the lookup.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D145897
Craig Topper [Tue, 14 Mar 2023 20:01:28 +0000 (13:01 -0700)]
[RISCV] Pre-commit tests for D145897. NFC
Slava Zakharin [Mon, 13 Mar 2023 21:50:13 +0000 (14:50 -0700)]
[flang] Handle Flang examples consistently with LLVM.
Without this change the problem is that flangOmpReport and
flangPrintFunctionNames libraries are not built under 'all',
but they are imported targets via LLVMExports.cmake so that
any out-of-tree build that configures upon LLVM+Flang package
will get this CMake error:
```
The imported target "flangPrintFunctionNames" references the file
".../lib/flangPrintFunctionNames.so"
but this file does not exist.
```
flang-aarch64-out-of-tree buildbot (https://lab.llvm.org/buildbot/#/builders/175)
does not catch this issue, because it does not enable Flang on the first stage.
This change gets rid of FLANG_BUILD_EXAMPLES in favor of LLVM_BUILD_EXAMPLES
and uses available LLVM CMake macros to add example executables/libraries.
Differential Revision: https://reviews.llvm.org/D145992
Vladislav Khmelevsky [Mon, 6 Feb 2023 13:13:46 +0000 (17:13 +0400)]
[BOLT] Add writable segment for allocatable sections
The golang support creates 2 new data segments, one of them contains
relocations in PIC binaries, so the section must have writable rights.
Currently BOLT creates only one new segment that contains new sections
with RX rights, now also create RW segment if there are any new writable
sections were allocated during BOLT binary processing.
Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei
Differential Revision: https://reviews.llvm.org/D143390
Joseph Huber [Tue, 14 Mar 2023 20:03:22 +0000 (15:03 -0500)]
[libc] Fix CMake deduplication `-Xclang` arguments
Summary:
We use `-Xclang` to pass the GPU binary to be embedded. In the case of
multi-source objects this will be passed more than once, but CMake
implicitly deduplicates arguments. Use the special generator to prevent
this from happening.
Joseph Huber [Tue, 14 Mar 2023 19:59:27 +0000 (14:59 -0500)]
[libc] Fix GPU fatbinary dependencies for multi-source object libraries
Summary:
Multi-source object libraries require some additional handling, this
logic wasn't correctly settending the dependency on each filename
individually and was instead using the last one. This meant that only
the last file was built for multi-object libraries.
Craig Topper [Tue, 14 Mar 2023 20:00:38 +0000 (13:00 -0700)]
[TableGen][RISCV][Hexagon][LoongArch] Add a list of Predicates to HwMode.
Use the predicate condition instead of checkFeatures in *GenDAGISel.inc.
This makes the code similar to isel pattern predicates.
checkFeatures is still used by code created by SubtargetEmitter so
we can't remove the string. Backends need to be careful to keep
the string and predicates in sync, but I don't think that's a big issue.
I haven't measured it, but this should be a compile time improvement
for isel since we don't have to do any of the string processing that's
inside checkFeatures.
Reviewed By: kparzysz
Differential Revision: https://reviews.llvm.org/D146012
Alex Bradbury [Tue, 14 Mar 2023 19:52:32 +0000 (19:52 +0000)]
[clang][docs] Clarify the semantics of -fexceptions
As noted in <https://github.com/llvm/llvm-project/issues/61216>, the
documentation for -fexceptions appears to imply that unwind information
is always generated, which isn't the case.
Differential Revision: https://reviews.llvm.org/D145564
Arthur Eubanks [Thu, 2 Feb 2023 23:29:20 +0000 (15:29 -0800)]
[AutoUpgrade] Add flag to disable autoupgrading debug info
Auto-upgrade can be expensive, especially UpgradeDebugInfo() since it runs the verifier.
With this patch, we can specify that the imported bitcode is built with the same revision of LLVM, meaning there's no need to run any auto-upgrading. For now, limit this to just debug info since projects like Rust want to support multiple versions of LLVM at the same time (at compiler build time, not at Rust source code build time) and run a subset of the autoupgrade functionality for simplicity.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D143229
Alex Bradbury [Tue, 14 Mar 2023 19:12:07 +0000 (19:12 +0000)]
[RISCV] Consistently error for arch strings with trailing _
RISCVISAInfo::parseArchString would sometimes error for arch strings
with a trailing _ and sometimes accept them. This patch makes it
consistently error.
Differential Revision: https://reviews.llvm.org/D145949
Luke Hutton [Tue, 14 Mar 2023 18:55:39 +0000 (18:55 +0000)]
[mlir][tosa] Add FFT2d operation
Adds the FFT2d TOSA operation and supporting
shape inference function.
Signed-off-by: Luke Hutton <luke.hutton@arm.com>
Reviewed By: rsuderman, eric-k256
Differential Revision: https://reviews.llvm.org/D144784
Alexandros Lamprineas [Mon, 6 Mar 2023 16:43:22 +0000 (16:43 +0000)]
[FuncSpec] Do not run pre-link when doing LTO.
Saves time. Post link will cover most cases anyway.
Differential Revision: https://reviews.llvm.org/D145394
Ramiro Leal-Cavazos [Tue, 14 Mar 2023 18:34:06 +0000 (18:34 +0000)]
[mlir][tosa] Swap reshape at end of reduce op with expand_shape
This commit swaps back the `tosa.reshape` op used at the end of the
lowering for reduce ops with the op `tensor.expand_shape`. This is
needed to properly support dynamically-sized tensors. In such cases,
lowering directly to `tensor.expand_shape` allows us to control which
dimension gets expanded at the end using the knowledge of the
reduction. This would not be possible when using `tosa.reshape`, since
the op does not have a way of knowing that we are only unsqueezing a
single dimension.
Note: this change had previously been performed in
https://reviews.llvm.org/D133877.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D145986
wren romano [Fri, 10 Mar 2023 01:00:27 +0000 (17:00 -0800)]
[mlir][sparse] Cleaning up names in {Merger,LoopEmitter,CodegenEnv}.{h,cpp}
This change does a bunch of renaming to clear up confusions in these files. In particular, this change:
* Renames variables and methods to clarify the "dim"/"lvl" distinction, and changes them to use the `Dimension`/`Level` types as appropriate.
* Introduces new typedefs
* `ExprId`, `LatPointId`, `LatSetId`: to clarify the interning design of the Merger.
* `LoopId`, `LoopOrd`: to clarify the distinction between arbitrary names for loop-variables, vs numeric identifiers based on the actual order of loop generation.
* `TensorId`
* (Future CLs will change these from typedefs to structs/classes, so that the typechecker can help avoid mixups.)
* Updates documentation to match the new terminology
* Adds additional assertions
* Adds `const` to local variables along the way
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D145756
Jonas Paulsson [Thu, 9 Mar 2023 18:19:09 +0000 (19:19 +0100)]
[SystemZ] Clear NW flags on an ISD::SUB when reused as comparison.
The SystemZ backend will try to reuse an existing subtraction of two values
whenever they are to be compared for equality. This depends on the SystemZ
subtraction instruction setting the condition code, which can also signal
overflow.
A later pass will remove the compare and reuse the CC from the subtraction
directly. However, if that subtraction has the NSW flag set it will not
include the overflow bit in the updated CC user. That was a bug which can
lead to wrong results, as shown by a csmith program.
Fixes: https://github.com/llvm/llvm-project/issues/61268
Reviewed By: nikic, uweigand
Differential Revision: https://reviews.llvm.org/D145811
Michael Jones [Fri, 10 Mar 2023 19:53:50 +0000 (11:53 -0800)]
[libc][NFC] add an atof test for a fuzz failure
The differential fuzzer found that glibc and our libc disagree on the
result for "0x30000002222225p-1077", with ours being rounded up and
theirs rounded down. Ours is more correct for the nearest rounding mode,
so only a test is added.
Reviewed By: lntue, sivachandra
Differential Revision: https://reviews.llvm.org/D145821
Anlun Xu [Tue, 14 Mar 2023 18:36:25 +0000 (11:36 -0700)]
[mlir][vector] Add bazel dependency to TestVector
Dependency was introduced in https://reviews.llvm.org/D145942
Reviewed By: cota
Differential Revision: https://reviews.llvm.org/D146072
Nikolas Klauser [Sun, 8 Jan 2023 13:07:44 +0000 (14:07 +0100)]
[libc++] Use __verbose_abort instead of std::abort in __throw_ functions
This results in proper error messages instead of just an abort.
Reviewed By: ldionne, Mordante, #libc
Spies: #libc_vendors, smeenai, libcxx-commits
Differential Revision: https://reviews.llvm.org/D141222
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