Peter Klausler [Tue, 26 Apr 2022 20:29:55 +0000 (13:29 -0700)]
[flang] Downgrade a fatal error to a warning
A non-CHARACTER expression in a CASE statement is allowed to have
a distinct kind (not type) from the expression in its SELECT CASE.
If a value in a CASE statement is out of range for the SELECT CASE
type, emit a warning, but it should not be a fatal error.
Differential Revision: https://reviews.llvm.org/D124544
Peter Klausler [Tue, 26 Apr 2022 20:01:00 +0000 (13:01 -0700)]
[flang] Allow for host association in ConvertTo(Object|Proc)Entity
Name resolution fails with a bogus "is not a variable" error message
when a host-associated object appears in a NAMELIST group. The root
cause is that ConvertToObjectEntity() returns false for host-associated
objects. Fix that, and also apply a similar fix to ConvertToProcEntity()
nearby.
Differential Revision: https://reviews.llvm.org/D124541
Blue Gaston [Tue, 26 Apr 2022 21:33:08 +0000 (14:33 -0700)]
[Darwin][UBSan][Sanitizer] abort_on_error ubsan test fix for arm64
The current darwin abort_on_error test specifically tests for a division
by zero undefined behavior. However arm does not trap by default for this
behavior. x86 signals the abort, which is why the test passes on x86.
This patch updates the test to test for a case where the ubsan runtime
specifically calls Die() to trigger an abort by default.
rdar://
92108564
Differential Revision: https://reviews.llvm.org/D124480
Petr Hosek [Wed, 27 Apr 2022 18:41:41 +0000 (11:41 -0700)]
Revert "[Driver] Support for compressed debug info on Fuchsia"
This reverts commit
2d0c897212d0551966b26eae986209ea31c4f032 which
is still breaking on the sanitizer bots.
Matt Arsenault [Tue, 19 Apr 2022 18:59:32 +0000 (14:59 -0400)]
llvm-reduce: Fix mangling types of generic registers
Petr Hosek [Wed, 17 Nov 2021 19:06:03 +0000 (11:06 -0800)]
[Driver] Support for compressed debug info on Fuchsia
Pass the --compress-debug-sections=zlib argument to the linker when
the use of compressed debug info is requested.
Differential Revision: https://reviews.llvm.org/D114115
Matt Arsenault [Tue, 19 Apr 2022 14:15:40 +0000 (10:15 -0400)]
llvm-reduce: Preserve subregisters and other fields for top block def
Nicolas Abram Lujan [Wed, 27 Apr 2022 17:41:25 +0000 (13:41 -0400)]
[InstCombine] C0 >> (X - C1) --> (C0 << C1) >> X
With the right pre-conditions, we can fold the offset
into the shifted constant:
https://alive2.llvm.org/ce/z/drMRBU
https://alive2.llvm.org/ce/z/cUQv-_
Fixes #55016
Differential Revision: https://reviews.llvm.org/D124369
Craig Topper [Wed, 27 Apr 2022 17:32:54 +0000 (10:32 -0700)]
[RISCV] Add isCommutable to scalar FMA instructions.
The default implementation of findCommutedOpIndices picks the
first two source operands. That's exactly what we want for the
scalar FMA instructions.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D124463
Martin Sebor [Wed, 27 Apr 2022 18:01:35 +0000 (12:01 -0600)]
[InstCombine] Fold strnlen calls in equality to zero.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D123818
Alexey Bataev [Wed, 14 Apr 2021 14:49:32 +0000 (07:49 -0700)]
[COST]Improve cost model for shuffles in SLP.
Introduced masks where they are not added and improved target dependent
cost models to avoid returning of the incorrect cost results after
adding masks.
Differential Revision: https://reviews.llvm.org/D100486
Zequan Wu [Wed, 27 Apr 2022 17:46:51 +0000 (10:46 -0700)]
[LLDB][NativePDB] Minor fix ParseInlinesite.
- Don't reset cur_line_offset to llvm::None when we don't have next_line_offset, because we may need to reuse it in new range after a code end.
- Don't use CombineConsecutiveEntriesWithEqualData for inline_site_sp->ranges, because that will combine consecutive entries with same data in the vector regardless of the entry's range. Originally, I thought that it only combine consecutive entries if adjacent entries' ranges are adjoining or intersecting with each other.
Andrew Savonichev [Wed, 27 Apr 2022 16:36:54 +0000 (19:36 +0300)]
[lit] Support %if ... %else syntax for RUN lines
This syntax allows to modify RUN lines based on features
available. For example:
RUN: ... | FileCheck %s --check-prefix=%if windows %{CHECK-W%} %else %{CHECK-NON-W%}
CHECK-W: ...
CHECK-NON-W: ...
The whole command can be put under %if ... %else:
RUN: %if tool_available %{ %tool %} %else %{ true %}
or:
RUN: %if tool_available %{ %tool %}
If tool_available feature is missing, we'll have an empty command in
this RUN line. LIT used to emit an error for empty commands, but now
it treats such commands as nop in all cases.
Multi-line expressions are also supported:
RUN: %if tool_available %{ \
RUN: %tool \
RUN: %} %else %{ \
RUN: true \
RUN: %}
Background and motivation:
D121727 [NVPTX] Integrate ptxas to LIT tests
https://reviews.llvm.org/D121727
Differential Revision: https://reviews.llvm.org/D122569
Wei Wang [Mon, 25 Apr 2022 21:00:41 +0000 (14:00 -0700)]
[CHR] Skip region containing llvm.coro.id
When a block containing llvm.coro.id is cloned during CHR, it inserts an invalid
PHI node with token type to the beginning of the block containing llvm.coro.begin.
To avoid such case, we exclude regions with llvm.coro.id.
Reviewed By: ChuanqiXu
Differential Revision: https://reviews.llvm.org/D124418
Aart Bik [Wed, 27 Apr 2022 04:25:32 +0000 (21:25 -0700)]
[mlir][sparse] optimize COO index handling
By using a shared index pool, we reduce the footprint of each "Element"
in the COO scheme and, in addition, reduce the overhead of allocating
indices (trading many allocations of vectors for allocations in a single
vector only). When the capacity is known, this means *all* allocation
can be done in advance.
This is a big win. For example, reading matrix SK-2005, with dimensions
50,636,154 x 50,636,154 and 1,949,412,601 nonzero elements improves
as follows (time in ms), or about 3.5x faster overall
```
SK-2005 before after speedup
---------------------------------------------
read 305,086.65 180,318.12 1.69
sort 2,836,096.23 510,492.87 5.56
pack 364,485.67 312,009.96 1.17
---------------------------------------------
TOTAL 3,505,668.56 1,002,820.95 3.50
```
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D124502
Vasileios Porpodas [Tue, 26 Apr 2022 15:31:19 +0000 (08:31 -0700)]
[NFC] Renamed /test/Analysis/CostModel/X86/splat-load.ll test and added more checks.
Renamed test/Analysis/CostModel/X86/splat-load.ll to shuffle-load.ll
to align it with AArch64's similar test.
Also added a complete list of checks for all vector combinations up to 512-bits.
Differential Revision: https://reviews.llvm.org/D124528
Min-Yih Hsu [Wed, 20 Apr 2022 17:40:37 +0000 (10:40 -0700)]
[mlir][LLVMIR] Do not cache llvm::Constant into instMap
Constants in MLIR are not globally unique, unlike that in LLVM IR.
Therefore, reusing previous-translated constants might cause the user
operations not being dominated by the constant (because the
previous-translated ones can be placed in arbitrary place)
This indeed misses some opportunities where we actually can reuse a
previous-translated constants, but verbosity is not our first priority
here.
Differential Revision: https://reviews.llvm.org/D124404
Min-Yih Hsu [Wed, 20 Apr 2022 17:30:43 +0000 (10:30 -0700)]
[mlir][LLVMIR] Do not cache Instruction generated on-the-fly
More specifically, the llvm::Instruction generated by
llvm::ConstantExpr::getAsInstruction. Such Instruction will be deleted
right away, but it's possible that when getAsInstruction is called
again, it will create a new Instruction that has the same address with
the one we just deleted. Thus, we shouldn't keep it in the `instMap` to
avoid a conflicting index that triggers an assertion in
processInstruction.
Differential Revision: https://reviews.llvm.org/D124402
Min-Yih Hsu [Wed, 20 Apr 2022 17:48:42 +0000 (10:48 -0700)]
[mlir][LLVMIR] Add support for importing struct-type ConstantAggregate(Zero)
And move importer test files from `test/Target/LLVMIR` into
`test/Target/LLVMIR/Import`.
We simply translate struct-type ConstantAggregate(Zero) into a
serious of `llvm.insertvalue` operations against a `llvm.undef` root.
Note that this doesn't affect the original logics on translating
vector/array-type ConstantAggregate values.
Differential Revision: https://reviews.llvm.org/D124399
Mike Kashkarov [Wed, 27 Apr 2022 13:14:10 +0000 (16:14 +0300)]
[flang] Fix UBOUND() folding for constant arrays
Similarly to LBOUND in https://reviews.llvm.org/D123237, fix UBOUND() folding
for constant arrays (for both w/ and w/o DIM=): convert
GetConstantArrayLboundHelper into common helper class for both lower/upper
bounds.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D123520
Mathieu Fehr [Wed, 27 Apr 2022 15:43:37 +0000 (08:43 -0700)]
[mlir] Allow setting operation legality with an OperationName
This is necessary to handle conversions of operations defined at runtime in extensible dialects.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D124353
Chris Bieneman [Wed, 27 Apr 2022 15:43:31 +0000 (10:43 -0500)]
[DXIL] [NFC] Remove dead attribute code paths
DXIL doesn't support attributes added after LLVM 3.7. The DXILPrepare
pass removes those attributes so they should never be present by the
time we reach the DXIL bitcode writer.
In the event that we somehow try to write a newer attribute in the DXIL
writer, we should fail hard (crash), because the output would be
invalid. This case should only be possible if the DXIL writer were
called without DXILPrepare being run first, which shouldn't be possible.
This patch also adds a default case to the switch statement over the
attribute list which covers all the removed cases and any new attribute
kinds that may be added in the future. The default case is handled like
other unsupported cases by a call to llvm_unreachable.
Hans Wennborg [Wed, 27 Apr 2022 12:14:39 +0000 (14:14 +0200)]
Remove the Visual Studio/MSBuild integration (llvm/tools/msbuild/)
This has been obsolete and abandoned since MS started including an
integration themselves in Visual Studio 2019.
See discussion at
https://discourse.llvm.org/t/building-the-llvm-with-msbuild/62053/
Differential revision: https://reviews.llvm.org/D124521
Jonas Devlieghere [Wed, 27 Apr 2022 01:23:10 +0000 (18:23 -0700)]
Remove Python 2 checks from the test suite
We dropped downstream support for Python 2 in the previous release. Now
that we have branched for the next release the window where this kind of
change could introduce conflicts is closing too. Remove Python 2 checks
from the test suite.
Differential revision: https://reviews.llvm.org/D124429
Jonas Devlieghere [Tue, 26 Apr 2022 03:14:44 +0000 (20:14 -0700)]
Remove Python 2 support from the ScriptInterpreter plugin
We dropped downstream support for Python 2 in the previous release. Now
that we have branched for the next release the window where this kind of
change could introduce conflicts is closing too. Start by getting rid of
Python 2 support in the Script Interpreter plugin.
Differential revision: https://reviews.llvm.org/D124429
Dmitry Vyukov [Wed, 27 Apr 2022 09:23:41 +0000 (11:23 +0200)]
tsan: avoid false positives related to epoll
An application can use the mere fact of epoll_wait returning an fd
as synchronization with the write on the fd that triggered the notification.
This pattern come up in an internal networking server (b/
229276331).
If an fd is added to epoll, setup a link from the fd to the epoll fd
and use it for synchronization as well.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D124518
Simon Pilgrim [Wed, 27 Apr 2022 14:29:03 +0000 (15:29 +0100)]
[X86] collectConcatOps - add ability to collect from vector 'widening' patterns
Recognise insert_subvector(undef, x, lo/hi) patterns where we double the width of a vector - creating an UNDEF subvector on the fly.
David Green [Wed, 27 Apr 2022 14:36:15 +0000 (15:36 +0100)]
[AArch64] Attempt to fix bots by ensuring legalized type is a vector
Andrew Savonichev [Tue, 26 Apr 2022 19:41:10 +0000 (22:41 +0300)]
[NVPTX] Fix NVPTX DebugInfo tests on Windows
Lei Zhang [Wed, 27 Apr 2022 14:22:41 +0000 (10:22 -0400)]
[mlir][spirv] Add conversion from vector.reduction
Only supports addition and multiplication for now; other cases
to be implemented.
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D124380
Roman Lebedev [Wed, 27 Apr 2022 13:48:02 +0000 (16:48 +0300)]
[InstCombine] 'round up integer': if bias is just right, just reuse instructions
This is only useful if we can't create new instruction
because %x.aligned has other uses and already sticks around.
Roman Lebedev [Wed, 27 Apr 2022 11:44:03 +0000 (14:44 +0300)]
[InstCombine] Fold 'round up integer' pattern (when alignment is a power of two)
But don't deal with non-splats.
The test coverage is sufficiently exhaustive,
and alive is happy about the changes there.
Example with constants: https://alive2.llvm.org/ce/z/EUaJ5- / https://alive2.llvm.org/ce/z/Bkng2X
General proof: https://alive2.llvm.org/ce/z/3RjJ5A
Roman Lebedev [Tue, 26 Apr 2022 23:25:33 +0000 (02:25 +0300)]
[NFC][InstCombine] Add some tests for open-coded round-up of an integer w/ power-of-2 target alignment
Lei Zhang [Wed, 27 Apr 2022 14:13:17 +0000 (10:13 -0400)]
[mlir][spirv] Allow converting from index type in unsigned ops
`index` type is converted to `i32` in SPIR-V. This is fine to
support for all signed/unsigned ops.
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D124451
Shilei Tian [Wed, 27 Apr 2022 14:07:49 +0000 (10:07 -0400)]
[SLP] Fix a typo that causes redundant assertion and potential segment fault
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D124497
Pavel Labath [Wed, 27 Apr 2022 14:01:54 +0000 (16:01 +0200)]
[lldb] Remove sanity check from TestWithLimitDebugInfo
The trick with opening the .o file does not work on arm (unhandled
relocations), and I can't think of a quick fix for that.
Joseph Huber [Wed, 27 Apr 2022 13:56:37 +0000 (09:56 -0400)]
[OpenMP] Properly handle the `-f/-fno` veraints for the new driver
Summary:
We provide the `-f(no-)openmp-new-driver` option to allow users to use
the old or new driver. Previously this wasn't handled in the expected
way and only `-fno-openmp-new-driver` was checked. This patch fixes that
by using the `hasFlag` method as is standard.
Sanjay Patel [Wed, 27 Apr 2022 13:01:19 +0000 (09:01 -0400)]
[InstCombine] add tests for ashr/lshr of constant with shift amount offset; NFC
Baseline tests for D124369
LLVM GN Syncbot [Wed, 27 Apr 2022 13:44:43 +0000 (13:44 +0000)]
[gn build] Port
6ddf2a824da9
Nikita Popov [Wed, 27 Apr 2022 12:56:40 +0000 (14:56 +0200)]
[GVN] Add more tests for opaque pointer GEPs (NFC)
Some of these are equivalent when considering an offset encoding.
Ivan Kosarev [Wed, 27 Apr 2022 13:07:52 +0000 (14:07 +0100)]
[AMDGPU] Adjust wave priority based on VMEM instructions to avoid duty-cycling.
As older waves execute long sequences of VALU instructions, this may
prevent younger waves from address calculation and then issuing their
VMEM loads, which in turn leads the VALU unit to idle. This patch tries
to prevent this by temporarily raising the wave's priority.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D124246
David Tenty [Wed, 27 Apr 2022 13:31:36 +0000 (09:31 -0400)]
[NFC] XFAIL tests which need visibility in XCOFF objectwriting
on AIX since this is currently unsupported and we added an error in D124392.
Anna Thomas [Tue, 26 Apr 2022 21:15:48 +0000 (17:15 -0400)]
[IRCE] Avoid computing potentially unnecessary analyses. NFC
IRCE is a function pass that operates on loops. If there are no loops in
the function (as seen through LI), we should avoid computing the
remaining expensive analyses (such as BPI). Reordered the analyses
requests and early return if there are no loops. This is an NFC with
compile time improvement.
The same will be done in a follow-up patch for the loop vectorizer.
Reviewed-By: nikic
Differential Revision: https://reviews.llvm.org/D124478
Biplob Mishra [Wed, 27 Apr 2022 13:17:54 +0000 (14:17 +0100)]
InstCombine: Add tests to show or-and scenarios which can be possibly be combined generically
Pavel Labath [Tue, 26 Apr 2022 14:13:48 +0000 (16:13 +0200)]
[lldb] Fix TestWithLimitDebugInfo.py
The test was broken (in the sense that it was not testing what it was
supposed to test) in two ways:
- a Makefile refactor caused it to stop being built with
-flimit-debug-info
- clang's constructor homing changed the "home" of the type
This patch fixes the Makefile, and modifies the source code to produce
the same result with both type homing strategies. Due to constructor
homing I had to use a different implicitly-defined function for the test
-- I chose the assignment operator.
I also added some sanity checks to the test to ensure that the test is
indeed operating on limited debug info.
Pavel Labath [Wed, 27 Apr 2022 13:01:01 +0000 (15:01 +0200)]
[lldb] Make test names unique
Florian Hahn [Wed, 27 Apr 2022 13:06:35 +0000 (14:06 +0100)]
[SimpleLoopUnswitch] Add trivial unswitching tests with selects.
Add tests with selects that match both logical AND and logical OR. Note
that some of the tests get miscompiled at the moment.
Also moves a related test to the newly added test file.
Denis Antrushin [Tue, 26 Apr 2022 10:52:43 +0000 (17:52 +0700)]
[StatepointLowering] Only export STATEPOINT results if used in nonlocal blocks.
Cuurently we always export STATEPOINT results (GC pointers lowered via VRegs)
to virtual registers. When processing gc.relocate instructions we have to
generate CopyFromRegs node and then export it to VReg again if gc.relocate
is used in other basic blocks. This results in generation of extra COPY MIR
instruction if statepoint and its gc.relocate are in the same BB, but gc.relocate
result is used in other blocks.
This patch changes this behavior to export statepoint results only if used
in other basic blocks. For local uses StatepointLoweringState.(get|set)Location()
API is used to communicate appropriate statepoint result from `LowerStatepoint()`
to `visitGCRelocate()`
This is NFC and is purely compile time optimization. On big methids it can improve
codegen compile time up to 10%.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D124444
David Green [Wed, 27 Apr 2022 12:51:50 +0000 (13:51 +0100)]
[AArch64] Break up larger shuffle-masks into legal sizes in getShuffleCost
Given a larger-than-legal shuffle mask, the final codegen will split
into multiple sub-vectors. This attempts to model that in
AArch64TTIImpl::getShuffleCost, splitting masks up according to the size
of the legalized vectors. If the sub-masks have at most 2 input sources
we can call getShuffleCost on them and sum the costs, to get a more
accurate final cost for the entire shuffle. The call to
improveShuffleKindFromMask helps to improve the shuffle kind for the
sub-mask cost call.
Differential Revision: https://reviews.llvm.org/D123414
David Green [Wed, 27 Apr 2022 12:30:50 +0000 (13:30 +0100)]
[AArch64] Add some larger shuffle cost tests. NFC
Kiran Chandramohan [Wed, 27 Apr 2022 12:19:54 +0000 (12:19 +0000)]
[Flang] Lower the FailImage Statement
Lowering of FailImage statement generates a runtime call and the
unreachable operation. The unreachable operation cannot terminate
a structured operation like the IF operation, hence mark as
unstructured.
Note: This patch is part of upstreaming code from the fir-dev branch of
https://github.com/flang-compiler/f18-llvm-project.
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D124520
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Haojian Wu [Tue, 26 Apr 2022 07:34:46 +0000 (09:34 +0200)]
[AST] Consider QualifiedTemplateName in TemplateName::getAsUsingDecl().
If the underlying template name of a qualified template name is a using
decl, TemplateName::getAsUsingDecl() will return it.
This will make the UsingTemplateName consumer life easier.
Differential Revision: https://reviews.llvm.org/D124437
Chris Jackson [Wed, 27 Apr 2022 12:08:03 +0000 (13:08 +0100)]
[Debuginfo][LSR] Add salvaging variadic dbg.value intrinsics [2/2]
This relands commit
8f550368b169b0a3d4ebc3e65efec49ec1e0798a.
The test is amended with REQUIRES: x86-registered-target, in line with
the other debuginfo-scev-salvage tests.
Differential Revision: https://reviews.llvm.org/D120169
Chris Jackson [Wed, 27 Apr 2022 12:06:03 +0000 (13:06 +0100)]
Revert [Debuginfo][LSR] Add salvaging variadic dbg.value intrinsics[2/2]
This reverts commit
8f550368b169b0a3d4ebc3e65efec49ec1e0798a.
Chris Jackson [Wed, 27 Apr 2022 11:38:12 +0000 (12:38 +0100)]
[Debuginfo][LSR] Add salvaging variadic dbg.value intrinsics [2/2]
Second of two patches to extend SCEV-based salvaging to dbg.value
intrinsics that have multiple location ops pre-LSR. This second patch
adds the core implementation.
Reviewers: @StephenTozer, @djtodoro
Differential Revision: https://reviews.llvm.org/D120169
Tom Weaver [Wed, 27 Apr 2022 11:29:04 +0000 (12:29 +0100)]
Revert "[Driver] Support for compressed debug info on Fuchsia"
This reverts commit
19190cc651ef153c308d23fb56f064223b144488.
Causes test failures on following build bot:
http://lab.llvm.org:8011/#/builders/216
David Green [Wed, 27 Apr 2022 11:09:01 +0000 (12:09 +0100)]
[AArch64] Use PerfectShuffle costs in AArch64TTIImpl::getShuffleCost
Given a shuffle with 4 elements size 16 or 32, we can use the costs
directly from the PerfectShuffle tables to get a slightly more accurate
cost for the resulting shuffle.
Differential Revision: https://reviews.llvm.org/D123409
Chris Jackson [Wed, 27 Apr 2022 10:27:10 +0000 (11:27 +0100)]
[Debuginfo][LSR] Add salvaging variadic dbg.value intrinsics [1/2] [NFC]
First of two patches that extends SCEV-based salvaging to enable
salvaging of dbg.value instrinsics that have multiple locations ops
before the Loop Strength Reduction pass.
The existing single-op SCEV-based salvaging can generate variadic
dbg.value intrinsics in order to salvage a dbg.value that has a single
location op. If a dbg.value has multiple location ops before LSR, and
LSR optimises away one or more of the location operands, then currently
no salvaging will be attempted.
Salvaging can now be added, but first this patch cleans up consistency
in both the code and comments, and applies some refactoring to make
application of the new salvaging implementation more straightforward.
- Use SCEVDbgValueBuilder for both types of recovery expressions:
IV-offset based and iteration count based.
- Combine the functions that write the final DIExpression.
- Move some static functions into member functions.
Reviewers: @Orlando
Differential Revision: https://reviews.llvm.org/D120168
Stephan Herhut [Wed, 27 Apr 2022 10:11:03 +0000 (12:11 +0200)]
[mlir][bazel] Add suport for PDLL tests.
Differential Revision: https://reviews.llvm.org/D124515
Nikolas Klauser [Wed, 27 Apr 2022 08:11:44 +0000 (10:11 +0200)]
[libc++] Implement P0980R1 (constexpr std::string)
Reviewed By: #libc, ldionne
Spies: daltenty, sdasgup3, ldionne, arichardson, MTC, ChuanqiXu, mehdi_amini, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, Kayjukh, jurahul, msifontes, tatianashp, rdzhabarov, teijeong, cota, dcaballe, Chia-hungDuan, wrengr, wenzhicui, arphaman, Mordante, miscco, Quuxplusone, smeenai, libcxx-commits
Differential Revision: https://reviews.llvm.org/D110598
Simon Pilgrim [Wed, 27 Apr 2022 09:45:39 +0000 (10:45 +0100)]
[GVN][NewGVN] Regenerate no_speculative_loads_with_asan.ll tests
As discussed on D124284 - ensure we actually checking the codegen not just a label + return
Andrzej Warzynski [Fri, 22 Apr 2022 10:59:31 +0000 (10:59 +0000)]
[flang][driver] NFC: Make code more in line with LLVM style
This patch basically implements [1] in ExecuteCompilerInvocation.cpp. It
also:
* replaces `CreateFrontendBaseAction` with `CreateFrontendAction`
(only one method is needed ATM, this change removes the extra
indirection)
* removes `InvalidAction` from the `ActionKind` enum (I don't think it
adds much and keeping it would mean adding a new void case in
`CreateFrontendAction`)
* sets the default frontend action in FrontendOptions.h to
`ParseSyntaxOnly` (note that this is still overridden independently
in `ParseFrontendArg` in CompilerInvocation.cpp)
No new functionality is added, hence no tests.
[1] https://llvm.org/docs/CodingStandards.html#don-t-use-default-labels-in-fully-covered-switches-over-enumerations
Differential Revision: https://reviews.llvm.org/D124245
Liqin.Weng [Wed, 27 Apr 2022 08:05:01 +0000 (08:05 +0000)]
[MIPS][SelectionDAG] Enable TargetLowering::hasBitTest for masks that fit in ANDI.
Reviewed By: sdardis
Differential Revision: https://reviews.llvm.org/D123577
Jeremy Morse [Wed, 27 Apr 2022 08:40:31 +0000 (09:40 +0100)]
[DebugInfo][InstrRef] Describe value sizes when spilt to stack
InstrRefBasedLDV can track and describe variable values that are spilt to
the stack -- however it does not current describe the size of the value on
the stack. This can cause uninitialized bytes to be read from the stack if
a small register is spilt for a larger variable, or theoretically on
big-endian machines if a large value on the stack is used for a small
variable.
Fix this by using DW_OP_deref_size to specify the amount of data to load
from the stack, if there's any possibility for ambiguity. There are a few
scenarios where this can be omitted (such as when using DW_OP_piece and a
non-DW_OP_stack_value location), see deref-spills-with-size.mir for an
explicit table of inputs flavours and output expressions.
Differential Revision: https://reviews.llvm.org/D123599
David Green [Wed, 27 Apr 2022 08:30:00 +0000 (09:30 +0100)]
[CostModel] Add basic fptoi_sat costs
This adds some basic fptosi_sat and fptoui_sat target independent cost
modelling. The fptosi_sat is modelled as a fmin/fmax to saturate the
value, followed by a fp convert. The signed values then have an
additional fcmp+select for handling Nan correctly.
The AArch64/Arm costs may be more incorrect, as the instruction exist
natively. This can be fixed with target specific cost updates.
Differential Revision: https://reviews.llvm.org/D124269
Vitaly Buka [Wed, 27 Apr 2022 07:20:11 +0000 (00:20 -0700)]
Revert "[asan] Enable detect_stack_use_after_return=1 by default"
Temporarily revert the option to fix
https://bugs.chromium.org/p/chromium/issues/detail?id=1319387
This reverts option default and documentation of the commit. Test
changes are not being reverted as they are improvement and break
reliance on option defaults.
Additional memory usage is a problem on mobile devices with low memory.
Even heavy thread desktop programs may need some FakeStack tunning.
This reverts commit
4b4437c084e2b8a2643e97e7aef125c438635a4d.
Nikita Popov [Tue, 26 Apr 2022 12:27:09 +0000 (14:27 +0200)]
[InstCombine] Combine opaque pointer GEPs with mismatching element types
Currently, two GEPs will only be combined if the result element
type of one is the same as the source element type of the other.
However, this means we may miss folding opportunities where the
second GEP could be rewritten using a different element type. This
is especially relevant for opaque pointers, where constant GEPs
often use i8 element type.
Address this by converting GEP indices to offsets, adding them,
and then converting them back to indices. The first (inner) GEP
is allowed to have variable indices as well, in which case only
the constant suffix is converted into an offset.
This should address the regression reported in
https://reviews.llvm.org/D123300#3467615.
Differential Revision: https://reviews.llvm.org/D124459
Nikita Popov [Tue, 26 Apr 2022 16:50:44 +0000 (18:50 +0200)]
[AsmParser] Automatically declare and lex attribute keywords (NFC)
Rather than listing these by hand, include all enum attribute
keywords from Attributes.inc. This reduces the number of places
one has to update whenever an enum attribute is added.
Differential Revision: https://reviews.llvm.org/D124465
Jim Lin [Wed, 27 Apr 2022 04:57:58 +0000 (12:57 +0800)]
[RISCV][NFC] Update and add missing closed curly bracket comment in RISCVInstrInfoZb.td
Petr Hosek [Wed, 17 Nov 2021 19:06:03 +0000 (11:06 -0800)]
[Driver] Support for compressed debug info on Fuchsia
Pass the --compress-debug-sections=zlib argument to the linker when
the use of compressed debug info is requested.
Differential Revision: https://reviews.llvm.org/D114115
Tobias Ribizel [Wed, 27 Apr 2022 06:36:08 +0000 (02:36 -0400)]
[clangd] Output inlay hints with `clangd --check`
With the addition of inlay hints to clangd, it would be useful to output them during verbose `clangd --check`.
This patch adds an output step for inlay hints and unifies the way `--check-lines` are passed around
Reviewed By: nridge
Differential Revision: https://reviews.llvm.org/D124344
Alexandros Lamprineas [Wed, 27 Apr 2022 06:25:01 +0000 (07:25 +0100)]
[FuncSpec] Conditional jump or move depends on uninitialised value(s).
I found this bug when performing a two-stage build of clang with
Function Specialization enabled and tuned aggressively. The crash
appears only on release builds.
Fixes https://github.com/llvm/llvm-project/issues/55000.
Before accessing the contents of the ArgInfo iterator inside
SCCPInstVisitor::markArgInFuncSpecialization, we should be
checking that the iterator is valid.
Differential Revision: https://reviews.llvm.org/D124114
Petr Hosek [Wed, 27 Apr 2022 06:25:38 +0000 (23:25 -0700)]
Revert "[CMake][compiler-rt] Use COMPILE_OPTIONS and LINK_OPTIONS"
This reverts commit
d47565ed62a383175ebb5cb5733f169d72715253.
Petr Hosek [Wed, 30 Mar 2022 17:33:40 +0000 (10:33 -0700)]
[CMake][compiler-rt] Use COMPILE_OPTIONS and LINK_OPTIONS
This avoids the need for string-ification and lets CMake deduplicate
potentially duplicate flags.
Differential Revision: https://reviews.llvm.org/D122750
Youngsuk Kim [Wed, 27 Apr 2022 04:46:06 +0000 (21:46 -0700)]
[docs] Fix typos in the 'CodeGenerator' doc
NFC.
Differential Revision: https://reviews.llvm.org/D124305
ShihPo Hung [Tue, 22 Mar 2022 02:58:46 +0000 (19:58 -0700)]
[RISCV][RVV] Select unmasked TU RVV pseudos in a DAG post-process
Following D118810 that reduced the size of ISel table,
this patch optimizes allone-masked RVV pseudos with TU policy and
swap them out to their unmasked TU pseudos.
Since the UNDEF merge operand is not preserved, we turn it into TA
pseudo regardless of the policy operand.
Reviewed By: craig.topper, frasercrmck
Differential Revision: https://reviews.llvm.org/D121881
ShihPo Hung [Fri, 8 Apr 2022 12:56:21 +0000 (05:56 -0700)]
[RISCV] Precommit test for D121881
Differential Revision: https://reviews.llvm.org/D123385
Richard [Sat, 23 Apr 2022 01:35:48 +0000 (19:35 -0600)]
[clang-tidy] Modernize-macro-to-enum should skip macros used in other macros
If a macro is used in the expansion of another macro, that can cause
a compile error if the macro is replaced with an enum. Token-pasting is
an example where converting a macro defined as an integral constant can
cause code to no longer compile.
This change causes such macros to be skipped from the conversion
process in order to prevent fixits from creating code that no longer
compiles.
A subsequent enhancement will examine macro usage in more detail to
allow more cases to be handled without breaking code.
Differential Revision: https://reviews.llvm.org/D124316
Fixes #54948
Mathieu Fehr [Wed, 27 Apr 2022 02:48:13 +0000 (19:48 -0700)]
[mlir] Add extensible dialects
Depends on D104534
Add support for extensible dialects, which are dialects that can be
extended at runtime with new operations and types.
These operations and types cannot at the moment implement traits
or interfaces.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D104554
River Riddle [Wed, 27 Apr 2022 02:45:30 +0000 (19:45 -0700)]
[mlir:PDLL] Use normalized paths in compilation database test
This fixes issues with the compilation database when the file path
isn't in the correct form.
River Riddle [Wed, 27 Apr 2022 02:40:41 +0000 (19:40 -0700)]
[mlir:PDLL] Fix build on windows related to different file paths
This fixes issues with the compilation database when the file path
isn't in the correct form.
Shoaib Meenai [Tue, 26 Apr 2022 05:51:10 +0000 (22:51 -0700)]
[ELF] Prevent LTO stripping of wrapped script-referenced symbols
After
1af25a986069f2ae8c724133fa8649bb795a7925, we stop unconditionally
retaining wrapped symbols, which means that LTO's summary-based global
dead stripping can eliminate them even if they'll be referenced by a
linker script after the wrapping is performed. Mark symbols referenced
in linker scripts as `referenced` in addition to `isUsedInRegularObj`,
so that the wrapping logic correctly sets `referencedAfterWrap` for the
symbols which will be referenced after wrapping, which will prevent LTO
from eliminating them.
An alternative would have been to change the `referencedAfterWrap` logic
to look at `isUsedInRegularObj` in addition to `referenced`, but
`isUsedInRegularObj` is also set in other places (e.g. for the entry
symbol), and it's not clear that we want `referencedAfterWrap` to take
all those places into account, so it seemed better to keep that logic
as-is and instead set `referenced` for linker script-referenced symbols.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D124433
Ping Deng [Wed, 27 Apr 2022 01:38:21 +0000 (09:38 +0800)]
[RISCV][NFC] Add RV64Zbs invalid tests
Add a new test rv64zbs-invalid.s along with the aleady
existing rv32zbs-invalid.s.
Reviewed By: craig.topper, asb
Differential Revision: https://reviews.llvm.org/D124428
River Riddle [Wed, 20 Apr 2022 18:58:11 +0000 (11:58 -0700)]
[mlir][PDLL-LSP] Add code completion for include file paths
This allows for providing completion results for include directive
file paths by searching the set of include directories for the current
file.
Differential Revision: https://reviews.llvm.org/D124112
River Riddle [Wed, 20 Apr 2022 09:14:08 +0000 (02:14 -0700)]
[mlir][PDLL] Add document link and hover support to mlir-pdll-lsp-server
This allows for navigating to included files on click, and also provides hover
information about the include file (similarly to clangd).
Differential Revision: https://reviews.llvm.org/D124077
River Riddle [Wed, 20 Apr 2022 06:53:42 +0000 (23:53 -0700)]
[mlir][PDLL] Add initial support for a PDLL compilation database
The compilation database acts in a similar way to the compilation database
(compile_commands.json) used by clang-tidy, i.e. it provides additional
information about the compilation of project files to help the language
server. The main piece of information provided by the PDLL compilation
database in this commit is the set of include directories used when processing
the input .pdll file. This allows for the server to properly process .pdll files
that use includes anchored by the include directories set up in the build system.
The structure of the textual form of a compilation database is a yaml file
containing documents of the following form:
```
--- !FileInfo:
filepath: <string> - Absolute file path of the file.
includes: <string> - Semi-colon delimited list of include directories.
```
This commit also adds support to cmake for automatically generating
a `pdll_compile_commands.yml` file at the top-level of the build
directory.
Differential Revision: https://reviews.llvm.org/D124076
River Riddle [Wed, 20 Apr 2022 05:46:34 +0000 (22:46 -0700)]
[mlir][PDLL] Add support for generating PDL patterns from PDLL at build time
This essentially sets up mlir-pdll to function in a similar manner to mlir-tblgen. Aside
from the boilerplate of configuring CMake and setting up a basic initial test, two new
options are added to mlir-pdll to mirror options provided by tblgen:
* -d
This option generates a dependency file (i.e. a set of build time dependencies) while
processing the input file.
* --write-if-changed
This option only writes to the output file if the data would have changed, which for
the build system prevents unnecesarry rebuilds if the file was touched but not actually
changed.
Differential Revision: https://reviews.llvm.org/D124075
River Riddle [Wed, 20 Apr 2022 03:34:21 +0000 (20:34 -0700)]
[mlir][PDLL] Don't use the result of `Constraint::getDefName()` when uniquing
In the case of anonymous defs this may return the name of the base def class,
which can lead to two different defs with the same name (which hits an assert).
This commit adds a new `getUniqueDefName` method that returns a unique name
for the constraint.
Differential Revision: https://reviews.llvm.org/D124074
Jason Molenda [Wed, 27 Apr 2022 01:30:18 +0000 (18:30 -0700)]
Don't push null ExecutionContext on CommandInterp exectx stack
The driver can push a null ExecutionContext on to this stack,
and later calls to SBCommandInterpreter::HandleCommand which
don't specify an ExecutionContext can pull an entry from the
stack, resulting in settings that aren't applied.
Differential Revision: https://reviews.llvm.org/D111209
rdar://
81489207
Eric Schweitz [Tue, 26 Apr 2022 23:49:01 +0000 (16:49 -0700)]
Upstream test for wide character literals.
Reviewed By: vdonaldson
Differential Revision: https://reviews.llvm.org/D124488
Alexander Shaposhnikov [Wed, 27 Apr 2022 00:21:33 +0000 (00:21 +0000)]
[Support] Factor out isCrash from throwIfCrash
This diff factors out the check "isCrash" from the static method "throwIfCrash".
This is a helper function that can be useful in debugging / analysis, in particular,
I'm planning to use it in the future patches for lld-fuzzer.
Test plan:
1/ ninja check-all
2/ export LLD_IN_TEST=5 ninja check-lld
Differential revision: https://reviews.llvm.org/D124414
Stanislav Mekhanoshin [Wed, 27 Apr 2022 00:45:41 +0000 (17:45 -0700)]
[AMDGPU] Remove now unused variable HasLdsModifier. NFC.
Yaxun (Sam) Liu [Tue, 26 Apr 2022 17:06:53 +0000 (13:06 -0400)]
[CUDA][HIP] Fix linkage of __clang_gpu_used_external
Different TU's may have this globl var. appending linkage can
only be used with lld recognized special variables.
Change it to internal linkage.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D124466
Stanislav Mekhanoshin [Tue, 26 Apr 2022 22:00:42 +0000 (15:00 -0700)]
[AMDGPU] Add both mayLoad and mayStore to MUBUF LDS opcodes
Differential Revision: https://reviews.llvm.org/D124483
Stanislav Mekhanoshin [Tue, 26 Apr 2022 21:58:42 +0000 (14:58 -0700)]
[AMDGPU] Remove vdata from buffer to lds load
Differential Revision: https://reviews.llvm.org/D124485
Dominic Chen [Wed, 27 Apr 2022 00:14:39 +0000 (17:14 -0700)]
Fix [libc] Minor test signedness fixes
Add namespace specifier
Differential Revision: https://reviews.llvm.org/D124468
Dominic Chen [Tue, 26 Apr 2022 17:25:05 +0000 (10:25 -0700)]
[libc] Minor test signedness fixes
Resolve compiler warnings about signed conversion
Differential Revision: https://reviews.llvm.org/D124468
Jeffrey Tan [Tue, 26 Apr 2022 21:29:10 +0000 (14:29 -0700)]
Fix missing import for test
The last fix missed an import in one test file causing skipIfWindows attribute
can't be recognized.
I feel embarrassed to miss it. I have run all tests on Mac to make sure them
passing in this patch.
Differential Revision: https://reviews.llvm.org/D124479
Warren Ristow [Tue, 26 Apr 2022 23:29:33 +0000 (16:29 -0700)]
[NFC] Fix argument types in doxygen comment
The argument types for _mm_extract_epi16 and _mm_insert_epi16 were
incorrectly identified as '__m256i' instead of '__m128i'. Introduced
by
df08b3493869540bad5d4b040dae814e078b411d, and fixed here.
David Tenty [Fri, 22 Apr 2022 18:37:17 +0000 (14:37 -0400)]
[AIX][XCOFF] error on emit symbol visibility for XCOFF object file
This is a follow on to the revert of D84265 to add an error if we'd need
to write a non-zero visibility type in the xcoff object file. We can't
currently do that because we lack the auxilary header to interpret the
bits in XCOFF32. This is important because visibility is being enabled
in the assembly writing path, and without this error the visibility
could be silently ignored.
Differential Revision: https://reviews.llvm.org/D124392