Butygin [Thu, 28 Oct 2021 16:04:35 +0000 (19:04 +0300)]
[mlir] spirv: Add scf.while spirv conversion
* It works similar to scf.for coversion, but convert condition and yield ops as part of scf.whille pattern so it don't need to maintain external state
Differential Revision: https://reviews.llvm.org/D113007
Adrian Kuegel [Tue, 16 Nov 2021 10:17:33 +0000 (11:17 +0100)]
Fix unused variable warning.
Adrian Kuegel [Tue, 16 Nov 2021 09:58:14 +0000 (10:58 +0100)]
[mlir] Support multi-dimensional vectors in MathToLibm conversion.
Differential Revision: https://reviews.llvm.org/D113969
Arnab Dutta [Tue, 16 Nov 2021 09:36:45 +0000 (15:06 +0530)]
[MLIR] Simplify semi-affine expressions using flattening
For the semi affine expressions, whenever rhs of a floordiv, ceildiv, mod
or product expression is a symbolic expression, we introduce a local variable
representing the result, and store the floordiv/ceildiv, mod or product
affine expression in LocalExprs. In this way the expression is flattened,
and trivial addition and subtraction related simplifications are performed.
Also rule based matching for detecting and transforming "expr - q * (expr floordiv q)"
to "expr mod q", where q is a symbolic exxpression, in simplifyAdd function.
Differential Revision: https://reviews.llvm.org/D112808
Frederik Gossen [Tue, 16 Nov 2021 10:04:45 +0000 (11:04 +0100)]
Fix unused variable in llvm/lib/CodeGen/GlobalISel/LoadStoreOpt.cpp
David Green [Tue, 16 Nov 2021 09:49:42 +0000 (09:49 +0000)]
[ARM] Add datalayout to costmodel tests. NFC
This adds a sensible datalayout to the ARM cost model tests, to prevent
the costs reported being incorrect for the size of pointers.
Groverkss [Tue, 16 Nov 2021 08:42:13 +0000 (14:12 +0530)]
[MLIR] FlatAffineConstraints: Allow extraction of explicit representation of local variables
This patch extends the existing functionality of computing an explicit
representation for local variables, to also get the explicit representation,
instead of only the inequality pairs.
This is required for a future patch to remove redundant local ids based on
their explicit representation.
Reviewed By: arjunp
Differential Revision: https://reviews.llvm.org/D113814
Kai Luo [Tue, 16 Nov 2021 09:16:54 +0000 (09:16 +0000)]
[CGP][PowerPC] Pre-commit test case for D113872. NFC.
Amara Emerson [Tue, 16 Nov 2021 08:48:07 +0000 (00:48 -0800)]
Remove unnecessary <any> include.
Carlos Galvez [Sun, 14 Nov 2021 17:09:54 +0000 (17:09 +0000)]
[clang-tidy][NFC] Simplify ClangTidyStats
- Use NSDMI and remove constructor.
Differential Revision: https://reviews.llvm.org/D113847
jacquesguan [Tue, 9 Nov 2021 02:15:46 +0000 (10:15 +0800)]
[RISCV] Refactor some rvv instructions' definition with foreach.
Simplify rvv instructions that use eew in their mnemonic and encoding with foreach. And fix a scheduling bug.
Differential Revision: https://reviews.llvm.org/D113453
Dmitry Vyukov [Mon, 15 Nov 2021 18:44:34 +0000 (19:44 +0100)]
tsan: use pthread_equal instead of direct pthread_t comparison
man pthread_equal:
The pthread_equal() function is necessary because thread IDs
should be considered opaque: there is no portable way for
applications to directly compare two pthread_t values.
Depends on D113916.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D113919
Dmitry Vyukov [Mon, 15 Nov 2021 18:00:31 +0000 (19:00 +0100)]
tsan: speed up pthread_setname_np
pthread_setname_np does linear search over all thread descriptors
to map pthread_t to the thread descriptor. This has O(N^2) complexity
and becomes much worse in the new tsan runtime that keeps all ever
existed threads in the thread registry.
Replace linear search with direct access if pthread_setname_np
is called for the current thread (a very common case).
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D113916
LLVM GN Syncbot [Tue, 16 Nov 2021 06:15:54 +0000 (06:15 +0000)]
[gn build] Port
2e6ae1d3f2de
Chuanqi Xu [Tue, 16 Nov 2021 06:05:34 +0000 (14:05 +0800)]
[libcxx] [Coroutine] Conform Coroutine Implementation
Since coroutine is merged in C++ standard and the support for coroutine
seems relatively stable. It's the time to move the implementation of
coroutine out of the experimental directory and the std::experimental
namespace. This patch creates header <coroutine> with conformed
implementation with C++ standard. To avoid breaking user's code too
fast, the <experimental/coroutine> header is remained. Note that
<experimental/coroutine> is deprecated and it would be removed in
LLVM15.
Reviewed By: Quuxplusone, ldionne
Differential Revision: https://reviews.llvm.org/D109433
Mehdi Amini [Tue, 16 Nov 2021 05:59:12 +0000 (05:59 +0000)]
Revert "[MLIR][LLVM] Permit integer types in switch other than i32"
This reverts commit
94992670fcc59d12d7f97cb08beb8d2eb15110ed.
Build is broken with:
tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.cpp.inc:23996:3: error: no matching function for call to 'printSwitchOpCases'
printSwitchOpCases(_odsPrinter, *this, getValue().getType(), getCaseValuesAttr(), getCaseDestinations(), getCaseOperands(), getCaseOperands().getTypes());
^~~~~~~~~~~~~~~~~~
Serguei Katkov [Tue, 5 Oct 2021 04:00:53 +0000 (11:00 +0700)]
[STATEPOINT] Force implicit-def for lr register.
STATEPOINT instruction behavior is similar to call instruction.
In aarch64 BL instruction implicitly define lr register, so
STATEPOINT instruction should do the same.
However STATEPOINT is a general pseudo instruction and I could not find
a way to override list of implicit defs for specific target.
So this patch post processes inserting STATEPOINT instruction by
adding implisit dead def for lr.
Reviewers: reames, loicottet, ostannard
Reviewed By: reames
Subscribers: danilaml, hiraditya, kristof.beyls, llvm-commits, yrouban
Differential Revision: https://reviews.llvm.org/D111114
William S. Moses [Tue, 16 Nov 2021 01:13:33 +0000 (20:13 -0500)]
[MLIR][LLVM] Permit integer types in switch other than i32
LLVM switchop currently only permits i32. Both LLVM IR and MLIR Standard switch permit other integer types leading to an illegal state when lowering an i8 switch from MLIR standard
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D113955
Kazu Hirata [Tue, 16 Nov 2021 05:28:46 +0000 (21:28 -0800)]
[llvm] Use make_early_inc_range (NFC)
LLVM GN Syncbot [Tue, 16 Nov 2021 05:11:06 +0000 (05:11 +0000)]
[gn build] Port
dc84770d559b
Amara Emerson [Mon, 15 Nov 2021 22:45:30 +0000 (14:45 -0800)]
[GlobalISel] Add a store-merging optimization pass and enable for AArch64.
This is a first attempt at a constant value consecutive store merging pass,
a counterpart to the DAGCombiner's store merging optimization.
The high level goals of this pass:
* Have a simple and efficient algorithm. As close to linear time as we can get.
Thus, prioritizing scalability of the algorithm over merging every corner case
we can find. The DAGCombiner's store merging code has been the source of
compile time and complexity issues in the past and I wanted to avoid that.
* Don't introduce any new data structures for ordering memory operations. In MIR,
we don't have the concept of chains like we do in the DAG, and the instruction
order is stricter than enforcing ordering with graph edges. Although I
considered adding something similar, I couldn't justify the overhead.
The pass is current split into 3 main parts. The main store merging code focuses
on identifying candidate stores and managing the candidate group that's under
consideration for merging. Analyzing addressing of stores is a potentially
complex part and for now there's just a basic implementation to identify easy
cases. Finally, the other main bit of complexity is the alias analysis, which
tries to follow the same logic as the DAG's AA.
Currently this implementation only supports merging of constant stores. Stores
of arbitrary variables are technically possible with a very small change, but
the DAG chooses not to do this. Doing so here makes most code worse since
there's extra overhead in merging values into wider registers.
On AArch64 -Os, this optimization results in very minor savings on CTMark.
Differential Revision: https://reviews.llvm.org/D109131
Wenlei He [Fri, 12 Nov 2021 02:28:47 +0000 (18:28 -0800)]
[llvm-profgen] Add switch to allow use of first loadable segment for calculating offset
Adding `-use-loadable-segment-as-base` to allow use of first loadable segment for calculating offset. By default first executable segment is used for calculating offset. The switch helps compatibility with unsymbolized profile generated from older tools.
Differential Revision: https://reviews.llvm.org/D113727
Greg Clayton [Fri, 12 Nov 2021 23:26:27 +0000 (15:26 -0800)]
Add the stop count to "statistics dump" in each target's dictionary.
It is great to know how many times the target has stopped over its lifetime as each time the target stops, and possibly resumes without the user seeing it for things like shared library loading and signals that are not notified and auto continued, to help explain why a debug session might be slow. This is now included as "stopCount" inside each target JSON.
Differential Revision: https://reviews.llvm.org/D113810
Craig Topper [Tue, 16 Nov 2021 01:45:16 +0000 (17:45 -0800)]
[RISCV] Override TargetLowering::hasAndNot for Zbb.
Differential Revision: https://reviews.llvm.org/D113937
Craig Topper [Tue, 16 Nov 2021 01:32:15 +0000 (17:32 -0800)]
[RISCV] Add test cases to prepare for overring TargetLowering::hasAndNot. NFC
These test files are copied directly from AArch64. Some of the cases
may benefit from ANDN with the Zbb extension. Somes cases already
improve use ANDN.
selectcc-to-shiftand.ll also contains tests that test select->and
conversion even when a ANDN isn't needed. I think this improves our
coverage of these optimizations.
Differential Revision: https://reviews.llvm.org/D113935
Fabian Wolff [Tue, 16 Nov 2021 00:54:31 +0000 (08:54 +0800)]
[X86] Fix crash with inline asm using wrong register name
Fixes PR#48678. `X86TargetLowering::getRegForInlineAsmConstraint()` can adjust the register class to match the type, e.g. change `VR128X` to `VR256X` if the type needs 256 bits. However, the function currently returns the unadjusted register and the adjusted register class, e.g. `xmm15` and `VR256X`, which then causes an assertion failure later because the register class does not contain that register. This patch fixes this behavior.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D113834
Matt Arsenault [Sat, 13 Nov 2021 17:03:44 +0000 (12:03 -0500)]
AMDGPU: Mark prolog/epilog SCC defs as dead
A future change will add SCC liveness checks. Since we are still
relying on forward register scavenging, add dead flags to avoid
spuriously detecting SCC as live.
Matt Arsenault [Sat, 13 Nov 2021 17:13:58 +0000 (12:13 -0500)]
AMDGPU: Regenerate test checks
Matthias Springer [Tue, 16 Nov 2021 02:10:57 +0000 (11:10 +0900)]
[mlir][linalg][bufferize][NFC] Clean up tensor op bufferization
Differential Revision: https://reviews.llvm.org/D113730
Matheus Izvekov [Tue, 16 Nov 2021 00:49:30 +0000 (01:49 +0100)]
[clang] NFC: rename internal `IsPossiblyOpaquelyQualifiedType` overload
Rename `IsPossiblyOpaquelyQualifiedType` overload taking a Type*
as `IsPossiblyOpaquelyQualifiedTypeInternal` instead.
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Differential Revision: https://reviews.llvm.org/D113954
Duncan P. N. Exon Smith [Tue, 16 Nov 2021 01:18:07 +0000 (17:18 -0800)]
DebugInfo: Make DWARFExpression::iterator::skipBytes() const, NFC
Given that DWARFExpression::iterator::skipBytes() doesn't change any
state (it returns a new `iterator`), it might as well be
`const`-qualified.
Duncan P. N. Exon Smith [Tue, 16 Nov 2021 01:05:09 +0000 (17:05 -0800)]
DebugInfo: const-qualify accessors of DWARFExpression::Operation
Add `const` to DWARFExpression::Operation's accessors and make
Operation::extract() private, since it's only used by the friend class
DWARFExpression::iterator.
Duncan P. N. Exon Smith [Tue, 16 Nov 2021 00:42:48 +0000 (16:42 -0800)]
DebugInfo: Make DWARFExpression::iterator::operator++ return itself
Looks like an accident that `operator++` was returning `Operator&`
instead of `iterator&`. Update to match standard iterator behaviour.
Craig Topper [Mon, 15 Nov 2021 23:16:37 +0000 (15:16 -0800)]
[DAGCombiner] Prevent unfoldMaskedMerge from creating an AND with two inverted inputs.
It's possible that the mask is already a NOT. At least if InstCombine
hasn't canonicalized the input. In that case we will form an ANDN with
X instead of with Y. So we don't need to worry about Y being a constant.
We might need to check that X isn't a constant instead, but we don't
have a test case for that yet.
This fixes a size regression found when trying to enable this combine
for RISCV in D113937.
Differential Revision: https://reviews.llvm.org/D113948
ZijunZhao [Wed, 1 Sep 2021 21:52:25 +0000 (21:52 +0000)]
add tsan shared lib
Change-Id: Ic83ff1ec86d6a7d61b07fa3df7e0cb2790b5ebc7
Zequan Wu [Tue, 16 Nov 2021 00:14:49 +0000 (16:14 -0800)]
[LLDB][NativePDB] Fix local-variables.cpp failure on windows bots
Geoffrey Martin-Noble [Mon, 15 Nov 2021 23:31:08 +0000 (15:31 -0800)]
[Bazel] Enable layering_check for MLIR build
This feature checks that headers included by a file are provided by a
header exported by one of the direct dependencies of the build rule in
which it is contained. It ensures that appropriate layering (a goal of
the LLVM project) is preserved. So far, I'm only adding this to MLIR
because we've had it turned on internally since the beginning, so MLIR
is already layering clean. It would be nice to also enable it for LLVM,
but that requires some additional cleanup.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D113952
Mehrnoosh Heidarpour [Mon, 15 Nov 2021 23:54:07 +0000 (18:54 -0500)]
[InstSimplify] Fold A|B | (A^B) --> A|B
This patch adds the following fold opportunity:
A|B | (A^B) --> A|B
that is reported here : https://bugs.llvm.org/show_bug.cgi?id=52479
https://alive2.llvm.org/ce/z/33-My-
Test cases with base results are added in D113860
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D113861
Ben Shi [Thu, 11 Nov 2021 12:57:33 +0000 (12:57 +0000)]
[RISCV] Optimize immediate materialisation with SH*ADD
Use LUI+SH*ADD+ADDI to compose specific immediates.
Reviewed By: craig.topper, luismarques
Differential Revision: https://reviews.llvm.org/D113568
Ben Shi [Wed, 10 Nov 2021 07:40:13 +0000 (07:40 +0000)]
[RISCV][test] Add more tests of immediate materialisation
Reviewed By: craig.topper, luismarques
Differential Revision: https://reviews.llvm.org/D113567
Aart Bik [Thu, 11 Nov 2021 18:05:01 +0000 (10:05 -0800)]
[mlir][sparse] first version of "truly" dynamic sparse tensors as outputs of kernels
This revision contains all "sparsification" ops and rewriting necessary to support sparse output tensors when the kernel has no reduction (viz. insertions occur in lexicographic order and are "injective"). This will be later generalized to allow reductions too. Also, this first revision only supports sparse 1-d tensors (viz. vectors) as output in the runtime support library. This will be generalized to n-d tensors shortly. But this way, the revision is kept to a manageable size.
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D113705
natashaknk [Mon, 15 Nov 2021 23:10:36 +0000 (15:10 -0800)]
[tosa][mlir] Refactor tosa.reshape lowering to linalg for dynamic cases.
Split tosa.reshape into three individual lowerings: collapse, expand and a
combination of both. Add simple dynamic shape support.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D113936
Stanislav Mekhanoshin [Mon, 15 Nov 2021 22:56:20 +0000 (14:56 -0800)]
Revert "[InstSimplify] Fold A|B | (A^B) --> A|B"
This reverts commit
193c40e9667ca2b173232b393fc72ea9e4944aa3.
James King [Mon, 15 Nov 2021 18:56:22 +0000 (18:56 +0000)]
Add `isInitCapture` and `forEachLambdaCapture` matchers.
This contributes follow-up work from https://reviews.llvm.org/D112491, which
allows for increased control over the matching of lambda captures. This also
updates the documentation for the `lambdaCapture` matcher.
Reviewed By: ymandel, aaron.ballman
Differential Revision: https://reviews.llvm.org/D113575
Arthur Eubanks [Fri, 12 Nov 2021 23:10:59 +0000 (15:10 -0800)]
[llvm-reduce] Don't reuse SmallVector across calls to getAllMetadata()
The SmallVector is not cleared in calls to getAllMetadata().
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D113808
not-jenni [Mon, 15 Nov 2021 22:44:13 +0000 (14:44 -0800)]
[mlir][tosa] Add tosa.mul by one canonicalization
Multiply by one can be removed during canonicalization. This optimizes away unneeded operations.
Differential Revision: https://reviews.llvm.org/D113807
Arthur Eubanks [Mon, 3 May 2021 23:50:26 +0000 (16:50 -0700)]
[NewPM] Only invalidate modified functions' analyses in CGSCC passes + turn on eagerly invalidate analyses
Previously, any change in any function in an SCC would cause all
analyses for all functions in the SCC to be invalidated. With this
change, we now manually invalidate analyses for functions we modify,
then let the pass manager know that all function analyses should be
preserved since we've already handled function analysis invalidation.
So far this only touches the inliner, argpromotion, function-attrs, and
updateCGAndAnalysisManager(), since they are the most used.
This is part of an effort to investigate running the function
simplification pipeline less on functions we visit multiple times in the
inliner pipeline.
However, this causes major memory regressions especially on larger IR.
To counteract this, turn on the option to eagerly invalidate function
analyses. This invalidates analyses on functions immediately after
they're processed in a module or scc to function adaptor for specific
parts of the pipeline.
Within an SCC, if a pass only modifies one function, other functions in
the SCC do not have their analyses invalidated, so in later function
passes in the SCC pass manager the analyses may still be cached. It is
only after the function passes that the eager invalidation takes effect.
For the default pipelines this makes sense because the inliner pipeline
runs the function simplification pipeline after all other SCC passes
(except CoroSplit which doesn't request any analyses).
Overall this has mostly positive effects on compile time and positive effects on memory usage.
https://llvm-compile-time-tracker.com/compare.php?from=
7f627596977624730f9298a1b69883af1555765e&to=
39e824e0d3ca8a517502f13032dfa67304841c90&stat=instructions
https://llvm-compile-time-tracker.com/compare.php?from=
7f627596977624730f9298a1b69883af1555765e&to=
39e824e0d3ca8a517502f13032dfa67304841c90&stat=max-rss
D113196 shows that we slightly regressed compile times in exchange for
some memory improvements when turning on eager invalidation. D100917
shows that we slightly improved compile times in exchange for major
memory regressions in some cases when invalidating less in SCC passes.
Turning these on at the same time keeps the memory improvements while
keeping compile times neutral/slightly positive.
Reviewed By: asbirlea, nikic
Differential Revision: https://reviews.llvm.org/D113304
Matheus Izvekov [Fri, 12 Nov 2021 23:40:18 +0000 (00:40 +0100)]
[clang] retain type sugar in auto / template argument deduction
This implements the following changes:
* AutoType retains sugared deduced-as-type.
* Template argument deduction machinery analyses the sugared type all the way
down. It would previously lose the sugar on first recursion.
* Undeduced AutoType will be properly canonicalized, including the constraint
template arguments.
* Remove the decltype node created from the decltype(auto) deduction.
As a result, we start seeing sugared types in a lot more test cases,
including some which showed very unfriendly `type-parameter-*-*` types.
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: rsmith, #libc, ldionne
Differential Revision: https://reviews.llvm.org/D110216
Steven Wu [Mon, 15 Nov 2021 21:55:06 +0000 (13:55 -0800)]
[JITLink] Fix splitBlock if there are symbols span across the boundary
Fix `splitBlock` so that it can handle the case when the block being
split has symbols span across the split boundary. This is an error
case in general but for EHFrame splitting on macho platforms, there is an
anonymous symbol that marks the entire block. Current implementation
will leave a symbol that is out of bound of the underlying block. Fix
the problem by dropping such symbols when the block is split.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D113912
Stanislav Mekhanoshin [Mon, 15 Nov 2021 20:24:44 +0000 (12:24 -0800)]
[InstSimplify] Fold A|B | (A^B) --> A|B
This patch adds the following fold opportunity:
A|B | (A^B) --> A|B
that is reported here : https://bugs.llvm.org/show_bug.cgi?id=52479
https://alive2.llvm.org/ce/z/33-My-
Test cases with base results are added in D113860
(authored by MehrHeidar, committed by rampitec).
Differential Revision: https://reviews.llvm.org/D113861
Jonas Paulsson [Fri, 5 Nov 2021 17:51:13 +0000 (18:51 +0100)]
[SystemZ] Support symbolic displacements.
This patch adds support for symbolic displacements, e.g. like 'lg %r0,
sym(%r1)', which is done using relocations. This is needed to compile the
kernel without disabling the integrated assembler.
Review: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D113341
Nicolas Vasilache [Mon, 15 Nov 2021 21:17:24 +0000 (21:17 +0000)]
[mlir][Vector] Make vector.shape_cast based size-1 foldings opt-in and separate.
This is in prevision of dropping them altogether and using insert/extract based patterns.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D113928
Mircea Trofin [Mon, 15 Nov 2021 19:42:04 +0000 (11:42 -0800)]
[NFC][Regalloc] Factor types that would be used by the eviction advisor
This is in prepartion of pulling the eviction decision-making into an
analysis pass, which would then allow swapping that decision making
process.
RFC: https://lists.llvm.org/pipermail/llvm-dev/2021-November/153639.html
Differential Revision: https://reviews.llvm.org/D113929
Fangrui Song [Mon, 15 Nov 2021 21:10:47 +0000 (13:10 -0800)]
[X86] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off build. NFC
Krasimir Georgiev [Mon, 15 Nov 2021 20:40:37 +0000 (21:40 +0100)]
[llvm] adapt DWARFExpression.h for
6b9b86db9dd974585a5c71cf2e5231d1e3385f7c
No functional changes intended.
Updated the iterator class for https://github.com/llvm/llvm-project/commit/
6b9b86db9dd974585a5c71cf2e5231d1e3385f7c.
Differential Revision: https://reviews.llvm.org/D113934
Philip Reames [Mon, 15 Nov 2021 20:30:48 +0000 (12:30 -0800)]
[unroll-runtime] Relax two profitability limitations on multi-exit unrolling
This change is mostly about getting rid of some "uninteresting" cases in a follow on deeper heuristic change. If anyone sees actually interesting code differences out of this, please let me know. I'm not expecting this to have much impact at all.
Case 1 - With the single deoptimize non-latch exit, we can't have two exiting blocks sharing an exit block. We can only hit this with a poorly documented debug flag.
Case 2 - Why should we treat epilog cases differently from prolog cases? Or to say it differently, why should starting with a constant control whether a multiple exit loop gets unrolled?
Sorry for the lack of tests here. These are both *exceedingly* narrow cases in practice, and after a while trying, I couldn't come up with a test which did anything "useful" as opposed to simply exercise a random combination of force flags. Note that the legality cases for each are already exercised with force flags.
Snehasish Kumar [Mon, 15 Nov 2021 20:53:47 +0000 (12:53 -0800)]
[InstrProf][NFC] Fix a few typos in code comments.
Nicolas Vasilache [Mon, 15 Nov 2021 20:39:37 +0000 (20:39 +0000)]
[mlir][Linalg] Add a DownscaleDepthwiseConv2DNhwcHwcOp decomposition pattern.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D113907
Nico Weber [Mon, 15 Nov 2021 18:55:05 +0000 (13:55 -0500)]
[asm] Make EmitMSInlineAsmStr and EmitGCCInlineAsmStr more alike
https://reviews.llvm.org/D71677 copied a bunch of code from
EmitGCCInlineAsmStr() to EmitMSInlineAsmStr() but made a few small
(likely unintentional) changes. This makes these pieces look the same.
No behavior change.
(Why are these functions two copies? No great reason as far as I can tell.
https://reviews.llvm.org/rG1778831a3d1d24ab6545635f63da4d9c5f8f0ac7 did the
split; we might want to undo them at some point. But PR23933 suggests
that a bigger change is planned for this file in the future, so keeping
this incremental for now.)
Differential Revision: https://reviews.llvm.org/D113924
Nico Weber [Mon, 15 Nov 2021 17:32:12 +0000 (12:32 -0500)]
[asm] Convert AsmPrinter::PrintSpecial() to StringRef
No behavior change.
Differential Revision: https://reviews.llvm.org/D113911
Nico Weber [Mon, 15 Nov 2021 17:09:09 +0000 (12:09 -0500)]
[asm] Correctly handle special names in variants
There's really no reason why anyone should use these special names in a variant.
I noticed this while reading the code: all other writes to OS are guarded by
this conditional, and the behavior with the check seems more correct, so
let's add the check.
Differential Revision: https://reviews.llvm.org/D113909
Lei Huang [Fri, 12 Nov 2021 21:05:52 +0000 (15:05 -0600)]
[PowerPC] Fix 32bit vector insert instructions for ISA3.1
The platform independent ISD::INSERT_VECTOR_ELT take a element index,
but vins* instructions take a byte index. Update 32bit td patterns for
vector insert to handle the element index accordingly.
Since vector insert for non constant index are supported in
ISA3.1, there is no need to use platform specific ISD node,
PPCISD::VECINSERT. Update td pattern to directly use
ISD::INSERT_VECTOR_ELT instead.
Reviewed By: nemanjai, #powerpc
Differential Revision: https://reviews.llvm.org/D113802
Quinn Pham [Mon, 15 Nov 2021 15:54:41 +0000 (09:54 -0600)]
[NFC][lld] Inclusive language: change master file to merged file
[NFC] As part of using inclusive language within the llvm project, this patch
replaces master with merged in these comments.
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D113903
Zequan Wu [Sat, 13 Nov 2021 01:38:05 +0000 (17:38 -0800)]
[LLDB][NativePDB] Fix image lookup by address
`image lookup -a ` doesn't work because the compilands list is always empty.
Create CU at given index if doesn't exit.
Differential Revision: https://reviews.llvm.org/D113821
Zahira Ammarguellat [Mon, 15 Nov 2021 19:31:59 +0000 (14:31 -0500)]
Making the code compliant to the documentation about Floating Point
support default values for C/C++. FPP-MODEL=PRECISE enables FFP-CONTRACT
(FMA is enabled).
Philip Reames [Mon, 15 Nov 2021 20:19:53 +0000 (12:19 -0800)]
Fix a misleading FIXME in an unroll test
Alexey Bataev [Mon, 15 Nov 2021 20:09:32 +0000 (12:09 -0800)]
[SLP][NFC]Add a test for extra shuffle emission, NFC.
Quinn Pham [Mon, 15 Nov 2021 18:38:26 +0000 (12:38 -0600)]
[llvm][fix] Inclusive language: replace master with main in find_interesting_reviews.py
As part of using inclusive language within the llvm project and to fix
the command because the master branch was renamed, this patch replaces
master with main in `find_interesting_reviews.py`.
Reviewed By: kristof.beyls
Differential Revision: https://reviews.llvm.org/D113918
Philip Reames [Mon, 15 Nov 2021 19:38:06 +0000 (11:38 -0800)]
[runtime-unroll] Inline canSafelyUnrollMultiExitLoop [NFC]
All of the interesting logic from this routine has been removed, inline the single check into the sole non-assert caller. The assert use has little value with the restructured code and is simply dropped.
Lei Zhang [Mon, 15 Nov 2021 19:33:31 +0000 (14:33 -0500)]
[mlir][linalg] Make loop ops in TileLoopNest accessible
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D113927
Stanislav Mekhanoshin [Tue, 9 Nov 2021 20:22:03 +0000 (12:22 -0800)]
[PatternMatch] Add m_BinOp/m_c_BinOp with specific opcode
Differential Revision: https://reviews.llvm.org/D113508
Vitaly Buka [Mon, 15 Nov 2021 19:18:40 +0000 (11:18 -0800)]
[msan] Disabled test failing on new GLIBC
Philip Reames [Mon, 15 Nov 2021 19:13:27 +0000 (11:13 -0800)]
[runtime-unroll] Restructure if-clause to improve readability [NFC]
Alexey Bataev [Mon, 15 Nov 2021 18:53:39 +0000 (10:53 -0800)]
[SLP][DOT][NFCI]Output all scalars for the splats, not only the first one.
Zarko Todorovski [Mon, 15 Nov 2021 18:54:15 +0000 (18:54 +0000)]
Revert "[llvm][ubsan] Inclusive language: replace use of blacklist HandleLLVMOptions.cmake"
This reverts commit
44a64afd43943ed6f47c37f61a6cd2e99c7287f3.
Steven Wan [Mon, 15 Nov 2021 18:12:59 +0000 (13:12 -0500)]
[AIX][llvm-go] AIX linker does not recognize `-rpath`
The existing logic adds `-rpath` to CGO_LDFLAGS, which is not a valid linker option on AIX. This patch substitutes it with `-blibpath` on AIX.
Reviewed By: daltenty
Differential Revision: https://reviews.llvm.org/D113704
Balazs Benics [Mon, 15 Nov 2021 18:10:46 +0000 (19:10 +0100)]
[analyzer][NFC] Separate CallDescription from CallEvent
`CallDescriptions` deserve its own translation unit.
This patch simply moves the corresponding parts.
Also includes the `CallDescription.h` where it's necessary.
Reviewed By: martong, xazax.hun, Szelethus
Differential Revision: https://reviews.llvm.org/D113587
Simon Pilgrim [Mon, 15 Nov 2021 17:57:33 +0000 (17:57 +0000)]
[X86] Add generic splitVectorOp helper. NFC
Update splitVectorIntUnary/splitVectorIntBinary to use this internally, after some operand type sanity checks.
Avoid code duplication and makes it easier to split other vector instruction forms in the future.
Craig Topper [Mon, 15 Nov 2021 17:49:22 +0000 (09:49 -0800)]
[RISCV] Teach needVSETVLIPHI to handle mask register instructions.
This handles the case where the mask register instruction input
comes from a Phi of vsetvlis. If the VLMAX is the same as the VLMAX
required by the mask register instruction, we can avoid a vsetvli.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D113204
Peter Steinfeld [Thu, 11 Nov 2021 18:46:26 +0000 (10:46 -0800)]
[flang] Allow implicit procedure pointers to associate with explicit procedures
Section 10.2.2.4, paragraph 3 states that, for procedure pointer assignment:
If the pointer object has an explicit interface, its characteristics shall be
the same as the pointer target ...
Thus, it's illegal for a procedure pointer with an explicit interface to be
associated with a procedure whose interface is implicit. However, there's no
prohibition that disallows a procedure pointer with an implicit interface from
being associated with a procedure whose interface is explicit.
We were incorrectly emitting an error message for this latter case.
We were also not covering the case of procedures with explicit
interfaces where calling them requires the use of a descriptor. Such
procedures cannot be associated with procedure pointers with implicit
interfaces.
Differential Revision: https://reviews.llvm.org/D113706
Roman Lebedev [Mon, 15 Nov 2021 17:46:14 +0000 (20:46 +0300)]
[NFC][X86][Costmodel] Improve test coverage for {i8,i16,i32,i64}->i1 vector trunc
Roman Lebedev [Mon, 15 Nov 2021 17:33:11 +0000 (20:33 +0300)]
[NFC][X86][Costmodel] Improve test coverage for i1->{i8,i16,i32,i64} vector *ext
Mehrnoosh Heidarpour [Mon, 15 Nov 2021 17:20:46 +0000 (12:20 -0500)]
[InstCombine] Fold (A^B)|~A-->~(A&B)
https://alive2.llvm.org/ce/z/2v6rhF
Fixes:
https://llvm.org/PR52478
Differential Revision: https://reviews.llvm.org/D113783
Denys Petrov [Tue, 9 Nov 2021 12:20:23 +0000 (14:20 +0200)]
[analyzer] Fix region cast between the same types with different qualifiers.
Summary: Specifically, this fixes the case when we get an access to array element through the pointer to element. This covers several FIXME's. in https://reviews.llvm.org/D111654.
Example:
const int arr[4][2];
const int *ptr = arr[1]; // Fixes this.
The issue is that `arr[1]` is `int*` (&Element{Element{glob_arr5,1 S64b,int[2]},0 S64b,int}), and `ptr` is `const int*`. We don't take qualifiers into account. Consequently, we doesn't match the types as the same ones.
Differential Revision: https://reviews.llvm.org/D113480
Simon Pilgrim [Mon, 15 Nov 2021 16:34:05 +0000 (16:34 +0000)]
[X86] LowerFunnelShift - pull out repeated EltSizeInBits variable. NFC.
Roman Lebedev [Mon, 15 Nov 2021 16:57:30 +0000 (19:57 +0300)]
[NFC][X86][Costmodel] Add i1 replication shuffle costmodel test coverage
Chris Lattner [Mon, 15 Nov 2021 16:21:49 +0000 (08:21 -0800)]
[PatternMatch] Add a new m_Any that binds a value.
This is analogous to what LLVM's PatternMatch.h supports,
but LLVM calls it m_Value for both the binding and
nonbinding versions.
This is an upstream from CIRCT and is used there.
Differential Revision: https://reviews.llvm.org/D113905
Zarko Todorovski [Mon, 15 Nov 2021 15:32:02 +0000 (15:32 +0000)]
[llvm][ubsan] Inclusive language: replace use of blacklist HandleLLVMOptions.cmake
This patch changes it to ignorelist and contains a filename change for the
.txt file that's called.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D113689
Sanjay Patel [Mon, 15 Nov 2021 15:47:11 +0000 (10:47 -0500)]
[x86] fold vector (X > -1) & Y to shift+andn (2nd try)
The first try at this patch (
bf5748a1af0d ) was reverted (
5be64d416481 )
because it could crash. The cause of that problem was failing to account
for the optional peek-through-bitcast in the enclosing function.
This version of the patch adds a clause to avoid the fold in case of
bitcasts because it is unlikely to be profitable in that scenario.
A test case based on https://llvm.org/PR52504 was added to make sure
we don't have that problem again.
Original commit message:
and (pcmpgt X, -1), Y --> pandn (vsrai X, BitWidth-1), Y
This avoids the -1 constant vector in favor of an arithmetic shift
instruction if it exists (the ISA is still not complete after all
these years...).
We catch this pattern late in combining by matching PCMPGT, so it
should not interfere with more general folds.
Differential Revision: https://reviews.llvm.org/D113603
Sanjay Patel [Mon, 15 Nov 2021 15:08:47 +0000 (10:08 -0500)]
[x86] add test for vector signbit mask fold (PR52504); NFC
This goes with D113603 -
which was reverted because it could crash on this and similar examples.
Roman Lebedev [Mon, 15 Nov 2021 15:55:45 +0000 (18:55 +0300)]
[X86][Costmodel] `getReplicationShuffleCost()`: promote 8 bit-wide elements to 32 bit when no AVX512VBMI
Currently `X86TTIImpl::getInterleavedMemoryOpCostAVX512()` asks about i8 elt type,
so this change does affect vectorization. In the end, it will ask about i1.
We should also try to promote to i16 if we have AVX512BW, i'll do that in a follow-up.
All costs here look good, i've added the missing truncation costs in preparatory patches.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D113853
Roman Lebedev [Mon, 15 Nov 2021 15:55:44 +0000 (18:55 +0300)]
[X86][Costmodel] `trunc v32i16 to v64i8` can appear after legalization, cost is same as for `trunc v32i16 to v32i8`
Some of the costs get larger here,
but i suppose that makes sense since we'd previously query
scalarization costs that may not be really representative of the reality.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D113852
Roman Lebedev [Mon, 15 Nov 2021 15:55:39 +0000 (18:55 +0300)]
[X86][Costmodel] `trunc v8i64 to v16i8/v32i8/v64i8` can appear after legalization, cost is same as for `trunc v8i64 to v8i8`
While this one is trivial and identical to the previous patch,
there is a weird cost change in a follow-up patch that i'm not sure about.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D113851
Roman Lebedev [Mon, 15 Nov 2021 15:55:35 +0000 (18:55 +0300)]
[X86][Costmodel] `trunc v16i32 to v32i8/v64i8` can appear after legalization, cost is same as for `trunc v16i32 to v16i8`
While this one is trivial and identical to the previous patch,
there is a weird cost change in a follow-up patch that i'm not sure about.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D113850
Kiran Chandramohan [Sat, 13 Nov 2021 18:02:16 +0000 (18:02 +0000)]
[Flang] Add the FIR LLVMPointer Type
Add a fir.llvm_ptr type to allow any level of indirections
Currently, fir pointer types (fir.ref, fir.ptr, and fir.heap) carry
a special Fortran semantics, and cannot be freely combined/nested.
When implementing some features, lowering sometimes needs more liberty
regarding the number of indirection levels. Add a fir.llvm_ptr that has
no constraints.
Allow its usage in fir.coordinate_op, fir.load, and fir.store.
Convert the FIR LLVMPointer to an LLVMPointer in the LLVM dialect.
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D113755
Co-authored-by: Jean Perier <jperier@nvidia.com>
Jon Chesterfield [Mon, 15 Nov 2021 15:56:00 +0000 (15:56 +0000)]
[openmp][amdgpu] Add comment warning that libm may be broken
Using llvm-link to add rocm device-libs probably doesn't work
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D112639
Simon Pilgrim [Mon, 15 Nov 2021 15:51:02 +0000 (15:51 +0000)]
[X86] getAVX512Node() - find constant broadcasts to encourage load-folding
If an operand is a bitcasted or widended constant, try to more aggressively create broadcastable constants for folding, which in particular helps non-VLX modes.
I've refactored getAVX512Node so that VLX targets can make better use of this as well.
NOTE: In the future, I think we should consider removing the broadcast of constant data from DAG entirely and move this to either X86InstrInfo::foldMemoryOperand or a new pass - AVX1/2 targets has similar problems with missed (whole vector) folds that need to be improved as well.
Differential Revision: https://reviews.llvm.org/D113845
Alexey Bataev [Fri, 12 Nov 2021 15:11:51 +0000 (07:11 -0800)]
[SLP]Improve splat detection.
A bunch of scalars can be treated as a splat not only if all elements
are the same but also if some of them are undefvalues.
Differential Revision: https://reviews.llvm.org/D113774
Ella Ma [Mon, 15 Nov 2021 15:47:39 +0000 (16:47 +0100)]
[clang] Allow clang-check to customize analyzer output file or dir name
Required by https://stackoverflow.com/questions/
58073606
As the output argument is stripped out in the clang-check tool, it seems impossible for clang-check users to customize the output file name, even with -extra-args and -extra-arg-before.
This patch adds the -analyzer-output-path argument to allow users to adjust the output name. And if the argument is not set or the analyzer is not enabled, the original strip output adjuster will remove the output arguments.
Differential Revision: https://reviews.llvm.org/D97265
Valentin Clement [Mon, 15 Nov 2021 15:47:04 +0000 (16:47 +0100)]
[fir] Add fir.global_len conversion placeholder
As for D113662, this patch just add a place holder for
the fir.global_len operation conversion. This operation
is part of F20xx and is not implemented yet.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: awarzynski
Differential Revision: https://reviews.llvm.org/D113887