1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 10:32:48 +02:00
Commit Graph

219433 Commits

Author SHA1 Message Date
Ani
6382230f0e test: Remove test files
The test directory severely inflates the size of the AUR clone, and we're not even using the tests
2021-11-02 16:34:32 +00:00
Nekotekina
05332b78c7 TypeSize.h: add integral constructor to ElementCount 2021-11-02 17:42:39 +03:00
Nekotekina
902970b075 IRBuilder.h: remove deprecations 2021-11-02 17:42:39 +03:00
Nekotekina
c9fceef173 X86: fixup (V)PMADDWD detection
Fix some bugs (missing checks).
Add constant support.
2021-11-02 17:42:39 +03:00
Nekotekina
f7d625e31a X86: improve (V)PMADDWD detection
In function combineMulToPMADDWD, if 17 bit are sign bits,
not just zero bits, the optimization can be applied sometimes.
For now, detect and replace SRA pairs with SRL.
2021-11-02 17:42:39 +03:00
Nekotekina
c36b21c023 X86: modify PreserveAll CC to save full AVX-512 state 2021-11-02 17:42:39 +03:00
Nekotekina
2e65b3a418 Fix possible compilation issue with gcc-11 2021-11-02 17:42:39 +03:00
Nekotekina
548daf04b5 X86: avoid vector-scalar shifts if splat amount is directly a vector ADD/SUB/AND op.
Prefer vector-vector shifts if available (AVX2+).
Improves code generated for rotate and funnel shifts.
Otherwise it would generate a shuffle + slower vector-scalar shift.
2021-11-02 17:42:39 +03:00
Nekotekina
d5bc359dfd X86: add patterns for X86ISD::VSHLV and X86ISD::VSRLV
Replace VSELECT instruction which zeroes their result on exceeding legal SHL/SRL shift amount.
2021-11-02 17:42:39 +03:00
Nekotekina
bed700114e X86: add pattern for X86ISD::VSRAV
Detect clamping ashr shift amount to max legal value
2021-11-02 17:42:39 +03:00
Nekotekina
2ffa82223f X86: expand detectAVGPattern()
Allow all integer widths in the pattern, allow ashr
Handle signed and mixed cases, allowing to replace truncation
2021-11-02 17:42:39 +03:00
Nekotekina
5ff8f4151c X86: optimize VSELECT for v16i8 with shl + sign bit test 2021-11-02 17:42:39 +03:00
Nekotekina
4743d020ce X86: LowerShift: new algorithm for vector-vector shifts
Emit pair of shifts of double size if possible
2021-11-02 17:42:39 +03:00
Nekotekina
d5b5885c23 Disable GDBRegistrationListener
It makes emitting object extremely slow.
GDB doesn't work properly with it anyway.
GDB also often crashes because it cannot read the format.
2021-11-02 17:42:39 +03:00
Nekotekina
6516f565ed MCJIT: don't finalize modules on symbol lookup (workaround)
This is extremely slow yet unnecessary with manual finalization.
In LLVM 6 this wasn't a problem.
2021-11-02 17:42:39 +03:00
Nekotekina
d18817ded9 X86: Fix/workaround Small Code Model for JIT
Force RIP-relative jump tables and global values
These things were causing crashes due to use of absolute addressing
2021-11-02 17:42:39 +03:00
Ivan
8edd96e498 Set up CI with Azure Pipelines 2021-11-02 17:42:39 +03:00
guopeilin
39c406a58f [AArch64][GlobalISel] Use ZExtValue for zext(xor) when invert tb(n)z
Currently, we use SExtValue to decide whether to invert tbz or tbnz.
However, for the case zext (xor x, c), we should use ZExt rather
than SExt otherwise we will generate totally opposite branches.

Reviewed By: paquette

Differential Revision: https://reviews.llvm.org/D108755

(cherry picked from commit 5f48c144c58f6d23e850a1978a6fe05887103b17)
2021-09-21 09:15:10 -07:00
James Henderson
be1489a181 [debuginfo-test][cross-project-tests] Release note for new project name
Add a release note for the renaming of the debuginfo-test to
cross-project-tests, performed in commit
1364750dadbb56032ef73b4d0d8cbc88a51392da and follow-ons.

Reviewed by: sylvestre.ledru

Differential Revision: https://reviews.llvm.org/D110134
2021-09-21 09:48:35 +01:00
Simon Pilgrim
aed4e7449f [X86] combineX86ShuffleChain - ensure we only peek through bitcasts to vectors (PR51858)
When searching for hidden identity shuffles (added at rG41146bfe82aecc79961c3de898cda02998172e4b), only peek through bitcasts to the source operand if it is a vector type as well.

(cherry picked from commit dcba99418438ec1d624ad207674234bd2e9e3394)
2021-09-20 11:22:27 -07:00
Jon Chesterfield
47e63cb60e [openmp] Apply code change from D109500
(cherry picked from commit 71052ea1e3c63b7209731fdc1726d10640d97480)
2021-09-13 20:57:17 -07:00
Florian Hahn
fca643847d [VPlan] Fix crash caused by not updating all users properly.
Users of VPValues are managed in a vector, so we need to be more
careful when iterating over users while updating them. For now, just
copy them.

Fixes 51798.

(cherry picked from commit 368af7558e55039e4e93c3eed68ce00da86e5e35)
2021-09-13 20:56:27 -07:00
Tom Stellard
7b93a88a1e Revert "[AArch64][GlobalISel] Legalize bswap <2 x i16>"
This reverts commit 5cd63e9ec2a385de2682949c0bbe928afaf35c91.

https://bugs.llvm.org/show_bug.cgi?id=51707
2021-09-10 21:09:59 -07:00
Nikita Popov
b6614b2353 Revert [MC][ELF] Emit separate unique sections for different flags
Commit Message from @MaskRay:

Rust has a fragile embed-bitcode implementation
(bddb59cf07/compiler/rustc_codegen_llvm/src/back/write.rs (L970-L1017))
which relied on the previous LLVM MC behavior.  Rust's LLVM fork
has carried a revert. This commit made the similar revert to help
distributions since they would otherwise probably carry a similar patch
(as they ship rust linked against system LLVM).

Fixes https://bugs.llvm.org/show_bug.cgi?id=51207.

Differential Revision: https://reviews.llvm.org/D107216
2021-09-10 16:55:29 -07:00
Elliot Saba
a967752a95 [X86] Don't clobber EBX in stackprobes
On X86, the stackprobe emission code chooses the `R11D` register, which
is illegal on i686.  This ends up wrapping around to `EBX`, which does
not get properly callee-saved within the stack probing prologue,
clobbering the register for the callers.

We fix this by explicitly using `EAX` as the stack probe register.

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D109203

(cherry picked from commit ae8507b0df738205a6b9e3795ad34672b7499381)
2021-09-10 09:30:52 -07:00
Nikita Popov
7d56483207 [IR] Handle constant expressions in containsUndefinedElement()
If the constant is a constant expression, then getAggregateElement()
will return null. Guard against this before calling HasFn().

(cherry picked from commit af382b93831ae6a58bce8bc075458cfd056e3976)
2021-09-10 09:04:21 -07:00
Roman Lebedev
bedf13b1a7 [SimplifyCFG] performBranchToCommonDestFolding(): require block-closed SSA form for bonus instructions (PR51125)
I can't seem to wrap my head around the proper fix here,
we should be fine without this requirement, iff we can form this form,
but the naive attempt (https://reviews.llvm.org/D106317) has failed.
So just to unblock the release, put up a restriction.

Fixes https://bugs.llvm.org/show_bug.cgi?id=51125

(cherry picked from commit 909cba969981032c5740774ca84a34b7f76b909b)
2021-09-10 09:02:26 -07:00
Fraser Cormack
5e5115bbd0 [MemCpyOpt] Fix a variety of scalable-type crashes
This patch fixes a variety of crashes resulting from the `MemCpyOptPass`
casting `TypeSize` to a constant integer, whether implicitly or
explicitly.

Since the `MemsetRanges` requires a constant size to work, all but one
of the fixes in this patch simply involve skipping the various
optimizations for scalable types as cleanly as possible.

The optimization of `byval` parameters, however, has been updated to
work on scalable types in theory. In practice, this optimization is only
valid when the length of the `memcpy` is known to be larger than the
scalable type size, which is currently never the case. This could
perhaps be done in the future using the `vscale_range` attribute.

Some implicit casts have been left as they were, under the knowledge
they are only called on aggregate types. These should never be
scalably-sized.

Reviewed By: nikic, tra

Differential Revision: https://reviews.llvm.org/D109329

(cherry-picked from commit 7fb66d4)
2021-09-09 16:21:27 -07:00
Bradley Smith
28d769100d Workaround incorrect types when lowering fixed length gather/scatter
When lowering a fixed length gather/scatter the index type is assumed to
be the same as the memory type, this is incorrect in cases where the
extension of the index has been folded into the addressing mode.

For now add a temporary workaround to fix the codegen faults caused by
this by preventing the removal of this extension. At a later date the
lowering for SVE gather/scatters will be redesigned to improve the way
addressing modes are handled.

As a short term side effect of this change, the addressing modes
generated for fixed length gather/scatters will not be optimal.

Differential Revision: https://reviews.llvm.org/D109145

(cherry picked from commit 14e1a4a6eef2fb95ec852c9ddfc597f80bba3226)
2021-09-09 09:05:58 -07:00
Bjorn Pettersson
b37f5f2114 Inform pass manager when child loops are deleted
As part of the nontrivial unswitching we could end up removing child
loops. This patch add a notification to the pass manager when
that happens (using the markLoopAsDeleted callback).

Without this there could be stale LoopAccessAnalysis results cached
in the analysis manager. Those analysis results are cached based on
a Loop* as key. Since the BumpPtrAllocator used to allocate
Loop objects could be resetted between different runs of for
example the loop-distribute pass (running on different functions),
a new Loop object could be created using the same Loop pointer.
And then when requiring the LoopAccessAnalysis for the loop we
got the stale (corrupt) result from the destroyed loop.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D109257

(fixes PR51754)
(cherry-picked from commit 0f0344dd1e3b53387bb396070916e67f4c426da6)
2021-09-09 09:04:59 -07:00
serge-sans-paille
601c2dd9dd Fine grain control over some symbol visibility
Setting -fvisibility=hidden when compiling Target libs has the advantage of
not being intrusive on the codebase, but it also sets the visibility of all
functions within header-only component like ADT. In the end, we end up with
some symbols with hidden visibility within llvm dylib (through the target libs),
and some with external visibility (through other libs). This paves the way for
subtle bugs like https://reviews.llvm.org/D101972

This patch explicitly set the visibility of some classes to `default` so that
`llvm::Any` related symbols keep a `default` visibility. Indeed a template
function with `default` visibility parametrized by a type with `hidden`
visibility is granted `hidden` visibility, and we don't want this for the
uniqueness of `llvm::Any::TypeId`.

Differential Revision: https://reviews.llvm.org/D108943
2021-09-08 21:06:19 -07:00
Cullen Rhodes
5f6ef6fbfd [AArch64][SME] Fix imm bug in mov vector to tile aliases
Also fixes a warning mentioned in D109359.

Reviewed By: sdesmalen

Differential Revision: https://reviews.llvm.org/D109363

(cherry picked from commit 89786c2b992c3cb4c4a230542d2af34ec2915a08)
2021-09-08 20:47:08 -07:00
Chen Zheng
921995afd5 Revert "[HardwareLoops] Change order of SCEV expression construction for InitLoopCount."
This causes https://bugs.llvm.org/show_bug.cgi?id=51714 and
is not a right patch according to comments in D91724

This reverts commit 42eaf4fe0adef3344adfd9fbccd49f325cb549ef.

(cherry picked from commit 34badc409cc452575c538c4b6449546adc38f121)
2021-09-08 20:46:17 -07:00
Jonas Paulsson
d21237cb11 [SelectionDAGBuilder] Bugfix in visitInlineAsm()
In case of a virtual register tied to a phys-def, the register class needs to
be computed. Make sure that this works generally also with fast regalloc by
using TLI.getRegClassFor() whenever possible, and make only the case of
'Untyped' use getMinimalPhysRegClass().

Fixes https://bugs.llvm.org/show_bug.cgi?id=51699.

Review: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D109291

(cherry picked from commit 118997d8e931dcb4c6e972611a7e4febcc33a061)
2021-09-08 14:03:50 -07:00
Maksim Panchenko
64f4a52b52 [llvm-objdump] Fix 'llvm-objdump -dr' for executables with relocations
Print relocations interleaved with disassembled instructions for
executables with relocatable sections, e.g. those built with "-Wl,-q".

Differential Revision: https://reviews.llvm.org/D109016

(cherry picked from commit 6300e4ac5806c9255c68c6fada37b2ce70efc524)
2021-09-08 08:45:39 -07:00
Hans Wennborg
09c230ecec Add llvm-ml to LLVM_TOOLCHAIN_TOOLS (PR50536)
so that it gets installed in LLVM_INSTALL_TOOLCHAIN_ONLY builds,
such as used by the Windows installer.

Differential revision: https://reviews.llvm.org/D109358

(cherry picked from commit c364dcbf1fd81c6291e935564fce2d9ebb97a3d0)
2021-09-08 08:44:45 -07:00
David Truby
e0d7c39869 [AArch64][sve] Prevent incorrect function call on fixed width vector
The isEssentiallyExtractHighSubvector function currently calls
getVectorNumElements on a type that in specific cases might be scalable.
Since this function only has correct behaviour at the moment on scalable
types anyway, the function can just return false when given a fixed type.

Differential Revision: https://reviews.llvm.org/D109163

(cherry picked from commit b297531ece896fb9ec36f001a74aef144082602b)
2021-09-08 06:09:19 -07:00
Nikita Popov
3c59cf5aa7 [SCEV] Fix applyLoopGuards() with range check idiom (PR51760)
Due to a typo, this replaced %x with umax(C1, umin(C2, %x + C3))
rather than umax(C1, umin(C2, %x)). This didn't make a difference
for the existing tests, because the result is only used for range
calculation, and %x will usually have an unknown starting range,
and the additional offset keeps it unknown. However, if %x already
has a known range, we may compute a result range that is too
small.

(cherry picked from commit 8d54c8a0c3d7d4a50186ae7087780c6082e5bb46)
2021-09-07 22:34:39 -07:00
Sanjay Patel
8830999b87 [DAGCombine] Prevent the transform of combine for multi-use operand
The test is based on a miscompile example in:
https://llvm.org/PR51321

Differential Revision: https://reviews.llvm.org/D107692

(cherry picked from commit e1e4bf174b09bcd4b25cd624f177537890bff785)
2021-09-07 22:33:53 -07:00
Yunde Zhong
6d085fa2f5 [tests] precommit tests for D107692
(cherry picked from commit 9790a2a72f60bb2caf891658c3c6a02b61e1f1a2)
2021-09-07 22:33:46 -07:00
Andrzej Warzynski
bf02d31357 [docs] Update release notes with items related to Flang
Differential Revision: https://reviews.llvm.org/D109317
2021-09-06 14:48:43 +01:00
Joachim Protze
12537ac90c [libomptarget][amdcgn] Only add opt/llvm-link dependency if TARGET is available
In some build configurations, the target we depend on is not available for declaring the build dependency.
We only need to declare the build dependency, if the build target is available in the same build.

Fixes the issue raised in https://reviews.llvm.org/D107156#2969862
This patch should go into release/13 together with D108404

Differential Revision: https://reviews.llvm.org/D108868

(cherry picked from commit 5ea1c37118699f0ed1da17e0d8562011d0002edd)
2021-09-03 15:49:42 -07:00
Joachim Protze
4b60833c5b [libomptarget][amdcgn] Add build dependency for llvm-link and opt
D107156 and D107320 are not sufficient when OpenMP is built as llvm runtime
(LLVM_ENABLE_RUNTIMES=openmp) because dependencies only work within the same
cmake instance.

We could limit the dependency to cases where libomptarget/plugins are really
built. But compared to the whole llvm project, building openmp runtime is
negligible and postponing the build of OpenMP runtime after the dependencies
are ready seems reasonable.

The direct dependency introduced in D107156 and D107320 is necessary for the
case where OpenMP is built as llvm project (LLVM_ENABLE_PROJECTS=openmp).

Differential Revision: https://reviews.llvm.org/D108404

(cherry picked from commit 4bb36df144127c5bee6ea2607bc544c003aae446)
2021-09-03 15:49:31 -07:00
Fraser Cormack
ba85498148 [RISCV] Fix reporting of incorrect commutable operand indices
This patch fixes an issue where RISCV's `findCommutedOpIndices` would
incorrectly return the pseudo `CommuteAnyOperandIndex` as a commutable
operand index, rather than fixing a specific index.

Reviewed By: rogfer01

Differential Revision: https://reviews.llvm.org/D108206

(cherry picked from commit 5b06cbac11e53ce55f483c1852a108012507a6bb)
2021-09-03 15:48:26 -07:00
Stefan Gränitz
bf7908ca9b [Orc] Enable debug object tests only on x86_64 hosts
These tests rely on running IR code with an explicit x86_64 target triple. They won't work on other architectures. (They won't work for 32-bit processes on x86_64 hosts either. We will take care of this later.)

Differential Revision: https://reviews.llvm.org/D107640

(cherry picked from commit c5ab55f5331c9da3c352b61d10d2f8a470a08b5b)
2021-09-02 14:16:41 -07:00
Petr Hosek
683bdb08a0 [Linker] Support weak symbols in nodeduplicate COMDAT group
When a nodeduplicate COMDAT group contains a weak symbol, choose
a non-weak symbol (or one of the weak ones) rather than reporting
an error. This should address issue PR51394.

With the current IR representation, a generic comdat nodeduplicate
semantics is not representable for LTO. In the linker, sections and
symbols are separate concepts. A dropped weak symbol does not force the
defining input section to be dropped as well (though it can be collected
by GC). In the IR, when a weak linkage symbol is dropped, its associate
section content is dropped as well.

For InstrProfiling, which is where ran into this issue in PR51394, the
deduplication semantic is a sufficient workaround.

Differential Revision: https://reviews.llvm.org/D108689
2021-09-02 14:15:28 -07:00
Arthur Eubanks
e415eb692a [docs] Mention that the legacy PM is deprecated and will be removed after 14
Per https://lists.llvm.org/pipermail/llvm-dev/2021-August/152305.html.

Reviewed By: MaskRay, fhahn

Differential Revision: https://reviews.llvm.org/D109080

(cherry picked from commit 2413d6063b788c3abc69072d48afa0b2a6e3583c)
2021-09-01 23:33:00 -07:00
Nikita Popov
fda0edff63 [NewPM] Add missing LTO ArgPromotion pass
This is a followup to D96780 to add one more pass missing from the
NewPM LTO pipeline. The missing ArgPromotion run is inserted at
the same position as in the LegacyPM, resolving the already
present FIXME:
16086d47c0/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp (L1096-L1098)

The compile-time impact is minimal with ~0.1% geomean regression
on CTMark.

Differential Revision: https://reviews.llvm.org/D108866

(cherry picked from commit b28c3b9d9f4292d7779a0e2661d308f1230c6ecd)
2021-09-01 17:37:57 -07:00
Philip Reames
72d2352801 [AlignFromAssume] Bailout w/non-constant alignments (pr51680)
This is a bailout for pr51680.  This pass appears to assume that the alignment operand to an align tag on an assume bundle is constant.  This doesn't appear to be required anywhere, and clang happily generates non-constant alignments for cases such as this case taken from the bug report:

// clang -cc1 -triple powerpc64-- -S -O1 opal_pci-min.c
extern int a[];
long *b;
long c;
void *d(long, int *, int, long, long, long) __attribute__((__alloc_align__(6)));
void e() {
  b = d(c, a, 0, 0, 5, c);
  b[0] = 0;
}

This was exposed by a SCEV change which allowed a non-constant alignment to reach further into the pass' code.  We could generalize the pass, but for now, let's fix the crash.

(cherry picked from commit 9b45fd909ffa754acbb4e927bc2d55c7ab0d4e3f)
2021-09-01 17:36:37 -07:00
Bjorn Pettersson
6d1749e6c0 [SelectionDAG] Fix miscompile bugs related to smul.fix.sat with scale zero
When expanding a SMULFIXSAT ISD node (usually originating from
a smul.fix.sat intrinsic) we've applied some optimizations for
the special case when the scale is zero. The idea has been that
it would be cheaper to use an SMULO instruction (if legal) to
perform the multiplication and at the same time detect any overflow.
And in case of overflow we could use some SELECT:s to replace the
result with the saturated min/max value. The only tricky part
is to know if we overflowed on the min or max value, i.e. if the
product is positive or negative. Unfortunately the implementation
has been incorrect as it has looked at the product returned by the
SMULO to determine the sign of the product. In case of overflow that
product is truncated and won't give us the correct sign bit.

This patch is adding an extra XOR of the multiplication operands,
which is used to determine the sign of the non truncated product.

This patch fixes PR51677.

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D108938

(cherry picked from commit 789f01283d52065b10049b58a3288c4abd1ef351)
2021-08-31 20:59:28 -07:00