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
Jay Foad [Mon, 13 Mar 2023 14:05:17 +0000 (14:05 +0000)]
[AMDGPU] Fix .amdhsa_shared_vgpr_count error checking for GFX11
Differential Revision: https://reviews.llvm.org/D145936
Max Kazantsev [Tue, 14 Mar 2023 08:49:25 +0000 (15:49 +0700)]
[Test] Add test showing difference in cost models for guards
Nikita Popov [Mon, 13 Mar 2023 10:18:57 +0000 (11:18 +0100)]
[IR] Allow !range on vector of integer instructions
Inspired by https://reviews.llvm.org/D144467#4188310, this allows
!range on vector of integer instructions, with the usual
element-wise interpretation, which is already used by various
analysis APIs that support vectors.
Differential Revision: https://reviews.llvm.org/D145920
Kadir Cetinkaya [Tue, 14 Mar 2023 08:20:13 +0000 (09:20 +0100)]
[IncludeCleaner][NFC] Dont rely on implicit conversion of StringRef
Fixes https://github.com/llvm/llvm-project/issues/61221
Siva Chandra Reddy [Tue, 14 Mar 2023 07:23:07 +0000 (07:23 +0000)]
[bazel][libc] Add errno target to function_deps of tests.
Existing listings in normal deps have been removed.
Reviewed By: akuegel
Differential Revision: https://reviews.llvm.org/D146014
Kazu Hirata [Tue, 14 Mar 2023 07:32:40 +0000 (00:32 -0700)]
[Analysis] Use *{Set,Map}::contains (NFC)
Kazu Hirata [Tue, 14 Mar 2023 07:24:30 +0000 (00:24 -0700)]
[Transforms] Use *{Set,Map}::contains (NFC)
Nathan Ridge [Fri, 27 Jan 2023 07:17:20 +0000 (02:17 -0500)]
[clang] Store the template param list of an explicit variable template specialization
VarTemplateSpecializationDecl does not store a template param list,
so the "template<>" needs to be stored in the ExtInfo.
Differential Revision: https://reviews.llvm.org/D142692
Nathan Ridge [Tue, 21 Feb 2023 08:22:59 +0000 (03:22 -0500)]
[clangd] Fix a bug in TweakTest::decorate()
The second argument to string::substr() is a count,
not an end position.
Differential Revision: https://reviews.llvm.org/D144453
Chuanqi Xu [Tue, 14 Mar 2023 06:20:44 +0000 (14:20 +0800)]
[C++20] [Modules] Profile TemplateName by canonical decl
Close https://github.com/llvm/llvm-project/issues/61317
The root cause of the problem is that we profile TemplateName by the
non-canonical decls so that the compiler thought they are two different
types. But this is not true. We fixed the issue after we profile the
template name by using the same name.
Siva Chandra [Tue, 14 Mar 2023 05:47:00 +0000 (05:47 +0000)]
[libc] Enable more functions on riscv64.
The list of headers has also been updated. Some duplicated entrypoints
have been removed.
Valentin Clement [Tue, 14 Mar 2023 05:31:27 +0000 (06:31 +0100)]
[flang] Use llvm.zext when converting from i1 -> iXX
CodeGen used llvm.sext when converting fir.convert %0 : (i1) -> iXX
where iXX is any integer. This leads to wrong values when the initial
i1 is equal to 1.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D145984
Jeff Bailey [Tue, 14 Mar 2023 05:31:01 +0000 (05:31 +0000)]
[libc] Update cross-compilation instructions
* Add various options so that it uses the build lld and compiler-rt
* Add instructions on how to use the newly built libc
* Remove trailing comments in code-block for cut and pastability
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D145878
Alex Brachet [Tue, 14 Mar 2023 05:17:54 +0000 (05:17 +0000)]
[Driver] Make -X default for baremetal riscv
Differential Revision: https://reviews.llvm.org/D145725
Siva Chandra Reddy [Mon, 13 Mar 2023 22:05:03 +0000 (22:05 +0000)]
[libc] Make libc_errno point to internal errno for non-public builds.
The macro llvmlibc_errno has also been removed. This change completes
the switch to using a hermetic errno for unit tests.
Fixes #61037
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D146005
Siva Chandra Reddy [Tue, 14 Mar 2023 01:12:11 +0000 (01:12 +0000)]
[libc] Switch sys/stat implementations over to libc_errno.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D146004
sstwcw [Fri, 10 Mar 2023 15:12:13 +0000 (15:12 +0000)]
[clang-format] Recognize Verilog always blocks
The small `Coverage` test was added because we added the space rule
about 2 at signs along with the rule about only 1 of it. We have not
fully covered covergroup yet.
Reviewed By: MyDeveloperDay, owenpan
Differential Revision: https://reviews.llvm.org/D145794
aabhinavg [Mon, 13 Mar 2023 06:22:00 +0000 (11:52 +0530)]
[Docs] Added llvm-mc documentation
Fix #61313
Reviewed By: lattner
Differential Revision: https://reviews.llvm.org/D145844
Chen Zheng [Tue, 7 Mar 2023 02:31:32 +0000 (21:31 -0500)]
[PowerPC] remove side effect for some cases for saturate instructions
Fixes #60684
Reviewed By: nemanjai
Differential Revision: https://reviews.llvm.org/D145353
Chen Zheng [Mon, 6 Mar 2023 05:28:39 +0000 (00:28 -0500)]
add testcases for D145353; NFC
Siva Chandra Reddy [Tue, 14 Mar 2023 01:25:47 +0000 (01:25 +0000)]
[libc][NFC] Switch nanosleep_test and getcwd_test to libc_errno.
Siva Chandra Reddy [Tue, 14 Mar 2023 01:00:23 +0000 (01:00 +0000)]
[libc] Switch termios implementations to libc_errno.
chenglin.bi [Tue, 14 Mar 2023 00:59:53 +0000 (08:59 +0800)]
Revert "[LogicCombine 1/?] Implement a general way to simplify logical operations."
This reverts commit
97dcbea63e11d566cff0cd3a758cf1114cf1f633.
Jakub Kuderski [Tue, 14 Mar 2023 00:48:38 +0000 (20:48 -0400)]
[ADT][NFCI] Do not use non-const lvalue-refs with enumerate in llvm/
Replace references to `enumerate` results with either const lvalue
rerences or structured bindings. I did not use structured bindings
everywhere as it wasn't clear to me it would improve readability.
This is in preparation to the switch to `zip` semantics which won't
support non-const lvalue reference to elements:
https://reviews.llvm.org/D144503.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D145987
Peter Klausler [Mon, 13 Mar 2023 18:02:32 +0000 (11:02 -0700)]
[flang] Accept non-interoperable LOGICAL scalar dummy arguments
Some Fortran compilers allow kinds of LOGICAL other than C_BOOL
for the types of dummy arguments to interoperable (BIND(C))
procedures. As any kind of LOGICAL can be converted to any
other without loss of information, this seems to be a useful
unambiguous extension that is attested in real codes; accept it
for scalars with a portability warning.
Differential Revision: https://reviews.llvm.org/D145968
Siva Chandra Reddy [Mon, 13 Mar 2023 23:44:03 +0000 (23:44 +0000)]
[libc][NFC] Switch unistd.h tests to libc_errno.
David Blaikie [Tue, 14 Mar 2023 00:49:32 +0000 (00:49 +0000)]
llvm-symbolizer: Don't crash when referencing an invalid CU in a dwp file twice
Previously we'd stash a null pointer in a sorted vector of CUs - the
next time around, we'd try to do a binary search in that vector (sorting
on a key inside the objects pointed to by the elements of the vector)
which would deref null if we'd stashed a null in there previously.
As a reasonable, but not ideal, workaround - don't stash any result in
the vector - this means every query will produce a new warning
(resulting in duplicate warnings) but better than a crash.
Stashing null in the list could be workable if we also stashed the
offset in a pair - but then all the clients would need to be fixed up
(maybe using a filtering iterator) which seems like overkill for this
uncommon error case.
ziqingluo-90 [Tue, 14 Mar 2023 00:17:30 +0000 (17:17 -0700)]
[-Wunsafe-buffer-usage] Reducing non-determinism in diagnostics output stream
The -Wunsafe-buffer-usage analysis outputs diagnostics in the order of
pointer values to associated `VarDecl`s. This creates non-determinism
in the order of diagnostics in output since the order cannot be
guaranteed in pointer values. However, our fix-it tests were written
under the assumption that diagnostics are output in source location
order. This results in non-deterministic failures in our tests. This
patch fixes the problem by keeping analysis results sorted by source
locations.
Reviewed by: jkorous, NoQ
Differential revision: https://reviews.llvm.org/D145993
Alex Langford [Tue, 14 Mar 2023 00:17:02 +0000 (17:17 -0700)]
[lldb] Remove MIPS Linux UnixSignals
MIPS Linux support was removed in
ce03a862372a6f36d2fcf80dc80052aa155fcae8
Siva Chandra Reddy [Mon, 13 Mar 2023 23:43:31 +0000 (23:43 +0000)]
[libc][NFC] Switch sys/*.h tests over to libc_errno.
Carl Ritson [Mon, 13 Mar 2023 23:42:22 +0000 (08:42 +0900)]
[IRLinker] Fix mapping of declaration metadata
Ensure metadata for declarations copied during materialization
is properly mapped if declarations do not become definitions.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D145318
Jacob Lambert [Sat, 11 Mar 2023 01:27:43 +0000 (17:27 -0800)]
Switch ABI references to env/environment
To be consistent with Triple.h, we update references to the
optional fourth triple field from ABI to env or enviornment
Differential Revision: https://reviews.llvm.org/D145833
Ben Langmuir [Sat, 11 Mar 2023 05:21:09 +0000 (21:21 -0800)]
[clang][deps] Handle response files in dep scanner
Extract the code the driver uses to expand response files and reuse it
in the dependency scanner.
rdar://
106155880
Differential Revision: https://reviews.llvm.org/D145838
Siva Chandra Reddy [Mon, 13 Mar 2023 22:46:19 +0000 (22:46 +0000)]
[libc][NFC] Switch mman.h tests to libc_errno and update Bazel build.
Siva Chandra Reddy [Mon, 13 Mar 2023 22:11:32 +0000 (22:11 +0000)]
[libc][NFC] Switch startup tests to libc_errno.
Siva Chandra Reddy [Mon, 13 Mar 2023 22:11:07 +0000 (22:11 +0000)]
[libc][NFC] Switch string and errno tests to libc_errno.
Siva Chandra Reddy [Mon, 13 Mar 2023 22:07:34 +0000 (22:07 +0000)]
[libc][NFC] Switch all uses of errno in math and math tests to libc_errno.
Philip Reames [Mon, 13 Mar 2023 22:10:13 +0000 (15:10 -0700)]
[RISCV] Improve SK_Reverse shuffle costs for fixed length vectors
As noted by @luke (https://reviews.llvm.org/D145953#inline-1409312), we were accounting for the cost of vector element size using vlenb whereas the expression can be constant folded for fixed length vectors.
Differential Revision: https://reviews.llvm.org/D145973
Aiden Grossman [Mon, 13 Mar 2023 21:43:05 +0000 (21:43 +0000)]
[Propeller][ELF] Add Doxygen comment for decodeBBAddrMap
Adds a doxygen comment on decodeBBAddrMap specifying what it does as well
as some requirements that need to be met when calling it (especially
the condition of passing in a relocation section when the ELFFile is
relocatable).
Differential Revision: https://reviews.llvm.org/D145989
Philip Reames [Mon, 13 Mar 2023 21:40:15 +0000 (14:40 -0700)]
[ASAN] Extract out a helper routine for foreach lane on vectors [nfc]
The new API matches a case we also need in MSAN. For the moment, I'm staging this as a local-to-ASAN commit, but I expect to move this to a shared location and reuse in the next day or two.
Jonas Devlieghere [Mon, 13 Mar 2023 21:39:10 +0000 (14:39 -0700)]
[lldb] Explicitly import json in TestSymbolFileJSON.py
The test was relying on the json module getting imported transitively by
one of its imported modules. Make this less brittle by importing it
explicitly.
Michal Paszkowski [Mon, 13 Mar 2023 21:26:04 +0000 (22:26 +0100)]
[SPIR-V] Promote arbitrary width ints to regular width
After this patch all arbitrary size integers (smaller than 64 bits) in
LLVM IR will be promoted to regular size type in SPIR-V (OpTypeInt
8/16/32/64).
Differential Revision: https://reviews.llvm.org/D145137
Aiden Grossman [Sat, 25 Feb 2023 10:18:57 +0000 (10:18 +0000)]
[Propeller] Make decoding BBAddrMaps trace through relocations
Currently when using the LLVM tools (eg llvm-readobj, llvm-objdump) to
find information about basic block locations using the propeller tooling
in relocatable object files function addresses are not mapped properly
which causes problems. In llvm-readobj this means that incorrect
function names will be pulled. In llvm-objdum this means that most BBs
won't show up in the output if --symbolize-operands is used. This patch
changes the behavior of decodeBBAddrMap to trace through relocations
to get correct function addresses if it is going through a relocatable
object file. This fixes the behavior in both tools and also other
consumers of decodeBBAddrMap. Some helper functions have been added
in/refactoring done to aid in grabbing BB address map sections now that
in some cases both relocation and BB address map sections need to be
obtained at the same time.
Regression tests moved around/added.
Differential Revision: https://reviews.llvm.org/D143841
Tue Ly [Mon, 13 Mar 2023 20:14:53 +0000 (16:14 -0400)]
[libc] Fix policy CMP0116 warnings for cmake 3.20 or above.
Warnings due to changes in behavior of cmake 3.20 or above. See
https://cmake.org/cmake/latest/policy/CMP0116.html
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D145983
Philip Reames [Mon, 13 Mar 2023 20:55:24 +0000 (13:55 -0700)]
[MSAN] Use TypeSize and related utilities [nfc-ish]
This is part of prework for supporting scalable vector types. This isn't NFC because it shifts the point of failure (i.e. which assert triggers first), but should be NFC for all non-scalable vector inputs.
David Tenty [Wed, 8 Mar 2023 20:48:44 +0000 (15:48 -0500)]
[clang][driver] accept maix32/maix64 gcc compat options
GCC on AIX primarily uses the -maix32 and -maix64 to select the bitmode
to target. In order to be compatible with existing build configurations,
clang should accept these options as well. In this patch we implement
these options for AIX targets.
Differential Revision: https://reviews.llvm.org/D145610
Philip Reames [Mon, 13 Mar 2023 20:05:53 +0000 (13:05 -0700)]
[MSAN] Remove usage of FixedVectorType where trivial [nfc]
This is a prepass on generalizing for scalable vectors; I'm just picking off the easy bits.
Snehasish Kumar [Mon, 13 Mar 2023 20:08:41 +0000 (20:08 +0000)]
Revert "[memprof] Record BuildIDs in the raw profile."
This reverts commit
287177a47a396ca6cc0bef7696108cdaa0c68e5f.
Amir Ayupov [Mon, 6 Feb 2023 22:03:40 +0000 (14:03 -0800)]
[BOLT][NFC] Return instruction list from createInstrIncMemory
Leverage move semantics for `std::vector`.
This also makes it consistent with `createInstrumentationSnippet`.
Reviewed By: Elvina
Differential Revision: https://reviews.llvm.org/D145465
Valentin Clement [Mon, 13 Mar 2023 13:08:20 +0000 (06:08 -0700)]
[flang] Handle parent component in user function argument for special cases
In some cases the argument is already handled by a fir.rebox operation. Just
adapat the type to match the parent component in that case.
Depends on D145928
Differential Revision: https://reviews.llvm.org/D145931
David Green [Mon, 13 Mar 2023 19:44:12 +0000 (19:44 +0000)]
[LV][VPlan] Fix printing TripCount liveins. NFC
The TripCount liveins would currently be printed as badref in the vplan as they
are not allocated slots in the VPSlotTracker. This patch allocates them a slot
and adds them to the printed Live-Ins. It also makes a minor adjustment to
printing of Live-ins to reduce the empty lines when multiple Live-ins are
present.
Differential Revision: https://reviews.llvm.org/D145507
Valentin Clement [Mon, 13 Mar 2023 19:29:43 +0000 (20:29 +0100)]
[flang] Handle parent component in user function argument
When the argument is a parent component the box needs to
be updated to reflect the correct type. Use `updateBoxForParentComponent`
to update the argument accordingly.
Depends on D145907
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D145928
Felipe de Azevedo Piovezan [Mon, 13 Mar 2023 14:44:13 +0000 (10:44 -0400)]
[AArchExpandPseudo] Preserve instruction debug number in expansions
This is an initial attempt at preserving debug information in the pseudo
instruction expansion of the AArch backend. In particular, we preserve
the instruction number required by the InstrRef implementation of live
debug values.
There are many other expansions that need to be considered, but the ones
addressed in this commit should be extremely common, as they handle most
arithmetic and logical instructions.
Differential Revision: https://reviews.llvm.org/D145943
Snehasish Kumar [Tue, 28 Feb 2023 21:33:30 +0000 (21:33 +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 19:16:13 +0000 (14:16 -0500)]
Revert "[Libomptarget] Use freestanding stdint.h header for DeviceRTL"
This patch breaks the handling of `printf` in the OpenMP library. Usiing
`-ffreestanding` prevents clang from emitting LLVM builtins, which we
use for OpenMP printing support. Shelve this until we have functioning
`printf` in the GPU `libc` and we can remove that code.
This reverts commit
a92eaa3ebee6ff85549e8f1c50da4958dbbdcb30.
Hassnaa Hamdi [Thu, 23 Feb 2023 16:13:16 +0000 (16:13 +0000)]
[AArch64][SVE]: custom lower AVGFloor/AVGCeil.
-Lower AVGFloor(A, B) to:
SRL(A) + SRL(B) + (A&B)&1.
-Lower AVGCeil(A, B) to:
SRL(A) + SRL(B) + (A|B)&1.
Differential Revision: https://reviews.llvm.org/D143283
Joshua Cranmer [Mon, 13 Mar 2023 18:53:55 +0000 (14:53 -0400)]
[lldb] Fix lldb code for renaming of OpenCL AVC types.
Philip Reames [Mon, 13 Mar 2023 18:39:00 +0000 (11:39 -0700)]
[IRBuilder] Add utilities for materializing scalable values [nfc]
These idioms already appear a number of places in code, and upcoming changes to the various sanitizers continue to need more instances of the same patterns.
Differential Revision: https://reviews.llvm.org/D145945
Job Noorman [Fri, 10 Mar 2023 20:12:57 +0000 (12:12 -0800)]
[BOLT][NFC] Improve performance of MCPlusBuilder::initAliases
It was using a redundant iteration over super regs to build
SmallerAliasMap. Removing this results in exactly the same alias maps
and a noticeable performance gain on targets with a large number of
registers.
Just anecdotally: on my machine, processing a small AArch64 binary went
from 2.7s down to 80ms.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D145779
Teresa Johnson [Mon, 13 Mar 2023 16:21:01 +0000 (09:21 -0700)]
[docs] Add more complete documentation for -f[no]split-lto-unit
Option was added in D53891, and only has basic documentation added
later in
5168ddfac44206e94f7ddd484d1cf03dee320fa7. Add more extensive
documentation with links to related docs.
Differential Revision: https://reviews.llvm.org/D145951
Nick Desaulniers [Mon, 13 Mar 2023 18:22:25 +0000 (11:22 -0700)]
[GVNHoist] add cast to unbreak windows build
Follow up to
commit
831e99fee90e ("[GVNHoist] don't hoist callbr users into the callbr's block")
Looks like MSVC has trouble with llvm::is_contained. Unbreak the build.
Link: https://lab.llvm.org/buildbot/#/builders/127/builds/45021/steps/7/logs/stdio
Reviewed By: hans, kuhar
Differential Revision: https://reviews.llvm.org/D145969
Joshua Cranmer [Mon, 13 Mar 2023 18:14:12 +0000 (14:14 -0400)]
[Clang][SPIR-V] Emit target extension types for OpenCL types on SPIR-V.
Reviewed By: Anastasia
Differential Revision: https://reviews.llvm.org/D141008
Jeffrey Tan [Mon, 13 Mar 2023 16:42:11 +0000 (09:42 -0700)]
Refactor ObjectFilePlaceholder for sharing
This patch refactors PlaceholderObjectFile into ObjectFile plugin directory
so that we can reuse it for other cases like coredump debugging with NT_FILE
notes.
PlaceholderObjectFile is also renamed to ObjectFilePlaceholder to be consistent
with ObjectFile plugin naming convention.
Differential Revision: https://reviews.llvm.org/D145955
Philip Reames [Mon, 13 Mar 2023 18:01:19 +0000 (11:01 -0700)]
[RISCV] Extend SK_Broadcast costing to scalable vectors
The existing scalable costing was just bad. No LMUL cost, no i1 specific costing, etc.. We had updated the fixed cost model, but none of the code is actually fixed length specific. Moving it down handles the scalable cases too.
Rahul Kayaith [Mon, 13 Mar 2023 16:42:25 +0000 (12:42 -0400)]
[mlir] Don't use -z,defs on sanitizer builds
This works around link errors when building the python bindings with
ASAN, since the ASAN run-time doesn't get linked into shared libraries.
The ASAN docs specficially call out -z,defs as a potential issue:
https://clang.llvm.org/docs/AddressSanitizer.html#usage
closes https://github.com/llvm/llvm-project/issues/60565
Reviewed By: stellaraccident, mehdi_amini
Differential Revision: https://reviews.llvm.org/D145956
Mike Crowe [Mon, 13 Mar 2023 17:38:34 +0000 (17:38 +0000)]
[clang-tidy] Support readability-redundant-string-cstr.StringParameterFunctions option
Add StringParameterFunctions option to allow the
readability-redundant-string-cstr check to work with library functions
such as fmt::format and spdlog::logger:info that are able to support
std::string arguments in addition to const char * ones.
Depends on D143342
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D145885
Jakub Kuderski [Mon, 13 Mar 2023 17:58:11 +0000 (13:58 -0400)]
[mlir][vector] Clarify OOB semantics for `gather` and `scatter`
Reword the vector gather and scatter op description to make it
well-defined to have out-of-bounds indices when the corresponding mask
bits are false.
Update the code sample to avoid relying on C UB semantics to provide
informal semantics for vector.gather.
This change should be consistent with the existing interpretation of the
semantics in the codebase.
Issue: https://github.com/llvm/llvm-project/issues/60905
Reviewed By: dcaballe
Differential Revision: https://reviews.llvm.org/D145824
Michał Górny [Mon, 13 Mar 2023 17:22:31 +0000 (18:22 +0100)]
[lld] Use installed llvm_gtest in standalone builds
Use the installed llvm_gtest library instead of rebuilding it locally
when standalone builds are used. This change is now required
as otherwise the build fails due to duplicate llvm_gtest target.
This is based on
82169103958583d3320b3a9a1e6542e8d32ef8da in clang.
Differential Revision: https://reviews.llvm.org/D145964
Jonas Paulsson [Mon, 13 Mar 2023 17:52:09 +0000 (18:52 +0100)]
[SystemZ] NFC minor cleanup
Don't create local pointers to Subtarget in places in SystemZTargetLowering
as the class already has a Subtarget member.
Review: Ulrich Weigand
Evangelos Foutras [Mon, 13 Mar 2023 17:40:26 +0000 (12:40 -0500)]
[LinkerWrapper] Switch to add_clang_tool() macro
Summary:
This creates install-clang-linker-wrapper{,-stripped} targets which are
useful for Linux distro builds when using LLVM_DISTRIBUTION_COMPONENTS.
Fixes: https://bugs.archlinux.org/task/77814
Differential Revision: https://reviews.llvm.org/D145862
Joseph Huber [Mon, 13 Mar 2023 17:38:04 +0000 (12:38 -0500)]
[Clang] Fix not including clangBasic in the dynamic build
Summary:
The previous patch only included the needed library if you had HSA and
CUDA installed. Fix that.
Vadim Paretsky [Mon, 13 Mar 2023 17:11:12 +0000 (10:11 -0700)]
[OpenMP] remove obsolete symbol defintions
Some globals were used for enforcing certain linking rules in the Intel
OpenMP implementation's MSVC compatibility layer and are not applicable
to the LLVM implementation (kmp_import.cpp has already been removed from
the build).
Differential Revision:https://reviews.llvm.org/D145837
Joseph Huber [Mon, 13 Mar 2023 17:18:58 +0000 (12:18 -0500)]
[Libomptarget] Use freestanding stdint.h header for DeviceRTL
The `stdint.h` header provides the standard types. Previously we used
`-nostdinc` and defined these ourselves. This patch switches to a
freestanding version which should work properly. Without
`-ffreestanding` the `stdint.h` header will include other libraries. But
in a freestanding environment it should work given the primitives.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D145963
Joseph Huber [Mon, 13 Mar 2023 15:07:36 +0000 (10:07 -0500)]
[Clang] Add --version and --help messages to amdgpu/nvptx-arch
Summray:
These clang tools should print some basic help and version messages so
they are less opaque.
Reviewed By: ye-luo
Differential Revision: https://reviews.llvm.org/D145944
Nick Desaulniers [Mon, 13 Mar 2023 17:14:02 +0000 (10:14 -0700)]
[GVNHoist] don't hoist callbr users into the callbr's block
This isn't safe to do.
Link: https://github.com/llvm/llvm-project/issues/53562
Fixes: https://github.com/llvm/llvm-project/issues/61023
Reviewed By: efriedma, nikic
Differential Revision: https://reviews.llvm.org/D144927
Slava Zakharin [Thu, 9 Mar 2023 04:51:19 +0000 (20:51 -0800)]
[flang] Avoid ICE in case of subprogram name clash with runtime namespace.
This is related to llvm-project#61074.
In general, it is undefined behavior if user subprogram is declared
with a name that matches a name of function from any runtime library
that Flang is using (e.g. FortranRuntime, libm, etc.). With this change-set
we avoid ICE for invalid calls generated during math lowering by
type casing the function before the call. This happens when a user function
call is lowered before the math function call with the same name.
To detect the name clash in cases when the math function call is lowered
before the user function call we set fir.runtime attribute for the math
functions and check it when we lower the user function call.
The warnings are currently emitted only in debug compiler and
under llvm debug options. I think they should be reported
in the same way as regular Flang warnings.
Note that this change-set does not resolve issues with the conversion
passes that might introduce libm calls after the lowering.
Differential Revision: https://reviews.llvm.org/D145653
Mehdi Amini [Mon, 13 Mar 2023 17:15:07 +0000 (18:15 +0100)]
Fix a small typo in a comment in MlitOptMain.cpp (NFC)
Alexander Belyaev [Mon, 13 Mar 2023 07:35:21 +0000 (08:35 +0100)]
[mlir] Use splitBlock instread of createBlock in GenericAtomicRMWLowering.
When generic_atomic_rmw is inside of memref.alloca_scope, then the pattern would fail.
Differential Revision: https://reviews.llvm.org/D145901
Chia-hung Duan [Fri, 10 Mar 2023 17:01:21 +0000 (17:01 +0000)]
[scudo] Reduce the times of holding MapAllocatorCache::Mutex (NFC)
Also fix few lints
Reviewed By: cryptoad
Differential Revision: https://reviews.llvm.org/D145427
Philip Reames [Mon, 13 Mar 2023 17:01:25 +0000 (10:01 -0700)]
[RISCV] Fallback to scalable lowering costs for fixed length vectors
Fixed vector costs may be more precise, but the actual lowering will use scalable vectors if nothing better is available. During review, we noticed a case where fixed vector reverse can be improved cost model wise, that will follow seperately.
Differential Revision: https://reviews.llvm.org/D145953
Dmitry Makogon [Tue, 7 Mar 2023 08:22:31 +0000 (15:22 +0700)]
[SCEV] Apply loop guards against min/max for its arguments
This replaces several rewriting rules in ScalarEvolution::applyLoopGuards
that are applied to min/max expressions with the equivalent ones but
applied to its arguments.
So previously given we had a loop guard min(a, b) >= c,
the min expression would get rewritten as max(c, min(a, b)).
With such approach, we were unable to apply the rewrite if min operands
were zext for example (min(zext(a), zext(b))), however it's equivalent
to the expression zext(min(a, b)) for which we could apply the rewrite.
Now we'd rewrite the min operands also with these expressions:
a -> max(c, a) and
b -> max(c, b).
and this would allow us to apply the loop guard in this and similar cases:
min(zext(a), zext(b)) would get rewritten as min(zext(max(c, a)), zext(max(c, b)))
instead of just being skipped.
The list of added rules (omitting predicates signedness for simplicity):
1. Guard: min(a, b) >= c
Old rule: min(a, b) -> max(c, min(a, b))
New rules: a -> max(a, c) and b -> max(b, c)
2. Guard: min(a, b) > c
Old rule: min(a, b) -> max(c + 1, min(a, b))
New rules: a -> max(a, c + 1) and b -> max(b, c + 1)
3. Guard: max(a, b) <= c
Old rule: max(a, b) -> min(c, max(a, b))
New rules: a -> min(a, c) and b -> min(b, c)
4. Guard: max(a, b) < c
Old rule: max(a, b) -> min(c - 1, max(a, b))
New rules: a -> min(a, c - 1) and b -> min(b, c - 1)
The old rewrites still hold.
Differential Revision: https://reviews.llvm.org/D145230
Dmitry Makogon [Mon, 13 Mar 2023 15:55:32 +0000 (22:55 +0700)]
[SCEV] Rename variables in applyLoopGuards (NFC)
Ayal Zaks [Tue, 14 Feb 2023 09:56:21 +0000 (11:56 +0200)]
[Clang][OpenCL] Allow pointers in structs as kernel arguments from 2.0
Structs that contain global or local pointers can be passed as kernel
arguments starting OpenCL v2.0 with the introduction of shared virtual memory.
Differential Revision: https://reviews.llvm.org/D143849
Takuya Shimizu [Mon, 13 Mar 2023 16:53:12 +0000 (12:53 -0400)]
[clang][AST] Improve diagnostic for `nullptr` constexpr function pointer call
This patch improves diagnostic for clang constexpr evaluator by adding
a check for nullptr in function pointer call evaluations.
ex.
```
constexpr int foo(int (*bla)(void)) {
return bla();
}
static_assert(foo(nullptr) == 1);
```
BEFORE this patch, clang generates the following diagnostic for the
code above:
```
<source>:5:15: error: static assertion expression is not an integral constant expression
static_assert(foo(nullptr) == 1);
^~~~~~~~~~~~~~~~~
<source>:2:10: note: subexpression not valid in a constant expression
return bla();
^
<source>:5:15: note: in call to 'foo(nullptr)'
static_assert(foo(nullptr) == 1);
^
1 error generated.
```
AFTER this patch, subexpression not valid in a constant expression note
is replaced with 'bla' evaluates to a null function pointer.
Fixes https://github.com/llvm/llvm-project/issues/59872
Differential Revision: https://reviews.llvm.org/D145793
Mehdi Amini [Mon, 13 Mar 2023 16:49:23 +0000 (17:49 +0100)]
Revert "Add a `skipRegion()` feature to the OpPrintingFlags for MLIR ASM printer"
This reverts commit
0fe16607a523af3d8978ad636134e4d3034e365c which wasn't ready
to land.
Zequan Wu [Mon, 13 Mar 2023 16:45:42 +0000 (12:45 -0400)]
Revert "[LowerTypeTests] Avoid creation of select constant expression"
This reverts commit
0317147a2848547ec97d8e76782f7dc38267a21f.
It causes broken module error when building chromium media_unittests
PHI nodes not grouped at top of basic block!
%19 = phi ptr [ %16, %15 ], [ %18, %12 ], !dbg !16
label %17
LLVM ERROR: Broken module found, compilation aborted!
Simon Tatham [Mon, 13 Mar 2023 16:28:38 +0000 (16:28 +0000)]
[AArch64] Don't #define __ARM_FP when there's no FPU.
On some R-profile CPUs, leaving out the FPU is an option. Clang will
accept `-march=armv8-r+nofp`, but it's currently not possible to find
out via the preprocessor whether it's in that mode (e.g. to change or
disable inline asm statements in your code).
The __ARM_FP macro, which has a bit set for each size of floating
point number supported by the hardware, is the natural thing to test.
But Clang was defining it unconditionally on AArch64. Now it checks
for FP support before defining it at all.
Reviewed By: tmatheson, DavidSpickett
Differential Revision: https://reviews.llvm.org/D145781
Yonghong Song [Fri, 10 Mar 2023 07:55:16 +0000 (23:55 -0800)]
[BPF] Improve pruning to avoid generate more types in BTF
Commit
3671bdbcd214("[BPF] Fix a BTF type pruning bug") fixed a
pruning bug to allow generate more types. But the commit has a bug
which permits to generate more types than necessary. The following
is an example to illustrate the problem.
struct t1 {
int a;
};
struct t2 {
struct t1 *p1;
struct t1 *p2;
int b;
};
int foo(struct t2 *arg) {
return arg->b;
}
The following is the part of BTF generation sequence:
(1). 'struct t2 *arg' -> 'struct t1 *p1'
In this step, the type 'struct t1' will be generated as
a forward decl and the ptr type (to 'struct t1') will
be stored in the internal type table.
(2). now the second field 'struct t1 *p2' will be processed.
Since the ptr type (to 'struct t1') already in the type
table, the existing logic strips out ptr modifier and
is able to generate BTF type for 'struct t1'.
In the above step (2), if CheckPointer is true (the type traversal
chain including a struct member), 'ptr' modifier should be checked
and the subsequent type generation should be skipped since
the same case has been processed in visitDerivedType().
The issue is exposed when I am trying to use llvm15 to compile
some internal bpf programs. The bpf skeleton put the whole
ELF section (after striping some sections like dwarf) as a string.
The large BTF section triggered the following error:
bpf_object_with_struct_ops_test_prog_bpf/BpfObjectWithStructOpsTestProg.skel.h:222:23:
error: string literal of length 140144 exceeds maximum length 65536 that C++ compilers
are required to support [-Werror,-Woverlength-strings]
return (const void *)"\
^~
1 error generated.
Although adding -Wno-overlength-strings could workaround the issue,
improving llvm BTF generation sounds better esp. for users using vmlinux.h.
Differential Revision: https://reviews.llvm.org/D145816
Arthur Eubanks [Sat, 11 Mar 2023 01:24:19 +0000 (17:24 -0800)]
[PassManagerBuilder] Remove PassManagerBuilder
PassManagerBuilder is dead, long live PassBuilder!
bugpoint's -O# are now useless (and probably have been for a while given the number of passes we've removed from PassManagerBuilder). Perhaps they'll be revived if bugpoint ever works with the new PM.
Reviewed By: nikic, MaskRay
Differential Revision: https://reviews.llvm.org/D145835
Saleem Abdulrasool [Tue, 7 Mar 2023 18:10:31 +0000 (10:10 -0800)]
MSVC: support version preference with search
Extend the logic for the WinSDK and UCRT handling to prefer a user
specified version of the VisualC++ tools and Windows SDK. This allows
us to now perform the regular search for the installation but select the
exact version of the SDK or VC++ tools to override the latest version.
Similar to the other flags controlling this behaviour, if the user
specifies a value, we will not perform validation on the input and will
attempt to prefer that, particularly in the case of VisualC++ tools
where no fallback occurs.
Reviewed by: hans
Differential Revision: https://reviews.llvm.org/D145517
Kazu Hirata [Mon, 13 Mar 2023 16:13:28 +0000 (09:13 -0700)]
[ADT] Implement {DenseMap,MapVector,StringMap}::contains
This patch implements the C++20-style contains() for DenseMap,
MapVector, and StringMap.
With this patch, every set and map container type that has count()
also has contains().
Differential Revision: https://reviews.llvm.org/D145895
Michał Górny [Mon, 13 Mar 2023 15:37:10 +0000 (16:37 +0100)]
[third-party] Respect LLVM_INSTALL_GTEST for llvm_gtest_main
Pass BUILDTREE_ONLY to llvm_gtest_main only if LLVM_INSTALL_GTEST
is not set. This fixes
0807986303f5d498cee32d42c242940d00617ad9.
Otherwise, llvm_gtest_main cannot be used
in LLVM_DISTRIBUTION_COMPONENTS, effectively making it impossible
to install llvm_gtest correctly.
Differential Revision: https://reviews.llvm.org/D145946
Shao-Ce SUN [Mon, 13 Mar 2023 15:44:36 +0000 (23:44 +0800)]
[flang][nfc] Avoid generating external-hello-world by default
The current setting is not working.
When compiling `flang`, the `external-hello-world` is still compiled by default.
Reviewed By: luporl
Differential Revision: https://reviews.llvm.org/D145877
Phoebe Wang [Mon, 13 Mar 2023 15:32:46 +0000 (23:32 +0800)]
[X86] Use llvm::Align for passing the alignment
This should be a typo in `emitConstantSizeRepmov`. Both its caller and
callee store the alignment in a 64-bit variables, no reason to truncate
it to 32-bit. It results in alignment turns into 0 when larger than
0x100000000.
Fixes #61348
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D145863
LLVM GN Syncbot [Mon, 13 Mar 2023 15:57:29 +0000 (15:57 +0000)]
[gn build] Port
383cfeee09d1
Philip Reames [Mon, 13 Mar 2023 15:54:44 +0000 (08:54 -0700)]
[RISCV] Inline and delete RISCVTTIImpl::getSpliceCost [nfc]
The code structure was copied from AArch64 which has a much more complicated splice cost model.
HerrCai0907 [Mon, 13 Mar 2023 15:50:43 +0000 (11:50 -0400)]
Fix typo: statment to statement; NFC
Differential Revision: https://reviews.llvm.org/D145834