Amara Emerson [Wed, 12 Jan 2022 22:54:11 +0000 (14:54 -0800)]
[AArch64][GlobalISel] Re-generate checks for a test.
River Riddle [Mon, 3 Jan 2022 07:12:03 +0000 (23:12 -0800)]
[mlir] Add a parsePassPipeline overload that returns a new pass manager
This overload parses a pipeline string that contains the anchor operation type, and returns an OpPassManager
corresponding to the provided pipeline. This is useful for various situations, such as dynamic pass pipelines
which are not anchored within a parent pass pipeline.
fixes #52813
Differential Revision: https://reviews.llvm.org/D116525
Michael Jones [Wed, 12 Jan 2022 22:33:03 +0000 (14:33 -0800)]
[libc] fix strtold_test formatting on ARM
I missed a variable when reformatting the tests. This fixes that.
Differential Revision: https://reviews.llvm.org/D117161
Daniel McIntosh [Wed, 8 Dec 2021 18:22:52 +0000 (13:22 -0500)]
[libcxxabi] Added convenience classes to cxa_guard
This is the 5th of 5 changes to overhaul cxa_guard.
See D108343 for what the final result will be.
Depends on D115368
Reviewed By: ldionne, #libc_abi
Differential Revision: https://reviews.llvm.org/D115369
Daniel McIntosh [Wed, 8 Dec 2021 18:16:21 +0000 (13:16 -0500)]
[libcxxabi] Re-organized inheritance structure to remove CRTP in cxa_guard
Currently, the `InitByte...` classes inherit from `GuardObject` so they can
access the `base_address`, `init_byte_address` and `thread_id_address`. Then,
since `GuardObject` needs to call `acquire`/`release`/`abort_init_byte`, it uses
the curiously recurring template pattern (CRTP). This is rather messy.
Instead, we'll have `GuardObject` contain an instance of `InitByte`, and pass it
the addresses it needs in the constructor. `GuardObject` doesn't need the
addresses anyways, so it makes more sense for `InitByte` to keep them instead of
`GuardObject`. Then, `GuardObject` can call `acquire`/`release`/`abort` as one
of `InitByte`'s member functions.
Organizing things this way not only gets rid of the use of the CRTP, but also
improves separation of concerns a bit since the `InitByte` classes are no longer
indirectly responsible for things because of their inheritance from
`GuardObject`. This means we no longer have strange things like calling
`InitByteFutex.cxa_guard_acquire`, instead we call
`GuardObject<InitByteFutex>.cxa_guard_acquire`.
This is the 4th of 5 changes to overhaul cxa_guard.
See D108343 for what the final result will be.
Depends on D115367
Reviewed By: ldionne, #libc_abi
Differential Revision: https://reviews.llvm.org/D115368
Daniel McIntosh [Wed, 8 Dec 2021 17:53:03 +0000 (12:53 -0500)]
[libcxxabi] Pulled guard byte code out of GuardObject
Right now, GuardObject is in charge of both reading and writing to the guard
byte, and co-ordinating with the InitByte... classes. In order to improve
separation of concerns, create a separate class responsible for managing the
guard byte and use that inside GuardObject.
This is the 3rd of 5 changes to overhaul cxa_guard.
See D108343 for what the final result will be.
Depends on D110088
Reviewed By: ldionne, #libc_abi
Differential Revision: https://reviews.llvm.org/D115367
Daniel McIntosh [Mon, 16 Aug 2021 18:07:55 +0000 (14:07 -0400)]
[libcxxabi] Make InitByteGlobalMutex check GetThreadID instead of PlatformThreadID
By relying on PlatformSupportsThreadID, InitByteGlobalMutex disregards
the GetThreadID template argument, rendering it useless.
This is the 2nd of 5 changes to overhaul cxa_guard.
See D108343 for what the final result will be.
Depends on D109539
Reviewed By: ldionne, #libc_abi
Differential Revision: https://reviews.llvm.org/D110088
Daniel McIntosh [Wed, 11 Aug 2021 14:47:48 +0000 (10:47 -0400)]
[NFC][libcxxabi] Rename GlobalLock to GlobalMutex
This will make the naming more consistent with what it's called in the
rest of the file.
This is the 1st of 5 changes to overhaul cxa_guard.
See D108343 for what the final result will be.
Reviewed By: ldionne, #libc_abi
Differential Revision: https://reviews.llvm.org/D109539
Michael Jones [Wed, 12 Jan 2022 21:44:10 +0000 (13:44 -0800)]
[libc] add working ARM entrypoints
Some functions were added to x86_64 that were untested on Aarch64. Now
that I've had an opportunity to test them, they all work on Aarch64 with
the minor formatting change included.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D117146
natashaknk [Wed, 12 Jan 2022 22:10:27 +0000 (14:10 -0800)]
[tosa][mlir] Support dynamic batch dimension for ops where the batch dim is explicit
Dynamic batch for rescale, gather, max_pool, avg_pool, conv2D and depthwise_conv2D. Split helper functions into a separate header file.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D117031
River Riddle [Mon, 10 Jan 2022 18:55:57 +0000 (10:55 -0800)]
[mlir] Refactor ShapedType into an interface
ShapedType was created in a time before interfaces, and is one of the earliest
type base classes in the ecosystem. This commit refactors ShapedType into
an interface, which is what it would have been if interfaces had existed at that
time. The API of ShapedType and it's derived classes are essentially untouched
by this refactor, with the exception being the API surrounding kDynamicIndex
(which requires a sole home).
For now, the API of ShapedType and its name have been kept as consistent to
the current state of the world as possible (to help with potential migration churn,
among other reasons). Moving forward though, we should look into potentially
restructuring its API and possible its name as well (it should really have "Interface"
at the end like other interfaces at the very least).
One other potentially interesting note is that I've attached the ShapedType::Trait
to TensorType/BaseMemRefType to act as mixins for the ShapedType API. This
is kind of weird, but allows for sharing the same API (i.e. preventing API loss from
the transition from base class -> Interface). This inheritance doesn't affect any
of the derived classes, it is just for API mixin.
Differential Revision: https://reviews.llvm.org/D116962
River Riddle [Sat, 8 Jan 2022 01:41:06 +0000 (17:41 -0800)]
[mlir][Interfaces] Add a extraSharedClassDeclaration field
This field allows for defining a code block that is placed in both the interface
and trait declarations. This is very useful when defining a set of utilities to
expose on both the Interface class and the derived attribute/operation/type.
In non-static methods, `$_attr`/`$_op`/`$_type` (depending on the type of
interface) may be used to refer to an instance of the IR entity. In the interface
declaration, this is an instance of the interface class. In the trait declaration,
this is an instance of the concrete entity class (e.g. `IntegerAttr`, `FuncOp`, etc.).
Differential Revision: https://reviews.llvm.org/D116961
Rob Suderman [Wed, 12 Jan 2022 19:28:34 +0000 (11:28 -0800)]
[mlir][tosa] Expand tosa.apply_scale lowering for vectors
Apply scale may encounter scalar, tensor, or vector operations. Expand the
lowering so that it can lower arbitrary of container types.
Reviewed By: NatashaKnk
Differential Revision: https://reviews.llvm.org/D117080
Tomas Matheson [Mon, 13 Dec 2021 14:57:09 +0000 (14:57 +0000)]
clang support for Armv8.8/9.3 HBC
This introduces clang command line support for new Armv8.8-A and
Armv9.3-A Hinted Conditional Branches feature, previously introduced
into LLVM in https://reviews.llvm.org/D116156.
Patch by Tomas Matheson and Son Tuan Vu.
Differential Revision: https://reviews.llvm.org/D116939
River Riddle [Tue, 4 Jan 2022 21:19:23 +0000 (13:19 -0800)]
[mlir] Remove populateFuncOpTypeConversionPattern
This method simply forwards to populateFunctionLikeTypeConversionPattern,
which is more general. This also helps to remove special treatment of FuncOp from
DialectConversion.
Differential Revision: https://reviews.llvm.org/D116624
CJ Johnson [Tue, 30 Nov 2021 23:17:24 +0000 (18:17 -0500)]
Filter string_view from the nullptr diagnosis of bugprone-string-constructor to prevent duplicate warnings with bugprone-stringview-nullptr
Updates the check and tests to not diagnose the null case for string_view (but retains it for string). This prevents the check from giving duplicate warnings that are caught by bugprone-stringview-nullptr ([[ https://reviews.llvm.org/D113148 | D113148 ]]).
Reviewed By: ymandel
Differential Revision: https://reviews.llvm.org/D114823
Luís Ferreira [Wed, 12 Jan 2022 21:37:41 +0000 (21:37 +0000)]
[Demangle] Pass Ret parameter from decodeNumber by reference
Since Ret parameter is never meant to be nullptr, let's pass it by reference instead of a raw pointer.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D117046
Luís Ferreira [Wed, 12 Jan 2022 21:37:40 +0000 (21:37 +0000)]
[Demangle] Add support for D types back referencing
This patch adds support for type back referencing, allowing demangling of
compressed mangled symbols with repetitive types.
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D111419
Luís Ferreira [Wed, 12 Jan 2022 21:37:37 +0000 (21:37 +0000)]
[Demangle] Add support for D symbols back referencing
This patch adds support for identifier back referencing allowing compressed
mangled names by avoiding repetitiveness.
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D111417
Luís Ferreira [Wed, 12 Jan 2022 21:37:34 +0000 (21:37 +0000)]
[Demangle] Add minimal support for D simple basic types
This patch implements simple demangling of two basic types to add minimal type functionality. This will be later used in function type parsing. After that being implemented we can add the rest of the types and test the result of the type name.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D111416
CJ Johnson [Sun, 5 Dec 2021 19:11:02 +0000 (14:11 -0500)]
Add support for return values in bugprone-stringview-nullptr
bugprone-stringview-nullptr was not initially written with tests for return statements. After landing the check, the thought crossed my mind to add such tests. After writing them, I realized they needed additional handling in the matchers.
Differential Revision: https://reviews.llvm.org/D115121
Stanislav Gatev [Wed, 12 Jan 2022 16:28:59 +0000 (16:28 +0000)]
[clang][dataflow] Add transfer functions for initializers
This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.
Reviewed-by: ymandel, xazax.hun
Differential Revision: https://reviews.llvm.org/D117123
James Y Knight [Wed, 12 Jan 2022 18:14:56 +0000 (18:14 +0000)]
Omit "clang" from CHECK lines.
This avoids spurious failures in some environemnts.
Similar change to
eafc64ed6325eba962096d4a947d7e45e909bfde.
Konstantin Varlamov [Wed, 12 Jan 2022 21:09:28 +0000 (13:09 -0800)]
Revert "[libc++] Temporarily disable the in_out_result test on Fuchsia."
This reverts commit
9e634b35ff51d0eb2b38013111491e88bdbae388.
Fangrui Song [Wed, 12 Jan 2022 21:04:32 +0000 (13:04 -0800)]
[ELF] Change gnuHashTab/hashTab to unique_ptr. NFC
and remove associated make<XXX> calls.
My x86-64 `lld` is ~5KiB smaller.
Mehdi Amini [Wed, 12 Jan 2022 20:55:03 +0000 (20:55 +0000)]
Add llc to the list of build dependencies to test MLIR (Fix buildbot)
Richard [Thu, 30 Dec 2021 18:37:04 +0000 (11:37 -0700)]
[clang-tidy] Improve modernize-redundant-void-arg to recognize macro uses
Sometimes a macro invocation will look like an argument list
declaration. Improve the check to detect this situation and not
try to modify the macro invocation.
Thanks to Nathan James for the fix.
- Ignore implicit typedefs (e.g. compiler builtins)
- Improve lexing state machine to locate void argument tokens
- Add additional return_t() macro tests
- clang-format control in the test case file
- remove braces around single statements per LLVM style guide
Fixes #43791
Differential Revision: https://reviews.llvm.org/D116425
Fangrui Song [Wed, 12 Jan 2022 20:47:07 +0000 (12:47 -0800)]
[ELF] Refactor how .gnu.hash and .hash are discarded
Switch to the D114180 approach which is simpler and allows gnuHashTab/hashTab to
switch to unique_ptr.
Fangrui Song [Wed, 12 Jan 2022 20:43:49 +0000 (12:43 -0800)]
[ELF][test] Improve discard-gnu-hash.s to check DT_HASH and DT_GNU_HASH
Walter Erquinigo [Wed, 12 Jan 2022 20:36:23 +0000 (12:36 -0800)]
[CODE OWNERS] Add wallace as code owner
Mehdi Amini [Wed, 12 Jan 2022 20:33:26 +0000 (20:33 +0000)]
Add split-file to the MLIR test dependencies (Fix bot)
Kazu Hirata [Wed, 12 Jan 2022 20:31:43 +0000 (12:31 -0800)]
[mlir] Fix a warning
This patch fixes:
mlir/lib/Dialect/Arithmetic/Transforms/ExpandOps.cpp:161:52: error:
'static_assert' with no message is a C++17 extension
[-Werror,-Wc++17-extensions]
Mehdi Amini [Tue, 11 Jan 2022 20:21:37 +0000 (20:21 +0000)]
Apply clang-tidy fixes for bugprone-macro-parentheses in Interop.h (NFC)
Mehdi Amini [Wed, 12 Jan 2022 18:56:21 +0000 (18:56 +0000)]
Add an example of integration test invoking MLIR source with Memref from C
Reviewed By: ftynse, nicolasvasilache, bondhugula
Differential Revision: https://reviews.llvm.org/D117072
Craig Topper [Wed, 12 Jan 2022 20:13:03 +0000 (12:13 -0800)]
[RISCV] Remove stale references to experimental-b. NFC
Differential Revision: https://reviews.llvm.org/D117136
Sanjay Patel [Wed, 12 Jan 2022 19:58:24 +0000 (14:58 -0500)]
[InstSimplify] use knownbits to fold more udiv/urem
We could use knownbits on both operands for even more folds (and there are
already tests in place for that), but this is enough to recover the example
from:
https://github.com/llvm/llvm-project/issues/51934
(the tests are derived from the code in that example)
I am assuming no noticeable compile-time impact from this because udiv/urem
are rare opcodes.
Differential Revision: https://reviews.llvm.org/D116616
River Riddle [Wed, 12 Jan 2022 19:20:18 +0000 (11:20 -0800)]
[mlir] Finish removing Identifier from the C++ API
There have been a few API pieces remaining to allow for a smooth transition for
downstream users, but these have been up for a few months now. After this only
the C API will have reference to "Identifier", but those will be reworked in a followup.
The main updates are:
* Identifier -> StringAttr
* StringAttr::get requires the context as the first parameter
- i.e. `Identifier::get("...", ctx)` -> `StringAttr::get(ctx, "...")`
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D116626
Christian Sigg [Tue, 11 Jan 2022 17:00:44 +0000 (18:00 +0100)]
Remove NaN constant from arith.minf, arith.maxf expansion
If any of the operands is NaN, return the operand instead of a new constant.
When the rhs operand is a constant, the second arith.cmpf+select ops will be folded away.
https://reviews.llvm.org/D117010 marks the two ops commutative, which will place the constant on the rhs.
Reviewed By: herhut
Differential Revision: https://reviews.llvm.org/D117011
Fangrui Song [Wed, 12 Jan 2022 19:55:22 +0000 (11:55 -0800)]
[ELF] Support discarding .relr.dyn
db08df0570b6dfaf00d7b1b8555c1d2d4effb224 does not work because part.relrDyn is
a unique_ptr and `reset` destroys the object which may still be referenced.
This commit uses the D114180 approach. Also improve the test to check that there
is no R_X86_64_RELATIVE.
Christian Sigg [Wed, 12 Jan 2022 11:48:38 +0000 (12:48 +0100)]
Fold arith.cmpf when at least one operand is known to be NaN.
Reviewed By: herhut
Differential Revision: https://reviews.llvm.org/D117101
Thomas Raoux [Fri, 7 Jan 2022 02:43:04 +0000 (18:43 -0800)]
[mlir][vector] Add folding for extract + extract/insert_strided
Differential Revision: https://reviews.llvm.org/D116785
Sanjay Patel [Tue, 11 Jan 2022 23:29:30 +0000 (18:29 -0500)]
[InstCombine] add tests for binop with phi operands; NFC
Fangrui Song [Wed, 12 Jan 2022 19:43:56 +0000 (11:43 -0800)]
[ELF][test] Temporarily remove .relr.dyn test which is not working
Nico Weber [Wed, 12 Jan 2022 19:40:09 +0000 (14:40 -0500)]
Revert "[JITLink][AArch64] Add support for splitting eh-frames on AArch64."
This reverts commit
253ce92844f72e3a6d0e423473f2765c2c5afd6a.
Breaks tests on Windows, see
https://github.com/llvm/llvm-project/issues/52921#issuecomment-
1011118896
Alex Bradbury [Wed, 12 Jan 2022 19:30:01 +0000 (19:30 +0000)]
[RISCV] Update recently ratified Zb{a,b,c,s} extensions to no longer be experimental
Agreed policy is that RISC-V extensions that have not yet been ratified
should be marked as experimental, and enabling them requires the use of
the -menable-experimental-extensions flag when using clang alongside the
version number. These extensions have now been ratified, so this is no
longer necessary, and the target feature names can be renamed to no
longer be prefixed with "experimental-".
Differential Revision: https://reviews.llvm.org/D117131
Fangrui Song [Wed, 12 Jan 2022 19:33:23 +0000 (11:33 -0800)]
[llvm-ar] Enforce one-dash form for long options
binutils ar does not support one-dash long options (they conflict with
operation code and modifier flags).
```
% ar -help
ar: invalid option -- 'e'
...
% ar -version
ar: invalid option -- 'e'
...
% ar x --plugin=xx x.a # ok
% ar x -plugin=xx x.a
ar: two different operation options specified
% ar -plugin=/usr/lib/gcc/x86_64-linux-gnu/10/liblto_plugin.so x x.a
ar: x: No such file or directory
```
Drop one-dash long options to simplify code and match the usual practice for
command line utilities.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D116977
Fangrui Song [Wed, 12 Jan 2022 19:32:30 +0000 (11:32 -0800)]
[llvm-ar][test] Test that --plugin is ignored
Matt Arsenault [Wed, 12 Jan 2022 18:12:03 +0000 (13:12 -0500)]
AMDGPU/GlobalISel: Regenerate mir test checks
Matt Arsenault [Tue, 11 Jan 2022 19:15:48 +0000 (14:15 -0500)]
AMDGPU/GlobalISel: Do not use terminator copy before waterfall loops
Stop using the _term variants of the mov to save the initial exec
value before the waterfall loop. This cannot be glued to the bottom of
the block because we may need to spill the result register. Just use a
regular mov, like the loops produced on the DAG path. Fixes some
verification errors with regalloc fast.
Matt Arsenault [Tue, 11 Jan 2022 16:03:10 +0000 (11:03 -0500)]
GlobalISel: Fix insert point in localizer
This was inserting the new G_CONSTANT after the use, and the later
block scan would run off the end. Fix calling SkipPHIsAndLabels for no
apparent reason.
Fangrui Song [Wed, 12 Jan 2022 18:40:33 +0000 (10:40 -0800)]
[ELF] -Map --why-extract=: print despite errors
Fix https://github.com/llvm/llvm-project/issues/53073
In case of a relocation error, GNU ld's link map includes
the archive member extraction information but not output sections.
Our -Map and --why-extract= are currently no-op in case of an error.
This change makes the two options work.
Reviewed By: ikudrin, peter.smith
Differential Revision: https://reviews.llvm.org/D116838
Fangrui Song [Wed, 12 Jan 2022 18:38:59 +0000 (10:38 -0800)]
[ELF] Support discarding .relr.dyn
to prepare for D116838, otherwise for linkerscript/discard-section-err.s,
there will be a null pointer dereference in `part.relrDyn->getParent()->size`
in `finalizeSynthetic(part.relrDyn.get())`.
Erich Keane [Wed, 12 Jan 2022 18:17:54 +0000 (10:17 -0800)]
Add an assert in cpudispatch emit to try to track down an error.
I'm attempting to debug an issue that I can only get to happen on
godbolt, where the cpu-dispatch resolver for an out of line member
function is generated with the wrong name, causing a link failure.
Arthur O'Dwyer [Tue, 11 Jan 2022 04:37:01 +0000 (23:37 -0500)]
[libc++] [ranges] SFINAE away ranges::cbegin(const T&&) for non-borrowed T.
Fixes #52952.
Differential Revision: https://reviews.llvm.org/D116991
Chia-hung Duan [Wed, 12 Jan 2022 18:11:30 +0000 (18:11 +0000)]
[mlir] Update BUILD rule for MathDialect.
1773dddadf5de5ad0477394ac2f308eff38c9978 adds the dependency to
ArithmeticDialect.
Reviewed By: rdzhabarov, ftynse
Differential Revision: https://reviews.llvm.org/D117127
Arthur Eubanks [Wed, 12 Jan 2022 17:55:16 +0000 (09:55 -0800)]
[ModuleInliner] Properly delete dead functions
Followup to D116964 where we only did this in the CGSCC inliner.
Fixes leaks reported in D116964.
Egor Zhdan [Tue, 4 Jan 2022 18:14:18 +0000 (18:14 +0000)]
[Clang][Sema] Use VersionMap from SDKSettings for remapping tvOS and watchOS availability
This makes the mapping between iOS & tvOS/watchOS versions more accurate. For example, iOS 9.3 now gets correctly mapped into tvOS 9.2 and not tvOS 9.3.
Before this change, the incorrect mapping could cause excessive or missing warnings for code that specifies availability for iOS, but not for tvOS/watchOS.
rdar://
81491680
Differential Revision: https://reviews.llvm.org/D116822
Craig Topper [Wed, 12 Jan 2022 17:13:07 +0000 (09:13 -0800)]
[RISCV] Add RISCVProcFamilyEnum and add SiFive7.
Use it to remove explicit string compares from unrolling preferences.
I'm of two minds on this. Ideally, we would define things in terms
of architectural or microarchitectural features, but it's hard to
do that with things like unrolling preferences without just ending up
with FeatureSiFive7UnrollingPreferences.
Having a proc enum is consistent with ARM and AArch64. X86 only has
a few and is trying to move away from it.
Reviewed By: asb, mcberg2021
Differential Revision: https://reviews.llvm.org/D117060
Mircea Trofin [Wed, 12 Jan 2022 17:32:06 +0000 (09:32 -0800)]
[NFC][MLGO] The regalloc reward is float, not int64_t
zhijian [Wed, 12 Jan 2022 17:27:03 +0000 (12:27 -0500)]
[AIX] demangle xcoff label symbol for llvm-nm
Summary:
modified the demangle for the xcoff label symbol.
Reviewers: James Henderson
Differential Revision: https://reviews.llvm.org/D113106
Amir Ayupov [Wed, 12 Jan 2022 17:23:30 +0000 (09:23 -0800)]
[BOLT][TEST] Move exceptions-instrumentation.test to X86
The aarch64 instrumentation is currently unsupported so the test is failing.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D117102
Markus Böck [Thu, 6 Jan 2022 10:26:03 +0000 (11:26 +0100)]
[clang][#51931] Enable `-Wdeclaration-after-statement` for all C versions
-Wdeclaration-after-statement currently only outputs an diagnostic if the user is compiling in C versions older than C99, even if the warning was explicitly requested by the user.
This patch makes the warning also available in later C versions. If the C version is C99 or later it is simply a normal warning that is disabled by default (as it is valid C99) and has to be enabled by users. In older versions it remains an extension warning, and therefore affected by -pedantic.
The above behaviour also matches GCCs behaviour.
Fixes https://bugs.llvm.org/show_bug.cgi?id=51931
Differential Revision: https://reviews.llvm.org/D114787
William S. Moses [Wed, 12 Jan 2022 05:26:41 +0000 (00:26 -0500)]
[MLIR][Math] Enable constant folding of ops
Enable constant folding of ops within the math dialect, and introduce constant folders for ceil and log2
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D117085
Stella Stamenova [Wed, 12 Jan 2022 16:55:48 +0000 (08:55 -0800)]
[lldb] Disable one more watchpoint test on Windows
This should be the last remaining flaky watchpoint test on Windows
Mircea Trofin [Wed, 12 Jan 2022 16:50:57 +0000 (08:50 -0800)]
[NFC][MLGO] Prep a few files before the main ML Regalloc adviser
To avoid trivial changes.
Stella Stamenova [Wed, 12 Jan 2022 16:53:19 +0000 (08:53 -0800)]
Revert "[LLDB][NativePDB] Add support for inlined functions"
This reverts commit
945aa520ef07a3edb655f3f38e4c3023658dd623.
This commit broke the windows lldb bot.
Petar Avramovic [Wed, 12 Jan 2022 16:43:18 +0000 (17:43 +0100)]
GlobalIsel: Fix fma combine when one of the operands comes from unmerge
Fma combine assumes that MRI.getVRegDef(Reg)->getOperand(0).getReg() = Reg
which is not true when Reg is defined by instruction with multiple defs
e.g. G_UNMERGE_VALUES.
Fix is to keep register and the instruction that defines register in
DefinitionAndSourceRegister and use when needed.
Differential Revision: https://reviews.llvm.org/D117032
Petar Avramovic [Wed, 12 Jan 2022 16:38:24 +0000 (17:38 +0100)]
GlobalIsel: Precommit fma combine tests with one operand from unmerge
Arthur Eubanks [Fri, 7 Jan 2022 17:47:55 +0000 (09:47 -0800)]
[Inline] Attempt to delete any discardable if unused functions
Previously we limited ourselves to only internal/private functions. We
can also delete linkonce_odr functions.
Minor compile time wins:
https://llvm-compile-time-tracker.com/compare.php?from=
d51e3474e060cb0e90dc2e2487f778b0d3e6a8de&to=
bccffe3f8d5dd4dda884c9ac1f93e51772519cad&stat=instructions
Major memory wins on tramp3d:
https://llvm-compile-time-tracker.com/compare.php?from=
d51e3474e060cb0e90dc2e2487f778b0d3e6a8de&to=
bccffe3f8d5dd4dda884c9ac1f93e51772519cad&stat=max-rss
Reviewed By: nikic, mtrofin
Differential Revision: https://reviews.llvm.org/D115545
Louis Dionne [Tue, 21 Dec 2021 16:49:04 +0000 (11:49 -0500)]
[libc++] Start using `arc4random()` to implement `std::random_device` on Apple
On Apple platforms, arc4random is faster than /dev/urandom, and it is
the recommended user-space RNG according to Apple's own OS folks.
This commit adds an ABI switch to guard ABI-break-protections in
std::random_device, and starts using arc4random instead of /dev/urandom
to implement std::random_device on Apple platforms.
Note that previously, `std::random_device` would allow passing a custom
token to its constructor, and that token would be interpreted as the name
of a file to read entropy from. This was implementation-defined and
undocumented. After this change, Apple platforms will be using arc4random()
instead, and any custom token passed to the constructor will be ignored.
This behavioral change will also impact other platforms that use the
arc4random() implementation, such as OpenBSD. This should be fine since
that is effectively a relaxation of the constructor's requirements.
rdar://
86638350
Differential Revision: https://reviews.llvm.org/D116045
Leonard Grey [Wed, 12 Jan 2022 15:47:04 +0000 (10:47 -0500)]
[lld-macho] Port CallGraphSort from COFF/ELF
Depends on D112160
This adds the new options `--call-graph-profile-sort` (default),
`--no-call-graph-profile-sort` and `--print-symbol-order=`. If call graph
profile sorting is enabled, reads `__LLVM,__cg_profile` sections from object
files and uses the resulting graph to put callees and callers close to each
other in the final binary via the C3 clustering heuristic.
Differential Revision: https://reviews.llvm.org/D112164
Simon Pilgrim [Wed, 12 Jan 2022 15:18:51 +0000 (15:18 +0000)]
CGBuiltin - Use castAs<> instead of getAs<> to avoid dereference of nullptr
The pointer is always dereferenced immediately below, so assert the cast is correct instead of returning nullptr
Simon Pilgrim [Wed, 12 Jan 2022 15:03:09 +0000 (15:03 +0000)]
[clang-tidy] UseDefaultMemberInitCheck::checkDefaultInit - Use cast<> instead of dyn_cast<> to avoid dereference of nullptr
The pointer is always dereferenced immediately below, so assert the cast is correct instead of returning nullptr
Paulo Matos [Wed, 12 Jan 2022 09:09:21 +0000 (10:09 +0100)]
[clang] Fix crash for sizeof on VLAs
Adds overload of TransformToPotentiallyEvaluated for TypeSourceInfo to
properly deal with VLAs in nested calls of sizeof and typeof. Fixes
PR31042 (https://github.com/llvm/llvm-project/issues/30390).
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D27800
Marek Kurdej [Wed, 12 Jan 2022 15:10:03 +0000 (16:10 +0100)]
[clang-format] Fix comment. NFC.
Simon Pilgrim [Wed, 12 Jan 2022 14:50:12 +0000 (14:50 +0000)]
[X86][AVX2] Add SimplifyDemandedVectorElts handling for avx2 per element shifts
Noticed while investigating how to improve funnel shift codegen
Simon Pilgrim [Wed, 12 Jan 2022 14:38:33 +0000 (14:38 +0000)]
[X86][AVX2] Add tests for missing demanded elts handling for avx2 per element shifts
Noticed while investigating how to improve funnel shift codegen
Nico Weber [Wed, 12 Jan 2022 14:42:05 +0000 (09:42 -0500)]
Revert "[llvm-readobj][XCOFF] dump auxiliary symbols."
This reverts commit
aad49c8eb9849be57c562f8e2b7fbbe816183343.
Breaks tests on Windows, see comments on https://reviews.llvm.org/D113825
Michał Górny [Wed, 12 Jan 2022 12:26:09 +0000 (13:26 +0100)]
[lldb] [Process/FreeBSD] Set current thread ID on events
Set the current thread ID to the thread where an event happened.
As a result, e.g. when a signal is delivered to a thread other than
the first one, the respective T packet refers to the signaled thread
rather than the first thread (with no stop reason). While this doesn't
strictly make a difference to the LLDB client, it is the expected
behavior.
Differential Revision: https://reviews.llvm.org/D117103
Kadir Cetinkaya [Mon, 29 Nov 2021 18:13:50 +0000 (19:13 +0100)]
[clangd][StdSymbolMap] Prefer std::remove from algorithm
std::remove from algorithm is a lot more common than the overload from
the cstdio (which deletes files). This patch introduces a set of symbols
for which we should prefer the overloaded versions.
Differential Revision: https://reviews.llvm.org/D114724
Leonard Grey [Wed, 12 Jan 2022 14:12:53 +0000 (09:12 -0500)]
[MachO] Port call graph profile section and directive
This ports the `.cg_profile` assembly directive and call graph profile section
generation to MachO from COFF/ELF. Due to MachO section naming rules, the
section is called `__LLVM,__cg_profile` rather than `.llvm.call-graph-profile`
as in COFF/ELF. Support for llvm-readobj is included to facilitate testing.
Corresponding LLD change is D112164
Differential Revision: https://reviews.llvm.org/D112160
Marco Elver [Wed, 12 Jan 2022 13:40:41 +0000 (14:40 +0100)]
[clang][auto-init] Provide __builtin_alloca*_uninitialized variants
When `-ftrivial-auto-var-init=` is enabled, allocas unconditionally
receive auto-initialization since [1].
In certain cases, it turns out, this is causing problems. For example,
when using alloca to add a random stack offset, as the Linux kernel does
on syscall entry [2]. In this case, none of the alloca'd stack memory is
ever used, and initializing it should be controllable; furthermore, it
is not always possible to safely call memset (see [2]).
Introduce `__builtin_alloca_uninitialized()` (and
`__builtin_alloca_with_align_uninitialized`), which never performs
initialization when `-ftrivial-auto-var-init=` is enabled.
[1] https://reviews.llvm.org/D60548
[2] https://lkml.kernel.org/r/YbHTKUjEejZCLyhX@elver.google.com
Reviewed By: glider
Differential Revision: https://reviews.llvm.org/D115440
Pietro Albini [Wed, 12 Jan 2022 13:43:26 +0000 (14:43 +0100)]
Update Pietro Albini's employer
Differential Revision: https://reviews.llvm.org/D117027
Florian Hahn [Wed, 12 Jan 2022 13:42:13 +0000 (13:42 +0000)]
[VPlan] Introduce and use BranchOnCount VPInstruction.
This patch adds a new BranchOnCount VPInstruction opcode with 2
operands. It first compares its 2 operands (increment of canonical
induction and vector trip count), followed by a branch to either the
exit block or back to the vector header.
It must be the last recipe in the exit block of the topmost vector loop
region.
This extracts parts from D113224 and was discussed in D113223.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D116479
Rosie Sumpter [Mon, 6 Dec 2021 11:27:31 +0000 (11:27 +0000)]
[LoopVectorize] Pass a vector type to isLegalMaskedGather/Scatter
This is required to query the legality more precisely in the LoopVectorizer.
This adds another TTI function named 'forceScalarizeMaskedGather/Scatter'
function to work around the hack introduced for MVE, where
isLegalMaskedGather/Scatter would return an answer by second-guessing
where the function was called from, based on the Type passed in (vector
vs scalar). The new interface makes this explicit. It is also used by
X86 to check for vector widths where gather/scatters aren't profitable
(or don't exist) for certain subtargets.
Differential Revision: https://reviews.llvm.org/D115329
Sven van Haastregt [Wed, 12 Jan 2022 13:30:09 +0000 (13:30 +0000)]
[OpenCL] Set external linkage for block enqueue kernels
All kernels can be called from the host as per the SPIR_KERNEL calling
convention. As such, all kernels should have external linkage, but
block enqueue kernels were created with internal linkage.
Reported-by: Pedro Olsen Ferreira
Differential Revision: https://reviews.llvm.org/D115523
Jeremy Morse [Wed, 12 Jan 2022 12:35:36 +0000 (12:35 +0000)]
[DebugInfo] Move flag for instr-ref to LLVM option, from TargetOptions
This feature was previously controlled by a TargetOptions flag, and I
figured that codegen::InitTargetOptionsFromCodeGenFlags would default it
to "on" for all frontends. Enabling by default was discussed here:
https://lists.llvm.org/pipermail/llvm-dev/2021-November/153653.html
and originally supposed to happen in
3c045070882f3, but it didn't actually
take effect, as it turns out frontends initialize TargetOptions themselves.
This patch moves the flag from a TargetOptions flag to a global flag to
CodeGen, where it isn't immediately affected by the frontend being used.
Hopefully this will actually cause instr-ref to be on by default on x86_64
now!
This patch is easily reverted, and chances of turbulence are moderately
high. If you need to revert, please consider instead commenting out the
'return true' part of llvm::debuginfoShouldUseDebugInstrRef to turn the
feature off, and dropping me an email.
Differential Revision: https://reviews.llvm.org/D116821
Kuba Mracek [Wed, 12 Jan 2022 13:19:28 +0000 (05:19 -0800)]
[UBSan] Relax test expectations in Misc/objc-cast.m test
The test checks that an array of Obj-C literal integers (e.g. `@1`) gets a UBSan
warning when cast to an NSString, however the actual concrete Obj-C class of
literal integers doesn't always need to be __NSCFNumber. Let's relax the test
expectations to allow NSConstantIntegerNumber. Which exact subclass of NSNumber
is used is not actually important for the test (the test is just checking that
the invalid cast warning is thrown).
David Sherwood [Wed, 12 Jan 2022 12:03:29 +0000 (12:03 +0000)]
[NFC] Run script to autogenerate CHECK lines for CodeGen/AArch64/fast-isel-cmp-vec.ll
Simon Moll [Wed, 12 Jan 2022 10:22:48 +0000 (11:22 +0100)]
[VP] llvm.vp.merge intrinsic and LangRef
llvm.vp.merge interprets the %evl operand differently than the other vp
intrinsics: all lanes at positions greater or equal than the %evl
operand are passed through from the second vector input. Otherwise it
behaves like llvm.vp.select.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D116725
Simon Pilgrim [Wed, 12 Jan 2022 12:17:06 +0000 (12:17 +0000)]
[X86][XOP] Add SimplifyDemandedVectorElts handling for xop shifts
Noticed while investigating how to improve funnel shift codegen
Simon Pilgrim [Wed, 12 Jan 2022 12:11:52 +0000 (12:11 +0000)]
[X86][XOP] Add tests for missing demanded elts handling for xop shifts
Noticed while investigating how to improve funnel shift codegen
Florian Hahn [Wed, 12 Jan 2022 12:37:46 +0000 (12:37 +0000)]
[IRBuilder] Migrate icmp-folding to value-based FoldICmp.
Depends on D116935.
Reviewed By: nikic, lebedev.ri
Differential Revision: https://reviews.llvm.org/D116969
David Spickett [Wed, 12 Jan 2022 12:17:52 +0000 (12:17 +0000)]
[lldb][AArch64] Correct top nibble setting in memory tag read tests
Due to a missing cast the << 60 always resulted in zero leaving
the top nibble empty. So we weren't actually testing that lldb
ignores those bits in addition to the tag bits.
Correct that and also set the top nibbles to ascending values
so that we can catch if lldb only removes one of the tag bits
and top nibble, but not both.
In future the tag manager will likely only remove the tag bits
and leave non-address bits to the ABI plugin but for now make
sure we're testing what we claim to implement.
Shao-Ce SUN [Wed, 12 Jan 2022 12:13:30 +0000 (20:13 +0800)]
[RISCV][llvm] Update CSRs
According the newest RISC-V Privileged Spec, updated CSRs.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D116645
Chuanqi Xu [Wed, 12 Jan 2022 11:34:49 +0000 (19:34 +0800)]
[NFC] [Coroutines] Add regression tests for symmetric transfer and coroutine elision
LLVM GN Syncbot [Wed, 12 Jan 2022 11:14:10 +0000 (11:14 +0000)]
[gn build] Port
35cca45b09b8
Phoebe Wang [Wed, 12 Jan 2022 11:08:01 +0000 (19:08 +0800)]
[X86][LLD] Update datelayout in LLD tests. NFCI
rG1bb0caf56168 changed the datalayout of f80 on Windows 32 bits. But it
missed the related use in the LLD tests. This patch will fix the
problem catched by buildbot.
serge-sans-paille [Tue, 28 Sep 2021 09:23:22 +0000 (11:23 +0200)]
Misleading bidirectional detection
This patch implements detection of incomplete bidirectional sequence withing
comments and string literals within clang-tidy.
It detects the bidi part of https://www.trojansource.codes/trojan-source.pdf
Differential Revision: https://reviews.llvm.org/D112913
Florian Hahn [Wed, 12 Jan 2022 10:32:52 +0000 (10:32 +0000)]
[BuildLibCalls] Add nounwind,willreturn to memset_pattern{4,8,16}.
Similar to memset, memset_pattern{4,8,16} all will return and do not
unwind. Use fallthrough to include all attributes also set for memset.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D114904