Konstantin Varlamov [Sat, 18 Jun 2022 09:22:26 +0000 (02:22 -0700)]
[libc++][ranges][NFC] Fix a format error on the ranges status page.
Matthias Springer [Sat, 18 Jun 2022 08:23:31 +0000 (10:23 +0200)]
[mlir][bufferization] Set emitAccessorPrefix dialect flag
Generate get/set accessors on all bufferization ops. Also update all internal uses.
Differential Revision: https://reviews.llvm.org/D128057
Benjamin Kramer [Sat, 18 Jun 2022 08:07:51 +0000 (10:07 +0200)]
[mlir] Fix an msvc warning
Float16bits.cpp(148): warning C4067: unexpected tokens following preprocessor directive - expected a newline
Siva Chandra [Fri, 17 Jun 2022 05:58:45 +0000 (22:58 -0700)]
[libc] Add TLS image initialization to aarch64 startup code.
The TLS loader test has been enabled for aarch64.
Handling of PT_TLS' filesz and memsz for x86_64 has also been fixed.
Reviewed By: jeffbailey
Differential Revision: https://reviews.llvm.org/D128032
Han-Kuan Chen [Fri, 17 Jun 2022 08:34:17 +0000 (01:34 -0700)]
[MachineCopyPropagation][RISCV] Fix D125335 accidentally change control flow.
D125335 makes regsOverlap skip following control flow, which is not entended
in the original code.
Differential Revision: https://reviews.llvm.org/D128039
Han-Kuan Chen [Fri, 17 Jun 2022 08:34:10 +0000 (01:34 -0700)]
[MachineCopyPropagation][RISCV] Add test case showing failure for MachineCopyPropagation. NFC
This is a pre-commit test cases for D128039.
Differential Revision: https://reviews.llvm.org/D128040
NAKAMURA Takumi [Sat, 18 Jun 2022 04:15:40 +0000 (13:15 +0900)]
[Bazel] Rename generated *_main.cpp to [tool-name]-driver.cpp which CMake uses.
Fixup to llvmorg-15-init-12347-gf06abbb39380
The difference of basename affects its emitted object file.
FIXME: Each rule's name is left as origin.
Chris Bieneman [Sat, 18 Jun 2022 02:41:58 +0000 (21:41 -0500)]
bzero->memset - Fix Windows bots
How does Windows not have bzero? How did I break this while working on
a Windows-specific component of LLVM?
The world may never know...
Chris Bieneman [Mon, 6 Jun 2022 21:27:40 +0000 (16:27 -0500)]
[DirectX] Add DirectX target object writer
This is the last piece to bring together writing DXContainer files
containing DXIL through the DirectX backend.
While this change only has one test, all of the tests under
llvm/test/tools/dxil-dis also exercise this code. With this change the
output object file type for the dxil target is now DXContainer. Each of
the existing tests will generate DXContainer files, and the dxil-dis
tests additionally verify that the DXContainers generated are
well-formed and can be parsed by the DirectXShaderCompiler tools.
Depends on D127153 and D127165
Differential Revision: https://reviews.llvm.org/D127166
LLVM GN Syncbot [Sat, 18 Jun 2022 02:23:50 +0000 (02:23 +0000)]
[gn build] Port
3adc908b2685
Chris Bieneman [Mon, 6 Jun 2022 22:18:08 +0000 (17:18 -0500)]
[DirectX][MC] Add MC support for DXContainer
DXContainer files resemble traditional object files in that they are
comprised of parts which resemble sections. Adding DXContainer as an
object file format in the MC layer will allow emitting DXContainer
objects through the normal object emission pipeline.
Differential Revision: https://reviews.llvm.org/D127165
Chris Bieneman [Mon, 6 Jun 2022 20:58:24 +0000 (15:58 -0500)]
[DirectX] Add DXILAsmPrinter
The DXILAsmPrinter will just write globals into sections, so the
DXILAsmPrinter only needs support for emitting global variables, and is
otherwise a stub.
Depends on D127147
Differential Revision: https://reviews.llvm.org/D127153
Chris Bieneman [Mon, 6 Jun 2022 20:34:47 +0000 (15:34 -0500)]
[DirectX] Add MC Register and Frame stubs
This patch adds no-op stubs overrides for the MCRegisterInfo and
MCFrameLowering for the DirectX/DXIL code generation path.
Since DXIL will not generate MCInstrs these stubs do nothing, but they
need to exist so that the MC layer can be used to emit DXContainer
objects.
Differential Revision: https://reviews.llvm.org/D127147
Felipe de Azevedo Piovezan [Sat, 18 Jun 2022 00:48:40 +0000 (00:48 +0000)]
llvm-dwarf-dump: include type name for AT_containing_type
Type attributes are currently printed as:
DW_AT_type (<address> "<name>")
For example:
DW_AT_type (0x00000086 "double")
However, containing_type attributes omit the name, for example:
DW_AT_containing_type (0x00000086)
In order to make the dwarf dumps easier to read, and to have consistency
between the type-like attributes, this commit changes the way
DW_AT_containing_type is printed so that it includes the name of the
type it refers to:
DW_AT_containing_type (0x00000086 "double")
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D127078
Vitaly Buka [Sat, 18 Jun 2022 00:36:51 +0000 (17:36 -0700)]
[CodeGen] Init EmptyExpr before the first use
David Blaikie [Sat, 18 Jun 2022 00:35:32 +0000 (00:35 +0000)]
Add unit test coverage for cast<T> assertion failures on invalid cast
Akira Hatanaka [Fri, 13 May 2022 21:24:27 +0000 (14:24 -0700)]
Stop wrapping GCCAsmStmts inside StmtExprs to destruct temporaries
Instead, just pop the cleanups at the end of the asm statement.
This fixes an assertion failure in BuildStmtExpr. It also fixes a bug
where blocks and C compound literals were destructed at the end of the
asm statement instead of at the end of the enclosing scope.
Differential Revision: https://reviews.llvm.org/D125936
Michael Jones [Thu, 16 Jun 2022 18:24:42 +0000 (11:24 -0700)]
[libc] add printf pointer conv
The pointer converter handles the %p conversion. It uses the hex
converter for most of the conversion.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D127995
Huan Nguyen [Fri, 17 Jun 2022 23:17:22 +0000 (16:17 -0700)]
[BOLT] Allow function fragments to point to one jump table
Resolve a crash related to split functions
Due to split function optimization, a function can be divided to two
fragments, and both fragments can access same jump table. This
violates
the assumption that a jump table can only have one parent
function,
which causes a crash during instrumentation.
We want to support the case: different functions cannot access same
jump tables, but different fragments of same function can!
As all fragments are from same function, we point JT::Parent to one
specific fragment. Right now it is the first disassembled fragment, but
we can point it to the function's main fragment later.
Functions are disassembled sequentially. Previously, at the end of
processing a function, JT::OffsetEntries is cleared, so other fragment
can no longer reuse JT::OffsetEntries. To extend the support for split
function, we only clear JT::OffsetEntries after all functions are
disassembled.
Let say A.hot and A.cold access JT of three targets {X, Y, Z}, where
X and Y are in A.hot, and Z is in A.cold. Suppose that A.hot is
disassembled first, JT::OffsetEntries = {X',Y',INVALID_OFFSET}. When
A.cold is disassembled, it cannot reuse JT::OffsetEntries above due to
different fragment start. A simple solution:
A.hot = {X',Y',INVALID_OFFSET}
A.cold = {INVALID_OFFSET, INVALID_OFFSET, INVALID_OFFSET}
We update the assertion to allow different fragments of same function
to get the same JumpTable object.
Potential improvements:
A.hot = {X',Y',INVALID_OFFSET}
A.cold = {INVALID_OFFSET, INVALID_OFFSET, Z'}
The main issue is A.hot and A.cold have separate CFGs, thus jump table
targets are still constrained within fragment bounds.
Future improvements:
A.hot = {X, Y, Z}
A.cold = {X, Y, Z}
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D127924
bixia1 [Fri, 17 Jun 2022 22:35:45 +0000 (15:35 -0700)]
[mlir][sparse][taco] Support complex types.
Support complex types of float and double. See the added test for an example.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D128076
Arthur Eubanks [Fri, 17 Jun 2022 22:49:48 +0000 (15:49 -0700)]
[test][RPOFuncAttrs] Update norecurse.ll
Use opaque pointers, remove obsolete FIXMEs, precommit test.
Add extra `CHECK-NOT: norecurse`s because it can appear before the checked attributes.
Christopher Bate [Fri, 17 Jun 2022 19:02:47 +0000 (13:02 -0600)]
[mlir][nvgpu] fix MSVC warning regarding left shift
Differential Revision: https://reviews.llvm.org/D128088
Jonas Devlieghere [Fri, 17 Jun 2022 22:03:12 +0000 (15:03 -0700)]
[lldb] Fix modernize-use-equals-default warnings (NFC)
Fix modernize-use-equals-default warnings. Because this check is listed
in LLDB's top level .clang-tidy configuration, the check is enabled by
default and the resulting warnings show up in my editor.
I've audited the modified lines. This is not a blind change.
Jonas Devlieghere [Fri, 17 Jun 2022 21:50:32 +0000 (14:50 -0700)]
[lldb] Fix modernize-use-override warnings (NFC)
Fix modernize-use-override warnings. Because this check is listed in
LLDB's top level .clang-tidy configuration, the check is enabled by
default and the resulting warnings show up in my editor.
I've audited the modified lines. This is not a blind change.
Jan Svoboda [Fri, 17 Jun 2022 21:31:07 +0000 (23:31 +0200)]
[clang][driver] Ensure we don't accumulate entries in -MJ files
Previously, each job would overwrite the -MJ file. This didn't quite work for Clang invocations with multiple architectures, which got fixed in D121997 by always appending to the -MJ file. That's not correct either, since the file would grow indefinitely on subsequent Clang invocations. This patch ensures the driver always removes the file before jobs fill it in by appending.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D128098
Sunho Kim [Fri, 17 Jun 2022 21:35:29 +0000 (06:35 +0900)]
[clang-repl] Remove memory leak of ASTContext/TargetMachine.
Removes memory leak of ASTContext and TargetMachine. When DisableFree is turned on, it intentionally leaks these instances as they can be trivially deallocated. This patch turns this off and delete Parser instance early so that they will not reference dangling pargma headers.
Asan shouldn't detect these as leaks normally, since burypointer is called for them. But, every invocation of incremental parser createa an additional leak of TargetMachine. If there are many invocations within a single test case, we easily reach number of leaks exceeding kGraveYardMaxSize (which is 12) and leaks start to get reported by asan buildbots.
Reviewed By: v.g.vassilev
Differential Revision: https://reviews.llvm.org/D127991
Louis Dionne [Fri, 10 Jun 2022 19:10:26 +0000 (15:10 -0400)]
[libc++] Make sure we install libc++abi headers on Apple
Differential Revision: https://reviews.llvm.org/D127526
Dave Lee [Fri, 17 Jun 2022 00:38:47 +0000 (17:38 -0700)]
[lldb][tests] Automatically call compute_mydir (NFC)
Eliminate boilerplate of having each test manually assign to `mydir` by calling
`compute_mydir` in lldbtest.py.
Differential Revision: https://reviews.llvm.org/D128077
Louis Dionne [Thu, 16 Jun 2022 17:39:01 +0000 (13:39 -0400)]
[libc++] Don't force -O2 when building the benchmarks
The optimization level used when building the benchmarks should
match the optimization level of the current build. Otherwise, we
can end up mixing an -O3 or -O0 optimized dylib with benchmarks
built with -O2, which is really misleading.
Differential Revision: https://reviews.llvm.org/D127987
Craig Topper [Fri, 17 Jun 2022 21:10:39 +0000 (14:10 -0700)]
[RISCV] Use RVVBitsPerBlock instead of hardcoding multiples of 64. NFC
Benjamin Kramer [Fri, 17 Jun 2022 20:40:00 +0000 (22:40 +0200)]
[mlir][sparse] Inline the definition of LLVM_ATTRIBUTE_WEAK
This library is supposed not to have a dependency on LLVM, and linking
LLVMSupport into it breaks its shared library setup.
Rafael Auler [Fri, 17 Jun 2022 20:04:40 +0000 (13:04 -0700)]
[BOLT] Fix for missing entry offset
Temporary fix for missing entry offset when creating address
translation tables (BAT) after D127935 landed. Will later work on
assigning a more reasonable offset different than zero.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D128092
Benjamin Kramer [Fri, 17 Jun 2022 20:09:13 +0000 (22:09 +0200)]
[bazel] Add missing dependency after
455679413
This is supposed to be header-only. Don't know how to express that in
bazel.
Benjamin Kramer [Fri, 17 Jun 2022 08:25:43 +0000 (10:25 +0200)]
[mlir][sparse] Add testing for bf16 and fallback for software bf16
This adds weak versions of the truncation libcalls in case the runtime
environment doesn't have them.
Differential Revision: https://reviews.llvm.org/D128091
Aart Bik [Fri, 17 Jun 2022 18:56:52 +0000 (11:56 -0700)]
[mlir][sparse] renable f16 tests
Sparse library ABI issues are fixed.
https://github.com/llvm/llvm-project/issues/55992
Reviewed By: bkramer
Differential Revision: https://reviews.llvm.org/D128086
Philip Reames [Fri, 17 Jun 2022 19:20:20 +0000 (12:20 -0700)]
[RISCV] Remove redundant code checking for exact VTYPE match [nfc]
Should be fully covered by the generic demanded field based logic just below, and this ensures better coverage of that logic.
Philip Reames [Fri, 17 Jun 2022 19:05:58 +0000 (12:05 -0700)]
[RISCV] Move store policy and mask reg ops into demanded handling in InsertVSETVLI
Doing so let's the post-mutation pass leverage the demanded info to rewrite vsetvlis before a store/mask-op to eliminate later vsetvlis.
Sorry for the lack of store test change; all of my attempts to write something reasonable have been handled through existing logic.
Florian Hahn [Fri, 17 Jun 2022 19:06:25 +0000 (21:06 +0200)]
Recommit "[LAA] Initial support for runtime checks with pointer selects."
This reverts commit
7aa8a678826dea86ff3e6c7df9d2a8a6ef868f5d.
This version includes fixes to address issues uncovered after
the commit landed and discussed at D11448.
Those include:
* Limit select-traversal to selects inside the loop.
* Freeze pointers resulting from looking through selects to avoid
branch-on-poison.
Sanjay Patel [Fri, 17 Jun 2022 18:10:13 +0000 (14:10 -0400)]
[AArch64] add tests for masked subtract; NFC
Nikolas Klauser [Thu, 16 Jun 2022 20:43:46 +0000 (22:43 +0200)]
[libc++] Mark standard-mandated includes as such
Reviewed By: ldionne, Mordante, #libc, saugustine
Spies: saugustine, MaskRay, arichardson, mstorsjo, jloser, libcxx-commits, arphaman
Differential Revision: https://reviews.llvm.org/D127953
Chris Bieneman [Mon, 13 Jun 2022 15:05:03 +0000 (10:05 -0500)]
[docs] Adding table of object file formats
The added section and table here list the object file formats LLVM MC
supports and which targets support each format.
Differential Revision: https://reviews.llvm.org/D127645
Chris Bieneman [Fri, 17 Jun 2022 18:36:53 +0000 (13:36 -0500)]
Revert "wip"
This reverts commit
0dd243fa8a4ec98d6cabbad16e6b485a093c6dea.
I accidentally pushed this! Oops!
Frederik Gossen [Fri, 17 Jun 2022 18:31:44 +0000 (14:31 -0400)]
[mlir][nvgpu] Fix Bazel BUILD file
Differential Revision: https://reviews.llvm.org/D128078
Chris Bieneman [Mon, 13 Jun 2022 14:38:07 +0000 (09:38 -0500)]
[docs] Adding DirectX target usage doc
This document is a work in progress to begin fleshing out documentation
for the DirectX backend and related changes in the LLVM project.
This is not intended to be exhaustive or complete, it is intended as a
starting
point so taht future changes have a place for documentation to land.
Differential Revision: https://reviews.llvm.org/D127640
Chris Bieneman [Thu, 16 Jun 2022 20:35:48 +0000 (15:35 -0500)]
wip
Arthur Eubanks [Fri, 17 Jun 2022 18:29:07 +0000 (11:29 -0700)]
[docs] Fix typo
isuckatcs [Mon, 13 Jun 2022 13:53:31 +0000 (15:53 +0200)]
[Static Analyzer] Structured binding to data members
Introducing structured binding to data members.
Differential Revision: https://reviews.llvm.org/D127643
Stanislav Gatev [Thu, 16 Jun 2022 21:57:28 +0000 (21:57 +0000)]
[clang][dataflow] Add support for comma binary operator
Add support for comma binary operator.
Differential Revision: https://reviews.llvm.org/D128013
Reviewed-by: ymandel, xazax.hun
Philip Reames [Fri, 17 Jun 2022 17:40:48 +0000 (10:40 -0700)]
[riscv] Extract isMaskRegOp helper [nfc]
Nico Weber [Fri, 17 Jun 2022 17:37:11 +0000 (13:37 -0400)]
[gn build] (manually) port
2040b6df0a3f (DebugInfoSymbolizerTests)
Daniel Thornburgh [Thu, 7 Apr 2022 23:37:11 +0000 (23:37 +0000)]
[Symbolize] Parser for log symbolizer markup.
This adds a parser for the log symbolizer markup format discussed in
https://discourse.llvm.org/t/rfc-log-symbolizer/61282. The parser
operates in a line-by-line fashion with minimal memory requirements.
This doesn't yet include support for multi-line tags or specific parsing
for ANSI X3.64 SGR control sequences, but it can be extended to do so.
The latter can also be relatively easily handled by examining the
resulting text elements.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D124686
Kiran Chandramohan [Fri, 17 Jun 2022 17:07:12 +0000 (17:07 +0000)]
[Flang] Fixes for XArrayCoorOp
The upstreamed code was not incrementing the sliceOffset in multiples
of 3. This issue is fixed by using Offsets and incrementing by 3 during
every iteration.
In the conversion pattern, we were comparing the definingOp of an
operand with an FIR::UndefOp. Use LLVM::UndefOp for conversion.
Reviewed By: clementval, Leporacanthicus
Differential Revision: https://reviews.llvm.org/D128017
LLVM GN Syncbot [Fri, 17 Jun 2022 17:10:15 +0000 (17:10 +0000)]
[gn build] Port
971e9c80e966
Nikolas Klauser [Fri, 17 Jun 2022 14:02:53 +0000 (16:02 +0200)]
[libc++] Implement std::boyer_moore{, _horspool}_searcher
This mostly copys the `<experimental/functional>` stuff and updates the code to current libc++ style.
Reviewed By: ldionne, #libc
Spies: nlopes, adamdebreceni, arichardson, libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D121074
Philip Reames [Fri, 17 Jun 2022 15:47:35 +0000 (08:47 -0700)]
[RISCV] Delete dead elideCopy code in InsertVSETVLI [nfc]
This code should be dead. A simple whole register copy of an IMPLICIT_DEF, is simply an IMPLICIT_DEF of it's own. (This would not be true for freeze, but is for copy.) If we find a case which gets here with vector operand copy of an IMPLICIT_DEF, we most likely have an earlier missed optimization anyways. (The most recent case of this was e6c7a3a, found by Craig during review of this patch.) There might be others, and if so, we'll revisit them individually as regressions are reported.
Differential Revision: https://reviews.llvm.org/D127996
Joe Nash [Fri, 17 Jun 2022 16:23:01 +0000 (12:23 -0400)]
[AMDGPU] NFC. Change comment format on gfx11 interp and ldsdir intrinsics
isuckatcs [Fri, 17 Jun 2022 14:40:47 +0000 (16:40 +0200)]
[Static Analyzer] Small array binding policy
If a lazyCompoundVal to a struct is bound to the store, there is a policy which decides
whether a copy gets created instead.
This patch introduces a similar policy for arrays, which is required to model structured
binding to arrays without false negatives.
Differential Revision: https://reviews.llvm.org/D128064
Michael Jones [Thu, 16 Jun 2022 17:12:23 +0000 (10:12 -0700)]
[libc][obvious] fix sign warning in file_writer
In the sign writer, a size_t was being compared to an int. This patch
casts the size_t to an int so that the comparison doesn't cause a sign
comparison warning.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D127984
Nikolas Klauser [Fri, 17 Jun 2022 13:59:53 +0000 (15:59 +0200)]
[libc++] Unwrap reverse_iterator<reverse_iterator<Iter>> in __unwrap_iter
Simplify the implementation of `std::copy` and `std::move` by using `__unwrap_iter` and `__rewrap_iter` to unwrap and rewrap `reverse_iterator<reverse_iterator<Iter>>` instead of specializing `__copy_impl` and `__move_impl`.
Reviewed By: ldionne, #libc
Spies: wenlei, libcxx-commits
Differential Revision: https://reviews.llvm.org/D127049
Martin Sebor [Fri, 17 Jun 2022 16:09:44 +0000 (10:09 -0600)]
[InstCombine] Fold memcmp of constant arrays and variable size
The memcmp simplifier is limited to folding to constants calls with constant
arrays and constant sizes. This change adds the ability to simplify
memcmp(A, B, N) calls with constant A and B and variable N to the pseudocode
equivalent of
N <= Pos ? 0 : (A < B ? -1 : B < A ? +1 : 0)
where Pos is the offset of the first mismatch between A and B.
Differential Revision: https://reviews.llvm.org/D127766
isuckatcs [Thu, 16 Jun 2022 17:57:25 +0000 (19:57 +0200)]
[Static Analyzer][CFG] Introducing the source array in the CFG of DecompositionDecl
For DecompositionDecl, the array, which is being decomposed was not present in the
CFG, which lead to the liveness analysis falsely detecting it as a dead symbol.
Differential Revision: https://reviews.llvm.org/D127993
bixia1 [Thu, 16 Jun 2022 21:27:26 +0000 (14:27 -0700)]
[mlir][linalg] Extend opdsl to support operations on complex types.
Linalg opdsl now supports negf/add/sub/mul on complex types.
Add a test.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D128010
Adrian Prantl [Fri, 17 Jun 2022 16:26:01 +0000 (09:26 -0700)]
[LLDB][ExpressionParser] Fix indices inside format-strings passed to LLDB_LOG
llvm::formatv expects the parameter indexes to start with 0.
Unfortunately it doesn't detect out-of-bounds accesses in the format
string at compile-time, of which we had several inside ClangExpressionDeclMap.
This patch fixes these out-of-bounds format accesses.
Example output
Before
ClangExpressionDeclMap::FindExternalVisibleDecls for '$__lldb_class' in a
'TranslationUnit'
CEDM::FEVD Searching the root namespace
CEDM::FEVD Adding type for $__lldb_class: 1
After
ClangExpressionDeclMap::FindExternalVisibleDecls for '$__lldb_class' in
a 'TranslationUnit'
CEDM::FEVD Searching the root namespace
CEDM::FEVD Adding type for $__lldb_class: class (lambda)
Patch by Michael Buch!
Differential Revision: https://reviews.llvm.org/D128063
Nico Weber [Fri, 17 Jun 2022 13:04:57 +0000 (09:04 -0400)]
[gn build] (manually) port
7cca33b40f77c
Not really needed for anything as far as I can tell (?),
more for completeness.
Christopher Bate [Fri, 17 Jun 2022 15:42:49 +0000 (09:42 -0600)]
[mlir][nvgpu] fix missing build dependency for NVGPUTransforms
Fixes build failure caused by
51b925df941a66349deff2467203acc200de5e78
Aart Bik [Fri, 17 Jun 2022 00:01:42 +0000 (17:01 -0700)]
[mlir][sparse] move from by-value to by-reference for data types
This fixes all sorts of ABI issues due to passing by-value
(using by-reference with memref's exclusively).
Reviewed By: bkramer
Differential Revision: https://reviews.llvm.org/D128018
Christopher Bate [Tue, 7 Jun 2022 16:51:27 +0000 (10:51 -0600)]
[mlir][nvgpu] shared memory access optimization pass
This change adds a transformation and pass to the NvGPU dialect that
attempts to optimize reads/writes from a memref representing GPU shared
memory in order to avoid bank conflicts. Given a value representing a
shared memory memref, it traverses all reads/writes within the parent op
and, subject to suitable conditions, rewrites all last dimension index
values such that element locations in the final (col) dimension are
given by
`newColIdx = col % vecSize + perm[row](col/vecSize,row)`
where `perm` is a permutation function indexed by `row` and `vecSize`
is the vector access size in elements (currently assumes 128bit
vectorized accesses, but this can be made a parameter). This specific
transformation can help optimize typical distributed & vectorized accesses
common to loading matrix multiplication operands to/from shared memory.
Differential Revision: https://reviews.llvm.org/D127457
Guillaume Chatelet [Fri, 17 Jun 2022 15:13:10 +0000 (15:13 +0000)]
[NFC][Alignment] Remove assumeAligned from MachineFrameInfo ctor
Quinn Pham [Fri, 17 Jun 2022 14:33:32 +0000 (09:33 -0500)]
[PowerPC] Fix PPCVSXSwapRemoval pass to include MTVSCR and MFVSCR as not swappable.
This patch adds the instructions `MTVSCR` and `MFVSCR` as not swappable to the
PPCVSXSwapRemoval pass because they are not lane-insensitive. This will prevent
the compiler from optimizing out required swaps when using `lxvd2x` and
`stxvd2x`.
Reviewed By: #powerpc, nemanjai
Differential Revision: https://reviews.llvm.org/D128062
Philip Reames [Fri, 17 Jun 2022 15:01:49 +0000 (08:01 -0700)]
[RISCV] Avoid changing etype for splat of 0 or -1
A splat of the values 0 and -1 as sign extended 12 bit immediates are always the same bit pattern regardless of the etype used to perform the operation. As a result, we can sometimes avoid introducing a vsetvli just for the purposes of a splat.
Looking at the diffs, we don't get a huge amount of immediate value out of this. We mostly push the vsetvli one instruction down, usually in front of a vmerge. We also don't get the corresponding fixed length vector cases because VL typically is changed despite the actual bits written being the same. Both of these are areas I plan to explore in future patches.
Interestingly, this makes a great example of why we need the forward and backward implementation to be consistent. Before we merged the demanded field handling, if we implement only the forward direction, we lost the ability to mutate a prior vsetvli and eliminate a later one entirely. This resulted in practical regressions instead of improvements. It's always nice when practice matches theory. :)
Differential Revision: https://reviews.llvm.org/D128006
Ben Langmuir [Thu, 16 Jun 2022 21:00:35 +0000 (14:00 -0700)]
[clang][deps] Sort submodules when calculating dependencies
Dependency scanning does not care about the order of submodules for
correctness, so sort the submodules so that we get the same
command-lines to build the module across different TUs. The order of
inferred submodules can vary depending on the order of #includes in the
including TU.
Differential Revision: https://reviews.llvm.org/D128008
Sanjay Patel [Fri, 17 Jun 2022 14:41:00 +0000 (10:41 -0400)]
[InstCombine] convert mask and shift of power-of-2 to cmp+select
When the mask is a power-of-2 constant and op0 is a shifted-power-of-2
constant, test if the shift amount equals the offset bit index:
(ShiftC << X) & C --> X == (log2(C) - log2(ShiftC)) ? C : 0
(ShiftC >> X) & C --> X == (log2(ShiftC) - log2(C)) ? C : 0
This is an alternate to D127610 with a more general pattern.
We match only shift+and instead of the trailing xor, so we see a few
more tests diffs. I think we discussed this initially in D126617.
Here are proofs for shifts in both directions:
https://alive2.llvm.org/ce/z/CFrLs4
The test diffs look equal or better for IR, and this makes the
patterns more uniform in IR. The backend can partially invert this
in both cases if that is profitable. It is not trivially reversible,
however, so if we find perf regressions that are not easy to undo,
then we may want to revert this.
Differential Revision: https://reviews.llvm.org/D127801
Kadir Cetinkaya [Fri, 17 Jun 2022 14:47:29 +0000 (16:47 +0200)]
Revert "Revert "[clang] Dont print implicit forrange initializer""
This reverts commit
7aac15d5df6cfa03b802e055b63227a95fa1734e.
Only updates the tests, as these statements are still part of the CFG
and its just the pretty printer policy that changes. Hopefully this
shouldn't affect any analysis.
Guillaume Chatelet [Fri, 17 Jun 2022 13:28:47 +0000 (13:28 +0000)]
[libc] Rely on __builtin_memcpy_inline for memcpy implementation
This patch removes usage of `-mllvm -combiner-global-alias-analysis`
and relies on compiler builtin to implement `memcpy`.
Note that `-mllvm -combiner-global-alias-analysis` is actually only useful for
functions where buffers can alias (namely `memcpy` and `memmove`). The other
memory functions where not benefiting from the flag anyways.
The upside is that the memory functions can now be compiled from source with
thinlto (thinlto would not be able to carry on the flag when doing inlining).
The downside is that for compilers other than clang (i.e. not providing
`__builtin_memcpy_inline`) the codegen may be worse.
Differential Revision: https://reviews.llvm.org/D128051
Eric Schweitz [Fri, 17 Jun 2022 14:09:32 +0000 (16:09 +0200)]
[flang] Fix bug in character casting. Add missing sext/trunc in code gen.
This patch is part of the upstreaming effort from fir-dev branch.
It also ensures all descriptors created inline complies with LBOUND
requirement that the lower bound is `1` when the related dimension
extent is zero.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: jeanPerier, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D128047
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Joe Nash [Tue, 14 Jun 2022 19:57:17 +0000 (15:57 -0400)]
[AMDGPU] gfx11 waitcnt support for VINTERP and LDSDIR instructions
Reviewed By: rampitec, #amdgpu
Differential Revision: https://reviews.llvm.org/D127781
Malhar Jajoo [Fri, 17 Jun 2022 13:01:04 +0000 (14:01 +0100)]
[LoopVectorize] Add support for invariant stores of ordered reductions
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D126772
Nikolas Klauser [Fri, 17 Jun 2022 11:58:22 +0000 (13:58 +0200)]
[libc++] Simplify __config a bit
Simplify logic in `__config` by assuming that we are using Clang in C++03 mode. Also, use standardized feature-test macros instead of compiler-specific checks (like `__has_feature`) in a couple of places.
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D127606
Joe Nash [Thu, 9 Jun 2022 19:10:47 +0000 (15:10 -0400)]
[AMDGPU] gfx11 VINTERP intrinsics and ISel support
Depends on D127664
Reviewed By: rampitec, #amdgpu
Differential Revision: https://reviews.llvm.org/D127756
Tue Ly [Fri, 17 Jun 2022 13:32:06 +0000 (09:32 -0400)]
[libc][Obvious] Fix hyperlink and typo in math status page.
Phoebe Wang [Fri, 17 Jun 2022 13:09:19 +0000 (21:09 +0800)]
Reland "Reland "Reland "Reland "[X86][RFC] Enable `_Float16` type support on X86 following the psABI""""
This resolves problems reported in commit
1a20252978c76cf2518aa45b175a9e5d6d36c4f0.
1. Promote to float lowering for nodes XINT_TO_FP
2. Bail out f16 from shuffle combine due to vector type is not legal in the version
Joe Nash [Mon, 13 Jun 2022 14:38:48 +0000 (10:38 -0400)]
[AMDGPU] gfx11 ldsdir intrinsics and ISel
Reviewed By: #amdgpu, rampitec
Differential Revision: https://reviews.llvm.org/D127664
Jay Foad [Fri, 17 Jun 2022 13:25:13 +0000 (14:25 +0100)]
[AMDGPU] More GFX11 test coverage
Nikita Popov [Thu, 16 Jun 2022 10:13:37 +0000 (12:13 +0200)]
[InstCombine] Push freeze through recurrence phi
We really want to push freezes through recurrence phis, so that we
freeze only the start value, rather than the IV value on every
iteration. foldOpIntoPhi() already handles this for the case where
the transfer function doesn't produce poison, e.g.
%iv.next = add %iv, 1. However, this does not work if nowrap flags
are present, e.g. the very common %iv.next = add nuw %iv, 1 case.
This patch adds a fold that pushes freeze instructions to the start
value by checking whether all backedge values will be non-poison
after poison generating flags have been dropped. This allows pushing
freezes out of loops in most cases. I suspect that this also
obsoletes the CanonicalizeFreezeInLoops pass, and we can probably
drop it.
Fixes https://github.com/llvm/llvm-project/issues/56048.
Differential Revision: https://reviews.llvm.org/D127960
Nico Weber [Fri, 17 Jun 2022 12:58:48 +0000 (08:58 -0400)]
Revert "[clang] Dont print implicit forrange initializer"
This reverts commit
32805e60c9de1f82887cd2af30d247dcabd2e1d3.
Broke check-clang, see comments on https://reviews.llvm.org/D127863
Sanjay Patel [Fri, 17 Jun 2022 12:19:07 +0000 (08:19 -0400)]
[InstCombine] add tests for FP casts; NFC
Sanjay Patel [Wed, 15 Jun 2022 21:31:58 +0000 (17:31 -0400)]
[InstCombine] add tests for (pow2 >> X) >u C; NFC
Paul Walker [Thu, 9 Jun 2022 03:03:10 +0000 (04:03 +0100)]
[SelectionDAG] Extend WidenVecOp_INSERT_SUBVECTOR to cover more cases.
WidenVecOp_INSERT_SUBVECTOR only supported cases where widening
effectively converts the insert into a copy. However, when the
widened subvector is no bigger than the vector being inserted into
and we can be sure there's no loss of data, we can simply emit
another INSERT_SUBVECTOR.
Fixes: #54982
Differential Revision: https://reviews.llvm.org/D127508
Nico Weber [Fri, 17 Jun 2022 12:35:45 +0000 (08:35 -0400)]
[gn build] (semi-manually) port
232bd331cbaa
Michał Górny [Fri, 17 Jun 2022 09:16:30 +0000 (11:16 +0200)]
[lldb] [test] Update baseline test status for FreeBSD
Fixes #19721
Fixes #18440
Partially fixes bug #47660
Fixes #47761
Fixes #47763
Sponsored by: The FreeBSD Foundation
Matthias Springer [Fri, 17 Jun 2022 12:01:25 +0000 (14:01 +0200)]
[mlir][bufferize][NFC] Remove BufferizationState
With the recent refactorings, this class is no longer needed. We can use BufferizationOptions in all places were BufferizationState was used.
Differential Revision: https://reviews.llvm.org/D127653
Jolanta Jensen [Fri, 17 Jun 2022 11:15:19 +0000 (12:15 +0100)]
[Clang] Allow 'Complex float __attribute__((mode(HC)))'
Adding half float to types that can be represented by __attribute__((mode(xx))).
Original implementation authored by George Steed.
Differential Revision: https://reviews.llvm.org/D126479
Matthias Springer [Fri, 17 Jun 2022 11:23:25 +0000 (13:23 +0200)]
[mlir][bufferize] Bufferize after TensorCopyInsertion
This change changes the bufferization so that it utilizes the new TensorCopyInsertion pass. One-Shot Bufferize no longer calls the One-Shot Analysis. Instead, it relies on the TensorCopyInsertion pass to make the entire IR fully inplacable. The `bufferize` implementations of all ops are simplified; they no longer have to account for out-of-place bufferization decisions. These were already materialized in the IR in the form of `bufferization.alloc_tensor` ops during the TensorCopyInsertion pass.
Differential Revision: https://reviews.llvm.org/D127652
Jay Foad [Fri, 17 Jun 2022 10:31:50 +0000 (11:31 +0100)]
[AMDGPU] Use explicit -global-isel=0/1 in tests. NFC.
lorenzo chelini [Sat, 11 Jun 2022 14:48:01 +0000 (16:48 +0200)]
[LLVM][IR] Fix typo in DerivedTypes.h (NFC)
Tiehu Zhang [Fri, 17 Jun 2022 10:24:23 +0000 (18:24 +0800)]
[AArch64][LV] AArch64 does not prefer vectorized addressing
TTI::prefersVectorizedAddressing() try to vectorize the addresses that lead to loads.
For aarch64, only gather/scatter (supported by SVE) can deal with vectors of addresses.
This patch specializes the hook for AArch64, to return true only when we enable SVE.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D124612
Kadir Cetinkaya [Wed, 15 Jun 2022 14:56:19 +0000 (16:56 +0200)]
[clang] Dont print implicit forrange initializer
Fixes https://github.com/clangd/clangd/issues/1158
Differential Revision: https://reviews.llvm.org/D127863
Nikita Popov [Fri, 17 Jun 2022 09:21:54 +0000 (11:21 +0200)]
[IR] Check for SignedMin/-1 division in canTrap() (PR56038)
In addition to division by zero, signed division also traps for
SignedMin / -1. This was handled in isSafeToSpeculativelyExecute(),
but not in Constant::canTrap().
Alex Zinenko [Thu, 16 Jun 2022 10:53:49 +0000 (12:53 +0200)]
[mlir] replace 'emit_c_wrappers' func->llvm conversion option with a pass
The 'emit_c_wrappers' option in the FuncToLLVM conversion requests C interface
wrappers to be emitted for every builtin function in the module. While this has
been useful to bootstrap the interface, it is problematic in the longer term as
it may unintentionally affect the functions that should retain their existing
interface, e.g., libm functions obtained by lowering math operations (see
D126964 for an example). Since D77314, we have a finer-grain control over
interface generation via an attribute that avoids the problem entirely. Remove
the 'emit_c_wrappers' option. Introduce the '-llvm-request-c-wrappers' pass
that can be run in any pipeline that needs blanket emission of functions to
annotate all builtin functions with the attribute before performing the usual
lowering that accounts for the attribute.
Reviewed By: chelini
Differential Revision: https://reviews.llvm.org/D127952
Guillaume Chatelet [Fri, 17 Jun 2022 09:07:24 +0000 (09:07 +0000)]
[libc][bazel] Remove memcpy dependency in memmove