Commit Graph

433296 Commits

Author SHA1 Message Date
Jakub Kuderski 53d4ff4a47 [mlir] Simplify is_splat use in MatchAllPred. NFC.
This is a simple cleanup after https://reviews.llvm.org/D131289.

Reviewed By: antiagainst, Mogball

Differential Revision: https://reviews.llvm.org/D131895
2022-08-15 13:18:11 -04:00
Slava Gurevich fa5124327a [LLDB][NFC] Reliability Fixes for FormatEntity
- Remove dead code
 - Fix incorrect null-reference check

Differential Revision: https://reviews.llvm.org/D131850
2022-08-15 10:16:47 -07:00
Kevin Sala Penads 1081bb08cc [OpenMP][libomptarget] Fix run region async condition
This patch fixes a condition in the openmp/libomptarget/src/device.cpp file. The code was checking if the run_region plugin API function was implemented, but it should actually check the run_region_async function instead.

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D131782
2022-08-15 13:08:45 -04:00
Sunho Kim 0c69f9f32c [ORC][COFF] Introduce DLLImportDefinitionGenerator.
This class will be used to properly solve the `__imp_` symbol and jump-thunk generation issues. It is assumed to be the last definition generator to be called, and as it's the last generator the only symbols remaining in the lookup set are the symbols that are supposed to be queried outside this jitdylib. Instead of just letting them through, we issue another lookup invocation and fetch the allocated addresses, and then create jitlink graph containing `__imp_` GOT symbols and jump-thunks targetting the fetched addresses.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D131833
2022-08-16 02:06:57 +09:00
Sanjay Patel e5748c6e73 [InstCombine] reduce sub-with-overflow ==/!= 0
The basic patterns look like this:
https://alive2.llvm.org/ce/z/MDj9EC

The tests have a use of the overflow value too.
Otherwise, existing folds should reduce already.

This was noted as a missing IR fold in:
926e7312b2

Hopefully, this makes it easier to implement a backend
fix because we should get the same IR regardless of
whether the source used builtins or inline code.
2022-08-15 13:03:51 -04:00
Sanjay Patel b4f61c5ecd [InstCombine] add tests for compare of sub-with-overflow; NFC 2022-08-15 13:03:51 -04:00
Simon Pilgrim e471fdad7c [InstCombine] known-phi-br.ll - add multiuse of compare results to avoid predicate inverse and add negative tests
Feedback from D131838
2022-08-15 17:57:34 +01:00
Jonas Devlieghere 350755d94d
[llvm] Include utils/unittest before projects and runtimes
Include utils/unittest before projects and runtimes so that downstream
projects can check for the existence of the llvm_gtest target. This is
motivated by 9c6c4d675b which fixes the stand-alone build
configuration where LLVM_MAIN_SRC_DIR does not exist.

Differential revision: https://reviews.llvm.org/D124314
2022-08-15 09:54:35 -07:00
Thomas Raoux 91594b5b98 [mlir][nvpu] Prevent F32ToTF32 pattern to generate illegal IR
We shouldn't apply this pattern to non F32->F32 mma.sync operations.

Differential Revision: https://reviews.llvm.org/D131902
2022-08-15 16:46:18 +00:00
Michael Buch ac1bedd584 [lldb][debugserver] Revert "Use llvm::all_of (NFC)" for debugserver
Commit [6d9cd9199a](https://reviews.llvm.org/rG6d9cd9199a6fdeab0412117bcefc28f625510b61) added a dependency on llvm to debugserver.
This breaks the build. Since we don't want to add a dependency on llvm, this
patch reverts the offending commit.

Differential Revision: https://reviews.llvm.org/D131901
2022-08-15 17:35:39 +01:00
Valentin Clement 26d3655a15
[flang][docs] Add lowering design doc for polymorphic entities
This document aims to give insights at the representation of polymorphic
entities in FIR and how polymorphic related constructs and features are lowered
to FIR.

Reviewed By: klausler, razvanlupusoru

Differential Revision: https://reviews.llvm.org/D131515
2022-08-15 18:13:15 +02:00
Slava Zakharin 56eda98f0c [flang] Handle mixed types in DOT_PRODUCT simplification.
Fortran runtime supports mixed types by casting the loaded values
to the result type, so DOT_PRODUCT simplification has to do the same.

Differential Revision: https://reviews.llvm.org/D131726
2022-08-15 09:03:38 -07:00
Mahesh Ravishankar f365e85c83 [mlir] Revisit `LinalgLoopDistributionOptions`.
This patch cleans up the way `LinalgLoopDistributionOptions` are meant
to be used. The option just contains a call back that takes the list
of loop ranges that represent the loops that are to be distributed.
These loops are the outer parallel loops of the tiled operation which
have non-zero tile sizes specified. The call back returns for each of
the loops,
- The procId to use,
- The number of processors,
- The distribution method to use for that loop.

Reviewed By: antiagainst, hanchung

Differential Revision: https://reviews.llvm.org/D131232
2022-08-15 15:56:17 +00:00
Steven Wu cae76582b0 [CMake] Update FindGPRC to use add_llvm_library
add_clang_library is not available in components other than clang and
clang-tool-extras. Trying to use this module elsewhere will cause cmake
error. `add_clang_library` doesn't seem necessary for clangd's GRPC.
Change it to a more generic `add_llvm_library` so it is easier to build
other downstream projects with GRPC that doesn't depend on clang.

Reviewed By: akyrtzi

Differential Revision: https://reviews.llvm.org/D131593
2022-08-15 08:54:15 -07:00
Matheus Izvekov b8a1b698af
[clang] fix missing initialization of original number of expansions
When expanding undeclared function parameters, we should initialize
the original number of expansions, if known, before trying to expand
them, otherwise a length mismatch with an outer pack might not be
diagnosed.

Fixes PR56094.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Differential Revision: https://reviews.llvm.org/D131802
2022-08-15 17:39:38 +02:00
Michele Scuttari b8ecf32f81
DynamicMemRefType: iteration and access by indices
The methods to perform such operations have been implemented for the DynamicMemRefType in a way that is similar to the implementation for StridedMemRefType. Up until here one could pass an unranked memref to the library, and thus obtain a “dynamic” memref descriptor, but then there would have been no possibility to operate on its content.

Differential Revision: https://reviews.llvm.org/D131359
2022-08-15 17:37:39 +02:00
Craig Topper 7a73ab5818 [RISCV] Enable isTruncateFree in SDAG for i64->i32 on rv64.
We have a good selection of W instructions, so promoting a truncated
value back to i64 is often free.

This appears to be a net code size reduction on SPECINT2006.

This has been split from D130397 as one of the patches needed to
complete that.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D131819
2022-08-15 08:32:51 -07:00
Craig Topper ef8c34e954 [InstSimplify] sle on i1 also encodes implication
We already support SGE, so the same logic should hold for SLE with
the LHS and RHS swapped.

I didn't see this in the wild. Just happened to walk past this code
and thought it was odd that it was asymmetric in what condition
codes it handled.

Reviewed By: spatel, reames

Differential Revision: https://reviews.llvm.org/D131805
2022-08-15 08:27:23 -07:00
Michał Górny d230055234 [llvm] [cmake] Move LLVM_INSTALL_PACKAGE_DIR top-level to fix llvm-config
Move the `LLVM_INSTALL_PACKAGE_DIR` declaration from llvm/cmake/modules
directory to the top-level llvm/CMakeLists.txt, in order to fix
the regression in `llvm-config --cmakedir` output for installed LLVM.
Since the tools directory is processed by CMake prior to
llvm/cmake/modules, the llvm-config executable ended up using
the variable prior to it being defined and incorrectly used an empty
path, resulting in e.g.:

    $ llvm-config --cmakedir
    /usr/lib/llvm/16/

With this patch, the path is defined (and therefore the default value
is being set) prior to adding the tools subdirectory and llvm-config
starts working correctly:

    $ llvm-config --cmakedir
    /usr/lib/llvm/16/lib64/cmake/llvm

This fixes a regression introduced by D130539.  Thanks to Petr Polezhaev
for reporting the problem @ https://bugs.gentoo.org/865165

Differential Revision: https://reviews.llvm.org/D131878
2022-08-15 17:21:24 +02:00
Simon Pilgrim a7b85e4c0c [X86] Freeze shl(x,1) -> add(x,x) vector fold (PR50468)
Vector fold shl(x,1) -> add(freeze(x),freeze(x)) to avoid the undef issues identified in PR50468

Differential Revision: https://reviews.llvm.org/D106675
2022-08-15 16:17:21 +01:00
Igor Zhukov f7f5308b82 [libc++][test] Fix conversion signed/unsigned in test/support/MoveOnly.h
Reviewed By: jloser, philnik

Differential Revision: https://reviews.llvm.org/D131889
2022-08-15 22:09:54 +07:00
Nico Weber 940e178c00 [llvm-objdump] Start on -chained_fixups for llvm-otool
And --chained-fixups for llvm-objdump.

For now, this only prints the dyld_chained_fixups_header and adds
plumbing for the flag. This will be expanded in future commits.

When Apple's effort to upstream their chained fixups code continues,
we'll replace this code with the then-upstreamed code. But we need
something in the meantime for testing ld64.lld's chained fixups
code.

Update chained-fixups.yaml with a file that actually contains
the chained fixup data (`LinkEditData` doesn't encode it yet,
so use `__LINKEDIT` via `--raw-segment=data`).

Differential Revision: https://reviews.llvm.org/D131890
2022-08-15 10:58:52 -04:00
Valentin Clement e114ecc5fe
[flang][openacc][NFC] Add test with allocatable and pointer arrays
This patch adds tests for the handling of array sections for
arrays with the ALLOCATABLE or POINTER attribute.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D131885
2022-08-15 16:45:08 +02:00
Simon Pilgrim 41bdb8cd36 [X86] Fold insert_vector_elt(undef, elt, 0) --> scalar_to_vector(elt)
I had hoped to make this a generic fold in DAGCombine, but there's quite a few regressions in Thumb2 MVE that need addressing first.

Fixes regressions from D106675.
2022-08-15 14:56:30 +01:00
wangyihan 91d784a021 [NFC][SmallVector] Use std::conditional_t instead of std::conditional
Signed-off-by: wangyihan <yihan.wang@intel.com>
2022-08-15 21:51:13 +08:00
David Green dfc95bab07 [DAG] Ensure more Legal BUILD_VECTOR elements types in shuffle->And combine
This is a followup to D131350, which caused another problem for i64
types being split into i32 on i32 targets. This patch tries to make sure
that either Illegal types are OK, or that the element types of a
buildvector are legal and bigger than or equal to the size of the
original elements.

Differential Revision: https://reviews.llvm.org/D131883
2022-08-15 14:41:45 +01:00
Matthias Springer 4911100dc6 [mlir][linalg][python] Add named constructor for MatchOp
This constructor makes it easier to match for ops by their name.

Differential Revision: https://reviews.llvm.org/D131882
2022-08-15 14:41:28 +02:00
Aaron Ballman a31e2859a8 Silence MSVC codecvt deprecation warnings
This silences warnings about use of deprecated codecvt functionality
after the switch to build with C++17.
2022-08-15 08:38:07 -04:00
Luo, Yuanke 853bb192c4 Revert "(Reland) [fastalloc] Support allocating specific register class in fastalloc"
This reverts commit 30f9e6ebd3.
2022-08-15 20:33:15 +08:00
Ayke van Laethem a560e57a7e
[AVR] Only push and clear R1 in interrupts when necessary
R1 is a reserved register, but LLVM gives the APIs to know when it is
used or not. So this patch uses these APIs to only save/clear/restore R1
in interrupts when necessary.

The main issue here was getting inline assembly to work. One could argue
that this is the job of Clang, but for consistency I've made sure that
R1 is always usable in inline assembly even if that means clearing it
when it might not be needed.

Information on inline assembly in AVR can be found here:

https://www.nongnu.org/avr-libc/user-manual/inline_asm.html#asm_code

Essentially, this seems to suggest that r1 can be freely used in avr-gcc
inline assembly, even without specifying it as an input operand.

Differential Revision: https://reviews.llvm.org/D117426
2022-08-15 14:29:38 +02:00
Ayke van Laethem 43a8dbc5be
[AVR] Use @earlyclobber instead of register scavenging
The code to support the case when the register allocator has assigned
the same register to the src and the dst register operand isn't actually
needed:

  * LDWRdPtr and LDDWRdPtrQ have an @earlyclobber on the output
    register, so the register allocator will make sure to allocate a
    different register for the output register.
  * LDDWRdYQ does not have an @earlyclobber, but the pointer register is
    the fixed Y register which is reserved. The register allocator won't
    use reserved registers for the output value.

This removes a special case in the code that makes the pseudo
instruction expansion pass more complicated than it needs to be.

Differential Revision: https://reviews.llvm.org/D131844
2022-08-15 14:29:38 +02:00
Ayke van Laethem de48717fcf
[AVR] Support unaligned store
This patch really just extends D39946 towards stores as well as loads.
While the patch is in SelectionDAGBuilder, it only applies to AVR (the
only target that supports unaligned atomic operations).

Differential Revision: https://reviews.llvm.org/D128483
2022-08-15 14:29:37 +02:00
Dmitry Vassiliev 5371ab4456 [IR] Change access rights of PredIterator members
These members were made private here 6177386b05 without an explanation.
Our customers have an own implementation inherited from PredIterator with updated advancePastNonTerminators().
The access specifier protected looks resonable and safe here.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D131608
2022-08-15 14:25:58 +02:00
Max Kazantsev 354fa0b480 Revert "[SCEV] Use context to strengthen flags of BinOps"
This reverts commit 34ae308c73.

Our internal testing found a miscompile. Not sure if it's caused by
this patch or it revealed something else. Reverting while investigating.
2022-08-15 18:51:59 +07:00
Simon Pilgrim 3a73133217 [DAG] canCreateUndefOrPoison - add freeze(sign_extend_inreg(x,vt)) -> sign_extend_inreg(freeze(x),vt) support
Guaranteed not to create undef/poison
2022-08-15 12:18:59 +01:00
Peter Waller 6e85db7293 [DAGCombine] Combine signext_inreg of extract-extend
The outer signext_inreg is redundant in the following:

  Fold (signext_inreg (extract_subvector (zext|anyext|sext iN_value to _) _) from iN)
       -> (extract_subvector (signext iN_value to iM))

Tests are precommitted and clone those by analogy from the AND case in
the same file. Add a negative test to check extension width is handled
correctly.

This patch supersedes D130700.

Differential Revision: https://reviews.llvm.org/D131503
2022-08-15 10:58:07 +00:00
Simon Pilgrim 7e294e676e [DAG] canCreateUndefOrPoison - add freeze(assertsext/zext(x,bt)) -> assertsext/zext(freeze(x),vt) support
These are guaranteed not to create undef/poison (although they may pass through) - the associated ISD::VALUETYPE node is also guaranteed never to generate poison
2022-08-15 11:13:43 +01:00
Matthias Springer a36348c586 [mlir][bufferize] Fix bug in AllocTensorElimination
AllocTensorElimination does currently not support chains where the type is
changing. AllocTensorElimination used to generate invalid IR for such
inputs. With this commit, AllocTensorElimination does no longer apply to
such inputs. (It can be extended to support such IR if needed.)

Differential Revision: https://reviews.llvm.org/D131880
2022-08-15 11:45:58 +02:00
Benjamin Kramer 982779230f
Make demangler independent of LLVM again
The demangler is not supposed to include bits of LLVM, so it can't use STLExtras.

This undoes part of 6d9cd9199a
2022-08-15 11:44:28 +02:00
David Spickett 9f947abf94 [LLDB] Remove __future__ imports from examples
Not needed now that we require python 3.

Reviewed By: kastiglione, JDevlieghere

Differential Revision: https://reviews.llvm.org/D131772
2022-08-15 09:04:25 +00:00
David Spickett 193259cbce [LLDB] Remove __future__ imports from tests
Not needed now that we require python 3.

Reviewed By: kastiglione, JDevlieghere

Differential Revision: https://reviews.llvm.org/D131761
2022-08-15 08:54:06 +00:00
Zain Jaffal df4878d28d
[AArch64] Tests for non-temporal loads.
Add some test cases for D131773 where LDNP could be used as well as
negative tests.

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D131767
2022-08-15 09:16:02 +01:00
Walter Erquinigo 4025a8ae93 [NFC][trace][intel pt] add simple documentation line 2022-08-15 00:56:12 -07:00
Diana Picus 467abac204 [flang] Install runtime libs with the toolchain
Make sure that FortranDecimal, FortranRuntime and Fortran_main are
installed/packaged even when LLVM_INSTALL_TOOLCHAIN_ONLY is enabled.
They are used by flang to link executables, so they should be provided
even with minimal installs.

Differential Revision: https://reviews.llvm.org/D131670
2022-08-15 07:43:47 +00:00
Zijia Zhu 8719faafdb [ADT] Make SmallSet::insert(const T &) return const_iterator
This patch makes `SmallSet::insert(const T &)` return
`std::pair<const_iterator, bool>` instead of
`std::pair<NoneType, bool>`. This will exactly match std::set's behavior
and make deduplicating items with SmallSet easier.

Reviewed By: dblaikie, lattner

Differential Revision: https://reviews.llvm.org/D131549
2022-08-15 13:53:34 +08:00
Fangrui Song d797c2ffdb [DebugInfo] -fdebug-prefix-map: handle '#line "file"' for asm source
`getContext().setMCLineTableRootFile` (from D62074) sets `RootFile.Name` to
`FirstCppHashFilename`. `RootFile.Name` is not processed by -fdebug-prefix-map
and will go to DW_TAG_compile_unit's DT_AT_name and DW_TAG_label's
DW_AT_decl_file. Remap `RootFile.Name`.

Fix another issue reported by https://github.com/llvm/llvm-project/issues/56609

Reviewed By: #debug-info, dblaikie, raj.khem

Differential Revision: https://reviews.llvm.org/D131848
2022-08-14 20:58:23 -07:00
Kazu Hirata eeac9e9232 [ADT] Deprecate Optional::map
This patch deprecates Optional::map in favor of Optional::transform
for consistency with std::optional::transform in C++23.

Note that I've migrated all known users of Optional::map.

Differential Revision: https://reviews.llvm.org/D131842
2022-08-14 17:51:59 -07:00
Craig Topper b8c5420d74 [X86][RISCV] Pre-commit tests for D130862. NFC
Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D131442
2022-08-14 16:31:15 -07:00
Kazu Hirata f5a68feab3 Use llvm::none_of (NFC) 2022-08-14 16:25:39 -07:00
Kazu Hirata 55f0a87ea4 [clangd] Use llvm::any_of (NFC) 2022-08-14 16:25:38 -07:00