204638 Commits

Author SHA1 Message Date
Michael Kruse
a5187b0c04 [docs] Revise loop terminology reference.
Motivated by D88183, this seeks to clarify the current loop nomenclature with added illustrations, examples for possibly unexpected situations (infinite loops not part of the "parent" loop, logical loops sharing the same header, ...), and clarification on what other sources may consider a loop. The current document also has multiple errors that are fixed here.

Some selected errors:
 * Loops a defined as strongly-connected components. A component a partition of all nodes, i.e. a subloop can never be a component. That is, the document as it currently is only covers top-level loops, even it also uses the term SCC for subloops.
 * "a block can be the header of two separate loops at the same time" (it is considered a single loop by LoopInfo)
 * "execute before some interesting event happens" (some interesting event is not well-defined)

Reviewed By: baziotis, Whitney

Differential Revision: https://reviews.llvm.org/D88408
2020-10-05 10:28:04 -05:00
Wenlei He
ddbd7fdf6a Revert SVML support for sqrt
As was brought up in D87169 by @craig.topper we shouldn't map llvm.sqrt to svml since there is a faster native instruction.
https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_sqrt_p&expand=5824,5823,5356,5823,5825,5365,5356

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D88620
2020-10-05 08:13:11 -07:00
Joseph Huber
34a590c455 [OpenMP] Add Error Handling for Conflicting Pointer Sizes for Target Offload
Summary:
This patch adds an error to Clang that detects if OpenMP offloading is
used between two architectures with incompatible pointer sizes. This
ensures that the data mapping can be done correctly and solves an issue
in code generation generating the wrong size pointer. This patch adds a
new lit substitution, %omp_powerpc_triple that, if the system is 32-bit or
64-bit, sets the powerpc triple accordingly. This was required to fix
some OpenMP tests that automatically populated the target architecture.

Reviewers: jdoerfert

Subscribers: cfe-commits guansong sstefan1 yaxunl delcypher

Tags: OpenMP clang LLVM

Differential Revision: https://reviews.llvm.org/D88594
2020-10-05 11:02:13 -04:00
Jonas Paulsson
501a93eef5 [SystemZ] Add support for .insn directives for vector instructions.
Support VRI, VRR, VRS, VRV, VRX, VSI instruction formats with the .insn
directive.

Review: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D88357
2020-10-05 16:53:13 +02:00
Sam Tebbs
6c3a9fc4e1 [ARM]Fold select_cc(vecreduce_[u|s][min|max], x) into VMINV or VMAXV
This folds a select_cc or select(set_cc) of a max or min vector reduction with a scalar value into a VMAXV or VMINV.

    Differential Revision: https://reviews.llvm.org/D87836
2020-10-05 15:51:28 +01:00
Florian Hahn
000449765c [VPlan] Clean up uses/operands on VPBB deletion.
Update the code responsible for deleting VPBBs and recipes to properly
update users and release operands.

This is another preparation for D84680 & following patches towards
enabling modeling def-use chains in VPlan.
2020-10-05 14:43:52 +01:00
David Green
992f992aa9 [LV] Regenerate test. NFC
This just reruns the update script to add the new
[[LOOP0:!llvm.loop !.*]] checks to remove them from
other diffs.
2020-10-05 13:46:15 +01:00
Simon Pilgrim
0ea0f77240 [ValueTracking] canCreateUndefOrPoison - use APInt to check bounds instead of getZExtValue().
Fixes OSS Fuzz #26135
2020-10-05 13:45:27 +01:00
Carl Ritson
666d3f19bf [AMDGPU][RegAlloc][SplitKit] Pre-commit test for D88821 2020-10-05 20:35:42 +09:00
Dmitry Preobrazhensky
487e45e4f5 [TableGen] Added a function for identification of unsupported opcodes.
This change implements generation of a function which may be used by a backend to check if a given instruction is supported for a specific subtarget.

Reviewers: sdesmalen

Differential Revision: https://reviews.llvm.org/D88214
2020-10-05 14:23:41 +03:00
Sebastian Neubauer
a7d36c5f92 [AMDGPU] Use tablegen for argument indices
Use tablegen generic tables to get the index of image intrinsic
arguments.
Before, the computation of which image intrinsic argument is at which
index was scattered in a few places, tablegen, the SDag instruction
selection and GlobalISel. This patch changes that, so only tablegen
contains code to compute indices and the ImageDimIntrinsicInfo table
provides these information.

Differential Revision: https://reviews.llvm.org/D86270
2020-10-05 11:50:52 +02:00
Kazushi (Jam) Marukawa
49c2273dfd [VE] Support register and frame-index pair correctly
Support register and frame-index pair correctly as operands of
generic load/store instrucitons, e.g. LD1BZXrri, STLrri, and etc.
Add regression tests also.

Differential Revision: https://reviews.llvm.org/D88779
2020-10-05 18:36:53 +09:00
Jay Foad
22df641aca [AMDGPU] Make bfe patterns divergence-aware
This tends to increase code size but more importantly it reduces vgpr
usage, and could avoid costly readfirstlanes if the result needs to be
in an sgpr.

Differential Revision: https://reviews.llvm.org/D88580
2020-10-05 09:55:10 +01:00
Jay Foad
ba3ba3a03c [AMDGPU] Split R600 and GCN bfe patterns
This is in preparation for making the GCN patterns divergence-aware.
NFC.

Differential Revision: https://reviews.llvm.org/D88579
2020-10-05 09:55:10 +01:00
Gabriel Hjort Åkerlund
ba5a05d667 [TableGen][GlobalISel] add handling of nested *_SUBREG
When nesting INSERT_SUBREG and EXTRACT_SUBREG, GlobalISelEmitter would
fail to find the register class of the nested node. This patch fixes
that for registers with subregs.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D88487
2020-10-05 10:42:18 +02:00
Markus Lavin
f177a262e2 [DebugInfo] Improve dbg preservation in LSR.
Use SCEV to salvage additional @llvm.dbg.value that have turned into
referencing undef after transformation (and traditional
salvageDebugInfo). Before transformation compute SCEV for each
@llvm.dbg.value in the loop body and store it (along side its current
DIExpression). After transformation update those @llvm.dbg.value now
referencing undef by comparing its stored SCEV to the SCEV of the
current loop-header PHI-nodes. Allow match with offset by inserting
compensation code in the DIExpression.

Fixes : PR38815

Differential Revision: https://reviews.llvm.org/D87494
2020-10-05 09:55:16 +02:00
Jonas Devlieghere
369aa73a5a [llvm] Rename DwarfFile to DWARFFile to fix ODR violation (NFC)
Rename the DwarfFile class in DWARFLinker to DWARFFile. This is
consistent with the other DWARF classes and avoids a ODR violation with
the DwarfFile class in AsmPrinter.
2020-10-04 23:46:36 -07:00
Craig Topper
e26792dd8f [X86] MWAITX_SAVE_RBX should not have EBX as an implicit use.
RBX was copied to a virtual register before this instruction
was created. And the EBX input for the final MWAITX is still
in a virtual register. So EBX isn't read by this pseudo.
2020-10-04 20:34:31 -07:00
David Blaikie
f900b58379 llvm-dwarfdump: Don't try to parse rnglist tables when dumping CUs
It's not possible to do this in complete generality - a CU using a
sec_offset DW_AT_ranges has no way of knowing where its rnglists
contribution starts, so should not attempt to parse any full rnglist
table/header to do so. And even using FORM_rnglistx there's no need to
parse the header - the offset can be computed using the CU's DWARF
format (32 or 64) to compute offset entry sizes, and then the list
parsed at that offset without ever trying to find a rnglist contribution
header immediately prior to the rnglists_base.
2020-10-04 19:18:14 -07:00
David Blaikie
bb57d88283 llvm-dwarfdump: Add support for DW_RLE_startx_endx 2020-10-04 17:50:43 -07:00
Craig Topper
7a99e30464 [X86] Remove MWAITX_SAVE_EBX pseudo instruction. Always save/restore the full %rbx register even in gnux32.
ebx/rbx only needs to be saved when 64-bit registers are supported
anyway. It should be fine to save/restore the whole rbx register
even in gnux32 where the base is technically just ebx.

This matches what we do for cmpxchg16b where rbx is saved/restored
regardless of gnux32.
2020-10-04 16:28:15 -07:00
David Blaikie
6fd7bf4523 llvm-dwarfdump: Print addresses in debug_line to the parsed address size 2020-10-04 16:05:49 -07:00
Yuanfang Chen
1948b58c36 [NewPM] collapsing nested pass mangers of the same type
This is one of the reason for extra invalidations in D84959. In
practice, I don't think we have use cases needing this. This simplifies
the pipeline a bit and prune corner cases when considering
invalidations.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D85676
2020-10-04 15:57:13 -07:00
Yuanfang Chen
22d49b0493 [NFCI] Remove unnecessary trailing undef in RuntimeLibcalls.def
All uses of the file undef the macro already.
2020-10-04 15:57:13 -07:00
David Blaikie
226999dbe2 llvm-dwarfdump: Dump address forms in their encoded length rather than always in 64 bits
Few places did this already - refactor them all into a common helper.
2020-10-04 15:48:57 -07:00
Fangrui Song
9382312eec [DomTree] findNearestCommonDominator: assert the nodes are in tree
i.e. they cannot be unreachable from the entry (which usually indicate usage errors).
This change allows the removal of some nullptr checks.

Reviewed By: kuhar

Differential Revision: https://reviews.llvm.org/D88758
2020-10-04 15:35:14 -07:00
Craig Topper
2fdaef6a15 [X86] Correct the implicit defs/uses for the MWAITX pseudo instructions.
MWAITX doesn't touch EFLAGS so no pseudos should def EFLAGS.

The SAVE_EBX/RBX pseudos only needs to def the EBX register that
the expansion overwrites. The EAX and ECX registers are only read.

The pseudo emitted during isel that is used by the custom inserter
shouldn't have any implicit defs or uses since everything is in
vregs.
2020-10-04 15:28:38 -07:00
Craig Topper
36c60c4742 [X86] Remove usesCustomInserter from MWAITX_SAVE_EBX and MWAITX_SAVE_RBX. NFC
These are now emitted by a CustomInserter rather than using a custom
inserter themselves.
2020-10-04 15:28:38 -07:00
Stephen Neuendorffer
bcb409d3b1 Revert "[RFC] Factor out repetitive cmake patterns for llvm-style projects"
This reverts commit e9b87f43bde8b5f0d8a79c5884fdce639b12e0ca.

There are issues with macros generating macros without an obvious simple fix
so I'm going to revert this and try something different.
2020-10-04 15:17:34 -07:00
Arthur Eubanks
e7f476cce6 [Coroutines][NewPM] Fix coroutine tests under new pass manager
Some new function parameter attributes are derived under NPM.

Reviewed By: rjmccall

Differential Revision: https://reviews.llvm.org/D88760
2020-10-04 14:19:29 -07:00
Roman Lebedev
59058ed191 [NFC][SCEV] Add a test with some patterns where we could treat inttoptr/ptrtoint as semi-transparent 2020-10-05 00:05:39 +03:00
David Blaikie
8abb392de3 llvm-dwarfdump: Skip tombstoned address ranges
Make the dumper & API a bit more informative by using the new tombstone
addresses to filter out or otherwise render more explicitly dead code
ranges.
2020-10-04 13:43:29 -07:00
Nikita Popov
37e53cdb15 [MemCpyOpt] Add tests for call slot optimization with GEPs (NFC) 2020-10-04 22:26:05 +02:00
Nikita Popov
c98933e02d [MemCpyOpt] Don't use array allocas in tests (NFC)
Apparently querying dereferenceability of array allocations is
being intentionally penalized (https://reviews.llvm.org/D41398),
so avoid using them in tests.
2020-10-04 21:50:27 +02:00
Martin Storsjö
5874815ad0 [X86] Remove an accidentally added file. NFC.
This file seems to have been accidentally added as part of commit
413577a8790407d75ba834fa5668c2632fe1851e.
2020-10-04 22:33:26 +03:00
Fangrui Song
5757d9663a [SDA] Fix -Wunused-function in -DLLVM_ENABLE_ASSERTIONS=off builds 2020-10-04 12:17:16 -07:00
LLVM GN Syncbot
90e91d175f [gn build] Port 6c6cd5f8a97 2020-10-04 19:10:39 +00:00
Craig Topper
e24e1a2fb1 [X86] Sync AESENC/DEC Key Locker builtins with gcc.
For the wide builtins, pass a single input and output pointer to
the builtins. Emit the GEPs and input loads from CGBuiltin.
2020-10-04 12:09:41 -07:00
Craig Topper
91a84f8e39 [X86] Synchronize the encodekey builtins with gcc. Don't assume void* is 16 byte aligned.
We were taking multiple pointer arguments in the builtin.
gcc accepts a single void*.

The cast from void* to _m128i* caused the IR generation to assume
the pointer was aligned.

Instead make the builtin take a single void*, emit i8* GEPs to
adjust then cast to <2 x i64>* and perform a store with align of 1.
2020-10-04 12:09:35 -07:00
Craig Topper
8d06bb420a [X86] Synchronize the loadiwkey builtin operand order with gcc version. 2020-10-04 12:09:29 -07:00
Florian Hahn
8d81d843da [VPlan] Add VPRecipeBase::toVPUser helper (NFC).
This adds a helper to convert a VPRecipeBase pointer to a VPUser, for
recipes that inherit from VPUser. Once VPRecipeBase directly inherits
from VPUser this helper can be removed.
2020-10-04 19:43:27 +01:00
Florian Hahn
253efbceef [VPlan] Account for removed users in replaceAllUsesWith.
Make sure we do not iterate using an invalid iterator.

Another small fix/step towards traversing the def-use chains in VPlan.
2020-10-04 18:18:58 +01:00
Esme-Yi
b654b312b6 [PowerPC] Add builtins for xvtdiv(dp|sp) and xvtsqrt(dp|sp).
Summary: This patch implements the builtins for xvtdivdp, xvtdivsp, xvtsqrtdp, xvtsqrtsp.
The instructions correspond to the following builtins:
int vec_test_swdiv(vector double v1, vector double v2);
int vec_test_swdivs(vector float v1, vector float v2);
int vec_test_swsqrt(vector double v1);
int vec_test_swsqrts(vector float v1);
This patch depends on D88274, which fixes the bug in copying from CRRC to GPRC/G8RC.

Reviewed By: steven.zhang, amyk

Differential Revision: https://reviews.llvm.org/D88278
2020-10-04 16:24:20 +00:00
Sanjay Patel
2e5d7a734d [SDAG] fold x * 0.0 at node creation time
In the motivating case from https://llvm.org/PR47517
we create a node that does not get constant folded
before getNegatedExpression is attempted from some
other node, and we crash.

By moving the fold into SelectionDAG::simplifyFPBinop(),
we get the constant fold sooner and avoid the problem.
2020-10-04 11:31:57 -04:00
Nikita Popov
04cd7397ef [MemCpyOpt] Add additional call slot tests (NFC)
The case of a destination read between call and memcpy was not
covered anywhere (but is handled correctly).

However, a potentially throwing call between the call and the
memcpy appears to be miscompiled.
2020-10-04 17:26:46 +02:00
Simon Pilgrim
d6bcf4c690 [X86][SSE] isTargetShuffleEquivalent - ensure shuffle inputs are the correct size.
Preliminary patch for the next stage of PR45974 - we don't want to be creating 'padded' vectors on-the-fly at all in combineX86ShufflesRecursively, and only pad the source inputs if we have a definite match inside combineX86ShuffleChain.

This means that the inputs to combineX86ShuffleChain might soon be smaller than the final root value type, so we should ensure that isTargetShuffleEquivalent only matches with the inputs if they are the correct size.
2020-10-04 15:32:05 +01:00
Anatoly Parshintsev
b8a39db2c9 [RISCV][ASAN] instrumentation pass now uses proper shadow offset
[10/11] patch series to port ASAN for riscv64

Depends On D87580

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D87581
2020-10-04 16:30:38 +03:00
Roman Lebedev
09fdde59e8 [OldPM] Pass manager: run SROA after (simple) loop unrolling
I have stumbled into this pretty accidentally, when rewriting
some spaghetti-like code into something more structured,
which involved using some `std::array<>`s. And to my surprise,
the `alloca`s remained, causing about `+160%` perf regression.

https://llvm-compile-time-tracker.com/compare.php?from=bb6f4d32aac3eecb51909f4facc625219307ee68&to=d563e66f40f9d4d145cb2050e41cb961e2b37785&stat=instructions
suggests that this has geomean compile-time cost of `+0.08%`.

Note that D68593 / cecc0d27ad58c0aed8ef9ed99bbf691e137a0f26
already did this chage for NewPM, but left OldPM in a pessimized state.

This fixes [[ https://bugs.llvm.org/show_bug.cgi?id=40011 | PR40011 ]], [[ https://bugs.llvm.org/show_bug.cgi?id=42794 | PR42794 ]] and probably some other reports.

Reviewed By: nikic, xbolva00

Differential Revision: https://reviews.llvm.org/D87972
2020-10-04 11:53:50 +03:00
Craig Topper
a586463b2b [X86] LOADIWKEY, ENCODEKEY128 and ENCODEKEY256 clobber EFLAGS. 2020-10-03 21:55:03 -07:00
Craig Topper
08e9221b58 [X86] Add memory operand to AESENC/AESDEC Key Locker instructions.
This removes FIXMEs from selectAddr.
2020-10-03 21:42:16 -07:00