Commit Graph

410900 Commits

Author SHA1 Message Date
Fangrui Song f8476fd47b [llvm-ar][test] Test that --plugin is ignored 2022-01-12 11:32:31 -08:00
Matt Arsenault 22e6722632 AMDGPU/GlobalISel: Regenerate mir test checks 2022-01-12 13:44:06 -05:00
Matt Arsenault bd2c01e937 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.
2022-01-12 13:44:05 -05:00
Matt Arsenault 8a16201a0b 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.
2022-01-12 13:44:05 -05:00
Fangrui Song 5014d6fc53 [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
2022-01-12 10:40:33 -08:00
Fangrui Song db08df0570 [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())`.
2022-01-12 10:38:59 -08:00
Erich Keane 6e77ad11ff 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.
2022-01-12 10:31:28 -08:00
Arthur O'Dwyer a70fe03961 [libc++] [ranges] SFINAE away ranges::cbegin(const T&&) for non-borrowed T.
Fixes #52952.

Differential Revision: https://reviews.llvm.org/D116991
2022-01-12 13:25:41 -05:00
Chia-hung Duan c025fd8b0b [mlir] Update BUILD rule for MathDialect.
1773dddadf adds the dependency to
ArithmeticDialect.

Reviewed By: rdzhabarov, ftynse

Differential Revision: https://reviews.llvm.org/D117127
2022-01-12 18:11:31 +00:00
Arthur Eubanks fe827a93f6 [ModuleInliner] Properly delete dead functions
Followup to D116964 where we only did this in the CGSCC inliner.
Fixes leaks reported in D116964.
2022-01-12 09:57:43 -08:00
Egor Zhdan 3a32d2e74e [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
2022-01-12 17:40:18 +00:00
Craig Topper 632c263eb3 [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
2022-01-12 09:34:02 -08:00
Mircea Trofin b2d2e93138 [NFC][MLGO] The regalloc reward is float, not int64_t 2022-01-12 09:32:41 -08:00
zhijian f51b25a4b9 [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
2022-01-12 12:27:03 -05:00
Amir Ayupov 2d97f0f2ef [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
2022-01-12 09:25:12 -08:00
Markus Böck 118f966b46 [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
2022-01-12 18:21:46 +01:00
William S. Moses 1773dddadf [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
2022-01-12 12:19:29 -05:00
Stella Stamenova 8fec756c0b [lldb] Disable one more watchpoint test on Windows
This should be the last remaining flaky watchpoint test on Windows
2022-01-12 08:55:48 -08:00
Mircea Trofin 3150bce078 [NFC][MLGO] Prep a few files before the main ML Regalloc adviser
To avoid trivial changes.
2022-01-12 08:54:00 -08:00
Stella Stamenova 10bc3362a1 Revert "[LLDB][NativePDB] Add support for inlined functions"
This reverts commit 945aa520ef.

This commit broke the windows lldb bot.
2022-01-12 08:53:19 -08:00
Petar Avramovic c8c5dc766b 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
2022-01-12 17:47:25 +01:00
Petar Avramovic 9f38a681cf GlobalIsel: Precommit fma combine tests with one operand from unmerge 2022-01-12 17:47:25 +01:00
Arthur Eubanks d5be48c66d [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
2022-01-12 08:36:04 -08:00
Louis Dionne d202c76441 [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
2022-01-12 11:24:23 -05:00
Leonard Grey 6db04b97e6 [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
2022-01-12 10:47:04 -05:00
Simon Pilgrim 497a4b26c4 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
2022-01-12 15:35:37 +00:00
Simon Pilgrim dcc20143e1 [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
2022-01-12 15:35:37 +00:00
Paulo Matos 968be05b8f [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
2022-01-12 16:10:58 +01:00
Marek Kurdej 6cbebfc7fb [clang-format] Fix comment. NFC. 2022-01-12 16:10:03 +01:00
Simon Pilgrim de3808c8fc [X86][AVX2] Add SimplifyDemandedVectorElts handling for avx2 per element shifts
Noticed while investigating how to improve funnel shift codegen
2022-01-12 14:50:28 +00:00
Simon Pilgrim 0c8d30a305 [X86][AVX2] Add tests for missing demanded elts handling for avx2 per element shifts
Noticed while investigating how to improve funnel shift codegen
2022-01-12 14:50:27 +00:00
Nico Weber d3b90f4104 Revert "[llvm-readobj][XCOFF] dump auxiliary symbols."
This reverts commit aad49c8eb9.
Breaks tests on Windows, see comments on https://reviews.llvm.org/D113825
2022-01-12 09:42:05 -05:00
Michał Górny 9a1ce35d7e [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
2022-01-12 15:40:13 +01:00
Kadir Cetinkaya c490f8feb7
[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
2022-01-12 15:25:42 +01:00
Leonard Grey 0f85393004 [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
2022-01-12 09:22:26 -05:00
Marco Elver 732ad8ea62 [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
2022-01-12 15:13:10 +01:00
Pietro Albini c8c3021e9f Update Pietro Albini's employer
Differential Revision: https://reviews.llvm.org/D117027
2022-01-12 14:46:06 +01:00
Florian Hahn d4a8fc3a87
[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
2022-01-12 13:42:13 +00:00
Rosie Sumpter 552eb372cb [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
2022-01-12 13:34:12 +00:00
Sven van Haastregt 4b85800bfd [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
2022-01-12 13:30:09 +00:00
Jeremy Morse 6a605b97a2 [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 3c04507088, 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
2022-01-12 13:28:01 +00:00
Kuba Mracek 23e8a4d160 [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).
2022-01-12 05:25:02 -08:00
David Sherwood b5493ff571 [NFC] Run script to autogenerate CHECK lines for CodeGen/AArch64/fast-isel-cmp-vec.ll 2022-01-12 13:12:51 +00:00
Simon Moll 33efbc8184 [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
2022-01-12 14:06:56 +01:00
Simon Pilgrim c2426fdcae [X86][XOP] Add SimplifyDemandedVectorElts handling for xop shifts
Noticed while investigating how to improve funnel shift codegen
2022-01-12 12:43:13 +00:00
Simon Pilgrim 13362abf3d [X86][XOP] Add tests for missing demanded elts handling for xop shifts
Noticed while investigating how to improve funnel shift codegen
2022-01-12 12:43:13 +00:00
Florian Hahn 138fcc5f76
[IRBuilder] Migrate icmp-folding to value-based FoldICmp.
Depends on D116935.

Reviewed By: nikic, lebedev.ri

Differential Revision: https://reviews.llvm.org/D116969
2022-01-12 12:37:46 +00:00
David Spickett 3fd9c90bdc [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.
2022-01-12 12:28:13 +00:00
Shao-Ce SUN edb9175de6 [RISCV][llvm] Update CSRs
According the newest RISC-V Privileged Spec, updated CSRs.

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D116645
2022-01-12 20:14:04 +08:00
Chuanqi Xu bf5f2354fa [NFC] [Coroutines] Add regression tests for symmetric transfer and coroutine elision 2022-01-12 19:39:56 +08:00