Serge Pavlov [Wed, 22 Apr 2020 16:00:12 +0000 (23:00 +0700)]
[Support] Add file lock/unlock functions
This is recommit of
f51bc4fb60fb, reverted in
8577595e03fa, because
the function `flock` is not available on Solaris. In this variant
`flock` was replaced with `fcntl`, which is a POSIX function.
New functions `lockFile`, `tryLockFile` and `unlockFile` implement
simple file locking. They lock or unlock entire file. This must be
enough to support simulataneous writes to log files in parallel builds.
Differential Revision: https://reviews.llvm.org/D78896
Bruno Ricci [Mon, 27 Jul 2020 22:22:21 +0000 (23:22 +0100)]
[clang] Pass the NamedDecl* instead of the DeclarationName into many diagnostics.
Background:
-----------
There are two related argument types which can be sent into a diagnostic to
display the name of an entity: DeclarationName (ak_declarationname) or
NamedDecl* (ak_nameddecl) (there is also ak_identifierinfo for
IdentifierInfo*, but we are not concerned with it here).
A DeclarationName in a diagnostic will just be streamed to the output,
which will directly result in a call to DeclarationName::print.
A NamedDecl* in a diagnostic will also ultimately result in a call to
DeclarationName::print, but with two customisation points along the way:
The first customisation point is NamedDecl::getNameForDiagnostic which is
overloaded by FunctionDecl, ClassTemplateSpecializationDecl and
VarTemplateSpecializationDecl to print the template arguments, if any.
The second customisation point is NamedDecl::printName. By default it just
streams the stored DeclarationName into the output but it can be customised
to provide a user-friendly name for an entity. It is currently overloaded by
DecompositionDecl and MSGuidDecl.
What this patch does:
---------------------
For many diagnostics a DeclarationName is used instead of the NamedDecl*.
This bypasses the two customisation points mentioned above. This patches fix
this for diagnostics in Sema.cpp, SemaCast.cpp, SemaChecking.cpp, SemaDecl.cpp,
SemaDeclAttr.cpp, SemaDecl.cpp, SemaOverload.cpp and SemaStmt.cpp.
I have only modified diagnostics where I could construct a test-case which
demonstrates that the change is appropriate (either with this patch or the next
one).
Reviewed By: erichkeane, aaron.ballman
Differential Revision: https://reviews.llvm.org/D84656
Bruno Ricci [Mon, 27 Jul 2020 22:19:02 +0000 (23:19 +0100)]
[clang-format][NFC] Be more careful about the layout of FormatToken.
The underlying ABI forces FormatToken to have a lot of padding.
Currently (on x86-64 linux) `sizeof(FormatToken) == 288`. After this patch
`sizeof(FormatToken) == 232`.
No functional changes.
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D84306
Joachim Protze [Tue, 28 Jul 2020 09:08:24 +0000 (11:08 +0200)]
[OpenMP][Tests] Enable nvptx64 testing for most libomptarget tests
Also add $BUILD/lib to the LIBRARY_PATH to fix
https://bugs.llvm.org/show_bug.cgi?id=46836.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D84557
Simon Pilgrim [Tue, 28 Jul 2020 08:52:38 +0000 (09:52 +0100)]
[X86][SSE] Attempt to match OP(SHUFFLE(X,Y),SHUFFLE(X,Y)) -> SHUFFLE(HOP(X,Y))
An initial backend patch towards fixing the various poor HADD combines (PR34724, PR41813, PR45747 etc.).
This extends isHorizontalBinOp to check if we have per-element horizontal ops (odd+even element pairs), but not in the expected serial order - in which case we build a "post shuffle mask" that we can apply to the HOP result, assuming we have fast-hops/optsize etc.
The next step will be to extend the SHUFFLE(HOP(X,Y)) combines as suggested on PR41813 - accepting more post-shuffle masks even on slow-hop targets if we can fold it into another shuffle.
Differential Revision: https://reviews.llvm.org/D83789
serge-sans-paille [Tue, 28 Jul 2020 08:55:09 +0000 (10:55 +0200)]
[legacyPM] Do not compute preserved analysis if there's no local change
All analysis are preserved if there's no local change, and thanks to
3667d87a33d3c8d4072a41fd84bb880c59347dc0 this property is enforced for all
passes.
Skipping the dependency computation improves the performance when there's a lot
of small functions, where only a few change happen.
Thanks to Nikita Popov who provided this numbers (extract below)
https://llvm-compile-time-tracker.com/compare.php?from=
183342c0a9850e60dd7a004b651c83dfb3a7d25e&to=
f2f91e6a2743070471cc9471e4e8c646e50c653c&stat=instructions
O3: (number of instructions)
Benchmark Old New
kimwitu++ 60783M 59968M (-1.34%)
sqlite3 73200M 73083M (-0.16%)
consumer-typeset 52776M 52712M (-0.12%)
Bullet 133709M 132940M (-0.58%)
tramp3d-v4 123864M 123186M (-0.55%)
mafft 55534M 55477M (-0.10%)
ClamAV 76292M 76164M (-0.17%)
lencod 103190M 103061M (-0.13%)
SPASS 64068M 63713M (-0.55%)
7zip 197332M 196308M (-0.52%)
geomean 85750M 85389M (-0.42%)
Differential Revision: https://reviews.llvm.org/D80707
Georgii Rymar [Thu, 23 Jul 2020 10:32:05 +0000 (13:32 +0300)]
[llvm-readelf] - Do not treat SHT_ANDROID_RELR sections the same as SHT_RELR.
Currently, when dumping section headers, llvm-readelf
prints "RELR" for SHT_ANDROID_RELR/SHT_RELR sections.
The behavior was introduced in D47919 and revealed in D84330.
But "SHT_ANDROID_RELR" has a different value from "SHT_RELR".
Also, "SHT_ANDROID_REL/SHT_ANDROID_RELA" are printed as "ANDROID_REL/ANDROID_RELA",
what makes the handling of the "SHT_ANDROID_RELR" inconsistent.
This patch makes llvm-readelf to print "ANDROID_RELR" instead of "RELR".
Differential revision: https://reviews.llvm.org/D84393
Kristina Bessonova [Fri, 29 May 2020 11:14:51 +0000 (13:14 +0200)]
[clang][cmake] Force CMAKE_LINKER for multistage build in case of BOOTSTRAP_LLVM_ENABLE_LLD and MSVC
The issue with LLVM_ENABLE_LLD is that it just passes -fuse-ld=lld
to compiler/linker options which makes sense only for those platforms
where cmake invokes a compiler driver for linking. On Windows (MSVC) cmake
invokes the linker directly and requires CMAKE_LINKER to be specified
otherwise it defaults CMAKE_LINKER to be link.exe.
This patch allows BOOTSTRAP_LLVM_ENABLE_LLD to set CMAKE_LINKER in two cases:
* if building for host Windows,
* if crosscompiling for target Windows.
It also skips adding '-fuse-ld=lld' to make lld-link not warning
about 'unknown argument'.
This fixes build with `clang/cmake/caches/DistributionExample.cmake`
on Windows.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D80873
Chen Zheng [Tue, 28 Jul 2020 06:56:35 +0000 (02:56 -0400)]
[PowerPC] test case for adding dq form to isLegalAddressingMode, nfc
Roman Lebedev [Tue, 28 Jul 2020 07:16:52 +0000 (10:16 +0300)]
[GVN] Rewrite IsValueFullyAvailableInBlock(): no recursion, less false-negatives
While this doesn't appear to help with the perf issue being exposed by
D84108, the function as-is is very weird, convoluted, and what's worse,
recursive.
There was no need for `SpeculativelyAvaliableAndUsedForSpeculation`,
tri-state choice is enough. We don't even ever check for that state.
The basic idea here is that we need to perform a depth-first traversal
of the predecessors of the basic block in question, either finding a
preexisting state for the block in a map, or inserting a "placeholder"
`SpeculativelyAvaliable`,
If we encounter an `Unavaliable` block, then we need to give up search,
and back-propagate the `Unavaliable` state to the each successor of
said block, more specifically to the each `SpeculativelyAvaliable`
we've just created.
However, if we have traversed entirety of the predecessors and have not
encountered an `Unavaliable` block, then it must mean the value is fully
available. We could update each inserted `SpeculativelyAvaliable` into
a `Avaliable`, but we don't need to, as assertion excersizes,
because we can assume that if we see an `SpeculativelyAvaliable` entry,
it is actually `Avaliable`, because during the time we've produced it,
if we would have found that it has an `Unavaliable` predecessor,
we would have updated it's successors, including this block,
into `Unavaliable`
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D84181
Ehsan Toosi [Fri, 24 Jul 2020 13:43:59 +0000 (15:43 +0200)]
[mlir][NFC] Polish copy removal transform
Address a few remaining comments in copy removal transform.
Differential Revision: https://reviews.llvm.org/D84529
Artem Dergachev [Thu, 23 Jul 2020 18:37:45 +0000 (11:37 -0700)]
[clang-tidy] Suppress one unittest on macOS.
Possibly a linker bug but I'm in a hurry to fix a buildbot.
Differential Revision: https://reviews.llvm.org/D84453
Craig Topper [Tue, 28 Jul 2020 04:11:54 +0000 (21:11 -0700)]
[X86] Detect if EFLAGs is live across XBEGIN pseudo instruction. Add it as livein to the basic blocks created when expanding the pseudo
XBEGIN causes several based blocks to be inserted. If flags are live across it we need to make eflags live in the new basic blocks to avoid machine verifier errors.
Fixes PR46827
Reviewed By: ivanbaev
Differential Revision: https://reviews.llvm.org/D84479
Craig Topper [Tue, 28 Jul 2020 04:11:48 +0000 (21:11 -0700)]
[X86] Add support for {disp32} to control size of jmp and jcc instructions in the assembler
By default we pick a 1 byte displacement and let relaxation enlarge it if necessary. The GNU assembler supports a pseudo prefix to basically pre-relax the instruction the larger size.
I plan to add {disp8} and {disp32} support for memory operands in another patch which is why I've included the parsing code and enum for {disp8} pseudo prefix as well.
Reviewed By: echristo
Differential Revision: https://reviews.llvm.org/D84709
Craig Topper [Tue, 28 Jul 2020 04:11:42 +0000 (21:11 -0700)]
[X86] Properly encode a 32-bit address with an index register and no base register in 16-bit mode.
In 16-bit mode we can encode a 32-bit address using 0x67 prefix.
We were failing to do this when the index register was a 32-bit
register, the base register was not present, and the displacement
fit in 16-bits.
Fixes PR46866.
Wei Mi [Wed, 8 Jul 2020 22:19:44 +0000 (15:19 -0700)]
Supplement instr profile with sample profile.
PGO profile is usually more precise than sample profile. However, PGO profile
needs to be collected from loadtest and loadtest may not be representative
enough to the production workload. Sample profile collected from production
can be used as a supplement -- for functions cold in loadtest but warm/hot
in production, we can scale up the related function in PGO profile if the
function is warm or hot in sample profile.
The implementation contains changes in compiler side and llvm-profdata side.
Given an instr profile and a sample profile, for a function cold in PGO
profile but warm/hot in sample profile, llvm-profdata will either mark
all the counters in the profile to be -1 or scale up the max count in the
function to be above hot threshold, depending on the zero counter ratio in
the profile. The assumption is if there are too many counters being zero
in the function profile, the profile is more likely to cause harm than good,
then llvm-profdata will mark all the counters to be -1 indicating the
function is hot but the profile is unaccountable. In compiler side, if a
function profile with all -1 counters is seen, the function entry count will
be set to be above hot threshold but its internal profile will be dropped.
In the long run, it may be useful to let compiler support using PGO profile
and sample profile at the same time, but that requires more careful design
and more substantial changes to make two profiles work seamlessly. The patch
here serves as a simple intermediate solution.
Differential Revision: https://reviews.llvm.org/D81981
Richard Smith [Tue, 28 Jul 2020 00:28:06 +0000 (17:28 -0700)]
Don't form a 'context-independent expr' reference to a member during
name annotation.
Instead, defer forming the member access expression or DeclRefExpr until
we build the use of ClassifyName's result. Just build an
UnresolvedLookupExpr to track the LookupResult until we're ready to
consume it.
This also reverts commit
2f7269b6773de2750f9cd1417ef5f21cd6cf7a91 (other
than its testcase). That change was an attempted workaround for the same
problem.
Xing GUO [Tue, 28 Jul 2020 01:53:59 +0000 (09:53 +0800)]
[llvm-readelf] Fix emitting incorrect number of spaces in '--hex-dump'.
This patch helps teach llvm-readelf to emit a correct number spaces when
dumping in hex format.
Before this patch, when the hex data doesn't fill the 4th column, some
spaces are missing.
```
Hex dump of section '.sec':
0x00000000
00000000 00000000 00000000 00000000 ................
0x00000010
00000000 00000000 00000000 0000 ..............
```
After this patch:
```
Hex dump of section '.sec':
0x00000000
00000000 00000000 00000000 00000000 ................
0x00000010
00000000 00000000 00000000 0000 ..............
```
Reviewed By: grimar
Differential Revision: https://reviews.llvm.org/D84640
Matt Arsenault [Tue, 28 Jul 2020 00:29:53 +0000 (20:29 -0400)]
TableGen: Check if pattern outputs matches instruction defs
Attempt to fix address sanitizer bots when building ARM.
Alina Sbirlea [Fri, 24 Jul 2020 23:29:58 +0000 (16:29 -0700)]
[CFGDiff] Refactor Succ/Pred maps.
Summary:
Refactor Succ/Pred maps to have a single map lookup when constructing
children. The preivous desing made sense when used by GraphTraits.
This more closely matches the previous approach in DomTree.
Reviewers: dblaikie
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D84567
Alina Sbirlea [Mon, 27 Jul 2020 23:41:55 +0000 (16:41 -0700)]
[DomTree] Remove dead code.[NFC]
Fred Riss [Tue, 28 Jul 2020 00:05:27 +0000 (17:05 -0700)]
[lldb/ArchSpec] Always match simulator environment in IsEqualTo
Summary:
Initially, Apple simulator binarie triples didn't use a `-simulator`
environment and were just differentiated based on the architecture.
For example, `x86_64-apple-ios` would obviously be a simualtor as iOS
doesn't run on x86_64. With Catalyst, we made the disctinction
explicit and today, all simulator triples (even the legacy ones) are
constructed with an environment. This is especially important on Apple
Silicon were the architecture is not different from the one of the
simulated device.
This change makes the simulator part of the environment always part of
the criteria to detect whether 2 `ArchSpec`s are equal or compatible.
Reviewers: aprantl
Subscribers: inglorion, dexonsmith, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D84716
Petr Hosek [Mon, 27 Jul 2020 18:55:52 +0000 (11:55 -0700)]
[CMake] Move find_package(ZLIB) to LLVMConfig
This way, downstream projects don't have to invoke find_package(ZLIB)
reducing the amount of boilerplate.
Differential Revision: https://reviews.llvm.org/D84691
Joel E. Denny [Mon, 27 Jul 2020 23:22:05 +0000 (19:22 -0400)]
[OpenMP][Docs] Update `present` modifier status
Alina Sbirlea [Thu, 16 Jul 2020 22:46:54 +0000 (15:46 -0700)]
[GraphDiff] Use class method getChildren instead of GraphTraits.
Summary:
Use getChildren() method in GraphDiff instead of GraphTraits.
This simplifies the code and allows for refactorigns inside GraphDiff.
All usecase need not have a light-weight/copyable range.
Clean GraphTraits implementation.
Reviewers: dblaikie
Subscribers: hiraditya, llvm-commits, george.burgess.iv
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D84562
Matt Arsenault [Tue, 21 Jul 2020 23:29:37 +0000 (19:29 -0400)]
GlobalISel: Don't fail translate on intrinsics with metadata
Matt Arsenault [Sat, 25 Jul 2020 14:17:49 +0000 (10:17 -0400)]
AMDGPU/GlobalISel: Mark G_ATOMICRMW_{NAND|FSUB} as lower
These aren't implemented and we're still relying on the AtomicExpand
pass, but mark these as lower to eliminate a few of the few remaining
no rules defined cases.
Matt Arsenault [Wed, 22 Jul 2020 00:53:57 +0000 (20:53 -0400)]
AMDGPU: global_atomic_csub is not always dereferenceable
Jonas Devlieghere [Mon, 27 Jul 2020 22:36:16 +0000 (15:36 -0700)]
[llvm] Make ZLIB handling compatible with multi-configuration generators
The CMAKE_BUILD_TYPE is only meaningful to single-configuration
generators (such as make and Ninja). For multi-configuration generators
like Xcode and MSVC this variable won't be set, resulting in a CMake
error.
Matt Arsenault [Mon, 13 Jul 2020 12:59:38 +0000 (08:59 -0400)]
TableGen/GlobalISel: Allow output instructions with multiple defs
The DAG behavior allows matchching input patterns with a single result
to the first result of an output instruction that defines multiple
results. The remaining defs are implicitly dead.
This starts to fix using manual selection for AMDGPU add/sub (although
it's still needed, mostly because it's also still needed for
G_PTR_ADD).
Francesco Petrogalli [Mon, 6 Jul 2020 17:46:59 +0000 (17:46 +0000)]
[llvm][CodeGen] Addressing modes for SVE ldN.
Reviewers: c-rhodes, efriedma, sdesmalen
Subscribers: huihuiz, tschuett, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77251
peter klausler [Wed, 22 Jul 2020 23:56:37 +0000 (16:56 -0700)]
[flang] Allow omission of comma in FORMAT(1PE5.2) in runtime
A comma is not required between a scale factor and a following
data edit descriptor (C1302).
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D84369
Arthur Eubanks [Mon, 27 Jul 2020 21:58:42 +0000 (14:58 -0700)]
[DFSan] Remove unused DataFlowSanitizer vars
Reviewed By: morehouse
Differential Revision: https://reviews.llvm.org/D84704
Fred Riss [Mon, 27 Jul 2020 20:51:07 +0000 (13:51 -0700)]
[lldb] NFC: Use early exit in ArchSpec::IsEqualTo
Sridhar Gopinath [Fri, 24 Jul 2020 17:44:48 +0000 (10:44 -0700)]
Fix the move constructor of MMI to move MachineFunctions map
The move constructor of MachineModuleInfo currently does not copy the
MachineFunctions map. This commit fixes this issue.
Patch by Sridhar Gopinath. Thanks!
Differential Revision: https://reviews.llvm.org/D84274
Jinsong Ji [Mon, 27 Jul 2020 20:48:44 +0000 (20:48 +0000)]
Revert "[PowerPC] Remove QPX/A2Q BGQ/BGP CNK support"
This reverts commit
adffce71538e219aab4eeb024819baa7687262ff.
This is breaking test-suite, revert while investigation.
Guillaume Chatelet [Mon, 27 Jul 2020 20:49:01 +0000 (20:49 +0000)]
[NFC] Move BitcodeCommon.h from Bitstream to Bitcode
Sergej Jaskiewicz [Tue, 14 Jul 2020 08:37:27 +0000 (11:37 +0300)]
Reland "[compiler-rt] [test] Allow expanding lit substitutions recursively"
The commit
8372d505082aceb38417e0b561cd32f2e227597b has been reverted
(
eafeb8af34946306a7382fa3801cf6e39a1c7226) because it broke asan
tests on green dragon buildbots.
The underlying issue has been fixed in
4dd5c2bee366514cbc3fc4e6da46462bc11a0a3d.
Arthur Eubanks [Mon, 27 Jul 2020 20:42:13 +0000 (13:42 -0700)]
Rename t2-reduce-size -> thumb2-reduce-size
For readability and consistency with other thumb2 passes like
"thumb2-it".
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D84696
Roman Lebedev [Mon, 27 Jul 2020 20:35:51 +0000 (23:35 +0300)]
[OpenMPOpt] Most SCC's are uninteresting, don't waste time on them (up to 16x faster)
Summary:
This seems obvious in hindsight, but the result is surprising.
I've measured compile-time of `-openmpopt` pass standalone
on RawSpeed unity build, and while there is some OpenMP stuff,
most is not OpenMP. But nonetheless the pass does a lot of costly
preparations before ever trying to look for OpenMP stuff in SCC.
Numbers (n=25): 0.094624s -> 0.005976s, an -93.68% improvement, or ~16x
Reviewers: jdoerfert
Reviewed By: jdoerfert
Subscribers: yaxunl, hiraditya, guansong, llvm-commits, sstefan1
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D84689
Adrian Prantl [Sat, 25 Jul 2020 15:27:21 +0000 (08:27 -0700)]
Unify the return value of GetByteSize to an llvm::Optional<uint64_t> (NFC-ish)
This cleanup patch unifies all methods called GetByteSize() in the
ValueObject hierarchy to return an optional, like the methods in
CompilerType do. This means fewer magic 0 values, which could fix bugs
down the road in languages where types can have a size of zero, such
as Swift and C (but not C++).
Differential Revision: https://reviews.llvm.org/D84285
This re-lands the patch with bogus :m_byte_size(0) initalizations removed.
Louis Dionne [Fri, 24 Jul 2020 14:13:53 +0000 (10:13 -0400)]
[libunwind] Remove old keymgr related logic
keymgr used to be used on MacOSX <= 10.6, however we don't build libunwind
from scratch for such old systems anymore. Hence, this code isn't useful
anymore.
Differential Revision: https://reviews.llvm.org/D84677
Ye Luo [Mon, 27 Jul 2020 20:08:19 +0000 (16:08 -0400)]
[OpenMP] Add more pass-through functions in DeviceTy
Summary:
1. Add DeviceTy::data_alloc, DeviceTy::data_delete, DeviceTy::data_alloc, DeviceTy::synchronize pass-through functions. Avoid directly accessing Device.RTL
2. Fix the type of the first argument of synchronize_ty in rth.h, device id is int32_t which is consistent with other functions.
Reviewers: tianshilei1992, jdoerfert
Reviewed By: tianshilei1992
Subscribers: yaxunl, guansong, sstefan1, openmp-commits
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D84487
Fred Riss [Fri, 24 Jul 2020 16:24:41 +0000 (09:24 -0700)]
[lldb/AppleSimulator] Always provide a -simulator environment
Summary:
This commit is somewhat NFC-ish today as the environment of triples
is not considered when comparing s if one of them is
not set (I plan to change that).
We have made simulator triples unambiguous these days, but the
simulator platforms still advertise triples without the
environment. This wasn't an issue when the sims ran only on
a very different architecure than the real device, but this
has changed with Apple Silicon.
This patch simplifies the way GetSupportedArchitectureAtIndex
is implemented for the sim platforms and adds the environment.
It also trivially adds support for Apple Silicon to those
platforms.
Reviewers: aprantl
Subscribers: lldb-commits
Jon Roelofs [Mon, 27 Jul 2020 19:37:35 +0000 (13:37 -0600)]
[llvm][examples][SimplifyCFG] Fix pass's IR changed reporting
... under the EXPENSIVE_CHECKS build, this fails the assert in the LegacyPM
that verifies whether a pass really did leave the IR alone when it reports no
changes back from its return status.
Jonas Devlieghere [Mon, 27 Jul 2020 19:30:09 +0000 (12:30 -0700)]
[lldb] Remove CMAKE_VERSION checks now that the minimum version is 3.13.4
Jinsong Ji [Mon, 27 Jul 2020 18:01:40 +0000 (18:01 +0000)]
[PowerPC] Remove QPX/A2Q BGQ/BGP CNK support
Per RFC http://lists.llvm.org/pipermail/llvm-dev/2020-April/141295.html
no one is making use of QPX/A2Q/BGQ/BGP CNK anymore.
This patch remove the support of QPX/A2Q in llvm, BGQ/BGP in clang,
CNK support in openmp/polly.
Reviewed By: hfinkel
Differential Revision: https://reviews.llvm.org/D83915
MaheshRavishankar [Mon, 27 Jul 2020 19:13:08 +0000 (12:13 -0700)]
[mlir][AffineToStandard] Make LowerAffine pass Op-agnostic.
The LowerAffine psas was a FunctionPass only for legacy
reasons. Making this Op-agnostic allows it to be used from command
line when affine expressions are within operations other than
`std.func`.
Differential Revision: https://reviews.llvm.org/D84590
Xiangling Liao [Tue, 2 Jun 2020 15:51:58 +0000 (11:51 -0400)]
[AIX] Implement AIX special alignment rule about double/long double
Implement AIX default `power` alignment rule by adding `PreferredAlignment` and
`PreferredNVAlignment` in ASTRecordLayout class.
The patchh aims at returning correct value for `__alignof(x)` and `alignof(x)`
under `power` alignment rules.
Differential Revision: https://reviews.llvm.org/D79719
Shinji Okumura [Mon, 27 Jul 2020 18:50:43 +0000 (03:50 +0900)]
[Attributor][NFC] Add tests to noalias.ll
Summary: Add tests to `noalias.ll` to make changes in D84665 clear
Reviewers: jdoerfert, sstefan1, uenoku, homerdin, baziotis
Subscribers: uenoku, kuter, bbn, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D84688
Kirill Bobyrev [Mon, 27 Jul 2020 18:45:05 +0000 (20:45 +0200)]
[clangd] Add more logs and attach tracers to remote index server routines
Reviewers: kadircet
Reviewed By: kadircet
Subscribers: sammccall, ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D84499
Matt Morehouse [Mon, 27 Jul 2020 18:15:35 +0000 (18:15 +0000)]
Replace fuzzer::FuzzerDriver's INTERFACE marking with new LLVMRunFuzzerDriver.
This adds a new extern "C" function that serves the same purpose. This removes the need for external users to depend on internal headers in order to use this feature. It also standardizes the interface in a way that other fuzzing engines will be able to match.
Patch By: IanPudney
Reviewed By: kcc
Differential Revision: https://reviews.llvm.org/D84561
Dokyung Song [Thu, 16 Jul 2020 21:24:06 +0000 (21:24 +0000)]
Recommit "[libFuzzer] Disable implicit builtin knowledge about memcmp-like functions when -fsanitize=fuzzer-no-link is given."
Summary: This patch disables implicit builtin knowledge about memcmp-like functions when compiling the program for fuzzing, i.e., when -fsanitize=fuzzer(-no-link) is given. This allows libFuzzer to always intercept memcmp-like functions as it effectively disables optimizing calls to such functions into different forms. This is done by adding a set of flags (-fno-builtin-memcmp and others) in the clang driver. Individual -fno-builtin-* flags previously used in several libFuzzer tests are now removed, as it is now done automatically in the clang driver.
The patch was once reverted in
8ef9e2bf355d05bc81d8b0fe1e5333eec59a0a91, as this patch was dependent on a reverted commit
f78d9fceea736d431e9e3cbca291e3909e3aa46d. This reverted commit was recommitted in
831ae45e3dc609e43ba561af07670a8fe47461ef, so relanding this dependent patch too.
Reviewers: morehouse, hctim
Subscribers: cfe-commits, #sanitizers
Tags: #clang, #sanitizers
Differential Revision: https://reviews.llvm.org/D83987
aartbik [Mon, 27 Jul 2020 18:22:26 +0000 (11:22 -0700)]
[mlir] [VectorOps] [integration_test] Sparse matrix times vector (DOT version)
Integration test that illustrates the gather operation with a
real-world operation expressed in mostly the Vector dialect.
Uses jagged diagonal storage.
Reviewed By: bondhugula
Differential Revision: https://reviews.llvm.org/D84571
Arthur Eubanks [Mon, 27 Jul 2020 17:49:16 +0000 (10:49 -0700)]
Prefix some AArch64/ARM passes with "aarch64-"/"arm-"
For consistency with other target specific passes.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D84560
Mitch Phillips [Mon, 27 Jul 2020 17:51:53 +0000 (10:51 -0700)]
[GWP-ASan] Crash handler API returns sizeof(collected trace)
Summary:
Fix up a slight bug with the crash handler API, where we say that we
return the size of the collected trace (instead of the size of the trace
that's returned) when the return buffer is too small, and the result is
truncated.
Also, as a result, patch up a small uninitialized memory bug.
Reviewers: morehouse, eugenis
Reviewed By: eugenis
Subscribers: #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D84652
Kazu Hirata [Fri, 24 Jul 2020 06:13:44 +0000 (23:13 -0700)]
Use llvm::is_contained where appropriate (NFC)
Summary:
This patch replaces std::find with llvm::is_contained where
appropriate.
Reviewers: efriedma, nhaehnle
Reviewed By: nhaehnle
Subscribers: arsenm, jvesely, nhaehnle, hiraditya, rogfer01, kerbowa, llvm-commits, vkmr
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D84489
Nadav Rotem [Mon, 27 Jul 2020 17:06:36 +0000 (10:06 -0700)]
[StackProtector] Speed up RequiresStackProtector
Speed up the method RequiresStackProtector by checking the intrinsic
value of the call. The original code calls getName() that returns an
allocating std::string on each check. This change removes about 96072
std::string instances when compiling sqlite3.c; The function was
discovered with a Facebook-internal performance tool.
Differential Revision: https://reviews.llvm.org/D84620
Craig Topper [Mon, 27 Jul 2020 16:40:26 +0000 (09:40 -0700)]
[X86] Add back comment inadvertently lost in
1a1448e6568d9b11f198e510fa9c4cb6b1f4216a.
AlexisPerry [Mon, 27 Jul 2020 16:57:31 +0000 (09:57 -0700)]
[flang] Temp Driver - pass the flag to change the default integer kind through to F18_FC
fixes BUG 46307
Differential Revision: https://reviews.llvm.org/D84266
Francesco Petrogalli [Mon, 27 Jul 2020 16:24:18 +0000 (16:24 +0000)]
[NFC][AArch64] Replace some template methods/invocations...
...with the non-template version, as the template version might
increase the size of the compiler build.
Methods affected:
1.`findAddrModeSVELoadStore`
2. `SelectPredicatedStore`
Also, remove the `const` qualifier from the `unsigned` parameters of
the methods to conform with other similar methods in the class.
MaheshRavishankar [Mon, 27 Jul 2020 16:48:36 +0000 (09:48 -0700)]
[mlir][Linalg] Enable fusion of std.constant (producer) with
linalg.indexed_generic (consumer) with tensor arguments.
The implementation of fusing std.constant producer with a
linalg.indexed_generic consumer was already in place. It is exposed
with this change. Also cleaning up some of the patterns that implement
the fusion to not be templated, thereby avoiding lot of conditional
checks for calling the right instantiation.
Differential Revision: https://reviews.llvm.org/D84566
Simon Pilgrim [Mon, 27 Jul 2020 16:32:53 +0000 (17:32 +0100)]
[X86][SSE] Relax 128-bit restriction on extract_subvector(ext_vector_inreg(X),0) -> ext_vector_inreg(extract_subvector(X,0)) fold
We only need to ensure that the source is larger than the subvector result type
LLVM GN Syncbot [Mon, 27 Jul 2020 16:45:49 +0000 (16:45 +0000)]
[gn build] Port
ee7caa75939
Nico Weber [Mon, 27 Jul 2020 16:44:47 +0000 (12:44 -0400)]
[gn build] Make syncing to single-line source files work after
1afd889d0b43
Vy Nguyen [Mon, 27 Jul 2020 16:38:05 +0000 (12:38 -0400)]
Reland [llvm-exegesis] Add benchmark latency option on X86 that uses LBR for more precise measurements.
Starting with Skylake, the LBR contains the precise number of cycles between the two
consecutive branches.
Making use of this will hopefully make the measurements more precise than the
existing methods of using RDTSC.
Differential Revision: https://reviews.llvm.org/D77422
New change: check for existence of field `cycles` in perf_branch_entry before enabling this mode.
This should prevent compilation errors when building for older kernel whose headers don't support it.
Nico Weber [Mon, 27 Jul 2020 16:30:09 +0000 (12:30 -0400)]
[gn build] (manually) merge
48c948abeb7
Jon Roelofs [Wed, 22 Jul 2020 22:13:20 +0000 (16:13 -0600)]
[TableGen][CGS] Print better errors on overlapping InstRW
Differential Revision: https://reviews.llvm.org/D83588
Logan Smith [Mon, 27 Jul 2020 15:37:01 +0000 (08:37 -0700)]
Use INTERFACE_COMPILE_OPTIONS to disable -Wsuggest-override for any target that links to gtest
This cleans up several CMakeLists.txt's where -Wno-suggest-override was manually specified. These test targets now inherit this flag from the gtest target.
Some unittests CMakeLists.txt's, in particular Flang and LLDB, are not touched by this patch. Flang manually adds the gtest sources itself in some configurations, rather than linking to LLVM's gtest target, so this fix would be insufficient to cover those cases. Similarly, LLDB has subdirectories that manually add the gtest headers to their include path without linking to the gtest target, so those subdirectories still need -Wno-suggest-override to be manually specified to compile without warnings.
Differential Revision: https://reviews.llvm.org/D84554
Vy Nguyen [Fri, 17 Jul 2020 23:08:48 +0000 (19:08 -0400)]
[llvm-exegesis] Check perf_branch_entry for field cycles
Summary: Follow up to breakages reported in D77422
Reviewers: ondrasej, gchatelet
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D84076
jasonliu [Mon, 27 Jul 2020 14:04:59 +0000 (14:04 +0000)]
[XCOFF][AIX] Handle llvm.used and llvm.compiler.used global array
For now, just return and do nothing when we see llvm.used and
llvm.compiler.used global array.
Hopefully, we could come up with a good solution later to prevent
linker from eliminating symbols in llvm.used array.
Reviewed By: DiggerLin, daltenty
Differential Revision: https://reviews.llvm.org/D84363
Jon Roelofs [Tue, 14 Jul 2020 21:45:05 +0000 (15:45 -0600)]
[AArch64] fjcvtzs,rmif,cfinv,setf* all clobber nzcv
Differential Revision: https://reviews.llvm.org/D83818
Sergej Jaskiewicz [Wed, 15 Jul 2020 15:55:37 +0000 (18:55 +0300)]
[lit] Don't expand escapes until all substitutions have been applied
Otherwise, if a Lit script contains escaped substitutions (like %%p in this test https://github.com/llvm/llvm-project/blob/master/compiler-rt/test/asan/TestCases/Darwin/asan-symbolize-partial-report-with-module-map.cpp#L10), they are unescaped during recursive application of substitutions, and the results are unexpected.
We solve it using the fact that double percent signs are first replaced with #_MARKER_#, and only after all the other substitutions have been applied, #_MARKER_# is replaced with a single percent sign. The only change is that instead of replacing #_MARKER_# at each recursion step, we replace it once after the last recursion step.
Differential Revision: https://reviews.llvm.org/D83894
Amy Kwan [Mon, 27 Jul 2020 14:36:38 +0000 (09:36 -0500)]
Revert "Re-apply:" Emit DW_OP_implicit_value for Floating point constants""
This patch reverts commit `
59a76d957a26` as it has caused failure on the
big endian PowerPC buildbots (as well as the SystemZ buildbots).
Martin Storsjö [Sat, 25 Jul 2020 09:25:19 +0000 (12:25 +0300)]
[LLD] [COFF] Fix mingw comdat associativity for leader symbols with a different name
For a weak symbol func in a comdat, the actual leader symbol ends up
named like .weak.func.default*. Likewise, for stdcall on i386, the symbol
may be named _func@4, while the section suffix only is "func", which the
previous implementation didn't handle.
This fixes unwinding through weak functions when using
-ffunction-sections in mingw environments.
Differential Revision: https://reviews.llvm.org/D84607
Luofan Chen [Mon, 27 Jul 2020 14:28:39 +0000 (22:28 +0800)]
[Attributor] Fix qualifier warning of the unittest
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D84532
Anastasia Stulova [Mon, 27 Jul 2020 12:27:21 +0000 (13:27 +0100)]
[OpenCL] Fixed missing address space for templated copy constructor.
Added missing address space for the parameter of copy ctor created
for templated constructor with an R-value reference.
Patch by Ole Strohm (olestrohm)!
Tags: #clang
Differential Revision: https://reviews.llvm.org/D83665
Guillaume Chatelet [Mon, 27 Jul 2020 13:54:46 +0000 (13:54 +0000)]
[NFC] Replace ".size() < 1" with ".empty()"
Simon Pilgrim [Mon, 27 Jul 2020 13:32:32 +0000 (14:32 +0100)]
[X86][AVX] Fold extract_subvector(truncate(x),0) -> truncate(extract_subvector(x),0)
This is currently only supported for VLX targets where the op should be legal.
Simon Pilgrim [Mon, 27 Jul 2020 12:14:13 +0000 (13:14 +0100)]
[X86] combineExtractSubvector - pull out repeated getSizeInBits() calls. NFCI.
Simon Pilgrim [Sat, 25 Jul 2020 14:52:05 +0000 (15:52 +0100)]
IRPrintingPasses.h - simplify unnecessary header with forward declarations. NFC.
Remove duplicate PassManager.h include in IRPrintingPasses.cpp
Christian Sigg [Sat, 25 Jul 2020 12:56:35 +0000 (14:56 +0200)]
[MLIR] NFC: Rename mcuMemHostRegister* to mgpuMemHostRegister* to make it consistent with the other cuda-runner functions and ROCm.
Summary: Rename mcuMemHostRegister* to mgpuMemHostRegister*.
Reviewers: herhut
Reviewed By: herhut
Subscribers: yaxunl, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, Kayjukh, jurahul, msifontes
Tags: #mlir
Differential Revision: https://reviews.llvm.org/D84583
Sergey Dmitriev [Mon, 27 Jul 2020 13:02:06 +0000 (06:02 -0700)]
[CallGraph] Preserve call records vector when replacing call edge
Summary:
Try not to resize vector of call records in a call graph node when
replacing call edge. That would prevent invalidation of iterators
stored in the CG SCC pass manager's scc_iterator.
Reviewers: jdoerfert
Reviewed By: jdoerfert
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D84295
Mitch Phillips [Mon, 27 Jul 2020 12:46:43 +0000 (05:46 -0700)]
[GWP-ASan] Fix uninitialized memory use in sigaction.
Fix up a small bug where we used a partially-uninitialized sigaction
struct in the optional signal handler. Shouldn't be a user-visible
change.
Tim Northover [Mon, 27 Jul 2020 12:29:49 +0000 (13:29 +0100)]
AArch64: avoid UB shift of negative value
Left shifting a negative value is undefined behaviour, so this just moves the
negation afterwards to avoid it.
Hans Wennborg [Mon, 27 Jul 2020 12:41:29 +0000 (14:41 +0200)]
llvm_canonicalize_cmake_booleans(CLANGD_ENABLE_REMOTE)
Otherwise it got defined as e.g. OFF in Features.inc.
Roman Lebedev [Mon, 27 Jul 2020 12:07:51 +0000 (15:07 +0300)]
[JumpThreading] ProcessBranchOnXOR(): bailout if any pred ends in indirect branch (PR46857)
SplitBlockPredecessors() can not split blocks that have such terminators,
and in two other places we already ensure that we don't end up calling
SplitBlockPredecessors() on such blocks. Do so in one more place.
Fixes https://bugs.llvm.org/show_bug.cgi?id=46857
Roman Lebedev [Mon, 27 Jul 2020 12:36:07 +0000 (15:36 +0300)]
[Reduce] Argument reduction: shoe-horn new function into remaining uses of old function
Much like with function reduction, there may be remaining unhandled uses
of function, in particular in blockaddress. And in constants we can't
RAUW it with undef, because undef is not a function.
Instead, let's try to pretent that in the remaining cases, the new
signature didn't change, by bitcasting it.
A new (previously crashing) test case added.
Roman Lebedev [Mon, 27 Jul 2020 10:30:39 +0000 (13:30 +0300)]
[Reduce] Function reduction: replace all users of function with undef
There may be other users of a function other than CallInsts,
but what's more important, we can't actually replace function pointer
with undef, because for constants, that would not preserve the type
and RAUW would assert.
In particular, that affects blockaddress, however it proves to be
prohibitively complex to come up with a good test involving blockaddress:
we'd need to both ensure that the function body survives until
this pass, and is not interesting in this pass.
Nathan James [Mon, 27 Jul 2020 12:37:21 +0000 (13:37 +0100)]
[llvm][NFC] Silence unused variable warning by using isa over dyn_cast
Raphael Isemann [Mon, 27 Jul 2020 12:28:30 +0000 (14:28 +0200)]
[lldb][NFC] Use a StringRef for AddRegexCommand::AddRegexCommand parameters
Summary: This way we can get rid of this 1024 char buffer workaround.
Reviewers: #lldb, labath
Reviewed By: labath
Subscribers: JDevlieghere
Differential Revision: https://reviews.llvm.org/D84528
Aleksandr Platonov [Mon, 27 Jul 2020 11:39:31 +0000 (14:39 +0300)]
[clangd] Collect references for externally visible main-file symbols
Summary:
Without this patch clangd does not collect references for main-file symbols if there is no public declaration in preamble.
Example:
`test1.c`
```
void f1() {}
```
`test2.c`
```
extern void f1();
void f2() {
f^1();
}
```
`Find all references` does not show definition of f1() in the result, but GTD works OK.
Reviewers: sammccall, kadircet
Reviewed By: kadircet
Subscribers: ilya-golovenko, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D84513
Raphael Isemann [Mon, 27 Jul 2020 12:05:23 +0000 (14:05 +0200)]
[lldb] Modernize away some snprintf calls
Reviewers: #lldb, JDevlieghere
Reviewed By: #lldb, JDevlieghere
Subscribers: JDevlieghere
Differential Revision: https://reviews.llvm.org/D84530
Sanjay Patel [Sun, 26 Jul 2020 19:19:09 +0000 (15:19 -0400)]
[InstSimplify] add tests for min/max intrinsics; NFC
Kirill Bobyrev [Mon, 27 Jul 2020 12:15:59 +0000 (14:15 +0200)]
[clangd] Add marshalling code for all request types
Summary:
Only FuzzyFindRequest is implemented via Marshaller even though other requests
also follow a similar pattern. Unify them under the marshalling umbrella and
make the server requests even more uniform to complement D84499.
Reviewers: kadircet
Reviewed By: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits, sammccall
Tags: #clang
Differential Revision: https://reviews.llvm.org/D84525
Hans Wennborg [Mon, 27 Jul 2020 12:11:29 +0000 (14:11 +0200)]
Fix another #ifdef CLANGD_ENABLE_REMOTE
Hans Wennborg [Mon, 27 Jul 2020 12:03:55 +0000 (14:03 +0200)]
[gn] Set CLANGD_ENABLE_REMOTE=0
To fix the build after
37ac559fccd4.
Hans Wennborg [Mon, 27 Jul 2020 12:03:28 +0000 (14:03 +0200)]
ClangdMain.cpp: this #ifdef should be an #if
CLANGD_ENABLE_REMOTE is always defined; to 0 or 1.
Tim Northover [Wed, 22 Jul 2020 13:53:26 +0000 (14:53 +0100)]
AArch64: diagnose out of range relocation addends on MachO.
MachO only has 24-bit addends for most relocations, small enough that it can
overflow in semi-reasonable functions and cause insidious bugs if compiled
without assertions enabled. Switch it to an actual error instead.
The condition isn't quite identical because ld64 treats the addend as a signed
number.
Nathan James [Mon, 27 Jul 2020 11:48:53 +0000 (12:48 +0100)]
[clang-tidy] Refactor IncludeInserter
Simplified how `IncludeInserter` is used in Checks by abstracting away the SourceManager and PPCallbacks inside the method `registerPreprocessor`.
Changed checks that use `IncludeInserter` to no longer use a `std::unique_ptr`, instead the IncludeInserter is just a member of the class thats initialized with an `IncludeStyle`.
Saving an unnecessary allocation.
This results in the removal of the field `IncludeSorter::IncludeStyle` from the checks, as its wrapped in the `IncludeInserter`.
No longer need to create an instance of the `IncludeInserter` in the registerPPCallbacks, now that method only needs to contain:
```
Inserter.registerPreprocessor(PP);
```
Also added a helper method to `IncludeInserter` called `createMainFileInclusionInsertion`, purely sugar but does better express intentions.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D83680