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
Mehdi Amini [Mon, 13 Mar 2023 15:37:21 +0000 (16:37 +0100)]
Fix test dialect to avoid using an unregistered dialect
Fixes #61374
Mehdi Amini [Sun, 12 Mar 2023 22:44:21 +0000 (23:44 +0100)]
Add a `skipRegion()` feature to the OpPrintingFlags for MLIR ASM printer
This is a convenient flag for context where we intend to summarize a top-level
operation without the full-blown regions it may hold.
Differential Revision: https://reviews.llvm.org/D145889
Anders Waldenborg [Sun, 12 Feb 2023 21:12:08 +0000 (22:12 +0100)]
[clang][pp] Handle attributes defined by plugin in __has_attribute
When using attributes by plugins (both in clang and clang-tidy) the
preprocessor functions `__has_attribute`, `__has_c_attribute`,
`__has_cpp_attribute` still returned 0.
That problem is fixed by having the "hasAttribute" function also check
if any of the plugins provide that attribute.
This also adds C2x spelling to the example plugin for attributes so that
`__has_c_attribute` can be tested.
Differential Revision: https://reviews.llvm.org/D144405
Anders Waldenborg [Thu, 2 Feb 2023 21:10:20 +0000 (22:10 +0100)]
[clang] Extract function for generated part of clang::hasAttribute (NFC)
This makes it easier to add additional handling when the
tablegen-generated code does not find a match.
No functional change intended.
Differential Revision: https://reviews.llvm.org/D144404
Anders Waldenborg [Thu, 9 Mar 2023 21:55:38 +0000 (22:55 +0100)]
[clang] Extract ParsedAttrInfo::hasSpelling method (NFC)
This intends to simplify this checking when it is done in more places.
No functional change intended.
Differential Revision: https://reviews.llvm.org/D145769
Anders Waldenborg [Sun, 12 Feb 2023 19:44:30 +0000 (20:44 +0100)]
[clang] Extract attribute plugin instantiation to function (NFC)
This moves the code to instantiate the attribute plugins to the same
place where the plugin registry is defined so they live together and the
user of the plugins doesn't have the burden of instantiating the
plugins.
No functional change intended.
Differential Revision: https://reviews.llvm.org/D144403
Anders Waldenborg [Sun, 12 Feb 2023 18:33:22 +0000 (19:33 +0100)]
[clang] Move ParsedAttrInfo from Sema to Basic (NFC)
This moves the ParsedAttrInfo class and the registry for attribute
plugin to be part of Basic module instead of Sema module.
This will allow it to be accessed from preprocessor later on.
No functional change intended.
Differential Revision: https://reviews.llvm.org/D144402
Philip Reames [Mon, 13 Mar 2023 15:32:16 +0000 (08:32 -0700)]
[RISCV] Use switch in RISCVTargetTransformInfo::getShuffleCost [nfc]
Refactoring in advance of a semantic change.
Siva Chandra Reddy [Mon, 13 Mar 2023 15:34:58 +0000 (15:34 +0000)]
[libc][NFC] Add string.h header to various platform headers.txt.
Alex Bradbury [Mon, 13 Mar 2023 15:14:43 +0000 (15:14 +0000)]
Reland [RISCV] Fix gaps in IgnoreUnknown=true for RISCVISAInfo::parseArchString
Prior to this patch, unrecognised z/s/sx/x prefixed extensions were not
ignored when IgnoreUnknown=true.
The first version of this patch,
a7313f83b9ca9, incorrectly used
`!isSupportedExtension(Ext)` rather than `!isSupportedExtension(Name)`.
i.e. checked the full substring rather than the split out name, causing
incorrect behaviour when a version is specified. This was fixed and a
new test case addded.
Differential Revision: https://reviews.llvm.org/D145882
Sjoerd Meijer [Mon, 13 Mar 2023 13:05:34 +0000 (13:05 +0000)]
[AArch64] Cost-model vector splat LD1Rs to avoid unprofitable SLP vectorisation
This slightly increases the costs of InsertElement instructions that are part
of a vector splat sequence, i.e. a load, InsertElement and a shuffle (load +
dup). The resulting LD1R is a high latency instruction, and this slight
increase in costs avoids SLP vectorisation for a couple of cases where this
isn't profitable.
Fixes: https://github.com/llvm/llvm-project/issues/61047
Differential Revision: https://reviews.llvm.org/D145578
Valentin Clement [Mon, 13 Mar 2023 14:27:02 +0000 (15:27 +0100)]
[flang] Handle parent component in intrinsic function arguments
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.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D145907
Valentin Clement [Mon, 13 Mar 2023 14:25:30 +0000 (15:25 +0100)]
[flang] Only check for embox/rebox if defining op is present
When the base box is a block argument, the defining op is null.
Only try to recover embox/rebox if there is a defining op.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D145910
Hans Wennborg [Mon, 13 Mar 2023 10:24:29 +0000 (11:24 +0100)]
[libc++] Add missing include in exception_ptr.h
Windows builds were failing due to missing include for std::addressof
after D145095.
Differential revision: https://reviews.llvm.org/D145919
Liming Liu [Tue, 7 Mar 2023 13:08:57 +0000 (21:08 +0800)]
[clang] Replace Member Expressions During Instantiation If Necessary
This patch replaces member accesses to declaration references during template
instantiation if the context is the unevaluated context and the class does not
contain the declaration.
The replacement fixes the issue #58674. Unlike previous fixes such as D143840,
it checks the membership during instantiation rather than right after parsing,
so the check is more accurate and efficient.
This patch also includes cases that previous fixes had once failed on.
Differential Revision: https://reviews.llvm.org/D145491
Collin Baker [Mon, 13 Mar 2023 14:11:05 +0000 (10:11 -0400)]
Fix include order in CXType.cpp
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. An
additional function clang_isBitFieldDecl() is added to disambiguate
between error code meanings.
Fixes: https://github.com/llvm/llvm-project/issues/56644
Differential Revision: https://reviews.llvm.org/D130303
Dmitry Polukhin [Mon, 13 Mar 2023 14:00:56 +0000 (07:00 -0700)]
Revert "[clangd] Move standard options adaptor to CommandMangler"
This reverts commit
34de7da6246cdfa6ff6f3d3c514583cddc0a10ec.
Simon Pilgrim [Mon, 13 Mar 2023 13:38:55 +0000 (13:38 +0000)]
[DAG] Use ISD::isBitwiseLogicOp in AND/OR/XOR checks. NFCI.
There's additional cases we can cleanup (mainly in target code), but this tries to cleanup generic code and PPC which had an equivalent helper.
Felipe de Azevedo Piovezan [Fri, 10 Mar 2023 03:22:50 +0000 (22:22 -0500)]
[MachineCombiner] Preserve debug instruction number
Each target's `TargetInstrInfo` is responsible for announcing which code
patterns it is able to transform during the MachineCombiner pass.
Currently, these patterns are applied without preserving the debug
instruction number required by the InstrRef implementation of
LiveDebugValues. As such, we've seen a number of examples where debug
information is dropped for variables in InstrRef mode that were
otherwise available in VarLoc mode. This has been observed both in X86
and AArch examples.
This commit is an initial attempt at preserving said numbers by changing
the general (target agnostic) implementation of TargetInstrInfo: the
reassociation pattern must keep the debug number of the "top level"
instruction, i.e., the instruction whose value represents the final
value of the arithmetic expression. Intermediate values must have their
debug number dropped, as they have no equivalent value in the
unoptimized code.
Future work is required to update each target's
`TargetInstrInfo::genAlternativeCodeSequence` method.
Differential Revision: https://reviews.llvm.org/D145759
Mehdi Amini [Mon, 13 Mar 2023 12:56:15 +0000 (13:56 +0100)]
Add a message to mlir-opt when reading from stdin to avoid being waiting for nothing
It happens from time to time that one may run mlir-opt expecting something to
happen, but the process is waiting on stdin. Print a message when reading from
stdin to warn developers.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D145469
Alexey Bataev [Thu, 9 Mar 2023 21:36:43 +0000 (13:36 -0800)]
[SLP][NFC]Initial merge of gather/buildvector code in the createBuildVector function.
Required for future changes with combining shuffled nodes and
buildvector sequences to improve cost/emission of the gather nodes.
Part of D110978
Differential Revision: https://reviews.llvm.org/D145732
Dmitry Polukhin [Thu, 16 Feb 2023 13:06:53 +0000 (05:06 -0800)]
[clangd] Move standard options adaptor to CommandMangler
There is a discrepancy between how clangd processes CDB loaded from
JSON file on disk and pushed via LSP. Thus the same CDB pushed via
LSP protocol may not work as expected. Some difference between these two
paths is expected but we still need to insert driver mode and target from
binary name and expand response files.
Test Plan: check-clang-tools
Differential Revision: https://reviews.llvm.org/D143436
Paul Walker [Thu, 2 Mar 2023 13:23:53 +0000 (13:23 +0000)]
[SVE] Restrict cmp+and->pred_cmp isel to instances where the and is the sole user of the compare.
Without the single use restriction we may replace the and with a
more costly duplicated compare.
Differential Revision: https://reviews.llvm.org/D145755
Ankur [Mon, 13 Mar 2023 12:28:39 +0000 (17:58 +0530)]
[clang][ExtractAPI] Add multiple file support to --extract-api-ignores
- Modify -extract-api-ignores command line option to accept multiple
arguments
- Update APIIgnoresList to operate on a file list instead of a single file
- Add new test verifying the functionality
- fix #61242 on GitHub issue tracker
Reviewed By: dang
Differential Revision: https://reviews.llvm.org/D145869
Mikhail Goncharov [Mon, 13 Mar 2023 12:15:53 +0000 (13:15 +0100)]
LLVM GN Syncbot [Mon, 13 Mar 2023 12:13:23 +0000 (12:13 +0000)]
[gn build] Port
e26dad0a661e
Kadir Cetinkaya [Mon, 13 Mar 2023 11:04:05 +0000 (12:04 +0100)]
[clangd] Add missing unittests to build graph
Also fix tests
Differential Revision: https://reviews.llvm.org/D145921
David Spickett [Mon, 13 Mar 2023 12:01:31 +0000 (12:01 +0000)]
[lldb][docs] Remove mentions of MIPS64 Linux debug
This was removed in
ce03a862372a6f36d2fcf80dc80052aa155fcae8.
David Spickett [Thu, 9 Mar 2023 14:55:12 +0000 (14:55 +0000)]
[lldb] Use static instead of anonymous namesapce in CrashReason
As preferred by the llvm guidelines.
David Spickett [Thu, 9 Mar 2023 14:42:28 +0000 (14:42 +0000)]
[lldb] Remove MIPS64 specific signal handling for Linux
MIPS Linux support was removed in
ce03a862372a6f36d2fcf80dc80052aa155fcae8
so this is no longer needed.
Haojian Wu [Mon, 13 Mar 2023 09:51:38 +0000 (10:51 +0100)]
[clangd] Remove the IncludeStructure::isSelfContained API.
This API was merely used in the old unused-include implementation, with
the removal, this API is not used anymore.
Differential Revision: https://reviews.llvm.org/D145917
Haojian Wu [Fri, 10 Mar 2023 11:06:32 +0000 (12:06 +0100)]
[clangd] Remove IWYU handling code that is used only for the old unused-include feature.
The old implementation has been removed, this patch removes the clangd's IWYU
code that is only used for the old implmentation (include-cleaner library has
better support):
- IWYU export pragma
- IWYU keep pragma
Differential Revision: https://reviews.llvm.org/D145916
Alex Bradbury [Mon, 13 Mar 2023 11:20:28 +0000 (11:20 +0000)]
Revert "[RISCV] Fix gaps in IgnoreUnknown=true for RISCVISAInfo::parseArchString"
This reverts commit
a7313f83b9ca904fade446e000550c69e0887cbf.
Causes a buildbot failure.
Alexey Lapshin [Thu, 9 Mar 2023 14:42:01 +0000 (15:42 +0100)]
[DWARFLinker][DWARFv5] Add support for DW_FORM_addrx*
This patch add support of DWARFv5 attribute forms: DW_FORM_addrx1,
DW_FORM_addrx2, DW_FORM_addrx3, DW_FORM_addrx4.
Differential Revision: https://reviews.llvm.org/D145805
Alex Bradbury [Mon, 13 Mar 2023 11:00:46 +0000 (11:00 +0000)]
[RISCV][test] Fix typos in RISCVISAInfoTest
Alex Bradbury [Mon, 13 Mar 2023 10:53:05 +0000 (10:53 +0000)]
[RISCV] Fix gaps in IgnoreUnknown=true for RISCVISAInfo::parseArchString
Prior to this patch, unrecognised z/s/sx/x prefixed extensions were not
ignored when IgnoreUnknown=true.
Differential Revision: https://reviews.llvm.org/D145882
Alex Bradbury [Mon, 13 Mar 2023 10:51:15 +0000 (10:51 +0000)]
[RISCV][test] Expand test coverage of RISCVISAInfo
D144343 added C++ unit tests for the newly added
RISCVISAInfo::parseArchStringNormalized. This patch adds test coverage
for parseArchString and the toFeatureVector member method.
Posting for review as it would be useful if someone can take a quick
look to check they don't feel I've missed testing an important aspect of
the current behaviour.
Differential Revision: https://reviews.llvm.org/D145879
Nikita Popov [Mon, 13 Mar 2023 10:11:55 +0000 (11:11 +0100)]
[IPSCCP] Don't add !range metadata for vector returns
!range metadata is currenlty not supported on vector types. This
fixes verifier failures exposed by D144467.
Peter Smith [Fri, 10 Mar 2023 13:22:18 +0000 (13:22 +0000)]
[LLD] Increase thunk pass limit
In issue 61250 https://github.com/llvm/llvm-project/issues/61250 there is
an example of a program that takes 17 passes to converge, which is 2 more
than the current limit of 15. Analysis of the program shows a particular
section that is made up of many roughly thunk sized chunks of code ending
in a call to a symbol that needs a thunk. Due to the positioning of the
section, at each pass a subset of the calls go out of range of their
original thunk, needing a new one created, which then pushes more thunks
out of range. This process eventually stops after 17 passes.
This patch is the simplest fix for the problem, which is to increase
the pass limit. I've chosen to double it which should comfortably
account for future cases like this, while only taking a few more
seconds to reach the limit in case of non-convergence.
As discussed in the issue, there could be some additional work done
to limit thunk reuse, this would potentially increase the number of
thunks in the program but should speed up convergence.
Differential Revision: https://reviews.llvm.org/D145786
Vladislav Khmelevsky [Mon, 13 Mar 2023 09:36:26 +0000 (13:36 +0400)]
[BOLT] Pass instrumentation-file arg for X86 xmm test
Differential Revision: https://reviews.llvm.org/D144865
Vladislav Khmelevsky [Fri, 10 Feb 2023 13:09:03 +0000 (17:09 +0400)]
[BOLT] Improve dynamic relocations support for CI
This patch fixes few problems with supporting dynamic relocations in CI.
1. After dynamic relocations and functions were read search for dynamic
relocations located in functions. Currently we expected them only to be
relative and only to be in constant island. Mark islands of such
functions to have dynamic relocations and create CI access symbol on the
relocation offset, so the BD would be created for such place.
2. During function disassemble and handling address reference for
constant island check if the referred external CI has dynamic
relocation. And if it has one we would continue to refer original CI
rather then creating a local copy.
3. After function disassembly stage mark function that has dynamic reloc
in CI as non-simple. We don't want such functions to be optimized, since
such passes as split function would create 2 copies of CI which we
unable to support currently.
4. During updating output values for BF search for BD located in CI and
update their output locations.
5. On dynamic relocation patching stage search for binary data located
on relocation offset. If it was moved use new relocation offset value
rather then an old one.
Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei
Differential Revision: https://reviews.llvm.org/D143748
Jay Foad [Mon, 13 Mar 2023 08:23:05 +0000 (08:23 +0000)]
[AMDGPU] Remove BoolToList class
Replace all:
foreach _ = BoolToList<cond>.ret in
with:
if cond then
Thanks to Philip Reames for D145711 which enabled this.
Matthias Springer [Mon, 13 Mar 2023 08:14:54 +0000 (09:14 +0100)]
[mlir][IR] Add ForwardDominanceIterator for IR walkers
This iterator is similar to `ForwardIterator` but enumerates blocks according to their successor relationship. As a first use case, this new iterator is utilized in the dialect conversion framework.
Differential Revision: https://reviews.llvm.org/D144888
Chuanqi Xu [Mon, 13 Mar 2023 08:42:55 +0000 (16:42 +0800)]
[doc] [Modules] Document how to implement ABI compatible code in module units
Phoebe Wang [Mon, 13 Mar 2023 08:39:08 +0000 (16:39 +0800)]
[X86] Pre-commit test for #61271
Adrian Kuegel [Mon, 13 Mar 2023 07:54:29 +0000 (08:54 +0100)]
[mlir][Bazel] Adjustments for
fa51c1753a274fbb7a71d8fe91fd4e5caf2fa4d3
Fix bazel build.
Differential Revision: https://reviews.llvm.org/D145903
Weining Lu [Mon, 13 Mar 2023 07:44:58 +0000 (15:44 +0800)]
[LLDB][ObjectFileELF] Correct the return type of Reloc{Offset,Addend}32
This is a follow up of D145550.
I think Reloc{Type,Symbol}{32,64} can keep unchanged as they are not
directly returning a field of the ELFRel[a] struct.
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D145571
Weining Lu [Mon, 13 Mar 2023 07:44:56 +0000 (15:44 +0800)]
[LLDB][ObjectFileELF] Correct the return type of RelocOffset64 and RelocAddend64
According to `/usr/include/elf.h` and `lldb/source/Plugins/ObjectFile/ELF/ELFHeader.h`.
For ELF64 relocation, types of `offset` and `addend` should be `elf_addr` and `elf_sxword`.
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D145550
Weining Lu [Mon, 13 Mar 2023 07:44:47 +0000 (15:44 +0800)]
[LLDB][ObjectFileELF] Support LoongArch64 in ApplyReloctions
Currently ApplyReloctions() deals with different archs' relocation types
together (in a single `switch() {..}`). I think it is incorrect because
different relocation types of different archs may have same enum values.
For example:
`R_LARCH_32` and `R_X86_64_64` are both `1`;
`R_LARCH_64` and `R_X86_64_PC32` are both `2`.
This patch handles each arch in seperate `switch()` to solve the enum
values conflict issue.
And a new test is added for LoongArch64.
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D145462
Matthias Springer [Mon, 13 Mar 2023 07:56:08 +0000 (08:56 +0100)]
[mlir][affine][analysis] Fix `closedUB` handling in `getSliceBounds`
There were cases in which `ubAdjustment` was not applied to the resulting UB.
Differential Revision: https://reviews.llvm.org/D145796
Chuanqi Xu [Mon, 13 Mar 2023 07:43:08 +0000 (15:43 +0800)]
[C++20] [Modules] Treat module linkage as formal linkage only
Close https://github.com/llvm/llvm-project/issues/61321
There are two linkage modes in clang now: one for internal linkage and
one for formal linkage. The internal linkage is for the implementation
details and the formal linkage is for the consistency with the C++
standard.
Since we previously implemented the strong ownership for modules, the
module linkage is not meaningful for linkers any more. So the module
linkage should only be used for formal linkage.
Siva Chandra Reddy [Mon, 13 Mar 2023 07:46:24 +0000 (07:46 +0000)]
[libc] Enable integration tests when built with gcc.
Siva Chandra Reddy [Sun, 12 Mar 2023 08:21:50 +0000 (08:21 +0000)]
[libc] Declare __dso_handle in the integration test instead of startup.
Fixes #61355. The __dso_handle decl was introduced incorrectly into the startup
objects during the integration test cleanup which moved the integration tests
away from using an artificial sysroot to using -nostdlib. Having it in the
startup creates the duplicate symbol error when one does not use -nostdlib.
Since this is an integration test only problem, it is meaningful to keep it in
the integration test anyway.
Differential Revision: https://reviews.llvm.org/D145898
Dmitry Vyukov [Mon, 13 Mar 2023 07:43:03 +0000 (08:43 +0100)]
asan: disable odd_stack_size test for powerpc
Fail on powerpc64 bots with:
AddressSanitizer: CHECK failed: asan_thread.cpp:315 "((AddrIsInStack((uptr)&local))) != (0)"
https://lab.llvm.org/buildbot/#/builders/18/builds/8162
Disable to unbreak bots.
Differential Revision: https://reviews.llvm.org/D145902
Kazu Hirata [Mon, 13 Mar 2023 07:43:27 +0000 (00:43 -0700)]
[mlir] Use llvm::is_contained (NFC)
Max Kazantsev [Mon, 13 Mar 2023 07:13:33 +0000 (14:13 +0700)]
Return "[LICM] Support logical AND/OR when hoisting min/max"
Underlying bug (creation of umin for pointers) is now fixed.
Differential Revision: https://reviews.llvm.org/D145771
pvanhout [Thu, 9 Mar 2023 14:01:56 +0000 (15:01 +0100)]
[StructurizeCFG] Use UniformityAnalysis instead of DivergenceAnalysis
Depends on D145572
Reviewed By: foad, sameerds
Differential Revision: https://reviews.llvm.org/D145688
Siva Chandra [Sun, 12 Mar 2023 08:31:03 +0000 (08:31 +0000)]
[libc] Special case sniffing of thread start args for riscv.