Joseph Huber [Wed, 1 Feb 2023 19:48:27 +0000 (13:48 -0600)]
[LinkerWrapper] Adjust placement of input files for the linker
Summary:
The placement of input files can change the result of the linker. We
should put the input files earlier to avoid this.
Petr Hosek [Wed, 1 Feb 2023 09:45:35 +0000 (09:45 +0000)]
[Driver][Fuchsia] Support --emit-static-lib in Fuchsia driver
This allows building static libraries with Clang driver.
Differential Revision: https://reviews.llvm.org/D143092
Peter Klausler [Thu, 29 Dec 2022 18:07:10 +0000 (10:07 -0800)]
[flang] Catch statement function typing error
Emit an error message when the right-hand side expression of a statement function
definition cannot be converted to the type of the statement function.
Differential Revision: https://reviews.llvm.org/D142745
Craig Topper [Wed, 1 Feb 2023 18:55:35 +0000 (10:55 -0800)]
[RISCV] Move the even register check for rv32zdinx later in the matching process.
And remove the IsRV64 checks for isGPRAsFPR and isGPRPF64AsFPR.
Overall I think this results in a better diagnostic experience. We
now do a better job of matching Zdinx instructions even if the registers
aren't correct and report an error for missing features like RV64.
Unfortunately, this makes it difficult to recover the error location
for the invalid odd register when we do report it. But to make up
for it, I gave a more specific error message.
It doesn't look like binutils gives any warning or error for odd registers.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D142997
Nikolas Klauser [Fri, 20 Jan 2023 08:26:37 +0000 (09:26 +0100)]
[libc++] Forward ranges::sort to instantiations in the dylib
This patch removes `_WrapAlgPolicy` and related functionality. Instead, we explicitly forward to `__sort` now if we have an instantiation inside the dylib. If we don't we just call `__introsort`.
Reviewed By: ldionne, #libc
Spies: sstefan1, libcxx-commits
Differential Revision: https://reviews.llvm.org/D140824
usama hameed [Wed, 1 Feb 2023 19:06:19 +0000 (11:06 -0800)]
[Sanitizers] fix -fno-sanitize-link-runtime for darwin
rdar://
99200922
Differential Revision: https://reviews.llvm.org/D142421
Nikolas Klauser [Fri, 20 Jan 2023 07:13:32 +0000 (08:13 +0100)]
[libc++] Split ranges.transform.binary.pass.cpp up
`ranges.transform.binary.pass.cpp` took ~25s to compile. `ranges.transform.binary.range.pass.cpp` and `ranges.transform.binary.iterator.pass.cpp` take ~13s each.
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D142183
Nikolas Klauser [Fri, 20 Jan 2023 08:18:07 +0000 (09:18 +0100)]
[libc++] Remove explicit instantiations of __insertion_sort_incomplete and __sort5 from the dylib
These instantiations were never visible, because they are only used in `__sort`, which is also explicitly instantiated in the dylib.
Reviewed By: ldionne, #libc
Spies: #libc_vendors, emaste, nemanjai, libcxx-commits
Differential Revision: https://reviews.llvm.org/D142185
Tue Ly [Wed, 1 Feb 2023 18:37:55 +0000 (13:37 -0500)]
[libc][Obvious] Add a default clause to RoundingModeUtils.h to suppress gcc
warning.
Mitch Phillips [Wed, 1 Feb 2023 18:35:56 +0000 (10:35 -0800)]
Revert "Fix tsan problem where the per-thread shared_ptr() can be locked right before the cache is destroyed causing a race where it tries to remove an entry from a destroyed cache."
This reverts commit
bcc10817d5569172ee065015747e226280e9b698.
Reason: Broke the aarch64-asan bot. More information available in the
Phabricator review: https://reviews.llvm.org/D140931
Steven Wu [Wed, 1 Feb 2023 18:34:05 +0000 (10:34 -0800)]
[Module] Respect `-fno-pch-timestamps` when building modules
Always respect the FrontendOption to not include timestamps in PCH or
Modules when `-fno-pch-timestamps` is specified.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D141632
Stella Stamenova [Wed, 1 Feb 2023 18:25:20 +0000 (10:25 -0800)]
[mlir] Pin for the PyPi requirements for mlir
This change is pinning the requirements to a specific version (or a range) depending on the requirement. A couple of considerations:
* numpy 1.24 deprecates np.object, np.bool, np.float, np.complex, np.str, and np.int which are used heavily in onnx-mlir
* not all versions of each package are available on every platform - to the best of my knowledge, these ranges should work on Ubuntu, CentOS and Windows
Adding a minimum and maximum version, or pinning to a specific versions where possible, helps with two major goals - security and maintainability. It gives us an opportunity to make sure that the packages being used are not part of a security attack as well as guaranteeing that they support the features that mlir depends on (see note about numpy deprecation).
Let me know if you are aware of better versions or ranges to pin to.
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D142563
Mircea Trofin [Wed, 1 Feb 2023 18:23:28 +0000 (10:23 -0800)]
[mlgo] Allow logging the spec for the "advice", if needed
This is for the interactive model runner, so it can confirm the tensor
spec of the advice with its host.
Jorge Gorbe Moya [Wed, 1 Feb 2023 18:12:41 +0000 (10:12 -0800)]
[Hexagon] Use %t for output file in test introduced in
97d51e3fa8e8 (NFCI).
Felipe de Azevedo Piovezan [Fri, 6 Jan 2023 18:52:22 +0000 (15:52 -0300)]
Reland "[codegen] Store address of indirect arguments on the stack"
The commit was reverted due to a regression in debug information of an
optimized code test in lldb. This has since been addressed by:
1. rGf753e5be8239: [LiveDebugValues] Allow EntryValue with OP_deref
expressions
2. rG055f2f04e658: [mem2reg][debuginfo] Handle op_deref when converting
dbg.declare
Differential Revision: https://reviews.llvm.org/D141381
Petr Hosek [Wed, 1 Feb 2023 17:29:54 +0000 (17:29 +0000)]
[CMake] Save and restore CMAKE_EXE_LINKER_FLAGS manually
cmake_push_check_state and cmake_pop_check_state doesn't save and
restore CMAKE_EXE_LINKER_FLAGS so we need to do it manually.
Differential Revision: https://reviews.llvm.org/D143088
Joseph Huber [Wed, 1 Feb 2023 18:01:44 +0000 (12:01 -0600)]
[LinkerWrapper] Fix passing `-rpath` directly to clang
Summary:
This code passed the value of `-rpath` directly to the clang invocation.
If we're using the linker then it'll be fine. However, if the linker is
`gcc` as is the case when doing `-fopenmp-targets=x86_64` then this will
cause problems. This patch adds the `-Wl,-rpath,` to feed it to the
linker correctly.
Nikolas Klauser [Tue, 10 Jan 2023 00:56:53 +0000 (01:56 +0100)]
[libc++] Add a clang-tidy check to make sure we use _Uglyfied attribute names
Reviewed By: ldionne, #libc
Spies: krytarowski, jdoerfert, libcxx-commits
Differential Revision: https://reviews.llvm.org/D142322
Ramon de C Valle [Wed, 1 Feb 2023 16:42:28 +0000 (16:42 +0000)]
Add CFI integer types normalization
This commit adds a new option (i.e.,
`-fsanitize-cfi-icall-normalize-integers`) for normalizing integer types
as vendor extended types for cross-language LLVM CFI/KCFI support with
other languages that can't represent and encode C/C++ integer types.
Specifically, integer types are encoded as their defined representations
(e.g., 8-bit signed integer, 16-bit signed integer, 32-bit signed
integer, ...) for compatibility with languages that define
explicitly-sized integer types (e.g., i8, i16, i32, ..., in Rust).
``-fsanitize-cfi-icall-normalize-integers`` is compatible with
``-fsanitize-cfi-icall-generalize-pointers``.
This helps with providing cross-language CFI support with the Rust
compiler and is an alternative solution for the issue described and
alternatives proposed in the RFC
https://github.com/rust-lang/rfcs/pull/3296.
For more information about LLVM CFI/KCFI and cross-language LLVM
CFI/KCFI support for the Rust compiler, see the design document in the
tracking issue https://github.com/rust-lang/rust/issues/89653.
Reviewed By: pcc, samitolvanen
Differential Revision: https://reviews.llvm.org/D139395
Chris Cotter [Wed, 1 Feb 2023 17:38:30 +0000 (17:38 +0000)]
[llvm][NFC] Use move instead of copy
Summary: For functions that accept an rvalue reference type
parameter, use move to avoid copying the parameter.
These were found when implementing CppCoreGuideline F.18 in
clang-tidy.
Committed on behalf of ccotter (Chris Cotter)
Reviewers: Michael137 thieta
Differential Revision: https://reviews.llvm.org/D142825
Ayush Sahay [Wed, 1 Feb 2023 14:40:22 +0000 (20:10 +0530)]
[lldb] Enable TestFrameFormatNameWithArgs in case of cross compilation
TestFrameFormatNameWithArgs.test is enabled only in case of native
compilation but is applicable in case of cross compilation too. So,
provision support for enabling it in case of both, native and cross
compilation.
Reviewed By: Michael137
Differential Revision: https://reviews.llvm.org/D140839
LLVM GN Syncbot [Wed, 1 Feb 2023 17:25:52 +0000 (17:25 +0000)]
[gn build] Port
516e30175256
Steven Wu [Wed, 1 Feb 2023 17:24:44 +0000 (09:24 -0800)]
[NFC][Profile] Access profile through VirtualFileSystem
Make the access to profile data going through virtual file system so the
inputs can be remapped. In the context of the caching, it can make sure
we capture the inputs and provided an immutable input as profile data.
Reviewed By: akyrtzi, benlangmuir
Differential Revision: https://reviews.llvm.org/D139052
Florian Hahn [Wed, 1 Feb 2023 16:51:17 +0000 (16:51 +0000)]
[SCEV] Use fact that B >u 0 for A <u B in applyLoopGuards.
If LHS <u RHS holds, RHS should be guaranteed to be > 0. By using
using 'umax(RHS, 1) -1' instead of 'RHS - 1' the results in
applyLoopGuards can be improved in some cases.
Note that the TODO for the tests mentioned the max BTC being 11, but
unless I am missing something 10 should be correct.
https://alive2.llvm.org/ce/z/44nP7F
Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D126503
Joe Nash [Tue, 31 Jan 2023 17:08:00 +0000 (12:08 -0500)]
[AMDGPU][NFC] More precise predicates on GFX9 f16 insts
Removes redundant Has16BitInsts and allows for future use
of OtherPredicates on V_DIV_FIXUP_F16_gfx9 and V_FMA_F16_gfx9
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D142990
Tue Ly [Sat, 28 Jan 2023 04:06:11 +0000 (23:06 -0500)]
[libc][math] Implement acoshf function correctly rounded to all rounding modes.
Implement acoshf function correctly rounded to all rounding modes.
Reviewed By: zimmermann6
Differential Revision: https://reviews.llvm.org/D142781
Ingo Müller [Wed, 1 Feb 2023 14:29:02 +0000 (14:29 +0000)]
[mlir][scf] Fix typo in description of option of TestSCFForUtilsPass (NFC).
Reviewed By: ingomueller-net
Differential Revision: https://reviews.llvm.org/D143067
Yitzhak Mandelbaum [Thu, 26 Jan 2023 14:31:03 +0000 (14:31 +0000)]
[clang][dataflow] Relax validity assumptions in `UncheckedOptionalAccessModel`.
Currently, the interpretation of `swap` calls in the optional model assumes the
optional arguments are modeled (and therefore have valid storage locations and
values). This assumption is incorrect, for example, in the case of unmodeled
optional fields (which can be missing either value or location). This patch
relaxes these assumptions, to return rather than assert when either argument is
not modeled.
Differential Revision: https://reviews.llvm.org/D142710
Petar Avramovic [Wed, 1 Feb 2023 15:40:04 +0000 (16:40 +0100)]
AMDGPU/MC: Refactor decoders. Rework decoders for float immediates
decodeFPImmed creates immediate operand using register operand width,
but size of created immediate should correspond to OperandType for
RegisterOperand.
e.g. OPW128 could be used for RegisterOperands that use v2f64 v4f32
and v8f16. Each RegisterOperands would have different OperandType and
require that immediate is decoded using 64, 32 and 16 bit immediate
respectively.
decodeOperand_<RegClass> only provides width for register decoding,
introduce decodeOperand_<RegClass>_Imm<ImmWidth> that also provides
width for immediate decoding.
Refactor RegisterOperands:
- decoders get _Imm<ImmWidth> suffix in some cases
- removed unused RegisterOperands defined via multiclass
- use different RegisterOperand in a few places, new RegisterOperand's
decoder corresponds to the number of bits used for operand's encoding
Refactor decoder functions:
- add asserts for the size of encoding that will be decoded
- regroup them according to the method of decoding
decodeOperand_<RegClass> (register only, no immediate) decoders can now
create immediate of consistent size, use it for better diagnostic of
'invalid immediate'.
Differential Revision: https://reviews.llvm.org/D142636
Chris Cotter [Wed, 1 Feb 2023 15:50:23 +0000 (15:50 +0000)]
[lldb][NFC] Use move instead of copy
Summary: For functions that accept an rvalue reference type
parameter, use move to avoid copying the parameter.
These were found when implementing CppCoreGuideline F.18 in
clang-tidy.
Committed on behalf of ccotter (Chris Cotter)
Reviewers: Michael137
Differential Revision: https://reviews.llvm.org/D142824
Paul Robinson [Tue, 31 Jan 2023 23:22:25 +0000 (15:22 -0800)]
[Driver] Move PS4/PS5 header search path management to the driver
This follows how OpenBSD, FreeBSD, and NetBSD now work. (See
D138183 and D140817 for those cases.)
It also tidies up some code duplication that wasn't exactly right.
Alexey Karyakin [Wed, 1 Feb 2023 15:18:31 +0000 (07:18 -0800)]
[Hexagon] Disallow using the same register for Vy/Vx in vdeal/vshuff
Non-assignment forms of vshuff and vdeal use the first two registers
(Vy, Vx) as both inputs and outputs. It is not valid to use the same
register for both Vy and Vx. The double-write error was not detected
previously because of a special case, which is not actually necessary.
Differential Revision: https://reviews.llvm.org/D142251
Mikhail Goncharov [Wed, 1 Feb 2023 15:09:35 +0000 (16:09 +0100)]
Revert "Improve and enable folding of conditional branches with tail calls."
This reverts commit
c05ddc9cbc12b1f2038380f57a16c4ca98c614b7.
Fails under asan:
https://lab.llvm.org/buildbot/#/builders/168/builds/11637
Failed Tests (3):
LLVM :: CodeGen/X86/jump_sign.ll
LLVM :: CodeGen/X86/or-branch.ll
LLVM :: CodeGen/X86/tailcall-extract.ll
Nikolas Klauser [Wed, 1 Feb 2023 15:05:18 +0000 (16:05 +0100)]
Revert "[libc++] Fix ODR violation with __exception_guard in mixed exceptions builds"
This reverts commit
561105fb9d3a16f7fb8c718cc5da71b11f17a144.
This breaks C++03 with -fno-exceptions.
Valentin Clement [Wed, 1 Feb 2023 14:53:52 +0000 (15:53 +0100)]
[flang] Make EndProgramStmt a NOP + early return
Fix done in D143055 can be simpler by making EndProgramStmt a NOP
and dealing with the exit in `endNewFunction` in a centralize way.
Also add finalization when there is an early exit in the main
program.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D143065
Nikita Popov [Wed, 1 Feb 2023 13:34:38 +0000 (14:34 +0100)]
[ConstantFold] Fix incorrect inbounds inference for [0 x T] GEPs
Previously all indices into [0 x T] arrays were considered in
range, which resulted in us incorrectly inferring inbounds for
all GEPs of that form. We should not consider them in range here,
and instead bail out of the rewriting logic (which would divide
by zero).
Do continue to consider 0 always in range, to avoid changing
behavior for zero-index GEPs.
Joseph Huber [Tue, 31 Jan 2023 15:50:40 +0000 (09:50 -0600)]
[LinkerWrapper] Fix memory issues due to unguarded accesses to global state
There were intemittent errors in the linker wrapper when using the
sanitizers in parallel. First, this is because the `TempFiles` global
was not guarded when creating a new file. Second, even though the `Args`
list is passed as const, the internal state is mutable when adding a
string. So that needs to be guarded too.
Fixes https://github.com/llvm/llvm-project/issues/60437
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D142985
Nikita Popov [Wed, 1 Feb 2023 14:02:34 +0000 (15:02 +0100)]
[InstCombine] Add test for incorrect inbounds on [0 x i8] global (NFC)
Alexander Kornienko [Wed, 1 Feb 2023 12:23:04 +0000 (13:23 +0100)]
[libc++] Fix ODR violation with __exception_guard in mixed exceptions builds
This fix was proposed in https://reviews.llvm.org/D133661#4095018
Shivam Gupta [Wed, 1 Feb 2023 03:14:04 +0000 (08:44 +0530)]
[Clang] Add -Wtype-limits to -Wextra for GCC compatibility
GCC added the -Wtype-limits warning group to -Wextra around
GCC 4.4 and the group has some very helpful extra warnings
like tautological comparison type limit warnings
(comparingan unsigned int to see if it's positive, etc).
Fix https://github.com/llvm/llvm-project/issues/58375
Reviewed By: #clang-vendors, thesamesam
Differential Revision: https://reviews.llvm.org/D142826
Valentin Clement [Wed, 1 Feb 2023 13:45:53 +0000 (14:45 +0100)]
[flang] Make sure derived-type finalization is done before return
Finalization needs to be done before the terminator. In case
of end program, this was done after it and trigger a verifier error.
This patch fixes this case.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D143055
LLVM GN Syncbot [Wed, 1 Feb 2023 13:31:48 +0000 (13:31 +0000)]
[gn build] Port
ca50be8c896b
Florian Hahn [Wed, 1 Feb 2023 13:30:43 +0000 (13:30 +0000)]
[SCEV] Add test for applyLoopGuards with pointer induction.
Add an additional variant of the test added in
67b712024ca1f3c5.
Tim Northover [Wed, 1 Feb 2023 12:17:39 +0000 (12:17 +0000)]
[compiler-rt] initialize variables to silence warning. NFC.
They were being initialized anyway, I believe, but the logic was a bit
convoluted for the Clang warnings to detect so we were getting "variable 'EBX'
may be uninitialized when used here" later on.
Sergey Kachkov [Fri, 27 Jan 2023 08:54:25 +0000 (11:54 +0300)]
[GVN] Add pre-commit tests for address translation through select (D142705)
Differential Revision: https://reviews.llvm.org/D142706
Matthias Springer [Wed, 1 Feb 2023 11:58:39 +0000 (12:58 +0100)]
[mlir][tensor][bufferize] Implement getBufferType for CastOp
This interface method is used to compute the buffer type of a value during bufferization. It was missing. This is interface method is used during loop bufferization.
Also fix a bug where a cast from an unranked tensor to a ranked tensor type did not always apply a fully dynamic layout map on the result memref.
Differential Revision: https://reviews.llvm.org/D143063
Yitzhak Mandelbaum [Tue, 3 Jan 2023 15:41:38 +0000 (15:41 +0000)]
[clang][dataflow] Fix handling of `DeclRefExpr`s to `BindingDecl`s.
The invariants around `ReferenceValues` are subtle (arguably, too much so). That
includes that we need to take care not to double wrap them -- in cases where we
wrap a loc in an `ReferenceValue` we need to be sure that the pointee isn't
already a `ReferenceValue`. `BindingDecl` introduces another situation in which
this can arise. Previously, the code did not properly handle `BindingDecl`,
resulting in double-wrapped values, which broke other invariants (at least, that
struct values have an `AggregateStorageLocation`).
This patch adjusts the interpretation of `DeclRefExpr` to take `BindingDecl`'s
peculiarities into account. It also fixes the two tests which should have caught
this issue but were themselves (subtly) buggy.
Differential Revision: https://reviews.llvm.org/D140897
Andrew Savonichev [Wed, 1 Feb 2023 13:16:43 +0000 (16:16 +0300)]
[NVPTX] Implement NVPTX AliasAnalysis
NVPTXAliasAnalysis extends the default AA to take pointer address
spaces into account. The analysis assumes that pointers in different
address spaces do not alias, unless one of them is generic (flat)
address space.
The patch also implements pointsToConstantMemory (via
getModRefInfoMask) to expose semantic of the constant address space to
the optimizer as discussed in D112466.
Differential Revision: https://reviews.llvm.org/D124787
Peixin Qiao [Wed, 1 Feb 2023 13:09:02 +0000 (21:09 +0800)]
[flang] Support allocate array from scalar source in runtime
As Fortran 2018 9.7.1.2(7), the value of each element of allocate object
becomes the value of source when the allocate object is array and the
source is scalar.
Fix #60090.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D142112
Ben Mudd [Mon, 23 Jan 2023 13:59:41 +0000 (13:59 +0000)]
[DebugInfo] Make debug intrinsics to track cloned values in JumpThreading
This patch causes debug value intrinsics outside of cloned blocks in the
Jump Threading pass to correctly point towards any derived values. If it cannot,
it kills them.
Reviewed By: probinson, StephenTozer
Differential Revision: https://reviews.llvm.org/D140404
Jonas Paulsson [Thu, 19 Jan 2023 23:00:32 +0000 (17:00 -0600)]
[SystemZ] Implement isGuaranteedNotToBeUndefOrPoisonForTargetNode().
Returning true from this method for PCREL_WRAPPER and PCREL_OFFSET avoids
problems when a PCREL_OFFSET node ends up with a freeze operand, which is not
handled or expected by the backend.
Fixes #60107
Reviewed By: uweigand, RKSimon
Differential Revision: https://reviews.llvm.org/D142971
Florian Hahn [Wed, 1 Feb 2023 12:02:54 +0000 (12:02 +0000)]
[SCEV] Add test for applyLoopGuards with pointer induction.
Extra test that crashes with earlier versions of D126503.
Kohei Yamaguchi [Wed, 1 Feb 2023 11:27:45 +0000 (16:57 +0530)]
[mlir][NFC] Clean and Fix broken Affine documentation
- Modified single-quote to back-quote at op name, etc.
- Remove a duplicated `affine.store` op's doc
- Fix broken links
- Move Syntax of `StoreOp` and `LoadOp` from Affine.md to AffineOps.td
Reviewed By: bondhugula, dcaballe
Differential Revision: https://reviews.llvm.org/D142858
Benjamin Kramer [Wed, 1 Feb 2023 11:04:19 +0000 (12:04 +0100)]
[InstCombine][NFC] Fold variable into assert
Avoids unused variable warnings when asserts are disabled.
Quentin Colombet [Thu, 19 Jan 2023 09:56:57 +0000 (10:56 +0100)]
[InstCombine] Don't replace unused `atomicrmw xchg` with `atomic store`
Following the discussion from https://reviews.llvm.org/D141277 and in
particular Ralf Jung's comment at
https://reviews.llvm.org/D141277#inline-1365148, replacing an unused `atomicrmw
xchg` into an `atomic store` is illegal even for release ordering.
Quoting Connor Horman from the rust lang discussion linked in that comment:
"An acquire operation A only synchronizes-with a release operation R if it
takes its value from R, or any store in the release sequence headed by R, which
is R, followed by the longest continuous sequence of read-modify-write
operations.
A regular store following R in the modification order would break the release
sequence, and if an acquire operation reads that store or something later, then
it loses any synchronization it might have already had."
This fixes https://github.com/llvm/llvm-project/issues/60418
Differential Revision: https://reviews.llvm.org/D142097
Jean Perier [Wed, 1 Feb 2023 10:43:22 +0000 (11:43 +0100)]
[flang][hlfir] Lower post f77 user calls
In lowering to HLFIR, deal with user calls involving a mix of:
- dummy with VALUE
- Polymorphism
- contiguous dummy
- assumed shape dummy
- OPTIONAL arguments
- NULL() passed to OPTIONAL arguments.
- elemental calls
Does not deal with assumed ranked dummy arguments.
This patch unifies the preparation of all arguments that must be passed
in memory and are not passed as allocatable/pointers.
For optionals, the same argument preparation is done, except the utility
that generates the IR for the argument preparation is called inside a
fir.if.
The addressing of array arguments in elemental calls is delayed so that
it can also happen during this argument preparation, and be placed in
the fir.if when the array may be absent.
Structure helpers are added to convey a prepared dummy argument and the
data that may be needed to do the clean-up after the call (temporary
storage deallocation or copy-out). And a utility is added to wrap
the preparation code inside a fir.if and convey these values through
the fir.if.
Certain aspects of this patch brings the HLFIR lowering support beyond
what the current lowering to FIR supports (e.g. handling of NULL(), handling
of optional in elemental calls, handling of copy-in/copy-out involving
polymorphic entities).
Differential Revision: https://reviews.llvm.org/D142695
Nicolas Vasilache [Mon, 30 Jan 2023 08:37:46 +0000 (00:37 -0800)]
[mlir][Linalg] Add a transform.structured.lower_unpack op
This revision introduces `transform.structured.lower_unpack` which allows
rewriting a `tensor.unpack` to `transpose` (`linalg.generic`) + `tensor.empty` + `tensor.collapse_shape` + `tensor.extract_slice`
The implementation is currently limited to static pack ops that do not have outer_dims permutations.
Differential Revision: https://reviews.llvm.org/D142889
David Sherwood [Wed, 1 Feb 2023 09:43:45 +0000 (09:43 +0000)]
[AArch64][SME2] Add LLVM IR intrinsics for multi-multi dots
Adds intrinsics for the following SME2 instructions:
* sdot (multi-multi, 2 and 4 vectors, 32-bit and 64-bit ZA)
* udot (multi-multi, 2 and 4 vectors, 32-bit and 64-bit ZA)
* usdot (multi-multi, 2 and 4 vectors)
* fdot (multi-multi, 2 and 4 vectors)
* bfdot (multi-multi, 2 and 4 vectors)
NOTE: These intrinsics are still in development and are subject to future changes.
Differential Revision: https://reviews.llvm.org/D142478
Guillaume Chatelet [Wed, 1 Feb 2023 09:34:46 +0000 (09:34 +0000)]
[NFC] Use GlobalObject::setAlignment that takes an Align in BitcodeReader
David Green [Wed, 1 Feb 2023 09:21:07 +0000 (09:21 +0000)]
[AArch64] Handle negative architecture features
Currently negative architecture features passes to clang like -Xclang
-target-feature -Xclang -v9.3a will end up _enabling_ dependant target
features (like FEAT_MOPS). This patch fixes that by ensuring we don't
enable dependant target features when !Enabled.
Fixes #60375
Differential Revision: https://reviews.llvm.org/D142963
Jonas Hahnfeld [Wed, 1 Feb 2023 09:14:56 +0000 (10:14 +0100)]
XFAIL new test available_externally_alias.ll on NVPTX
Guillaume Chatelet [Wed, 1 Feb 2023 09:13:57 +0000 (09:13 +0000)]
[NFC] Use GlobalObject::setAlignment that takes an Align in LLParser
Tobias Gysi [Wed, 1 Feb 2023 09:08:42 +0000 (10:08 +0100)]
[mlir][llvm] Opaque pointer support for atomic and call ops.
This revision adapts the printers and parsers of the LLVM Dialect
AtomicRMWOp, AtomicCmpXchgOp, CallOp, and InvokeOp to support both
opaque and typed pointers by printing the pointer types explicitly.
Previously, the printers and parser of these operations silently assumed
typed pointers. This assumption is problematic if a lowering or the
LLVM IR import produce LLVM Dialect with opaque pointers and the IR is
then printed and parsed, for example, when running mlir-translate. In
LLVM IR itself all tests with typed pointers are already gone. It is
thus important to start switching to opaque pointers.
This revision can be seen as a preparation step for the switch of the
LLVM Dialect to opaque pointers. Once printing and parsing works
seamlessly, all lowerings to LLVM Dialect can be switched to produce
opaque pointers. After a transition period, LLVM Dialect itself can by
simplified to support opaque pointers only.
Reviewed By: ftynse, Dinistro
Differential Revision: https://reviews.llvm.org/D142884
Matthias Springer [Wed, 1 Feb 2023 08:33:22 +0000 (09:33 +0100)]
[mlir][bufferization][NFC] Rename getAliasingOpOperand/getAliasingOpResult
* `getAliasingOpOperand` => `getAliasingOpOperands`
* `getAliasingOpResult` => `getAliasingOpResults`
Also a few minor code cleanups and better documentation.
Differential Revision: https://reviews.llvm.org/D142979
Simon Tatham [Tue, 31 Jan 2023 17:31:33 +0000 (17:31 +0000)]
[ARM] Allow selecting hard-float ABI in integer-only MVE.
Armv8.1-M can be configured to support the integer subset of the MVE
vector instructions, and no floating point. In that situation, the FP
and vector registers still exist, and so do the load, store and move
instructions that transfer data in and out of them. So there's no
reason the hard floating point ABI can't be supported, and you might
reasonably want to use it, for the sake of intrinsics-based code
passing explicit MVE vector types between functions.
But the selection of the hard float ABI in the backend was gated on
Subtarget->hasVFP2Base(), which is false in the case of integer MVE
and no FP.
As a result, you'd silently get the soft float ABI even if you
deliberately tried to select it, e.g. with clang options such as
--target=arm-none-eabi -mfloat-abi=hard -march=armv8.1m.main+nofp+mve
The hard float ABI should have been gated on the weaker condition
Subtarget->hasFPRegs(), because the only requirement for being able to
pass arguments in the FP registers is that the registers themselves
should exist.
I haven't added a new test, because changing the existing
CodeGen/Thumb2/float-ops.ll test seemed sufficient. But I've added a
comment explaining why the results are expected to be what they are.
Reviewed By: lenary
Differential Revision: https://reviews.llvm.org/D142703
Jonas Hahnfeld [Mon, 23 Jan 2023 13:09:48 +0000 (14:09 +0100)]
[CodeGen] Filter out available_externally aliases
The Language Reference says that aliases can have available_externally
linkage if their aliasee is an available_externally global value. Using
this kind of aliases resulted in crashes during code generation, filter
them out (the same that the AsmPrinter also filters out GlobalVariables
in emitSpecialLLVMGlobal(); Functions are discarded in the machine pass
infrastructure).
Differential Revision: https://reviews.llvm.org/D142352
wanglei [Wed, 1 Feb 2023 03:27:52 +0000 (11:27 +0800)]
[LoongArch] Support getHostCPUName and getHostCPUFeatures
Reviewed By: xen0n, MaskRay
Differential Revision: https://reviews.llvm.org/D142950
Lorenzo Chelini [Tue, 31 Jan 2023 13:25:14 +0000 (14:25 +0100)]
[MLIR] Propagate unpack through element-wise ops
Introduce `pushDownUnPackOpThroughElemGenericOp` to propagate producer
unpack operation through an element-wise linalg.generic operation. This
pattern complements `BubbleUpPackOpThroughElemGenericOp`. The general
idea is to bubble up tensor.pack as much as possible while pushing down
tensor.unpack as much as possible, and canonicalize away symmetrical
tensor.pack and tensor.unpack operations.
Currently, `pushDownUnPackOpThroughElemGenericOp` expects a single
tensor.unpack operation as the producer of one of the linalg.generic's
operands.
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D142523
Noah Goldstein [Wed, 1 Feb 2023 05:23:29 +0000 (23:23 -0600)]
Make `prefetchit{0/1}` emit an assembler warning if the operand is not rip-rel
Without a rip-rel operand, `prefetchit{0/1}` is a nop. This is a
reasonable mistake for someone to make and is almost certainly not
what they are after.
This matches the same warning in `gas`.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D142797
Noah Goldstein [Wed, 1 Feb 2023 02:50:45 +0000 (20:50 -0600)]
Improve and enable folding of conditional branches with tail calls.
Improve and enable folding of conditional branches with tail calls.
1. Make it so that conditional tail calls can be emitted even when
there are multiple predecessors.
2. Don't guard the transformation behind -Os. The rationale for
guarding it was static-prediction can be affected by whether the
branch is forward of backward. This is no longer true for almost any
X86 cpus (anything newer than `SnB`) so is no longer a meaningful
concern.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D140931
Noah Goldstein [Wed, 1 Feb 2023 05:23:12 +0000 (23:23 -0600)]
Use autogenerated result for switch-bt.ll test; NFC
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D142860
Noah Goldstein [Wed, 1 Feb 2023 05:23:18 +0000 (23:23 -0600)]
Transform slow LEA_B_I_D/LEA_SLOWBASE_I -> LEA_IS_D/LEA_IS iff base == index
The two 3c LEA cases:
lea D(base, index,1) -> lea D(,index,2)
lea D(r13/rbp, index) -> lea D(,r13/rbp,2) // D maybe zero
Current take 2 instructions to transform. We can do a bit better by
using LEA w.o a base if base == index and scale == 1.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D141980
Xiang [Tue, 31 Jan 2023 01:38:57 +0000 (20:38 -0500)]
[mlir] return nullopt for getNeutralElement
Fixes 60210 https://github.com/llvm/llvm-project/issues/60210
Crash for return Attribute instead of nullopt.
Differential Revision: https://reviews.llvm.org/D142945
Serge Pavlov [Mon, 30 Jan 2023 12:49:57 +0000 (19:49 +0700)]
[AArch64] Mark function calls as possibly changing FPCR
This patch does the same changes as D111433 for PowerPC and D139549 for
X86, - in the strictfp function all calls are marked as implicit defs of
FPCR. It prevents from moving FP operations across function calls, which
may change rounding mode, as fesetround does.
Differential Revision: https://reviews.llvm.org/D143001
Mohammed Keyvanzadeh [Tue, 31 Jan 2023 21:28:45 +0000 (00:58 +0330)]
[github] update actions and make tweaks
- Update the GitHub workflow actions to their latest versions.
- Use the latest Node.js LTS release.
- Use the latest Ubuntu version for consistency across all workflows.
- The `set-output` command is deprecated and will soon be disabled (https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/) so use the new recommended way.
- Use the `$()` expressions for string interpolation instead of the deprecated backticks in Bash.
- Format the YAML files.
Differential Revision: https://reviews.llvm.org/D143015
Lang Hames [Wed, 1 Feb 2023 02:17:09 +0000 (18:17 -0800)]
[lli] Don't create an ExecutorProcessControl in non-remote MCJIT config.
When lli is run with -jit-kind=mcjit and without remote JITing there is no need
to create an ExecutorProcessControl object.
This is nice cleanup, but as a bonus should silence the leak reports that we're
seeing in https://green.lab.llvm.org/green/job/clang-stage2-cmake-RgSan/9105/.
(Though as a side note I believe those reports are spurious. They are being
tracked by rdar://
104825696).
Sergei Barannikov [Tue, 31 Jan 2023 10:54:40 +0000 (13:54 +0300)]
[NFC] Extract `CodeGenInstAlias` into its own *.h/*.cpp
Differential Revision: https://reviews.llvm.org/D142968
Lang Hames [Wed, 1 Feb 2023 01:55:29 +0000 (17:55 -0800)]
[ORC] Fix an iterator invalidation issue in JITDylib::defineMaterializing.
The loop body may add and remove entries in the symbol table so we can't hold
iterators to the entries. This commit updates the method to use the newly added
NonOwningSymbolStringPtr type as keys for removal instead.
Side note: This bug has been present since the introduction of the
defineMaterializing method, but the method is called rarely and DenseMap
resizes are also rare so we didn't see any fallout until a large program was
thrown at it. There's no testcase as I haven't been able to reproduce the
failure with smaller testcases.
Lang Hames [Wed, 1 Feb 2023 01:46:27 +0000 (17:46 -0800)]
[ORC] Enable DenseMap<SymbolStringPtr, T>::find_as(NonOwningSymbolStringPtr).
For maps of SymbolStringPtrs to values, enables lookup using
NonOwningSymbolStringPtr keys.
wanglei [Wed, 1 Feb 2023 01:03:35 +0000 (09:03 +0800)]
[LoongArch] Enable shrink wrapping when optimize the function
We set it conservatively so that it is turned on when optimization
is enabled, i.e. when the optimization level is not `O0`.
Reviewed By: xen0n
Differential Revision: https://reviews.llvm.org/D142876
Mahesh Ravishankar [Tue, 31 Jan 2023 23:20:58 +0000 (23:20 +0000)]
Fix missing return of LogicalResult from D142848
Differential Revision: https://reviews.llvm.org/D143023
Jorge Gorbe Moya [Wed, 1 Feb 2023 01:05:49 +0000 (17:05 -0800)]
Fix bazel build
James Y Knight [Tue, 31 Jan 2023 21:33:31 +0000 (16:33 -0500)]
[VE] Fix useDeprecatedPositionallyEncodedOperands errors.
This is a follow-on to https://reviews.llvm.org/D134073.
Behavior is unchanged by this cleanup, except that previously the
'CVTRDm' pattern was accidentally getting the top bit of 'sz' from the
'sx' input, instead of setting it to 0.
Differential Revision: https://reviews.llvm.org/D140922
Lang Hames [Tue, 31 Jan 2023 22:43:11 +0000 (14:43 -0800)]
[ORC] Further improvements to SymbolStringPtr & NonOwningSymbolStringPtr.
A follow-up to https://reviews.llvm.org/D142314:
* Make SymbolStringPtrs constructible from NonOwningSymbolStringPtrs.
* Move and rename getRefCount and isValid (now poolEntryIsAlive) to improve
readability. Also updates these routines to make them safe for use with
sentinel values (null, empty, tombstone).
* Move ref-counting operations into their own incRef and decRef methods.
Brian Cain [Tue, 31 Jan 2023 02:25:42 +0000 (18:25 -0800)]
[hexagon] add a -mcabac flag
For v73 and later, clang users who wish to use the cabac instructions need
a way to add the 'cabac' target feature.
Reviewed By: kparzysz
Differential Revision: https://reviews.llvm.org/D142947
Kai Sasaki [Tue, 31 Jan 2023 23:58:58 +0000 (08:58 +0900)]
[mlir] Register tensor dialect for transfer_read conversion
Make sure to register tensor dialect as tensor.transfer_read can be dependent on its parameter. It resolves the issue causing the unregisterd dialect error to convert vector to SCF reported https://github.com/llvm/llvm-project/issues/60197.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D142866
Philipp Tomsich [Tue, 31 Jan 2023 20:34:06 +0000 (21:34 +0100)]
[RISCV][NFC] Update RISCVUsage.rst to sort vendor extensions
Vladislav Dzhidzhoev [Fri, 27 Jan 2023 02:01:22 +0000 (03:01 +0100)]
[GlobalISel] Don't combine instructions with unknown type in hoist_logic_op_with_same_opcode_hands.
This fixes failure for some LLVM IR.
Differential Revision: https://reviews.llvm.org/D142791
Sam Clegg [Tue, 31 Jan 2023 21:33:29 +0000 (13:33 -0800)]
[lld][WebAssembly] Apply relocations to TLS data
This is only needed in the case of dynamic linking and pthreads.
Previously these relocations were simply not being applied.
Verified that this works using a more real world emscripten test:
https://github.com/emscripten-core/emscripten/pull/18641
Differential Revision: https://reviews.llvm.org/D143020
Jonas Devlieghere [Tue, 31 Jan 2023 23:33:46 +0000 (15:33 -0800)]
[lldb] Use ${CMAKE_COMMAND} -E remove instead of remove_directory
We no longer need to remove a directory downstream and also contrary to
my previous observations, remove_directory isn't sufficient to remove a
regular file.
Differential revision: https://reviews.llvm.org/D143024
Konstantin Varlamov [Tue, 31 Jan 2023 23:27:07 +0000 (15:27 -0800)]
[libc++][ranges] Fix incorrect integer typedef in `elements_view` test.
Differential Revision: https://reviews.llvm.org/D142951
Louis Dionne [Mon, 30 Jan 2023 15:57:26 +0000 (10:57 -0500)]
[libc++] Use bounded iterators in std::string_view when the debug mode is enabled
Differential Revision: https://reviews.llvm.org/D142903
H.J. Lu [Tue, 31 Jan 2023 22:30:55 +0000 (14:30 -0800)]
compiler-rt/lib: Add .Linterceptor_sigsetjmp
Older GNU assemblers generate R_X86_64_PC32 relocation against
defined non-weak global branch targets with default visibility. A
linker may issue an error when building a shared library. Add a local
alias, .Linterceptor_sigsetjmp, to __interceptor_sigsetjmp to avoid
R_X86_64_PC32 relocation for "jmp __interceptor_sigsetjmp" with older
GNU assemblers.
Fixes: https://github.com/llvm/llvm-project/issues/60426
Differential Revision: https://reviews.llvm.org/D142995
Lang Hames [Sun, 22 Jan 2023 18:30:15 +0000 (10:30 -0800)]
[ORC] Add a NonOwningSymbolStringPtr utility.
Introduces a non-owning SymbolStringPool entry pointer. Instances of the new
type can be compared with SymbolStringPtr instances, but do not participate in
ref-counting and are therefore cheaper to copy. This makes it efficient to use
in algorithms that use symbol-strings as ids, e.g. ORC's waiting-on graph. A
future commit will rewrite ORC's waiting-on graph.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D142314
Alex Yermolovich [Tue, 31 Jan 2023 22:12:02 +0000 (14:12 -0800)]
[DWARF] Fix handling of .debug_aranges with -g1
Old behavior was to add to .debug_aranges only when we create a DIE. As the
result we could end up in situation where DW_AT_ranges have addresses that are
not in .debug_aranges. This has caused issues for LLDB: D136395.
Changed it to add addresses to .debug_aranges even when DIE is not created.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D137139
Jorge Gorbe Moya [Tue, 31 Jan 2023 21:49:07 +0000 (13:49 -0800)]
Fix two warnings introduced by
69011a2ad0ce "[mlir][Linalg] Make Elementwise op fusion return a map from existing values to values in the fused op." (NFCI)
- a -Wunused-result from ignoring a LogicalResult return value.
- an unused variable
Florian Hahn [Tue, 31 Jan 2023 21:51:03 +0000 (21:51 +0000)]
[VPlan] VPPredInstPHIRecipe does not read from memory.
VPPredInstPHIRecipe just merges the incoming values and does not write
to memory.
Siva Chandra Reddy [Tue, 31 Jan 2023 05:31:18 +0000 (05:31 +0000)]
[libc] Build two different static archives libc.a and libm.a under full build.
We currently put everything in one single archive libc.a which breaks in
certain situations where the compiler drivers expect libm.a also. With
this change, we separate out libc.a and libm.a functions as is done
conventionally and put them in two different static archives.
One will now have to build two targets, `libc` and `libm` which produce
`libc.a` and `libm.a` respectively. Under default build, one still builds only
one target named `libc` which produces `libllvmlibc.a`.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D143005
Sam Clegg [Tue, 31 Jan 2023 20:17:18 +0000 (12:17 -0800)]
[lld][WebAssembly] Renamed a few tests to conform to naming convention. NFC
Differential Revision: https://reviews.llvm.org/D143009
LLVM GN Syncbot [Tue, 31 Jan 2023 21:17:27 +0000 (21:17 +0000)]
[gn build] Port
486729ce06c1