Commit Graph

422225 Commits

Author SHA1 Message Date
David Tenty 6e8dda047f [NFC] XFAIL tests which need visibility in XCOFF objectwriting
on AIX since this is currently unsupported and we added an error in D124392.
2022-04-27 09:31:36 -04:00
Anna Thomas c515b2f39e [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
2022-04-27 09:22:10 -04:00
Biplob Mishra 70dbb5abd3 InstCombine: Add tests to show or-and scenarios which can be possibly be combined generically 2022-04-27 14:18:12 +01:00
Pavel Labath 089a1d9deb [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.
2022-04-27 15:08:58 +02:00
Pavel Labath f513b5fc47 [lldb] Make test names unique 2022-04-27 15:08:58 +02:00
Florian Hahn 51be0925b4
[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.
2022-04-27 14:06:36 +01:00
Denis Antrushin 4059770af5 [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
2022-04-27 15:53:24 +03:00
David Green 8e2a0e61f5 [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
2022-04-27 13:51:50 +01:00
David Green d42f222f9d [AArch64] Add some larger shuffle cost tests. NFC 2022-04-27 13:30:50 +01:00
Kiran Chandramohan acd75440c6 [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>
2022-04-27 12:20:25 +00:00
Haojian Wu 8052f4d22a [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
2022-04-27 14:16:19 +02:00
Chris Jackson 74273d575f [Debuginfo][LSR] Add salvaging variadic dbg.value intrinsics [2/2]
This relands commit 8f550368b1.

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
2022-04-27 13:10:30 +01:00
Chris Jackson 855752e563 Revert [Debuginfo][LSR] Add salvaging variadic dbg.value intrinsics[2/2]
This reverts commit 8f550368b1.
2022-04-27 13:06:03 +01:00
Chris Jackson 8f550368b1 [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
2022-04-27 12:47:35 +01:00
Tom Weaver 31ff40042d Revert "[Driver] Support for compressed debug info on Fuchsia"
This reverts commit 19190cc651.

Causes test failures on following build bot:

http://lab.llvm.org:8011/#/builders/216
2022-04-27 12:29:04 +01:00
David Green d6327050e0 [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
2022-04-27 12:09:01 +01:00
Chris Jackson c45e4c140f [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
2022-04-27 11:43:05 +01:00
Stephan Herhut c10bbc20bc [mlir][bazel] Add suport for PDLL tests.
Differential Revision: https://reviews.llvm.org/D124515
2022-04-27 12:35:12 +02:00
Nikolas Klauser 425620ccdd [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
2022-04-27 12:25:34 +02:00
Simon Pilgrim 6e078f9804 [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
2022-04-27 10:45:39 +01:00
Andrzej Warzynski d902dd011c [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
2022-04-27 09:20:07 +00:00
Liqin.Weng ca3cd345a0 [MIPS][SelectionDAG] Enable TargetLowering::hasBitTest for masks that fit in ANDI.
Reviewed By: sdardis

Differential Revision: https://reviews.llvm.org/D123577
2022-04-27 09:03:14 +00:00
Jeremy Morse a15b66e76d [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
2022-04-27 09:54:50 +01:00
David Green 4a8c13a6f4 [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
2022-04-27 09:30:00 +01:00
Vitaly Buka c1e94591bc 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 4b4437c084.
2022-04-27 00:43:39 -07:00
Nikita Popov c103f5e9da [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
2022-04-27 09:33:47 +02:00
Nikita Popov 86c770346c [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
2022-04-27 09:27:26 +02:00
Jim Lin 9de7b93bc0 [RISCV][NFC] Update and add missing closed curly bracket comment in RISCVInstrInfoZb.td 2022-04-27 15:08:51 +08:00
Petr Hosek 19190cc651 [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
2022-04-26 23:46:56 -07:00
Tobias Ribizel 56058b921b [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
2022-04-27 02:36:09 -04:00
Alexandros Lamprineas a910337b5d [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
2022-04-27 07:28:25 +01:00
Petr Hosek 0571af01df Revert "[CMake][compiler-rt] Use COMPILE_OPTIONS and LINK_OPTIONS"
This reverts commit d47565ed62.
2022-04-26 23:25:38 -07:00
Petr Hosek d47565ed62 [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
2022-04-26 23:19:16 -07:00
Youngsuk Kim e1567e771b [docs] Fix typos in the 'CodeGenerator' doc
NFC.

Differential Revision: https://reviews.llvm.org/D124305
2022-04-26 21:47:12 -07:00
ShihPo Hung 6b55f133fb [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
2022-04-26 20:14:54 -07:00
ShihPo Hung bcb2b86df6 [RISCV] Precommit test for D121881
Differential Revision: https://reviews.llvm.org/D123385
2022-04-26 20:14:54 -07:00
Richard 693246e03f [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
2022-04-26 21:09:13 -06:00
Mathieu Fehr 9e0b553359 [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
2022-04-26 19:48:22 -07:00
River Riddle 71aad31c0b [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.
2022-04-26 19:45:30 -07:00
River Riddle 021b254547 [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.
2022-04-26 19:40:41 -07:00
Shoaib Meenai 7cc328600e [ELF] Prevent LTO stripping of wrapped script-referenced symbols
After 1af25a9860, 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
2022-04-26 18:48:26 -07:00
Ping Deng c15ae0a37d [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
2022-04-27 09:42:32 +08:00
River Riddle 41d2c6df5c [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
2022-04-26 18:33:17 -07:00
River Riddle 09af7fefc8 [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
2022-04-26 18:33:17 -07:00
River Riddle fb5a59f6e1 [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
2022-04-26 18:33:17 -07:00
River Riddle 597fde54a8 [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
2022-04-26 18:33:16 -07:00
River Riddle b3fc0fa84a [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
2022-04-26 18:33:16 -07:00
Jason Molenda a2681c4330 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
2022-04-26 18:32:18 -07:00
Eric Schweitz 8dc8e59eba Upstream test for wide character literals.
Reviewed By: vdonaldson

Differential Revision: https://reviews.llvm.org/D124488
2022-04-26 18:25:13 -07:00
Alexander Shaposhnikov 6beb2db7d1 [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
2022-04-27 00:52:53 +00:00