Commit Graph

369448 Commits

Author SHA1 Message Date
Alex Zinenko 39613c2cbc [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
2020-10-20 09:39:08 +02:00
Atmn Patel 595c615606 [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
2020-10-20 03:09:57 -04:00
Richard Smith 08c8d5bc51 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.
2020-10-19 23:59:11 -07:00
Igor Kudrin 1329944c22 [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
2020-10-20 13:32:16 +07:00
Fangrui Song 2484e9159c [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.
2020-10-19 23:06:33 -07:00
Vitaly Buka f97ca48b1c [sanitizer] Fix compilation on older systems
Fixes https://bugs.llvm.org/show_bug.cgi?id=47896
2020-10-19 22:45:51 -07:00
Artur Pilipenko 037ef7d70c Adding new Azul representative to security group
Adding myself as a new Azul representative to security group.

Differential Revision: https://reviews.llvm.org/D89287
2020-10-19 22:41:19 -07:00
Stella Laurenzo 0e6beb2996 [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
2020-10-19 22:29:35 -07:00
Fangrui Song 545c687c4b [gcov] Unify driver and CC1 option names for -ftest-coverage & -fprofile-arcs
No need to use -femit-coverage-notes and -femit-coverage-data.
2020-10-19 22:19:00 -07:00
Luqman Aden 51892a42da [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
2020-10-19 22:16:16 -07:00
Arthur Eubanks 7e9411efcf [NPM][PFOProfile] Fix some tests under NPM 2020-10-19 22:06:10 -07:00
Jonas Devlieghere 024921a5e1 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
2020-10-19 22:01:28 -07:00
Fangrui Song 0ab222e7d7 [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.
2020-10-19 21:48:51 -07:00
Jonas Devlieghere f44fb13025 [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
2020-10-19 21:37:20 -07:00
Max Kazantsev a10a64e7e3 [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
2020-10-20 11:32:36 +07:00
Richard Smith 3692d20d2b 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.
2020-10-19 21:31:19 -07:00
Arthur Eubanks 0f0ff33037 [NPM][StackSafetyAnalysis] Pin uses of -analyze to legacy PM
Tests already have corresponding NPM RUN lines.
2020-10-19 21:24:03 -07:00
Kai Luo 638fee625d [PowerPC] Add test case for missing `nsw` flag. NFC. 2020-10-20 03:47:49 +00:00
Serguei Katkov 38799975ce [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
2020-10-20 10:33:59 +07:00
Geoffrey Martin-Noble ad0b2d9d46 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
2020-10-19 20:29:33 -07:00
Richard Smith c7a7bba8c1 Fixup clang-tidy after recent Clang change. 2020-10-19 20:13:56 -07:00
Lang Hames 1044dfa7ed [ORC] Remove commented out methods accidentally left in in 069919c9ba.
Thanks for spotting this Mehdi!
2020-10-19 19:55:03 -07:00
Qiu Chaofan 1b2fe71ecf [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
2020-10-20 10:13:01 +08:00
Richard Smith 76c0092665 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).
2020-10-19 19:04:04 -07:00
Volodymyr Sapsai a28678e20a Revert "Reland "[Modules] Add stats to measure performance of building and loading modules.""
This reverts commit 4000c9ee18.

Test "LLVM :: Other/statistic.ll" is failing on Windows.
2020-10-19 18:27:30 -07:00
Wang, Pengfei 3a85472af2 [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
2020-10-20 09:26:32 +08:00
Douglas Yung 774ab60125 Add option to use older clang ABI behavior when passing certain union types as function arguments
Recently commit D78699 (commit 26cfb6e562), 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
2020-10-19 18:17:34 -07:00
Kostya Kortchinsky ae9d040028 [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
2020-10-19 18:13:11 -07:00
Duncan P. N. Exon Smith b03ae74319 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
2020-10-19 20:27:56 -04:00
Casey Carter a668ad92d5 [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`.
2020-10-19 17:20:47 -07:00
Casey Carter 7f82352a2c [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)
2020-10-19 17:19:52 -07:00
Casey Carter f92d874fe5 [libc++][test] Silence MSVC "comparison of signed and unsigned" warning 2020-10-19 17:18:44 -07:00
Casey Carter d5971a63ca [libc++][test] test allocator<const T> extension only on libc++ 2020-10-19 17:14:51 -07:00
Casey Carter 877766573b [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`.
2020-10-19 17:14:01 -07:00
Casey Carter dccc742c22 [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`.
2020-10-19 17:13:18 -07:00
Casey Carter fce9ca3c1e [libc++][test] Pass correct ordering to std::merge
The predicate passed to `merge` must induce a strict weak ordering on its arguments.
2020-10-19 17:12:06 -07:00
Casey Carter 24ab5787b4 [libc++][test] Spell "TEST_CONSTEXPR_CXX17" correctly
These three algorithm tests are incorrectly using `_LIBCPP_CONSTEXPR_AFTER_CXX17` instead of `TEST_CONSTEXPR_CXX17`.
2020-10-19 17:11:26 -07:00
Duncan P. N. Exon Smith f96e16bc15 lldb: Update for change in `clang::Lexer`'s constructor
b3eff6b7bb updated `Lexer::Lexer` to take
`clang::MemoryBufferRef` instead of `clang::MemoryBuffer*`. Update LLDB
to fix the bots.
2020-10-19 20:09:27 -04:00
Nico Weber 6ca3dd9735 Revert "[gn build] (manually) port d09b08919ca"
This reverts commit 4d2d287a03.
d09b08919c got reverted in 7ecd60bb70.
2020-10-19 20:01:06 -04:00
Volodymyr Sapsai 34ccc3e13b [hmaptool] Fix `NameError: global name 'num_buckets' is not defined` in `action_dump`. 2020-10-19 16:27:13 -07:00
Jon Chesterfield d27b39ce11 [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
2020-10-20 00:24:15 +01:00
Evgenii Stepanov 7ecd60bb70 Revert "[Sanitizers] Remove OpenBSD support" + 1
Revert "Fix compiler-rt build on Windows after D89640"

This reverts commit a7acee89d6.
This reverts commit d09b08919c.

Reason: breaks Linux / x86_64 build.
2020-10-19 16:11:21 -07:00
Duncan P. N. Exon Smith b3eff6b7bb 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
2020-10-19 19:10:21 -04:00
Sean Silva 57211fd239 [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
2020-10-19 15:51:46 -07:00
Sean Silva 7885bf8b78 [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
2020-10-19 15:51:46 -07:00
Sean Silva f4abd3ed6d [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
2020-10-19 15:51:45 -07:00
Sean Silva e3f5073a96 [mlir] Add some more std bufferize patterns.
Add bufferizations for extract_element and tensor_from_elements.

Differential Revision: https://reviews.llvm.org/D89594
2020-10-19 15:51:45 -07:00
Volodymyr Sapsai 4000c9ee18 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
2020-10-19 15:44:11 -07:00
Stanislav Mekhanoshin 6ddadf9901 [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
2020-10-19 15:29:52 -07:00
Walter Erquinigo 8a203bb22d [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
2020-10-19 15:15:02 -07:00