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
Cullen Rhodes [Fri, 17 Jun 2022 08:31:02 +0000 (08:31 +0000)]
[AArch64] NFC: Fix BFMLAL[BT] inst def names
Alexander Potapenko [Wed, 15 Jun 2022 09:30:05 +0000 (11:30 +0200)]
[msan] Allow KMSAN to use -fsanitize-memory-param-retval
Let -fsanitize-memory-param-retval be used together with
-fsanitize=kernel-memory, so that it can be applied when building the
Linux kernel.
Also add clang/test/CodeGen/kmsan-param-retval.c to ensure that
-fsanitize-memory-param-retval eliminates shadow accesses for parameters
marked as undef.
Reviewed By: eugenis, vitalybuka
Differential Revision: https://reviews.llvm.org/D127860
Sven van Haastregt [Fri, 17 Jun 2022 08:53:45 +0000 (09:53 +0100)]
[OpenCL] Fix atomic_fetch_add/sub half overloads
Some of the atomic_fetch_add and atomic_fetch_sub overloads intended
for atomic_half types accidentally had an atomic_float parameter.
Nikita Popov [Fri, 17 Jun 2022 08:14:38 +0000 (10:14 +0200)]
[InstCombine] Add tests for freeze of recurrence with invoke start (NFC)
Muhammad Omair Javaid [Fri, 17 Jun 2022 07:46:27 +0000 (11:46 +0400)]
[LLDB] XFAIL TestLoadUnload fails on Arm/Ubuntu Jammy
This patch marks following tests as XFAIL for Arm/Ubuntu Jammy 22.04:
test_lldb_process_load_and_unload_commands
test_load_unload
Benjamin Kramer [Fri, 17 Jun 2022 07:40:50 +0000 (09:40 +0200)]
Revert "Reland "Reland "Reland "[X86][RFC] Enable `_Float16` type support on X86 following the psABI""""
This reverts commit
04a3d5f3a1193fb87576425a385aa0a6115b1e7c.
I see two more issues:
- uitofp/sitofp from i32/i64 to half now generates
__floatsihf/__floatdihf, which exists in neither compiler-rt nor
libgcc
- This crashes when legalizing the bitcast:
```
; RUN: llc < %s -mcpu=skx
define void @main.45(ptr nocapture readnone %retval, ptr noalias nocapture readnone %run_options, ptr noalias nocapture readnone %params, ptr noalias nocapture readonly %buffer_table, ptr noalias nocapture readnone %status, ptr noalias nocapture readnone %prof_counters) local_unnamed_addr {
entry:
%fusion = load ptr, ptr %buffer_table, align 8
%0 = getelementptr inbounds ptr, ptr %buffer_table, i64 1
%Arg_1.2 = load ptr, ptr %0, align 8
%1 = getelementptr inbounds ptr, ptr %buffer_table, i64 2
%Arg_0.1 = load ptr, ptr %1, align 8
%2 = load half, ptr %Arg_0.1, align 8
%3 = bitcast half %2 to i16
%4 = and i16 %3, 32767
%5 = icmp eq i16 %4, 0
%6 = and i16 %3, -32768
%broadcast.splatinsert = insertelement <4 x half> poison, half %2, i64 0
%broadcast.splat = shufflevector <4 x half> %broadcast.splatinsert, <4 x half> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert9 = insertelement <4 x i16> poison, i16 %4, i64 0
%broadcast.splat10 = shufflevector <4 x i16> %broadcast.splatinsert9, <4 x i16> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert11 = insertelement <4 x i16> poison, i16 %6, i64 0
%broadcast.splat12 = shufflevector <4 x i16> %broadcast.splatinsert11, <4 x i16> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert13 = insertelement <4 x i16> poison, i16 %3, i64 0
%broadcast.splat14 = shufflevector <4 x i16> %broadcast.splatinsert13, <4 x i16> poison, <4 x i32> zeroinitializer
%wide.load = load <4 x half>, ptr %Arg_1.2, align 8
%7 = fcmp uno <4 x half> %broadcast.splat, %wide.load
%8 = fcmp oeq <4 x half> %broadcast.splat, %wide.load
%9 = bitcast <4 x half> %wide.load to <4 x i16>
%10 = and <4 x i16> %9, <i16 32767, i16 32767, i16 32767, i16 32767>
%11 = icmp eq <4 x i16> %10, zeroinitializer
%12 = and <4 x i16> %9, <i16 -32768, i16 -32768, i16 -32768, i16 -32768>
%13 = or <4 x i16> %12, <i16 1, i16 1, i16 1, i16 1>
%14 = select <4 x i1> %11, <4 x i16> %9, <4 x i16> %13
%15 = icmp ugt <4 x i16> %broadcast.splat10, %10
%16 = icmp ne <4 x i16> %broadcast.splat12, %12
%17 = or <4 x i1> %15, %16
%18 = select <4 x i1> %17, <4 x i16> <i16 -1, i16 -1, i16 -1, i16 -1>, <4 x i16> <i16 1, i16 1, i16 1, i16 1>
%19 = add <4 x i16> %18, %broadcast.splat14
%20 = select i1 %5, <4 x i16> %14, <4 x i16> %19
%21 = select <4 x i1> %8, <4 x i16> %9, <4 x i16> %20
%22 = bitcast <4 x i16> %21 to <4 x half>
%23 = select <4 x i1> %7, <4 x half> <half 0xH7E00, half 0xH7E00, half 0xH7E00, half 0xH7E00>, <4 x half> %22
store <4 x half> %23, ptr %fusion, align 16
ret void
}
```
llc: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:977: void (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode *): Assertion `(TLI.getTypeAction(*DAG.getContext(), Op.getValueType()) == TargetLowering::TypeLegal || Op.getOpcode() == ISD::TargetConstant || Op.getOpcode() == ISD::Register) && "Unexpected illegal type!"' failed.
Javier Alvarez [Fri, 17 Jun 2022 07:31:14 +0000 (10:31 +0300)]
[clang] Fix trivially copyable for copy constructor and copy assignment operator
From [class.copy.ctor]:
```
A non-template constructor for class X is a copy constructor if its first
parameter is of type X&, const X&, volatile X& or const volatile X&, and
either there are no other parameters or else all other parameters have
default arguments (9.3.4.7).
A copy/move constructor for class X is trivial if it is not user-provided and if:
- class X has no virtual functions (11.7.3) and no virtual base classes (11.7.2), and
- the constructor selected to copy/move each direct base class subobject is trivial, and
- or each non-static data member of X that is of class type (or array thereof),
the constructor selected to copy/move that member is trivial;
otherwise the copy/move constructor is non-trivial.
```
So `T(T&) = default`; should be trivial assuming that the previous
provisions are met.
This works in GCC, but not in Clang at the moment:
https://godbolt.org/z/fTGe71b6P
Reviewed By: royjacobson
Differential Revision: https://reviews.llvm.org/D127593
ping.deng [Fri, 17 Jun 2022 06:53:19 +0000 (06:53 +0000)]
[RISCV][NFC] Add load/store instructions in rv64*-invalid.s
Reviewed By: benshi001, sunshaoce
Differential Revision: https://reviews.llvm.org/D127721
Fangrui Song [Fri, 17 Jun 2022 06:33:48 +0000 (23:33 -0700)]
[Driver] Pass -X to ld for riscv*-{elf,freebsd,linux}
GNU ld has a hack that defaults to -X (--discard-locals) in the emulation file
`riscvelf.em`. The recommended way, as gcc/config/arm does, is to let the
compiler driver pass -X to ld.
(The motivation is likely to discard a plethora of `.L` symbols due to linker
relaxation.)
lld default to --discard-none. To make clang+lld match GNU ld's behavior, pass
-X to ld.
Note: GNU ld has a special rule to treat ld -r -s as ld -r -S -x. With -X, driver `-r -Wl,-s`
will behave as ld `-r -S -X`. This removes fewer symbols than `-r -S -x` but is safe.
Differential Revision: https://reviews.llvm.org/D127826
Xiang Li [Thu, 16 Jun 2022 21:35:47 +0000 (14:35 -0700)]
[TableGen][DirectX] generate DXIL operation table with TableGen.
Add more feature to tableGen backend gen-dxil-operation.
It will generate getOpCodeProperty, getOpCodeClassName and getOpCodeName when build DirectX target.
Each of these functions has a table which generate based on DXIL operations.
These generated functions will replace the manually written functions which used for query DXIL operation information.
Reviewed By: bogner
Differential Revision: https://reviews.llvm.org/D125520
Fangrui Song [Fri, 17 Jun 2022 05:41:39 +0000 (22:41 -0700)]
[AArch64][test] Add --mattr=-{sve,sve2,sme} to SVE/SVE2/SME MC tests
llvm-objdump will be changed to default to disassemble all instructions.
Add --mattr=-{sve,sve2,sme} to keep the desired testing.
Mingming Liu [Fri, 17 Jun 2022 04:59:54 +0000 (21:59 -0700)]
[MachineBlockPlacementStats] Added check for "-filter-print-funcs"
option to the machine-block-placement-stats.
Differential Revision: https://reviews.llvm.org/D128019
Mingming Liu [Fri, 17 Jun 2022 04:56:08 +0000 (21:56 -0700)]
Revert "[MachineBlockPlacementStats] Add check for `-filter-print-funcs` option to machine-block-placement stats."
This reverts commit
46d45df4516e9a5bc43460429cd02cd04a85db1a. Going to
add differential revision link to commit message and re-commit.
Mingming Liu [Fri, 17 Jun 2022 00:26:02 +0000 (17:26 -0700)]
[MachineBlockPlacementStats] Add check for `-filter-print-funcs` option to machine-block-placement stats.
Phoebe Wang [Fri, 17 Jun 2022 03:25:22 +0000 (11:25 +0800)]
Reland "Reland "Reland "[X86][RFC] Enable `_Float16` type support on X86 following the psABI"""
Fix the crash on lowering X86ISD::FCMP.
Jonas Devlieghere [Fri, 17 Jun 2022 03:19:12 +0000 (20:19 -0700)]
[lldb] Remove LogHandler::Create functions (NFC)
Remove the LogHandler::Create functions. Except for the StreamHandler
they were just forwarding their arguments to std::make_shared.
Jez Ng [Fri, 17 Jun 2022 03:49:11 +0000 (23:49 -0400)]
[lld-macho][nfc] Tests for -force_load + regular archive load combinations
I realized we'd forgotten to cover this case (though our existing
behavior is indeed correct / matches ld64's).
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D128025
Jacques Pienaar [Fri, 17 Jun 2022 03:15:13 +0000 (20:15 -0700)]
[mlir] Disable warning in test of deprecated feature (NFC)
Disable warning for deprecation in test of deprecated feature. Also
remove additional test of deprecated feature from TestOps.td.
Jacques Pienaar [Fri, 17 Jun 2022 03:01:54 +0000 (20:01 -0700)]
[mlir] Split MLProgram global load and store to Graph variants
* Split ops into X_graph variants as discussed;
* Remove tokens from non-Graph region variants and rely on side-effect
modelling there while removing side-effect modelling from Graph
variants and relying on explicit ordering there;
* Make tokens required to be produced by Graph variants - but kept
explicit token type specification given previous discussion on this
potentially being configurable in future;
This results in duplicating some code. I considered adding helper
functions but decided against adding an abstraction there early given
size of duplication and creating accidental coupling.
Differential Revision: https://reviews.llvm.org/D127813
Lian Wang [Wed, 15 Jun 2022 03:46:57 +0000 (03:46 +0000)]
[LegalizeTypes][NFC] Merge promote SPLAT_VECTOR and promote SCALAR_TO_VECTOR to one function
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D127825