Ranjeet Singh [Mon, 28 Mar 2022 13:40:36 +0000 (14:40 +0100)]
[ARM] Make testcase warning pattern match more specific
Make the warning more specific as downstream compilers could produce other warnings.
Reviewed By: tstellar
Differential Revision: https://reviews.llvm.org/D122487
Jake Egan [Mon, 28 Mar 2022 13:43:21 +0000 (09:43 -0400)]
[NFC][tests][AIX] XFAIL test for lack of visibility support
With the addition of `__attribute__((visibility("hidden")))` to the test, the test fails because AIX's current default behaviour is to ignore hidden visibility, so the expected error is not seen. This patch marks the test `XFAIL` on AIX for now.
Reviewed By: cebowleratibm
Differential Revision: https://reviews.llvm.org/D122519
Erich Keane [Mon, 28 Mar 2022 13:28:13 +0000 (06:28 -0700)]
Update www_status/add test for P1972:
This seems to have been implemented/supported correctly back in Clang
10, so update the documentation and add the test from the paper.
Nathan Sidwell [Fri, 4 Feb 2022 19:45:23 +0000 (11:45 -0800)]
[demangler] Add operator precedence
The demangler had no concept of operator precendence, and would
parenthesize many more subexpressions than necessary. In particular
it would parenthesize primary-expressions, such as '4', which just
looks strange. It would also parenthesize '>' expressions, just in
case they were inside a template parameter list.
This patch fixes both issues.
* Add operator precedence to the OpInfo structure, and add a
subexpression helper that will parenthesize a lower precedence
subexpression.
* Add a 'greater-than is greater-than' indicator to the output buffer,
so the expression printer knows whether it is immediately inside a
template parameter list (and must therefore parenthesize 'expr >
expr'). This is a counter, so that ...
* Add open and close printers to the output buffer, that increment and
decrement the gt-is-gt indicator.
* Parenthesize comma operators inside comma-separated lists. (probably
a rare case, but still).
This dramatically reduces the extraneous parentheses being printed.
Reviewed By: dblaikie, bruno
Differential Revision: https://reviews.llvm.org/D120905
Pavel Labath [Tue, 15 Mar 2022 13:17:28 +0000 (14:17 +0100)]
Remove a top-level using-directive from EPCDebugObjectRegistrar.h
The directive pollutes the namespace of all files which include the
header.
Use alternate ways to reference the namespace constituents instead.
Pavel Labath [Mon, 21 Mar 2022 14:35:49 +0000 (15:35 +0100)]
[lldb] Remove some unused functions from PosixApi.h
There are better llvm replacements for all of these.
Simon Pilgrim [Mon, 28 Mar 2022 12:54:07 +0000 (13:54 +0100)]
[X86] Add shuffle tests from Issue #54562
Nikita Popov [Mon, 28 Mar 2022 12:26:24 +0000 (14:26 +0200)]
[GlobalOpt] Handle non-instruction MTI source (PR54572)
This was reusing a cast to GlobalVariable to check for an
Instruction, which means we'll try to dereference a null pointer
if it's not actually a GlobalVariable. We should be casting
MTI->getSource() instead.
I don't think this problem is really specific to opaque pointers,
but it certainly makes it a lot easier to reproduce.
Fixes https://github.com/llvm/llvm-project/issues/54572.
Valentin Clement [Mon, 28 Mar 2022 11:36:10 +0000 (13:36 +0200)]
[flang] Lower some coarray statements to their runtime functions
This patch adds the lowering of coarray statements to the runtime
functions. The runtime functions are currently not implemented.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D122466
Aaron Ballman [Mon, 28 Mar 2022 11:13:56 +0000 (07:13 -0400)]
Correct a minor point with the Phabricator docs
The repository field we want to leave blank is on the page as the
`Create Diff` button, so merged the instructions about leaving the
field blank and clicking the button.
Alexandros Lamprineas [Wed, 23 Mar 2022 14:51:16 +0000 (14:51 +0000)]
[FuncSpec] Support function specialization across multiple arguments.
The current implementation of Function Specialization does not allow
specializing more than one arguments per function call, which is a
limitation I am lifting with this patch.
My main challenge was to choose the most suitable ADT for storing the
specializations. We need an associative container for binding all the
actual arguments of a specialization to the function call. We also
need a consistent iteration order across executions. Lastly we want
to be able to sort the entries by Gain and reject the least profitable
ones.
MapVector fits the bill but not quite; erasing elements is expensive
and using stable_sort messes up the indices to the underlying vector.
I am therefore using the underlying vector directly after calculating
the Gain.
Differential Revision: https://reviews.llvm.org/D119880
Andrzej Warzynski [Mon, 28 Mar 2022 10:46:47 +0000 (10:46 +0000)]
Revert "[flang] Add & use a better visit()"
This reverts commit
2ab9990c9eb79682a4d4b183dfbc7612d3e55328. It has
caused multiple build failures:
* https://lab.llvm.org/buildbot/#/builders/177/builds/4346
* https://lab.llvm.org/buildbot/#/builders/180/builds/3803
* https://lab.llvm.org/buildbot/#/builders/175/builds/10419
* https://lab.llvm.org/buildbot/#/builders/191/builds/4318
* https://lab.llvm.org/buildbot/#/builders/173/builds/4274
* https://lab.llvm.org/buildbot/#/builders/181/builds/4297
All these bots failed with a time-out:
```
command timed out: 1200 seconds without output running [b'ninja', b'-j', b'32'], attempting to kill
```
I'm guessing that that's due to template instantiations failing at some
point (https://reviews.llvm.org/D122441 introduced a custom
implementation of std::visit). Everything seems fine when either:
* building on X86 with GCC or Clang (tested with GCC 9.3 and Clang 12)
* building on AArch64 with GCC (tested with GCC 11)
Mikhail Goncharov [Mon, 28 Mar 2022 09:23:14 +0000 (11:23 +0200)]
Return -no-canonical-prefixes for riskv32/64 test
W/o -no-canonical-prefixes CC1: clang{{.*}} "-cc1" "-triple" "riscv32"
does not match clang output for some setups.
See
da62a5c6610dd2087ce2f527ca84ba43e93d5e30.
Balázs Kéri [Mon, 28 Mar 2022 06:57:11 +0000 (08:57 +0200)]
[clang][ASTImporter] Fix a bug when importing CXXDefaultInitExpr.
The "in-class initializer" expression should be set in the field of a
default initialization expression before this expression node is created.
The `CXXDefaultInitExpr` objects are created after the AST is loaded and
at import not present in the "To" AST. And the in-class initializers of
the used fields can be missing too, these must be set at import.
This fixes a github issue #54061.
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D120824
Shraiysh Vaishay [Mon, 28 Mar 2022 08:06:32 +0000 (13:36 +0530)]
[mlir][OpenMP] Added ReductionClauseInterface
This patch adds the ReductionClauseInterface and also adds reduction
support for `omp.parallel` operation.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D122402
Carl Ritson [Mon, 28 Mar 2022 08:30:09 +0000 (17:30 +0900)]
[AMDGPU] Split waterfall loop exec manipulation
Split waterfall loops into multiple blocks so that exec mask
manipulation (s_and_saveexec) does not occur in the middle of
a block.
VGPR live range optimizer is updated to handle waterfall loops
spanning multiple blocks.
Reviewed By: ruiling
Differential Revision: https://reviews.llvm.org/D122200
LLVM GN Syncbot [Mon, 28 Mar 2022 08:27:36 +0000 (08:27 +0000)]
[gn build] Port
c0eb9b4cdef6
Fangrui Song [Mon, 28 Mar 2022 08:27:16 +0000 (01:27 -0700)]
[Object][test] Fix invalid.test
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