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
Martin Sebor [Tue, 26 Apr 2022 22:26:09 +0000 (16:26 -0600)]
[SimplifyLibCalls] avoid slicing 64-bit integers in an ILP32 build (PR #54739)
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D123472
Paul Kirth [Tue, 26 Apr 2022 23:17:26 +0000 (23:17 +0000)]
[BOLT][NFC] Fix warning for unqualified call to std::move
Fixes warning from RetpolineInsertion.cpp:171:44:
warning: unqualified call to std::move [-Wunqualified-std-cast-call]
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D124482
Aart Bik [Tue, 26 Apr 2022 20:30:57 +0000 (13:30 -0700)]
[mlir][sparse] support pattern-only matrices from Matrix Market
We simply set nonzero entries to the value "1" in this case.
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D124475
Martin Sebor [Tue, 26 Apr 2022 22:12:57 +0000 (16:12 -0600)]
[InstCombine] Fold strnlen of constant strings.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D123817
Nico Weber [Tue, 26 Apr 2022 22:00:37 +0000 (18:00 -0400)]
try to fix check-llvm on windows after
0a27622a1d62
Eric Schweitz [Tue, 26 Apr 2022 20:44:34 +0000 (13:44 -0700)]
[NFC] More synching of sources for upstreaming.
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D124476
Warren Ristow [Tue, 26 Apr 2022 21:33:14 +0000 (14:33 -0700)]
[NFC] Cleanup miscellaneous header items
- Explain the use of the _MM_SHUFFLE and _MM_SHUFFLE2 macros
- Update some doxygen parameter descriptions to match the implementations
- Add "see also" doxygen tags to some intrinsics
- Minor clang-format changes
Reviewers: RKSimon
Differential Revision: https://reviews.llvm.org/D124469
Ricky Zhou [Tue, 26 Apr 2022 21:26:54 +0000 (17:26 -0400)]
[InstCombine] Update predicate when canonicalizing comparisons in canonicalizeClampLike.
canonicalizeClampLike canonicalizes the ule/ugt comparisons to ult/uge,
respectively. However, it does not update the variable holding the
comparison predicate type after doing this. Later code fails to handle
the non-canonical predicate type (specifically, the swap of
ThresholdLowIncl and ThresholdHighExcl when Pred0 has been canonicalized
from ugt to uge). This leads to the miscompile reported in PR53252. Fix
this by updating the comparison predicate after canonicalizing.
Fixes #53252
Differential Revision: https://reviews.llvm.org/D119690
Michael Kruse [Tue, 26 Apr 2022 18:35:13 +0000 (13:35 -0500)]
[OpenMPIRBuilder] Remove ContinuationBB argument from Body callback.
The callback is expected to create a branch to the ContinuationBB (sometimes called FiniBB in some lambdas) argument when finishing. This creates problems:
1. The InsertPoint used for CodeGenIP does not need to be the end of a block. If it is not, a naive callback will insert a branch instruction into the middle of the block.
2. The BasicBlock the CodeGenIP is pointing to may or may not have a terminator. There is an conflict where to branch to if the block already has a terminator.
3. Some API functions work only with block having a terminator. Some workarounds have been used to insert a temporary terminator that is removed again.
4. Some callbacks are sensitive to whether the BasicBlock has a terminator or not. This creates a callback ordering problem where different callback may have different behaviour depending on whether a previous callback created a terminator or not. The problem also exists for FinalizeCallbackTy where some callbacks do create branch to another "continue" block, but unlike BodyGenCallbackTy does not receive the target as argument. This is not addressed in this patch.
With this patch, the callback receives an CodeGenIP into a BasicBlock where to insert instructions. If it has to insert control flow, it can split the block at that position as needed but otherwise no separate ContinuationBB is needed. In particular, a callback can be empty without breaking the emitted IR. If the caller needs the control flow to branch to a specific target, it can insert the branch instruction itself and pass an InsertPoint before the terminator to the callback.
Certain frontends such as Clang may expect the current IRBuilder position to be at the end of a basic block. In this case its callbacks must split the block at CodeGenIP before setting the IRBuilder position such that the instructions after CodeGenIP are moved to another basic block and before returning create a new branch instruction to the split block.
Some utility functions such as `splitBB` are supporting correct splitting of BasicBlocks, independent of whether they have a terminator or not, returning/setting the InsertPoint of an IRBuilder to the end of split predecessor block, and optionally omitting creating a branch to the split successor block to be added later.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D118409
Ricky Zhou [Tue, 26 Apr 2022 21:21:27 +0000 (17:21 -0400)]
[InstCombine] Add tests reproducing PR53252 (NFC)
This are baseline tests for D119690 ( #53252 )
Differential Revision: https://reviews.llvm.org/D119689
Martin Storsjö [Tue, 26 Apr 2022 21:19:14 +0000 (00:19 +0300)]
Revert "[compiler-rt] Use C_STANDARD instead of custom logic for adding -std=c11"
This reverts commit
2f251925db060f83894a4cf5448259b7a1255552.
This was reported to break the Builtins-powerpc64le-linux::qdiv_test.c
test on ppc64le buildbots, e.g. these:
https://lab.llvm.org/buildbot/#/builders/105/builds/24538
https://lab.llvm.org/buildbot/#/builders/121/builds/18755
Stanislav Mekhanoshin [Tue, 26 Apr 2022 19:34:27 +0000 (12:34 -0700)]
[AMDGPU] Properly mark MUBUF and FLAT LDS DMA instructions. NFC.
Add these bits to the MUBUF and FLAT LDS DMA instructions:
- LGKM_CNT - these operate on LDS;
- VALU - SPG 3.9.8: This instruction acts as both a MUBUF and
VALU instruction;
Codegen currently does not produce any of this, so the change is NFC.
Differential Revision: https://reviews.llvm.org/D124472
Vasileios Porpodas [Tue, 26 Apr 2022 18:32:24 +0000 (11:32 -0700)]
Recommit "[SLP][TTI] Refactoring of `getShuffleCost` `Args` to work like `getArithmeticInstrCost`"
This reverts commit
6a9bbd9f20dcd700e28738788bb63a160c6c088c.
Code review: https://reviews.llvm.org/D124202
Paul Robinson [Tue, 26 Apr 2022 20:36:22 +0000 (13:36 -0700)]
[PS5] Add debug option testing for the PS5 target
The functionality was added in 7726ad0, catching up on the tests now.
This test mostly runs clang and checks one thing each time, which isn't
very efficient. I added some -DAG suffixes and combined some checks so
adding PS5 checking didn't actually increase the number of clang runs.
Jeffrey Tan [Tue, 26 Apr 2022 19:13:49 +0000 (12:13 -0700)]
Disable symbol on-demand feature for Windows
Symbol on-demand feature is never tested on Windows so it is not a surprise
that we are getting Buildbot failure from Windows:
https://lab.llvm.org/buildbot/#/builders/83/builds/18228
This patch disables symbol on-demand feature on Windows. I will find a Windows
machine to test and re-enable symbol on-demand feature as follow-up.
Differential Revision: https://reviews.llvm.org/D124471
Kirill Stoimenov [Tue, 26 Apr 2022 20:24:06 +0000 (20:24 +0000)]
Revert "[demangler] Simplify OutputBuffer initialization"
Reverting due to a bot failure:
https://lab.llvm.org/buildbot/#/builders/5/builds/22738
This reverts commit
5b3ca24a35e91bf9c19af856e7f92c69b17f989e.
Martin Sebor [Tue, 26 Apr 2022 19:15:03 +0000 (13:15 -0600)]
[InstCombine] Fold memrchr calls with a constant character.
Reviewed By: nikic
Differential Revision: //reviews.llvm.org/D123629
Martin Sebor [Tue, 26 Apr 2022 17:52:15 +0000 (11:52 -0600)]
[InstCombine] Fold memrchr calls with constant size, bail on excessive.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D123626
Differential Revision: https://reviews.llvm.org/D123628
Martin Sebor [Tue, 26 Apr 2022 17:48:43 +0000 (11:48 -0600)]
[InstCombine] Fold strnlen with a bound of zero and one.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D123816