Commit graph

408020 commits

Author SHA1 Message Date
Chuanqi Xu 9effb6f816 [NFC] Use %clang_cc instead of %clang in c++20 module tests 2021-12-22 11:50:47 +08:00
Chuanqi Xu 759f3e297c [NFC] [C++20] [Modules] Add tests for template instantiation in transitively imported module
This commit adds two test about template class instantiation in
transitively imported module. They are used as pre-commit tests for
successive patches.

Differential Revision: https://reviews.llvm.org/D116097
2021-12-22 11:09:41 +08:00
LLVM GN Syncbot 19030717e3 [gn build] Port 7056250f51 2021-12-22 01:35:25 +00:00
Nikolas Klauser 7056250f51 [libc++][NFC] Granularize <filesystem>
Granularize the `<filesystem>` header

Reviewed By: Quuxplusone, ldionne, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D115578
2021-12-22 02:31:17 +01:00
Arthur O'Dwyer 1fe897dffd [libc++] [test] Simplify some ranges tests.
Eliminate a bogus operator== overload.
Also, check more intermediate steps in the logic we're checking here.
Some of this simplification is possible only now that we've implemented
more of <ranges>.

Differential Revision: https://reviews.llvm.org/D116002
2021-12-21 20:16:35 -05:00
Julian Lettner 63ddf0baf3 [TSan] Don't instrument code that is executed from __tsan_on_report()
See also: https://reviews.llvm.org/D111157
2021-12-21 17:02:51 -08:00
Owen Pan b9f6e09b85 [clang-format][NFC] Handle wrapping after => in mustBreakBefore()
Move the handling of brace wrapping after => from unwrapped line
parser to token annotator and clean up the parser.

Differential Revision: https://reviews.llvm.org/D115967
2021-12-21 16:42:52 -08:00
John Ericson 9531146899 [lldb] Use GNUInstallDirs to support custom installation dirs.
Extracted from D99484. My new plan is to start from the outside and work
inward.

Reviewed By: compnerd

Differential Revision: https://reviews.llvm.org/D115570
2021-12-22 00:28:53 +00:00
Alexandre Ganea a282ea4898 Reland - [CodeView] Emit S_OBJNAME record
Reland integrates build fixes & further review suggestions.

Thanks to @zturner for the initial S_OBJNAME patch!

Differential Revision: https://reviews.llvm.org/D43002
2021-12-21 19:02:14 -05:00
Alexandre Ganea 5bb5142e80 Revert [CodeView] Emit S_OBJNAME record
Also revert all subsequent fixes:
- abd1cbf5e5 [Clang] Disable debug-info-objname.cpp test on Unix until I sort out the issue.
- 00ec441253 [Clang] debug-info-objname.cpp test: explictly encode a x86 target when using %clang_cl to avoid falling back to a native CPU triple.
- cd407f6e52 [Clang] Fix build by restricting debug-info-objname.cpp test to x86.
2021-12-21 19:02:14 -05:00
Nico Weber 0e9393f522 [gn build] (manually) port f68e89044a 2021-12-21 18:59:37 -05:00
Martin Storsjö d67b25e7f6 [libcxx] [test] Extend test for bash for executor-has-no-bash
If %{exec} sets "--env PATH=single-dir", the directory containing
bash and related shell utils is omitted from the path, which means
that most shell scripts would fail.

(Setting PATH is needed for DLL builds on Windows; PATH fills the same
role as e.g. LD_LIBRARY_PATH on Linux.)

This condition is missed in the current test, because the executor
run.py first resolves the executable to run using the original path,
then invokes that executable with an environment with a restricted
path. Thus the executor is able to run bash, but that bash is then
unable to run further shell commands (other than bash builtins).

Extend the test from "bash --version" to "bash -c 'bash --version'".
This correctly identifies the executor-has-no-bash condition in the
current Windows CI configs, allowing removing 6 cases of
LIBCXX-WINDOWS-FIXME.

Another longterm fix would be to extend run.py with an option like
"--env-prepend PATH=dir", to allow keeping the current path while
adding a directory to it.

Differential Revision: https://reviews.llvm.org/D116117
2021-12-22 00:43:29 +02:00
Martin Storsjö f68e89044a [libcxx] Add LIBCXX_EXTRA_SITE_DEFINES for adding extra defines in __config_site
This is similar to the existing setting LIBCXX_ABI_DEFINES, with
the difference that this also allows setting other defines than
ones that start with "_LIBCPP_ABI_", and allows setting defines
to a specific value.

This allows avoiding using LIBCXX_TEST_COMPILER_FLAGS in two
CI configurations.

Differential Revision: https://reviews.llvm.org/D116109
2021-12-22 00:43:29 +02:00
Martin Storsjö c1a14a5c3e [libcxx] Use LIBCXX_EXECUTOR in new test configs
This allows cross-testing (by setting LIBCXX_EXECUTOR to point
to ssh.py) without making an entirely new test config file.

Implicitly, this also fixes quoting of the python executable name
(which is quoted in test/CMakeLists.txt).

Differential Revision: https://reviews.llvm.org/D115398
2021-12-22 00:43:28 +02:00
Alexandre Ganea d26520f6f7 [Clang] Own the CommandLineArgs in CodeGenOptions
Fixes PR52704 : https://github.com/llvm/llvm-project/issues/52704

Differential Revision: https://reviews.llvm.org/D116011
2021-12-21 17:41:35 -05:00
Louis Dionne beff71520b [libc++] Partially revert 346ef5e587
This moves the macro definitions back to __config, but keeps the
improved documentation. 346ef5e587 had broken the MinGW build.
2021-12-21 23:58:17 +02:00
Kirill Stoimenov 2477e69c6d [ASan] Change optimized callbacks visibility to hidden.
Making callbacks hidden will remove PLT calls.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D116121
2021-12-21 21:32:30 +00:00
Nemanja Ivanovic de4e0195ae [PowerPC] Add missed test case updates
In commit 1674d9b6b2,
I missed adding the updates to existing test cases.
This should bring the bots back to green.
2021-12-21 14:55:19 -06:00
Louis Dionne 346ef5e587 [libc++][NFC] Improve documentation of the various random_device implementations
Also, move the setting of the macro closer to its point of use, which
also has the benefit of uncluttering `__config`.
2021-12-21 15:32:09 -05:00
Nemanja Ivanovic 1674d9b6b2 [PowerPC] Fix vector equality comparison for v2i64 pre-Power8
The current code makes the assumption that equality
comparison can be performed with a word comparison
instruction. While this is true if the entire 64-bit
results are used, it does not generally work. It is
possible that the low order words and high order
words produce different results and a user of only
one will get the wrong result.

This patch adds an and of the result words so that
each word has the result of the comparison of the
entire doubleword that contains it.

Differential revision: https://reviews.llvm.org/D115678
2021-12-21 14:28:41 -06:00
Nemanja Ivanovic a3ea9052d6 [PowerPC] Do not increase cost for getUserCost with MMA types
Commit 150681f increases
cost of producing MMA types (vector pair and quad).
However, it increases the cost for getUserCost() which is
used in unrolling. As a result, loops that contain these
types already (from the user code) cannot be unrolled
(even with the user's unroll pragma). This was an unintended
sideeffect. Reverting that portion of the commit to allow
unrolling such loops.

Differential revision: https://reviews.llvm.org/D115424
2021-12-21 13:36:08 -06:00
Tue Ly db8716a2ec [libc] Show average runtime for math single-input-single-output performance tests.
Run performance tests in denormal and normal ranges separately and show more detailed results.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D116112
2021-12-21 14:22:20 -05:00
LLVM GN Syncbot 3ce4b6a599 [gn build] Port f78d49e068 2021-12-21 18:57:55 +00:00
Dmitry Vyukov f78d49e068 tsan: remove old vector clocks
They are unused in the new tsan runtime.

Depends on D112604.

Reviewed By: vitalybuka, melver

Differential Revision: https://reviews.llvm.org/D112605
2021-12-21 19:54:27 +01:00
Dmitry Vyukov 22a251c3d0 tsan: remove hacky call
It's unused in the new tsan runtime.

Depends on D112603.

Reviewed By: vitalybuka, melver

Differential Revision: https://reviews.llvm.org/D112604
2021-12-21 19:53:49 +01:00
Dmitry Vyukov 9789e74a90 tsan: reduce shadow ranges
The new tsan runtime has 2x more compact shadow.
Adjust shadow ranges accordingly.

Depends on D112603.

Reviewed By: vitalybuka, melver

Differential Revision: https://reviews.llvm.org/D113751
2021-12-21 19:53:19 +01:00
Dmitry Vyukov 53fc462513 tsan: remove unused variable
Depends on D113983.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D113984
2021-12-21 19:52:34 +01:00
Dmitry Vyukov c82bd4c5ba tsan: use VReport instead of VPrintf in background thread
If there are multiple processes, it's hard to understand
what output comes from what process.
VReport prepends pid to the output. Use it.

Depends on D113982.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D113983
2021-12-21 19:51:48 +01:00
Dmitry Vyukov 05ca57a054 tsan: better maintain current time in the background thread
Update now after long operations so that we don't use
stale value in subsequent computations.

Depends on D113981.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D113982
2021-12-21 19:51:39 +01:00
Fangrui Song 48161b7490 [ELF] --gc-sections: Work around SHT_PROGBITS .init_array
Older Go cmd/link used SHT_PROGBITS for .init_array .
Work around the lack of https://golang.org/cl/373734 for a while.
It does not generate .fini_array or .preinit_array
2021-12-21 10:44:29 -08:00
Louis Dionne e03ce65190 [libc++][NFC] Reformatting in random_device.h and random.cpp 2021-12-21 13:32:56 -05:00
minglotus-6 9c49f8d705 [LTO][WPD] Ignore unreachable function by analyzing IR.
In regular LTO, analyze IR and discard unreachable functions when finding virtual call targets.

Differential Revision: https://reviews.llvm.org/D116056
2021-12-21 18:13:03 +00:00
Fangrui Song 6683099a0d [ELF] Optimize RelocationSection<ELFT>::writeTo
When linking a 1.2G output (nearly no debug info, 2846621 dynamic relocations) using `--threads=8`, I measured

```
9.131462 Total ExecuteLinker
1.449913 Total Write output file
1.445784 Total Write sections
0.657152 Write sections {"detail":".rela.dyn"}
```

This change decreases the .rela.dyn time to 0.25, leading to 4% speed up in the total time.

* The parallelSort is slow because of expensive r_sym/r_offset computation. Cache the values.
* The iteration is slow. Move r_sym/r_addend computation ahead of time and parallelize it.

With the change, the new encodeDynamicReloc is cheap (0.05s). So no need to parallelize it.

Reviewed By: ikudrin

Differential Revision: https://reviews.llvm.org/D115993
2021-12-21 09:43:44 -08:00
Martin Storsjö 008849d7a5 [libcxx] [test] Don't rerun supportsVerify for each individual test
We can't just memoize _supportsVerify in place in format.py, as it
previously was executed in each of the individual processes.

Instead use hasCompileFlag() and add a feature flag for it instead,
which can be used both by tests (that already have such a flag,
locally for one set of tests) and for the testing framework itself.

By using hasCompileFlag(), this also implicitly fixes two other issues:
Previously, _supportsVerify called subprocess.call() directly, which can
interpret command line quoting differently than lit.TestRunner.

(In particular, TestRunner handles arguments quoted by a single quote,
while launching Windows processes with subprocess.call() only supports
double quotes. This allows using shlex.quote(), which uses single quotes,
everywhere - as all commands now go through TestRunner. This should make
41d7909368 redundant.)

Secondly, the old _supportsVerify method didn't include %{flags) or
%{compile_flags}.

Differential Revision: https://reviews.llvm.org/D116010
2021-12-21 19:40:30 +02:00
Philip Reames b7b308c50a [funcattrs] Infer access attributes for vararg arguments
This change allows us to infer access attributes (readnone, readonly) on arguments passed to vararg functions. Since there isn't a formal argument corresponding to the parameter, they'll never be considered part of the speculative SCC, but they can still benefit from attributes on the call site or the callee function.

The main motivation here is just to simplify the code, and remove some special casing. Previously, an indirect vararg call could return more precise results than an direct vararg call which is just weird.

Differential Revision: https://reviews.llvm.org/D115964
2021-12-21 09:34:14 -08:00
Philip Reames 1fee7195c9 [funcattrs] Fix incorrect readnone/readonly inference on captured arguments
This fixes a bug where we would infer readnone/readonly for a function which passed a value to a function which could capture it. With the value captured in memory, the function could reload the value from memory after the call, and write to it. Inferring the argument as readnone or readonly is unsound.

@jdoerfert apparently noticed this about two years ago, and tests were checked in with 76467c4, but the issue appears to have never gotten fixed.

Since this seems like this issue should break everything, let me explain why the case is actually fairly narrow. The main inference loop over the argument SCCs only analyzes nocapture arguments. As such, we can only hit this when construction the partial SCCs. Due to that restriction, we can only hit this when we have either a) a function declaration with a manually annotated argument, or b) an immediately self recursive call.

It's also worth highlighting that we do have cases we can infer readonly/readnone on a capturing argument validly. The easiest example is a function which simply returns its argument without ever accessing it.

Differential Revision: https://reviews.llvm.org/D115961
2021-12-21 09:34:14 -08:00
minglotus-6 55c71c9eac Simplify WPD test case for hybrid LTO and thinTLO.
1) remove verbose information (function linkage types, alignment, TBAA) 2) remove unused element or replace irrelevant element with null (as placeholders) in virtual table, remove unused definitions of deleted elements accordingly.

Differential Revision: https://reviews.llvm.org/D116071
2021-12-21 17:23:42 +00:00
Alexandre Ganea cd407f6e52 [Clang] Fix build by restricting debug-info-objname.cpp test to x86.
See: https://lab.llvm.org/buildbot/#/builders/188/builds/7188
2021-12-21 12:22:25 -05:00
Alexandre Ganea 00ec441253 [Clang] debug-info-objname.cpp test: explictly encode a x86 target when using %clang_cl to avoid falling back to a native CPU triple. 2021-12-21 11:54:19 -05:00
Marek Kurdej 450ddddcb7 [clang-format] Remove unnecessary qualifications. NFC. 2021-12-21 17:53:42 +01:00
Krzysztof Parzyszek 7a641d2499 [Hexagon] Add ELF flags for Hexagon v69 2021-12-21 08:50:21 -08:00
Alexandros Lamprineas ada028c32f [AArch64] Add a tablegen pattern for UZP2.
Converts concat_vectors((trunc (lshr)), (trunc (lshr))) to UZP2
when the shift amount is half the width of the vector element.

Differential Revision: https://reviews.llvm.org/D116021
2021-12-21 16:21:46 +00:00
Kadir Cetinkaya 1a929525e8
[clangd] Return error for textdocument/outgoingCalls rather than success 2021-12-21 17:06:59 +01:00
Marek Kurdej 36ea9861e3 [clang-format] Remove unnecessary qualifications. NFC. 2021-12-21 17:02:26 +01:00
Matt Arsenault 01d97dfde1 AMDGPU/GlobalISel: Regenerate test checks 2021-12-21 10:57:46 -05:00
Marek Kurdej 07fe451305 [clang-format] Fix SplitEmptyRecord affecting SplitEmptyFunction.
Fixes https://github.com/llvm/llvm-project/issues/50051.

Given the style:
```
BraceWrapping
  AfterFunction: true
 SplitEmptyFunction: true
 SplitEmptyRecord: false
...
```

The code that should be like:
```
void f(int aaaaaaaaaaaaaaaaaaaaaaaaaaaa,
       int bbbbbbbbbbbbbbbbbbbbbbbb)
{
}
```

gets the braces merged together:
```
void f(int aaaaaaaaaaaaaaaaaaaaaaaaaaaa,
       int bbbbbbbbbbbbbbbbbbbbbbbb)
{}
```

Reviewed By: MyDeveloperDay

Differential Revision: https://reviews.llvm.org/D116049
2021-12-21 16:54:19 +01:00
Dmitry Vyukov d95baa98f3 tsan: fix failures after multi-threaded fork
Creating threads after a multi-threaded fork is semi-supported,
we don't give particular guarantees, but we try to not fail
on simple cases and we have die_after_fork=0 flag that enables
not dying on creation of threads after a multi-threaded fork.
This flag is used in the wild:
23c052e3e3/SConstruct (L3599)

fork_multithreaded.cpp test started hanging in debug mode
after the recent "tsan: fix deadlock during race reporting" commit,
which added proactive ThreadRegistryLock check in SlotLock.

But the test broke earlier after "tsan: remove quadratic behavior in pthread_join"
commit which made tracking of alive threads based on pthread_t stricter
(CHECK-fail on 2 threads with the same pthread_t, or joining a non-existent thread).
When we start a thread after a multi-threaded fork, the new pthread_t
can actually match one of existing values (for threads that don't exist anymore).
Thread creation started CHECK-failing on this, but the test simply
ignored this CHECK failure in the child thread and "passed".
But after "tsan: fix deadlock during race reporting" the test started hanging dead,
because CHECK failures recursively lock thread registry.

Fix this purging all alive threads from thread registry on fork.

Also the thread registry mutex somehow lost the internal deadlock detector id
and was excluded from deadlock detection. If it would have the id, the CHECK
wouldn't hang because of the nested CHECK failure due to the deadlock.
But then again the test would have silently ignore this error as well
and the bugs wouldn't have been noticed.
Add the deadlock detector id to the thread registry mutex.

Also extend the test to check more cases and detect more bugs.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D116091
2021-12-21 16:54:00 +01:00
Louis Dionne d5b3cb0711 [libc++][NFC] Fix links to https://llvm.org/PR20183 in the tests 2021-12-21 10:34:08 -05:00
Alexandre Ganea abd1cbf5e5 [Clang] Disable debug-info-objname.cpp test on Unix until I sort out the issue. 2021-12-21 10:32:43 -05:00
Nathan Sidwell d4de2a4d59 [clang][NFC] Refactor coroutine_traits lookup
To allow transition from the TS-specified
std::experimental::coroutine_traits to the C++20-specified
std::coroutine_traits, we lookup in both places and provide helpful
diagnostics. This refactors the code to avoid separate paths to
std::experimental lookups.

Reviewed By: ChuanqiXu

Differential Revision: https://reviews.llvm.org/D116029
2021-12-21 10:29:01 -05:00