Nicolai Hähnle [Tue, 20 Oct 2020 11:50:52 +0000 (13:50 +0200)]
Introduce CfgTraits abstraction
The CfgTraits abstraction simplfies writing algorithms that are
generic over the type of CFG, and enables writing such algorithms
as regular non-template code that operates on opaque references
to CFG blocks and values.
Implementations of CfgTraits provide operations on the concrete
CFG types, e.g. `IrCfgTraits::BlockRef` is `BasicBlock *`.
CfgInterface is an abstract base class which provides operations
on opaque types CfgBlockRef and CfgValueRef. Those opaque types
encapsulate a `void *`, but the meaning depends on the concrete
CFG type. For example, MachineCfgTraits -- for use with MachineIR
in SSA form -- encodes a Register inside CfgValueRef. Converting
between concrete references and opaque/generic ones is done by
CfgTraits::{fromGeneric,toGeneric}. Convenience methods
CfgTraits::{un}wrap{Iterator,Range} are available as well.
Writing algorithms in terms of CfgInterface adds some overhead
(virtual method calls, plus in same cases it removes the
opportunity to inline iterators), but can be much more convenient
since generic algorithms can be written as non-templates.
This patch adds implementations of CfgTraits for all CFGs on
which dominator trees are calculated, so that the dominator
tree can be ported to this machinery. Only IrCfgTraits (LLVM IR)
and MachineCfgTraits (Machine IR in SSA form) are complete, the
other implementations are limited to the absolute minimum
required to make the upcoming dominator tree changes work.
v5:
- fix MachineCfgTraits::blockdef_iterator and allow it to iterate over
the instructions in a bundle
- use MachineBasicBlock::printName
v6:
- implement predecessors/successors for all CfgTraits implementations
- fix error in unwrapRange
- rename toGeneric/fromGeneric into wrapRef/unwrapRef to have naming
that is consistent with {wrap,unwrap}{Iterator,Range}
- use getVRegDef instead of getUniqueVRegDef
v7:
- std::forward fix in wrapping_iterator
- fix typos
v8:
- cleanup operators on CfgOpaqueType
- address other review comments
Change-Id: Ia75f4f268fded33fca11218a7d578c9aec1f3f4d
Differential Revision: https://reviews.llvm.org/D83088
Haojian Wu [Tue, 20 Oct 2020 09:04:27 +0000 (11:04 +0200)]
[format] foo.<name>.h should be the main-header for foo.<name>.cc
This fixes a regression introduced in https://reviews.llvm.org/D88640.
Differential Revision: https://reviews.llvm.org/D89783
Roman Lebedev [Tue, 20 Oct 2020 11:10:57 +0000 (14:10 +0300)]
[NFC][SCEV] Improve/rework test coverage for ptrtoint handling
Simon Pilgrim [Tue, 20 Oct 2020 10:02:23 +0000 (11:02 +0100)]
[InstCombine] SimplifyDemandedUseBits - pass APInt by const reference. NFCI.
Luís Marques [Tue, 20 Oct 2020 11:07:40 +0000 (12:07 +0100)]
[compiler-rt][builtins] Add tests for atomic builtins support functions
Adds some simple sanity checks that the support functions for the atomic
builtins do the right thing. This doesn't test concurrency and memory model
issues.
Differential Revision: https://reviews.llvm.org/D86278
Konrad Kleine [Tue, 20 Oct 2020 10:42:43 +0000 (06:42 -0400)]
[doc] Apply buildbot worker terminology change: slave->worker
Recently [1], there was an upgrade to the version of buildbot being
deployed. The new setup will still work with old buildslaves but I
thought it might be a good idea to update the documentation to reflect,
that you now can use a newer buildbot version to when setting up your
worker (formely known as slave).
The upgrade from buildbot 0.8.5 to 2.8.5 went a long with a transition
to a new "worker" terminology [2] which is also reflected by this
change.
[1]: http://lists.llvm.org/pipermail/llvm-dev/2020-October/145629.html
[2]: http://docs.buildbot.net/0.9.12/manual/worker-transition.html
Reviewed By: gkistanova
Differential Revision: https://reviews.llvm.org/D89230
Pushpinder Singh [Tue, 20 Oct 2020 09:09:29 +0000 (05:09 -0400)]
[libomptarget][AMDGPU][NFC] Split atmi_memcpy for h2d and d2h
The calls to atmi_memcpy presently determine the direction of copy (host to
device or device to host) by storing pointers in a map during malloc and
looking up the pointers during memcpy. As each call site already knows the
direction, this stash+lookup can be eliminated.
This NFC will be followed by a functional one that deletes those map lookups.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D89776
Change-Id: I1d9089bc1e56b3a9a30e334735fa07dee1f84990
Carl Ritson [Tue, 20 Oct 2020 09:11:51 +0000 (18:11 +0900)]
[AMDGPU] Remove fix up operand from SI_ELSE
Remove immediate operand from SI_ELSE which indicates if EXEC has
been modified. Instead always emit code that handles EXEC and
remove unnecessary instructions during pre-RA optimisation.
This facilitates passes (i.e. SIWholeQuadMode) adding exec mask
manipulation post control flow lowering, and pre control flow
lower passes do not need to be aware of SI_ELSE handling.
Reviewed By: nhaehnle
Differential Revision: https://reviews.llvm.org/D89644
Aleksandr Platonov [Tue, 20 Oct 2020 10:03:28 +0000 (13:03 +0300)]
[clangd][remote] Add Windows paths support
Without this patch 6 marshalling tests fail on Windows.
This patch contains the following changes:
- Allow paths with Windows slashes (convert to the POSIX style instead of assertion)
- Add support for URI with Windows path.
- Change the value of the second parameter of several `llvm::sys::path::convert_to_slash()` calls: we should use `windows` instead of `posix` to ensure UNIX slashes in the path.
- Port `RemoteMarshallingTest::IncludeHeaderURI` test to Windows.
Reviewed By: kbobyrev
Differential Revision: https://reviews.llvm.org/D89529
sstefan1 [Thu, 15 Oct 2020 11:04:36 +0000 (13:04 +0200)]
[IR] Make nosync, nofree and willreturn default for intrinsics.
D70365 allows us to make attributes default. This is a follow up to
actually make nosync, nofree and willreturn default. The approach we
chose, for now, is to opt-in to default attributes to avoid introducing
problems to target specific intrinsics. Intrinsics with default
attributes can be created using `DefaultAttrsIntrinsic` class.
Tres Popp [Tue, 20 Oct 2020 09:32:48 +0000 (11:32 +0200)]
[mlir] Use affine dim instead of symbol in SCFToGPU lowering.
This still satisfies the constraints required by the affine dialect and
gives more flexibility in what iteration bounds can be used when
loewring to the GPU dialect.
Differential Revision: https://reviews.llvm.org/D89782
Georgii Rymar [Tue, 20 Oct 2020 09:20:15 +0000 (12:20 +0300)]
[yaml2obj][NFCI] - Address post commit comments for "[yaml2obj][ELF] - Simplify the code that performs sections validation."
This addresses post commit comments for D89463.
Kirill Bobyrev [Tue, 20 Oct 2020 09:23:36 +0000 (11:23 +0200)]
[clangd] NFC: Resolve Clang-Tidy warnings in Protocol.cpp
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D89771
David Carlier [Tue, 20 Oct 2020 10:14:26 +0000 (11:14 +0100)]
[Sanitizers] Remove OpenBSD support (new attempt)
- Fixing VS compiler and other cases settings this time.
Reviewers: dmajor, hans
Reviewed By: hans
Differential Revision: https://reviews.llvm.org/D89759
Alex Richardson [Mon, 19 Oct 2020 16:14:01 +0000 (17:14 +0100)]
[clang-format] Drop clangFrontend dependency for FormatTests
This allows building the clang-format unit tests in only 657 ninja steps
rather than 1257 which allows for much faster incremental builds after a
git pull.
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D89709
Alex Richardson [Tue, 20 Oct 2020 07:54:07 +0000 (08:54 +0100)]
Move clang/Tooling/Core/Lookup.h to clang/Tooling/Refactoring/Lookup.h
This allows removing the clangAST dependency from libclangToolingCore and
therefore allows clang-format to be built without depending on clangAST.
Before 1166 files had to be compiled for clang-format, now only 796.
Reviewed By: bkramer
Differential Revision: https://reviews.llvm.org/D89708
Benjamin Kramer [Tue, 20 Oct 2020 08:48:12 +0000 (10:48 +0200)]
Silence unused variable warning in Release builds. NFCI.
Jason Molenda [Tue, 20 Oct 2020 08:42:02 +0000 (01:42 -0700)]
Add a nul byte to packet str before logging, increase default size.
Add a nul byte to the stream in CommunicationKDP::CheckForPacket
before we send the GetData() to a Log::Printf as a c-str. Avoids
a crash when logging kdp communications and memory layout isn't
in your favor.
Georgii Rymar [Thu, 15 Oct 2020 09:44:42 +0000 (12:44 +0300)]
[yaml2obj][ELF] - Simplify the code that performs sections validation.
This:
1) Changes the return type of `MappingTraits<T>>::validate` to `std::string`
instead of `StringRef`. It allows to create more complex error messages.
2) It introduces std::vector<std::pair<StringRef, bool>> getEntries():
a new virtual method of Section, which is the base class for all sections.
It returns names of special section specific keys (e.g. "Entries") and flags that
says if them exist in a YAML. The code in validate() uses this list of entries
descriptions to generalize validation.
This approach was discussed in the D89039 thread.
Differential revision: https://reviews.llvm.org/D89463
Carl Ritson [Tue, 20 Oct 2020 07:43:37 +0000 (16:43 +0900)]
[AMDGPU][NFC] Tidy SIOptimizeExecMaskingPreRA for extensibility
Remove duplicate code and move things around to make it easier to
add additional optimisations to the pass.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D89619
Ulrich Weigand [Tue, 20 Oct 2020 08:19:15 +0000 (10:19 +0200)]
[SystemZ] Fix disassembler crashes
The "Size" value returned by SystemZDisassembler::getInstruction is
used by common code even in the case where the routine returns
failure. If that Size value exceeds the number of bytes remaining
in the section, that could cause disassembler crashes.
Fixed by never returning more than the number of bytes remaining.
Evgeny Leviant [Tue, 20 Oct 2020 08:14:21 +0000 (11:14 +0300)]
[ARM][SchedModels] Convert IsCPSRDefinedPred to MCSchedPredicate
Differential revision: https://reviews.llvm.org/D89460
David Green [Tue, 20 Oct 2020 07:55:21 +0000 (08:55 +0100)]
Revert "[ARM][LowOverheadLoops] Adjust Start insertion."
This reverts commit
38f625d0d1360b035271422bab922d22ed04d79a.
This commit contains some holes in its logic and has been causing
issues since it was commited. The idea sounds OK but some cases were not
handled correctly. Instead of trying to fix that up later it is probably
simpler to revert it and work to reimplement it in a more reliable way.
Alex Zinenko [Mon, 19 Oct 2020 17:17:51 +0000 (19:17 +0200)]
[mlir] Expose Value hierarchy to C API
The Value hierarchy consists of BlockArgument and OpResult, both of which
derive Value. Introduce IsA functions and functions specific to each class,
similarly to other class hierarchies. Also, introduce functions for
pointer-comparison of Block and Operation that are necessary for testing and
are generally useful.
Reviewed By: stellaraccident, mehdi_amini
Differential Revision: https://reviews.llvm.org/D89714
Atmn Patel [Tue, 20 Oct 2020 06:48:18 +0000 (02:48 -0400)]
[IR] Adds mustprogress as a LLVM IR attribute
This adds the LLVM IR attribute `mustprogress` as defined in LangRef through D86233. This attribute will be applied to functions with in languages like C++ where forward progress is guaranteed. Functions without this attribute are not required to make progress.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D85393
Richard Smith [Tue, 20 Oct 2020 03:03:18 +0000 (20:03 -0700)]
Properly track whether a variable is constant-initialized.
This fixes miscomputation of __builtin_constant_evaluated in the
initializer of a variable that's not usable in constant expressions, but
is readable when constant-folding.
If evaluation of a constant initializer fails, we throw away the
evaluated result instead of keeping it as a non-constant-initializer
value for the variable, because it might not be a correct value.
To avoid regressions for initializers that are foldable but not formally
constant initializers, we now try constant-evaluating some globals in
C++ twice: once to check for a constant initializer (in an mode where
is_constannt_evaluated returns true) and again to determine the runtime
value if the initializer is not a constant initializer.
Igor Kudrin [Thu, 15 Oct 2020 13:51:02 +0000 (20:51 +0700)]
[LTO][Legacy] Eliminate an unused member of llvm::LTOModule. NFC.
This is a follow-up for D62935 where the corresponding API methods were removed.
Differential Revision: https://reviews.llvm.org/D89472
Fangrui Song [Tue, 20 Oct 2020 06:05:26 +0000 (23:05 -0700)]
[Driver] Clean up -gz & --compress-debug-sections
* Make cc1 and cc1as --compress-debug-sections an alias for --compress-debug-sections=zlib
* Make -gz an alias for -gz=zlib
The new behavior is consistent with GCC when binutils>=2.26 is detected:
-gz is translated to --compress-debug-sections=zlib instead of --compress-debug-sections.
Vitaly Buka [Tue, 20 Oct 2020 05:44:34 +0000 (22:44 -0700)]
[sanitizer] Fix compilation on older systems
Fixes https://bugs.llvm.org/show_bug.cgi?id=47896
Artur Pilipenko [Tue, 20 Oct 2020 05:39:32 +0000 (22:39 -0700)]
Adding new Azul representative to security group
Adding myself as a new Azul representative to security group.
Differential Revision: https://reviews.llvm.org/D89287
Stella Laurenzo [Tue, 20 Oct 2020 05:29:35 +0000 (22:29 -0700)]
[mlir][Python] Add python binding to create DenseElementsAttribute.
* Interops with Python buffers/numpy arrays to create.
* Also cleans up 'get' factory methods on some types to be consistent.
* Adds mlirAttributeGetType() to C-API to facilitate error handling and other uses.
* Punts on a lot of features of the ElementsAttribute hierarchy for now.
* Does not yet support bool or string attributes.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D89363
Fangrui Song [Tue, 20 Oct 2020 05:17:32 +0000 (22:17 -0700)]
[gcov] Unify driver and CC1 option names for -ftest-coverage & -fprofile-arcs
No need to use -femit-coverage-notes and -femit-coverage-data.
Luqman Aden [Tue, 20 Oct 2020 05:10:27 +0000 (22:10 -0700)]
[COFF][ARM] Fix CodeView for Windows on 32bit ARM targets.
Create the LLVM / CodeView register mappings for the 32-bit ARM Window targets.
Reviewed By: compnerd
Differential Revision: https://reviews.llvm.org/D89622
Arthur Eubanks [Tue, 20 Oct 2020 05:05:01 +0000 (22:05 -0700)]
[NPM][PFOProfile] Fix some tests under NPM
Jonas Devlieghere [Tue, 20 Oct 2020 04:54:46 +0000 (21:54 -0700)]
Use LLVM_TOOLCHAIN_UTILITIES to allow utils to be installed in the toolchain
Make it possible to specify a list of utilities that should be installed
in the toolchain.
Differential revision: https://reviews.llvm.org/D89762
Fangrui Song [Tue, 20 Oct 2020 04:33:47 +0000 (21:33 -0700)]
[gcov] Delete CC1 option -test-coverage
The name is unfortunate because it is similar to the driver option -ftest-coverage.
It turns out aside from one occurrence in a test, this option is not used.
Jonas Devlieghere [Mon, 19 Oct 2020 21:29:59 +0000 (14:29 -0700)]
[FileCollector] Move interface into FileCollectorBase (NFC)
For the reproducers in LLDB we want to switch to an "immediate mode"
FileCollector that writes every file encountered straight to disk so we
can generate the actual mapping out-of-process. This patch moves the
interface into a separate base class.
Differential revision: https://reviews.llvm.org/D89742
Max Kazantsev [Mon, 19 Oct 2020 11:15:39 +0000 (18:15 +0700)]
[SCEV] Recommit "Use nw flag and symbolic iteration count to sharpen ranges of AddRecs", attempt 2
Fixed wrapping range case & proof methods reduced to constant range
checks to save compile time.
Differential Revision: https://reviews.llvm.org/D89381
Richard Smith [Tue, 20 Oct 2020 04:29:13 +0000 (21:29 -0700)]
Refactor tracking of constant initializers for variables.
Instead of framing the interface around whether the variable is an ICE
(which is only interesting in C++98), primarily track whether the
initializer is a constant initializer (which is interesting in all C++
language modes).
No functionality change intended.
Arthur Eubanks [Tue, 20 Oct 2020 04:24:03 +0000 (21:24 -0700)]
[NPM][StackSafetyAnalysis] Pin uses of -analyze to legacy PM
Tests already have corresponding NPM RUN lines.
Kai Luo [Tue, 20 Oct 2020 03:43:59 +0000 (03:43 +0000)]
[PowerPC] Add test case for missing `nsw` flag. NFC.
Serguei Katkov [Fri, 16 Oct 2020 07:23:02 +0000 (14:23 +0700)]
[IRCE] Do not transform if loop has small number of iterations
IRCE has some overhead for runtime checks and in case number of iteration is small
the overhead can kill the benefit from optimizations.
This CL bases on BlockFrequencyInfo of pre-header and header to estimate the
number of loop iterations. If it is less than irce-min-estimated-iters we do not transform the loop.
Probably it is better to make more complex cost model but for simplicity it seems the be enough.
The usage of BFI is added only for new pass manager and tries to use it efficiently.
Reviewers: ebrevnov, dantrushin, asbirlea, mkazantsev
Reviewed By: mkazantsev
Subscribers: llvm-commits, fhahn
Differential Revision: https://reviews.llvm.org/D89541
Geoffrey Martin-Noble [Tue, 20 Oct 2020 02:20:16 +0000 (19:20 -0700)]
Add llvm_unreachable to avoid MSVC warning
Without this I get a warning about not all paths returning.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D89760
Richard Smith [Tue, 20 Oct 2020 03:13:35 +0000 (20:13 -0700)]
Fixup clang-tidy after recent Clang change.
Lang Hames [Tue, 20 Oct 2020 02:53:38 +0000 (19:53 -0700)]
[ORC] Remove commented out methods accidentally left in in
069919c9ba3.
Thanks for spotting this Mehdi!
Qiu Chaofan [Tue, 20 Oct 2020 02:13:01 +0000 (10:13 +0800)]
[DAGCombiner] Tighten reasscociation of visitFMA
From LangRef, FMF contract should not enable reassociating to form
arbitrary contractions. So it should not help rearrange nodes like
(fma (fmul x, c1), c2, y) into (fma x, c1*c2, y).
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D89527
Richard Smith [Tue, 20 Oct 2020 02:01:48 +0000 (19:01 -0700)]
Ensure that checkInitIsICE is called exactly once for every variable
for which it matters.
This is a step towards separating checking for a constant initializer
(in which std::is_constant_evaluated returns true) and any other
evaluation of a variable initializer (in which it returns false).
Volodymyr Sapsai [Tue, 20 Oct 2020 01:25:35 +0000 (18:25 -0700)]
Revert "Reland "[Modules] Add stats to measure performance of building and loading modules.""
This reverts commit
4000c9ee18ecebe3ff0f197af8c1fb434ad986e5.
Test "LLVM :: Other/statistic.ll" is failing on Windows.
Wang, Pengfei [Tue, 20 Oct 2020 00:58:22 +0000 (08:58 +0800)]
[X86] Fix assert fail when element type is i1.
extract_vector_elt will turn type vxi1 into i8, which triggers the assertion fail.
Since we don't really handle vxi1 cases in below code, we can just return from here.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D89096
Douglas Yung [Tue, 20 Oct 2020 01:17:34 +0000 (18:17 -0700)]
Add option to use older clang ABI behavior when passing certain union types as function arguments
Recently commit D78699 (commit
26cfb6e562f1), fixed clang's behavior with respect
to passing a union type through a register to correctly follow the ABI. However,
this is an ABI breaking change with earlier versions of the clang compiler, so we
should add an -fclang-abi-compat option to address this. Additionally, the PS4 ABI
requires the older behavior, so that is added as well.
This change adds a Ver11 value to the ClangABI enum that when it is set (or the
target is the PS4 triple), we skip the ABI fix introduced in D78699.
Differential Revision: https://reviews.llvm.org/D89747
Kostya Kortchinsky [Mon, 19 Oct 2020 18:54:43 +0000 (11:54 -0700)]
[GWP-ASan] Cleanup (NFC)
Cleaning up some of the GWP-ASan code base:
- lots of headers didn't have the correct file name
- adding `#ifdef` guard to `utilities.h`
- correcting an `#ifdef` guard based on actual file name
- removing an extra `;`
- clang-format'ing the code (`-style=llvm`)
Differential Revision: https://reviews.llvm.org/D89721
Duncan P. N. Exon Smith [Wed, 14 Oct 2020 16:37:19 +0000 (12:37 -0400)]
clang/Lex: Stop using SourceManager::getBuffer
Update clang/lib/Lex to stop relying on a `MemoryBuffer*`, using the
`MemoryBufferRef` from `getBufferOrNone` since both locations had logic
for checking validity of the buffer. There's potentially a functionality
change, since the logic was wrong (it checked for `nullptr`, which was
never returned by the old API), but if that was reachable the new
behaviour should be better.
Differential Revision: https://reviews.llvm.org/D89402
Casey Carter [Mon, 19 Oct 2020 23:20:59 +0000 (16:20 -0700)]
[libc++][test] MSVC has no __PRETTY_FUNCTION__
Use `__FUNCSIG__` instead when compiling with MSVC. While we're touching `makeTypeIDImp`, remove the warning suppression for C4640 "construction of local static object is not thread safe" since C1XX now correctly constant-initializes `id`.
Casey Carter [Mon, 19 Oct 2020 22:43:11 +0000 (15:43 -0700)]
[libc++][test] Test nonconforming atomic_fetch_XXX overloads only on libc++
The Standard doesn't include the
```c++
template<class T>
T* atomic_fetch_meow(atomic<T*>, ...);
```
templates these tests are testing.
(See https://bugs.llvm.org/show_bug.cgi?id=47908)
Casey Carter [Mon, 19 Oct 2020 22:32:57 +0000 (15:32 -0700)]
[libc++][test] Silence MSVC "comparison of signed and unsigned" warning
Casey Carter [Mon, 19 Oct 2020 22:25:35 +0000 (15:25 -0700)]
[libc++][test] test allocator<const T> extension only on libc++
Casey Carter [Mon, 19 Oct 2020 22:24:50 +0000 (15:24 -0700)]
[libc++][test] Don't violate precondition [atomics.flag]/6
... which forbids passing `memory_order_release` or `memory_order_acq_rel` to either overload of `atomic_flag_test_explicit`.
Casey Carter [Mon, 19 Oct 2020 22:18:01 +0000 (15:18 -0700)]
[libc++][test] atomic<T> requires trivially copyable T
The author of these tests apparently forgot that `atomic_{,un}signed_lock_free` are already specializations of `atomic`.
Casey Carter [Mon, 19 Oct 2020 22:12:27 +0000 (15:12 -0700)]
[libc++][test] Pass correct ordering to std::merge
The predicate passed to `merge` must induce a strict weak ordering on its arguments.
Casey Carter [Mon, 19 Oct 2020 22:10:39 +0000 (15:10 -0700)]
[libc++][test] Spell "TEST_CONSTEXPR_CXX17" correctly
These three algorithm tests are incorrectly using `_LIBCPP_CONSTEXPR_AFTER_CXX17` instead of `TEST_CONSTEXPR_CXX17`.
Duncan P. N. Exon Smith [Tue, 20 Oct 2020 00:07:25 +0000 (20:07 -0400)]
lldb: Update for change in `clang::Lexer`'s constructor
b3eff6b7bb31e7ef059a3d238de138849839fbbd updated `Lexer::Lexer` to take
`clang::MemoryBufferRef` instead of `clang::MemoryBuffer*`. Update LLDB
to fix the bots.
Nico Weber [Tue, 20 Oct 2020 00:01:06 +0000 (20:01 -0400)]
Revert "[gn build] (manually) port
d09b08919ca"
This reverts commit
4d2d287a030fe81a5bf9d982ed8ea26fe3bcee6b.
d09b08919ca got reverted in
7ecd60bb702.
Volodymyr Sapsai [Mon, 19 Oct 2020 23:25:45 +0000 (16:25 -0700)]
[hmaptool] Fix `NameError: global name 'num_buckets' is not defined` in `action_dump`.
Jon Chesterfield [Mon, 19 Oct 2020 23:23:44 +0000 (00:23 +0100)]
[libomptarget][amdgcn] Implement missing symbols in deviceRTL
[libomptarget][amdgcn] Implement missing symbols in deviceRTL
Malloc, wtime are stubs. Malloc needs a hostrpc implementation which is
a work in progress, wtime needs some experimentation to find out the
multiplier to get a time in seconds as documentation is scarce.
Reviewed By: ronlieb
Differential Revision: https://reviews.llvm.org/D89725
Evgenii Stepanov [Mon, 19 Oct 2020 22:53:34 +0000 (15:53 -0700)]
Revert "[Sanitizers] Remove OpenBSD support" + 1
Revert "Fix compiler-rt build on Windows after D89640"
This reverts commit
a7acee89d68473183cc5021d952a56cdf0ae27d3.
This reverts commit
d09b08919ca6e206cd981fdea8b19b1d1188e325.
Reason: breaks Linux / x86_64 build.
Duncan P. N. Exon Smith [Wed, 14 Oct 2020 15:11:09 +0000 (11:11 -0400)]
Lexer: Update the Lexer to use MemoryBufferRef, NFC
Update `Lexer` / `Lexer::Lexer` to use `MemoryBufferRef` instead of
`MemoryBuffer*`. Callers that were acquiring a `MemoryBuffer*` via
`SourceManager::getBuffer` were updated, such that if they checked
`Invalid` they use `getBufferOrNone` and otherwise `getBufferOrFake`.
Differential Revision: https://reviews.llvm.org/D89398
Sean Silva [Mon, 19 Oct 2020 01:34:05 +0000 (18:34 -0700)]
[mlir] Use dynamic_tensor_from_elements in shape.broadcast conversion
Now, convert-shape-to-std doesn't internally create memrefs, which was
previously a bit of a layering violation. The conversion to memrefs
should logically happen as part of bufferization.
Differential Revision: https://reviews.llvm.org/D89669
Sean Silva [Mon, 19 Oct 2020 04:10:55 +0000 (21:10 -0700)]
[mlir][DialectConversion] Fix recursive `clone` calls.
The framework was not tracking ops created in any regions of the cloned
op.
Differential Revision: https://reviews.llvm.org/D89668
Sean Silva [Fri, 16 Oct 2020 22:57:27 +0000 (15:57 -0700)]
[mlir] Add std.dynamic_tensor_from_elements bufferization.
It's unfortunate that this requires adding a dependency on scf dialect
to std bufferization (and hence all of std transforms). This is a bit
perilous. We might want a lib/Transforms/Bufferize/ with a separate
bufferization library per dialect?
Differential Revision: https://reviews.llvm.org/D89667
Sean Silva [Fri, 16 Oct 2020 20:50:34 +0000 (13:50 -0700)]
[mlir] Add some more std bufferize patterns.
Add bufferizations for extract_element and tensor_from_elements.
Differential Revision: https://reviews.llvm.org/D89594
Volodymyr Sapsai [Mon, 19 Oct 2020 20:39:47 +0000 (13:39 -0700)]
Reland "[Modules] Add stats to measure performance of building and loading modules."
Measure amount of high-level or fixed-cost operations performed during
building/loading modules and during header search. High-level operations
like building a module or processing a .pcm file are motivated by
previous issues where clang was re-building modules or re-reading .pcm
files unnecessarily. Fixed-cost operations like `stat` calls are tracked
because clang cannot change how long each operation takes but it can
perform fewer of such operations to improve the compile time.
Also tracking such stats over time can help us detect compile-time
regressions. Added stats are more stable than the actual measured
compilation time, so expect the detected regressions to be less noisy.
On relanding drop stats in MemoryBuffer.cpp as their value is pretty low
but affects a lot of clients and many of those aren't interested in
modules and header search.
rdar://problem/
55715134
Reviewed By: aprantl, bruno
Differential Revision: https://reviews.llvm.org/D86895
Stanislav Mekhanoshin [Thu, 15 Oct 2020 21:57:34 +0000 (14:57 -0700)]
[AMDGPU] flat scratch ST addressing mode on gfx10
GFX10 enables third addressing mode for flat scratch instructions,
an ST mode. In that mode both register operands are omitted and
only swizzled offset is used in addition to flat_scratch base.
Differential Revision: https://reviews.llvm.org/D89501
Walter Erquinigo [Wed, 14 Oct 2020 17:25:39 +0000 (10:25 -0700)]
[trace] rename ThreadIntelPT into TraceTrace
Renamed ThreadIntelPT to TreaceThread, making it a top-level class. I noticed that this class can and shuld work for any trace plugin and there's nothing intel-pt specific in it.
With that TraceThread change, I was able to move most of the json file parsing logic to the base class TraceSessionFileParser, which makes adding new plug-ins easier.
This originally was part of https://reviews.llvm.org/D89283
Differential Revision: https://reviews.llvm.org/D89408
Jordan Rupprecht [Mon, 19 Oct 2020 22:11:37 +0000 (15:11 -0700)]
[NFC] Inline assertion-only variable
Sergei Trofimovich [Mon, 19 Oct 2020 21:51:12 +0000 (22:51 +0100)]
[VE] Fix initializer visibility
Before the change attempt to link libLTO.so against shared
LLVM library failed as:
```
[ 76%] Linking CXX shared library ../../lib/libLTO.so
... /usr/bin/cmake -E cmake_link_script CMakeFiles/LTO.dir/link.txt --verbose=1
c++ -o ...libLTO.so.12git ...ibLLVM-12git.so
ld: CMakeFiles/LTO.dir/lto.cpp.o: in function `llvm::InitializeAllTargetInfos()':
include/llvm/Config/Targets.def:31: undefined reference to `LLVMInitializeVETargetInfo'
```
It happens because on linux llvm build system sets default
symbol visibility to "hidden". The fix is to set visibility
back to "default" for exported APIs with LLVM_EXTERNAL_VISIBILITY.
Bug: https://bugs.llvm.org/show_bug.cgi?id=47847
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D89633
Yaxun (Sam) Liu [Wed, 23 Sep 2020 22:00:23 +0000 (18:00 -0400)]
Recommit "[CUDA][HIP] Defer overloading resolution diagnostics for host device functions"
This recommits
7f1f89ec8d9944559042bb6d3b1132eabe3409de and
40df06cdafc010002fc9cfe1dda73d689b7d27a6 with bug fixes for
memory sanitizer failure and Tensile build failure.
Yaxun (Sam) Liu [Wed, 23 Sep 2020 20:16:00 +0000 (16:16 -0400)]
[NFC] Refactor DiagnosticBuilder and PartialDiagnostic
PartialDiagnostic misses some functions compared to DiagnosticBuilder.
This patch refactors DiagnosticBuilder and PartialDiagnostic, extracts
the common functionality so that the streaming << operators are
shared.
Differential Revision: https://reviews.llvm.org/D84362
Amy Huang [Mon, 19 Oct 2020 21:31:17 +0000 (14:31 -0700)]
[NPM] Port module-debuginfo pass to the new pass manager
Port pass to NPM and update tests in DebugInfo/Generic.
Differential Revision: https://reviews.llvm.org/D89730
Roman Lebedev [Mon, 19 Oct 2020 19:28:44 +0000 (22:28 +0300)]
[NFCI][SCEV] Always refer to enum SCEVTypes as enum, not integer
The main tricky thing here is forward-declaring the enum:
we have to specify it's underlying data type.
In particular, this avoids the danger of switching over the SCEVTypes,
but actually switching over an integer, and not being notified
when some case is not handled.
I have updated most of such switches to be exaustive and not have
a default case, where it's pretty obvious to be the intent,
however not all of them.
Roman Lebedev [Mon, 19 Oct 2020 20:41:26 +0000 (23:41 +0300)]
[NFC][SCEV] BuildConstantFromSCEV(): reformat, NFC
Makes diff in next commit more readable
Roman Lebedev [Mon, 19 Oct 2020 19:39:55 +0000 (22:39 +0300)]
[NFC][SCEVExpander] isHighCostExpansionHelper(): rewrite as a switch
If we switch over an enum, compiler can easily issue a diagnostic
if some case is not handled. However with an if cascade that isn't so.
Experimental evidence suggests new behavior to be superior.
Dávid Bolvanský [Mon, 19 Oct 2020 21:08:27 +0000 (23:08 +0200)]
[Intrinsics] Added writeonly attribute to the first arg of llvm.memmove
D18714 introduced writeonly attribute:
"Also start using the attribute for memset, memcpy, and memmove intrinsics,
and remove their special-casing in BasicAliasAnalysis."
But actually, writeonly was not attached to memmove - oversight, it seems.
So let's add it. As we can see, this helps DSE to eliminate redundant stores.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D89724
Martin Storsjö [Sun, 18 Oct 2020 20:19:29 +0000 (23:19 +0300)]
[libcxx] [test] Use _putenv instead of setenv/unsetenv on windows
Move the functions to the helper header and keep the arch specific
logic there.
Differential Revision: https://reviews.llvm.org/D89681
Martin Storsjö [Sun, 18 Oct 2020 19:47:50 +0000 (22:47 +0300)]
[libcxx] [test] Fix all remaining issues with fs::path::string_type being wstring
Use fs::path as variable type instead of std::string, when the input
potentially is a path, as they can't be implicitly converted back to
string.
Differential Revision: https://reviews.llvm.org/D89674
Martin Storsjö [Tue, 13 Oct 2020 18:42:31 +0000 (21:42 +0300)]
[libcxx] [test] Fix filesystem_test_helper.h to compile for windows
Use .string() instead of .native() in places where we want to combine
paths with std::string.
Convert some methods to take a fs::path as parameter instead of
std::string, for cases where they are called with paths as
parameters (which can't be implicitly converted to std::string if
the path's string_type is wstring).
Differential Revision: https://reviews.llvm.org/D89530
Martin Storsjö [Mon, 19 Oct 2020 08:44:19 +0000 (11:44 +0300)]
[libcxx] [test] Mark tests that require specific allocation behaviours as libcpp only
This fixes/silences a few failures on libstdc++ on linux.
Differential Revision: https://reviews.llvm.org/D89676
Martin Storsjö [Mon, 19 Oct 2020 08:07:31 +0000 (11:07 +0300)]
[libcxx] [test] Exclude domain socket tests on windows, like bsd/darwin
Differential Revision: https://reviews.llvm.org/D89673
Martin Storsjö [Mon, 19 Oct 2020 07:58:31 +0000 (10:58 +0300)]
[libcxx] [test] Add LIBCPP_ONLY() around another test for an implementation detail
Differential Revision: https://reviews.llvm.org/D89675
Martin Storsjö [Mon, 19 Oct 2020 08:46:08 +0000 (11:46 +0300)]
[libcxx] [test] Don't require fs::path::operator(string_type&&) to be noexcept
Mark this as a libcpp specific test; the standard doesn't say that
this method should be noexcept.
Differential Revision: https://reviews.llvm.org/D89677
Martin Storsjö [Mon, 19 Oct 2020 08:46:58 +0000 (11:46 +0300)]
[libcxx] [test] Allow fs::permissions(path, perms, perm_options, error_code) to be noexcept
The standard doesn't declare this overload as noexcept, but doesn't
either say that it strictly cannot be noexcept either. The function
doesn't throw on errors that are signaled via error_code, but the
standard says that it may throw a bad_alloc.
This fixes an error with libstdc++ on linux.
Differential Revision: https://reviews.llvm.org/D89678
Martin Storsjö [Mon, 19 Oct 2020 08:49:17 +0000 (11:49 +0300)]
[libcxx] [test] Do error printfs to stderr in filesystems tests
This makes them more readable in llvm-lit's output on failures.
This only applies the change on the filesystem test subdir.
Differential Revision: https://reviews.llvm.org/D89680
Martin Storsjö [Mon, 19 Oct 2020 13:10:18 +0000 (16:10 +0300)]
[clang] Automatically link against oldnames just as linking against libcmt
Differential Revision: https://reviews.llvm.org/D89702
Duncan P. N. Exon Smith [Wed, 14 Oct 2020 16:58:19 +0000 (12:58 -0400)]
clang/{Format,Rewrite}: Stop using SourceManager::getBuffer, NFC
Update clang/lib/Format and clang/lib/Rewrite to use a `MemoryBufferRef`
from `getBufferOrFake` instead of `MemoryBuffer*` from `getBuffer`.
No functionality change here, since the call sites weren't checking if
the buffer was valid.
Differential Revision: https://reviews.llvm.org/D89406
Evgenii Stepanov [Thu, 15 Oct 2020 23:10:42 +0000 (16:10 -0700)]
Add alloca size threshold for StackTagging initializer merging.
Summary:
Initializer merging generates pretty inefficient code for large allocas
that also happens to trigger an exponential algorithm somewhere in
Machine Instruction Scheduler. See https://bugs.llvm.org/show_bug.cgi?id=47867.
This change adds an upper limit for the alloca size. The default limit
is selected such that worst case size of memtag-generated code is
similar to non-memtag (but because of the ISA quirks, this case is
realized at the different value of alloca size, ex. memset inlining
triggers at sizes below 512, but stack tagging instructions are 2x
shorter, so limit is approx. 256).
We could try harder to emit more compact code with initializer merging,
but that would only affect large, sparsely initialized allocas, and
those are doing fine already.
Reviewers: vitalybuka, pcc
Subscribers: llvm-commits
Arthur Eubanks [Mon, 19 Oct 2020 20:09:39 +0000 (13:09 -0700)]
[test][NPM] Fix already-vectorized.ll under NPM
The NPM runs SpeculateAroundPHIs which breaks critical edges, causing a
branch we check for to not directly jump back to the same block.
Craig Topper [Mon, 19 Oct 2020 19:03:04 +0000 (12:03 -0700)]
[SelectionDAG][X86] Enable SimplifySetCC CTPOP transforms for vector splats
This enables these transforms for vectors:
(ctpop x) u< 2 -> (x & x-1) == 0
(ctpop x) u> 1 -> (x & x-1) != 0
(ctpop x) == 1 --> (x != 0) && ((x & x-1) == 0)
(ctpop x) != 1 --> (x == 0) || ((x & x-1) != 0)
All enabled if CTPOP isn't Legal. This differs from the scalar
behavior where the first two are done unconditionally and the
last two are done if CTPOP isn't Legal or Custom. The Legal
check produced better results for vectors based on X86's
custom handling. Might be worth re-visiting scalars here.
I disabled the looking through truncate for vectors. The
code that creates new setcc can use the same result VT as the
original setcc even if we truncated the input. That may work
work for most scalars, but definitely wouldn't work for vectors
unless it was a vector of i1.
Fixes or at least improves PR47825
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D89346
Craig Topper [Mon, 19 Oct 2020 18:50:47 +0000 (11:50 -0700)]
[X86] Add i32->float and i64->double bitcast pseudo instructions to store folding table.
We have pseudo instructions we use for bitcasts between these types.
We have them in the load folding table, but not the store folding
table. This adds them there so they can be used for stack spills.
I added an exact size check so that we don't fold when the stack slot
is larger than the GPR. Otherwise the upper bits in the stack slot
would be garbage. That would be fine for Eli's test case in PR47874,
but I'm not sure its safe in general.
A step towards fixing PR47874. Next steps are to change the ADDSSrr_Int
pseudo instructions to use FR32 as the second source register class
instead of VR128. That will keep the coalescer from promoting the
register class of the bitcast instruction which will make the stack
slot 4 bytes instead of 16 bytes.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D89656
Matt Arsenault [Sat, 17 Oct 2020 14:12:30 +0000 (10:12 -0400)]
Fix typo
Lang Hames [Mon, 19 Oct 2020 18:55:08 +0000 (11:55 -0700)]
[ORC] Fix a missing include.
Arthur Eubanks [Mon, 19 Oct 2020 19:04:31 +0000 (12:04 -0700)]
[NPM][test] Fix some LoopVectorize tests under NPM