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

217651 Commits

Author SHA1 Message Date
Jinsong Ji
4d8c0e830b [DAGCombine] reassoc flag shouldn't enable contract
According to IR LangRef, the FMF flag:

contract
Allow floating-point contraction (e.g. fusing a multiply followed by an
addition into a fused multiply-and-add).

reassoc
Allow reassociation transformations for floating-point instructions.
This may dramatically change results in floating-point.

My understanding is that these two flags shouldn't imply each other,
as we might have a SDNode that can be reassociated with others, but
not contractble.

eg: We may want following fmul/fad/fsub to freely reassoc, but don't
want fma being generated here.

   %F = fmul reassoc double %A, %B         ; <double> [#uses=1]
   %G = fmul reassoc double %C, %D         ; <double> [#uses=1]
   %H = fadd reassoc double %F, %G         ; <double> [#uses=1]
   %I = fsub reassoc double %H, %E         ; <double> [#uses=1]

Before https://reviews.llvm.org/D45710, `reassoc` flag actually
did not imply isContratable either.

The current implementation also only check the flag in fadd node,
ignoring fmul node, this patch update that as well.

Reviewed By: spatel, qiucf

Differential Revision: https://reviews.llvm.org/D104247
2021-06-21 21:15:43 +00:00
Joel E. Denny
43ea08452a [UpdateCCTestChecks] Fix --replace-value-regex across RUN lines
Without this patch, llvm/utils/update_cc_test_checks.py fails to
perform `--replace-value-regex` replacements when two RUN lines
produce the same output and use the same single FileCheck prefix.  The
problem is that replacements in a RUN line's output are not performed
until after comparing against previous RUN lines' output, where
replacements have already been performed.  This patch fixes that.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D104566
2021-06-21 17:01:17 -04:00
Roman Lebedev
da20b78ffa [NFC][SimplifyCFG] Add basic test for debuginfo preservation of ret tail merging 2021-06-21 23:56:54 +03:00
Roman Lebedev
32bdf0a6f4 [NFC][SimplifyCFG] Fix tests to use FileCheck instead of grep 2021-06-21 23:56:54 +03:00
Alexey Bataev
24ae3b661f [SLP][NFC]Rename functions in the tests, NFC. 2021-06-21 13:37:12 -07:00
Nikita Popov
628c200526 Reapply [InstCombine] Don't try converting opaque pointer bitcast to GEP
Reapplied without changes -- this was reverted together with an
underlying patch.

-----

Bitcasts having opaque pointer source or result type cannot be
converted into a zero-index GEP, GEP source and result types
always have the same opaque-ness.
2021-06-21 22:15:56 +02:00
Nikita Popov
3520bd21c8 Reapply [InstCombine] Extract bitcast -> gep transform
Relative to the original patch, an InstCombine test has been
added to show a previously missed pattern, and the Coroutine
test that resulted in the revert has been regenerated.

-----

Move this into a separate function, to make sure that early
returns do not accidentally skip other transforms. This previously
happened for the isSized() check, which skipped folds like
distributing a bitcast over a select.
2021-06-21 22:03:15 +02:00
Nikita Popov
4ce7d65381 [InstCombine] Add test for bitcast of unsized pointer (NFC)
The bitcast should get folded into the select, but currently isn't
due to an incorrect early bailout.
2021-06-21 22:03:15 +02:00
Craig Topper
a3a91ab85e [RISCV] Remove extra character from a comment. NFC 2021-06-21 12:52:02 -07:00
Langston Barrett
2ef169fe7d [llvm-reduce] Don't delete arguments of intrinsics
The argument reduction pass shouldn't remove arguments of
intrinsics, because the resulting module is ill-formed, and so
inherently uninteresting.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D103129
2021-06-21 12:43:58 -07:00
Nikita Popov
5f863d3d56 Revert "[InstCombine] Extract bitcast -> gep transform"
This reverts commit d9f5d7b959de36085944d4a99a73f3053f953796.
This reverts commit 5780611d7e044ef56c4214df2c236ef5e15545ab.

This causes a failure in Coroutine tests.
2021-06-21 21:34:17 +02:00
Nikita Popov
1872603909 [LoopUnroll] Don't modify TripCount/TripMultiple in computeUnrollCount() (NFCI)
As these are no longer passed to UnrollLoop(), there is no need to
modify them in computeUnrollCount(). Make them non-reference parameters.

Differential Revision: https://reviews.llvm.org/D104590
2021-06-21 21:34:17 +02:00
Alexey Bataev
d0ec98897c [SLP]Improve vectorization of PHI instructions.
Perform better analysis when trying to vectorize PHIs.
1. Do not try to vectorize vector PHIs.
2. Do deeper analysis for more profitable nodes for the vectorization.

Before we just tried to vectorize the PHIs of the same type. Patch
improves this and tries to vectorize PHIs with incoming values which
come from the same basic block, have the same and/or alternative
opcodes.

It allows to save the compile time and provides better vectorization
results in general.

Part of D57059.

Differential Revision: https://reviews.llvm.org/D103638
2021-06-21 12:26:24 -07:00
Nikita Popov
2b34d4059b [InstCombine] Don't try converting opaque pointer bitcast to GEP
Bitcasts having opaque pointer source or result type cannot be
converted into a zero-index GEP, GEP source and result types
always have the same opaque-ness.
2021-06-21 21:24:50 +02:00
Nikita Popov
3ff4077a87 [InstCombine] Extract bitcast -> gep transform
Move this into a separate function, to make sure that early
returns do not accidentally skip other transforms. There is
already one isSized() check that could run into this issue,
thus this change is not strictly NFC.
2021-06-21 21:24:50 +02:00
Fangrui Song
ced2bcc8c8 [llvm-profdata] Allow omission of -o for --text output
This makes it more convenient to get a text format profile.

Add an error for printing non-text format output to a terminal for instrumentation profile.
(It cannot be portably tested. For sample profile, raw_fd_ostream is hidden deeply so it's inconvenient to add a diagnostic.)

Reviewed By: davidxl

Differential Revision: https://reviews.llvm.org/D104600
2021-06-21 12:01:57 -07:00
Jonas Paulsson
645046f06a [SystemZ] Fix some typos in comments. 2021-06-21 13:50:54 -05:00
Craig Topper
4e0a96eedd [RISCV] Add isel patterns to match vmacc/vmadd/vnmsub/vnmsac from add/sub and mul.
Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D104163
2021-06-21 11:27:44 -07:00
Nikita Popov
9afed001b7 [InstCombine] Remove unnecessary addres space check (NFC)
It's not possible to bitcast between different address spaces,
and this is ensured by the IR verifier. As such, this bitcast to
addrspacecast canonicalization can never be hit.
2021-06-21 20:11:39 +02:00
Nikita Popov
609a4f9be4 [OpaquePtr] Support opaque constant expression GEP
Adjust assertions to use isOpaqueOrPointeeTypeMatches() and make
it return an opaque pointer result for an opaque base pointer. We
also need to enumerate the element type, as it is no longer
implicitly enumerated through the pointer type.

Differential Revision: https://reviews.llvm.org/D104655
2021-06-21 20:06:25 +02:00
Philip Reames
160f03fe5f Split a test for ease of auto update 2021-06-21 11:02:26 -07:00
Jacob Hegna
c371e1f8a1 Remove ML inlining model artifacts.
They are not conducive to being stored in git. Instead, we autogenerate
mock model artifacts for use in tests. Production models can be
specified with the cmake flag LLVM_INLINER_MODEL_PATH.

LLVM_INLINER_MODEL_PATH has two sentinel values:
 - download, which will download the most recent compatible model.
 - autogenerate, which will autogenerate a "fake" model for testing the
 model uptake infrastructure.

Differential Revision: https://reviews.llvm.org/D104251
2021-06-21 17:38:09 +00:00
Nathan Chancellor
b329f1bc69 Revert "[LoopDeletion] Handle Phis with similar inputs from different blocks"
This reverts commit bb1dc876ebb8a2eef38d5183d00c2db1437f1c91.

This patch causes an assertion failure when building an arm64 defconfig
Linux kernel.

See https://reviews.llvm.org/D103959 for a link to the original bug
report and a reduced reproducer.
2021-06-21 10:18:55 -07:00
Nikita Popov
7f56d08fc8 [OpaquePtr] Return opaque pointer from opaque pointer GEP
For a GEP on an opaque pointer, also return an opaque pointer (or
vector of opaque pointer) result.

This requires explicitly enumerating the GEP source element type,
because it is now no longer implicitly enumerated as part of either
the source or result pointer types.

Differential Revision: https://reviews.llvm.org/D104652
2021-06-21 18:36:32 +02:00
Hendrik Greving
6abba09064 RegisterCoalescer: Fix iterating through use operands.
Fixes a minor bug when trying to iterate through use operands when
updating debug use operands.

Extends a test to include above.

Differential Revision: https://reviews.llvm.org/D104576
2021-06-21 09:17:54 -07:00
Sanjay Patel
d8dba3ce64 [InstCombine] move bitmanipulation-of-select folds
This is no outwardly-visible-difference-intended,
but it is obviously better to have all transforms
for an intrinsic housed together since we already
have helper functions in place.

It is also potentially more efficient to zap a
simple pattern match before trying to do expensive
computeKnownBits() calls.
2021-06-21 11:32:16 -04:00
Rosie Sumpter
844287b90f [SLP][AArch64] Add SLP vectorizer regression test. NFC
This test is for a missed SLP vectorizer opportunity, reported here
https://bugs.llvm.org/show_bug.cgi?id=44593. This is due to a cost
modelling issue with vector reduction intrinsics which will be
fixed in a future commit (see https://reviews.llvm.org/D104538).
2021-06-21 16:31:00 +01:00
Sanjay Patel
ed82d06775 [InstCombine] fold ctlz/cttz-of-select with 1 or more constant arms
Building on:
4c44b02d87
...and adding handling for the extra operand in these intrinsics.

This pattern is discussed in:
https://llvm.org/PR50140
2021-06-21 11:04:12 -04:00
Matt Arsenault
ca489b9942 AMDGPU: Add missing tests for v_fma_mixlo 2021-06-21 10:58:53 -04:00
Sjoerd Meijer
dcef6b166c [FuncSpec] Add minsize test. NFC. 2021-06-21 15:21:09 +01:00
Sam Tebbs
a7c1a9b580 [ARM] Transform a fixed-point to floating-point conversion into a VCVT_fix
Conversion from a fixed-point number to a floating-point number is done by
multiplying the fixed-point number by 2^(-n) where n is the number of
fractional bits. Currently this is lowered to a vcvt
(integer to floating-point) then a vmul, but it can instead be lowered
directly to a vcvt (fixed-point to floating-point). This patch enables
such transformations as long as the multiplication factor is a power of 2.

Differential Revision: https://reviews.llvm.org/D103903
2021-06-21 14:14:09 +01:00
Sebastian Neubauer
a7a80ebf9c [NFC] Fix typo 2021-06-21 14:59:30 +02:00
Bradley Smith
d2336f2398 [AArch64][SVE] Wire up vscale_range attribute to SVE min/max vector queries
Differential Revision: https://reviews.llvm.org/D103702
2021-06-21 13:00:36 +01:00
Florian Hahn
1cebcabcfe [LoopIdiom] Add test case that involves adds with flags and zero exts.
Test coverage to ensure D104319 does not introduce a regression here.
2021-06-21 12:10:58 +01:00
Jordan Rupprecht
79bdbc37ef [NFC] Wrap entire assert-only block in LLVM_DEBUG 2021-06-21 04:01:27 -07:00
Fraser Cormack
18c509d4ea [VP][NFCI] Address various clang-tidy warnings
Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D104288
2021-06-21 10:57:42 +01:00
Sebastian Neubauer
95f90b846b [AMDGPU] Fix linking with shared libraries
AMDGPULDSUtils depends on llvm::CallGraph.
2021-06-21 11:11:13 +02:00
Nikita Popov
64dbdb829e [Mem2Reg] Regenerate test checks (NFC) 2021-06-21 11:06:28 +02:00
Nikita Popov
7f3872cdf6 [Mem2Reg] Use poison for unreachable cases
Use poison instead of undef for cases dealing with unreachable
code. This still leaves the more interesting case of "load from
uninitialized memory" as undef.
2021-06-21 10:54:13 +02:00
Nikita Popov
192f74a255 [Mem2Reg] Regenerate test checks (NFC) 2021-06-21 10:47:59 +02:00
Juneyoung Lee
f69a2df9b9 [InstCombine] Fold icmp (select c,const,arg), null if icmp arg, null can be simplified
This patch folds icmp (select c,const,arg), null if icmp arg, null can be simplified.

Resolves llvm.org/pr48975.

Reviewed By: nikic, xbolva00

Differential Revision: https://reviews.llvm.org/D96663
2021-06-21 17:39:05 +09:00
Sjoerd Meijer
a6fd3be6d5 [FuncSpec] Don't specialise functions with NoDuplicate instructions.
getSpecializationCost was returning INT_MAX for a case when specialisation
shouldn't happen, but this wasn't properly checked if specialisation was
forced.

Differential Revision: https://reviews.llvm.org/D104461
2021-06-21 09:02:11 +01:00
LLVM GN Syncbot
150a090f84 [gn build] Port 208332de8abf 2021-06-21 07:27:34 +00:00
Ruiling Song
02847853b4 [AMDGPU] Add Optimize VGPR LiveRange Pass.
This pass aims to optimize VGPR live-range in a typical divergent if-else
control flow. For example:

def(a)
if(cond)
  use(a)
  ... // A
else
  use(a)

As AMDGPU access vgpr with respect to active-mask, we can mark `a` as
dead in region A. For details, please refer to the comments in
implementation file.

The pass is enabled by default, the frontend can disable it through
"-amdgpu-opt-vgpr-liverange=false".

Differential Revision: https://reviews.llvm.org/D102212
2021-06-21 15:25:55 +08:00
LLVM GN Syncbot
75f1abb9b8 [gn build] Port 80fd5fa5269c 2021-06-21 06:23:08 +00:00
hsmahesha
37c462f96a [AMDGPU] Replace non-kernel function uses of LDS globals by pointers.
The main motivation behind pointer replacement of LDS use within non-kernel
functions is - to *avoid* subsequent LDS lowering pass from directly packing
LDS (assume large LDS) into a struct type which would otherwise cause allocating
huge memory for struct instance within every kernel.

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D103225
2021-06-21 11:51:49 +05:30
Max Kazantsev
0317b20934 [Test] Add some tests showing room for optimization exploiting undef and UB 2021-06-21 13:11:46 +07:00
Esme-Yi
d5a215bffc [yaml2obj] Add support for writing the long symbol name.
Summary: This patch, as a follow-up of D95505, adds
support for writing the long symbol name by implementing
the StringTable. Only XCOFF32 is suppoted now.

Reviewed By: jhenderson, shchenz

Differential Revision: https://reviews.llvm.org/D103455
2021-06-21 05:09:56 +00:00
Max Kazantsev
633abb5259 [LoopDeletion] Handle Phis with similar inputs from different blocks
This patch lifts the requirement to have the only incoming live block
for Phis. There can be multiple live blocks if the same value comes to
phi from all of them.

Differential Revision: https://reviews.llvm.org/D103959
Reviewed By: nikic, lebedev.ri
2021-06-21 11:37:06 +07:00
Juneyoung Lee
1652bab657 [InstCombine] Use poison constant to represent the result of unreachable instrs
This patch updates InstCombine to use poison constant to represent the resulting value of (either semantically or syntactically) unreachable instrs, or a don't-care value of an unreachable store instruction.

This allows more aggressive folding of unused results, as shown in llvm/test/Transforms/InstCombine/getelementptr.ll .

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D104602
2021-06-21 09:58:44 +09:00