Jonas Paulsson [Thu, 17 Feb 2022 01:12:06 +0000 (02:12 +0100)]
[SystemZ] Improve emission of alignment hints.
Handle multiple memoperands in lowerAlignmentHint().
Review: Ulrich Weigand
Alex Brachet [Thu, 17 Feb 2022 18:20:23 +0000 (18:20 +0000)]
[Driver][Fuchsia][NFC] Use GetLinkerPath to see if linker is lld
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D120074
Artem Dergachev [Thu, 17 Feb 2022 05:09:09 +0000 (21:09 -0800)]
[analyzer] Fix a crash in NoStateChangeVisitor with body-farmed stack frames.
LocationContext::getDecl() isn't useful for obtaining the "farmed" body because
the (synthetic) body statement isn't actually attached to the (natural-grown)
declaration in the AST.
Differential Revision: https://reviews.llvm.org/D119509
Arthur Eubanks [Thu, 17 Feb 2022 18:00:26 +0000 (10:00 -0800)]
[InstCombine][OpaquePtr] Check store type in DSE implementation
Alexey Bataev [Thu, 17 Feb 2022 17:34:58 +0000 (09:34 -0800)]
[SLP][NFC]Add another test for swapped main/alternate cmp, NFC.
Philip Reames [Thu, 17 Feb 2022 17:50:32 +0000 (09:50 -0800)]
[instsimplify] When compare allocas, consider their minimal size
The code was using exact sizing only, but since what we really need is just to make sure the offsets are in bounds, a minimum bound on the object size is sufficient.
To demonstrate the difference, support computing minimum sizes from obects of scalable vector type.
Shangwu Yao [Thu, 17 Feb 2022 17:38:06 +0000 (09:38 -0800)]
[CUDA][SPIRV] Assign global address space to CUDA kernel arguments
This patch converts CUDA pointer kernel arguments with default address space to
CrossWorkGroup address space (__global in OpenCL). This is because Generic or
Function (OpenCL's private) is not supported as storage class for kernel pointer types.
Differential Revision: https://reviews.llvm.org/D119207
Philip Reames [Thu, 17 Feb 2022 17:21:42 +0000 (09:21 -0800)]
[instsimplify] Fix a miscompile with zero sized allocas
Remove some code which tried to handle the case of comparing two allocas where an object size could not be precisely computed. This code had zero coverage in tree, and at least one nasty bug.
The bug comes from the fact that the code uses the size of the result pointer as a proxy for whether the alloca can be of size zero. Since the result of an alloca is *always* a pointer type, and a pointer type can *never* be empty, this check was a nop. As a result, we blindly consider a zero offset from two allocas to never be equal. They can in fact be equal when one or more of the allocas is zero sized.
This is particularly ugly because instcombine contains the exact opposite rule. If instcombine reaches the allocas first, it combines them into one (making them equal). If instsimplify reaches the compare first, it would consider them not equal. This creates all kinds of fun scenarios for order of optimization reaching different and contradictory conclusions.
Valentin Clement [Thu, 17 Feb 2022 17:23:22 +0000 (18:23 +0100)]
[flang] Lower simple scalar assignment
This patch hanlde lowering of simple scalar assignment.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D120058
Co-authored-by: Jean Perier <jperier@nvidia.com>
Alex Brachet [Thu, 17 Feb 2022 17:21:55 +0000 (17:21 +0000)]
[libc] Add exit and atexit
Often atexit is implemented using __cxa_atexit. I have not implemented __cxa_atexit here because it potentially requires more discussion. It is unique for llvm-libc (I think) that it is an exported symbol that wouldn’t be defined in any spec file because it doesn’t have a header. Implementing it will be trivial given what is here already, but I figured it would be more contentious so it can be implemented later.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D119512
Brad Smith [Thu, 17 Feb 2022 17:15:14 +0000 (12:15 -0500)]
[clangd] Fix building SerializationTests unit test on OpenBSD
This fixes building the unit tests on OpenBSD. OpenBSD does not support RLIMIT_AS.
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D119989
Brad Smith [Thu, 17 Feb 2022 17:09:21 +0000 (12:09 -0500)]
[RuntimeDyld] Fix building on OpenBSD
With https://reviews.llvm.org/D105466 the tree does not build on OpenBSD/amd64.
Moritz suggested only building this code on Linux.
Reviewed By: MoritzS
Differential Revision: https://reviews.llvm.org/D119991
Philip Reames [Thu, 17 Feb 2022 17:12:17 +0000 (09:12 -0800)]
[instsimplify] Precommit a test showing an alloca equality miscompile
Zakk Chen [Wed, 16 Feb 2022 07:20:51 +0000 (23:20 -0800)]
[RISCV] Add the policy operand for nomask vector Multiply-Add IR intrinsics.
The goal is support tail and mask policy in RVV builtins.
We focus on IR part first.
The nomask vector Multiply-Add need a policy operand
because merge value could not be undef.
Reviewed By: monkchiang
Differential Revision: https://reviews.llvm.org/D119727
Kerry McLaughlin [Thu, 17 Feb 2022 16:00:36 +0000 (16:00 +0000)]
[AArch64][SVE] Add structured load/store opcodes to getMemOpInfo
Currently, loading from or storing to a stack location with a structured load
or store crashes in isAArch64FrameOffsetLegal as the opcodes are not handled by
getMemOpInfo. This patch adds the opcodes for structured load/store instructions
with an immediate index to getMemOpInfo & getLoadStoreImmIdx, setting appropriate
values for the scale, width & min/max offsets.
Reviewed By: sdesmalen, david-arm
Differential Revision: https://reviews.llvm.org/D119338
zhijian [Thu, 17 Feb 2022 17:04:04 +0000 (12:04 -0500)]
[NFC][llvm-nm] refactor function dumpSymbolNamesFromFile
Summary:
split the function into several small functions.
Reviewers: James Henderson,Fangrui Song
Differential Revision: https://reviews.llvm.org/D119974
Adrian Prantl [Thu, 17 Feb 2022 17:02:19 +0000 (09:02 -0800)]
add missing include
Simon Pilgrim [Thu, 17 Feb 2022 16:59:41 +0000 (16:59 +0000)]
[clang] Sema::CheckEquivalentExceptionSpec - remove useless nullptr test
We use castAs<> for NewProto/OldProto, which would assert if the cast failed.
Zahira Ammarguellat [Tue, 19 Oct 2021 16:12:57 +0000 (09:12 -0700)]
Add support for floating-point option `ffp-eval-method` and for
`pragma clang fp eval_method`.
https://reviews.llvm.org/D109239
Arthur O'Dwyer [Mon, 14 Feb 2022 20:11:47 +0000 (15:11 -0500)]
[clang] [NFC] More exhaustive tests for deducing void return types
Differential Revision: https://reviews.llvm.org/D119772
Aart Bik [Wed, 16 Feb 2022 20:56:43 +0000 (12:56 -0800)]
[mlir][linalg][sparse] add linalg optimization passes "upstream"
It is time to compose Linalg related optimizations with SparseTensor
related optimizations. This is a careful first start by adding some
general Linalg optimizations "upstream" of the sparse compiler in the
full sparse compiler pipeline. Some minor changes were needed to make
those optimizations aware of sparsity.
Note that after this, we will add a sparse specific fusion rule,
just to demonstrate the power of the new composition.
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D119971
Arthur Eubanks [Thu, 17 Feb 2022 04:34:55 +0000 (20:34 -0800)]
[SCEVExpander][OpaquePtr] Check GEP source type when finding identical GEP
Fixes an opaque pointers miscompile.
Reviewed By: #opaque-pointers, nikic
Differential Revision: https://reviews.llvm.org/D120004
Arthur Eubanks [Thu, 17 Feb 2022 04:34:08 +0000 (20:34 -0800)]
[test][IndVarSimplify][OpaquePtr] Precommit test
John Brawn [Thu, 17 Feb 2022 16:37:38 +0000 (16:37 +0000)]
[AArch64] Remove an unused variable in my previous patch
zhijian [Thu, 17 Feb 2022 16:37:33 +0000 (11:37 -0500)]
Title: Export unique symbol list with llvm-nm new option "--export-symbols"
Summary:
the patch implement of following functionality.
1. export the symbols from archive or object files.
2. sort the export symbols. (based on same symbol name and visibility)
3. delete the duplicate export symbols (based on same symbol name and visibility)
4. print out the unique and sorted export symbols (print the symbol name and visibility).
there are two new options are add in the patch
1. --export-symbols (enable the functionality of export unique symbol)
2. --no-rsrc (exclude the symbol name begin with "__rsrc" from be exporting from xcoff object file)
Export symbol list for xcoff object file has the same functionality as
The patch has the same functionality as
https://www.ibm.com/docs/en/xl-c-aix/13.1.0?topic=library-exporting-symbols-createexportlist-utility
Reviewers: James Henderson,Fangrui Song
Differential Revision: https://reviews.llvm.org/D112735
Alexey Lapshin [Thu, 17 Feb 2022 16:04:51 +0000 (19:04 +0300)]
Craig Topper [Thu, 17 Feb 2022 16:17:41 +0000 (08:17 -0800)]
[RISCV] Match shufflevector corresponding to slideup.
This generalizes isElementRotate to work when there's only a single
slide needed. I've removed matchShuffleAsSlideDown which is now
redundant.
Reviewed By: frasercrmck, khchen
Differential Revision: https://reviews.llvm.org/D119759
Craig Topper [Thu, 17 Feb 2022 16:10:20 +0000 (08:10 -0800)]
[RISCV] Fix incorrect MemOperand copy converting splat+load to vlse.
Due to an incorrect copy/paste from load intrinsic handling we
checked if the splat node was a MemSDNode which of course it isn't.
Instead get the MemOperand from the LoadSDNode for the source of
the splat.
This enables LICM to see the load is loop invariant and hoist it
out of the loop.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D120014
John Brawn [Tue, 25 Jan 2022 17:53:58 +0000 (17:53 +0000)]
[AArch64] Add some missing strict FP vector lowering
Also add a test for the codegen of strict FP vector operations so
these changes get tested.
Differential Revision: https://reviews.llvm.org/D117795
Jay Foad [Thu, 17 Feb 2022 14:17:36 +0000 (14:17 +0000)]
[GlobalDCE] Simplify and return Changed = true less often
Removing dead constants should not count as making a change to the
module. This means that RemoveUnusedGlobalValue simplifies to just
calling removeDeadConstantUsers, so inline it.
Differential Revision: https://reviews.llvm.org/D120052
Matt Devereau [Tue, 8 Feb 2022 14:24:03 +0000 (14:24 +0000)]
[AArch64][SVE] Invert VSelect operand order and condition for predicated arithmetic operations
(vselect (setcc ( condcode) (_) (_)) (a) (op (a) (b)))
=> (vselect (setcc (!condcode) (_) (_)) (op (a) (b)) (a))
As a follow up to D117689, invert the operand order and condition
in order to fold vselects into predicated instructions.
Differential Revision: https://reviews.llvm.org/D119424
Michael Kruse [Thu, 17 Feb 2022 15:42:15 +0000 (09:42 -0600)]
[polly] Fix regression test after D110620.
fourdim [Thu, 17 Feb 2022 15:40:32 +0000 (23:40 +0800)]
Revert "[JITLink][RISCV] fix the extractBits behavior and add R_RISCV_JAL relocation."
This reverts commit
3af7bbca4a0ef64de64b8bb38d3b167673ec60f0.
Sanjay Patel [Thu, 17 Feb 2022 15:34:48 +0000 (10:34 -0500)]
[InstCombine] push constant operand down/outside in sequence of min/max intrinsics
A generalization like this was suggested in D119754.
This is the inverse direction of D119851,
and we get all of the folds there plus the one that was missed.
There is precedence for this kind of transform in instcombine
with "or" instructions (but strangely only with that one opcode AFAICT).
Similar justification as in the other patch:
The line between instcombine and reassociate for these kinds of folds
is blurry. This doesn't appear to have much cost and gives us the
expected wins from repeated folds as seen in the last set of test diffs.
Differential Revision: https://reviews.llvm.org/D119955
Sanjay Patel [Wed, 16 Feb 2022 18:57:38 +0000 (13:57 -0500)]
[InstCombine] add test for min/max intrinsic with constant expression; NFC
Shilei Tian [Thu, 17 Feb 2022 15:22:16 +0000 (10:22 -0500)]
[OpenMP][Offloading] Fix test case issues in bug49334.cpp
`bug49334.cpp` has one issue that causes flaky result reported in #53730.
The root cause is `BlockedC` is never initialized but in `BlockMatMul_TargetNowait`
it is directly read and written (via `+=`). Fixes #53730.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D119988
fourdim [Thu, 17 Feb 2022 15:00:55 +0000 (23:00 +0800)]
[JITLink][RISCV] fix the extractBits behavior and add R_RISCV_JAL relocation.
This patch supports the R_RISCV_JAL relocation.
Moreover, it will fix the extractBits function's behavior as it extracts Size + 1 bits.
In the test ELF_jal.s:
Before:
```
Hi:
4294836480
extractBits(Hi, 12, 8): 480
```
After:
```
Hi:
4294836480
extractBits(Hi, 12, 8): 224
```
Reviewed By: StephenFan
Differential Revision: https://reviews.llvm.org/D117975
Zakk Chen [Mon, 14 Feb 2022 02:09:27 +0000 (18:09 -0800)]
[RISCV] Add the passthru operand for vmv.vv/vmv.vx/vfmv.vf IR intrinsics.
Add the passthru operand for
VMV_V_X_VL, VFMV_V_F_VL and SPLAT_VECTOR_SPLIT_I64_VL also.
The goal is support tail and mask policy in RVV builtins.
We focus on IR part first.
If the passthru operand is undef, we use tail agnostic, otherwise
use tail undisturbed.
Reviewed By: rogfer01
Differential Revision: https://reviews.llvm.org/D119688
Alexander Potapenko [Thu, 17 Feb 2022 14:09:31 +0000 (15:09 +0100)]
tsan: Add a missing disable_sanitizer_instrumentation attribute
Turns out the test was working by accident: we need to ensure
TSan instrumentation is not called from the fork() hook, otherwise the
tool will deadlock. Previously it worked because alloc_free_blocks() got
inlined into __tsan_test_only_on_fork(), but it cannot always be the
case.
Adding __attribute__((disable_sanitizer_instrumentation)) will prevent
TSan from instrumenting alloc_free_blocks().
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D120050
Lei Zhang [Thu, 17 Feb 2022 14:08:15 +0000 (09:08 -0500)]
[mlir][spirv] Add a pass to unify aliased resource variables
In SPIR-V, resources are represented as global variables that
are bound to certain descriptor. SPIR-V requires those global
variables to be declared as aliased if multiple ones are bound
to the same slot. Such aliased decorations can cause issues
for transcompilers like SPIRV-Cross when converting to source
shading languages like MSL.
So this commit adds a pass to perform analysis of aliased
resources and see if we can unify them into one.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D119872
Alexey Bataev [Thu, 17 Feb 2022 13:40:01 +0000 (05:40 -0800)]
[SLP][NFC]Fix misprint in function name, NFC.
Nico Weber [Thu, 17 Feb 2022 13:56:06 +0000 (08:56 -0500)]
[gn build] (manually) port
f75da0c8e65c (ObjCopy lib)
Shao-Ce SUN [Thu, 17 Feb 2022 13:02:58 +0000 (21:02 +0800)]
[RISCV] add the MC layer support of Zfinx extension
This patch added the MC layer support of Zfinx extension.
Authored-by: StephenFan
Co-Authored-by: Shao-Ce Sun
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D93298
Simon Pilgrim [Thu, 17 Feb 2022 13:50:52 +0000 (13:50 +0000)]
[X86] selectLEAAddr - add X86ISD::SMUL/UMULO handling
After D118128 relaxed the heuristic to require only one EFLAGS generating operand, it now makes sense to avoid X86ISD::SMUL/UMULO duplication as well.
Differential Revision: https://reviews.llvm.org/D119578
Guillaume Chatelet [Thu, 17 Feb 2022 12:31:00 +0000 (12:31 +0000)]
[libc][automemcpy] Introduce geomean of scores as a tie breaker
Differential Revision: https://reviews.llvm.org/D120040
Paul Walker [Fri, 10 Dec 2021 18:05:38 +0000 (18:05 +0000)]
[DAGCombiner] Extend ISD::ABDS/U combine to handle more cases.
The current ABD combine doesn't quite work for SVE because only a
single scalable vector per scalar integer type is legal (e.g. for
i32, <vscale x 4 x i32> is the only legal scalable vector type).
This patch extends the combine to also trigger for the cases when
operand extension must be retained.
Differential Revision: https://reviews.llvm.org/D115739
Bjorn Pettersson [Fri, 4 Feb 2022 17:32:13 +0000 (18:32 +0100)]
[DAG] Fix in ReplaceAllUsesOfValuesWith
When doing SelectionDAG::ReplaceAllUsesOfValuesWith a worklist is
prepared containing all users that should be updated. Then we use
the RemoveNodeFromCSEMaps/AddModifiedNodeToCSEMaps helpers to handle
recursive CSE updates while doing the replacements.
This patch aims at solving a problem that could arise if the recursive
CSE updates would result in an SDNode present in the worklist is being
removed as a side-effect of morphing a prio user in the worklist.
To examplify such a scenario, imagine that we have these nodes in
the DAG
t12: i64 = add t8, t11
t13: i64 = add t12, t8
t14: i64 = add t11, t11
t15: i64 = add t14, t8
t16: i64 = sub t13, t15
and that the t8 uses should be replaced by t11. An initial worklist
(listing the users that should be morphed) could be [t12, t13, t15].
When updating t12 we get
t12: i64 = add t11, t11
which results in a CSE update that replaces t14 by t12, so we get
t15: i64 = add t12, t8
which results in a CSE update that replaces t13 by t12, so we get
t16: i64 = sub t12, t15
and then t13 is removed given that it was the last use of t13.
So when being done with the updates triggered by rewriting the use
of t8 in t12 the t13 node no longer exist. And we used to end up
hitting an assertion when continuing with the worklist aiming at
replacing the t8 uses in t13.
The solution is based on using a DAGUpdateListener, making sure that
we prune a user from the worklist if it is removed during the
recursive CSE updates.
The bug was found using an OOT target. I think the problem is quite
old, even if the particular intree target reproducer added in this
patch seem to pass when using LLVM 13.0.0.
Differential Revision: https://reviews.llvm.org/D119088
Simon Pilgrim [Thu, 17 Feb 2022 13:28:02 +0000 (13:28 +0000)]
[clang-doc] SerializeIndex - pass Index param by constant reference
Silence coverity warnings about unnecessary copies
Shao-Ce SUN [Thu, 17 Feb 2022 13:19:14 +0000 (21:19 +0800)]
[NFC] Fix comment
Simon Pilgrim [Thu, 17 Feb 2022 13:18:02 +0000 (13:18 +0000)]
[clang] CGDebugInfo::getOrCreateMethodType - use castAs<> instead of getAs<> to avoid dereference of nullptr
The pointer is always dereferenced, so assert the cast is correct instead of returning nullptr
Simon Pilgrim [Thu, 17 Feb 2022 13:15:19 +0000 (13:15 +0000)]
[clang] CGCXXABI::EmitLoadOfMemberFunctionPointer - use castAs<> instead of getAs<> to avoid dereference of nullptr
The pointer is always dereferenced by arrangeCXXMethodType, so assert the cast is correct instead of returning nullptr
Shao-Ce SUN [Thu, 17 Feb 2022 13:13:00 +0000 (21:13 +0800)]
[NFC] Correct typo `interger` to `integer`
Benjamin Kramer [Thu, 17 Feb 2022 12:51:27 +0000 (13:51 +0100)]
[BufferDeallocation] Don't assume successor operands are unique
This would create a double free when a memref is passed twice to the
same op. This wasn't a problem at the time the pass was written but is
common since the introduction of scf.while.
There's a latent non-determinism that's triggered by the test, but this
change is messy enough as-is so I'll leave that for later.
Differential Revision: https://reviews.llvm.org/D120044
John Brawn [Fri, 28 Jan 2022 15:05:39 +0000 (15:05 +0000)]
[AArch64] Allow strict opcodes in faddp patterns
This also requires adjustment to code in AArch64ISelLowering so that
vector_extract is distributed over strict_fadd.
Differential Revision: https://reviews.llvm.org/D118489
John Brawn [Fri, 28 Jan 2022 14:31:17 +0000 (14:31 +0000)]
[AArch64] Allow strict opcodes in indexed fmul and fma patterns
Using an indexed version instead of a non-indexed version doesn't
change anything with regards to exceptions or rounding.
Differential Revision: https://reviews.llvm.org/D118487
John Brawn [Fri, 28 Jan 2022 14:10:51 +0000 (14:10 +0000)]
[AArch64] Allow strict opcodes in fp->int->fp patterns
These patterns don't change the fundamental instructions that are
used, just the variants that are used in order to remove some extra
MOVs.
Differential Revision: https://reviews.llvm.org/D118485
John Brawn [Fri, 7 Jan 2022 14:47:26 +0000 (14:47 +0000)]
[AArch64] Add instruction selection for strict FP
This consists of marking the various strict opcodes as legal, and
adjusting instruction selection patterns so that 'op' is 'any_op'.
FP16 and vector instructions additionally require some extra work in
lowering and legalization, so we can't set IsStrictFPEnabled just yet.
Also more work needs to be done for full strict fp support (marking
instructions that can raise exceptions as such, and modelling FPCR use
for controlling rounding).
Differential Revision: https://reviews.llvm.org/D114946
Guillaume Chatelet [Thu, 17 Feb 2022 11:51:59 +0000 (11:51 +0000)]
[llvm][automemcpy] Allow distribution filtering in analysis
Differential Revision: https://reviews.llvm.org/D120037
Adrian Kuegel [Thu, 17 Feb 2022 12:31:50 +0000 (13:31 +0100)]
[AArch64][NFC] Fix unused-lambda-capture warning.
Differential Revision: https://reviews.llvm.org/D120041
Nikita Popov [Thu, 17 Feb 2022 13:08:29 +0000 (14:08 +0100)]
[Docs] Use correct rst syntax
Momchil Velikov [Thu, 17 Feb 2022 11:18:11 +0000 (11:18 +0000)]
Remove duplicated code for printing the `uwtable` attribute (NFC)
Committed as obvious.
Reviewed By: chill
Differential Revision: https://reviews.llvm.org/D120030
Adrian Kuegel [Thu, 17 Feb 2022 12:02:14 +0000 (13:02 +0100)]
[Bazel] Fix build after ObjCopy move.
Differential Revision: https://reviews.llvm.org/D120039
Andrzej Warzynski [Fri, 4 Feb 2022 17:15:12 +0000 (17:15 +0000)]
[flang][driver] Add support for `-emit-llvm`
This patch adds support for the `-emit-llvm` option in the frontend
driver (i.e. `flang-new -fc1`). Similarly to Clang, `flang-new -fc1
-emit-llvm file.f` will generate a textual LLVM IR file.
Depends on D118985
Differential Revision: https://reviews.llvm.org/D119012
Guillaume Chatelet [Thu, 17 Feb 2022 10:56:25 +0000 (10:56 +0000)]
[libc][automemcpy] Add mean/variance and simplify implementation
Differential Revision: https://reviews.llvm.org/D120031
Nikita Popov [Thu, 17 Feb 2022 12:00:46 +0000 (13:00 +0100)]
[Docs] Update opaque pointers docs
Expand migration instructions.
Roman Lebedev [Thu, 17 Feb 2022 11:30:02 +0000 (14:30 +0300)]
[NFC][PhaseOrdering] Improve test coverage for D119975
Simon Pilgrim [Thu, 17 Feb 2022 11:56:29 +0000 (11:56 +0000)]
[SystemZ] lowerDYNAMIC_STACKALLOC_XPLINK - use cast<> instead of dyn_cast<> to avoid dereference of nullptr
The pointer is always dereferenced, so assert the cast is correct instead of returning nullptr
Simon Pilgrim [Thu, 17 Feb 2022 11:54:12 +0000 (11:54 +0000)]
[X86] X86tcret_1reg - use cast<> instead of dyn_cast<> to avoid dereference of nullptr
The pointer is always dereferenced, so assert the cast is correct instead of returning nullptr
Simon Pilgrim [Thu, 17 Feb 2022 11:41:47 +0000 (11:41 +0000)]
AArch64_MC::isQForm - Fix MSVC 'no default capture mode' lambda warning
Nikita Popov [Thu, 17 Feb 2022 10:59:04 +0000 (11:59 +0100)]
[RelLookupTableConverter] Ensure that GV, GEP and load types match
This code could be generalized to be type-independent, but for now
just ensure that the same type constraints are enforced with opaque
pointers as with typed pointers.
Max Kazantsev [Thu, 17 Feb 2022 10:38:42 +0000 (17:38 +0700)]
[SCEV] Infer ranges for SCC consisting of cycled Phis
Our current strategy of computing ranges of SCEVUnknown Phis was to simply
compute the union of ranges of all its inputs. In order to avoid infinite recursion,
we mark Phis as pending and conservatively return full set for them. As result,
even simplest patterns of cycled phis always have a range of full set.
This patch makes this logic a bit smarter. We basically do the same, but instead
of taking inputs of single Phi we find its strongly connected component (SCC)
and compute the union of all inputs that come into this SCC from outside.
Processing entire SCC together has one more advantage: we can set range for all
of them at once, because the only thing that happens to them is the same value is
being passed between those Phis. So, despite we spend more time analyzing a
single Phi, overall we may save time by not processing other SCC members, so
amortized compile time spent should be approximately the same.
Differential Revision: https://reviews.llvm.org/D110620
Reviewed By: reames
Sven van Haastregt [Thu, 17 Feb 2022 10:58:52 +0000 (10:58 +0000)]
[OpenCL] Guard 64-bit atomic types
Until now, overloads with a 64-bit atomic type argument were always
made available with `-fdeclare-opencl-builtins`. Ensure these
overloads are only available when both the `cl_khr_int64_base_atomics`
and `cl_khr_int64_extended_atomics` extensions have been enabled, as
required by the OpenCL specification.
Differential Revision: https://reviews.llvm.org/D119858
Alexey Lapshin [Thu, 17 Feb 2022 10:25:48 +0000 (13:25 +0300)]
[objcopy][NFC] Add doc comments to the executeObjcopy* functions.
Add doc comments to the executeObjcopy* functions.
Depends on D88827
Pavel Kosov [Thu, 17 Feb 2022 10:41:57 +0000 (13:41 +0300)]
[SchedModels][CortexA55] Add ASIMD integer instructions
Depends on D114642
Original review https://reviews.llvm.org/D112201
OS Laboratory. Huawei Russian Research Institute. Saint-Petersburg
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D117003
Pavel Kosov [Thu, 17 Feb 2022 10:41:05 +0000 (13:41 +0300)]
[AArch64][SchedModels] Handle virtual registers in FP/NEON predicates
Current implementation of Check[HSDQ]Form predicates doesn’t handle virtual registers and therefore isn’t useful for pre-RA scheduling. Patch fixes this implementing two function predicates: CheckQForm for checking that instruction writes 128-bit NEON register and CheckFpOrNEON which checks that instruction writes FP register (any width). The latter supersedes Check[HSD]Form predicates which are not used individually.
OS Laboratory. Huawei Russian Research Institute. Saint-Petersburg
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D114642
Nikita Popov [Wed, 16 Feb 2022 15:38:11 +0000 (16:38 +0100)]
[CodeGen] Rename deprecated Address constructor
To make uses of the deprecated constructor easier to spot, and to
ensure that no new uses are introduced, rename it to
Address::deprecated().
While doing the rename, I've filled in element types in cases
where it was relatively obvious, but we're still left with 135
calls to the deprecated constructor.
Zakk Chen [Fri, 28 Jan 2022 16:16:25 +0000 (08:16 -0800)]
[RISCV] Add the passthru operand for vadc/vsbc/vmerge/vfmerge IR intrinsics.
The goal is support tail and mask policy in RVV builtins.
We focus on IR part first.
If the passthru operand is undef, we use tail agnostic, otherwise
use tail undisturbed.
Reviewed By: rogfer01
Differential Revision: https://reviews.llvm.org/D119686
Eli Friedman [Thu, 17 Feb 2022 10:17:27 +0000 (02:17 -0800)]
Revert "[compiler-rt] Implement ARM atomic operations for architectures without SMP support"
This reverts commit
910a642c0a5b66a8d2517026b890a1acdc447f19.
There are serious correctness issues with the current approach: __sync_*
routines which are not actually atomic should not be enabled by default.
I'll continue discussion on the review.
Eli Friedman [Thu, 17 Feb 2022 10:16:25 +0000 (02:16 -0800)]
Revert "[NFC][compiler-rt] Format file lib/builtins/arm/sync-ops.h"
This reverts commit
f165c23bf3598990aaf2174a6bc40be75199ee1a.
Part of revert sequence for
910a642c0a.
Alexey Lapshin [Fri, 11 Feb 2022 18:42:40 +0000 (21:42 +0300)]
[llvm-objcopy][NFC] Move core implementation of llvm-objcopy into separate library.
This patch moves core implementation of llvm-objcopy into Object library
(http://lists.llvm.org/pipermail/llvm-dev/2020-September/145075.html).
The functionality for parsing input options is left inside tools/llvm-objcopy.
The interface of ObjCopy library:
ObjCopy/ELF/ELFObjcopy.h
```
Error executeObjcopyOnIHex(const CopyConfig &Config, MemoryBuffer &In,
Buffer &Out);
Error executeObjcopyOnRawBinary(const CopyConfig &Config, MemoryBuffer &In,
Buffer &Out);
Error executeObjcopyOnBinary(const CopyConfig &Config,
object::ELFObjectFileBase &In, Buffer &Out);
```
ObjCopy/COFF/COFFObjcopy.h
```
Error executeObjcopyOnBinary(const CopyConfig &Config,
object::COFFObjectFile &In, Buffer &Out);
```
ObjCopy/MachO/MachOObjcopy.h
```
Error executeObjcopyOnBinary(const CopyConfig &Config,
object::MachOObjectFile &In, Buffer &Out);
```
ObjCopy/wasm/WasmObjcopy.h
```
Error executeObjcopyOnBinary(const CopyConfig &Config,
object::WasmObjectFile &In, Buffer &Out);
```
Differential Revision: https://reviews.llvm.org/D88827
Siddharth Bhat [Thu, 17 Feb 2022 10:10:19 +0000 (15:40 +0530)]
[MLIR] add entry block to MLIR grammar.
The MLIR parser allows regions to have an unnamed entry block.
Make this explicit in the language grammar.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D119950
David Green [Thu, 17 Feb 2022 10:03:28 +0000 (10:03 +0000)]
[AArch64] Cleanup for performCommonVectorExtendCombine. NFC
This is some NFC (hopefully!) cleanup for performCommonVectorExtendCombine
and related methods, removing conditions that cannot occur and otherwise
cleaning up the code a little.
Jay Foad [Wed, 16 Feb 2022 11:00:44 +0000 (11:00 +0000)]
[AMDGPU] Return better Changed status from SILowerI1Copies
Differential Revision: https://reviews.llvm.org/D119946
Jay Foad [Wed, 16 Feb 2022 11:00:25 +0000 (11:00 +0000)]
[AMDGPU] Return better Changed status from SIAnnotateControlFlow
Differential Revision: https://reviews.llvm.org/D119945
Stanislav Gatev [Thu, 17 Feb 2022 09:37:02 +0000 (09:37 +0000)]
Add missing break statement in switch.
Jay Foad [Wed, 16 Feb 2022 11:00:05 +0000 (11:00 +0000)]
[AMDGPU] Return better Changed status from AMDGPUPerfHintAnalysis
Differential Revision: https://reviews.llvm.org/D119944
Jay Foad [Wed, 16 Feb 2022 10:59:39 +0000 (10:59 +0000)]
[AMDGPU] Return better Changed status from AMDGPUAnnotateUniformValues
Differential Revision: https://reviews.llvm.org/D119943
Jay Foad [Wed, 16 Feb 2022 10:58:54 +0000 (10:58 +0000)]
[CodeGen] Return better Changed status from LocalStackSlotAllocation
Differential Revision: https://reviews.llvm.org/D119942
Jay Foad [Wed, 16 Feb 2022 10:57:50 +0000 (10:57 +0000)]
[CodeGen] Return false from LiveIntervals::runOnMachineFunction
This is an analysis pass so it does not modify the MachineFunction.
Differential Revision: https://reviews.llvm.org/D119941
Jay Foad [Wed, 16 Feb 2022 10:56:56 +0000 (10:56 +0000)]
[CodeGen] Return better Changed status from DetectDeadLanes
Differential Revision: https://reviews.llvm.org/D119940
Ben Shi [Thu, 17 Feb 2022 09:24:38 +0000 (17:24 +0800)]
Revert "[RISCV] LUI used for address computation should not isAsCheapAsAMove"
This reverts commit
23a50736004e94704a2393aa36a905d737f2b20f.
Although this patch achieved better codegen in most cases, it is really
important to accurately describe the cost of instructions. So I revert it.
Roman Lebedev [Thu, 17 Feb 2022 09:07:17 +0000 (12:07 +0300)]
[SimplifyCFG][PhaseOrdering] Defer lowering switch into an integer range comparison and branch until after at least the IPSCCP
That transformation is lossy, as discussed in
https://github.com/llvm/llvm-project/issues/53853
and https://github.com/rust-lang/rust/issues/85133#issuecomment-
904185574
This is an alternative to D119839,
which would add a limited IPSCCP into SimplifyCFG.
Unlike lowering switch to lookup, we still want this transformation
to happen relatively early, but after giving a chance for the things
like CVP to do their thing. It seems like deferring it just until
the IPSCCP is enough for the tests at hand, but perhaps we need to
be more aggressive and disable it until CVP.
Fixes https://github.com/llvm/llvm-project/issues/53853
Refs. https://github.com/rust-lang/rust/issues/85133
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D119854
Alex Zinenko [Wed, 16 Feb 2022 13:54:54 +0000 (14:54 +0100)]
[mlir] call target materialization more in dialect conversion
During dialect conversion, target materialization is triggered to create
cast-like operations when a type mismatch occurs between the value that
replaces a rewritten operation and the type that another operations expects as
operands processed by the type conversion. First, a dummy cast is inserted to
make sure the pattern application can proceed. The decision to trigger the
user-provided materialization hook is taken later based on the result of the
dummy cast having uses. However, it only has uses if other patterns constructed
new operations using the casted value as operand. If existing (legal)
operations use the replaced value, they may have not been updated to use the
casted value yet. The conversion infra would then delete the dummy cast first,
and then would replace the uses with now-invalid (null in the bast case) value.
When deciding whether to trigger cast materialization, check for liveness the
uses not only of the casted value, but also of all the values that it replaces.
This was discovered in the finalizing bufferize pass that cleans up
mutually-cancelling casts without touching other operations. It is not
impossible that there are other scenarios where the dialect converison infra
could produce invalid operand uses because of dummy casts erased too eagerly.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D119937
Stanislav Gatev [Wed, 16 Feb 2022 16:47:37 +0000 (16:47 +0000)]
[clang][dataflow] Add transfer functions for logical and, or, not.
This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.
Reviewed-by: xazax.hun
Differential Revision: https://reviews.llvm.org/D119953
Lorenzo Chelini [Thu, 17 Feb 2022 09:06:16 +0000 (10:06 +0100)]
[MLIR][PDL] Fix typo (NFC)
Nikita Popov [Thu, 17 Feb 2022 08:54:07 +0000 (09:54 +0100)]
[InstSimplify] Delay creation of constants for offsets (NFC)
Return APInt from stripAndComputeConstantOffsets(), and only
create corresponding Constants later, if we actually need them.
Martin Storsjö [Mon, 24 Jan 2022 22:25:41 +0000 (22:25 +0000)]
[libcxx] [test] Fix locale.time.get.byname get_date and get_date_wide on Windows
Also apply the same fix on glibc. This takes the test one step closer
to passing on glibc, but it still fails on the zh_CN test (which
requires a more involved fix in libc++ itself).
Differential Revision: https://reviews.llvm.org/D119791
Martin Storsjö [Tue, 25 Jan 2022 10:32:55 +0000 (10:32 +0000)]
[libcxx] [test] Fix the locale get_one_wide test for windows and glibc
Differential Revision: https://reviews.llvm.org/D119790
Martin Storsjö [Thu, 20 Jan 2022 09:30:57 +0000 (09:30 +0000)]
[libcxx] [test] Make the put_long_double test pass on mingw, clarify quirks in put_double
Expect the same NAN formatting on Windows as on Glibc. (Both MSVC and
MinGW produce the same formatting there.)
The hex float formatting tests pass on MinGW, so opt in to those tests.
Document exactly what issues are remaining in Clang-cl/MSVC
configurations. (It's easily possible to make the tests pass there too,
but it requires a whole lot of small-scope ifndefs in the test file;
around 60 ifdefs in total for those both test files. Those could
be avoided if the CI environment could run with a newer version
of UCRT, but that's nontrivial to fix right away.)
Differential Revision: https://reviews.llvm.org/D119766
Amir Ayupov [Thu, 17 Feb 2022 04:39:59 +0000 (20:39 -0800)]
[BOLT][NFC] Report errors from createBinaryContext and RewriteInstance ctor
Refactor createBinaryContext and RewriteInstance/MachORewriteInstance
constructors to report an error in a library and fuzzer-friendly way instead of
returning a nullptr or exiting.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D119658