Jean Perier [Mon, 28 Mar 2022 08:21:36 +0000 (10:21 +0200)]
[flang][runtime] Ensure PointerDeallocate actually deallocate pointers
PointerDeallocate was silently doing nothing because it relied on
Destroy that doe not do anything for Pointers. Add an option to Destroy
in order to destroy pointers.
Add a unit test for PointerDeallocate.
Differential Revision: https://reviews.llvm.org/D122492
Fangrui Song [Mon, 28 Mar 2022 08:17:37 +0000 (01:17 -0700)]
Revert D121984 "[RISCV][NFC] Moving RVV intrinsic type related util to llvm/Support"
This reverts commit
ad57e10dbca2fdeff1448afc0aa1cf23d6df8736 and
1967fd8d5e7e40a987d8f65d163c7eb8f4b9e76f
llvm/lib/Support/RISCVVIntrinsicUtils.cpp introduced llvm/TableGen includes,
a circular dependency https://llvm.org/docs/CodingStandards.html#library-layering
I think this particular instance is serious and should be reverted.
Adrian Kuegel [Mon, 28 Mar 2022 07:49:18 +0000 (09:49 +0200)]
Revert "Revert "[RISCV][NFC] Remove unused header includes.""
Reland Remove unused header includes.
Add header includes that are needed, but previously were pulled in
transitively.
Fangrui Song [Mon, 28 Mar 2022 08:00:43 +0000 (01:00 -0700)]
[llvm-objdump] --private-headers: change errors to warnings for dynamic section dumping
Fix #54456: `objcopy --only-keep-debug` produces a linked image with invalid
empty dynamic section. llvm-objdump -p currently reports an error which seems
excessive.
```
% llvm-readelf -l a.out
llvm-readelf: warning: 'a.out': no valid dynamic table was found
...
```
Follow the spirit of llvm-readelf -l (D64472) and report a warning instead.
This allows later files to be dumped despite warnings for an input file, and
improves objdump compatibility in that the exit code is now 0 instead of 1.
```
% llvm-objdump -p a.out # new behavior
...
Program Header:
llvm-objdump: warning: 'a.out': invalid empty dynamic section
% objdump -p a.out
...
Dynamic Section:
```
Reviewed By: jhenderson, raj.khem
Differential Revision: https://reviews.llvm.org/D122505
Fangrui Song [Mon, 28 Mar 2022 07:58:14 +0000 (00:58 -0700)]
[llvm-objdump][test] dos2unix some files
Fangrui Song [Mon, 28 Mar 2022 07:51:58 +0000 (00:51 -0700)]
[RISCV] Remove using namespace llvm from public header after D121984
Adrian Kuegel [Mon, 28 Mar 2022 07:48:14 +0000 (09:48 +0200)]
Revert "[RISCV][NFC] Remove unused header includes."
This reverts commit
4edd7576dbb4917162c22e371c2464df90883bd1.
It seems we rely on transitive header includes here.
Adrian Kuegel [Mon, 28 Mar 2022 06:44:40 +0000 (08:44 +0200)]
[RISCV][NFC] Remove unused header includes.
Keeping those includes would cause a dependency cycle between Support
and TableGen targets.
Differential Revision: https://reviews.llvm.org/D122555
Muhammad Omair Javaid [Mon, 28 Mar 2022 07:32:44 +0000 (12:32 +0500)]
[LLDB] Skip TestProcessIOHandlerInterrupt Arm/AArch64 Linux
This patch skips TestProcessIOHandlerInterrupt on Arm/AArch64.
PExpect tests are not stable when run in containerized machine.
LLVM GN Syncbot [Mon, 28 Mar 2022 06:40:50 +0000 (06:40 +0000)]
[gn build] Port
ad57e10dbca2
Iain Sandoe [Fri, 31 Jul 2020 09:44:12 +0000 (10:44 +0100)]
[C++20][Modules][HU 5/5] Add fdirectives-only mode for preprocessing output.
When the -fdirectives-only option is used together with -E, the preprocessor
output reflects evaluation of if/then/else directives.
As such, it preserves defines and undefs of macros that are still live after
such processing. The intent is that this output could be consumed as input
to generate considered a C++20 header unit.
We strip out any (unused) defines that come from built-in, built-in-file or
command line; these are re-added when the preprocessed source is consumed.
Differential Revision: https://reviews.llvm.org/D121099
Kito Cheng [Mon, 28 Mar 2022 02:00:02 +0000 (10:00 +0800)]
[RISCV][NFC] Moving RVV intrinsic type related util to llvm/Support
This patch is split from https://reviews.llvm.org/D111617, we need those
stuffs on clang, so must moving those stuff to llvm/Support.
Reviewed By: khchen
Differential Revision: https://reviews.llvm.org/D121984
Kazu Hirata [Mon, 28 Mar 2022 05:22:37 +0000 (22:22 -0700)]
[Target] Apply clang-tidy fixes for readability-redundant-member-init (NFC)
lizhengxian.123 [Mon, 28 Mar 2022 04:39:44 +0000 (12:39 +0800)]
[docs][Lexicon] Add new explanation for some shortcomings(WPD, CFI) for lexicon
Add explanations for WPD(whole program devirtualization) and another meaning for CFI(control flow Integrity).
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D122473
Vladislav Khmelevsky [Sat, 19 Mar 2022 10:26:38 +0000 (13:26 +0300)]
[BOLT] Align constant islands to 8 bytes
AArch64 requires CI to be aligned to 8 bytes due to access instructions
restrictions. E.g. the ldr with imm, where imm must be aligned to 8 bytes.
Differential Revision: https://reviews.llvm.org/D122065
Florian Hahn [Sun, 27 Mar 2022 18:59:37 +0000 (19:59 +0100)]
[Clang,TBAA] Add test cases for nested pointers and TBAA data.
Mateusz Guzik [Sun, 27 Mar 2022 18:17:56 +0000 (20:17 +0200)]
[Support] Skip attempts to access /proc/self/fd on FreeBSD
In contrast to Linux it does not provide entries which can be readlinked
-- these are just regular files, not giving the expected outcome. That's
on top of procfs not being mounted by default to begin with.
This is probably the case on other BSDs as well, so I expect there will
be more ifdefs added down the road.
Reviewed By: emaste, dim
Differential Revision: https://reviews.llvm.org/D122545
Mark de Wever [Sun, 27 Mar 2022 15:14:27 +0000 (17:14 +0200)]
[libc++][doc] Update format implementation status.
chenglin.bi [Sun, 27 Mar 2022 13:34:58 +0000 (09:34 -0400)]
[InstCombine] add baseline tests for logical and/or folds; NFC
Extracted from D122152
zhongyunde [Sun, 27 Mar 2022 13:17:35 +0000 (21:17 +0800)]
[AArch64][SelectionDAG] Refactor to support more scalable vector extending loads
Accord the discussion in D120953, we should firstly exclude all scalable vector
extending loads and then selectively enable those which we directly support.
This patch is intend to refactor for above (truncating stores is not touched),and
more scalable vector types will try to reduce the number of masked loads in favour
of more unpklo/hi instructions.
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D122281
Hirochika Matsumoto [Sun, 27 Mar 2022 13:11:20 +0000 (09:11 -0400)]
[InstCombine] add baseline tests for fold of ctpop + icmp; NFC
Extracted from D122077.
Iain Sandoe [Wed, 2 Mar 2022 20:18:10 +0000 (20:18 +0000)]
[C++20][Modules][HU 4/5] Handle pre-processed header units.
We wish to support emitting a pre-processed output for an importable
header unit, that can be consumed to produce the same header units as
the original source.
This means that ee need to find the original filename used to produce
the re-preprocessed output, so that it can be assigned as the module
name. This is peeked from the first line of the pre-processed source
when the action sets up the files.
Differential Revision: https://reviews.llvm.org/D121098
Phoebe Wang [Sun, 27 Mar 2022 04:23:21 +0000 (12:23 +0800)]
[X86] Refactor X86ScalarSSEf16/32/64 with hasFP16/SSE1/SSE2. NFCI
This is used for f16 emulation. We emulate f16 for SSE2 targets and
above. Refactoring makes the future code to be more clean.
Reviewed By: LuoYuanke
Differential Revision: https://reviews.llvm.org/D122475
Luo, Yuanke [Thu, 17 Mar 2022 09:48:02 +0000 (17:48 +0800)]
Verify parameter alignment attribute
In DAGISel, the parameter alignment only have 4 bits to hold the value.
The encode(alignment) would plus the value by 1, so the max aligment that
ISel can support is 2^14. This patch verify align attribute for parameter.
Differential Revision: https://reviews.llvm.org/D122130
Shengchen Kan [Sun, 27 Mar 2022 00:41:17 +0000 (08:41 +0800)]
[X86][tablgen] Extract common functions in X86EVEX2VEXTablesEmitter.cpp and X86FoldTablesEmitter.cpp to avoid duplicated code. NFC
Luo, Yuanke [Thu, 17 Mar 2022 09:48:02 +0000 (17:48 +0800)]
[Verifier] Verify parameter alignment.
In DAGISel, the parameter alignment only have 4 bits to hold the value.
The encode(alignment) would plus the shift value by 1, so the max aligment
ISel can support is 2^14. This patch verify the parameter and return
value for alignment.
Differential Revision: https://reviews.llvm.org/D121898
Shengchen Kan [Sat, 26 Mar 2022 23:35:47 +0000 (07:35 +0800)]
[X86][tablgen] Remove PointerLikeRegClass from isRegisterOperand b/c getRegOperandSize crashes for it. NFCI
David Green [Sat, 26 Mar 2022 21:10:43 +0000 (21:10 +0000)]
[AArch64] Lower 3 and 4 sources buildvectors to TBL
The default expansion for buildvectors is to extract each element and
insert them into a new vector. That involves a lot of copying to/from
the GPR registers. TLB3 and TLB4 can be relatively slow instructions
with the mask needing to be loaded from a constant pool, but they should
always be better than all the moves to/from GPRs.
Differential Revision: https://reviews.llvm.org/D121137
Martin Storsjö [Thu, 24 Mar 2022 08:42:37 +0000 (10:42 +0200)]
[lldb] Fix interpreting absolute Windows paths with forward slashes
In practice, Windows paths can use either backslashes or forward slashes.
This fixes an issue reported downstream at
https://github.com/mstorsjo/llvm-mingw/issues/266.
Differential Revision: https://reviews.llvm.org/D122389
Martin Storsjö [Fri, 25 Mar 2022 15:39:48 +0000 (17:39 +0200)]
[lldb] Fix building for mingw after changes to sigtstp_handler
Some signal handlers were set up within an !_MSC_VER condition,
i.e. omitted in MSVC builds but included in mingw builds. Previously
sigtstp_handler was defined in all builds, but since
4bcadd66864bf4af929ac8753a51d7ad408cdef0 / D120320 it's only
defined non platforms other than Windows.
Change the condition to !_WIN32 for consistency between the MSVC
and mingw builds, fixing the build for mingw.
Differential Revision: https://reviews.llvm.org/D122486
Lang Hames [Sat, 26 Mar 2022 20:14:26 +0000 (13:14 -0700)]
[docs][ORC] Simplify paragraph on hardcoding process addresses.
Lang Hames [Sat, 26 Mar 2022 20:02:01 +0000 (13:02 -0700)]
[docs][ORC] Reword "How to Add Process and Library Symbols to the JITDylibs".
Now opens with advice on what to do, rather than what *not* to do.
Alisamar Husain [Sat, 26 Mar 2022 15:53:50 +0000 (08:53 -0700)]
[intelpt] Refactoring instruction decoding for flexibility
Now the decoded thread has Append methods that provide more flexibility
in terms of the underlying data structure that represents the
instructions. In this case, we are able to represent the sporadic errors
as map and thus reduce the size of each instruction.
Differential Revision: https://reviews.llvm.org/D122293
Iain Sandoe [Wed, 23 Sep 2020 14:58:58 +0000 (15:58 +0100)]
[C++20][Modules][HU 3/5] Emit module macros for header units.
For header units we build the top level module directly from the header
that it represents and macros defined in this TU need to be emitted (when
such a definition is live at the end of the TU).
Differential Revision: https://reviews.llvm.org/D121097
LLVM GN Syncbot [Sat, 26 Mar 2022 16:10:19 +0000 (16:10 +0000)]
[gn build] Port
555214cbcc79
Shengchen Kan [Sat, 26 Mar 2022 16:04:03 +0000 (00:04 +0800)]
[X86][tablgen] Remove useless check in X86FoldTablesEmitter.cpp. NFC
Any `X86Inst` has a name.
Mark de Wever [Sat, 4 Sep 2021 19:05:23 +0000 (21:05 +0200)]
[libc++][format][2/6] Adds a __output_iterator.
Instead of using a temporary `string` in `__vformat_to_wrapped` use a new
generic iterator. This aids to reduce the number of template instantions
and avoids using a `string` to buffer the entire formatted output.
This changes the type of `format_context` and `wformat_context`, this can
still be done since the code isn't ABI stable yet.
Several approaches have been evaluated:
- Using a __output_buffer base class with:
- a put function to store the buffer in its internal buffer
- a virtual flush function to copy the internal buffer to the output
- Using a `function` to forward the output operation to the output buffer,
much like the next method.
- Using a type erased function point to store the data in the buffer.
The last version resulted in the best performance. For some cases there's
still a loss of speed over the original method. This loss many becomes
apparent when large strings are copied to a pointer like iterator, before
the compiler optimized this using `memcpy`.
Reviewed By: ldionne, vitaut, #libc
Differential Revision: https://reviews.llvm.org/D110495
Shengchen Kan [Sat, 26 Mar 2022 15:32:50 +0000 (23:32 +0800)]
[X86][tablgen] Rename some fields for RecognizableInstrBase to align with fields in TD file. NFC
The comment for `HasVEX_L` is updated.
Shengchen Kan [Sat, 26 Mar 2022 15:14:08 +0000 (23:14 +0800)]
[X86][tablgen] Rename field hasREX_WPrefix to hasREX_W for X86Inst. NFC
To make it more like hasVEX_L and hasEVEX_K, etc.
Shengchen Kan [Sat, 26 Mar 2022 14:29:23 +0000 (22:29 +0800)]
[X86][tablgen] Refine the class RecognizableInstr. NFCI
1. Add comments to explain why we set `isAsmParserOnly` for XACQUIRE and XRELEASE
2. Check `X86Inst` in the constructor of `RecognizableInstrBase` so that
we can avoid the case where one of it's field is not initialized but
accessed by user. (e.g. in X86EVEX2VEXTablesEmitter.cpp)
3. Move `Rec` from `RecognizableInstrBase` to `RecognizableInstr` to reduce
size of `RecognizableInstrBase`
4. Remove out-of-date comments for shouldBeEmitted() (filter() was removed)
5. Add a basic field `IsAsmParserOnly` and remove the field
`ShouldBeEmitted` b/c we can deduce it w/ little overhead
Aaron Ballman [Sat, 26 Mar 2022 12:01:47 +0000 (08:01 -0400)]
[C11] Correct the resulting type for an assignment expression
In C, assignment expressions result in an rvalue whose type is the type
of the lhs of the assignment after it undergoes lvalue to rvalue
conversion. lvalue to rvalue conversion in C strips all qualifiers
including _Atomic.
We used getUnqualifiedType() which does not strip the _Atomic qualifier
when we should have used getAtomicUnqualifiedType(). This corrects the
usage and adds some comments to getUnqualifiedType() to make it more
clear that it does not strip _Atomic and that's on purpose (see C11
6.2.5p27).
This addresses Issue 48742.
Mark de Wever [Thu, 24 Mar 2022 19:05:30 +0000 (20:05 +0100)]
[Clang][doc] Fix __builtin_assume wording.
D117296 removed wording for __builtin_assume, D120205 restored the
wording, but the last sentence was only partly restored. This restores
the rest of the last sentence.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D122423
xndcn [Thu, 24 Mar 2022 02:54:59 +0000 (10:54 +0800)]
[mlir][spirv] Convert func.call to spv.FunctionCall
Differential Revision: https://reviews.llvm.org/D122368
zhongyunde [Sat, 26 Mar 2022 11:09:11 +0000 (19:09 +0800)]
[test][AArch64] Add a test case for D121180 NFC
Now, perform last active true vector combine only where
we're extracting from a flag-setting operation. But in
fact, the last active extracting will output LASTB + WHILELS,
and the WHILELS itself is a flag-setting operation, so
precommit this case to test the potentially further optimization.
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D122453
Shengchen Kan [Sat, 26 Mar 2022 11:01:58 +0000 (19:01 +0800)]
[X86][tablgen] Set ShouldBeEmitted to false when isAsmParserOnly is true. NFCI
In fact, an instruction can not be emitted to disassemble table when
`isAsmParserOnly` is true, so `isAsmParserOnly=true` implies
`ShouldBeEmitted=false`.
We check `isAsmParserOnly` in X86FoldTablesEmitter.cpp at a early stage
b/c none of them is foldable.
Iain Sandoe [Sun, 10 Jan 2021 13:50:26 +0000 (13:50 +0000)]
[C++20][Modules][HU 2/5] Support searching Header Units in user or system search paths.
This is support for the user-facing options to create importable header units
from headers in the user or system search paths (or to be given an absolute path).
This means that an incomplete header path will be passed by the driver and the
lookup carried out using the search paths present when the front end is run.
To support this, we introduce file fypes for c++-{user,system,header-unit}-header.
These terms are the same as the ones used by GCC, to minimise the differences for
tooling (and users).
The preprocessor checks for headers before issuing a warning for
"#pragma once" in a header build. We ensure that the importable header units
are recognised as headers in order to avoid such warnings.
Differential Revision: https://reviews.llvm.org/D121096
Shengchen Kan [Sat, 26 Mar 2022 10:03:13 +0000 (18:03 +0800)]
[X86][tablgen] Use initializer list for some fields of RecognizableInstr*. NFC
Also, some code in constructor of `RecognizableInstrBase` is formatted.
Shengchen Kan [Sat, 26 Mar 2022 08:33:29 +0000 (16:33 +0800)]
[X86][tablgen] Move fields Name, Is64Bit, Is32Bit, Operands from RecognizableInstrBase to RecognizableInstr, NFCI
These four fields are not used by any user of `RecognizableInstrBase`,
so we can move them to `RecognizableInstr` to avoid unnecessary
construction.
Fangrui Song [Sat, 26 Mar 2022 08:09:18 +0000 (01:09 -0700)]
[Option] Remove the error-prone default argument true from 4-argument hasFlag
Fangrui Song [Sat, 26 Mar 2022 07:58:39 +0000 (00:58 -0700)]
[Option] Remove the error-prone default argument true from 3-argument hasFlag
Fangrui Song [Sat, 26 Mar 2022 07:57:06 +0000 (00:57 -0700)]
[Option] Avoid using the default argument for the 3-argument hasFlag. NFC
The default argument true is error-prone: I think many would think the
default is false.
Fangrui Song [Sat, 26 Mar 2022 06:59:31 +0000 (23:59 -0700)]
[Driver][test] Clean up riscv* tests
See `D119309` for the guideline (-target, -no-canonical-prefixes, unneeded -o
with -###).
Ben Shi [Sat, 26 Mar 2022 03:24:18 +0000 (03:24 +0000)]
[AVR] Optimize int16 airthmetic right shift for shift amount 7/14/15
Reviewed By: aykevl
Differential Revision: https://reviews.llvm.org/D115618
Fangrui Song [Sat, 26 Mar 2022 05:15:35 +0000 (22:15 -0700)]
[LoongArch] Fix several Clang warnings. NFC
Shengchen Kan [Sat, 26 Mar 2022 05:00:53 +0000 (13:00 +0800)]
[X86][tablgen] Add class RecognizableInstrBase to simplify X86 code, NFCI
Joseph Huber [Sat, 26 Mar 2022 03:05:29 +0000 (23:05 -0400)]
[OpenMP] Fix AMDGPU globals test
Shilei Tian [Sat, 26 Mar 2022 02:49:25 +0000 (22:49 -0400)]
[OpenMP][CUDA] Fix potential program crash caused by double free resources
As we mentioned in the code comments for function `ResourcePoolTy::release`,
at some point there could be two identical resources on the two sides of `Next`
mark. It is usually not an issue, unless the following case:
1. Some resources are not returned.
2. We need to iterate the pool and free the element.
That will cause double free, which is the case for event pool. Since we don't release
events hold by the data map, it can happen that the `Next` mark is not reset, and
we have two identical items in the pool. When the pool is destroyed, we will call
`cuEventDestroy` twice on the same event. In the best case, we can only observe
CUDA errors. In the worst case, it can cause internal failures in CUDART and further
crash.
This patch fixes the issue by tracking all resources that have been given using
an `unordered_set`. We don't remove it when a resource is returned. When the pool
is destroyed, we merge the pool (a `vector`) and the set. In this way, we can make
sure that the set contains all resources allocated from the device. We just need
to iterate the set and free the resource accordingly.
For now, only event pool is set to use it. Stream pool is not because we can make
sure all streams are returned when the plugin is destroyed.
Someone might be wondering, why don't we release all events hold in the data map.
That is because, plugins are determined to be destroyed *before* `libomptarget`.
If we can somehow make the plugin outlast `libomptarget`, life will be much
easier.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D122014
Joseph Huber [Fri, 25 Mar 2022 22:42:12 +0000 (18:42 -0400)]
[OpenMP] Add AMDGPU calling convention to ctor / dtor functions
This patch adds the necessary AMDGPU calling convention to the ctor /
dtor kernels. These are fundamentally device kenels called by the host
on image load. Without this calling convention information the AMDGPU
plugin is unable to identify them.
Depends on D122504
Fixes #54091
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D122515
Joseph Huber [Fri, 25 Mar 2022 20:36:57 +0000 (16:36 -0400)]
[OpenMP] Make Ctor / Dtor functions have external visibility
The default construction of constructor functions by LLVM tends to make
them have internal linkage. When we call a ctor / dtor function in the
target region we are actually creating a kernel that is called at
registration. Because the ctor is a kernel we need to make sure it's
externally visible so we can actually call it. This prevented AMDGPU
from correctly using constructors while NVPTX could use them simply
because it ignored internal visibility.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D122504
Shengchen Kan [Fri, 25 Mar 2022 12:54:19 +0000 (20:54 +0800)]
[X86][tablgen] Add interface getMnemonic to namespace X86Disassembler, NFCI
Address comments in D122477 b/c `getMnemonic` is common to X86 and may be
used in more than one place.
Maksim Panchenko [Mon, 21 Mar 2022 22:45:48 +0000 (15:45 -0700)]
[Disassember][NFCI] Use strong type for instruction decoder
All LLVM backends use MCDisassembler as a base class for their
instruction decoders. Use "const MCDisassembler *" for the decoder
instead of "const void *". Remove unnecessary static casts.
Reviewed By: skan
Differential Revision: https://reviews.llvm.org/D122245
Peter Klausler [Thu, 24 Mar 2022 19:59:04 +0000 (12:59 -0700)]
[flang] Catch bad OPEN(STATUS=) cases
STATUS='NEW' and 'REPLACE' require FILE= to be present.
STATUS='SCRATCH' may not appear with FILE=.
These errors are caught at compilation time when constant character
strings are used in an OPEN statement, but the runtime needs
to enforce them as well to catch errors in OPEN statements
with character variables and expressions.
Differential Revision: https://reviews.llvm.org/D122509
Uday Bondhugula [Wed, 23 Mar 2022 06:46:27 +0000 (12:16 +0530)]
Update affine.load folding hook to fold global splat constant loads
Enhance affine.load folding hook to fold loads on global splat constant
memrefs.
Differential Revision: https://reviews.llvm.org/D122292
Fred Riss [Mon, 1 Feb 2021 19:44:27 +0000 (11:44 -0800)]
Adopt new dyld SPIs to introspect the shared cache.
With the shared cache getting split into multiple files, the current
way we created ObjectFileMachO objects for shared cache dylib images
will break.
This patch conditionally adopts new SPIs which will do the right
thing in the new world of multi-file caches.
Gulfem Savrun Yeniceri [Sat, 26 Mar 2022 00:22:38 +0000 (00:22 +0000)]
[InstrProfiling] Add comments for no runtime hook
This patch adds comments about
c7f91e227a79, and
follows LLVM style guideline about nested if statements.
David Blaikie [Wed, 9 Mar 2022 21:13:31 +0000 (21:13 +0000)]
Disable -Wmissing-prototypes for internal linkage functions that aren't explicitly marked "static"
Some functions can end up non-externally visible despite not being
declared "static" or in an unnamed namespace in C++ - such as by having
parameters that are of non-external types.
Such functions aren't mistakenly intended to be defining some function
that needs a declaration. They could be maybe more legible (except for
the operator new example) with an explicit static, but that's a
stylistic thing outside what should be addressed by a warning.
This reapplies
275c56226d7fbd6a4d554807374f78d323aa0c1c - once we figure
out what to do about the change in behavior for -Wnon-c-typedef-for-linkage
(this reverts the revert commit
85ee1d3ca1d06b6bd3477515b8d0c72c8df7c069)
Differential Revision: https://reviews.llvm.org/D121328
David Blaikie [Fri, 25 Mar 2022 22:42:41 +0000 (22:42 +0000)]
DebugInfo: Don't allow type units to references types in the CU
We could only do this in limited ways (since we emit the TUs first, we
can't use ref_addr (& we can't use that in Split DWARF either) - so we
had to synthesize declarations into the TUs) and they were ambiguous in
some cases (if the CU type had internal linkage, parsing the TU would
require knowing which CU was referencing the TU to know which type the
declaration was for, which seems not-ideal). So to avoid all that, let's
just not reference types defined in the CU from TUs - instead moving the
TU type into the CU (recursively).
This does increase debug info size (by pulling more things out of type
units, into the compile unit) - about 2% of uncompressed dwp file size
for clang -O0 -g -gsplit-dwarf. (5% .debug_info.dwo section size
increase in the .dwp)
Haojian Wu [Fri, 25 Mar 2022 23:04:41 +0000 (00:04 +0100)]
[pseudo] Fix the wrong rule ids in ForestTest.
Haojian Wu [Fri, 25 Mar 2022 22:51:19 +0000 (23:51 +0100)]
[pseudo] Add missing header guard for Forest.h
Peter Klausler [Mon, 21 Mar 2022 23:01:06 +0000 (16:01 -0700)]
[flang] Mark C_ASSOCIATED specific procedures as PURE
The interfaces to C_ASSOCIATED()'s specific procedures must be
PURE so that they are accepted for use in specification expressions.
Differential Revision: https://reviews.llvm.org/D122438
Med Ismail Bennani [Fri, 25 Mar 2022 21:25:23 +0000 (14:25 -0700)]
[lldb/Plugin] Sort the ScriptedProcess' thread list before creating threads
With Scripted Processes, in order to create scripted threads, the blueprint
provides a dictionary that have each thread index as the key with the respective
thread instance as the pair value.
In Python, this is fine because a dictionary key can be of any type including
integer types:
```
>>> {1: "one", 2: "two", 10: "ten"}
{1: 'one', 2: 'two', 10: 'ten'}
```
However, when the python dictionary gets bridged to C++ we convert it to a
`StructuredData::Dictionary` that uses a `std::map<ConstString, ObjectSP>`
for storage.
Because `std::map` is an ordered container and ours uses the `ConstString`
type for keys, the thread indices gets converted to strings which makes the
dictionary sorted alphabetically, instead of numerically.
If the ScriptedProcess has 10 threads or more, it causes thread “10”
(and higher) to be after thread “1”, but before thread “2”.
In order to solve this, this sorts the thread info dictionary keys
numerically, before iterating over them to create ScriptedThreads.
rdar://
90327854
Differential Revision: https://reviews.llvm.org/D122429
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Thu, 24 Mar 2022 19:21:21 +0000 (12:21 -0700)]
[lldb/Utility] Make StructuredData::Dictionary::GetKeys return an Array
This patch changes `StructuredData::Dictionary::GetKeys` return type
from an `StructuredData::ObjectSP` to a `StructuredData::ArraySP`.
The function already stored the keys in an array but implicitely upcasted
it to an `ObjectSP`, which required the user to convert it again to a
Array object to access each element.
Since we know the keys should be held by an iterable container, it makes
more sense to return the allocated ArraySP as-is.
Differential Revision: https://reviews.llvm.org/D122426
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Fri, 25 Mar 2022 00:19:33 +0000 (17:19 -0700)]
[lldb/crashlog] Parse thread fields and pass it to crashlog scripted process
Previously, the ScriptedThread used the thread index as the thread id.
This patch parses the crashlog json to extract the actual thread "id" value,
and passes this information to the Crashlog ScriptedProcess blueprint,
to create a higher fidelity ScriptedThreaad.
It also updates the blueprint to show the thread name and thread queue.
Finally, this patch updates the interactive crashlog test to reflect
these changes.
rdar://
90327854
Differential Revision: https://reviews.llvm.org/D122422
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Fangrui Song [Fri, 25 Mar 2022 21:56:18 +0000 (14:56 -0700)]
[Driver][Linux] Remove D.Dir+"/../lib" from default search paths for LLVM_ENABLE_RUNTIMES builds
The rule was added in 2014 to support -stdlib=libc++ and -lc++ without
specifying -L, when D.Dir is not a well-known system library directory like
/usr/lib /usr/lib64. This rule turns out to get in the way with (-m32 for
64-bit clang) or (-m64 for 32-bit clang) for Gentoo :
https://github.com/llvm/llvm-project/issues/54515
Nowadays LLVM_ENABLE_RUNTIMES is the only recommended way building libc++ and
LLVM_ENABLE_PROJECTS=libc++ is deprecated. LLVM_ENABLE_RUNTIMES builds libc++
in D.Dir+"/../lib/${triple}/". The rule is unneeded. Also reverts D108286.
Gentoo uses a modified LLVM_ENABLE_RUNTIMES that installs libc++.so in
well-known paths like /usr/lib64 and /usr/lib which are already covered by
nearby search paths.
Implication: if a downstream package needs something like -lLLVM-15git and uses
libLLVM-15git.so not in a well-known path, it needs to supply -L
D.Dir+"/../lib" explicitly (e.g. via LLVMConfig.cmake), instead of relying on
the previous default search path.
Reviewed By: mgorny
Differential Revision: https://reviews.llvm.org/D122444
Johannes Doerfert [Fri, 25 Mar 2022 21:06:46 +0000 (16:06 -0500)]
Revert "[OpenMP][NFC] Add missing virtual destructor to silence warning"
This reverts commit
b9fd8f34ae547674ac0b5f5fbc5bb66d2bc0fedb as it
accidentally contained a unit test change that is not finished (and
unrelated).
Florian Hahn [Fri, 25 Mar 2022 21:05:58 +0000 (21:05 +0000)]
[Clang] Use pattern to match profile metadata in test.
Make the test more robust to slightly different metadata numbering by
using a pattern instead of hard coding the ids.
Johannes Doerfert [Fri, 25 Mar 2022 21:00:06 +0000 (16:00 -0500)]
[OpenMP][FIX] Repair ExclusiveAccess move semantic snafu
Johannes Doerfert [Fri, 25 Mar 2022 19:53:38 +0000 (14:53 -0500)]
[OpenMP][NFC] Add missing virtual destructor to silence warning
William S. Moses [Fri, 25 Mar 2022 19:39:43 +0000 (15:39 -0400)]
[Clang] Add helper method to determine if a nonvirtual base has an entry in the LLVM struct
This patch adds a helper method to determine if a nonvirtual base has an entry in the LLVM struct. Such a base may not have an entry
if the base does not have any fields/bases itself that would change the size of the struct. This utility method is useful for other frontends (Polygeist) that use Clang as an API to generate code.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D122502
Paul Robinson [Fri, 25 Mar 2022 20:13:00 +0000 (13:13 -0700)]
Remove dead code in driver parsing -gsimple-template-names= options
While -g[no-]simple-template-names is a driver option, the fancier
-gsimple-template-names={simple,mangled} option is cc1-only, so code
to handle it in the driver is dead.
Differential Revision: https://reviews.llvm.org/D122503
Peter Klausler [Wed, 23 Mar 2022 21:05:50 +0000 (14:05 -0700)]
[flang] Add & use a better visit()
Adds flang/include/flang/Common/visit.h, which defines
a Fortran::common::visit() template function that is a drop-in
replacement for std::visit(). Modifies most use sites in
the front-end and runtime to use common::visit().
The C++ standard mandates that std::visit() have O(1) execution
time, which forces implementations to build dispatch tables.
This new common::visit() is O(log2 N) in the number of alternatives
in a variant<>, but that N tends to be small and so this change
produces a fairly significant improvement in compiler build
memory requirements, a 5-10% improvement in compiler build time,
and a small improvement in compiler execution time.
Building with -DFLANG_USE_STD_VISIT causes common::visit()
to be an alias for std::visit().
Calls to common::visit() with multiple variant arguments
are referred to std::visit(), pending further work.
Differential Revision: https://reviews.llvm.org/D122441
Hongtao Yu [Thu, 24 Mar 2022 18:15:34 +0000 (11:15 -0700)]
[PseudoProbe] Do not emit pseudo probes when module is not probed.
There is a case when a function has pseudo probe intrinsics but the module it resides does not have the probe desc. This could happen when the current module is not built with `-fpseudo-probe-for-profiling` while a function in it calls some other function from a probed module. In thinLTO mode, the callee function could be imported and inlined into the current function.
While this is undefined behavior, I'm fixing the asm printer to not ICE and warn user about this.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D121737
Emilio Cota [Fri, 25 Mar 2022 19:40:48 +0000 (15:40 -0400)]
[bazel] add missing targets since
3be7c28917
Adrian Prantl [Fri, 25 Mar 2022 19:36:32 +0000 (12:36 -0700)]
Add missing include diagnosed in modules build. (NFC)
Martin Storsjö [Fri, 25 Mar 2022 19:22:34 +0000 (21:22 +0200)]
[clang-tidy] Fix the condition for building CTTestTidyModule
This is the correct intended condition; the problematic case where
we don't want to try to build the plugin is "WIN32 AND LLVM_LINK_LLVM_DYLIB"
and thus the negation is "NOT WIN32 OR NOT LLVM_LINK_LLVM_DYLIB".
Differential Revision: https://reviews.llvm.org/D121687
Sam McCall [Wed, 16 Mar 2022 02:13:44 +0000 (03:13 +0100)]
[cmake] Provide CURRENT_TOOLS_DIR centrally, replacing CLANG_TOOLS_DIR
CLANG_TOOLS_DIR holds the the current bin/ directory, maybe with a %(build_mode)
placeholder. It is used to add the just-built binaries to $PATH for lit tests.
In most cases it equals LLVM_TOOLS_DIR, which is used for the same purpose.
But for a standalone build of clang, CLANG_TOOLS_DIR points at the build tree
and LLVM_TOOLS_DIR points at the provided LLVM binaries.
Currently CLANG_TOOLS_DIR is set in clang/test/, clang-tools-extra/test/, and
other things always built with clang. This is a few cryptic lines of CMake in
each place. Meanwhile LLVM_TOOLS_DIR is provided by configure_site_lit_cfg().
This patch moves CLANG_TOOLS_DIR to configure_site_lit_cfg() and renames it:
- there's nothing clang-specific about the value
- it will also replace LLD_TOOLS_DIR, LLDB_TOOLS_DIR etc (not in this patch)
It also defines CURRENT_LIBS_DIR. While I removed the last usage of
CLANG_LIBS_DIR in
e4cab4e24d1, there are LLD_LIBS_DIR usages etc that
may be live, and I'd like to mechanically update them in a followup patch.
Differential Revision: https://reviews.llvm.org/D121763
Chia-hung Duan [Fri, 25 Mar 2022 18:09:53 +0000 (18:09 +0000)]
[mlir] Add InferTensorType without supporting reifyReturnTypeShapes
This is useful for the case that we don't need to implement
reifyReturnTypeShapes.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D121403
Philip Reames [Fri, 25 Mar 2022 18:34:31 +0000 (11:34 -0700)]
[SLP] Simplify eraseInstruction [NFC]
This simplifies the implementation of eraseInstruction by moving the odd-replace-users-with-undef handling back to the only caller which uses it. This handling was not obviously correct, so add the asserts which make it clear why this is safe to do at all. The result is simpler code and stronger assertions.
LLVM GN Syncbot [Fri, 25 Mar 2022 18:54:35 +0000 (18:54 +0000)]
[gn build] Port
cef52105bd4b
Douglas Yung [Fri, 25 Mar 2022 18:53:42 +0000 (11:53 -0700)]
Revert "[clang-tidy] Add modernize-macro-to-enum check"
This reverts commit
39b80c8380c86539de391600efaa17184b5a52b4.
This change was causing build failures on several build bots:
- https://lab.llvm.org/buildbot/#/builders/139/builds/19210
- https://lab.llvm.org/buildbot/#/builders/93/builds/7956
Corentin Jabot [Fri, 25 Mar 2022 18:34:16 +0000 (19:34 +0100)]
[Clang] Fix error in Documentation introduced by
3784e8cc [nfc].
The documentation contained extra space.
Also remove https://github.com/llvm/llvm-project/issues/54296
from the list of issues by
3784e8cc as this commit did not
fix it (nor was it supposed to).
Peter Klausler [Wed, 23 Mar 2022 23:02:59 +0000 (16:02 -0700)]
[flang] Fix bogus error from assignment to CLASS(*)
Assignment semantics was coughing up bad errors and crashes for
intrinsic assignments to unlimited polymorphic entities while
looking for any (impossible) user defined ASSIGNMENT(=) generic
or intrinsic type conversion.
Differential Revision: https://reviews.llvm.org/D122440
Corentin Jabot [Sat, 12 Mar 2022 19:49:01 +0000 (20:49 +0100)]
[Clang] Fix Unevaluated Lambdas
Unlike other types, when lambdas are instanciated,
they are recreated from scratch.
When an unevaluated lambdas appear in the type of a function,
parameter it is instanciated in the wrong declaration context,
as parameters are transformed before the function.
To support lambda in function parameters, we try to
compute whether they are dependant without looking at the
declaration context.
This is a short term stopgap solution to avoid clang
iceing. A better fix might be to inject some kind of
transparent declaration with correctly computed dependency
for function parameters, variable templates, etc.
Fixes https://github.com/llvm/llvm-project/issues/50376
Fixes https://github.com/llvm/llvm-project/issues/51414
Fixes https://github.com/llvm/llvm-project/issues/51416
Fixes https://github.com/llvm/llvm-project/issues/51641
Fixes https://github.com/llvm/llvm-project/issues/54296
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D121532
Florian Hahn [Fri, 25 Mar 2022 18:12:39 +0000 (18:12 +0000)]
[Clang,TBAA] Use pattern for metadata reference in test.
Update the single check line that still had a hard-coded metadata
reference. This makes it more robust to slight changes in the metadata
numbering.
Florian Hahn [Fri, 25 Mar 2022 18:08:24 +0000 (18:08 +0000)]
[ConstraintElimination] Use AddOverflow for offset summation.
Fixes an incorrect transformation due to values overflowing
https://alive2.llvm.org/ce/z/uizoea
Florian Hahn [Fri, 25 Mar 2022 18:08:17 +0000 (18:08 +0000)]
[ConstraintElimination] Add test where offset additions overflow.
Emil Kieri [Fri, 25 Mar 2022 15:33:25 +0000 (16:33 +0100)]
[clang][driver] Disable non-functional --version option for clang -cc1
This patch removes --version as a clang -cc1 option.
clang --version
and
clang --cc1 -version
remain valid. This behaviour is consistent with clang -cc1as.
Previously, clang -cc1 accepted both --version and -version, but
only -version was acted upon. The call
clang -cc1 --version
stalled without any message: --version was an accepted option but
triggered no action, and the driver waited for standard input.
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D122344
Nathan James [Fri, 25 Mar 2022 17:53:24 +0000 (17:53 +0000)]
Reland "[ASTMatchers] Output currently processing match and nodes on crash"
This reverts commit
cff34ccb605aa78030cd51cfe44362ed1c1fb80b.
This relands commit
d89f9e963e4979466193dc6a15fe091bf7ca5c47
Philip Reames [Fri, 18 Mar 2022 22:33:43 +0000 (15:33 -0700)]
Reapply "[SLP] Schedule only sub-graph of vectorizable instructions"" (try 3)
The original commit exposed several missing dependencies (e.g. latent bugs in SLP scheduling). Most of these were fixed over the weekend and have had several days to bake. The last was fixed this morning after being noticed in manual review of test changes yesterday. See the review thread for links to each change.
Original commit message follows:
SLP currently schedules all instructions within a scheduling window which stretches from the first instruction potentially vectorized to the last. This window can include a very large number of unrelated instructions which are not being considered for vectorization. This change switches the code to only schedule the sub-graph consisting of the instructions being vectorized and their transitive users.
This has the effect of greatly reducing the amount of work performed in large basic blocks, and thus greatly improves compile time on degenerate examples. To understand the effects, I added some statistics (not planned for upstream contribution). Here's an illustration from my motivating example:
Before this patch:
704357 SLP - Number of calcDeps actions
699021 SLP - Number of schedule calls
5598 SLP - Number of ReSchedule actions
59 SLP - Number of ReScheduleOnFail actions
10084 SLP - Number of schedule resets
8523 SLP - Number of vector instructions generated
After this patch:
102895 SLP - Number of calcDeps actions
161916 SLP - Number of schedule calls
5637 SLP - Number of ReSchedule actions
55 SLP - Number of ReScheduleOnFail actions
10083 SLP - Number of schedule resets
8403 SLP - Number of vector instructions generated
I do want to highlight that there is a small difference in number of generated vector instructions. This example is hitting the bailout due to maximum window size, and the change in scheduling is slightly perturbing when and how we hit it. This can be seen in the RescheduleOnFail counter change. Given that, I think we can safely ignore.
The downside of this change can be seen in the large test diff. We group all vectorizable instructions together at the bottom of the scheduling region. This means that vector instructions can move quite far from their original point in code. While maybe undesirable, I don't see this as being a major problem as this pass is not intended to be a general scheduling pass.
For context, it's worth noting that the pre-scheduling that SLP does while building the vector tree is exactly the sub-graph scheduling implemented by this patch.
Differential Revision: https://reviews.llvm.org/D118538
Christopher Bate [Fri, 25 Mar 2022 17:20:07 +0000 (17:20 +0000)]
[mlir][NVVM] Add support for nvvm mma.sync ops
This patch adds MLIR NVVM support for the various NVPTX `mma.sync`
operations. There are a number of possible data type, shape,
and other attribute combinations supported by the operation, so a
custom assebmly format is added and attributes are inferred where
possible.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D122410