1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
Commit Graph

204199 Commits

Author SHA1 Message Date
Craig Disselkoen
1cbae6c6e8 C API: functions to get mask of a ShuffleVector
This commit fixes a regression (from LLVM 10 to LLVM 11 RC3) in the LLVM
C API.

Previously, commit 1ee6ec2bf removed the mask operand from the
ShuffleVector instruction, storing the mask data separately in the
instruction instead; this reduced the number of operands of
ShuffleVector from 3 to 2. AFAICT, this change unintentionally caused
a regression in the LLVM C API. Specifically, it is no longer possible
to get the mask of a ShuffleVector instruction through the C API. This
patch introduces new functions which together allow a C API user to get
the mask of a ShuffleVector instruction, restoring the functionality
which was previously available through LLVMGetOperand().

This patch also adds tests for this change to the llvm-c-test
executable, which involved adding support for InsertElement,
ExtractElement, and ShuffleVector itself (as well as constant vectors)
to echo.cpp. Previously, vector operations weren't tested at all in
echo.ll.

I also fixed some typos in comments and help-text nearby these changes,
which I happened to spot while developing this patch. Since the typo
fixes are technically unrelated other than being in the same files, I'm
happy to take them out if you'd rather they not be included in the patch.

Differential Revision: https://reviews.llvm.org/D88190
2020-09-25 16:01:05 -07:00
Layton Kifer
6f52fb9013 [TRE][NFC] Refactor Basic Block Processing
Simplify and improve readability.

Differential Revision: https://reviews.llvm.org/D82269
2020-09-25 16:01:05 -07:00
Eli Friedman
1a2bff22f4 [AArch64][SVE] Drop "argmemonly" from gather/scatter with vector base.
The intrinsics don't have any pointer arguments, so "argmemonly" makes
optimizations think they don't write to memory at all.

Differential Revision: https://reviews.llvm.org/D88186
2020-09-25 16:01:05 -07:00
Andrew Litteken
841f42ea48 Revert "[IRSim] Adding basic implementation of llvm-sim."
This reverts commit 15645d044bcfe2a0f63156048b302f997a717688.
2020-09-25 16:18:48 -05:00
Simon Pilgrim
effa5d6f54 Fix copy+paste typo in doxygen parameter name to fix Wdocumentation. NFCI. 2020-09-25 22:09:51 +01:00
Simon Pilgrim
a164751ba9 [InstCombine] matchRotate - support (uniform) constant rotation amounts (PR46895)
This patch adds handling of rotation patterns with constant shift amounts - the next bit will be how we want to support non-uniform constant vectors.

Differential Revision: https://reviews.llvm.org/D87452
2020-09-25 22:03:10 +01:00
Simon Pilgrim
fc99fe9ce5 [InstCombine] Fix test name to match type. NFCI.
We're testing a <2 x i36> not <2 x i16>
2020-09-25 22:00:36 +01:00
Andrew Litteken
7c7bb877bb [IRSim] Adding basic implementation of llvm-sim.
This is a similarity visualization tool that accepts a Module and
passes it to the IRSimilarityIdentifier.  The resulting SimilarityGroups
are output in a JSON file.

Tests are found in test/tools/llvm-sim and check for the file not found,
a bad module, and that the JSON is created correctly.

Reviewers: paquette, jroelofs

Differential Revision: https://reviews.llvm.org/D86974
2020-09-25 15:12:34 -05:00
Simon Pilgrim
1aa5f65d4b [InstCombine] collectBitParts - add fshl/fshr handling
Pulled from D87452, this is a fixed version of the collectBitParts fshl/fshr handling which as @nikic noticed wasn't checking for different providers or had correct bit ordering (which was hid by only testing shift amounts of bitwidth/2).

Differential Revision: https://reviews.llvm.org/D88292
2020-09-25 20:34:59 +01:00
Arthur Eubanks
f62987dedb [LoopReroll][NewPM] Port -loop-reroll to NPM
Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D87957
2020-09-25 12:09:06 -07:00
Adrian Prantl
76f3fb45dc Add a verifier check that rejects non-distinct DISubprogram function
attachments. They would crash the backend, which expects all
DISubprograms that are not part of the type system to have a unit field.

Clang right before https://reviews.llvm.org/D79967 would generate this
kind of broken IR.

rdar://problem/69534688

Thanks to Fangrui for fixing an assembler test I had missed!

https://reviews.llvm.org/D88270
2020-09-25 12:04:46 -07:00
Thomas Lively
06c1a3680b [WebAssembly] Check features before making SjLj vars thread-local
1c5a3c4d3823 updated the variables inserted by Emscripten SjLj lowering to be
thread-local, depending on the CoalesceFeaturesAndStripAtomics pass to downgrade
them to normal globals if the target features did not support TLS. However, this
had the unintended side effect of preventing all non-TLS-supporting objects from
being linked into modules with shared memory, because stripping TLS marks an
object as thread-unsafe. This patch fixes the problem by only making the SjLj
lowering variables thread-local if the target machine supports TLS so that it
never introduces new usage of TLS that will be stripped. Since SjLj lowering
works on Modules instead of Functions, this required that the
WebAssemblyTargetMachine have its feature string updated to reflect the
coalesced features collected from all the functions so that a
WebAssemblySubtarget can be created without using any particular function.

Differential Revision: https://reviews.llvm.org/D88323
2020-09-25 11:45:16 -07:00
Daniel Paoliello
24ad32b97c [Coroutine] Split PHI Nodes in cleanuppad blocks in a way that obeys EH pad rules
Issue Details:
In order to support coroutine splitting, any multi-value PHI node in a coroutine is split into multiple blocks with single-value PHI Nodes, which then allows a subsequent transform to generate `reload` instructions as required (i.e., to reload the value if required if the coroutine has been resumed). This causes issues with EH pads (`catchswitch` and `catchpad`) as all pads within a `catchswitch` must have the same unwind destination, but the coroutine splitting logic may modify them to each have a unique unwind destination if there is a PHI node in the unwind `cleanuppad` that is set from values in the `catchswitch` and `cleanuppad` blocks.

Fix Details:
During splitting, if such a PHI node is detected, then create a "dispatcher" `cleanuppad` as well as the blocks with single-value PHI Nodes: thus the "dispatcher" is the unwind destination and it will detect which predecessor called it and then branch to the appropriate single-value PHI node block, which will then branch back to the original `cleanuppad` block.

Reviewed By: GorNishanov, lxfind

Differential Revision: https://reviews.llvm.org/D88059
2020-09-25 11:30:38 -07:00
Matt Arsenault
0ec533bb8a OpaquePtr: Add type to sret attribute
Make the corresponding change that was made for byval in
b7141207a483d39b99c2b4da4eb3bb591eca9e1a. Like byval, this requires a
bulk update of the test IR tests to include the type before this can
be mandatory.
2020-09-25 14:07:30 -04:00
Florian Hahn
9204e8aa01 [SCEV] Add support for x != 0 to CollectCondition.
Add support for NE predicates with 0 constants. Those can be translated
to UMaxExpr(x, 1).
2020-09-25 18:58:55 +01:00
Florian Hahn
82689ee151 [SCEV] Add another test using info from loop guards for BTC with NE. 2020-09-25 18:58:55 +01:00
Hans Wennborg
dcc4c6d98a Move PassBuilder::registerParseTopLevelPipelineCallback out-of-line
For some mysterious reason it doesn't build with clang-cl when compiled
as part of the includes in clang's CodeGenAction.cpp
(crbug.com/1132292).
2020-09-25 19:55:40 +02:00
Adrian Prantl
c9f20079f3 Revert "Add a verifier check that rejects non-distinct DISubprogram function"
This reverts commit e17f52d623cc146b7d9bf5a2e02965043508b4c4.

while investigating bot breakage.
2020-09-25 10:52:19 -07:00
Matt Arsenault
232a67949a AArch64/GlobalISel: Narrow stack passed argument access size
This fixes a verifier error in the testcase from bug 47619.

The stack passed s3 value was widened to 4-bytes, and producing a
4-byte memory access with a < 1 byte result type. We need to either
widen the result type or narrow the access size. This copies the code
directly from the AMDGPU handling, which narrows the load size. I
don't like that every target has to handle this, but this is currently
broken on the 11 release branch and this is the simplest fix.

This reverts commit 42bfa7c63b85e76fe16521d1671afcafaf8f64ed.
2020-09-25 13:35:17 -04:00
Fangrui Song
3aafaac39d Fix Assembler/disubprogram.ll after e17f52d623cc146b7d9bf5a2e02965043508b4c4 2020-09-25 10:26:35 -07:00
Baptiste Saleil
ffc575b896 [PowerPC] Add accumulator register class and instructions
This patch adds the xxmfacc, xxmtacc and xxsetaccz instructions to manipulate
accumulator registers. It also adds the ACC register class definition for the
accumulator registers.

Differential Revision: https://reviews.llvm.org/D84847
2020-09-25 12:25:13 -05:00
Fangrui Song
d5bd75b062 Fix DISubprogram-v4.ll after e17f52d623cc146b7d9bf5a2e02965043508b4c4 2020-09-25 10:08:43 -07:00
Amara Emerson
d2def942fc [AArch64][GlobalISel] Add selection support for <8 x s16> G_INSERT_VECTOR_ELT with GPR scalar.
Fixes the neon intrinsics test in the test suite.
2020-09-25 09:51:04 -07:00
Florian Hahn
824da4582d [SCEV] Add support for x == constant to CollectCondition.
Add support for EQ predicates with constant operand. In that case, using
the constant instead of an unknown expression should always be
beneficial.
2020-09-25 16:56:49 +01:00
Dávid Bolvanský
9b814fe81c [SystemZ] Optimize bcmp calls (PR47420)
Solves https://bugs.llvm.org/show_bug.cgi?id=47420

Reviewed By: uweigand

Differential Revision: https://reviews.llvm.org/D87988
2020-09-25 17:55:39 +02:00
David Tenty
27ef9572b0 [CMake] Make sure _cmake_system_name has a default
We currently try to pick it up from the CMake arguments passed to llvm_ExternalProject_Add but
if there isn't an explicit option passed, we should reflect CMake's own default behaviour
of targeting the host, since we'll make decisions about what tools to use for the build based on
the setting. Otherwise, we'll get different behaviour between configuring an external project with
the default target and configuring with an explicit one targeting the same platform.

Reviewed By: stevewan, hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D88157
2020-09-25 11:33:12 -04:00
Adrian Prantl
bd0784a5a5 Add a verifier check that rejects non-distinct DISubprogram function
attachments. They would crash the backend, which expects all
DISubprograms that are not part of the type system to have a unit field.

Clang right before https://reviews.llvm.org/D79967 would generate this
kind of broken IR.

rdar://problem/69534688
2020-09-25 08:15:16 -07:00
Cameron McInally
0c606f5b51 [SVE] Revert accidental change from 405e22fbe8719cff6c40eec15c2044f42527f116
Accidentally commited two lines that were not intended. Remove those.
2020-09-25 10:11:10 -05:00
Cameron McInally
823b24f773 [SVE] Lower fixed length VECREDUCE_[SMAX|SMIN] to Scalable
This patch is pretty similar to the VECREDUCE_ADD patch, with some minor tweaks.

Results from the AArch64ISD::[SMAX|SMIN]V_PRED return element sized results. This requires an ANY_EXTEND for results < 32-bits, since Legalization promotes those results.

There is no NEON i64 vector support for SMAXV|SMINV, so use SVE for those.

Differential Revision: https://reviews.llvm.org/D88259
2020-09-25 09:58:17 -05:00
David Tenty
59bfb2c576 [AIX] Try to not use LLVM tools while building runtimes
Since 64-bit XCOFF and the big AR format is not yet supported in some of these tools, this patch avoids additional setup of these tools. This patch is not intended to prevent picking up the LLVM tools if they happen to be available otherwise.

Reviewed By: hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D85329
2020-09-25 10:55:24 -04:00
Florian Hahn
2bc55827ef [SCEV] Swap operands if LHS is not unknown.
Currently we only use information from guards for unknown expressions.
Swap LHS/RHS and predicate, if LHS is not unknown.
2020-09-25 15:50:01 +01:00
Simon Pilgrim
7d071a1cb8 [InstCombine] Add some extra bswap tests from PR39793
Also test for cases where recognizeBSwapOrBitReverseIdiom checks for a truncated bswap pattern.
2020-09-25 15:46:19 +01:00
Simon Pilgrim
7b75368937 [InstCombine] Add 'partial' bswap tests from PR39793
Tests for basic zext(bswap(trunc(x))) patterns shown on PR39793
2020-09-25 15:28:21 +01:00
Florian Hahn
18059fbd55 [SCEV] Extract code to collect conditions to lambda (NFC).
This makes re-using the common functionality easier in follow-up
patches.
2020-09-25 15:12:42 +01:00
Florian Hahn
d7750b1c5c [SCEV] Add more tests using info from loop guards for BTC. 2020-09-25 14:18:58 +01:00
LLVM GN Syncbot
e82f648232 [gn build] Port e336b74c995 2020-09-25 12:13:19 +00:00
Simon Pilgrim
f0bf472ab7 [InstCombine] Add bswap tests from funnel shift intrinsics
Based on (WIP) patch in D87452 - I'm intending to add the intrinsics handling to collectBitParts as a separate patch to make the changes clearer.
2020-09-25 12:40:23 +01:00
Momchil Velikov
e1e1463f1c [AArch64] PAC/BTI code generation for LLVM generated functions
PAC/BTI-related codegen in the AArch64 backend is controlled by a set
of LLVM IR function attributes, added to the function by Clang, based
on command-line options and GCC-style function attributes. However,
functions, generated in the LLVM middle end (for example,
asan.module.ctor or __llvm_gcov_write_out) do not get any attributes
and the backend incorrectly does not do any PAC/BTI code generation.

This patch record the default state of PAC/BTI codegen in a set of
LLVM IR module-level attributes, based on command-line options:

* "sign-return-address", with non-zero value means generate code to
  sign return addresses (PAC-RET), zero value means disable PAC-RET.

* "sign-return-address-all", with non-zero value means enable PAC-RET
  for all functions, zero value means enable PAC-RET only for
  functions, which spill LR.

* "sign-return-address-with-bkey", with non-zero value means use B-key
  for signing, zero value mean use A-key.

This set of attributes are always added for AArch64 targets (as
opposed, for example, to interpreting a missing attribute as having a
value 0) in order to be able to check for conflicts when combining
module attributed during LTO.

Module-level attributes are overridden by function level attributes.
All the decision making about whether to not to generate PAC and/or
BTI code is factored out into AArch64FunctionInfo, there shouldn't be
any places left, other than AArch64FunctionInfo, which directly
examine PAC/BTI attributes, except AArch64AsmPrinter.cpp, which
is/will-be handled by a separate patch.

Differential Revision: https://reviews.llvm.org/D85649
2020-09-25 11:47:14 +01:00
Jay Foad
e5d8c1ade8 [AMDGPU] Fix declaration parameter names to match definition
This fixes the declaration of AMDGPULegalizerInfo::legalizeBufferLoad to
match the definition. It is still confusing that that parameter order is
different from legalizeBufferStore.

https://bugs.llvm.org/show_bug.cgi?id=47535
2020-09-25 11:38:17 +01:00
Jay Foad
21296d3ad3 [SplitKit] In addDeadDef tolerate parent range that defines more lanes
Following on from D87757 "[SplitKit] Only copy live lanes", in
SplitEditor::addDeadDef, when we're checking whether the parent live
interval has a subrange defining the same lanes, tolerate the case
where the parent subrange defines a superset of the lanes. This can
happen when the child subrange comes from SplitEditor::buildCopy
decomposing a partial copy into a sequence of subreg copies that cover
the required lanes.

Differential Revision: https://reviews.llvm.org/D88020
2020-09-25 11:31:56 +01:00
Simon Pilgrim
38fb64abd8 Revert rGe55410f8b260 : "AArch64/GlobalISel: Add testcase for bug 47619"
This reverts commit e55410f8b260a2868d600ca99fe5ee80f9cd4fc5.

This is failing on EXPENSIVE_CHECKS buildbots
2020-09-25 11:31:14 +01:00
Georgii Rymar
526ef95b26 [Object/yaml2obj/obj2yaml][test] - Split, cleanup and move MIPS abi-flags.yaml test. NFCI.
We have the `Object/Mips/abi-flags.yaml` which tests how yaml2obj/obj2yaml
handle `SHT_MIPS_ABIFLAGS` sections.

This patch splits it into two tests: one for obj2yaml and one for yaml2obj
and moves the result to right places.

Differential revision: https://reviews.llvm.org/D88231
2020-09-25 12:04:55 +03:00
Amara Emerson
14b2a06b65 [AArch64][GlobalISel] Manually select G_DUP with s8/s16 gpr scalar operands.
These don't get selected by the imported patterns, and avoiding generating them
is a whole load of not-worth-it-hassle (until we have fp types in GlobalISel).
2020-09-25 01:59:16 -07:00
Amara Emerson
c10d4840ee [AArch64][GlobalISel] Make <8 x s16> for G_INSERT_VECTOR_ELT legal. 2020-09-25 01:59:16 -07:00
Sam Parker
a28cbccef7 [ARM] Find VPT implicitly predicated by VCTP
On failing to find a VCTP in the list of instructions that explicitly
predicate the entry of a VPT block, inspect whether the block is
controlled via VPT which is implicitly predicated due to it's
predicated operand(s).

Differential Revision: https://reviews.llvm.org/D87819
2020-09-25 08:50:53 +01:00
Ian Levesque
919066e494 [xray] Function coverage groups
Add the ability to selectively instrument a subset of functions by dividing the functions into N logical groups and then selecting a group to cover. By selecting different groups over time you could cover the entire application incrementally with lower overhead than instrumenting the entire application at once.

Differential Revision: https://reviews.llvm.org/D87953
2020-09-24 22:09:53 -04:00
Mehdi Amini
ded74e922b Hint how to get a symbolized stack trace if llvm-symbolizer is not found on crashes
Most users of LLVM tools hit the raw traces and don't know how to get LLVM to
symbolize automatically for them.

When we print the non-symbolized stack trace, we will add information about
how to get it symbolized.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D88269
2020-09-25 01:52:20 +00:00
Krzysztof Parzyszek
df96f62f63 [Hexagon] Avoid crash on CONCAT_VECTORS with illegal element types
Legal vector element types may not be legal as scalar types. When
CONCAT_VECTORS is converted to BUILD_VECTOR, the individual vector
elements become standalone operands to the build operation. If they
have illegal (scalar) types, they need to be made legal. In doing
so, the case of TRUNCATE was not handled, causing an assertion to
fail.
2020-09-24 20:05:23 -05:00
Juneyoung Lee
c5b0e93f4a [ValueTracking] Make isGuaranteedNotToBeUndefOrPoison exit early when MetadataAsValue is given
It is set to conservatively return false, otherwise noundef attributes are added to function calls with metadata arguments.
2020-09-25 09:50:09 +09:00
Juneyoung Lee
4311585bec [ValueTracking] Check uses of Argument if it is given to isGuaranteedNotToBeUndefOrPoison
This is a patch that allows isGuaranteedNotToBeUndefOrPoison to return more precise result
when an argument is given, by looking through its uses at the entry block (and following blocks as well, if it is checking poison only).

This is useful when there is a function call with noundef arguments at the entry block.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D88207
2020-09-25 08:57:57 +09:00