Tres Popp [Tue, 8 Feb 2022 08:00:03 +0000 (09:00 +0100)]
Add missing BUILD dependency to ShapeOps
Rainer Orth [Tue, 8 Feb 2022 07:57:59 +0000 (08:57 +0100)]
[CodeGen][test] XFAIL CodeGen/Generic/ForceStackAlign.ll on SPARC
`CodeGen/Generic/ForceStackAlign.ll` `FAIL`s on SPARC like this:
LLVM ERROR: Function "g" required stack re-alignment, but LLVM couldn't
handle it (probably because it has a dynamic alloca).
According to the comments in `llvm/lib/Target/Sparc/SparcFrameLowering.cpp`
(`SparcFrameLowering::emitPrologue`) and `SparcRegisterInfo.cpp`
(`SparcRegisterInfo::canRealignStack`) this isn't going to change any time
soon, so this patch `XFAIL`s the test.
Tested on `sparcv9-sun-solaris2.11`.
Differential Revision: https://reviews.llvm.org/D119119
Jason Molenda [Tue, 8 Feb 2022 07:51:46 +0000 (23:51 -0800)]
Platform gdb RSP packet doc fixes based on implementation behavior
Reviewing some recent fixes to the platform packet implementations
in lldb, I saw the docs were out of sync in a few spots. Updated them.
Differential Revision: https://reviews.llvm.org/D118842
Mariusz Ceier [Tue, 8 Feb 2022 07:26:22 +0000 (23:26 -0800)]
[lldb][CMake] Fix linking of gdb-remote when LLVM_ENABLE_ZLIB is ON
When LLVM_ENABLE_ZLIB is ON gdb-remote should link against ZLIB::ZLIB.
This fixes
```
/mnt/b/yoe/master/build/tmp/hosttools/ld: lib/liblldbPluginProcessGDBRemote.a(GDBRemoteCommunication.cpp.o): in function `lldb_private::process_gdb_remote::GDBRemoteCommunication::DecompressPacket() [clone .localalias]':
GDBRemoteCommunication.cpp:(.text._ZN12lldb_private18process_gdb_remote22GDBRemoteCommunication16DecompressPacketEv+0x59a): undefined reference to `inflateInit2_'
/mnt/b/yoe/master/build/tmp/hosttools/ld: GDBRemoteCommunication.cpp:(.text._ZN12lldb_private18process_gdb_remote22GDBRemoteCommunication16DecompressPacketEv+0x5af): undefined reference to `inflate'
```
Reviewed By: JDevlieghere, MaskRay
Differential Revision: https://reviews.llvm.org/D119186
Carl Ritson [Tue, 8 Feb 2022 06:01:07 +0000 (15:01 +0900)]
[MachineLICM] Add shouldHoist method to TargetInstrInfo
Add a shouldHoist method to TargetInstrInfo which is queried by
MachineLICM to override hoisting decisions for a given target.
This mirrors functionality provided by shouldSink.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D118773
Lang Hames [Tue, 8 Feb 2022 06:41:53 +0000 (17:41 +1100)]
[ORC-RT] Fix missing #include from
f9aef477ebc.
Lang Hames [Tue, 8 Feb 2022 05:31:17 +0000 (16:31 +1100)]
[ORC][ORC-RT] Rewrite the MachO platform to use allocation actions.
This patch updates the MachO platform (both the ORC MachOPlatform class and the
ORC-Runtime macho_platform.* files) to use allocation actions, rather than EPC
calls, to transfer the initializer information scraped from each linked object.
Interactions between the ORC and ORC-Runtime sides of the platform are
substantially redesigned to accomodate the change.
The high-level changes in this patch are:
1. The MachOPlatform::setupJITDylib method now calls into the runtime to set up
a dylib name <-> header mapping, and a dylib state object (JITDylibState).
2. The MachOPlatformPlugin builds an allocation action that calls the
__orc_rt_macho_register_object_platform_sections and
__orc_rt_macho_deregister_object_platform_sections functions in the runtime
to register the address ranges for all "interesting" sections in the object
being allocated (TLS data sections, initializers, language runtime metadata
sections, etc.).
3. The MachOPlatform::rt_getInitializers method (the entry point in the
controller for requests from the runtime for initializer information) is
replaced by MachOPlatform::rt_pushInitializers. The former returned a data
structure containing the "interesting" section address ranges, but these are
now handled by __orc_rt_macho_register_object_platform_sections. The new
rt_pushInitializers method first issues a lookup to trigger materialization
of the "interesting" sections, then returns the dylib dependence tree rooted
at the requested dylib for dlopen to consume. (The dylib dependence tree is
returned by rt_pushInitializers, rather than being handled by some dedicated
call, because rt_pushInitializers can alter the dependence tree).
The advantage of these changes (beyond the performance advantages of using
allocation actions) is that it moves more information about the materialized
portions of the JITDylib into the executor. This tends to make the runtime
easier to reason about, e.g. the implementation of dlopen in the runtime is now
recursive, rather than relying on recursive calls in the controller to build a
linear data structure for consumption by the runtime. This change can also make
some operations more efficient, e.g. JITDylibs can be dlclosed and then
re-dlopened without having to pull all initializers over from the controller
again.
In addition to the high-level changes, there are some low-level changes to ORC
and the runtime:
* In ORC, at ExecutionSession teardown time JITDylibs are now destroyed in
reverse creation order. This is on the assumption that the ORC runtime will be
loaded into an earlier dylib that will be used by later JITDylibs. This is a
short-term solution to crashes that arose during testing when the runtime was
torn down before its users. Longer term we will likely destroy dylibs in
dependence order.
* toSPSSerializable(Expected<T> E) is updated to explicitly initialize the T
value, allowing it to be used by Ts that have explicit constructors.
* The ORC runtime now (1) attempts to track ref-counts, and (2) distinguishes
not-yet-processed "interesting" sections from previously processed ones. (1)
is necessary for standard dlopen/dlclose emulation. (2) is intended as a step
towards better REPL support -- it should enable future runtime calls that
run only newly registered initializers ("dlopen_more", "dlopen_additions",
...?).
Fangrui Song [Tue, 8 Feb 2022 06:02:25 +0000 (22:02 -0800)]
[ELF] AArch64ErrataFix: replace std::map with DenseMap. NFC
There is now no <map> in lld/ELF.
Fangrui Song [Tue, 8 Feb 2022 05:53:34 +0000 (21:53 -0800)]
[ELF] Clean up headers. NFC
wangpc [Tue, 8 Feb 2022 05:42:15 +0000 (13:42 +0800)]
[RISCV] Split f64 undef into two i32 undefs
So that no store instruction will be generated.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D118222
Lang Hames [Tue, 8 Feb 2022 05:18:43 +0000 (16:18 +1100)]
[llvm-jitlink] Don't add process symbols to every JITDylib.
The addProcessSymbols function added a generator for process symbols to every
JITDylib in the session, but this is unhelpful default behavior (e.g. it will
cause the ORC runtime's definition of __cxa_atexit to be shadowed by the
process's definition for all JITDylibs except main).
Since the loadProcessSymbols function already added a generator to main we only
need to drop this function. Other JITDylibs wishing to resolve process symbols
can link against the main JITDylib by passing `-lmain`.
Lang Hames [Tue, 8 Feb 2022 05:10:10 +0000 (16:10 +1100)]
[ORC-RT] Make ExecutorAddr hashable.
This will be used in an upcoming macho_platform patch.
Amir Ayupov [Mon, 7 Feb 2022 19:03:20 +0000 (11:03 -0800)]
[BOLT][CMAKE][NFC] Update runtime/CMakeLists.txt
Summary:
- Specify compiler flags for runtime libraries as BOLT_RT_FLAGS,
- Remove redundant CMake definitions.
Reviewers: maksfb
FBD34048561
Amir Ayupov [Thu, 3 Feb 2022 03:08:27 +0000 (19:08 -0800)]
[BOLT] Add ld.lld substitution
Register ld.lld substition (tests were failing)
Reviewed By: yota9
Differential Revision: https://reviews.llvm.org/D118738
wangpc [Tue, 8 Feb 2022 04:52:13 +0000 (12:52 +0800)]
[RISCV] Pre-commit test for D118222
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D119212
Lang Hames [Tue, 8 Feb 2022 04:12:00 +0000 (15:12 +1100)]
[ORC-RT] Add more string_view operations and tests.
Adds construction from std::string, an ostream &operator<< and std::hash
specialization. Also adds unit tests for each of these operations, as well as
tests for copy construction and assignment.
These new operations will be used in upcoming macho_platform patches.
Lang Hames [Tue, 8 Feb 2022 03:23:02 +0000 (14:23 +1100)]
[ORC-RT] Fix typos in testcase.
Replace references to 'span' in string_view tests that were originally copied
from span tests.
Keith Smiley [Mon, 7 Feb 2022 23:08:24 +0000 (15:08 -0800)]
[test][llvm-objcopy/mac] Fix invalid strip tests
I discovered some of these tests had `cmp` statements that weren't
actually being run. I had also recently copied this broken setup for a
new test around chained fixups. Fixing this revealed that the binaries
did differ because of their code signature so I regenerated the fixture
here with this source:
```c
int main() {
return 0;
}
```
Passing `-Wl,-no_adhoc_codesign` on my M1 machine to make sure it didn't
get any signature.
Differential Revision: https://reviews.llvm.org/D119203
Keith Smiley [Mon, 7 Feb 2022 17:01:14 +0000 (09:01 -0800)]
[test][llvm-objcopy/mac] Move test to new file
Follow up from https://reviews.llvm.org/D118526
Differential Revision: https://reviews.llvm.org/D119149
Chuanqi Xu [Tue, 8 Feb 2022 03:50:57 +0000 (11:50 +0800)]
[C++20] [Modules] Don't create multiple global module fragment
Since the serialization code would recognize modules by names and the
name of all global module fragment is <global>, so that the
serialization code would complain for the same module.
This patch fixes this by using a unique global module fragment in Sema.
Before this patch, the compiler would fail on an assertion complaining
the duplicated modules.
Reviewed By: urnathan, rsmith
Differential Revision: https://reviews.llvm.org/D115610
Chuanqi Xu [Tue, 8 Feb 2022 03:42:38 +0000 (11:42 +0800)]
[C++20] [Coroutines] Warning for always_inline coroutine
See the discussion in https://reviews.llvm.org/D100282. The coroutine
marked always inline might not be inlined properly in current compiler
support. Since the coroutine would be splitted into pieces. And the call
to resume() and destroy() functions might be indirect call. Also the
ramp function wouldn't get inlined under O0 due to pipeline ordering
problems. It might be different to what users expects to. Emit a warning
to tell it.
This is what GCC does too: https://godbolt.org/z/7eajb1Gf8
Reviewed By: Quuxplusone
Differential Revision: https://reviews.llvm.org/D115867
River Riddle [Tue, 1 Feb 2022 21:27:46 +0000 (13:27 -0800)]
[mlir] Finish removing FunctionPass
FunctionPass has been deprecated in favor of OperationPass<FuncOp>
for a few weeks, and this commit finished the deprecation with deletion.
The only difference between the two is that FunctionPass filters out function
declarations. When updating references to FunctionPass, ensure that
the pass either can handle declarations or explicitly add in filtering.
See https://llvm.discourse.group/t/functionpass-deprecated-in-favor-of-operationpass-funcop
Differential Revision: https://reviews.llvm.org/D118735
River Riddle [Tue, 8 Feb 2022 01:54:04 +0000 (17:54 -0800)]
[mlir] Update uses of `parser`/`printer` ODS op field to `hasCustomAssemblyFormat`
The parser/printer fields are deprecated and in the process of being removed.
River Riddle [Sat, 5 Feb 2022 21:59:43 +0000 (13:59 -0800)]
[mlir] Update Toy operations to use the `hasCustomAssemblyFormat` field
The parser/printer fields are deprecated and in the process of being removed.
River Riddle [Sun, 6 Feb 2022 20:33:08 +0000 (12:33 -0800)]
[mlir][NFC] Remove deprecated/old build/fold/parser utilities from OpDefinition
These have generally been replaced by better ODS functionality, and do not
need to be explicitly provided anymore.
Differential Revision: https://reviews.llvm.org/D119065
River Riddle [Sun, 6 Feb 2022 20:32:47 +0000 (12:32 -0800)]
[mlir][NFC] Remove a few op builders that simply swap parameter order
Differential Revision: https://reviews.llvm.org/D119093
River Riddle [Sat, 5 Feb 2022 04:47:01 +0000 (20:47 -0800)]
[mlir:ODS] Deprecate Op parser/printer fields in favor of a new hasCustomAssemblyFormat field
Currently if an operation wants a C++ implemented parser/printer, it specifies inline
code blocks. This is quite problematic for various reasons, e.g. it requires defining
C++ inside of Tablegen which is discouraged when possible, but mainly because
nearly all usages simply forward to static functions (e.g. `static void parseSomeOp(...)`)
with users devising their own standards for how these are defined.
This commit adds support for a `hasCustomAssemblyFormat` bit field that specifies if
a C++ parser/printer is needed, and when set to 1 declares the parse/print methods for
operations to override. For migration purposes, the existing behavior is untouched. Upstream
usages will be replaced in a followup to keep this patch focused on the new implementation.
Differential Revision: https://reviews.llvm.org/D119054
Arthur Eubanks [Wed, 2 Feb 2022 00:47:29 +0000 (16:47 -0800)]
[clang] Fix some clang->llvm type cache invalidation issues
Take the following as an example
struct z {
z (*p)();
};
z f();
When we attempt to get the LLVM type of f, we recurse into z. z itself
has a function pointer with the same type as f. Given the recursion,
Clang simply treats z::p as a pointer to an empty struct `{}*`. The
LLVM type of f is as expected. So we have two different potential
LLVM types for a given Clang type. If we store one of those into the
cache, when we access the cache with a different context (e.g. we
are/aren't recursing on z) we may get an incorrect result. There is some
attempt to clear the cache in these cases, but it doesn't seem to handle
all cases.
This change makes it so we only use the cache when we are not in any
sort of function context, i.e. `noRecordsBeingLaidOut() &&
FunctionsBeingProcessed.empty()`, which are the cases where we may
decide to choose a different LLVM type for a given Clang type. LLVM
types for builtin types are never recursive so they're always ok.
This allows us to clear the type cache less often (as seen with the
removal of one of the calls to `TypeCache.clear()`). We
still need to clear it when we use a placeholder type then replace it
later with the final type and other dependent types need to be
recalculated.
I've added a check that the cached type matches what we compute. It
triggered in this test case without the fix. It's currently not
check-clang clean so it's not on by default for something like expensive
checks builds.
This change uncovered another issue where the LLVM types for an argument
and its local temporary don't match. For example in type-cache-3, when
expanding z::dc's argument into a temporary alloca, we ConvertType() the
type of z::p which is `void ({}*)*`, which doesn't match the alloca GEP
type of `{}*`.
No noticeable compile time changes:
https://llvm-compile-time-tracker.com/compare.php?from=
3918dd6b8acf8c5886b9921138312d1c638b2937&to=
50bdec9836ed40e38ece0657f3058e730adffc4c&stat=instructions
Fixes #53465.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D118744
Sameer Sahasrabuddhe [Tue, 8 Feb 2022 02:45:32 +0000 (21:45 -0500)]
[AMDGPU] [NFC] refactor the AMDGPU attributor
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D119087
Carl Ritson [Tue, 8 Feb 2022 02:27:23 +0000 (11:27 +0900)]
[AMDGPU] Allow hoisting of some VALU compare instructions
Conversatively allow hoisting/sinking of VALU comparisons.
If the result of a comparison is masked with exec, narrowing the
set of active lanes, then it is safe to hoist it as the masking
instruction will never by hoisted.
Heuristically this is also true for sinking, as we do not expect
the result of a sunk comparison that is masked with exec to be
used outside of the loop.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D118975
Johannes Doerfert [Tue, 8 Feb 2022 01:39:19 +0000 (19:39 -0600)]
[Attributor][FIX] Do not use assumed information for UB detection
The helper `Attributor::checkForAllReturnedValuesAndReturnInsts`
simplifies the returned value optimistically. In `AAUndefinedBehavior`
we cannot use such optimistic values when deducing UB. As a result, we
assumed UB for the return value of a function because we initially
(=optimistically) thought the function return is `undef`. While we later
adjusted this properly, the `AAUndefinedBehavior` was under the
impression the return value is "known" (=fix) and could never change.
To correct this we use `Attributor::checkForAllInstructions` and then
manually to perform simplification of the return value, only allowing
known values to be used. This actually matches the other UB deductions.
Fixes #53647
Johannes Doerfert [Tue, 1 Feb 2022 20:32:33 +0000 (14:32 -0600)]
[MemoryBuiltins][FIX] Adjust index type size properly wrt. AS casts
Use existing functionality to strip constant offsets that works well
with AS casts and avoids the code duplication.
Since we strip AS casts during the computation of the offset we also
need to adjust the APInt properly to avoid mismatches in the bit width.
This code ensures the caller of `compute` sees APInts that match the
index type size of the value passed to `compute`, not the value result
of the strip pointer cast.
Fixes #53559.
Differential Revision: https://reviews.llvm.org/D118727
Sheng [Tue, 8 Feb 2022 02:08:21 +0000 (21:08 -0500)]
[M68k][GlobalISel] Implement lowerCall based on M68k calling convention
This patch implements CallLowering::lowerCall based on M68k calling
convention and adds M68kOutgoingValueHandler and CallReturnHandler to
handle argument passing and returned value.
Tue Ly [Tue, 8 Feb 2022 02:04:12 +0000 (21:04 -0500)]
[libc] Return a float NaN for log1pf instead of double NaN.
Jez Ng [Tue, 8 Feb 2022 02:06:02 +0000 (21:06 -0500)]
[lld-macho] Include address offsets in error messages
This makes it easier to pinpoint the source of the problem.
TODO: Have more relocation error messages make use of this
functionality.
Reviewed By: #lld-macho, oontvoo
Differential Revision: https://reviews.llvm.org/D118798
Craig Topper [Tue, 8 Feb 2022 01:52:08 +0000 (17:52 -0800)]
[SystemZ] Remove a superfluous semicolon to fix a gcc warning. NFC
Lancelot Six [Tue, 8 Feb 2022 00:06:13 +0000 (19:06 -0500)]
[AMDGPU][NFC] AMDGPUUsage.rst: fix wording.
Sheng [Tue, 8 Feb 2022 00:04:27 +0000 (19:04 -0500)]
[GlobalISel][Legalizer] Support reducing load/store width in big endian order
Sheng [Tue, 8 Feb 2022 00:03:26 +0000 (19:03 -0500)]
M68K: Pre-commit test of D116931
Alex Lorenz [Tue, 8 Feb 2022 00:49:47 +0000 (16:49 -0800)]
[clang][driver] update the darwin driver to point to correct macho_embedded path
Compiler-rt started emitting the macho_embedded libraries in
`<resource_dir>/lib/darwin/macho_embedded` after
https://reviews.llvm.org/D105765 /
1e03c37b97b6176a60404d84665c40321f4e33a4,
so update the clang's driver to reflect that.
Differential Revision: https://reviews.llvm.org/D115403
Vladislav Khmelevsky [Fri, 4 Feb 2022 22:33:11 +0000 (01:33 +0300)]
[BOLT] Fix runtime osx cross-compile build
Place include elf.h under !apple condition
Differential Revision: https://reviews.llvm.org/D119038
Nikolas Klauser [Mon, 7 Feb 2022 20:06:03 +0000 (21:06 +0100)]
[libc++][CI] Put runs into groups
Many CI runs are very similar in nature. Let's put them into groups for a better overview
Reviewed By: ldionne, #libc
Spies: libcxx-commits, arichardson, mstorsjo
Differential Revision: https://reviews.llvm.org/D119059
Vladislav Khmelevsky [Tue, 1 Feb 2022 20:41:07 +0000 (23:41 +0300)]
[BOLT] Add aarch64 support for peephole passes
Enable peephole optimizations for aarch64.
Also small code refactoring - add PeepholeOpts under Peepholes class.
Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei
Differential Revision: https://reviews.llvm.org/D118732
Craig Topper [Mon, 7 Feb 2022 23:52:13 +0000 (15:52 -0800)]
[RISCV] Use splat_vector instead of SplatPat in widening FP instruction patterns. NFCI
We use splat_vector for FP nodes without VL, not SplatPat which handles
splat_vector and integer VMV_V_X_VL.
Reduces isel table size by a few hundred bytes.
Craig Topper [Mon, 7 Feb 2022 21:24:36 +0000 (13:24 -0800)]
[VP] llvm.vp.fma intrinsic and LangRef
Differential Revision: https://reviews.llvm.org/D119185
Nico Weber [Mon, 7 Feb 2022 23:45:04 +0000 (18:45 -0500)]
[gn build] (manually) port
157bbe6aea22e
Joe Loser [Mon, 7 Feb 2022 00:47:45 +0000 (19:47 -0500)]
[libc++] Mark some members private in experimental/functional
Some members are public but should be private. Nothing requires they are public
right now, so make them private.
Differential Revision: https://reviews.llvm.org/D119097
Mahesh Ravishankar [Mon, 7 Feb 2022 22:50:36 +0000 (22:50 +0000)]
Revert "[mlir][Linalg] NFC: Combine elementwise fusion test passes."
This reverts commit
d730336411b59622a625510378cec0f9d23807c6.
Louis Dionne [Wed, 8 Sep 2021 16:57:58 +0000 (12:57 -0400)]
[libc++] Remove the ability to use the std::nullptr_t emulation in C++03 mode
Back in https://reviews.llvm.org/D109459, we stopped using the C++03
emulation for std::nullptr_t by default, which was an ABI break. We
still left a knob for users to turn it back on if they were broken by
the change, with a note that we would remove that knob after one release.
The time has now come to remove the knob and clean up the std::nullptr_t
emulation.
Differential Revision: https://reviews.llvm.org/D114786
Mahesh Ravishankar [Mon, 7 Feb 2022 17:45:28 +0000 (17:45 +0000)]
[mlir][Linalg] NFC: Combine elementwise fusion test passes.
There are a few different test passes that check elementwise fusion in
Linalg. Consolidate them to a single pass controlled by different pass
options (in keeping with how `TestLinalgTransforms` exists).
Dave Lee [Mon, 7 Feb 2022 20:24:51 +0000 (12:24 -0800)]
[lldb] Call __lldb_init_module from __init__
Update `__init__.py` generation to implement `__lldb_init_module`, which calls
`__lldb_init_module` on submodules that define it.
This allows the use case where a user runs `command script import lldb.macosx`.
With this change, the `__lldb_init_module` function in `crashlog.py` and
`heap.py` will be run, which is where command registration is occurring.
Differential Revision: https://reviews.llvm.org/D119179
Keith Smiley [Thu, 3 Feb 2022 01:46:11 +0000 (17:46 -0800)]
[llvm-libtool-darwin] Add -warnings_as_errors
libtool can currently produce 2 warnings:
1. No symbols were in the object file
2. An object file with the same basename was specified multiple times
The first warning here is often harmless and may just mean you have some
translation units with no symbols for the target you're building for.
The second warning can lead to real issues like those mentioned in
https://reviews.llvm.org/D113130 where ODR violations can slip in.
This introduces a new -warnings_as_errors flag that can be used by build
systems that want to verify they never hit these warnings. For example
with bazel the libtool caller first uniques names to make sure the
duplicate base name case is not possible, but if that doesn't work as
expected, having it fail would be preferred.
It's also worth noting that llvm-libtool-darwin works around an issue
that cctools libtool experiences related to debug info and duplicate
basenames, the workaround is described here:
https://github.com/llvm/llvm-project/blob/
30baa5d2a450d5e302d8cba3fc7a26a59d4b7ae1/llvm/lib/Object/ArchiveWriter.cpp#L424-L465
And it avoids this bug:
https://github.com/keith/radars/tree/
f0cbbb1c37126ec6528c132510b29e08566377a7/DuplicateBasenameIssue
Differential Revision: https://reviews.llvm.org/D118931
Sanjay Patel [Mon, 7 Feb 2022 22:14:30 +0000 (17:14 -0500)]
[SDAG] try to fold one-demanded-bit-of-multiply
This is a translation of the transform added to InstCombine with:
D118539
Ruslan Arutyunyan [Mon, 7 Feb 2022 22:02:57 +0000 (01:02 +0300)]
[libcxx][test][NFC] Add tests for backward iteration over associative
containers
Add test cases for iteration over the ordered associative container from
end to begin using operator--
Reviewed By: Quuxplusone, rarutyun
Differential Revision: https://reviews.llvm.org/D118114
Joseph Huber [Mon, 7 Feb 2022 21:41:35 +0000 (16:41 -0500)]
[Libomptarget] Replace Value RAII with default value
This patch replaces the ValueRAII pointer with a default 'nullptr'
value. Previously this was initialized as a reference to an existing
variable. The use of this variable caused overhead as the compiler could
not look through the uses and determine that it was unused if 'Active'
was not set. Because of this accesses to the variable would be left in
the runtime once compiled.
Fixes #53641
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D119187
Paul Robinson [Mon, 7 Feb 2022 22:01:49 +0000 (14:01 -0800)]
Fix my email address in CODE_OWNERS.TXT
Sanjay Patel [Mon, 7 Feb 2022 21:59:50 +0000 (16:59 -0500)]
[x86] avoid compile-time warning for parens; NFC
Sergei Grechanik [Mon, 7 Feb 2022 20:42:23 +0000 (12:42 -0800)]
[mlir][spirv] Fix verification of nested array constants
Fix the verification function of spirv::ConstantOp to allow nesting
array attributes.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D118939
Andrew Browne [Mon, 7 Feb 2022 20:21:30 +0000 (12:21 -0800)]
[Bitstream] Temporarily disable UBSan for invalid bitcode tests. This fixes failing sanitizer buildbots.
Tests added by
https://github.com/llvm/llvm-project/commit/
3c86642edd28f1ce970882edaba8dce468ec7401
https://github.com/llvm/llvm-project/commit/
f4fca0fbb052e55935b483c8955c440b59511ce8
cause existing code to exhibit UB:
https://github.com/llvm/llvm-project/blob/
b4c6d1bb379192cb5b712fda9f60cd105f21194f/llvm/include/llvm/Bitstream/BitstreamReader.h#L244
llvm/include/llvm/Bitstream/BitstreamReader.h:244:51:
runtime error: shift exponent 35 is too large for 32-bit type 'unsigned int'
Hitting the UBSan error before the expected error causes the test to fail under UBSan:
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D119182
Tue Ly [Mon, 7 Feb 2022 17:38:40 +0000 (12:38 -0500)]
[libc] Fix mixed-sign comparison warnings and an out-of-bound access in high_precision_decimal.h
Fix mixed-sign comparison warnings and an out-of-bound access in high_precision_decimal.h
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D119156
Tue Ly [Mon, 7 Feb 2022 20:54:50 +0000 (15:54 -0500)]
[libc][Obvious] Suppress unused-variable warnings from syscall_unittest.
The unused vararibles in the tests are intentional.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D119183
Tue Ly [Fri, 4 Feb 2022 02:27:26 +0000 (21:27 -0500)]
[libc] Implement log1pf correctly rounded to all rounding modes.
Implement log1pf correctly rounded to all rounding modes relying on logf implementation for exponent > 2^(-8).
Reviewed By: sivachandra, zimmermann6
Differential Revision: https://reviews.llvm.org/D118962
Matt Morehouse [Mon, 7 Feb 2022 21:10:06 +0000 (13:10 -0800)]
[HWASan] Use hwasan_memalign for aligned new.
Aligned new does not require size to be a multiple of alignment, so
memalign is the correct choice instead of aligned_alloc.
Fixes false reports for unaligned sizes.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D119161
Elizabeth Andrews [Fri, 4 Feb 2022 23:45:35 +0000 (15:45 -0800)]
Fix address space for function pointers with qualifier
This patch fixes a bug introduced in commit
4eaf5846d0e7. Commit
4eaf5846d0e7 sets address space of function type as program
address space unconditionally. This breaks types which have
address space qualifiers. E.g. __ptr32.
This patch fixes the bug by using address space qualifiers if
present.
Differential Revision: https://reviews.llvm.org/D119045
Sanjay Patel [Mon, 7 Feb 2022 20:22:08 +0000 (15:22 -0500)]
[SDAG] SimplifyDemandedBits - generalize fold for 2 LSB of X*X
This is translated from recent changes to the IR version of this function:
D119060
D119139
Sanjay Patel [Mon, 7 Feb 2022 20:09:45 +0000 (15:09 -0500)]
[AArch64] add tests for demanded bits of multiply; NFC
This is adapted from existing tests for instcombine.
We want to keep the backend logic synchronized with
that as much as possible.
See D119139 / D119060 / D118539
Dave Lee [Mon, 7 Feb 2022 17:31:25 +0000 (09:31 -0800)]
[lldb] Print message after loading 'crashlog' command
Previously, importing `crashlog` resulted in a message being printed. The
message was about other commands (those in heap.py), not `crashlog`. The
changes in D117237 made it so that the heap.py messages were printed only when
importing `lldb.macosx.heap`, not when importing `lldb.macosx.crashlog`. Some
users may see no output and think `crashlog` wasn't successfully loaded. This
ensures users see that `crashlog` is loaded.
rdar://
88283132
Differential Revision: https://reviews.llvm.org/D119155
Aaron Ballman [Mon, 7 Feb 2022 20:28:35 +0000 (15:28 -0500)]
Use functions with prototypes when appropriate; NFC
A significant number of our tests in C accidentally use functions
without prototypes. This patch converts the function signatures to have
a prototype for the situations where the test is not specific to K&R C
declarations. e.g.,
void func();
becomes
void func(void);
This is the fourth batch of tests being updated (there are a significant
number of other tests left to be updated).
Joseph Huber [Mon, 7 Feb 2022 20:23:50 +0000 (15:23 -0500)]
[Clang][Docs] Fix some typos in offloading design documentation
serge-sans-paille [Fri, 4 Feb 2022 11:00:40 +0000 (12:00 +0100)]
Cleanup LLVMBitcode headers
Major user-facing changes:
llvm/Bitcode/BitcodeReader.h no longer includes llvm/IR/ModuleSummaryIndex.h
Some statistics:
clang++ -E -Iinclude -I../llvm/include ../llvm/lib/Bitcode/Reader/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l
after: 493335
before: 539640
Discourse thread on the topic: https://discourse.llvm.org/t/include-what-you-use-include-cleanup/
Differential Revision: https://reviews.llvm.org/D119091
Joseph Huber [Mon, 7 Feb 2022 19:59:03 +0000 (14:59 -0500)]
[OpenMP] Use executable path when searching for lld
Summary:
This patch changes the ClangLinkerWrapper to use the executable path
when searching for the lld binary. Previously we relied on the program
name. Also not finding 'llvm-strip' is not considered an error anymore
because it is an optional optimization.
Jonas Devlieghere [Mon, 7 Feb 2022 20:06:30 +0000 (12:06 -0800)]
[lldb] Fix Lua/watchpoint_callback.test on Apple Silicon
As Pavel pointed out, on Apple Silicon "b main" stops at a point after
the variable has already been initialized. This patch updates the test
case to avoids that. I've also split the test into separate files so its
easier to reproduce the individual scenarios without having to build any
shared state.
Nikolas Klauser [Fri, 4 Feb 2022 23:00:31 +0000 (00:00 +0100)]
[libc++][CI] Reorder CI runs
This patch makes the uncontrovertial changes to the pipeline.
Reviewed By: ldionne, #libc
Spies: libcxx-commits, arichardson
Differential Revision: https://reviews.llvm.org/D119041
Fangrui Song [Mon, 7 Feb 2022 19:45:31 +0000 (11:45 -0800)]
David Green [Mon, 7 Feb 2022 19:34:28 +0000 (19:34 +0000)]
[LoopVectorizer] Don't perform interleaving of predicated scalar loops
The vectorizer will choose at times to "vectorize" loops with a scalar
factor (VF=1) with interleaving (IC > 1). This can occasionally produce
better code than the unroller (notable for reductions where it can
produce independent reduction chains that are combined after the loop).
At times this is not very beneficial though, for example when runtime
checks are needed or when the scalar code requires predication.
This addresses the second point, preventing the vectorizer from
interleaving when the scalar loop will require predication. This
prevents it from making a bit of a mess, that is worse than the original
and better left for the unroller to unroll if beneficial. It helps
reverse some of the regressions from D118090.
Differential Revision: https://reviews.llvm.org/D118566
Arjun P [Mon, 7 Feb 2022 19:01:27 +0000 (00:31 +0530)]
[MLIR][Presburger] Add support for piece-wise multi-affine functions
Add the class MultiAffineFunction which represents functions whose domain is an
IntegerPolyhedron and which produce an output given by a tuple of affine
expressions in the IntegerPolyhedron's ids.
Also add support for piece-wise MultiAffineFunctions, which are defined on a
union of IntegerPolyhedrons, and may have different output affine expressions
on each IntegerPolyhedron. Thus the function is affine on each individual
IntegerPolyhedron piece in the domain.
This is part of a series of patches leading up to parametric integer programming.
Depends on D118778.
Reviewed By: Groverkss
Differential Revision: https://reviews.llvm.org/D118779
Vang Thao [Fri, 4 Feb 2022 18:44:20 +0000 (10:44 -0800)]
[AMDGPU] Fix debug values in scheduler not placed correctly when reverting
Debug position data is cleared after ScheduleDAGMILive::schedule() due to it also calling placeDebugValues(). Make it so the data is not cleared after initial call to placeDebugValues since we will call it again after reverting a schedule.
Secondly, since we skip debug instructions when reverting the schedule on AMDGPU, all debug instructions are now moved to the end of the scheduling region. RegionEnd points to the beginning of this chunk of debug instructions since it was not incremented when a debug instruction was skipped. RegionBegin may also point to the same debug instruction if Unsched.front() is a debug instruction thus shrinking the region to 1. Fix RegionBegin and RegionEnd so that they point to the current beginning and ending before calling placeDebugValues() since both vars will be used as reference points to move debug instructions back.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D119022
Vladislav Khmelevsky [Mon, 7 Feb 2022 18:30:38 +0000 (21:30 +0300)]
[BOLT] Refactor heatmap to be standalone tool
Separate heatmap from bolt and build it as standalone tool.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D118946
Nikolas Klauser [Mon, 7 Feb 2022 15:07:01 +0000 (16:07 +0100)]
[libc++] Disable -Wattributes in GCC
Currently GCC produces lots of warnings. Most of them are `-Wattributes`, but these warnings are completly ignored by everybody. So let's disable -Wattributes and make the output cleaner.
Reviewed By: ldionne, #libc
Spies: libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D119140
Florian Mayer [Mon, 7 Feb 2022 18:38:25 +0000 (10:38 -0800)]
[NFC] use Range based any_of for more concise code.
Fangrui Song [Mon, 7 Feb 2022 18:26:16 +0000 (10:26 -0800)]
[ELF] Move Symbol::needsTlsLd to config->needsTlsLd
to decrease sizeof(SymbolUnion) from 72 to 64 on ELF64 platforms.
Use a dummy `Undefined` to prevent null pointer dereference (though unused)
`*rel.sym` in InputSectionBase::relocateAlloc.
The relocation order may shuffle a bit, but otherwise there is no behavior
difference.
Florian Hahn [Mon, 7 Feb 2022 18:07:19 +0000 (18:07 +0000)]
[LV] Adjust accesses in test to ensure full RT checks are generated.
Add an additional access so the full runtime checks are still generated,
even after D119078.
Fangrui Song [Mon, 7 Feb 2022 18:00:42 +0000 (10:00 -0800)]
[libc++][docs] Change some words to use reST inline literals
Reviewed By: #libc, ldionne, Quuxplusone
Differential Revision: https://reviews.llvm.org/D119052
Alexander Kornienko [Mon, 7 Feb 2022 17:46:39 +0000 (18:46 +0100)]
Revert "[ELF] Move Symbol::needsTlsLd to config->needsTlsLd. NFC"
This reverts commit
f9e3ca542ec17a0aa706bb51dcddf7fc6f0988ac.
The commit results in internal test failures. Test case provided offline.
Florian Hahn [Mon, 7 Feb 2022 17:46:16 +0000 (17:46 +0000)]
[LV] Use IRBuilderBase in VPlan.h, remove IRBuilder.h include (NFC).
By using IRBuilderBase instead of IRBuilder<> a forward declaration can
be used instead of including IRBuilder.h
Adrian Prantl [Mon, 7 Feb 2022 17:41:39 +0000 (09:41 -0800)]
Revert "Add llgs category to all tests in TestLldbGdbServer that attach to the process."
This reverts commit
d42765b3bea5ee90426c49f35b0b5654de82a4f9.
Jonas Devlieghere [Mon, 7 Feb 2022 17:40:45 +0000 (09:40 -0800)]
[lldb] Skip part of TestGdbRemoteMemoryAllocation.py on Apple Silicon
Skip the part of TestGdbRemoteMemoryAllocation.py that attempts to
allocate both writable and executable memory.
Matthias Springer [Mon, 7 Feb 2022 17:25:55 +0000 (02:25 +0900)]
[mlir][SCF] Further simplify affine maps during `for-loop-canonicalization`
* Implement `FlatAffineConstraints::getConstantBound(EQ)`.
* Inject a simpler constraint for loops that have at most 1 iteration.
* Taking into account constant EQ bounds of FlatAffineConstraint dims/symbols during canonicalization of the resulting affine map in `canonicalizeMinMaxOp`.
Differential Revision: https://reviews.llvm.org/D119153
Sam James [Mon, 7 Feb 2022 17:37:08 +0000 (09:37 -0800)]
[libunwind] Define _Unwind_Backtrace for powerpc, sparc
Add SPARC to the list of platforms for which we provide a full
unwind implementation which leads to _Unwind_Backtrace being defined within
libunwind.so.
Likewise for PPC (see D118320 for background).
Reviewed By: #libunwind, MaskRay, Arfrever
Differential Revision: https://reviews.llvm.org/D119068
Jonas Devlieghere [Mon, 7 Feb 2022 17:30:20 +0000 (09:30 -0800)]
[lldb] Fix a few lldb-server tests on Apple Silicon
This fixes TestGdbRemoteSingleStep.py and TestGdbRemote_vCont.py. This
patch updates the test to account for the possibility that the constants
are already materialized. This appears to behave differently between
embedded arm64 devices and Apple Silicon.
Arthur Eubanks [Mon, 7 Feb 2022 17:29:27 +0000 (09:29 -0800)]
[gn build] Port D119058
Arthur Eubanks [Fri, 4 Feb 2022 17:21:20 +0000 (09:21 -0800)]
[clang] Cache OpenCL types
If we call CGOpenCLRuntime::convertOpenCLSpecificType() multiple times
we should get the same type back.
Reviewed By: svenvh
Differential Revision: https://reviews.llvm.org/D119011
Mariusz Ceier [Mon, 7 Feb 2022 17:20:03 +0000 (09:20 -0800)]
Fix lld standalone build
lld/ELF/OutputSections.cpp includes llvm/Config/config.h for
LLVM_ENABLE_ZLIB definition, but llvm/Config/config.h doesn't exist in
standalone build.
To fix this, this patch moves LLVM_ENABLE_ZLIB from config.h to
llvm-config.h and updates OutputSections.cpp to include llvm-config.h
instead of config.h
Reviewed By: MaskRay, mgorny
Differential Revision: https://reviews.llvm.org/D119058
Sanjay Patel [Mon, 7 Feb 2022 16:04:22 +0000 (11:04 -0500)]
[InstCombine] generalize 2 LSB of demanded bits for X*X
This is a follow-up suggested in D119060.
Instead of checking each of the bottom 2 bits individually,
we can check them together and handle the possibility that
we demand both together.
https://alive2.llvm.org/ce/z/C2ihC2
Differential Revision: https://reviews.llvm.org/D119139
Adrian Prantl [Mon, 7 Feb 2022 16:25:54 +0000 (08:25 -0800)]
Add llgs category to all tests in TestLldbGdbServer that attach to the process.
David Goldman [Mon, 7 Feb 2022 15:20:33 +0000 (10:20 -0500)]
Reland "[clangd] Properly compute framework-style include spelling"
Roll forward of https://reviews.llvm.org/D117056 with a fix. Proper
initialization of `IsPrivateHeader` was missing, causing failures
on Linux.
Nathan Sidwell [Fri, 21 Jan 2022 19:00:56 +0000 (11:00 -0800)]
[demangler] Stricter NestedName parsing
The parsing of nested names is a little lax. This corrects that.
1) The 'L' local name prefix cannot appear before a NestedName -- only
within it. Let's remove that check from parseName, and then adjust
parseUnscopedName to allow it with or without the 'St' prefix.
2) In a nested name, a <template-param>, <decltype> or <substitution>
can only appear as the first element. Let's enforce that. Note I do
not remove these from the loop, to make the change easier to follow
(such a change will come later).
3) Given that, there's no need to special case 'St' outside of the
loop, handle it with the other 'S' elements.
4) There's no need to reset 'EndsWithTemplateArgs' after each
non-template-arg component. Rather, always clear it and then set it
in the template-args case.
5) An template-args cannot immediately follow a template-args.
6) The parsing of a CDtor name with ABITags would attach the tags to
the NestedName node, rather than the CDTor node. This is different to
how ABITags are attached to an unscopedName. Make it consistent.
7) We remain with only CDTor and UnscopedName requireing construction
of a NestedName, so let's drop the PushComponent lambda.
8) Add some tests to catch the new rejected manglings.
Reviewed By: ChuanqiXu
Differential Revision: https://reviews.llvm.org/D118132
Jonas Devlieghere [Mon, 7 Feb 2022 16:11:30 +0000 (08:11 -0800)]
[lldb] Update outdated comment in TestDyldTrieSymbols.py
After
aed965d55d46 we no longer demangle and store the full name. The
test was updated accordingly but the comment still specified that we
should be able to find the symbol by its full demangled name.
Nikita Popov [Mon, 7 Feb 2022 15:52:31 +0000 (16:52 +0100)]
[MatrixBuilder] Require explicit element type in CreateColumnMajorLoad()
This makes the method compatible with opaque pointers.
Hans Wennborg [Mon, 7 Feb 2022 15:47:14 +0000 (16:47 +0100)]
Revert "Remove -Wweak-template-vtables"
Turns out there's still some code referencing this. No harm in keeping it in a
bit longer.
> as it was planned for removal in clang 15 and we're now past the branch point
>
> See https://github.com/llvm/llvm-project/issues/19107
>
> Differential revision: https://reviews.llvm.org/D118762
This reverts commit
564f9be11c9cb8d131f48df07538fab7a19b41a7.