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
Alexey Lapshin [Mon, 10 Jan 2022 18:38:53 +0000 (21:38 +0300)]
[CodeGen][Debuginfo][NFC] Refactor DIE values SizeOf method to not depend on AsmPrinter.
SizeOf() method of DIE values(unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const)
depends on AsmPrinter. AsmPrinter is too specific class here. This patch removes dependency
on AsmPrinter and use dwarf::FormParams structure instead. It allows calculate DIE values
size without using AsmPrinter. That refactoring is useful for D96035([dsymutil][DWARFlinker]
implement separate multi-thread processing for compile units.)
Differential Revision: https://reviews.llvm.org/D116997
Florian Hahn [Wed, 12 Jan 2022 10:09:37 +0000 (10:09 +0000)]
Revert (2) "[AST] Add RParen loc for decltype AutoTypeloc."
This reverts commit
41fbdfa4d5601cccbcdc0ded8ef35190d502f7f3.
The commit breaks stage 2 builds with debug info, e.g.
https://green.lab.llvm.org/green/job/clang-stage2-Rthinlto/5088/console
Clang crashes with the following assertion when building
llvm-project/llvm/lib/Support/Timer.cpp
/usr/local/bin/sccache /Users/buildslave/jenkins/workspace/clang-stage2-Rthinlto/host-compiler/bin/clang++ -DGTEST_HAS_RTTI=0 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Support -I/Users/buildslave/jenkins/workspace/clang-stage2-Rthinlto/llvm-project/llvm/lib/Support -Iinclude -I/Users/buildslave/jenkins/workspace/clang-stage2-Rthinlto/llvm-project/llvm/include -fno-stack-protector -fno-common -Wno-profile-instr-unprofiled -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -fmodules -fmodules-cache-path=/Users/buildslave/jenkins/workspace/clang-stage2-Rthinlto/clang-build/Build/module.cache -fcxx-modules -Xclang -fmodules-local-submodule-visibility -gmodules -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -flto=thin -O2 -g -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -std=c++14 -fno-exceptions -fno-rtti -MD -MT lib/Support/CMakeFiles/LLVMSupport.dir/Timer.cpp.o -MF lib/Support/CMakeFiles/LLVMSupport.dir/Timer.cpp.o.d -o lib/Support/CMakeFiles/LLVMSupport.dir/Timer.cpp.o -c /Users/buildslave/jenkins/workspace/clang-stage2-Rthinlto/llvm-project/llvm/lib/Support/Timer.cpp
Assertion failed: (((getOffset()+Offset) & MacroIDBit) == 0 && "offset overflow"), function getLocWithOffset, file /Users/buildslave/jenkins/workspace/clang-stage1-RA/llvm-project/clang/include/clang/Basic/SourceLocation.h, line 135.
Diana Picus [Tue, 21 Dec 2021 13:10:51 +0000 (13:10 +0000)]
[flang] Fix overallocation by fir-to-llvm-ir pass
When converting a fir.alloca of an array to the LLVM dialect, we used to
multiply the allocated size by all the constant factors encoded in the
array type. This is fine when the array type is converted to the element
type for the purposes of the allocation, but if it's converted to an
array type, then we might be allocating too much space. For example, for
`%2 = fir.alloca !fir.array<8x16x32xf32>, %0, %1` we would allocate
%0 * %1 * 8 * 16 * 32 x llvm.array<32 x array<16 * array<8 x f32>>>. We
really only need to allocate %0 * %1 such arrays.
This patch fixes the issue by taking note of the array type that we're
trying to allocate. It tries to match the behaviour of
LLVMTypeConverter::convertPointerLike, which returns a pointer to the
element type only when the array type doesn't have a constant interior.
We consequently only multiply with the constant factors in the array
type if the array type doesn't have a constant interior.
This has the nice side effect that it gets rid of some redundant
multiplications with the constant 1 in some cases.
Differential Revision: https://reviews.llvm.org/D116926
David Spickett [Fri, 17 Dec 2021 13:49:35 +0000 (13:49 +0000)]
[lldb] Don't print "Command Options Usage:" for an alias with no options
"shell" is an alias to "platform shell -h --". Previously you would get this
help text:
(lldb) help shell
Run a shell command on the host. Expects 'raw' input (see 'help raw-input'.)
Syntax: shell <shell-command>
Command Options Usage:
'shell' is an abbreviation for 'platform shell -h --'
Since the code doesn't handle the base command having options
but the alias removing them. With these changes you get:
(lldb) help shell
Run a shell command on the host. Expects 'raw' input (see 'help raw-input'.)
Syntax: shell <shell-command>
'shell' is an abbreviation for 'platform shell -h --'
Note that we already handle a non-alias command having no options,
for example "quit":
(lldb) help quit
Quit the LLDB debugger.
Syntax: quit [exit-code]
Reviewed By: JDevlieghere, jingham
Differential Revision: https://reviews.llvm.org/D117004
Kadir Cetinkaya [Tue, 11 Jan 2022 17:55:53 +0000 (18:55 +0100)]
[clang][CodeComplete] Perform approximate member search in bases
Differential Revision: https://reviews.llvm.org/D117037
Matthias Springer [Wed, 12 Jan 2022 09:40:08 +0000 (18:40 +0900)]
[mlir][linalg][bufferize] Add pass options for `createDeallocs`
This change makes it possible to use a different buffer deallocation strategy. E.g., `-buffer-deallocation` can be used, which also works for allocations that are not in destination-passing style.
Differential Revision: https://reviews.llvm.org/D117096
Andrzej Warzynski [Thu, 6 Jan 2022 10:03:22 +0000 (10:03 +0000)]
[Clang] Make Clang copy its CMake modules into the build dir
LLVM has a documented mechanism for passing configuration information to
an out of tree project using CMake. See
https://llvm.org/docs/CMake.html#embedding-llvm-in-your-project.
Similar logic applies to "standalone" builds of other sub-projects
within LLVM that depend on each other. For example, a standalone build
of Flang will use this mechanism to acquire Clang's configuration.
Currently, the relevant CMake modules for Clang will only be copied into
the installation directory. This means that in order to configure a
standalone build of Flang, one has to first build and then install
Clang. This is not required for LLVM nor for MLIR - other sub-projects
that Flang depends on (i.e. the CMake modules for LLVM and MLIR are
available in the build dir, so installation is not needed).
This change removes the need for installing Clang in order to access its
configuration. It makes sure that the required CMake modules are copied
into the build directory. This will make Clang behave consistently with
LLVM and MLIR in this respect. It will also simplify building Flang as
standalone sub-project.
Differential Revision: https://reviews.llvm.org/D116731
Phoebe Wang [Fri, 17 Dec 2021 15:09:33 +0000 (23:09 +0800)]
[X86][MS] Change the alignment of f80 to 16 bytes on Windows 32bits to match with ICC
MSVC currently doesn't support 80 bits long double. ICC supports it when
the option `/Qlong-double` is specified. Changing the alignment of f80
to 16 bytes so that we can be compatible with ICC's option.
Reviewed By: rnk, craig.topper
Differential Revision: https://reviews.llvm.org/D115942
Konstantin Varlamov [Wed, 12 Jan 2022 09:49:37 +0000 (01:49 -0800)]
[libc++] Quick fix to remove a narrowing conversion from the in_out_result test.
This needs a proper solution in a follow-up. The issue is that the
Standard defines conversions between `in_out_result` classes with
different template types as just `return {in, out};`. Because the
expression uses list initialization, it will fail to compile if the
conversion happens to be narrowing -- which is probably unintended.
Surprisingly, this error wasn't caught by the CI.
Differential Revision: https://reviews.llvm.org/D117089
David Green [Wed, 12 Jan 2022 09:44:53 +0000 (09:44 +0000)]
[ARM] Remove FeaturePerfMon from armv7-m
FeaturePerfMon relates to the PMU extensions available in armv7-a, and
should not be available in v7-m (it requires loading from a system
register with a mrc). Sink it down a level in the dependency map so that
it isn't present in ARMv7m or HasV8MMainlineOps.
It is also removed from the Neoverse-N2, as it will already be
transitively included.
Differential Revision: https://reviews.llvm.org/D117022
Lang Hames [Wed, 12 Jan 2022 09:36:08 +0000 (20:36 +1100)]
[JITLink][AArch64] Add support for splitting eh-frames on AArch64.
This is needed for DWARF eh-frame exception handling on AArch64.
https://github.com/llvm/llvm-project/issues/52921.
Original patch by David Nadlinger <code@klickverbot.at> (thanks David!),
testcase and comments added by me.
Andrzej Warzynski [Tue, 4 Jan 2022 19:02:23 +0000 (19:02 +0000)]
[flang] Make the `flang` wrapper script check the Bash version
The `flang` wrapper script has been written in a relatively modern
version of Bash and it fails on systems with older versions. This patch
makes the script check the version of Bash being used to run it and
generates an error when unsupported version is used.
This was discussed in more detail in:
* https://github.com/flang-compiler/f18-llvm-project/issues/1344.
Many thanks to Anthony Cabrera for the suggestion and for identifying
the oldest version of Bash that we can use here.
Differential Revision: https://reviews.llvm.org/D116608
Florian Hahn [Wed, 12 Jan 2022 09:24:46 +0000 (09:24 +0000)]
[IRBuilder] Migrate add-folding to value-based FoldAdd.
Depends on D116935.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D116968
Phoebe Wang [Fri, 17 Dec 2021 14:30:44 +0000 (22:30 +0800)]
[X86][ABI] Pre-commit test for the f80 ABI alignment change. NFC
Simon Tatham [Wed, 12 Jan 2022 09:06:54 +0000 (09:06 +0000)]
[extract_symbols.py] Fix line-splitting of tool output.
Two functions in the `is_32bit_windows` family were retrieving the
output of a tool via `subprocess.check_output`, and then iterating
over it using `for line in output`. But in Python, that gets you the
output one //character// at a time, not a line at a time. So the
regexes that looked for a platform name were never matching.
(This is a mistake that Python makes uniquely easy, because iterating
over a file and over a string have different default behaviour, and
because the element type of a string is still a string so you don't
even get a type mismatch error to warn you about it!)
Reviewed By: michaelplatings
Differential Revision: https://reviews.llvm.org/D117030
Matthias Springer [Wed, 12 Jan 2022 08:45:27 +0000 (17:45 +0900)]
[mlir][linalg][bufferize] Support std.select bufferization
This op is an example for how to deal with ops who's OpResult may aliasing with one of multiple OpOperands.
Differential Revision: https://reviews.llvm.org/D116868
Nikita Popov [Wed, 12 Jan 2022 08:42:58 +0000 (09:42 +0100)]
[GlobalOpt] Drop redundant setExternallyInitialized() call (NFC)
This is part of copyAttributesFrom().
Nikita Popov [Wed, 12 Jan 2022 08:40:54 +0000 (09:40 +0100)]
[GlobalStatus] Remove unused HasNonInstructionUser member (NFC)
This hasn't been used in a long time.
Nikita Popov [Tue, 11 Jan 2022 17:00:41 +0000 (18:00 +0100)]
[GlobalOpt] Support "stored once" optimization for different types
GlobalOpt can optimize a global with undef initializer and a single
store to put the stored value into the initializer instead. Currently,
this requires the type of the global and the store to match.
This patch extends support to cases with different types (but same
size), in which case we create a new global to replace the old one.
Differential Revision: https://reviews.llvm.org/D117034
Carlos Galvez [Fri, 7 Jan 2022 18:45:20 +0000 (18:45 +0000)]
[clang] Introduce support for disabling warnings in system macros
Often we run into situations where we want to ignore
warnings from system headers, but Clang will still
give warnings about the contents of a macro defined
in a system header used in user-code.
Introduce a ShowInSystemMacro option to be able to
specify which warnings we do want to keep raising
warnings for. The current behavior is kept in this patch
(i.e. warnings from system macros are enabled by default).
The decision as to whether this should be an opt-in or opt-out
feature can be made in a separate patch.
To put the feature to test, replace duplicated code for
Wshadow and Wold-style-cast with the SuppressInSystemMacro tag.
Also disable the warning for C++20 designators, fixing #52944.
Differential Revision: https://reviews.llvm.org/D116833
Chuanqi Xu [Wed, 12 Jan 2022 07:53:49 +0000 (15:53 +0800)]
[Coroutines] Handle lifetime markers, bitcast and unused instruciton for symmetric transfer
This fixes bug49888. The root cause for this is that
simplifyTerminatorLeadingToRet didn't handle lifetime markers well.
Another issue also noted in D116327 is that we deleted some inlined
optimization pass in CoroSplit so that simplifyTerminatorLeadingToRet
need to remove dead instructions by hand.
This patch fixes bug49888 by skipping lifetime markers and bitcast
instruction and removing dead instructions by hand in
simplifyTerminatorLeadingToRet.
Reviewed By: junparser
Differential Revision: https://reviews.llvm.org/D116330
Stanislav Gatev [Tue, 11 Jan 2022 12:15:53 +0000 (12:15 +0000)]
[clang][dataflow] Add transfer functions for data members and this pointers
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/D117012
Uday Bondhugula [Mon, 27 Dec 2021 10:13:25 +0000 (15:43 +0530)]
Add inliner interface for GPU dialect
Add inliner interface for GPU dialect. The interface marks all GPU
dialect ops legal to inline anywhere.
Differential Revision: https://reviews.llvm.org/D116889
Esme-Yi [Wed, 12 Jan 2022 07:18:21 +0000 (07:18 +0000)]
[llvm-readobj][XCOFF] dump auxiliary symbols.
Summary: The patch adds support for dumping auxiliary symbols
in llvm-readobj for XCOFF.
Reviewed By: jhenderson, Higuoxing
Differential Revision: https://reviews.llvm.org/D113825
Lang Hames [Wed, 12 Jan 2022 06:53:13 +0000 (17:53 +1100)]
[JITLink][AArch64] Use R-X permissions for the GOT.
This consistent with ld64's treatment of the GOT, but the main aim here is a
short-term workaround for a bad interaction between stub code sequences and
memory layout: Stubs use LDRLiteral19 relocations to reference the GOT, but
BasicLayout currently puts RW- segments between R-- and R-X segments -- a large
RW- segment (or a large R-- for that matter) can cause the relocation to fail
with an out-of-range error.
Putting the GOT in R-X fixes this efficiently in practice. A more robust fix
will be to use a longer code sequence to materialize the GOT pointer and then
rewrite the stub to use a shorter sequence where possible.
Lang Hames [Wed, 12 Jan 2022 04:42:10 +0000 (15:42 +1100)]
[ORC] Add an ostream operator for ExecutorAddrRange.
This makes it easier to print addr ranges in debugging output.
Lang Hames [Wed, 12 Jan 2022 04:41:11 +0000 (15:41 +1100)]
[JITLink] Use Section + Offset format for anon symbols in out-of-range errors.
The previous error message only provided the address of the anonymous symbol.
Knowing the containing section makes the error easier to diagnose at a glance.
Jez Ng [Wed, 12 Jan 2022 07:00:56 +0000 (23:00 -0800)]
[lld-macho] Try and fix map-file.s' flakiness
After {D117069}, map-file.s seems flaky. It seems that the "Total Write
map file" section always exists, but the "Write map file" sub-section
may or may not be emitted. So we check for the former.
William S. Moses [Wed, 12 Jan 2022 07:00:53 +0000 (02:00 -0500)]
Revert "[MLIR][Math] Enable constant folding of ops"
This reverts commit
2f8b956ab6e63e57fbaa60749c9ba7752b071993.
There is a linker error for mlir-nvidia as seen on
https://lab.llvm.org/buildbot/#/builders/61/builds/19939.
As it's late for me here, I'm oing to rever this for now to be
investigated later.
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
William S. Moses [Wed, 12 Jan 2022 05:44:05 +0000 (00:44 -0500)]
[MLIR][LLVM] Add memoryeffect for alloca
Add memory effect for llvm.alloca op
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D117086
zhongyunde [Wed, 12 Jan 2022 06:40:41 +0000 (14:40 +0800)]
[DAGCombiner][AArch64] precommit some tests for D116915 NFC
In working on D116915 I found that a few tests were needed. I've been
asked to pre-push the tests for that ticket. This should complete the tests
needed for now.