439279 Commits

Author SHA1 Message Date
wren romano
e0401d2252 [mlir][sparse] Removing the DimLvlType and DimLevelFormat types
This removes another massive source of redundancy, and instead has the Merger.{h,cpp} reuse the SparseTensorEnums library.

Depends On D136005

Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D136123
2022-10-18 15:47:40 -07:00
Quentin Colombet
98c529652a [mlir][MemRef] Move the forwarding patterns for extract_strided_metadata
The `SimplifyExtractStridedMetadata` pass features a pattern that forward
statically known information (offset, sizes, strides) to their respective
users.

This patch moves this pattern from this pass to the
`extract_strided_metadata` folding patterns.

Differential Revision: https://reviews.llvm.org/D135797
2022-10-18 22:34:50 +00:00
Sam McCall
25bac38a02 [include-cleaner] Add line numbers to HTML output 2022-10-19 00:21:33 +02:00
wren romano
062f29c8d0 [mlir][sparse] Moving Enums.h into Dialect/SparseTensor/IR
Move the SparseTensorEnums library out of the ExecutionEngine directory and into Dialect/SparseTensor/IR.

Depends On D136002

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D136005
2022-10-18 15:15:18 -07:00
Siva Chandra Reddy
67957368ae [libc] Add implementation of sigaltstack for linux.
Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D135949
2022-10-18 22:04:30 +00:00
jinge90
09dcb933ef [CMake] Fix LIBUNWIND_ENABLE_CET build after D110005
D110005 renamed LIBUNWIND_SUPPORTS_* to CXX_SUPPORTS_*.

Reviewed By: MaskRay, #libunwind, mstorsjo

Differential Revision: https://reviews.llvm.org/D136131
2022-10-18 15:00:09 -07:00
Joseph Huber
037669de8b [clang-format] Do not parse certain characters in pragma directives
Currently, we parse lines inside of a compiler `#pragma` the same way we
parse any other line. This is fine for some cases, like separating
expressions and adding proper spacing, but in others it causes some poor
results from miscategorizing some tokens.

For example, the OpenMP offloading uses certain clauses that contain
special characters like `map(tofrom : A[0:N])`. This will be formatted
poorly as it will be split between lines on the first colon.
Additionally the subscript notation will lead to poor spacing. This can
be seen in the OpenMP tests as the automatic clang formatting with
inevitably ruin the formatting.

For example, the following contrived example will be formatted poorly.
```
#pragma omp target teams distribute collapse(2) map(to: A[0 : M * K])  \
    map(to: B[0:K * N]) map(tofrom:C[0:M*N]) firstprivate(Alpha) \
    firstprivate(Beta) firstprivate(X) firstprivate(D) firstprivate(Y) \
    firstprivate(E) firstprivate(Z) firstprivate(F)
```
This results in this when formatted, which is far from ideal.
```
#pragma omp target teams distribute collapse(2) map(to                         \
                                                    : A [0:M * K])             \
    map(to                                                                     \
        : B [0:K * N]) map(tofrom                                              \
                           : C [0:M * N]) firstprivate(Alpha)                  \
        firstprivate(Beta) firstprivate(X) firstprivate(D) firstprivate(Y)     \
            firstprivate(E) firstprivate(Z) firstprivate(F)
```

This patch seeks to improve this by adding extra logic where the parsing goes
awry. This is primarily caused by the colon being parsed as an inline-asm
directive and the brackes an objective-C expressions. Also the line gets
indented every single time the line is dropped.

This doesn't implement true parsing handling for OpenMP statements.

Reviewed By: HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D136100
2022-10-18 16:38:19 -05:00
Joseph Huber
8c1449a84d [OpenMP] Make kernels have protected visibility
This patch changes the kernels generated by OpenMP to have protected
visibility. This is unlikely to change anything functionally. However,
protected visibility better matches the behaviour of these GPU kernels.
We do not expect any pending shared library load to preempt these
kernels so we can specify a more restrictive visibility.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D136198
2022-10-18 16:37:28 -05:00
Jez Ng
316d4f96f2 [lld-macho] Folded symbols should have size zero in linker map
This matches ld64's behavior.

I also extended the icf-stabs.s test to demonstrate that even though
folded symbols have size zero, we cannot use the size-zero property in
lieu of `wasIdenticalCodeFolded`, because size zero symbols should still
get STABS entries.

Reviewed By: #lld-macho, thakis

Differential Revision: https://reviews.llvm.org/D136001
2022-10-18 17:22:10 -04:00
Jez Ng
16d784159f [lld-macho] Don't fold subsections with symbols at nonzero offsets
Symbols occur at non-zero offsets in a subsection if they are
`.alt_entry` symbols, or if `.subsections_via_symbols` is omitted.

It doesn't seem like ld64 supports folding those subsections either.
Moreover, supporting this it makes `foldIdentical` a lot more
complicated to implement. The existing implementation has some
questionable behavior around STABS omission -- if a section with an
non-zero offset symbol was folded into one without, we would omit the
STABS entry for the non-zero offset symbol.

I will be following up with a diff that makes `foldIdentical` zero out
the symbol sizes for folded symbols. Again, this is much easier to
implement if we don't have to worry about non-zero offsets.

Reviewed By: #lld-macho, oontvoo

Differential Revision: https://reviews.llvm.org/D136000
2022-10-18 17:22:09 -04:00
wren romano
181b04d276 [mlir][sparse] Factoring out SparseTensorEnums library
This differential splits the SparseTensorEnums library out from the SparseTensorRuntime library. The actual moving of files will be handled in the next differential.

Depends On D135996

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D136002
2022-10-18 14:20:33 -07:00
Aart Bik
d22df0ebba [mlir][sparse] refine insertion code
builds SSA cycle for compress insertion loop
adds casting on index mismatch during push_back

Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D136186
2022-10-18 14:16:38 -07:00
Arthur Eubanks
3e8eff3747 [opt] Don't initialize legacy instrumentation passes
So that we require `opt -passes=` syntax for instrumentation passes.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D135042
2022-10-18 14:04:31 -07:00
Siva Chandra Reddy
18daa8255a [libc][Obvious] Skip some termios tests when there no is /dev/tty. 2022-10-18 20:58:50 +00:00
Walter Erquinigo
f1e63855b0 [lldb][trace] Add a basic function call dump [3] - Add a JSON dumper
The JSON dumper is very minimalistic. It pretty much only shows the
delimiting instruction IDs of every segment, so that further queries to
the SBCursor can be used to make sense of the data. It's main purpose is
to be serialized somewhat cheaply.

I also renamed untracedSegment to untracedPrefixSegment, in case in the
future we add an untracedSuffixSegment. In any case, this new name is
more explicit, which I like.

Differential Revision: https://reviews.llvm.org/D136034
2022-10-18 13:57:53 -07:00
Walter Erquinigo
840d861d6e [lldb][trace] Add a basic function call dump [2] - Implement the reconstruction algorithm
This diff implements the reconstruction algorithm for the call tree and
add tests.

See TraceDumper.h for documentation and explanations.

One important detail is that the tree objects are in TraceDumper, even
though Trace.h is a better home. I'm leaving that as future work.

Another detail is that this code is as slow as dumping the entire
symolicated trace, which is not that bad tbh. The reason is that we use
symbols throughout the algorithm and we are not being careful about
memory and speed. This is also another area for future improvement.

Lastly, I made sure that incomplete traces work, i.e. you start tracing
very deep in the stack or failures randomly appear in the trace.

Differential Revision: https://reviews.llvm.org/D135917
2022-10-18 13:57:53 -07:00
Walter Erquinigo
566146c03b [lldb][trace] Add a basic function call dumpdump [1] - Add the command scaffolding
The command is thread trace dump function-calls and as minimum will
require printing to a file in json and non-json format

I added a test

Differential Revision: https://reviews.llvm.org/D135521
2022-10-18 13:57:52 -07:00
Siva Chandra Reddy
b2a294bcf8 [libc] Add termios.h and the implementation of functions declared in it.
Reviewed By: lntue, michaelrj

Differential Revision: https://reviews.llvm.org/D136143
2022-10-18 20:53:00 +00:00
Maksim Panchenko
bcc4c90954 [BOLT] Fix instruction encoding validation
Always use non-symbolizing disassembler for instruction encoding
validation as symbols will be treated as undefined/zeros be the encoder
and causing byte sequence mismatches.

Reviewed By: Amir

Differential Revision: https://reviews.llvm.org/D136118
2022-10-18 13:50:00 -07:00
Paul Pluzhnikov
5b773dcd2d Fix incorrect check for running out of source locations.
When CurrentLoadedOffset is less than TotalSize, current code will
trigger unsigned overflow and will not return an "allocation failed"
indicator.

Google ref: b/248613299

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D135192
2022-10-18 20:48:00 +00:00
wren romano
0e77b63bc0 [mlir][sparse] Use the runtime DimLevelType instead of a separate tablegen enum
This differential replaces all uses of SparseTensorEncodingAttr::DimLevelType with DimLevelType.  The next differential will break out a separate library for the DimLevelType enum, so that the Dialect code doesn't need to depend on the rest of the runtime

Depends On D135995

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D135996
2022-10-18 13:45:26 -07:00
Nico Weber
4481057d4c [clang] Move variable declaration closer to use
...and add some whitespace to delimit the three logical steps done in this
function.

No behavior change.
2022-10-18 16:40:46 -04:00
Nancy Wang
8266eefd91 [SystemZ][z/OS][libcxx]: fix the mask in stage2_float_loop function
This patch is to fix issue related to __stage2_float_loop function, float point value comparison is not working on EBCDIC mode because the mask is hard-coded and assumes character is ASCII, fix is to use toupper function when do the comparison.

Differential Revision: https://reviews.llvm.org/D118930
2022-10-18 15:56:18 -04:00
Quentin Colombet
df455beedf [mlir][MemRef] Fix the simplification of extract_strided_metadata(subview)
Prior to this patch we were wrongly applying the sub-strides to the
computation of the final offset of the subview.

Put differently, we were computing the offset as:
```
offset = baseOffset + sum(subOffset#i * baseStrides#i * subSizes#i)
```
Whereas we should be doing:
```
offset = baseOffset + sum(subOffset#i * baseStrides#i)
```
I.e., drop the subSizes#i term from the sum.

Differential Revision: https://reviews.llvm.org/D136107
2022-10-18 19:29:49 +00:00
LLVM GN Syncbot
0bfd900150 [gn build] Port 594fa1474f0c 2022-10-18 19:15:31 +00:00
wren romano
d9affadd00 [mlir][sparse] rename the values of the runtime DimLevelType
This change is to make way for reusing the DimLevelType enum in lieu of the SparseTensorEncodingAttr::DimLevelType enum, but broken out to make it quick and easy to review

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D135995
2022-10-18 12:08:19 -07:00
Yuanfang Chen
340eac01f7 [C++20] Implement P2113R0: Changes to the Partial Ordering of Constrained Functions
This implementation matches GCC behavior in that [[ https://eel.is/c++draft/temp.func.order#6.2.1 | temp.func.order p6.2.1 ]] is not implemented [1]. I reached out to the GCC author to confirm that some changes elsewhere to overload resolution are probably needed, but no solution has been developed sufficiently [3].

Most of the wordings are implemented straightforwardly. However,
for [[ https://eel.is/c++draft/temp.func.order#6.2.2 | temp.func.order p6.2.2 ]] "... or if the function parameters that positionally correspond between the two templates are not of the same type", the "same type" is not very clear ([2] is a bug related to this). Here is a quick example
```
template <C T, C U>        int f(T, U);
template <typename T, C U> int f(U, T);

int x = f(0, 0);
```
Is the `U` and `T` from different `f`s the "same type"? The answer is NO even though both `U` and `T` are deduced to be `int` in this case. The reason is that `U` and `T` are dependent types, according to [[ https://eel.is/c++draft/temp.over.link#3 |  temp.over.link p3 ]], they can not be the "same type".

To check if two function parameters are the "same type":
* For //function template//: compare the function parameter canonical types and return type between two function templates.
* For //class template/partial specialization//: by [[ https://eel.is/c++draft/temp.spec.partial.order#1.2 | temp.spec.partial.order p1.2 ]], compare the injected template arguments between two templates using hashing(TemplateArgument::Profile) is enough.

[1] https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=57b4daf8dc4ed7b669cc70638866ddb00f5b7746
[2] https://github.com/llvm/llvm-project/issues/49308
[3] https://lists.isocpp.org/core/2020/06/index.php#msg9392

Fixes https://github.com/llvm/llvm-project/issues/54039
Fixes https://github.com/llvm/llvm-project/issues/49308 (PR49964)

Reviewed By: royjacobson, #clang-language-wg, mizvekov

Differential Revision: https://reviews.llvm.org/D128750
2022-10-18 11:58:57 -07:00
Mark de Wever
9f8340eff3 [libc++][chrono] Fixes build.
Changes in D134742 were not properly propagated to D136037 before
landing.
2022-10-18 20:57:54 +02:00
Alexey Bataev
087dadfd37 [SLP]Generalize cost model.
Generalized the cost model estimation. Improved cost model estimation
for repeated scalars (no need to count their cost anymore), improved
  cost model for extractelement instructions.

cpu2017
   511.povray_r             0.57
   520.omnetpp_r           -0.98
   521.wrf_r               -0.01
   525.x264_r               3.59 <+
   526.blender_r           -0.12
   531.deepsjeng_r         -0.07
   538.imagick_r           -1.42
Geometric mean:  0.21

Differential Revision: https://reviews.llvm.org/D115757
2022-10-18 11:55:59 -07:00
Yuanfang Chen
6bca52be03 [Clang] update cxx_dr_status.html by running make_cxx_dr_status
For https://github.com/llvm/llvm-project/issues/58382

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D136133
2022-10-18 11:45:40 -07:00
Eli Friedman
d6481dc88c [AArch64][Windows] Add MC support for save_any_reg.
Representing this as 12 separate operations is a bit ugly, but
trying to represent the different modes using a bitfield seemed worse.

Differential Revision: https://reviews.llvm.org/D135417
2022-10-18 11:45:27 -07:00
Mark de Wever
566868cd82 [libc++][chrono] Implements formatter weekday.
Partially implements:
- P1361 Integration of chrono with text formatting
- P2372 Fixing locale handling in chrono formatters

Depends on D134742

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D136037
2022-10-18 20:40:06 +02:00
Mark de Wever
719c3dc6f2 [libc++][chrono] Implements formatter duration.
Partially implements:
- P1361 Integration of chrono with text formatting
- P2372 Fixing locale handling in chrono formatters
- LWG3270 Parsing and formatting %j with durations

Completes:
- P1650R0 std::chrono::days with 'd' suffix
- LWG3262 Formatting of negative durations is not specified
- LWG3314 Is stream insertion behavior locale dependent when Period::type is micro?

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D134742
2022-10-18 20:39:39 +02:00
Hui Xie
594fa1474f [libc++][ranges] implement std::ranges::drop_while_view
Differential Revision: https://reviews.llvm.org/D135460
2022-10-18 19:34:47 +01:00
Alexey Bataev
62267e8de0 Revert "[SLP]Generalize cost model."
This reverts commit f12fb91188b836e1bddb36bacbbdb8e4ab70b9b6 and
f5c747bfbe36b8f53e6fe2d85ffcaecba6d7153c to fix detected non-initialized
var use.
2022-10-18 11:25:59 -07:00
Sjoerd Meijer
f7c42a278b Revert "Recommit "[LoopFlatten] Enable it by default""
This reverts commit 5b9597f59a445523bd59b5251ab1c2865e74919f.

A miscompilation was reported:
https://github.com/llvm/llvm-project/issues/58441

Reverting this while I look at that.
2022-10-18 23:36:36 +05:30
Felipe de Azevedo Piovezan
3dfc39db58 Revert "[lldb-tests] Remove dubious standard library flag"
This reverts commit f477412685fe6bac49d3d080ba91896c28e62116.
2022-10-18 13:59:29 -04:00
Valentin Clement
87b2d1d04e
[flang] Add getTypeDescriptorBindingTableName function
Type descriptor and its binding table are defined as fir.global in FIR.
Their names are derived from the derived-type name. This patch adds a new
function `getTypeDescriptorBindingTableName` in the NameUniquer and
refactor the `GetTypeDescriptorName` function to reuse the same code.
This will be used in the fir.dispatch code generation.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D136167
2022-10-18 19:55:55 +02:00
Felipe de Azevedo Piovezan
f477412685 [lldb-tests] Remove dubious standard library flag
The test currently sets `USE_LIBSTDCPP = 0`, which is curious given the
behavior of `and` and `or` in Makefiles (the contents of the variables
are not important). In particular, this causes the tests to not use the
standard libraries appropriately.

To capture the actual intent of the test, we're changing this to
`USE_LIBCXX=1`.

Differential Revision: https://reviews.llvm.org/D136171
2022-10-18 13:50:31 -04:00
Felipe de Azevedo Piovezan
58a25ebb86 [lldb-tests] Add libcxx version check for regex tests
Regex requires the c++20 flag, which was not introduced available prior
to Clang 11.

Differential Revision: https://reviews.llvm.org/D136165
2022-10-18 13:49:19 -04:00
Felipe de Azevedo Piovezan
3c1d8e06d4 [lldb-tests] Add compiler version check in TestFunctionStarts
This test requires compiling its input program without debug
information. To do so, it uses certain Makefile variables that are never
populated with custom libcxx paths (if present). Doing so would not
necessarily be correct: we cannot guarantee that said standard library
has no debug symbols.

As such, we keep using the system libraries but disable the tests in
clang versions that are too old to work with more modern system
libraries, as in the case of the lldb-matrix bot.

Differential Revision: https://reviews.llvm.org/D136178
2022-10-18 13:48:26 -04:00
Fangrui Song
821e04de11 [ELF] Restore AArch64Relaxer after 685b21255315e699aa839d93fe71b37d806c90c2
relocateAlloc may be parallel so we should avoid sharing AArch64 states.
2022-10-18 10:28:11 -07:00
Katherine Rasmussen
1eb5cd020c [flang] Add atomic_cas to the list of intrinsics
Add the atomic subroutine, atomic_cas, to the list of intrinsic
subroutines and check one of its arguments for a coindexed object.
Create a new function, CheckAtomicKind, that will be used for the
atomic subroutines that have arguments that can be either of type
int and of kind atomic_int_kind or of type logical and of kind
atomic_logical_kind.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D135835
2022-10-18 11:20:12 -06:00
Alexey Bataev
f5c747bfbe [SLP][NFC]Fix a warning for ?: with enum/unsigned, NFC. 2022-10-18 10:08:05 -07:00
Slava Zakharin
51962690d8 [flang] Restrict __float128 support for some build configurations.
This change is intended to resolve build issues reported in D134503.
A compiler supporting __float128 must define either __FLOAT128__ or
__SIZEOF_FLOAT128__ (or both). Additional check for _LIBCPP_VERSION
was added to disable __float128 for builds with libc++, because
__float128 support is incomplete there.

Differential Revision: https://reviews.llvm.org/D136121
2022-10-18 09:58:05 -07:00
Arthur Eubanks
df92b05f1b [test] Remove redundant -passes flags 2022-10-18 09:57:06 -07:00
Aart Bik
86bf62fa64 [mlir][sparse] improve push_back type checking, printing, parsing
Rationale:
Enforces type consistency on parsed and generated IR.

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D136132
2022-10-18 09:55:25 -07:00
Arthur Eubanks
7676817ecd [ObjCARC][test] Use opt -passes= syntax 2022-10-18 09:54:05 -07:00
Krzysztof Parzyszek
6a8cfe9a72 [Hexagon] Use shifts by scalar for funnel shifts by scalar
HVX has vector shifts by a scalar register. Use those in the expansions
of funnel shifts where profitable.
2022-10-18 09:49:17 -07:00
Chris Bieneman
6e05c8dfc8 [DX] Create globals for DXContainer parts
DXContainer files have a handful of sections that need to be written.
This adds a pass to write the section data into IR globals, and writes
the shader flag data into a global.

The test cases here verify that the shader flags are correctly written
from the IR into the global and emitted to the DXContainer.

This change also fixes a bug in the MCDXContainerWriter, where the size
of the dxbc::ProgramHeader was not being included in the part offset
calcuations. This is verified to be working by the new testcases where
obj2yaml can properly dump part data for parts after the DXIL part.

Resolves issue #57742 (https://github.com/llvm/llvm-project/issues/57742)

Reviewed By: python3kgae

Differential Revision: https://reviews.llvm.org/D135793
2022-10-18 11:48:08 -05:00