1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
Commit Graph

217986 Commits

Author SHA1 Message Date
Fangrui Song
a3ca7c81a9 [llvm-objcopy][MachO] Support ARM64_RELOC_ADDEND
An ARM64_RELOC_ADDEND relocation reuses the symbol field for the addend value.
We should pass through such relocations.

Reviewed By: alexander-shaposhnikov

Differential Revision: https://reviews.llvm.org/D104967
2021-06-29 11:23:30 -07:00
Jacob Hegna
f4bf136cf5 [NFC] clang-format on InlineCost.cpp and InlineAdvisor.h. 2021-06-29 18:15:27 +00:00
Nikita Popov
a2c6bb600a [OpaquePtr] Support forward references in textual IR
Currently, LLParser will create a Function/GlobalVariable forward
reference based on the desired pointer type and then modify it when
it is declared. With opaque pointers, we generally do not know the
correct type to use until we see the declaration.

Solve this by creating the forward reference with a dummy type, and
then performing a RAUW with the correct Function/GlobalVariable when
it is declared. The approach is adopted from
b5b55963f6.

This results in a change to the use list order, which is why we see
test changes on some module passes that are not stable under use list
reordering.

Differential Revision: https://reviews.llvm.org/D104950
2021-06-29 20:10:31 +02:00
Craig Topper
a7bbefe73d [LegalizeTypes][VE] Don't Expand BITREVERSE/BSWAP during type legalization promotion if they will be promoted for NVT in op legalization.
We were trying to expand these if they were going to be expanded
in op legalization so that we generated the minimum number of
operations. We failed to take into account that NVT could be
promoted to another legal type in op legalization.

Hoping this fixes the issue on the VE target reported as a follow
up to D96681. The check line changes were taken from before
1e46b6f4012399a2fef5fbbb4ed06fc919835414 so this patch does
appear to improve some cases that had previously regressed.
2021-06-29 11:00:11 -07:00
Nick Desaulniers
fd64c3a741 [Inline] prevent inlining on noprofile mismatch
Similar to
commit bc044a88ee3c ("[Inline] prevent inlining on stack protector mismatch")

The noprofile function attribute is meant to prevent compiler
instrumentation from being inserted into a function. Inlining may defeat
the developer's intent. If the caller and callee don't either BOTH have
the attribute or BOTH lack the attribute, suppress inline substitution.

This matches behavior being proposed in GCC:
https://gcc.gnu.org/pipermail/gcc-patches/2021-June/573511.html
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80223

Add LangRef entry for noprofile fn attr, similar to text added in D93422
and D104944.

Reviewed By: MaskRay, melver, phosek

Differential Revision: https://reviews.llvm.org/D104810
2021-06-29 10:32:03 -07:00
Alexey Bataev
8ff5759dd2 [INSTCOMBINE] Transform reduction(shuffle V, poison, unique_mask) to reduction(V).
After SLP + LTO we may have have reduction(shuffle V, poison,
mask). This can be simplified to just reduction(V) if the mask is only
for single vector and just all elements from this vector are permuted,
  without reusing, replacing with undefs and/or other values, etc.

Differential Revision: https://reviews.llvm.org/D105053
2021-06-29 10:02:38 -07:00
Craig Topper
dbb86a4f63 [RISCV] Protect the SHL/SRA/SRL handlers in LowerOperation against being called for an illegal i32 shift amount.
It seems it is possible for DAG combine to create a shl with an
i64 result type and an i32 shift amount. This is ok before type
legalization since the type don't need to match in SelectionDAG.
This results in type legalization calling LowerOperation to
legalize just the amount. We weren't expecting this so we
asserted for not finding a fixed vector shift.

To fix this, I've added a check for the fixed vector case and
returned SDValue() to get the default type legalizer. I've
factored all shifts together and added a fixed vector specific
handler to avoid repeating similar code for each in
LowerOperation.

The particular case I found was exposed by D104581, but the bad
shift is created after that patch triggers.
2021-06-29 09:45:13 -07:00
gbreynoo
39a9ec9e1c [llvm-objdump] Add --no-print-imm-hex to the command guide
The option --no-print-imm-hex was not included in the command guide for
llvm-objdump but appears in the help text. This commit adds it to the
command guide.

Differential Revision: https://reviews.llvm.org/D104717
2021-06-29 17:18:32 +01:00
gbreynoo
07b4e4ed2f [llvm-objdump] Add testing for --print-imm-hex, --headers, --section-headers and --private-headers
llvm-objdump had some missing coverage that is fixed by this change:
- A test specifically for --print-imm-hex, and coverage of --no-print-imm-hex
- section-headers.test checks the aliases --headers or --section-headers
- A test for the use of --private-headers for ELF that checks the output
- A test for ELF program headers

Differential Revision: https://reviews.llvm.org/D103974
2021-06-29 17:03:21 +01:00
Piotr Sobczak
8db71b419f [AMDGPU] Fix 224-bit spills
Related to D104622.

Differential Revision: https://reviews.llvm.org/D105109
2021-06-29 17:52:16 +02:00
David Green
fb194b2e47 [ARM] Extra test for gep immediate costs. NFC 2021-06-29 16:51:47 +01:00
LLVM GN Syncbot
93f53bac4a [gn build] Port d03aa7d6b66f 2021-06-29 15:41:00 +00:00
Eugene Zhulenev
260c6f5e5f [perf] Fix a data race in the PerfJITEventListener
Concurrent JIT compilation + PerfJITEventListener triggers tsan error

Reviewed By: cota

Differential Revision: https://reviews.llvm.org/D104977
2021-06-29 08:30:31 -07:00
Florian Hahn
785de491d5 [SCCP] Extend tests added 1092357ccdc9 in with UREM/SREM by 0.
Add additional coverage for computing UREM/SREM C, 0.
2021-06-29 16:08:56 +01:00
Philip Reames
718aae50fc [LV] Fix bug when unrolling (only) a loop with non-latch exit
If we unroll a loop in the vectorizer (without vectorizing), and the cost model requires a epilogue be generated for correctness, the code generation must actually do so.

The included test case on an unmodified opt will access memory one past the expected bound.  As a result, this patch is fixing a latent miscompile.

Differential Revision: https://reviews.llvm.org/D103700
2021-06-29 08:04:26 -07:00
Jeremy Morse
cc491fbe18 Catch an extremely obvious memory leak, thanks asan
https://lab.llvm.org/buildbot/#/builders/5/builds/9208

(dbg-phis-merging-in-ldv.mir and dbg-phis-with-loops.mir in the asan
 check stage)
2021-06-29 15:47:17 +01:00
Johannes Doerfert
ab6a6eee6b [Attributor][NFCI] Make the state of AAValueSimplify explicit
As we have done with other states we want the AAValueSimplify state to
be explicit to use it more easily in our helpers.
2021-06-29 09:38:22 -05:00
Johannes Doerfert
a031eae9ff [Attributor][NFCI] Remove unneeded namespace 2021-06-29 09:38:20 -05:00
Johannes Doerfert
3ea2170c4d [Attributor] Teach AAPotentialValues about constant select conditions
There was a TODO but now we actually check if the select condition is
assumed constant and only look at the relevant operand.
2021-06-29 09:38:18 -05:00
Johannes Doerfert
18ba32676c [Attributor][NFC] Clang format 2021-06-29 09:38:15 -05:00
Johannes Doerfert
ea0c08f69f [InstCombine] Gracefully handle an alloca outside the alloca-AS
While we might eventually want to disallow allocas that do not have the
alloca-AS set, it seems undesirable to crash on them. Add a cast when
required so that we can support such allocas (at least here).

Differential Revision: https://reviews.llvm.org/D104866
2021-06-29 09:38:13 -05:00
David Sherwood
6d130d7c16 Revert "[NFC] Remove shadowed variable in InnerLoopVectorizer::createInductionVariable"
This reverts commit 9dde51416209a5552156384b9c2b08b676818d70.
2021-06-29 15:20:22 +01:00
Dylan Fleming
277920c0ec [SVE] Added CodeGen support for inserting an element into a predicate vector
Reviewed By: sdesmalen

Differential Revision: https://reviews.llvm.org/D104722
2021-06-29 14:55:40 +01:00
Jeremy Morse
62063d6d86 [DebugInstrRef][3/3] Follow DBG_PHI instructions through LiveDebugValues
This patch reads machine value numbers from DBG_PHI instructions (marking
where SSA PHIs used to be), and matches them up with DBG_INSTR_REF
instructions that refer to them. Essentially they are two separate parts of
a DBG_VALUE: the place to read the value (register and program position),
and where the variable is assigned that value.

Sometimes these DBG_PHIs can be duplicated, usually by tail duplication.
This corresponds to the SSA structure of the program being destroyed, and
the original PHI being split. When this happens: run LLVMs standard
SSAUpdater utility, to work out what values should appear in which blocks.
The majority of this patch is boilerplate to make use of SSAUpdater.

If there are any additional PHIs on the path between multiple DBG_PHIs and
their using DBG_INSTR_REF, their existance is validated, just in case a
value gets clobbered along the way (see dbg-phis-with-loops.mir for
several examples).

Differential Revision: https://reviews.llvm.org/D86814
2021-06-29 14:45:13 +01:00
Ben Shi
cb125f06fc [AVR] Fix a bug in prologue of ISR
The r1 register should be cleared in prologue of ISR as it is used
as constant zero.

Reviewed By: dylanmckay

Differential Revision: https://reviews.llvm.org/D99467
2021-06-29 21:44:50 +08:00
Simon Pilgrim
2b3aa9d368 [X86] Add cmov i33 sgt test case
Suggested on D101074 - add a 'icmp sgt i64 %0, -2147483649' comparison that can fold to 'icmp sge i64 %0, -2147483648' on D101074 allowing i32 immediate folding
2021-06-29 14:36:33 +01:00
David Sherwood
5545465662 [NFC] Remove shadowed variable in InnerLoopVectorizer::createInductionVariable
Avoid creating a IRBuilder stack variable with the same name as the
class member.
2021-06-29 14:34:30 +01:00
Tim Northover
b0c708ce07 ARM: fix vacuously true assertion to actually check what it should. NFC. 2021-06-29 14:24:03 +01:00
Florian Hahn
d2c5dfe27a [SCCP] Add tests with urem/srem with 2 constant operands.
Reduced test case for PR49731.
2021-06-29 14:19:52 +01:00
David Sherwood
aca55c1db1 Revert "[NFC] Remove shadowed variable in InnerLoopVectorizer::createInductionVariable"
This reverts commit dcfc2c3fac980b137415c17f2f19c06c3e2bd7fb.
2021-06-29 14:04:42 +01:00
Florian Hahn
9615e680f2 [LV] Fix crash when target instruction for sinking is dead.
This patch fixes a crash when the target instruction for sinking is
dead. In that case, no recipe is created and trying to get the recipe
for it results in a crash. To ensure all sink targets are alive, find &
use the first previous alive instruction.

Note that the case where the sink source is dead is already handled.

Found by
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=35320

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D104603
2021-06-29 13:31:22 +01:00
Alexey Bataev
45a9df5860 [InstCombine]Add a test for reductions after shuffles, NFC. 2021-06-29 05:27:56 -07:00
David Sherwood
753f3c1d53 [LoopVectorize] Add support for scalable vectorization of invariant stores
Previously in setCostBasedWideningDecision if we encountered an
invariant store we just assumed that we could scalarize the store
and called getUniformMemOpCost to get the associated cost.
However, for scalable vectors this is not an option because it is
not currently possibly to scalarize the store. At the moment we
crash in VPReplicateRecipe::execute when trying to scalarize the
store.

Therefore, I have changed setCostBasedWideningDecision so that if
we are storing a scalable vector out to a uniform address and the
target supports scatter instructions, then we should use those
instead.

Tests have been added here:

  Transforms/LoopVectorize/AArch64/sve-inv-store.ll

Differential Revision: https://reviews.llvm.org/D104624
2021-06-29 11:56:09 +01:00
Roman Lebedev
35e351f514 [NFC][InstCombine] foldAggregateConstructionIntoAggregateReuse(): cast to Instruction eagerly
In all of these, the value must be an instruction for us to succeed anyway,
so change it to maybe hopefully make further changes more straight-forward.
2021-06-29 13:29:18 +03:00
David Green
112f77cc7c [ARM] Fold extract of ARM_BUILD_VECTOR
This adds a small fold for extract (ARM_BUILD_VECTOR) to fold to the
original node. This can help simplify the resulting codegen in some
cases.

Differential Revision: https://reviews.llvm.org/D104860
2021-06-29 11:03:19 +01:00
LLVM GN Syncbot
9bb30676fd [gn build] Port 9b02a9b40150 2021-06-29 09:44:27 +00:00
LLVM GN Syncbot
c68d0345e7 [gn build] Port 159024ce2315 2021-06-29 09:44:26 +00:00
Tianqing Wang
66fd6df972 [X86] Add a test to reveal a bug in CMOV conversion.
CMOV conversion first rewrites all CMOVs with memory load to branches.
Then runs a second pass to convert other CMOVs in loops if profitable.
But the first pass doesn't add new basic blocks to MachineLoopInfo,
CMOVs in these blocks are ignored in the subsequent pass.

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D104692
2021-06-29 16:37:19 +08:00
Florian Hahn
8002fe7d67 [BasicAA] Be more careful with modulo ops on VariableGEPIndex.
(V * Scale) % X may not produce the same result for any possible value
of V, e.g. if the multiplication overflows. This means we currently
incorrectly determine NoAlias in some cases.

This patch updates LinearExpression to track whether the expression
has NSW and uses that to adjust the scale used for alias checks.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D99424
2021-06-29 09:22:36 +01:00
Soham Dixit
2186304c09 [DebugInfo] Bug 41152 - Improve dumping of empty location expressions
Fixes PR41152 (https://bugs.llvm.org/show_bug.cgi?id=41152).

Reviewed by: jhenderson, dblaikie, SouraVX

Differential Revision: https://reviews.llvm.org/D103502
2021-06-29 09:21:00 +01:00
Alexander Shaposhnikov
80b24cf0f0 Revert "[llvm-objcopy][MachO] Minor code cleanup"
This reverts commit c94cf97b53566a26245c54ea0c41b0dc83daf8a0
since it appears to have broken linaro-clang-armv7-quick build bot
and needs further investigation.
2021-06-29 01:18:48 -07:00
David Sherwood
2bd098b59e [NFC] Remove shadowed variable in InnerLoopVectorizer::createInductionVariable
Avoid creating a IRBuilder stack variable with the same name as the
class member.
2021-06-29 09:14:35 +01:00
Alexander Shaposhnikov
bb669b7109 [llvm-objcopy][MachO] Minor code cleanup
Remove unnecessary template in MachOReader.cpp. NFC.
2021-06-28 22:51:02 -07:00
Michael Liao
58a44149ab [MIRParser] Add machine metadata.
- Add standalone metadata parsing support so that machine metadata nodes
  could be populated before and accessed during MIR is parsed.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D103282
2021-06-28 22:29:36 -04:00
Xun Li
b6f60388ba [Coroutines] Remove CoroElide from O0 pipeline
CoroElide pass works only when a post-split coroutine is inlined into another post-split coroutine.
In O0, there is no inlining after CoroSplit, and hence no CoroElide can happen.
It's useless to put CoroElide pass in the O0 pipeline and it will never be triggered (unless I miss anything).

Differential Revision: https://reviews.llvm.org/D105066
2021-06-28 19:28:27 -07:00
Greg Clayton
35965d72e0 Fix a case where multiple symbols with zero size would cause duplicate entries in gsym files.
Symbol tables can have symbols with no size in mach-o files that were failing to get combined into a single entry. This resulted in many duplicate entries for the same address and made gsym files larger.

Differential Revision: https://reviews.llvm.org/D105068
2021-06-28 18:26:26 -07:00
Lang Hames
8ce4e9967f [JITLink][ELF] Move ELF section and symbol parsing into ELFLinkGraphBuilder.
Move architecture independent ELF parsing/graph-building code from
ELFLinkGraphBuilder_x86_64 to the ELFLinkGraphBuilder base class template.
2021-06-29 09:59:49 +10:00
Philip Reames
d80c16b06b Precommit miscompile test from D103700 2021-06-28 16:00:42 -07:00
Stanislav Mekhanoshin
d434a51f8d [IR] Fix replaceUsesWithIf ponetial issue with constants
There can be a use after free in the Value::replaceUsesWithIf()
if two uses point to the same constant. Patch defers handling
of the constants past the iterator scan.

Another potential issue is that handleOperandChange updates all
the uses in a given Constant, not just the one passed to
ShouldReplace. Added a FIXME comment.

Both issues are not currently exploitable as the only use of
this call with constants avoids it.

Differential Revision: https://reviews.llvm.org/D105061
2021-06-28 15:55:55 -07:00
Joseph Huber
01b46e36dd [OpenMP] Run the OpenMPOpt module pass at O1
Now that the OpenMPOpt module pass include important optimizations for removing
globalization from offloading regions it should be run at a lower optimization
level.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D105056
2021-06-28 18:47:41 -04:00