Peiming Liu [Mon, 9 Jan 2023 17:45:00 +0000 (17:45 +0000)]
[mlir][sparse] remove redundant template parameter (NFC)
The template parameter is no longer needed after MutSparseTensorDescriptor
is implemented as a subclass of SparseTensorDescriptorImpl. The only purpose
for it was to enable SFINAE.
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D141303
Philip Reames [Mon, 9 Jan 2023 19:00:11 +0000 (11:00 -0800)]
[RISCV] Consolidate test lines in fence lowering test
These are identical for RV32 and RV64.
Thurston Dang [Tue, 3 Jan 2023 21:47:51 +0000 (21:47 +0000)]
tsan: increase app mappings for aarch64 48-bit
Currently, tsan's memory mappings include 4GB
for high app, 20GB for mid app, and 8GB for low
app. The high app and mid app mappings are
too small for large programs, especially if ASLR
entropy (mmap_rnd_bits) is set higher. The low app
region (for non-PIE) is too small for some of tcmalloc's
internal tests (this does not affect normal apps,
since tsan will replace malloc).
This CL increases the memory mappings to 4TB for
high app, 1.3TB for mid app, and 10TB for low app. Note
that tsan's 44-bit pointer compression/decompression imposes
a 16TB limit on the combined size of the app mappings, making
this set of mappings more or less maximal.
Differential Revision: https://reviews.llvm.org/D140923
Augusto Noronha [Fri, 6 Jan 2023 23:17:25 +0000 (15:17 -0800)]
[lldb] Fix symbol table use after free
The symbol file stores a raw pointer to the main object file's symbol
table. This pointer, however, can be freed, if ObjectFile::ClearSymtab
is ever called. This patch makes sure out pointer to the symbol file
is valid before using it.
Philip Reames [Mon, 9 Jan 2023 18:07:17 +0000 (10:07 -0800)]
[RISCV] Add test coverage for singlethread fences
Alexey Bataev [Mon, 9 Jan 2023 17:49:12 +0000 (09:49 -0800)]
[SLP][NFC]Move getExtractIndex function for future changes, NFC.
Kazu Hirata [Mon, 9 Jan 2023 17:51:17 +0000 (09:51 -0800)]
[mlir] Fix a warning
This patch fixes:
mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp:947:13:
error: variable 'distributedDim' set but not used
[-Werror,-Wunused-but-set-variable]
Paul Kirth [Thu, 5 Jan 2023 20:32:25 +0000 (20:32 +0000)]
[lld-macho] Prevent assertions for aliases to weak_def_can_be_hidden symbols
In https://reviews.llvm.org/D137982 we found that on Mach-O private
aliases could trigger an assert in lld when the aliasee was a
weak_def_can_be_hidden symbol.
This appears to be incorrect, and should be allowed in Mach-O.
Disallowing this behavior is also inconsistent with how ld64 handles
a private alias to weak_def_can_be_hidden symbols.
This patch removes the assert and tests that LLD handles such aliases
gracefully.
Reviewed By: #lld-macho, int3
Differential Revision: https://reviews.llvm.org/D141082
Craig Topper [Mon, 9 Jan 2023 17:45:22 +0000 (09:45 -0800)]
[LocalStackSlotAllocation] Minor simplifications. NFC
Instead of maintaining a separate valid flag for BaseReg, Use
BaseReg.isValid(). I think this is left over from an older
implementation that maintained a vector of base registers.
The other change is not do a speculative assignment to BaseOffset
that needs to be reverted. Only commit it after we do the check.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D141153
Theodore Luo Wang [Mon, 9 Jan 2023 17:33:22 +0000 (17:33 +0000)]
[mlir] Print a newline when dumping Type
Fixes https://github.com/llvm/llvm-project/issues/59673
Reviewed By: mehdi_amini, Mogball
Differential Revision: https://reviews.llvm.org/D141201
Sanjay Patel [Mon, 9 Jan 2023 17:25:02 +0000 (12:25 -0500)]
[InstCombine] bitrev (zext i1 X) --> select X, SMinC, 0
https://alive2.llvm.org/ce/z/ZXCtgi
This breaks the infinite combine loop for issue #59897,
but we may still need more changes to avoid those loops.
Sanjay Patel [Mon, 9 Jan 2023 17:20:32 +0000 (12:20 -0500)]
[InstCombine] add tests for bitreverse of i1; NFC
Nikolas Klauser [Mon, 9 Jan 2023 17:15:17 +0000 (18:15 +0100)]
[libc++] Use %{clang-query} when calling clang-query
Ivan Kosarev [Mon, 9 Jan 2023 16:45:29 +0000 (16:45 +0000)]
[AMDGPU][NFC] Rename GFX10A16 operands.
They do not seem to be GFX10-specific anymore. Also renames the
corresponding feature.
Reviewed By: dp
Differential Revision: https://reviews.llvm.org/D141069
Valentin Clement [Mon, 9 Jan 2023 16:53:16 +0000 (17:53 +0100)]
[flang] Add runtime default initialization for polymorphic intent(out) dummy
This patch adds runtime default initialization for polymorphic
dummy argument. The dynamic type might require default initialization
but not the declared type.
Reviewed By: jeanPerier, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D141278
Valentin Clement [Mon, 9 Jan 2023 16:52:14 +0000 (17:52 +0100)]
[flang] Handle emboxing of a fir.ref<none> to an unlimited polymorphic box
When an array element is extracted from an unlimited polymorphic array, the
emboxing of this element has to retrive the type code and element size from
the initial array. This patch retrive this information through the extracted
type descriptor.
This situation can be found in code like:
```
subroutine sub1(a)
class(*) :: a(:)
select type (x=>a(1))
type is (integer)
x = 10
end select
end subroutine
```
Reviewed By: jeanPerier, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D141274
Florian Hahn [Mon, 9 Jan 2023 16:38:19 +0000 (16:38 +0000)]
[AArch64] Add additional reassociation test.
Add a test where the reassociation candidates are split across 2 blocks.
Jakub Kuderski [Mon, 9 Jan 2023 16:35:46 +0000 (11:35 -0500)]
[mlir][spirv] Account for type conversion failures in scf-to-spirv
Fixes: https://github.com/llvm/llvm-project/issues/59136
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D141292
Joseph Huber [Mon, 9 Jan 2023 16:02:28 +0000 (10:02 -0600)]
[OpenMP] Fix some tests failing with 'libgomp' as the default library
Summary:
There's some static checks on the library, we can't do offloading with
`libgomp` for OpenMP. This patch specifies the library for the tests to
avoid this breaking tests.
Nikita Popov [Mon, 9 Jan 2023 15:51:43 +0000 (16:51 +0100)]
[ConstantRange] Test 1 bit ranges in exhaustive tests (NFC)
There have been multiple cases where range calculations were wrong
in the 1 bit case. Make sure we catch these by not specifying the
bit width explicitly, and letting the test framework pick it (which
will now always test 1 and 4 bits both).
Alex Brachet [Mon, 9 Jan 2023 15:54:11 +0000 (15:54 +0000)]
[compiler-rt] Move up undefined macro checks
Previously HWCAP_ATOMIC and others were being used before checking if
they were defined. This moves up all the ifndef checks to define these
macros if they are not yet defined.
Differential Revision: https://reviews.llvm.org/D141285
Jakub Kuderski [Mon, 9 Jan 2023 15:50:06 +0000 (10:50 -0500)]
[mlir][spirv] Clean up transform pass definitions. NFC.
- Make naming more consistent.
- Drop unnecessary custom constructors definitions.
- Move pass documentation to pass descriptions.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D141159
Matthias Springer [Mon, 9 Jan 2023 15:46:01 +0000 (16:46 +0100)]
[mlir][vector] Distribute vector.insert op
In case the distributed dim of the dest vector is also a dim of the src vector, each lane inserts a smaller part of the source vector. Otherwise, one lane inserts the entire src vector and the other lanes do nothing.
Differential Revision: https://reviews.llvm.org/D137953
Jay Foad [Mon, 9 Jan 2023 14:47:09 +0000 (14:47 +0000)]
[AMDGPU] S_MULK_I32 does not define SCC. NFCI.
Differential Revision: https://reviews.llvm.org/D141281
Matthias Springer [Mon, 9 Jan 2023 15:40:32 +0000 (16:40 +0100)]
[mlir][vector] Distribute vector.insertelement op
In case of a distribution, only one lane inserts the scalar value. In case of a broadcast, every lane inserts the scalar.
Differential Revision: https://reviews.llvm.org/D137929
Matthias Springer [Mon, 9 Jan 2023 15:35:29 +0000 (16:35 +0100)]
[mlir][vector] Support vector.extract distribution of >1D vectors
Ops such as `%1 = vector.extract %0[2] : vector<5x96xf32>`.
Distribute the source vector, then extract. In case of a 1d extract, rewrite to vector.extractelement.
Differential Revision: https://reviews.llvm.org/D137646
Nikolas Klauser [Mon, 9 Jan 2023 15:37:31 +0000 (16:37 +0100)]
[libc++] Add missing include in __format/unicode.h
Nikita Popov [Mon, 9 Jan 2023 15:29:37 +0000 (16:29 +0100)]
[ConstantRange] Fix single bit abs range (PR59887)
For a full range input, we would produce an empty range instead
of a full range. The change to the SMin.isNonNegative() branch is
an optimality fix, because we should account for the potentially
discarded SMin value in the IntMinIsPoison case.
Change TestUnaryOpExhaustive to test both 4 and 1 bits, to both
cover this specific case in unit tests, and make sure all other
unary operations deal with 1-bit inputs correctly.
Fixes https://github.com/llvm/llvm-project/issues/59887.
Joe Loser [Mon, 9 Jan 2023 15:13:38 +0000 (08:13 -0700)]
[libc++][test] Fix missing include in `bit_ceil.fail.cpp`
The test uses `size_t` but does not include a header defining it. Include
`<cstddef>` which provides `size_t`.
Differential Revision: https://reviews.llvm.org/D141284
Louis Dionne [Wed, 21 Dec 2022 15:08:54 +0000 (10:08 -0500)]
[libc++] Remove HIDE_FROM_ABI from virtual functions
_LIBCPP_HIDE_FROM_ABI (which is what _LIBCPP_INLINE_VISIBILITY is) uses
ABI tags to avoid ODR violations when linking together object files
compiled against different versions of libc++. However, pointer
authentication uses the mangled name of the function to sign the
function pointer in the vtable, which means that the ABI tag effectively
changes how the pointers are signed.
This leads to PAC failures when passing an object that holds one of these
pointers in its vtable across an ABI boundary: one side will sign the
pointer using one function mangling (with one ABI tag), and the other
side will authenticate the pointer expecting it to have a different
mangled name, which won't work.
To make sure this does not regress in the future, this patch also adds
a clang-query test to detect incorrect applications of _LIBCPP_HIDE_FROM_ABI.
Differential Revision: https://reviews.llvm.org/D140453
Sanjay Patel [Mon, 9 Jan 2023 14:53:45 +0000 (09:53 -0500)]
[InstCombine] reduce smul.ov with i1 types to 'and'
https://alive2.llvm.org/ce/z/5tLkW6
There's still a miscompile bug as shown in issue #59876 / D141214 .
Sanjay Patel [Mon, 9 Jan 2023 14:26:28 +0000 (09:26 -0500)]
[InstCombine] add tests for smul/umul with overflow with i1 types; NFC
More coverage for D141214 / issue #59876
Florian Hahn [Mon, 9 Jan 2023 15:20:55 +0000 (15:20 +0000)]
[AArch64] Add test showing reassociation potential.
Add a test case where some ops of a reassociate-able expression are in
an earlier block.
This can appear in practice, e.g. when computing the final reduction
value after vectorization.
Nikita Popov [Mon, 9 Jan 2023 15:15:36 +0000 (16:15 +0100)]
[CVP] Add test for PR59887 (NFC)
Also fix all the incorrect intrinsic name mangling while here.
Sander de Smalen [Mon, 9 Jan 2023 09:45:50 +0000 (09:45 +0000)]
[AArch64][SME] Improve streaming-compatible codegen for extending loads/truncating stores.
This is another step in aligning addTypeForStreamingSVE with addTypeForFixedLengthSVE,
which also improves code quality for extending loads and truncating stores.
Reviewed By: hassnaa-arm
Differential Revision: https://reviews.llvm.org/D141266
David Goldman [Tue, 6 Dec 2022 21:33:12 +0000 (16:33 -0500)]
[clangd] Full support for #import insertions
These are still disabled by default, but will work in ObjC code if you
enable the `-import-insertions` flag.
Completion requires ASTSignals to be available; before ASTSignals are
available, we will always use #include. Once they are available, the
behavior varies as follows:
- For source files, use #import if the ObjC language flag is enabled
- For header files:
- If the ObjC language flag is disabled, use #include
- If the header file contains any #imports, use #import
- If the header file references any ObjC decls, use #import
- Otherwise, use #include
IncludeFixer support is similar, but it does not rely upon ASTSignals,
instead it does the above checks excluding the scan for ObjC symbols.
Differential Revision: https://reviews.llvm.org/D139458
David Goldman [Tue, 6 Dec 2022 19:25:46 +0000 (14:25 -0500)]
[clangd] Add flag to control #import include insertions
This will be disabled by default, hopefully we can enable for the next
major release.
Differential Revision: https://reviews.llvm.org/D139446
Nikita Popov [Mon, 9 Jan 2023 14:36:32 +0000 (15:36 +0100)]
[InstCombine] Preserve alignment in atomicrmw -> store fold
Preserve the alignment of the original atomicrmw, rather than using
the ABI alignment.
The same problem exists for loads, but that code is being removed
in D141277 anyway.
David Truby [Fri, 18 Nov 2022 16:55:56 +0000 (16:55 +0000)]
[flang] Disable LTO when building the flang runtime
When building the flang runtime if LTO is enabled the archive file
contains LLVM IR rather than object code. Currently flang is not
LTO aware so cannot link this file to compiled Fortran code.
This patch disables LTO when building the flang runtime to avoid
this issue.
Differential Revision: https://reviews.llvm.org/D140016
Nikita Popov [Mon, 9 Jan 2023 14:25:15 +0000 (15:25 +0100)]
[InstCombine] Test alignment in atomicrmw -> store transform (NFC)
And regenerate test checks. The current alignment is incorrect.
Martin Storsjö [Mon, 9 Jan 2023 11:18:19 +0000 (13:18 +0200)]
[LLD] [COFF] Add a testcase for the type of autoexported symbols from LTO
This adds test coverage for the behaviour that broke in
7370ff624d217b0f8f7512ca5b651a9b8095a411.
Martin Storsjö [Mon, 9 Jan 2023 14:04:09 +0000 (16:04 +0200)]
Revert "[LLD] Remove global state in lld/COFF"
This reverts commit
7370ff624d217b0f8f7512ca5b651a9b8095a411.
(and
47fb8ae2f9a4075de05433ef24f459b6befd1730).
This commit broke the symbol type in import libraries generated
for mingw autoexported symbols, when the source files were built
with LTO. I'll commit a testcase that showcases this issue after
the revert.
Alexey Baturo [Wed, 31 Aug 2022 05:21:39 +0000 (08:21 +0300)]
[RISC-V][HWASAN] Don't explicitly load GOT entry to call hwasan mismatch routine
Reviewed by: luismarques
Differential Revision: https://reviews.llvm.org/D132994
David Green [Mon, 9 Jan 2023 13:28:57 +0000 (13:28 +0000)]
[ARM] Fold And/Or into CSel if possible
This is the ARM equivalent of D141119, where we fold `and x, (csel 0, 1, cc)`
to `csel ZR, x, cc` if we know that x is 0/1 and for `or x, (csel 0, 1, cc)`
emit `csinc x, ZR, cc`. The or pattern gets recognized from a cmov under Arm.
Differential Revision: https://reviews.llvm.org/D141137
Jamie Hill-Daniel [Mon, 9 Jan 2023 13:21:12 +0000 (14:21 +0100)]
[InstCombine] Fold zero check followed by decrement to usub.sat
Fold (a == 0) : 0 ? a - 1 into usub.sat(a, 1).
Differential Revision: https://reviews.llvm.org/D140798
Jamie Hill-Daniel [Mon, 9 Jan 2023 13:07:55 +0000 (14:07 +0100)]
[InstCombine] Add tests for saturating subtract by one (NFC)
Tests for D140798.
Alex Zinenko [Mon, 9 Jan 2023 13:01:25 +0000 (14:01 +0100)]
[mlir] verify against nullptr payload in transform dialect
When establishing the correspondence between transform values and
payload operations or parameters, check that the latter are non-null and
report errors. This was previously allowed for exotic cases of partially
successfull transformations with "apply each" trait, but was dangerous.
The "apply each" implementation was reworked to remove the need for this
functionality, so this can now be hardned to avoid null pointer
dereferences.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D141142
Haojian Wu [Thu, 22 Dec 2022 10:54:07 +0000 (11:54 +0100)]
[include-cleaner] Don't count references to operators as uses
Fixes https://github.com/llvm/llvm-project/issues/59655
Differential Revision: https://reviews.llvm.org/D140551
Viktoriia Bakalova [Mon, 9 Jan 2023 10:49:08 +0000 (10:49 +0000)]
[include-cleaner] Filter template instantiations from AST roots.
Fix: https://github.com/llvm/llvm-project/issues/59825
Differential Revision: https://reviews.llvm.org/D141271
Aliia Khasanova [Mon, 9 Jan 2023 07:25:03 +0000 (08:25 +0100)]
[mlir][linalg] Reuploading: Apply shortened printing/parsing form to linalg.reduce.
Differential Revision: https://reviews.llvm.org/D141259
Max Kazantsev [Mon, 9 Jan 2023 12:23:46 +0000 (19:23 +0700)]
[Test] One more test where check is not replaced to invariant
Irrelevant constant check makes things even more difficult, surprisingly.
Johannes Reifferscheid [Mon, 9 Jan 2023 10:48:43 +0000 (11:48 +0100)]
Lower math.cbrt to NVVM/ROCDL.
Reviewed By: pifon2a
Differential Revision: https://reviews.llvm.org/D141270
Nikita Popov [Mon, 9 Jan 2023 11:55:47 +0000 (12:55 +0100)]
[Attributes] Avoid duplicate hasAttribute() query (NFC)
removeAttribute() already performs a hasAttribute() check, so no
need to also do it in the caller. Instead check whether the
attribute set was changed.
This makes the implementations in line with removeAttributesAtIndex().
David Green [Mon, 9 Jan 2023 11:52:37 +0000 (11:52 +0000)]
[AArch64] Fold And/Or into CSel if possible
If we have `and x, (csel 0, 1, cc)` and we know that x is 0/1, then we
can emit a `csel ZR, x, cc`. Similarly for `or x, (csel 0, 1, cc)` we
can emit `csinc x, ZR, cc`. This can help where we can not otherwise
general ccmp instructions.
Differential Revision: https://reviews.llvm.org/D141119
Noah Goldstein [Mon, 9 Jan 2023 11:44:03 +0000 (12:44 +0100)]
[InstCombine] Canonicalize (A & B_Pow2) eq/ne B_Pow2 patterns
1. A & B_Pow2 != B_Pow2 -> A & B_Pow2 == 0
https://alive2.llvm.org/ce/z/KVUej4
2. A & B_Pow2 == B_Pow2 -> A & B_Pow2 != 0
https://alive2.llvm.org/ce/z/PVv9FR
This allows the patterns to more easily be analyzed elsewhere.
Differential Revision: https://reviews.llvm.org/D141090
Ties Stuij [Mon, 9 Jan 2023 11:06:00 +0000 (11:06 +0000)]
[lld][ARM] don't use short thumb thunks if no branch range extension
In ThumbThunk::isCompatibleWith, we check if we can use short thunks if we are
within branch range. However these short thumb thunks will generate b.w
instructions, and these are not available on pre branch range extension
architectures.
On these architectures (v4, v5, and most of v6), we could replace the b.w with a
Thumb b (2) instruction, but that would in an ideal situation only give us an
extra range of 2048 bytes on top of the 4MB range of a BL, if a thunk section
happens to be placed on the outer range of a BL and the stars are aligned. It
doesn't seem worth it.
What would be worth it is a state change to Arm and a subsequent branch to
either Arm or Thumb code. But that's the subject of another patch.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D140633
Ben Mudd [Mon, 9 Jan 2023 11:04:39 +0000 (11:04 +0000)]
[DebugInfo] Fix jump threading failing to update cloned dbg.values
This is a patch to fix duplicated dbg.values in the JumpThreading pass not
pointing towards their local value, and instead towards the variable in the
original block.
JumpThreadingPass::cloneInstructions is the changed function to target metadata
as well as normal cloned values.
Reviewed By: jmorse, StephenTozer
Differential Revision: https://reviews.llvm.org/D140006
Nikolas Klauser [Mon, 9 Jan 2023 11:19:36 +0000 (12:19 +0100)]
[libc++] Fix transitive includes list for C++23
serge-sans-paille [Fri, 6 Jan 2023 15:56:23 +0000 (16:56 +0100)]
Move from llvm::makeArrayRef to ArrayRef deduction guides - clang/ part
This is a follow-up to https://reviews.llvm.org/D140896, split into
several parts as it touches a lot of files.
Differential Revision: https://reviews.llvm.org/D141139
Tim Northover [Mon, 9 Jan 2023 10:52:34 +0000 (10:52 +0000)]
TailDuplication: do not remove trivial PHIs from addr-taken blocks.
Unlike an anonymous block, it will not be removed even though we've resolved
all valid paths to get here. So removing a PHI can leave vregs with no
definition, violating SSA. Instead, this converts it to an IMPLICIT_DEF.
Joe Loser [Mon, 9 Jan 2023 11:09:45 +0000 (12:09 +0100)]
[libc++][test] Fix missing include in `endian.pass.cpp`
`endian.pass.cpp` uses `std::is_enum` and friends but doesn't include
`<type_traits>`. Add the missing include.
Reviewed By: philnik, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D141239
Nikita Popov [Mon, 9 Jan 2023 10:58:06 +0000 (11:58 +0100)]
[Attributes] Avoid repeated attribute set lookup (NFC)
Perform the hasAttribute() check on the AttributeSet we need to
fetch anyway, rather than going through hasAttributeAtIndex().
Noah Goldstein [Mon, 9 Jan 2023 10:38:36 +0000 (11:38 +0100)]
[InstCombine] Fix potentially buggy code in `((%x & C) == 0) --> %x u< (-C)` transform
While demanded bits constant shrinking appears to prevent this in
practice right now, it is principally possible for C2 to have
set bits that are known not-needed (zeroable). See: D140858
`+` will overflow here, `|` will get the right logic.
Differential Revision: https://reviews.llvm.org/D141089
Dmitri Gribenko [Mon, 9 Jan 2023 10:31:25 +0000 (11:31 +0100)]
[llvm] Fix an "unused variable" warning when assertions are disabled
Markus Böck [Mon, 9 Jan 2023 10:16:56 +0000 (11:16 +0100)]
[TableGen][SourceMgr] Fix obvious mistake in D141220
It now tried to open the IncludedFile instead of the Filename, which was not intended.
Sander de Smalen [Mon, 9 Jan 2023 09:26:20 +0000 (09:26 +0000)]
[AArch64] NFC: Align addTypeForStreamingSVE and addTypeForFixedLengthSVE
This patch is NFC and just moves things around so their implementation is very similar.
Dmitri Gribenko [Mon, 9 Jan 2023 09:27:15 +0000 (10:27 +0100)]
[bazel] Updates for https://github.com/llvm/llvm-project/commit/
496f9a7d8d4b61b6f5dfa21e2614043a2b27cf67
Dmitri Gribenko [Mon, 9 Jan 2023 09:26:25 +0000 (10:26 +0100)]
[bazel] Update the mpfr URL to a stable one
mpfr has released a new version, and now the old tar.gz URL does not
work anymore. Update the URL to a stable one.
Johannes de Fine Licht [Mon, 9 Jan 2023 09:28:10 +0000 (10:28 +0100)]
[mlir:LLVM] Rudimentary inlining support for LLVM load store.
Conservatively only allow inlining for loads and stores that don't carry
any attributes that require handling while inlining. This can later be
relaxed when proper handling is introduced.
Reviewed By: Dinistro, gysit
Differential Revision: https://reviews.llvm.org/D141115
Christian Ulmann [Mon, 9 Jan 2023 09:14:21 +0000 (10:14 +0100)]
[mlir][llvm] Add branch weights to call and invoke
This commit introduces branch weight attributes to the LLVM::CallOp and
LLVM::InvokeOp and adds both import and export of them.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D141122
Thomas Symalla [Mon, 9 Jan 2023 09:11:08 +0000 (10:11 +0100)]
[NFC] Missing whitespace in SSAUpdaterBulk debug output.
Adds a whitespace in a debug message before printing out a
value in the SSAUpdaterBulk.
Without this, debugging can end up a bit cumbersome.
Differential Revision: https://reviews.llvm.org/D141262
Max Kazantsev [Mon, 9 Jan 2023 09:04:00 +0000 (16:04 +0700)]
[JumpThreading] Preserve profile metadata during select unfolding
Jump threading can replace select and unconditional branch with
conditional branch, but when doing so loses profile information.
This destructive transform can eventually lead to a performance
degradation due to folding of branches in
shouldFoldCondBranchesToCommonDestination as branch probabilities
are no longer known.
Patch by Roman Paukner!
Differential Revision: https://reviews.llvm.org/D138132
Reviewed By: mkazantsev
LLVM GN Syncbot [Mon, 9 Jan 2023 09:00:23 +0000 (09:00 +0000)]
[gn build] Port
59b029238af2
Stephen Tozer [Tue, 3 Jan 2023 18:13:31 +0000 (18:13 +0000)]
[DebugInfo] Produce variadic DBG_INSTR_REFs from ISel
This patch modifies SelectionDAG and FastISel to produce DBG_INSTR_REFs with
variadic expressions, and produce DBG_INSTR_REFs for debug values with variadic
location expressions. The former essentially means just prepending
DW_OP_LLVM_arg, 0 to the existing expression. The latter is achieved in
MachineFunction::finalizeDebugInstrRefs and InstrEmitter::EmitDbgInstrRef.
Reviewed By: jmorse, Orlando
Differential Revision: https://reviews.llvm.org/D133929
Balázs Kéri [Mon, 9 Jan 2023 08:16:18 +0000 (09:16 +0100)]
[clang][analyzer] Remove report of null stream from StreamChecker.
The case of NULL stream passed to stream functions was reported by StreamChecker.
The same condition is checked already by StdLibraryFunctionsChecker and it is
enough to check at one place. The StreamChecker stops now analysis if a passed NULL
stream is encountered but generates no report.
This change removes a dependency between StdCLibraryFunctionArgs checker and
StreamChecker. There is now no more specific message reported by StreamChecker,
the previous weak-dependency is not needed. And StreamChecker can be used
without StdCLibraryFunctions checker or its ModelPOSIX option.
Reviewed By: Szelethus
Differential Revision: https://reviews.llvm.org/D137790
Guillaume Chatelet [Fri, 6 Jan 2023 16:33:56 +0000 (16:33 +0000)]
[reland][NFC] Vastly simplifies TypeSize
Simplifies the implementation of `TypeSize` while retaining its interface.
There is no need for abstract concepts like `LinearPolyBase`, `UnivariateLinearPolyBase` or `LinearPolySize`.
Differential Revision: https://reviews.llvm.org/D140263
zhongyunde [Mon, 9 Jan 2023 08:04:49 +0000 (16:04 +0800)]
[AArch64][SelectionDAG] Eliminates redundant zero-extension for 32-bit popcount
Fix https://github.com/llvm/llvm-project/issues/59597.
mov w8, w0 + fmov d0, x8 ==> fmov s0, w0
Reviewed By: dmgreen, efriedma
Differential Revision: https://reviews.llvm.org/D140649
Markus Böck [Sun, 8 Jan 2023 21:20:36 +0000 (22:20 +0100)]
[TableGen][SourceMgr] Correctly append filename to include directories
The current implementation unconditionally appends the system path separator with the filename to the include directory. This is not correct in edge cases however, such as when specifying `/` as include directory (on Unix systems) or just `\` on Windows.
This patch fixes that by using `sys::path::append`, which already has the required logic to correctly implement this.
While this is technically only a change in the `SourceMgr` class, I think the main user of that class, and the include mechanism, is TableGen.
No test attached because no behavioral difference is observable without trying to access the root directory of the users filesystem.
The motivation for this change is a rather funny story, as this actually fixes a performance problem when running `check-mlir` on Windows.
Some tests for `mlir-pdll-lsp-server` lead to adding `\` as include directory in TableGen (which is a valid absolute path on Windows!). Due to the unconditional append, the created filepath would then be of the form `\\<dir>\...` which is also a valid path on Windows, but is a network path. On my machine it'd then attempt to access the network and find a machine with the name `<dir>` and the file there. This call would take several seconds, leading to some tests in `mlir-pdll-lsp-server` taking 2 minutes on my machine.
Running `check-mlir` after this patch reduces the runtime on my machine from 161 seconds to 6 seconds.
Differential Revision: https://reviews.llvm.org/D141220
Max Kazantsev [Mon, 9 Jan 2023 06:50:07 +0000 (13:50 +0700)]
[NFC] Add missing 'static' notion in createReplacement
Serguei Katkov [Thu, 20 Oct 2022 05:05:33 +0000 (12:05 +0700)]
[Inline Spiller] Extend the snippet by statepoint uses
Snippet is a tiny live interval which has copy or fill like def
and copy or spill like use at the end (any of them might abcent).
Snippet has only one use/def inside interval and interval is located
in one basic block.
When inline spiller spills some reg around uses it also forces the
spilling of connected snippets those which got by splitting the
same original reg and its def is a full copy of our reg or its
last use is a full copy to our reg.
The definition of snippet is extended to allow not only one use/def
but more. However all other uses are statepoint instructions which will
fold fill into its operand. That way we do not introduce new fills/spills.
Reviewed By: qcolombet, dantrushin
Differential Revision: https://reviews.llvm.org/D138093
Uday Bondhugula [Mon, 9 Jan 2023 05:40:44 +0000 (11:10 +0530)]
[MLIR] NFC. Fix DEBUG_TYPE for AffineOps.cpp
Fix DEBUG_TYPE for AffineOps.cpp. NFC.
Differential Revision: https://reviews.llvm.org/D141252
liqinweng [Mon, 9 Jan 2023 04:56:10 +0000 (12:56 +0800)]
[RISCV][CostModel] Add half type support for the cost model of sqrt/fabs
1. Refactor for costs of sqrt/fabs
2. Add half type support for the cost model of sqrt/fabs
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D132908
NAKAMURA Takumi [Mon, 9 Jan 2023 03:15:19 +0000 (12:15 +0900)]
lldCOFF: Fix warnings for D110450 [-Wunused-private-field]
Chuanqi Xu [Mon, 9 Jan 2023 03:23:30 +0000 (11:23 +0800)]
[NFC] Fix the test failure in
08f957808e5f7e44b11d in armv8
The test in
08f957808e5f7e44b11d may fail in armv8 since the signature
of the constructor may be different. This patch tries to fix it.
liqinweng [Mon, 9 Jan 2023 03:38:24 +0000 (11:38 +0800)]
[RISCV][CostModel] Add cost model for integer abs
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D132999
Chuanqi Xu [Mon, 9 Jan 2023 02:43:35 +0000 (10:43 +0800)]
[C++20] [Modules] Don't generate global ctors/dtors for variables which are available externally
Closes https://github.com/llvm/llvm-project/issues/59765.
Currently we will generate the global ctor/dtor for variables in
importing modules. It will cause multiple initialization/destructions.
It makes no sense. This patch tries to not generate global ctor/dtor for
variables which are available externally. Note that the variables in
header units and clang modules won't be available externally by default.
Reviewed By: iains
Differential Revision: https://reviews.llvm.org/D140867
Chuanqi Xu [Mon, 9 Jan 2023 02:39:35 +0000 (10:39 +0800)]
[C++20] [Modules] Make placement allocation functions always visible
Close https://github.com/llvm/llvm-project/issues/59601.
This is actually a workaround for the issue. See the comments and the
test for example. The proper fix should make the placement allocation
functions acceptable based on the context. But it is harder and more
complex on the one side. On the other side, such workaround won't be too
bad in practice since users rarely call the placement allocation
functions directly.
So personally I prefer to address such problems in the simpler way.
Reviewed By: royjacobson
Differential Revision: https://reviews.llvm.org/D141023
chenglin.bi [Mon, 9 Jan 2023 02:21:05 +0000 (10:21 +0800)]
[InstCombine] Fold logic-and/logic-or by distributive laws part2
Follow up https://reviews.llvm.org/D139408, support `and/or+select` patterns
X && Z || Y && Z --> (X || Y) && Z
https://alive2.llvm.org/ce/z/EMCkBG
https://alive2.llvm.org/ce/z/Q-YRvr
https://alive2.llvm.org/ce/z/SFkVQc
https://alive2.llvm.org/ce/z/S9MCuJ
https://alive2.llvm.org/ce/z/KZ7zzz
(X || Z) && (Y || Z) --> (X && Y) || Z
https://alive2.llvm.org/ce/z/Ggpa8-
https://alive2.llvm.org/ce/z/nhQRLY
https://alive2.llvm.org/ce/z/zpmEnq
https://alive2.llvm.org/ce/z/7omsrf
https://alive2.llvm.org/ce/z/CWBzBp
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D139630
Kazu Hirata [Mon, 9 Jan 2023 00:31:45 +0000 (16:31 -0800)]
[CodeGen] Fix a warning
This patch fixes:
llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp:1220:13: error:
unused function 'locStr' [-Werror,-Wunused-function]
Nikolas Klauser [Mon, 9 Jan 2023 00:16:34 +0000 (01:16 +0100)]
[libc++] Add _LIBCPP_HIDE_FROM_ABI to __constexpr_logb and __constexpr_scalbn
Amy Huang [Thu, 14 Jul 2022 19:53:32 +0000 (15:53 -0400)]
[LLD] Remove global state in lld/COFF
Remove globals from the lldCOFF library, by moving globals into a context class.
This patch mostly moves the config object into COFFLinkerContext.
See https://lists.llvm.org/pipermail/llvm-dev/2021-June/151184.html for
context about removing globals from LLD.
Reviewed By: aganea
Differential Revision: https://reviews.llvm.org/D110450
Casey Carter [Sun, 8 Jan 2023 07:12:21 +0000 (23:12 -0800)]
[libc++][test] zip_view test cleanups
* The reference type of `common_input_iterator<const int*>` can't be `int&`, because an lvalue of type `const int` _can't_ bind to an `int&`. Fix by changing the return type of `operator*` to `decltype(auto)` to make it fully generic.
* `range.zip/iterator/compare.pass.cpp` verifies that the iterators of a `zip_view` don't support `<=>` when the underlying iterators do not; this is not true after LWG-3692.
* libc++ doesn't yet implement P2165R4 "Compatibility between tuple, pair and tuple-like objects", so the tests expect `zip_view` to use `pair` in places where the working draft requires `tuple`.
Differential Revision: https://reviews.llvm.org/D141216
Fangrui Song [Sun, 8 Jan 2023 23:27:21 +0000 (23:27 +0000)]
[AVR] Support .reloc directive
Reviewed By: benshi001
Differential Revision: https://reviews.llvm.org/D141176
Tue Ly [Sun, 8 Jan 2023 23:21:30 +0000 (18:21 -0500)]
[libc][Obvious] Temporarily disable log10_test for further investigation.
Tue Ly [Sun, 8 Jan 2023 22:52:46 +0000 (17:52 -0500)]
[libc][Obvious] Remove constexpr fomr exact_mult in double_double.h
Tue Ly [Sun, 8 Jan 2023 22:19:13 +0000 (17:19 -0500)]
[libc][math] Implement log10 function correctly rounded for all rounding modes
Implement double precision log10 function correctly rounded for all
rounding modes. This implementation currently needs FMA instructions for
correctness.
Use 2 passes:
Fast pass:
- 1 step range reduction with a lookup table of `2^7 = 128` elements to reduce the ranges to `[-2^-7, 2^-7]`.
- Use a degree-7 minimax polynomial generated by Sollya, evaluated using a mixed of double-double and double precisions.
- Apply Ziv's test for accuracy.
Accurate pass:
- Apply 5 more range reduction steps to reduce the ranges further to [-2^-27, 2^-27].
- Use a degree-4 minimax polynomial generated by Sollya, evaluated using 192-bit precisions.
- By the result of Lefevre (add quote), this is more than enough for correct rounding to all rounding modes.
In progress: Adding detail documentations about the algorithm.
Depend on: https://reviews.llvm.org/D136799
Reviewed By: zimmermann6
Differential Revision: https://reviews.llvm.org/D139846
Shilei Tian [Sun, 8 Jan 2023 21:45:42 +0000 (16:45 -0500)]
[AAUnderlyingObjects] Introduce an AA for getting underlying objects of a pointer
This patch introduces a new AA `AAUnderlyingObjects`. It is basically like a wrapper
AA of the function `AA::getAssumedUnderlyingObjects`, but it can recursively do
query if the underlying object is an indirect access, such as a phi node or a select
instruction.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D141164
Jeff Niu [Thu, 8 Dec 2022 20:22:40 +0000 (12:22 -0800)]
[mlir][analysis] Add an analysis for preserving symbol tables
This patch adds a `SymbolTableAnalysis` that can be used with the
analysis manager. It contains a symbol table collection. This analysis
allows symbol tables to be preserved across passes so that they do not
need to be recomputed. The analysis assumes it remains valid because
most transformations automatically keep symbol tables up-to-date using
its `insert` and `erase` methods.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D139666
Pavel Iliin [Fri, 30 Dec 2022 13:34:45 +0000 (13:34 +0000)]
[AArch64][compiler-rt] Option to build compiler-rt without FMV support.
This commit adds compiler-rt cmake option COMPILER_RT_DISABLE_AARCH64_FMV
which, when enabled, doesn't include function multiversioning features
initilization code in 'builtins' build.
Differential Revision: https://reviews.llvm.org/D141199
Simon Pilgrim [Sun, 8 Jan 2023 19:05:54 +0000 (19:05 +0000)]
[X86] Add shuffle test coverage for Issue #59860