Alexander Belyaev [Wed, 22 Apr 2020 07:02:00 +0000 (09:02 +0200)]
[MLIR] Verify there are no side-effecting ops in GenericAtomicRMWOp body.
Differential Revision: https://reviews.llvm.org/D78559
Stephan Herhut [Tue, 21 Apr 2020 19:21:37 +0000 (21:21 +0200)]
[MLIR] Add extra locking during cubin generation.
We also need to lock the LLVMDialect mutex when initializing
LLVM targets or destroying llvm modules concurrently. Added another
scoped lock to that effect.
Differential Revision: https://reviews.llvm.org/D78580
Alexander Belyaev [Tue, 21 Apr 2020 14:00:28 +0000 (16:00 +0200)]
[MLIR] Update documentation for loop.parallel.
Differential Revision: https://reviews.llvm.org/D78562
Johannes Doerfert [Sat, 18 Apr 2020 01:47:38 +0000 (20:47 -0500)]
[Attributor] Replace AccessKind2Accesses map with an "array map"
The number of different access location kinds we track is relatively
small (8 so far). With this patch we replace the DenseMap that mapped
from index (0-7) to the access set pointer with an array of access set
pointers. This reduces memory consumption.
No functional change is intended.
---
Single run of the Attributor module and then CGSCC pass (oldPM)
for SPASS/clause.c (~10k LLVM-IR loc):
Before:
```
calls to allocation functions: 472499 (215654/s)
temporary memory allocations: 77794 (35506/s)
peak heap memory consumption: 35.28MB
peak RSS (including heaptrack overhead): 125.46MB
total memory leaked: 269.04KB
```
After:
```
calls to allocation functions: 472270 (308673/s)
temporary memory allocations: 77578 (50704/s)
peak heap memory consumption: 32.70MB
peak RSS (including heaptrack overhead): 121.78MB
total memory leaked: 269.04KB
```
Difference:
```
calls to allocation functions: -229 (346/s)
temporary memory allocations: -216 (326/s)
peak heap memory consumption: -2.58MB
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B
```
---
Johannes Doerfert [Tue, 21 Apr 2020 16:13:20 +0000 (11:13 -0500)]
[Attributor] Run IRPosition::verify only with EXPENSIVE_CHECKS
Craig Topper [Wed, 22 Apr 2020 06:29:17 +0000 (23:29 -0700)]
[CallSite removal][Target] Replace CallSite with CallBase. NFC
In some cases just delete an unneeded include.
Qiu Chaofan [Fri, 17 Apr 2020 07:08:58 +0000 (15:08 +0800)]
[PowerPC] Exploit RLDIMI for OR with large immediates
This patch exploits rldimi instruction for patterns like
`or %a,
0b000011110000`, which saves number of instructions when the
operand has only one use, compared with `li-ori-sldi-or`.
Reviewed By: nemanjai
Differential Revision: https://reviews.llvm.org/D77850
Craig Topper [Tue, 21 Apr 2020 07:55:35 +0000 (00:55 -0700)]
[CallSite removal][TargetTransformInfoImpl] Replace CallSite with CallBase. NFC
Siva Chandra Reddy [Tue, 21 Apr 2020 16:58:12 +0000 (09:58 -0700)]
[libc][NFC] Cleanup dependencies in src/signal and test/src/signal.
Reviewers: abrachet
Differential Revision: https://reviews.llvm.org/D78585
Igor Kudrin [Wed, 22 Apr 2020 05:11:17 +0000 (12:11 +0700)]
[DebugInfo] Simplify DWARFUnit::determineStringOffsetsTableContribution(). NFC.
The method is called from only one place and the call is already guarded
by a condition which checks that IsDWO is false.
Differential Revision: https://reviews.llvm.org/D78482
Mehdi Amini [Wed, 22 Apr 2020 00:31:59 +0000 (00:31 +0000)]
Add `//` before the banner displayed in `--print-ir-before/after-all`
This is making the output file (when the stream is a file) a valid MLIR
file.
Differential Revision: https://reviews.llvm.org/D78604
Eli Friedman [Wed, 22 Apr 2020 04:00:19 +0000 (21:00 -0700)]
[TargetPassConfig] Run MachineVerifier after more passes.
We were disabling verification for no reason in a bunch of places; just
turn it on.
At this point, there are two key places where we don't run verification:
during register allocation, and after addPreEmitPass. Regalloc probably
isn't worth messing with; it has its own invariants, and verifying
afterwards is probably good enough. For after addPreEmitPass, it's
probably worth investigating improvements.
Ian Levesque [Tue, 21 Apr 2020 22:37:39 +0000 (18:37 -0400)]
[xray] Avoid text relocations in trampolines for ARM/AArch64
Summary: Switch to pc-relative lookup of the xray handler function to avoid text relocations.
Reviewers: MaskRay, dberris, johnislarry
Subscribers: kristof.beyls, danielkiss, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D78595
Ian Levesque [Tue, 21 Apr 2020 22:18:23 +0000 (18:18 -0400)]
[xray] Use hidden symbol visibility for xray trampolines
Summary: We load multiple copies of the trampolines into memory when instrumenting DSOs. Hidden visibility prevents conflicts in this scenario.
Reviewers: MaskRay, dberris, johnislarry
Subscribers: #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D78593
Fangrui Song [Wed, 22 Apr 2020 01:27:40 +0000 (18:27 -0700)]
[Frontend] Drop unneeded CC1 options
Sameer Sahasrabuddhe [Wed, 22 Apr 2020 01:57:26 +0000 (07:27 +0530)]
FixIrreducible: don't crash when moving a child loop
Summary:
When an irreducible SCC is converted into a new natural loop, existing
loops included in that SCC now become children of the new loop. The
logic that moves these loops from the parent loop to the new loop
invoked undefined behaviour when it modified the container that it was
iterating over. Fixed this by first extracting all the loops that are
to be removed from the parent.
Fixes bug 45623.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D78544
Dan Liew [Tue, 21 Apr 2020 01:52:26 +0000 (18:52 -0700)]
Add missing call to `__sanitizer::InitializePlatformEarly()` in UBSan's standalone init.
Summary:
While working on rdar://problem/
62083617 I noticed this call was
missing.
This is a no-op for all platforms except Darwin. For Darwin this
means the `use_xnu_fast_mmap` flag is initialized as it was intended
when using UBSan in standalone mode.
Reviewers: vitalybuka, vsk, kubamracek, yln, samsonov
Subscribers: #sanitizers, llvm-commits
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D78532
Dan Liew [Tue, 21 Apr 2020 01:27:43 +0000 (18:27 -0700)]
Add missing call to `Symbolizer::LateInitialize()` in UBSan's standalone init.
Summary:
This fixes symbolization in Standalone UBSan mode for the Darwin simulators.
861b69faee5df8d4e13ef316c7474a10e4069e81 (rdar://problem/
58789439) tried to fix
symbolization for all sanitizers on Darwin simulators but unfortunately it only
fixed the problem for TSan.
For UBSan in standalone mode the fix wasn't sufficient because UBSan's
standalone init doesn't call `Symbolizer::LateInitialize()` like ASan
and TSan do. This meant that `AtosSymbolizerProcess::LateInitialize()`
was never being called before
`AtosSymbolizerProcess::StartSymbolizerSubprocess()` which breaks an
invariant we expect to hold.
The missing call to `Symbolizer::LateInitialize()` during UBSan's
standalone init seems like an accidently omission so this patch simply
adds it.
rdar://problem/
62083617
Reviewers: vitalybuka, kubamracek, yln, samsonov
Subscribers: #sanitizers, llvm-commits
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D78530
Justin Hibbits [Tue, 21 Apr 2020 20:36:08 +0000 (15:36 -0500)]
[PowerPC] Add clang -msvr4-struct-return for 32-bit ELF
Summary:
Change the default ABI to be compatible with GCC. For 32-bit ELF
targets other than Linux, Clang now returns small structs in registers
r3/r4. This affects FreeBSD, NetBSD, OpenBSD. There is no change for
32-bit Linux, where Clang continues to return all structs in memory.
Add clang options -maix-struct-return (to return structs in memory) and
-msvr4-struct-return (to return structs in registers) to be compatible
with gcc. These options are only for PPC32; reject them on PPC64 and
other targets. The options are like -fpcc-struct-return and
-freg-struct-return for X86_32, and use similar code.
To actually return a struct in registers, coerce it to an integer of the
same size. LLVM may optimize the code to remove unnecessary accesses to
memory, and will return i32 in r3 or i64 in r3:r4.
Fixes PR#40736
Patch by George Koehler!
Reviewed By: jhibbits, nemanjai
Differential Revision: https://reviews.llvm.org/D73290
Andrew Browne [Mon, 6 Apr 2020 21:42:57 +0000 (14:42 -0700)]
Make SmallVector assert if it cannot grow.
Context:
/// Double the size of the allocated memory, guaranteeing space for at
/// least one more element or MinSize if specified.
void grow(size_t MinSize = 0) { this->grow_pod(MinSize, sizeof(T)); }
void push_back(const T &Elt) {
if (LLVM_UNLIKELY(this->size() >= this->capacity()))
this->grow();
memcpy(reinterpret_cast<void *>(this->end()), &Elt, sizeof(T));
this->set_size(this->size() + 1);
}
When grow is called in push_back() without a MinSize specified, this is
relying on the guarantee of space for at least one more element.
There is an edge case bug where the SmallVector is already at its maximum size
and push_back() calls grow() with default MinSize of zero. Grow is unable to
provide space for one more element, but push_back() assumes the additional
element it will be available. This can result in silent memory corruption, as
this->end() will be an invalid pointer and the program may continue executing.
Another alternative to fix would be to remove the default argument from
grow(), which would mean several changing grow() to grow(this->size()+1)
in several places.
No test case added because it would require allocating ~4GB.
Reviewers: echristo
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77601
Lawrence D'Anna [Tue, 21 Apr 2020 23:53:47 +0000 (16:53 -0700)]
get rid of PythonInteger::GetInteger()
Summary:
One small step in my long running quest to improve python exception handling in
LLDB. Replace GetInteger() which just returns an int with As<long long> and
friends, which return Expected types that can track python exceptions
Reviewers: labath, jasonmolenda, JDevlieghere, vadimcn
Reviewed By: labath
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D78462
LLVM GN Syncbot [Tue, 21 Apr 2020 23:36:07 +0000 (23:36 +0000)]
[gn build] Port
23609331472
Amy Huang [Tue, 21 Apr 2020 21:25:32 +0000 (14:25 -0700)]
Reland "Implement some functions in NativeSession." with fixes so that
the tests pass on Linux.
Summary:
This change implements readFromExe, and calculating VA and RVA, which
are some of the functionalities that will be used for native PDB reading
for llvm symbolizer.
bug: https://bugs.llvm.org/show_bug.cgi?id=41795
Mircea Trofin [Tue, 21 Apr 2020 20:13:23 +0000 (13:13 -0700)]
[llvm][NFC][CallSite] Remove CallSite from FunctionAttrs
Reviewers: dblaikie, craig.topper
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D78584
Bruno Cardoso Lopes [Tue, 21 Apr 2020 22:30:54 +0000 (15:30 -0700)]
Reapply: Make header inclusion order from umbrella dirs deterministic
Sort the headers by name before adding the includes in
collectModuleHeaderIncludes. This makes the include order for building
umbrellas deterministic across different filesystems and also guarantees
that the ASTWriter always dump top headers in the same order.
There's currently no good way to test for this behavior.
This was first introduced in r289478 and reverted few times because of
ASANifed test failures on open source bots (both from LLVM and Swift).
Finally reproduced the problem in a Linux machine and use std::sort as a
fix, since we are not dealing with POD-like types.
rdar://problem/
28116411
Fangrui Song [Tue, 21 Apr 2020 21:44:03 +0000 (14:44 -0700)]
[ELF] Fix a null pointer dereference when relocating a Local-Exec TLS relocation for a lazy symbol
If there is no SHF_TLS section, there will be no PT_TLS and Out::tlsPhdr may be a nullptr.
If the symbol referenced by an R_TLS is lazy, we should treat the symbol as undefined.
Also reorganize tls-in-archive.s and tls-weak-undef.s . They do not test what they intended to test.
Dan Liew [Tue, 21 Apr 2020 22:13:15 +0000 (15:13 -0700)]
Disable a Darwin test under LSan.
* Changing source lines seems to cause us to hit rdar://problem/
62132428.
* Even if I workaround the above issue sometimes the source line in the dylib reported by atos is off by one.
It's simpler to just disable the test for now.
rdar://problem/
61793759
Jonas Devlieghere [Tue, 21 Apr 2020 22:05:32 +0000 (15:05 -0700)]
[lldb/Test] Add decorator to the right method
Jonas Devlieghere [Tue, 21 Apr 2020 21:36:31 +0000 (14:36 -0700)]
[lldb/Test] Add skipIfReproducer for tests that diverge during replay
Add the skipIfReproducer decorator to the remaining tests that fail to
replay because the GDB remote packets diverge during replay. This is
*not* expected and should be fixed, but figuring out exactly what caused
the divergence has proven pretty difficult to track down.
I've marked these tests as skipped for now so we can get clean results
and detect new regressions. I have no evidence to believe that these
failures have the same root cause, so I've not assigned them a PR.
Jonas Devlieghere [Tue, 21 Apr 2020 21:34:18 +0000 (14:34 -0700)]
[lldb/Test] Add skipIfReproducer for tests that are not expected to work
Some tests are not expected to work with reproducers, for example tests
that completely circumvent the reproducers (i.e. using the side_effects
Python module) or that rely on changes to the file system.
LLVM GN Syncbot [Tue, 21 Apr 2020 21:22:08 +0000 (21:22 +0000)]
[gn build] Port
352fef3f11f
LLVM GN Syncbot [Tue, 21 Apr 2020 21:22:07 +0000 (21:22 +0000)]
[gn build] Port
060efd24c7f
Amy Huang [Tue, 21 Apr 2020 21:14:32 +0000 (14:14 -0700)]
Joel E. Denny [Tue, 21 Apr 2020 20:27:39 +0000 (16:27 -0400)]
[OpenMP] target_data_begin: fail on device alloc fail
Without this patch, target_data_begin continues after an illegal
mapping or an out-of-memory error on the device. With this patch, it
terminates the runtime with an error instead.
The new test exercises only illegal mappings. I didn't think of a
good way to exercise out-of-memory errors from the test suite.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D78170
Joel E. Denny [Tue, 21 Apr 2020 20:27:32 +0000 (16:27 -0400)]
[OpenMP] Add scaffolding for negative runtime tests
Without this patch, the openmp project's test suites do not appear to
have support for negative tests. However, D78170 needs to add a test
that an expected runtime failure occurs.
This patch makes `not` visible in all of the openmp project's test
suites. In all but `libomptarget/test`, it should be possible for a
test author to insert `not` before a use of the lit substitution for
running a test program. In `libomptarget/test`, that substitution is
target-specific, and its value is `echo` when the target is not
available. In that case, inserting `not` before a lit substitution
would expect an `echo` fail, so this patch instead defines a separate
lit substitution for expected runtime fails.
Reviewed By: jdoerfert, Hahnfeld
Differential Revision: https://reviews.llvm.org/D78566
Jez Ng [Tue, 21 Apr 2020 20:37:57 +0000 (13:37 -0700)]
[lld-macho] Add basic support for linking against dylibs
This diff implements:
* dylib loading (much of which is being restored from @pcc and @ruiu's
original work)
* The GOT_LOAD relocation, which allows us to load non-lazy dylib
symbols
* Basic bind opcode emission, which tells `dyld` how to populate the GOT
Differential Revision: https://reviews.llvm.org/D76252
Christopher Tetreault [Tue, 21 Apr 2020 20:02:23 +0000 (13:02 -0700)]
[SVE] Remove VectorType::getBitWidth()
Summary:
* VectorType::getBitWidth() is just an unsafe version of
getPrimitiveSizeInBits() that assumes all vectors are fixed width.
Reviewers: efriedma, sdesmalen, huntergr, craig.topper
Reviewed By: efriedma
Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77833
Johannes Doerfert [Tue, 21 Apr 2020 18:57:19 +0000 (13:57 -0500)]
[Attributor] Remove dependence edges eagerly
If we have a dependence between an abstract attribute A to an abstract
attribute B such hat changes in A should trigger an update of B, we do
not need to keep the dependence around once the update was triggered. If
the dependence is still required the update will reinsert it into the
dependence map, if it is not we avoid triggering B in the future. This
replaces the "recompute interval" mechanism we used before to prune
stale dependences.
Number of required iterations is generally down, compile time for the
module pass (not really the CGSCC pass) is down quite a bit.
There is one test change which looks like an artifact in the undefined
behavior AA that needs to be looked at.
Johannes Doerfert [Fri, 17 Apr 2020 01:32:06 +0000 (20:32 -0500)]
[Attributor][NFC] Track the number of created AAs in the statistics
Johannes Doerfert [Sat, 18 Apr 2020 02:43:54 +0000 (21:43 -0500)]
[Attributor][PM] Introduce `-attributor-enable={none,cgscc,module,all}`
The old command line option `-attributor-disable` was too coarse grained
as we want to measure the effects of the module or cgscc pass without
the other as well.
Since `none` is the default there is no real functional change.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D78571
Johannes Doerfert [Sat, 18 Apr 2020 02:09:16 +0000 (21:09 -0500)]
[Attributor][NFC] Remove obsolete option from tests
Since D76871 it is sufficient to run `opt -atributor` or
`-attributor-cgscc`.
Michael Liao [Tue, 21 Apr 2020 20:09:17 +0000 (16:09 -0400)]
Fix `-Wpedantic` warnings. NFC.
Michael Liao [Mon, 20 Apr 2020 19:15:05 +0000 (15:15 -0400)]
[hip] Claim builtin type `__float128` supported if the host target supports it.
Reviewers: tra, yaxunl
Subscribers: jvesely, nhaehnle, kerbowa, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D78513
Aaron Ballman [Tue, 21 Apr 2020 19:37:19 +0000 (15:37 -0400)]
C++2a -> C++20 in some identifiers; NFC.
Amy Huang [Tue, 21 Apr 2020 19:34:42 +0000 (12:34 -0700)]
[NativeSession] Fix unchecked Expected type
(followup to https://reviews.llvm.org/D78128)
Valentin Clement [Tue, 21 Apr 2020 19:27:35 +0000 (20:27 +0100)]
[Flang] fix dependency issues after D78215
Patch D78215 changes various dependencies in the CMakeLists.txt. This
results in error while compiling. This patch fixes the issue.
Reviewers: DavidTruby
Differential Revision: https://reviews.llvm.org/D78340
Louis Dionne [Thu, 16 Apr 2020 20:59:35 +0000 (16:59 -0400)]
[libc++abi] Add a rate limiter when logging dynamic_cast errors
This upstreams a fix that Howard made a long time ago, where so many
errors would be logged that applications were becoming sluggish. With
this patch, the first three errors will be printed, and after that the
printing frequency decreases exponentially.
_LIBCXX_DYNAMIC_FALLBACK is only enabled on Apple platforms, so this
should be NFC for other platforms.
rdar://
14996273
Differential Revision: https://reviews.llvm.org/D78330
Matt Arsenault [Tue, 21 Apr 2020 19:06:53 +0000 (15:06 -0400)]
AMDGPU: Use Register
Eli Friedman [Tue, 21 Apr 2020 01:43:52 +0000 (18:43 -0700)]
[ARM] Fix MIR tests with invalid live-ins.
A register can't be live if it isn't defined; fix issues in various
testcases.
Differential Revision: https://reviews.llvm.org/D78529
Eli Friedman [Tue, 21 Apr 2020 01:27:07 +0000 (18:27 -0700)]
[AArch64] Fix MIR tests with invalid live-ins.
A register can't be live if it isn't defined; fix issues in various
testcases.
Differential Revision: https://reviews.llvm.org/D78531
Evgenii Stepanov [Mon, 20 Apr 2020 18:53:26 +0000 (11:53 -0700)]
Fix Solaris build of ubsan.
Summary: Broken in D78325.
Reviewers: ro
Subscribers: mgorny, fedor.sergeev, #sanitizers, llvm-commits
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D78510
Michael Liao [Tue, 21 Apr 2020 19:02:25 +0000 (15:02 -0400)]
Fix `-Wparentheses` warnings. NFC.
Fangrui Song [Tue, 21 Apr 2020 18:52:51 +0000 (11:52 -0700)]
[XRay] xray_fn_idx: set SHF_WRITE to avoid text relocations
In a future change we should properly fix xray_fn_idx to use PC-relative
addresses as well, but for now let's keep absolute addresses until sled
addresses are all fixed.
Roman Lebedev [Tue, 21 Apr 2020 18:24:36 +0000 (21:24 +0300)]
[InstCombine] Negator - sink sinkable negations
Summary:
As we have discussed previously (e.g. in D63992 / D64090 / [[ https://bugs.llvm.org/show_bug.cgi?id=42457 | PR42457 ]]), `sub` instruction
can almost be considered non-canonical. While we do convert `sub %x, C` -> `add %x, -C`,
we sparsely do that for non-constants. But we should.
Here, i propose to interpret `sub %x, %y` as `add (sub 0, %y), %x` IFF the negation can be sinked into the `%y`
This has some potential to cause endless combine loops (either around PHI's, or if there are some opposite transforms).
For former there's `-instcombine-negator-max-depth` option to mitigate it, should this expose any such issues
For latter, if there are still any such opposing folds, we'd need to remove the colliding fold.
In any case, reproducers welcomed!
Reviewers: spatel, nikic, efriedma, xbolva00
Reviewed By: spatel
Subscribers: xbolva00, mgorny, hiraditya, reames, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68408
Michael Liao [Tue, 21 Apr 2020 18:58:52 +0000 (14:58 -0400)]
Fix build. NFC.
Fangrui Song [Tue, 21 Apr 2020 18:53:56 +0000 (11:53 -0700)]
[PDB] Change llvm/object/COFF.h to llvm/Object/COFF.h after D78128
Amy Huang [Tue, 14 Apr 2020 00:53:12 +0000 (17:53 -0700)]
Implement some functions in NativeSession.
Summary:
This change implements readFromExe, and calculating VA and RVA, which
are some of the functionalities that will be used for native PDB reading
for llvm symbolizer.
bug: https://bugs.llvm.org/show_bug.cgi?id=41795
Reviewers: hans, amccarth, rnk
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D78128
Benjamin Kramer [Tue, 21 Apr 2020 18:09:30 +0000 (20:09 +0200)]
Bit-pack some pairs. No functionlity change intended.
Fangrui Song [Tue, 21 Apr 2020 18:33:40 +0000 (11:33 -0700)]
[CallSite] Fix build breakage after D78538
Jonas Devlieghere [Tue, 21 Apr 2020 18:29:47 +0000 (11:29 -0700)]
[lldb/Scripts] proc.returncode is set in proc.communicate
Make sure proc.returncode has been assigned before we compare it to 0.
Sanjay Patel [Tue, 21 Apr 2020 18:22:13 +0000 (14:22 -0400)]
[Analysis] recognize the 'null' pointer constant as not poison
Differential Revision: https://reviews.llvm.org/D78575
Sanjay Patel [Tue, 21 Apr 2020 16:50:12 +0000 (12:50 -0400)]
[InstCombine] add tests for logic-of-icmps; NFC
River Riddle [Tue, 21 Apr 2020 18:20:13 +0000 (11:20 -0700)]
[mlir] Remove braces to avoid ambiguous constructor of operand range
aartbik [Tue, 21 Apr 2020 17:27:05 +0000 (10:27 -0700)]
[llvm] [X86] Fixed type bug in vselect for AVX masked load
Summary:
Bugzilla issue 45563
https://bugs.llvm.org/show_bug.cgi?id=45563
Reviewers: nicolasvasilache, mehdi_amini, craig.topper
Reviewed By: craig.topper
Subscribers: RKSimon, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D78527
Mircea Trofin [Tue, 21 Apr 2020 05:09:47 +0000 (22:09 -0700)]
[llvm][NFC][CallSite] Remove CallSite from DeadArgumentElimination
Summary: Also capitalized some induction variables, to match coding style.
Reviewers: dblaikie, craig.topper
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D78538
Simon Pilgrim [Tue, 21 Apr 2020 17:32:00 +0000 (18:32 +0100)]
[Transforms] getOrEnforceKnownAlignment - fix MSVC result of 32-bit shift implicitly converted to 64 bits warning. NFCI
We don't overflow here so we can use a U64 shift directly.
Siva Chandra Reddy [Tue, 21 Apr 2020 17:10:58 +0000 (10:10 -0700)]
[libc][Take 2] Propagate entrypoint deps to downstream targets.
This reverts commit
a8086ba4ac85152d8407630e56e9ee5c8b46a214.
Setting couple of target properties to an empty string was missed in the
previous commit.
Pavel Iliin [Wed, 15 Apr 2020 22:46:23 +0000 (23:46 +0100)]
[AArch64] FMLA/FMLS patterns improvement.
FMLA/FMLS f16 indexed patterns added.
Fixes https://bugs.llvm.org/show_bug.cgi?id=45467
Removed redundant v2f32 vector_extract indexed pattern since
Instruction Selection is able to match v4f32 instead.
Roman Lebedev [Tue, 21 Apr 2020 17:13:57 +0000 (20:13 +0300)]
[NFC][InstCombine] sub-of-negatible.ll: some more test cases
Louis Dionne [Tue, 21 Apr 2020 17:11:03 +0000 (13:11 -0400)]
[libc++] Do not enable assertions in the dylib in the Apple cache
It turns out that all this time, we've actually been building without
assertions enabled in the dylib. This commit updates the Apple CMake
cache to make it consistent with reality.
Siva Chandra Reddy [Tue, 21 Apr 2020 17:09:25 +0000 (10:09 -0700)]
[libc] Revert "Propagate entrypoint deps to downstream targets."
This reverts commit
20cb440ea210597bf223505604bb5f2220a067c6 as the
target llvmlibc seems to be failing on the bots.
Ana Pazos [Tue, 21 Apr 2020 16:38:04 +0000 (09:38 -0700)]
[MC][PGO][PGSO] Cleanup unused MBFI in AsmPrinter
Summary:
Machine Block Frequency Info (MBFI) is being computed but unused in AsmPrinter.
MBFI computation was introduced with PGO change D71149 and then its use was
removed in D71106. No need to keep computing it.
Reviewers: MaskRay, jyknight, skan, yamauchi, davidxl, efriedma, huihuiz
Reviewed By: MaskRay, skan, yamauchi
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D78526
Louis Dionne [Mon, 20 Apr 2020 15:33:29 +0000 (11:33 -0400)]
[libc++] Re-enable warnings in the new format
When the new libc++ test format was enabled, warnings were accidentally
dropped cause they were not part of the %{compile_flags} substitution.
This commit adds them back, however `-Werror` is only used for non-verify
tests (cause it doesn't make sense for verify tests).
This commit is a re-application of
20fd62438004, which was reverted in
5ec6fdb0580b because it broke the C++03 bot. This failure should have
been fixed in
b4fb705e77aa.
Benjamin Kramer [Tue, 21 Apr 2020 16:59:19 +0000 (18:59 +0200)]
Fix an unused-variable warning in Release mode.
Siva Chandra Reddy [Sat, 18 Apr 2020 06:14:54 +0000 (23:14 -0700)]
[libc] Propagate entrypoint deps to downstream targets.
Deps are recrusively evaluated at the place they are needed. With this
change, one does not have to list recursive deps of entrypoints when
listing test targets. One will still have to explicitly list all
entrypoint objects when setting up an "add_entrypoint_library" target.
Reviewers: abrachet
Differential Revision: https://reviews.llvm.org/D78537
Fangrui Song [Tue, 14 Apr 2020 05:28:16 +0000 (22:28 -0700)]
[XRay] Change xray_instr_map sled addresses from absolute to PC relative for x86-64
xray_instr_map contains absolute addresses of sleds, which are relocated
by `R_*_RELATIVE` when linked in -pie or -shared mode.
By making these addresses relative to PC, we can avoid the dynamic
relocations and remove the SHF_WRITE flag from xray_instr_map. We can
thus save VM pages containg xray_instr_map (because they are not
modified).
This patch changes x86-64 and bumps the sled version to 2. Subsequent
changes will change powerpc64le and AArch64.
Reviewed By: dberris, ianlevesque
Differential Revision: https://reviews.llvm.org/D78082
Sanjay Patel [Tue, 21 Apr 2020 16:24:18 +0000 (12:24 -0400)]
[InstCombine] add tests for logic-of-icmps; NFC
These are mostly replicated from D78430 (instsimplify).
If we implement more general transforms for instcombine,
then we probably don't need to add that complexity to instsimplify.
Siva Chandra Reddy [Sat, 18 Apr 2020 01:42:40 +0000 (18:42 -0700)]
[libc] [NFC] Split the CMake rules into multiple files.
Summary:
The single file was getting too long to be convenient to navigate. This
patch splits it up two into 4 files one each for header rules,
object rules, library rules, and test rules.
Reviewers: abrachet, alexshap
Subscribers: mgorny, tschuett, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D78536
Johannes Doerfert [Fri, 17 Apr 2020 01:00:19 +0000 (20:00 -0500)]
[Attributor] Use a pointer value type for the OpcodeInstMap
This reduces memory consumption and the need to copy complex data
structures repeatedly.
No functional change is intended.
---
Single run of the Attributor module and then CGSCC pass (oldPM)
for SPASS/clause.c (~10k LLVM-IR loc):
Before:
```
calls to allocation functions: 490390 (320725/s)
temporary memory allocations: 84601 (55330/s)
peak heap memory consumption: 41.70MB
peak RSS (including heaptrack overhead): 131.18MB
total memory leaked: 269.04KB
```
After:
```
calls to allocation functions: 489359 (301144/s)
temporary memory allocations: 82983 (51066/s)
peak heap memory consumption: 36.76MB
peak RSS (including heaptrack overhead): 126.48MB
total memory leaked: 269.04KB
```
Difference:
```
calls to allocation functions: -1031 (-10739/s)
temporary memory allocations: -1618 (-16854/s)
peak heap memory consumption: -4.94MB
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B
---
Johannes Doerfert [Fri, 17 Apr 2020 00:49:03 +0000 (19:49 -0500)]
[Attributor] Use a pointer value type for the QueryMap
This reduces memory consumption and the need to copy complex data
structures repeatedly.
No functional change is intended.
---
Single run of the Attributor module and then CGSCC pass (oldPM)
for SPASS/clause.c (~10k LLVM-IR loc):
Before:
```
calls to allocation functions: 596180 (374484/s)
temporary memory allocations: 84979 (53378/s)
peak heap memory consumption: 52.14MB
peak RSS (including heaptrack overhead): 139.79MB
total memory leaked: 269.04KB
```
After:
```
calls to allocation functions: 489200 (303285/s)
temporary memory allocations: 83406 (51708/s)
peak heap memory consumption: 41.70MB
peak RSS (including heaptrack overhead): 131.76MB
total memory leaked: 269.04KB
```
Difference:
```
calls to allocation functions: -106980 (-5094285/s)
temporary memory allocations: -1573 (-74904/s)
peak heap memory consumption: -10.44MB
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B
---
Johannes Doerfert [Fri, 17 Apr 2020 00:28:06 +0000 (19:28 -0500)]
[Attributor] Use a pointer value type for the access kind -> accesses map
This reduces memory consumption and the need to copy complex data
structures repeatedly.
No functional change is intended.
---
Single run of the Attributor module and then CGSCC pass (oldPM)
for SPASS/clause.c (~10k LLVM-IR loc):
Before:
```
calls to allocation functions: 616219 (381559/s)
temporary memory allocations: 83294 (51575/s)
peak heap memory consumption: 72.15MB
peak RSS (including heaptrack overhead): 160.04MB
total memory leaked: 269.04KB
```
After:
```
calls to allocation functions: 595004 (357145/s)
temporary memory allocations: 83840 (50324/s)
peak heap memory consumption: 52.14MB
peak RSS (including heaptrack overhead): 138.32MB
total memory leaked: 269.04KB
```
Difference:
```
calls to allocation functions: -21215 (-415980/s)
temporary memory allocations: 546 (10705/s)
peak heap memory consumption: -20.01MB
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B
---
Johannes Doerfert [Fri, 17 Apr 2020 23:24:49 +0000 (18:24 -0500)]
[Attributor] Pass the Attributor to the AbstractAttribute constructors
AbstractAttribute::initialize is used to initialize the deduction and
the object we do not always call it. To make sure we have the option to
initialize the object even if initialize is not called we pass the
Attributor to AbstractAttribute constructors now.
Johannes Doerfert [Thu, 16 Apr 2020 23:23:01 +0000 (18:23 -0500)]
[Attributor] Use a pointer value type for the AAMap
This reduces memory consumption and the need to copy complex data
structures repeatedly.
No functional change is intended.
---
Single run of the Attributor module and then CGSCC pass (oldPM)
for SPASS/clause.c (~10k LLVM-IR loc):
Before:
```
calls to allocation functions: 613353 (376521/s)
temporary memory allocations: 83636 (51341/s)
peak heap memory consumption: 75.64MB
peak RSS (including heaptrack overhead): 162.97MB
total memory leaked: 269.04KB
```
After:
```
calls to allocation functions: 616575 (349929/s)
temporary memory allocations: 83650 (47474/s)
peak heap memory consumption: 72.15MB
peak RSS (including heaptrack overhead): 159.81MB
total memory leaked: 269.04KB
```
Difference:
```
calls to allocation functions: 3222 (24225/s)
temporary memory allocations: 14 (105/s)
peak heap memory consumption: -3.49MB
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B
---
Pierre Oechsel [Tue, 21 Apr 2020 16:12:11 +0000 (18:12 +0200)]
[mlir] [linalg] Specify alignment during promotion.
The buffer allocated by a promotion can be subject to other transformations afterward. For example it could be vectorized, in which case it is needed to ensure that this buffer is memory-aligned.
Differential Revision: https://reviews.llvm.org/D78556
Nicolas Vasilache [Sat, 18 Apr 2020 04:04:35 +0000 (00:04 -0400)]
[mlir][Linalg] Create a named batch_matmul op and pipe it through.
This revision is the first in a set of improvements that aim at allowing
more generalized named Linalg op generation from a mathematical
specification.
This revision allows creating a new op and checks that the parser,
printer and verifier are hooked up properly.
This opened up a few design points that will be addressed in the future:
1. A named linalg op has a static region builder instead of an
explicitly parsed region. This is not currently compatible with
assemblyFormat so a custom parser / printer are needed.
2. The convention for structured ops and tensor return values needs to
evolve to allow tensor-land and buffer land specifications to agree
3. ReferenceIndexingMaps and referenceIterators will need to become
static to allow building attributes at parse time.
4. Error messages will be improved once we have 3. and we pretty print
in custom form.
Differential Revision: https://reviews.llvm.org/D78327
Stefan Pintilie [Tue, 21 Apr 2020 16:08:19 +0000 (11:08 -0500)]
[PowerPC][Future] Add offsets to PC Relative relocations.
This is an optimization that applies to global addresses and
allows for the following transformation:
Convert this:
paddi r3, 0, symbol@PCREL, 1
ld r4, 8(r3)
To this:
pld r4, symbol@PCREL+8(0), 1
An instruction is saved and the linker can do the addition when
the symbol is resolved.
Differential Revision: https://reviews.llvm.org/D76160
Kang Zhang [Tue, 21 Apr 2020 16:00:34 +0000 (16:00 +0000)]
[PowerPC] Add a new test case expand-isel-liveness.mir
Jonas Devlieghere [Tue, 21 Apr 2020 15:25:44 +0000 (08:25 -0700)]
[lldb/Test] Decode stdout and stderr in case it contains Unicode.
Lit's to_string will just return the string when it's a `str` instance,
which in Python 2 can still contain UTF-8 characters.
Differential revision: https://reviews.llvm.org/D76955
Nick Desaulniers [Tue, 21 Apr 2020 15:25:18 +0000 (08:25 -0700)]
[InlineSpiller] simplify insertReload() NFC
Summary:
The repeated use of std::next() on a MachineBasicBlock::iterator was
clever, but we only need to reconstruct the iterator post creation of
the spill instruction.
This helps simplifying where we plan to place the spill, as discussed in
D77849.
From here, we can simplify the code a little by flipping the return code
of a helper.
Reviewers: efriedma
Reviewed By: efriedma
Subscribers: qcolombet, hiraditya, llvm-commits, srhines
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D78520
Jay Foad [Tue, 21 Apr 2020 12:34:23 +0000 (13:34 +0100)]
[AMDGPU] Remove selectSGPRVectorRegClassID. NFC.
This was yet another function that had to be updated whenever you added
a new register class. Remove it by refactoring its only caller to use
standard helper functions from SIRegisterInfo.
Differential Revision: https://reviews.llvm.org/D78557
Fangrui Song [Fri, 17 Apr 2020 17:29:25 +0000 (10:29 -0700)]
[ELF] Keep local symbols when both --emit-relocs and --discard-all are specified
This fixes a bug as exposed by D77807.
Add tests for {--emit-relocs,-r} x {--discard-locals,--discard-all}. They add coverage for previously undertested cases:
* STT_SECTION associated to GCed sections (`gc`)
* STT_SECTION associated to retained sections (`text`)
* STT_SECTION associated to non-SHF_ALLOC sections (`.comment`)
* STB_LOCAL in GCed sections (`unused_gc`)
Reviewed By: grimar, ikudrin
Differential Revision: https://reviews.llvm.org/D78389
Louis Dionne [Tue, 21 Apr 2020 15:02:29 +0000 (11:02 -0400)]
[libc++] Fix warnings with Clang in C++03
Sean Fertile [Tue, 21 Apr 2020 14:36:45 +0000 (10:36 -0400)]
[PowerPC][AIX][NFC] Fix use of FileCheck variable in lit test.
Fangrui Song [Sat, 18 Apr 2020 22:04:44 +0000 (15:04 -0700)]
[ELF] Fix "TLS attribute mismatch" false positives for STT_NOTYPE undefined symbols
D13550 added the diagnostic to address/work around a crash.
The rule was refined by D19836 (test/ELF/tls-archive.s) to exclude Lazy symbols.
https://bugs.llvm.org/show_bug.cgi?id=45598 reported another case where the current logic has a false positive:
Bitcode does not record undefined module-level inline assembly symbols
(`IRSymtab.cpp:Builder::addSymbol`). Such an undefined symbol does not
have the FB_tls bit and lld will not consider it STT_TLS. When the symbol is
later replaced by a STT_TLS Defined, lld will error "TLS attribute mismatch".
This patch fixes this false positive by allowing a STT_NOTYPE undefined
symbol to be replaced by a STT_TLS.
Considered alternative:
Moving the diagnostics to scanRelocs() can improve the diagnostics (PR36049)
but that requires a fair amount of refactoring. We will need more
RelExpr members. It requires more thoughts whether it is worthwhile.
See `test/ELF/tls-mismatch.s` for behavior differences. We will fail to
diagnose a likely runtime bug (STT_NOTYPE non-TLS relocation referencing
a TLS definition). This is probably acceptable because compiler
generated code sets symbol types properly.
Reviewed By: grimar, psmith
Differential Revision: https://reviews.llvm.org/D78438
Fangrui Song [Sat, 18 Apr 2020 23:05:49 +0000 (16:05 -0700)]
[ELF][test] Reorganize "TLS attribute mismatch" tests
Pavel Labath [Tue, 24 Mar 2020 14:49:54 +0000 (15:49 +0100)]
[DWARFDebugLine] Check for errors when parsing v2 file/dir lists
Summary:
Without this we could silently accept an invalid prologue because the
default DataExtractor behavior is to return an empty string when
reaching the end of file. And empty string is also used to terminate
these lists.
This makes the parsing code slightly more complicated, but this
complexity will go away once the parser starts working with truncating
data extractors. The reason I am doing it this way is because without
this, the truncation would regress the quality of error messages (right
now, we produce bad error messages only near EOF, but truncation would
make everything behave as if it was near EOF).
Reviewers: dblaikie, probinson, jhenderson
Subscribers: hiraditya, MaskRay, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77555
Jean-Michel Gorius [Tue, 21 Apr 2020 14:54:01 +0000 (16:54 +0200)]
[mlir][NFC] Fix typo in the standalone dialect README.
Pavel Labath [Mon, 23 Mar 2020 13:20:08 +0000 (14:20 +0100)]
[DWARFDataExtractor] Add a "truncating" constructor
Summary:
This constructor allows us to create a new DWARFDataExtractor which will
only present a subrange of an entire debug section. Since debug sections
typically consist of multiple contributions, it is expected that one
will create a new data extractor for each contribution in order to
avoid unexpectedly running off into the next one.
This is very useful for unifying the flows for detecting parse errors.
Without it, the code needs to consider two very different scenarios:
1. If there is another contribution after the current one, the
DataExtractor functions will just start reading from there. This is
detectable by comparing the current offset against the known
end-of-contribution offset.
2. If this is the last contribution, the data extractor will just start
returning zeroes (or other default values). This situation can *not*
be detected by checking the parsing offset, as this will not be
advanced in case of errors.
Using a truncated data extractor simplifies the code (and reduces
cognitive load) by making these two cases behave identically -- a
running off the end of a contribution will _always_ produce an EOF error
(if one uses error-aware parsing methods) or return default values.
Reviewers: dblaikie, probinson, jhenderson, ikudrin
Subscribers: aprantl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77556
Pavel Iliin [Tue, 21 Apr 2020 12:55:22 +0000 (13:55 +0100)]
[AArch64][NFC] One more intrinsic test.
Simon Pilgrim [Tue, 21 Apr 2020 14:18:06 +0000 (15:18 +0100)]
X86ISelLowering.cpp - clang-format to fix col80 limit. NFC.