Commit Graph

430382 Commits

Author SHA1 Message Date
Fangrui Song 23ba688f02 [X86] Use Min behavior for cf-protection-{return,branch}/ibt-seal module flags
These features require that all object files are compiled with the support. When
the feature is disabled for an object file, the merge behavior should treat the
file having a value of 0 (see D129911).

Reviewed By: xiangzhangllvm

Differential Revision: https://reviews.llvm.org/D130065
2022-07-19 21:20:02 -07:00
Douglas Yung e882ac54c4 Mark test experimental-library-flag.cpp as XFAIL on PS4 and PS5 to get the bot green until the author can investigate.
Should fix https://lab.llvm.org/buildbot/#/builders/139/builds/25208

Test was originally introduced in D121141.
2022-07-19 21:18:46 -07:00
Kazu Hirata 0387da6f4f Use value instead of getValue (NFC) 2022-07-19 21:18:26 -07:00
Haohai Wen d946fb8d95 [X86] Make sure load size is not larger than stack slot
Reviewed By: LuoYuanke

Differential Revision: https://reviews.llvm.org/D130084
2022-07-20 12:17:44 +08:00
Konstantin Varlamov 25aa29f38a [libc++][ranges][NFC] Consolidate range algorithm checks for returning `dangling`.
Also simplify the `robust` test files for non-boolean predicates and
omitting `std::invoke`.

Differential Revision: https://reviews.llvm.org/D129741
2022-07-19 20:46:22 -07:00
chenglin.bi d337c1f256 [AArch64] Use SUBXrx64 for dynamic stack to refer to sp
When we lower dynamic stack, we need to substract pattern `x15 << 4`  from sp.
Subtract instruction with arith shifted register(SUBXrs) can't refer to sp. So for now we need two extra mov like:

```
mov x0, sp
sub x0, x0, x15, lsl #4
mov sp, x0
```
If we want to refer to sp in subtract instruction like this:
```
sub	sp, sp, x15, lsl #4
```
We must use arith extended register version(SUBXrx).
So in this patch when we find sub have sp operand on src0, try to select to SubXrx64.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D129932
2022-07-20 11:46:10 +08:00
LLVM GN Syncbot 5b0e96a8ff [gn build] Port 5dd19ada57 2022-07-20 03:15:57 +00:00
Kazu Hirata 41ae78ea3a Use has_value instead of hasValue (NFC) 2022-07-19 20:15:44 -07:00
varconst 5dd19ada57 [libc++][ranges] Implement `ranges::partial_sort`.
Differential Revision: https://reviews.llvm.org/D128744
2022-07-19 20:10:34 -07:00
Jacques Pienaar c35807f271 [mlir] Address compiler warning 2022-07-19 20:03:03 -07:00
Kazu Hirata bbbb4393ee [CodeGen] Use value_or instead of getValueOr (NFC) 2022-07-19 19:50:43 -07:00
Chuanqi Xu 57224ff4a6 Don't treat readnone call in presplit coroutine as not access memory
To solve the readnone problems in coroutines. See
https://discourse.llvm.org/t/address-thread-identification-problems-with-coroutine/62015
for details.

According to the discussion, we decide to fix the problem by inserting
isPresplitCoroutine() checks in different passes instead of
wrapping/unwrapping readnone attributes in CoroEarly/CoroCleanup passes.
In this direction, we might not be able to cover every case at first.
Let's take a "find and fix" strategy.

Reviewed By: nikic, nhaehnle, jyknight

Differential Revision: https://reviews.llvm.org/D127383
2022-07-20 10:37:23 +08:00
Jez Ng 87ce7b41d8 [lld-macho] Simplify archive loading logic
This is a follow-on to {D129556}. I've refactored the code such that
`addFile()` no longer needs to take an extra parameter. Additionally,
the "do we force-load or not" policy logic is now fully contained within
addFile, instead of being split between `addFile` and
`parseLCLinkerOptions`. This also allows us to move the `ForceLoad` (now
`LoadType`) enum out of the header file.

Additionally, we can now correctly report loads induced by
`LC_LINKER_OPTION` in our `-why_load` output.

I've also added another test to check that CLI library non-force-loads
take precedence over `LC_LINKER_OPTION` + `-force_load_swift_libs`. (The
existing logic is correct, just untested.)

Reviewed By: #lld-macho, thakis

Differential Revision: https://reviews.llvm.org/D130137
2022-07-19 21:56:24 -04:00
Alex Brachet 09d4dbc382 [llvm-driver] Generate symlinks instead of executables for tools
When LLVM_TOOL_LLVM_DRIVER_BUILD is On, create symlinks
to llvm instead of creating the executables. Currently
this only works for install and not
install-distribution, the work for the later will be
split up into a second patch.

Differential Revision: https://reviews.llvm.org/D127800
2022-07-20 01:42:56 +00:00
Sanjay Patel f0dd12ec5c [x86] use zero-extending load of a byte outside of loops too (2nd try)
The first attempt missed changing test files for tools
(update_llc_test_checks.py).

Original commit message:

This implements the main suggested change from issue #56498.
Using the shorter (non-extending) instruction with only
-Oz ("minsize") rather than -Os ("optsize") is left as a
possible follow-up.

As noted in the bug report, the zero-extending load may have
shorter latency/better throughput across a wide range of x86
micro-arches, and it avoids a potential false dependency.
The cost is an extra instruction byte.

This could cause perf ups and downs from secondary effects,
but I don't think it is possible to account for those in
advance, and that will likely also depend on exact micro-arch.
This does bring LLVM x86 codegen more in line with existing
gcc codegen, so if problems are exposed they are more likely
to occur for both compilers.

Differential Revision: https://reviews.llvm.org/D129775
2022-07-19 21:27:08 -04:00
Jez Ng 2d889a87fb [lld-macho] Read in new addrsig format
The new format uses symbol relocations, as described in {D127637}.

Reviewed By: #lld-macho, alx32

Differential Revision: https://reviews.llvm.org/D128938
2022-07-19 21:22:27 -04:00
Jez Ng 2e2737cdf9 [MC][MachO] Change addrsig format + ensure its size is properly set
There were two problems with the previous setup:

1. We weren't setting its size, which caused problems when `__llvm_addrsig`
   wasn't the last section. In particular, `__debug_line` (if created) is
   generated and placed after `__llvm_addrsig`, and would result in an
   invalid object file w/ overlapping sections being emitted.

2. The symbol indices could be invalidated if e.g. `llvm-strip` ran on
   the object file. See discussion [here][1].

To fix both these issues, we use symbol relocations instead of encoding
symbol indices directly in the section contents. The section itself
doesn't contain any data. That sidesteps the layout problem in addition
to solving the second issue.

The corresponding LLD change to read in this new format: {D128938}.
It will fix the icf-safe.ll test failure on this diff.

[1]: https://discourse.llvm.org/t/problems-with-mach-o-address-significance-table-generation/63392/

Reviewed By: #lld-macho, alx32

Differential Revision: https://reviews.llvm.org/D127637
2022-07-19 21:22:23 -04:00
Konstantin Varlamov 18f46f3ab0 [libc++][ranges] Fix broken CI. 2022-07-19 18:14:44 -07:00
Hui Xie 9c0564a3a7 [libc++][ranges] fix `std::search_n` incorrect `static_assert`
[libc++][ranges] fix `std::search_n` incorrect `static_assert`
see more detail in https://reviews.llvm.org/D124079?#3661721

Differential Revision: https://reviews.llvm.org/D130124
2022-07-19 17:24:47 -07:00
Lang Hames 94e6d2677b [ORC] Fix serialization / deserialization of default-constructed StringRef.
Avoids accessing the data field on zero-length strings. This is the StringRef
counterpart to the ArrayRef<char> fix in 67220c2ad7.

rdar://97285294
2022-07-19 17:22:21 -07:00
Konstantin Varlamov b8d54d1d6a [libc++][ranges][NFC] Test that range algorithms support iterators requiring `iter_move`.
Differential Revision: https://reviews.llvm.org/D130057
2022-07-19 17:21:08 -07:00
Joe Loser 50cfb76e02
[libc++] Define ostream nullptr inserter for >= C++17 only
The `ostream` `nullptr` inserter implemented in 3c125fe is missing a C++ version
guard. Normally, `libc++` takes the stance of backporting LWG issues to older
standards modes as was done in 3c125fe. However, backporting to older standards
modes breaks existing code in popular libraries such as `Boost.Test` and
`Google Test` who define their own overload for `nullptr_t`.

Instead, only apply this `operator<<` overload in C++17 or later.

Fixes https://github.com/llvm/llvm-project/issues/55861.

Differential Revision: https://reviews.llvm.org/D127033
2022-07-19 18:16:45 -06:00
Qwinci 3f73c57935 Argument name support for function pointer signature hints
Fixes https://github.com/clangd/clangd/issues/1068

Reviewed By: nridge

Differential Revision: https://reviews.llvm.org/D125120
2022-07-19 20:02:26 -04:00
River Riddle 7d815ab9b4 [mlir][NFC] Split out various tests from IR/invalid.mlir
This file contains a huge number of tests that should really be in
different dialect/files. It is monolothic because of the legacy
surrounding the old standard dialect, affine operations, etc. Splitting
this up makes the tests much more maintainable given that they are now
group with other similar tests.
2022-07-19 16:34:35 -07:00
Volodymyr Sapsai f693874c53 [ODRHash diagnostics] Preparation to minimize subsequent diffs. NFC.
Specifically, making the following changes:
* Turn lambdas calculating ODR hashes into static functions.
* Move `ODRCXXRecordDifference` where it is used.
* Rename some variables and move some lines of code.
* Replace `auto` with explicit type when the deduced type is not mentioned.
* Add `const` for unmodified objects, so we can pass them to more functions.

Differential Revision: https://reviews.llvm.org/D128690
2022-07-19 16:29:33 -07:00
Johannes Doerfert f84712f0b8 [Attributor] Teach checkForAllUses to follow returns into callers
If we can determine all call sites we can follow a use in a return
instruction into the caller. AAPointerInfo utilizes this feature.
2022-07-19 18:17:40 -05:00
Johannes Doerfert 4f2ccdd0b1 [Attributor][NFC] Improve debug messages 2022-07-19 18:17:40 -05:00
Sriraman Tallam 116ee23f4c [bolt] std::atomic_uint64_t to std::atomic<uint64_t>
Differential Revision: https://reviews.llvm.org/D129903
2022-07-19 16:09:11 -07:00
Sriraman Tallam 16cccc66b8 Bazel BUILD file for BOLT.
Differential Revision: https://reviews.llvm.org/D129899
2022-07-19 16:03:52 -07:00
Slava Zakharin 04644a9e55 [mlir] Fixed ordering of pass statistics.
The change makes sure the plain C string statistics names
are properly ordered.

Differential Revision: https://reviews.llvm.org/D130122
2022-07-19 15:52:02 -07:00
LLVM GN Syncbot 41f6a21025 [gn build] Port 1b1f1c7786 2022-07-19 22:44:22 +00:00
Siva Chandra Reddy f8322d1351 [libc] Add a method `find_last_of` to StringView.
Reviewed By: jeffbailey

Differential Revision: https://reviews.llvm.org/D130112
2022-07-19 22:43:43 +00:00
Zequan Wu b8cf916b89 [LLDB][NativePDB] Add MSInheritanceAttr when creating pointer type that is a pointer to member.
Differential Revision: https://reviews.llvm.org/D129807
2022-07-19 15:36:35 -07:00
Anubhab Ghosh 1b1f1c7786 Re-re-apply 5acd471698, Add a shared-memory based orc::MemoryMapper...
...with more fixes.

The original patch was reverted in 3e9cc543f2 due to bot failures caused by
a missing dependence on librt. That issue was fixed in 32d8d23cd0, but that
commit also broke sanitizer bots due to a bug in SimplePackedSerialization:
empty ArrayRef<char>s triggered a zero-byte memcpy from a null source. The
ArrayRef<char> serialization issue was fixed in 67220c2ad7, and this patch has
also been updated with a new custom SharedMemorySegFinalizeRequest message that
should avoid serializing empty ArrayRefs in the first place.

https://reviews.llvm.org/D128544
2022-07-19 15:35:33 -07:00
Nick Desaulniers 1cf6b93df1 Revert "[Local] Allow creating callbr with duplicate successors"
This reverts commit 08860f525a.

Crashes during PPC64LE linux kernel builds as reported by @nathanchance.
https://reviews.llvm.org/D129997#3663632
2022-07-19 15:03:27 -07:00
Lang Hames 6d8438314f [JITLink] Hook up prebuilt cache in DWARFRecordSectionSplitter::processBlock.
DWARFRecordSectionSplitter pre-builds a splitBlock cache, but wasn't passing it
to the call to splitBlock. This was an oversight in the original patch.
2022-07-19 15:03:14 -07:00
Kaining Zhong dd5635541c [lld-macho] Fix loading same libraries from both LC_LINKER_OPTION and command line
This fixes https://github.com/llvm/llvm-project/issues/56059 and
https://github.com/llvm/llvm-project/issues/56440. This is inspired by
tapthaker's patch (https://reviews.llvm.org/D127941), and has reused his
test cases. This patch adds an bool "isCommandLineLoad" to indicate
where archives are from. If lld tries to load the same library loaded
previously by LC_LINKER_OPTION from CLI, it will use this
isCommandLineLoad to determine if it should be affected by -all_load &
-ObjC flags. This also prevents -force_load from affecting archives
loaded previously from CLI without such flag, whereas tapthaker's patch
will fail such test case (introduced by
https://reviews.llvm.org/D128025).

Reviewed By: int3, #lld-macho

Differential Revision: https://reviews.llvm.org/D129556
2022-07-19 17:46:14 -04:00
Jacques Pienaar d2c0572b2e [mlir] Flip LinAlg dialect to _Both
This one required more changes than ideal due to overlapping generated name
with different return types. Changed getIndexingMaps to getIndexingMapsArray to
move it out of the way/highlight that it returns (more expensively) a
SmallVector and uses the prefixed name for the Attribute.

Differential Revision: https://reviews.llvm.org/D129919
2022-07-19 14:42:58 -07:00
Sanjay Patel 95401b0153 Revert "[x86] use zero-extending load of a byte outside of loops too"
This reverts commit 9d1ea1774c.
There are tests of update_llc_tests_checks.py that missed being updated.
2022-07-19 17:37:22 -04:00
Johannes Doerfert bf789b1957 [Attributor] Replace AAValueSimplify with AAPotentialValues
For the longest time we used `AAValueSimplify` and
`genericValueTraversal` to determine "potential values". This was
problematic for many reasons:
- We recomputed the result a lot as there was no caching for the 9
  locations calling `genericValueTraversal`.
- We added the idea of "intra" vs. "inter" procedural simplification
  only as an afterthought. `genericValueTraversal` did offer an option
  but `AAValueSimplify` did not. Thus, we might end up with "too much"
  simplification in certain situations and then gave up on it.
- Because `genericValueTraversal` was not a real `AA` we ended up with
  problems like the infinite recursion bug (#54981) as well as code
  duplication.

This patch introduces `AAPotentialValues` and replaces the
`AAValueSimplify` uses with it. `genericValueTraversal` is folded into
`AAPotentialValues` as are the instruction simplifications performed in
`AAValueSimplify` before. We further distinguish "intra" and "inter"
procedural simplification now.

`AAValueSimplify` was not deleted as we haven't ported the
re-materialization of instructions yet. There are other differences over
the former handling, e.g., we may not fold trivially foldable
instructions right now, e.g., `add i32 1, 1` is not folded to `i32 2`
but if an operand would be simplified to `i32 1` we would fold it still.

We are also even more aware of function/SCC boundaries in CGSCC passes,
which is good even if some tests look like they regress.

Fixes: https://github.com/llvm/llvm-project/issues/54981

Note: A previous version was flawed and consequently reverted in
      6555558a80.
2022-07-19 16:24:42 -05:00
Philip Reames f1243fa193 [LV] Autogen a partially autogened test for ease of update 2022-07-19 14:18:53 -07:00
Louis Dionne 91941f0142 [libc++][NFC] Add commit SHA for ABI change 2022-07-19 17:16:53 -04:00
Louis Dionne f1c3013541 [libc++] Drop the legacy debug mode symbols by default
Leave the escape hatch in place with a note, but don't include the
debug mode symbols by default since we don't support the debug mode
in the normal library anymore.

This is technically an ABI break for users who were depending on
those debug mode symbols in the dylib, however those users will
already be broken at compile-time because they must have been using
_LIBCPP_DEBUG=2, which is now an error.

Differential Revision: https://reviews.llvm.org/D127360
2022-07-19 17:16:06 -04:00
Slava Zakharin fd4afa7a29 [flang] Support late math lowering for intrinsics from the llvm table.
mathOperations should now support all intrinsics that are handled
by the llvmIntrinsics table + `tan` lowered as Math dialect operation +
f128 flavor of abs.

I am going to flip the default to late math lowering after this change,
but still keep the fallback via pgmath. This will allow getting rid
of the llvmIntrinsics table and continue populating
only the mathOperations table, otherwise, updating both tables
seems to be inconvenient.

Differential Revision: https://reviews.llvm.org/D130048
2022-07-19 14:07:59 -07:00
Keith Smiley 0bc100986c
[lld-macho] Add support for -alias
This creates a symbol alias similar to --defsym in the elf linker. This
is used by swiftpm for all executables, so it's useful to support. This
doesn't implement -alias_list but that could be done pretty easily as
needed.

Differential Revision: https://reviews.llvm.org/D129938
2022-07-19 13:55:56 -07:00
Nico Weber 374db8fc2e [gn build] (manually) port c91ce94144 (HTMLForestResources.inc) 2022-07-19 16:51:30 -04:00
Sanjay Patel 9d1ea1774c [x86] use zero-extending load of a byte outside of loops too
This implements the main suggested change from issue #56498.
Using the shorter (non-extending) instruction with only
-Oz ("minsize") rather than -Os ("optsize") is left as a
possible follow-up.

As noted in the bug report, the zero-extending load may have
shorter latency/better throughput across a wide range of x86
micro-arches, and it avoids a potential false dependency.
The cost is an extra instruction byte.

This could cause perf ups and downs from secondary effects,
but I don't think it is possible to account for those in
advance, and that will likely also depend on exact micro-arch.
This does bring LLVM x86 codegen more in line with existing
gcc codegen, so if problems are exposed they are more likely
to occur for both compilers.

Differential Revision: https://reviews.llvm.org/D129775
2022-07-19 16:43:47 -04:00
Sanjay Patel f36f0f23c4 [x86] add tests for fixup-bw with size optimization attrs; NFC 2022-07-19 16:43:47 -04:00
Sam McCall c91ce94144 [pseudo] Add `clang-pseudo -html-forest=<output.html>`, an HTML forest browser
It generates a standalone HTML file with all needed JS/CSS embedded.
This allows navigating the tree both with a tree widget and in the code,
inspecting nodes, and selecting ambiguous alternatives.

Demo: https://htmlpreview.github.io/?https://gist.githubusercontent.com/sam-mccall/03882f7499d293196594e8a50599a503/raw/ASTSignals.cpp.html

Differential Revision: https://reviews.llvm.org/D130004
2022-07-19 22:32:11 +02:00
Arthur Eubanks 5bce73ba75 [test] Convert some tests to use opaque pointers 2022-07-19 13:11:08 -07:00