Commit Graph

408006 Commits

Author SHA1 Message Date
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
Florian Hahn 1a54889f48
[LV] Ensure WidenCanonicalIVRecipe is always created in header (NFC).
The VPWidenCanonicalIVRecipe must always be created in the phi section
of the header block. Use that block as insert point.
2021-12-21 15:14:48 +00:00
Joe Loser 8dbc7745e5
[libcxx][test] Verify customization point object properties
Add test for various customization point object properties as defined by
the Standard. Test various CPOs from `<ranges>`, `<iterator>`,
`<concepts>`, etc.

The test is mostly from https://reviews.llvm.org/D107036 and split up
into this.

Differential Revision: https://reviews.llvm.org/D115588
2021-12-21 10:12:19 -05:00
Djordje Todorovic 93615b88f5 [Debugify] Use WeakWH map collected before Pass when checking loc drop
This fixes a typo/bug when checking for pointer reuse when testing
DI location preservation in the Debugify original mode (when
checking -g generated Debug Info).

Differential Revision: https://reviews.llvm.org/D115621
2021-12-21 15:54:09 +01:00
Nikita Popov a995cdab19 [CodeGen] Avoid more pointer element type accesses 2021-12-21 15:52:18 +01:00
Alexandre Ganea f44e3fbadd [CodeView] Emit S_OBJNAME record
Thanks to @zturner for the initial patch!

Differential Revision: https://reviews.llvm.org/D43002
2021-12-21 09:26:36 -05:00
mydeveloperday 142e79b868 [clang-format] NFC use recently added Style.isJavaScript()
Improve the readability of these if(Style==FormatStyle::LK_JavsScript) clauses
2021-12-21 14:24:12 +00:00
mydeveloperday 6e28b86cc6 AlignConsecutiveDeclarations not working for 'const' keyword in JavsScript
https://github.com/llvm/llvm-project/issues/49846

Fixes #49846

AlignConsecutiveDeclarations  is not working for "let" and "const" in JavaScript

let letVariable     = 5;
const constVariable = 10;

Reviewed By: owenpan, HazardyKnusperkeks, curdeius

Differential Revision: https://reviews.llvm.org/D115990
2021-12-21 13:57:43 +00:00
Nikita Popov 9a05a7b00c [CodeGen] Accept Address in CreateLaunderInvariantGroup
Add an overload that accepts and returns an Address, as we
generally just want to replace the pointer with a laundered one,
while retaining remaining information.
2021-12-21 14:43:20 +01:00
Arthur O'Dwyer 9233675466 [libc++] Rename __s1/__s2 to __dest/__source in __copy_constexpr. NFC.
This consistently completes the renaming started in D115986.
2021-12-21 08:36:44 -05:00
Butygin 28ab10f404 [mlir][memref] ReinterpretCast: allow static sizes/strides/offset where affine map expects dynamic
* There is no reason to forbid that case
* Also, user will get very unfriendly error like `expected result type with offset = -9223372036854775808 instead of 1`

Differential Revision: https://reviews.llvm.org/D114678
2021-12-21 16:20:01 +03:00
Sam McCall 6f1a501fdd [clangd] Fix typo in test. NFC 2021-12-21 14:17:25 +01:00
Simon Pilgrim dfa2ad1ad8 [X86] getTargetVShiftNode - remove shift-by-constant handling.
Move shift-by-constant handling and move it into its only user (VSHIFT intrinsics lowering).

This is some prep-work for getTargetVShiftNode to no longer take a scalar shift amount - we're introducing temporary ISD::EXTRACT_VECTOR_ELT nodes via SelectionDAG::getSplatValue to accommodate this which can cause various issues, including unnecessary scalarization and xmm->gpr->xmm transfers, and causes problems for 32-bit codegen if we fail to remove an (illegal) i64 scalar extracted from a (legal) vXi64 vector.
2021-12-21 13:16:48 +00:00
Nikita Popov e751d97863 [CodeGen] Avoid some pointer element type accesses
This avoids some pointer element type accesses when compiling
C++ code.
2021-12-21 14:16:28 +01:00
Nico Weber f2f6d09185 [gn build] (semiautomatically) port 9b4f179bf8 2021-12-21 08:10:52 -05:00