Commit Graph

438819 Commits

Author SHA1 Message Date
Chia-hung Duan 9c26f51f5e [scudo] Support partial page releasing
Block grouping enables us doing partial page releasing so that we can
release the pages in a finer granularity. Which means we don't need to
visit all blocks to determine which pages are unused. Besides, this
means we can do incremental page releasing depends on the number fo free
blocks.

Reviewed By: cryptoad, cferris

Differential Revision: https://reviews.llvm.org/D134226
2022-10-13 23:35:07 +00:00
Chia-hung Duan cf9d7f55d3 [scudo] Manage free blocks in BatchGroup.
Scudo is supposed to allocate any blocks across the entired mapped
pages and each page is equally likely to be selected. Which means Scudo
is leaning to touch as many pages as possible. This brings better
security but it also sacrifices the chance of releasing dirty pages.

To alleviate the unmanagable footprint growing, this CL introduces the
BatchGroup concept. Each blocks will be classified into a BatchGroup
according to its address. While allocation, we are leaning to allocate
blocks in the same group first. Note that the blocks selected from a
group is still random over several pages. At the same time, we have
better prediction of dirty page growing speed. Besides, we are able to
do partial page releasing by examing part of BatchGroups.

Reviewed By: cryptoad, cferris

Differential Revision: https://reviews.llvm.org/D133897
2022-10-13 23:35:06 +00:00
Chia-hung Duan 56dafd024c [scudo] Add PageReleaseContext to convey page usage status.
PageReleaseContext contains all the information needed for determing if
a page can be released. Splitting out the context increases the flexibility
of heterogenous free lists in the future. Also rename PackedCounterArray to
PageMap.

Reviewed By: cryptoad, cferris

Differential Revision: https://reviews.llvm.org/D133895
2022-10-13 23:35:06 +00:00
Chia-hung Duan 0fb2aeef53 Use u16 to store Count/MaxCount
The Count/MaxCount used in TransferBatch and PerClass can be fit in u16 in
current configurations and it's also reasonable to have a u16 limit. The
spare 16 bits will be used for additional status like pages mapping
status in a TransferBatch.

Reviewed By: cryptoad, cferris, vitalybuka

Differential Revision: https://reviews.llvm.org/D133145
2022-10-13 23:35:06 +00:00
Jason Molenda 3d8d9c9884 PlatformDarwinKernel calls the ctor directly, not setting no-jit
Fix a small thinko in https://reviews.llvm.org/D133534 .  Normally
DynamicLoaderDarwinKernels are created via the CreateInstance plugin
method, and that plugin method sets the Process CanJIT to false.
In the above patch, I added a new code path that can call the
DynamicLoaderDarwinKernel ctor directly, without going through
CreateInstance, and CanJIT was not being correctly set for the
process.

rdar://101148552
2022-10-13 16:28:18 -07:00
Peter Collingbourne 8d9c4a7425 Driver: Change default Android linker to lld.
The clang distributed with the Android NDK has defaulted to lld since r22,
so let's update the driver to match.

Differential Revision: https://reviews.llvm.org/D135421
2022-10-13 15:40:30 -07:00
Alexandros Lamprineas 25162418c6 [NFC][FuncSpec] Add a test to show redundant function cloning.
Happens when we find identical specializations.

Differential Revision: https://reviews.llvm.org/D135459
2022-10-13 23:00:23 +01:00
Wolfgang Pieb b43a1d1bd9 [PGO] Do not create block count annotations when all weights are 0,
avoiding an assertion.

A BB with a nonzero count, whose successor blocks all have 0 counts, could
cause an assertion. Don't create any branch weights in this case.

Reviewed By: xur

Differential Revision: https://reviews.llvm.org/D134203
2022-10-13 14:57:42 -07:00
Sam Clegg 1532be98f9 [lld][WebAssembly] Add symbols marking start/end of stack region
Currently emscripten is make assumptions about that memory layout,
assuming the stack is between `__data_end` and `__heap_base`:

af961ad5c4/system/lib/compiler-rt/stack_limits.S (L42-L61)

With this change we can be more precise:

https://github.com/emscripten-core/emscripten/pull/18057

Differential Revision: https://reviews.llvm.org/D135910
2022-10-13 14:52:17 -07:00
Mehdi Amini f7cd3fc35e Apply clang-tidy fixes for performance-for-range-copy in VectorOps.cpp (NFC) 2022-10-13 21:49:19 +00:00
Mehdi Amini 59405cddb8 Apply clang-tidy fixes for readability-identifier-naming in TosaCanonicalizations.cpp (NFC) 2022-10-13 21:49:18 +00:00
David Blaikie 9363071303 Move GCC-compatible pod-packing change to v16/old behavior available at v15 and below
Change matches D126334/e59f648d698e since this change got punted from
v15 too.
2022-10-13 21:13:19 +00:00
Slava Zakharin 88da0de14f Revert "[Libomp] Do not error on undefined version script symbols"
This reverts commit 096f93e73d.

Revert "[Libomptarget] Make the plugins ingore undefined exported symbols"

This reverts commit 3f62314c23.

Revert "[LLD] Enable --no-undefined-version by default."

This reverts commit 7ec8b0d162.

Three commits are reverted because of the current omp build fail
with GNU ld. See discussion here: https://reviews.llvm.org/rG096f93e73dc3
2022-10-13 14:12:07 -07:00
Jez Ng 922346ef05 [lld-macho] Preserve the size of common symbols
We never noticed this before because the only time the size gets emitted is via
the linker map...

Reviewed By: #lld-macho, thakis

Differential Revision: https://reviews.llvm.org/D135884
2022-10-13 16:44:33 -04:00
Jez Ng bdd0cec569 [lld-macho] Include symbol sizes in mapfile
This matches ld64's behavior.

Additionally, I edited the "Dead Stripped Symbols" header to omit "Address" --
this also matches ld64.

Reviewed By: #lld-macho, oontvoo

Differential Revision: https://reviews.llvm.org/D135883
2022-10-13 16:44:29 -04:00
Arthur Eubanks aa5bc41b76 [test] Reset timer flag after test is done
Fixes some test failures after D135219 on internal bots.
2022-10-13 13:31:22 -07:00
Sanjay Patel d85505a932 [InstCombine] fold logical and/or to xor
(A | B) & ~(A & B) --> A ^ B

https://alive2.llvm.org/ce/z/qpFMns

We already have the equivalent fold for real
logic instructions, but this pattern may occur
with selects too.

This is part of solving issue #58313.
2022-10-13 16:12:20 -04:00
Sanjay Patel b78306c9f7 [InstCombine] add tests for logical select xor folds; NFC
issue #58313
2022-10-13 16:12:20 -04:00
Florian Hahn 572d5d374c
[ConstraintElim] Add support for GEPs with multiple indices.
Lift restriction on GEPs with a single index by iterating over all
indices and joining the {Coefficient, Variable} entries for all indices
together.
2022-10-13 21:08:33 +01:00
Aaron Ballman 2a1bd10a99 Fix the clang Sphinx build
This should address the issue found in:
https://lab.llvm.org/buildbot/#/builders/92/builds/34157
2022-10-13 16:04:25 -04:00
Florian Hahn 52fdbbd86d
[ConstraintElim] Add nested GEP test with scalable vectors. 2022-10-13 20:58:11 +01:00
Fangrui Song 71bad24b0d [llvm-objdump] Add HelpText for --no-addresses after D135040 2022-10-13 12:50:15 -07:00
Alex Brachet ecac223b0e [PGO] Make emitted symbols hidden
This was reverted because it was breaking when targeting Darwin which
tried to export these symbols which are now hidden. It should be safe
to just stop attempting to export these symbols in the clang driver,
though Apple folks will need to change their TAPI allow list described
in the commit where these symbols were originally exported
f538018562

Bug: https://github.com/llvm/llvm-project/issues/58265

Differential Revision: https://reviews.llvm.org/D135340
2022-10-13 19:47:15 +00:00
Zequan Wu d3492ed016 [LLDB][NativePDB] Fix struct layout when it has anonymous unions.
Previously, lldb mistook fields in anonymous union in a struct as the direct
field of the struct, which causes lldb crashes due to multiple fields sharing
the same offset in a struct. This patch fixes it.

MSVC generated pdb doesn't have the debug info entity representing a anonymous
union in a struct. It looks like the following:
```
struct S {
union {
  char c;
  int i;
};
};

0x1004 | LF_FIELDLIST [size = 40]
         - LF_MEMBER [name = `c`, Type = 0x0070 (char), offset = 0, attrs = public]
         - LF_MEMBER [name = `i`, Type = 0x0074 (int), offset = 0, attrs = public]
0x1005 | LF_STRUCTURE [size = 32] `S`
         unique name: `.?AUS@@`
         vtable: <no type>, base list: <no type>, field list: 0x1004
```
Clang generated pdb is similar, though due to the [[ https://github.com/llvm/llvm-project/issues/57999 | bug ]],
it's not more useful than the debug info above. But that's not very relavent,
lldb should still be able to understand MSVC geneerated pdb.
```
0x1003 | LF_UNION [size = 60] `S::<unnamed-tag>`
         unique name: `.?AT<unnamed-type-$S1>@S@@`
         field list: <no type>
         options: forward ref (= 0x1003) | has unique name | is nested, sizeof 0
0x1004 | LF_FIELDLIST [size = 40]
         - LF_MEMBER [name = `c`, Type = 0x0070 (char), offset = 0, attrs = public]
         - LF_MEMBER [name = `i`, Type = 0x0074 (int), offset = 0, attrs = public]
         - LF_NESTTYPE [name = ``, parent = 0x1003]
0x1005 | LF_STRUCTURE [size = 32] `S`
         unique name: `.?AUS@@`
         vtable: <no type>, base list: <no type>, field list: 0x1004
         options: contains nested class | has unique name, sizeof 4
0x1006 | LF_FIELDLIST [size = 28]
         - LF_MEMBER [name = `c`, Type = 0x0070 (char), offset = 0, attrs = public]
         - LF_MEMBER [name = `i`, Type = 0x0074 (int), offset = 0, attrs = public]
0x1007 | LF_UNION [size = 60] `S::<unnamed-tag>`
         unique name: `.?AT<unnamed-type-$S1>@S@@`
         field list: 0x1006
         options: has unique name | is nested | sealed, sizeof
```
This patch delays the FieldDecl creation when travesing LF_FIELDLIST so we know
if there are multiple fields are in the same offsets and are able to group them
into different anonymous unions based on offsets. Nested anonymous union will
be flatten into one anonymous union, because we simply don't have that info, but
they are equivalent in terms of union layout.

Differential Revision: https://reviews.llvm.org/D134849
2022-10-13 12:43:45 -07:00
Xiang Li 1fc78d66ea [DirectX backend] [NFC] Change Resources::write to const.
Change Resources::write to const.
Also fix parameter name.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D135705
2022-10-13 12:38:12 -07:00
Alex Brachet d1b6c1b1a9 Only enable driver test if in driver build 2022-10-13 19:26:06 +00:00
Alex Brachet 1fda6f6859 [llvm-driver] Add lld
The llvm-driver, enabled with LLVM_TOOL_LLVM_DRIVER_BUILD combines many llvm executables
into one to save overall toolchain size. This patch adds the capability for lld to be part of the
llvm-driver.

Differential Revision: https://reviews.llvm.org/D127472
2022-10-13 19:23:25 +00:00
Yabin Cui 4e6b071509 Fix clang version check in SARIF diagnostics test
This is to allow future clang versions and use of LLVM_VERSION_PATCH.

Differential Revision: https://reviews.llvm.org/D135896
2022-10-13 15:16:58 -04:00
Bill Wendling 8c7b3461a5 [clang] Update ASM goto documentation to reflect how Clang differs from GCC
That said, we are planning to add this support in the near future.

Link: https://github.com/llvm/llvm-project/issues/53562

Differential Revision: https://reviews.llvm.org/D135818
2022-10-13 12:05:40 -07:00
Siva Chandra Reddy 02a543db66 [libc] Add a simple implementation of the posix_spawn function.
The implementation currently ignores all spawn attributes. Support for
them will be added in future changes.

A simple allocator for integration tests has been added so that the
integration test for posix_spawn can use the
posix_spawn_file_actions_add* functions.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D135752
2022-10-13 18:47:47 +00:00
Sanjoy Das dde9db5f93 Unbreak Windows build
Without the llvm_unreachable, Windows complains about not returning a
value from mlir::isSpeculatable on all paths.

Differential Revision: https://reviews.llvm.org/D135899
2022-10-13 11:21:43 -07:00
Jonathon Penix 4d95f74b13 [flang] Lower assumed length character allocatable and pointer arguments
It seems the needed functionality was already implemented for host associations,
so turn that code into a function and move it into a (hopefully appropriate)
common location and reuse it.

Differential Revision: https://reviews.llvm.org/D135481
2022-10-13 11:03:56 -07:00
Florian Hahn 71c49d189a
[ConstraintElim] Move check-and-replace logic to helper function (NFC).
Move logic to check and replace conditions to a helper function. This
isolates the code, allows using early returns, reduces the
indentation and simplifies eliminateConstraints.
2022-10-13 18:58:37 +01:00
Jakub Chlanda 8407fdbd69 [NVPTX] Support neg{.ftz} for f16 and f16x2
Differential Revision: https://reviews.llvm.org/D135428
2022-10-13 10:48:33 -07:00
Wiktor Garbacz e851f7dbca Fix LSan build
This change fixes a build bug introduced in
39db491957

Differential Revision: https://reviews.llvm.org/D135860
2022-10-13 10:44:27 -07:00
Aaron Puchert 54bfd04846 Thread safety analysis: Support copy-elided production of scoped capabilities through arbitrary calls
When support for copy elision was initially added in e97654b2f2, it
was taking attributes from a constructor call, although that constructor
call is actually not involved. It seems more natural to use attributes
on the function returning the scoped capability, which is where it's
actually coming from. This would also support a number of interesting
use cases, like producing different scope kinds without the need for tag
types, or producing scopes from a private mutex.

Changing the behavior was surprisingly difficult: we were not handling
CXXConstructorExpr calls like regular calls but instead handled them
through the DeclStmt they're contained in. This was based on the
assumption that constructors are basically only called in variable
declarations (not true because of temporaries), and that variable
declarations necessitate constructors (not true with C++17 anymore).

Untangling this required separating construction from assigning a
variable name. When a call produces an object, we use a placeholder
til::LiteralPtr for `this`, and we collect the call expression and
placeholder in a map. Later when going through a DeclStmt, we look up
the call expression and set the placeholder to the new VarDecl.

The change has a couple of nice side effects:
* We don't miss constructor calls not contained in DeclStmts anymore,
  allowing patterns like
    MutexLock{&mu}, requiresMutex();
  The scoped lock temporary will be destructed at the end of the full
  statement, so it protects the following call without the need for a
  scope, but with the ability to unlock in case of an exception.
* We support lifetime extension of temporaries. While unusual, one can
  now write
    const MutexLock &scope = MutexLock(&mu);
  and have it behave as expected.
* Destructors used to be handled in a weird way: since there is no
  expression in the AST for implicit destructor calls, we instead
  provided a made-up DeclRefExpr to the variable being destructed, and
  passed that instead of a CallExpr. Then later in translateAttrExpr
  there was special code that knew that destructor expressions worked a
  bit different.
* We were producing dummy DeclRefExprs in a number of places, this has
  been eliminated. We now use til::SExprs instead.

Technically this could break existing code, but the current handling
seems unexpected enough to justify this change.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D129755
2022-10-13 19:36:15 +02:00
Tom Praschan a8124eea9d [clangd] Add missing readonly modifier for const generic parameters
Fixes https://github.com/clangd/clangd/issues/1222. As discussed there, we saw no reason to keep this check.

Differential Revision: https://reviews.llvm.org/D135892
2022-10-13 21:09:25 +02:00
Alan Hu b75bde6321 [llvm-ocaml] Fix arity mismatch in pointer bindings
Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D135842
2022-10-13 10:07:10 -07:00
Eric Li 576283c3a8 [clang] Support `constexpr` for some `ASTNodeKind` member functions
Add `constexpr` support for:

  * The `getFromNodeKind` factory function
  * `isSame`
  * `isNone`
  * `hasPointerIdentity`

This enables these functions to be used in SFINAE context for AST node
types.

Differential Revision: https://reviews.llvm.org/D135816
2022-10-13 13:00:48 -04:00
Nico Weber 3ab947ede0 [lld/mac] Add test for bug fixed in reland 82ca390062
Differential Revision: https://reviews.llvm.org/D135889
2022-10-13 12:52:25 -04:00
Sam Clegg c07e838130 [lld][WebAssembly] Add `--extra-features` flag to add addional features
This flag acts just like the existing `--features` flag but instead
of replacing the set of inferred features it adds to it.

This is useful for example if you want to `--export` a mutable global
but none of the input of object were built with mutable global support.
In that case you can do `--extra-features=mutable-globals` to avoid the
linker error that would otherwise be generated in this case:

wasm-ld: error: mutable global exported but 'mutable-globals' feature not present in inputs: `__stack_pointer`. Use --no-check-features to suppress.

Differential Revision: https://reviews.llvm.org/D135831
2022-10-13 09:25:02 -07:00
Arthur Eubanks 0cd27cdc3a [PassTimingInfo] Stop double (or worse) counting passes/analyses
If we nest timers, we end up double counting anything nested.

The most egregious is ModuleInlinerWrapperPass/DevirtSCCRepeatedPass showing up as >20% of the total time when they're just wrappers.

Analyses also end up getting counted multiple times because they're nested inside wrappers and passes.

Ignore ModuleInlinerWrapperPass/DevirtSCCRepeatedPass and put analyses into their own TimerGroup.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D135219
2022-10-13 09:12:12 -07:00
Craig Topper e68b0d5875 [RISCV] Match (select C, -1, X)->(or -C, X) during lowerSelect
Same with (select C, X, -1), (select C, 0, X), and (select C, X, 0).

There's a DAGCombine after we turn the select into select_cc, but
that may introduce a setcc that didn't previously exist. We could
add more DAGCombines to remove the extra setcc, but this seemed lower
effort.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D135833
2022-10-13 09:06:12 -07:00
Nico Weber e7e32489f4 [lld/mac] Convert undef-spell-corrector.s test to split-file
Differential Revision: https://reviews.llvm.org/D135888
2022-10-13 12:03:32 -04:00
Nico Weber ad030740b2 [lld/mac] Make two local variables const
While reading this code, I was wondering if we change these variables in the
loop. We don't, so make them const to make this easier to see next time.

No behavior change.

Differential Revision: https://reviews.llvm.org/D135877
2022-10-13 12:02:51 -04:00
Ramiro Leal-Cavazos b4c8c4952a Fix handling of rank-1 tensors in tosa.reduce_sum
The conversion of `tosa.reduce_sum` to linalg creates a
`linalg.generic` op that produces a tensor of rank `input_rank -
1`. This tensor is then expanded back into a tensor of rank
`input_rank`. In the case where the tensor being expanded is rank-0,
the reassociation map used must be empty. However, the current
implementation indexes and modifies the reassociation map independent
of the rank of the tensor being expanded, resulting in out-of-bounds
indexing when the tensor being expanded is rank-0. This commit adds a
guard to the reassociation map indexing.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D135828
2022-10-13 09:02:01 -07:00
Mehdi Amini 928c23ddbf Apply clang-tidy fixes for performance-unnecessary-value-param in TosaCanonicalizations.cpp (NFC) 2022-10-13 15:55:32 +00:00
Mehdi Amini 549c18eda0 Apply clang-tidy fixes for modernize-use-equals-default in TosaCanonicalizations.cpp (NFC) 2022-10-13 15:55:32 +00:00
David Green 16e4e4ab87 [CodeGenPrep] Handle constants in ConvertPhiType
This is a simple addition to the convertPhiTypes in CodeGenPrepare to
consider and convert constants as it converts the phi type. Someone
fixed the bug in the motivating example, so the undef is now a constant
0. This does mean converting between integer and floating point
constants, which may have different materialization.

Differential Revision: https://reviews.llvm.org/D135561
2022-10-13 16:41:44 +01:00
Nicolas Vasilache d8cab3f407 [mlir][Transform] Fix dropReverseMapping early exit condition
Previously, the erasure would not trigger and result in surprising behavior.

Differential Revision: https://reviews.llvm.org/D135881
2022-10-13 08:30:45 -07:00