1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

196942 Commits

Author SHA1 Message Date
Eli Friedman
62c143a2d5 Harden IR and bitcode parsers against infinite size types.
If isSized is passed a SmallPtrSet, it uses that set to catch infinitely
recursive types (for example, a struct that has itself as a member).
Otherwise, it just crashes on such types.
2020-05-16 14:24:51 -07:00
Sanjay Patel
a80619608b [VectorCombine] forward walk through instructions to improve chaining of transforms
This is split off from D79799 - where I was proposing to fully iterate
over a function until there are no more transforms. I suspect we are
still going to want to do something like that eventually.

But we can achieve the same gains much more efficiently on the current
set of regression tests just by reversing the order that we visit the
instructions.

This may also reduce the motivation for D79078, but we are still not
getting the optimal pattern for a reduction.
2020-05-16 13:08:01 -04:00
Sanjay Patel
31896780e0 [PhaseOrdering] add vector reduction tests; NFC
These are based on tests originally included in:
D79078
2020-05-16 12:51:10 -04:00
Nikita Popov
29255c0acf [InstCombine] Clean up alignment handling (NFC)
Now that load/store alignment is required, we can simplify code
in some places.
2020-05-16 18:47:29 +02:00
David Green
e11168f2ca [ARM] Patterns for VQSHRN
Given a VQMOVN(VSHR), we can fold that into a VQSHRN simply enough using
a few tablegen patterns.

Differential Revision: https://reviews.llvm.org/D77720
2020-05-16 17:46:43 +01:00
Sanjay Patel
24383b676b [VectorCombine] add reduction-like patterns; NFC
These are based on tests originally included in:
D79078
2020-05-16 12:45:01 -04:00
Jay Foad
04a4fd47c1 [AArch64] Precommit tests for D77316 2020-05-16 16:00:02 +01:00
Sanjay Patel
3077a08070 [x86][CGP] try to hoist funnel shift above select-of-splats
This is basically the same patch as D63233, but converted to
funnel shifts rather than regular shifts. I did not see a
way to effectively share code for these 2 cases though.

This follows D79718 and D79827 to re-fix PR37426 because
that gets canonicalized to funnel shift intrinsics in IR.

I did draft an alternative patch as an enhancement to
"shouldSinkOperands()", but that was awkward because
we have to key the transform from the select, but then
look at both its users and its operands.
2020-05-16 10:44:47 -04:00
David Green
c1a15ae1a8 [ARM] Combines for VMOVN
This adds two combines for VMOVN, one to fold
VMOVN[tb](c, VQMOVNb(a, b)) => VQMOVN[tb](c, b)
The other to perform demand bits analysis on the lanes of a VMOVN. We
know that only the bottom lanes of the second operand and the top or
bottom lanes of the Qd operand are needed in the result, depending on if
the VMOVN is bottom or top.

Differential Revision: https://reviews.llvm.org/D77718
2020-05-16 15:13:16 +01:00
David Green
4120e7a927 [ARM] MVE saturating truncates
This adds some custom lowering for VQMOVN, an instruction that can be
used to perform saturating truncates from a pair of min(max(X, -0x8000),
0x7fff), providing those constants are correct. This leaves a VQMOVNBs
which saturates the value and inserts that into the bottom lanes of an
existing vector. We then need to do something with the other lanes,
extending the value using a vmovlb.

Ideally, as will often be the case, only the bottom lane of what remains
will be demanded, allowing the vmovlb to be removed. Which should mean
the instruction is either equal or a win most of the time, and allows
some extra follow-up folding to happen.

Differential Revision: https://reviews.llvm.org/D77590
2020-05-16 15:10:20 +01:00
Simon Pilgrim
5658bcf0c4 DIEHash.cpp - remove headers explicitly included in DIEHash.h. NFC.
Don't duplicate module header includes.
2020-05-16 15:00:57 +01:00
Simon Pilgrim
eb138b0d7b AggressiveAntiDepBreaker.cpp - remove headers explicitly included in AggressiveAntiDepBreaker.h. NFC.
Don't duplicate module header includes.
2020-05-16 15:00:56 +01:00
Simon Pilgrim
eb9d65c52c LLParser.cpp - remove headers explicitly included in LLParser.h. NFC.
Don't duplicate module header includes.
2020-05-16 15:00:56 +01:00
Simon Pilgrim
9302102de5 Fix -Wdocumentation warning. NFC.
Remove non-existant DataLayoutCallback param comment.
2020-05-16 15:00:56 +01:00
David Green
b6aab3138f [ARM] Extra VQMOVN/VQSHRN tests. NFC 2020-05-16 14:23:26 +01:00
Nikita Popov
14ba2f0ba5 [ValueTracking] Fix computeKnownBits() with bitwidth-changing ptrtoint
computeKnownBitsFromAssume() currently asserts if m_V matches a
ptrtoint that changes the bitwidth. Because InstCombine
canonicalizes ptrtoint instructions to use explicit zext/trunc,
we never ran into the issue in practice. I'm adding unit tests,
as I don't know if this can be triggered via IR anywhere.

Fix this by calling anyextOrTrunc(BitWidth) on the computed
KnownBits. Note that we are going from the KnownBits of the
ptrtoint result to the KnownBits of the ptrtoint operand,
so we need to truncate if the ptrtoint zexted and anyext if
the ptrtoint truncated.

Differential Revision: https://reviews.llvm.org/D79234
2020-05-16 14:17:11 +02:00
Craig Topper
a07919a144 [LegalizeDAG] Use getMemBasePlusOffset to simplify some code. Use other signature of getMemBasePlusOffset in another location. NFCI
The code was calculating an offset from a stack pointer SDValue.
This is exactly what getMemBasePlusOffset does. I also replaced
sizeof(int) with a hardcoded 4. We know the type we're operating
on is 4 bytes. But the size of int that the source code is being
compiled with isn't guaranteed to be 4 bytes.

While here replace another use of getMemBasePlusOffset that was
proceeded with a call to getConstant with the other signature
that call getConstant internally.
2020-05-16 01:02:08 -07:00
Craig Topper
221b44b9c7 [LegalizeVectorTypes] Remove non-constnat INSERT_SUBVECTOR handling. NFC
Now that D79814 has landed, we can assume that subvector ops use constant, in-range indices.
2020-05-15 23:56:13 -07:00
Ten Tzen
60a9f85d44 [Windows EH] Fix the order of Nested try-catches in $tryMap$ table
This bug is exposed by Test7 of ehthrow.cxx in MSVC EH suite where
a rethrow occurs in a try-catch inside a catch (i.e., a nested Catch
handlers). See the test code in
https://github.com/microsoft/compiler-tests/blob/master/eh/ehthrow.cxx#L346

When an object is rethrown in a Catch handler, the copy-ctor of this
object must be executed after the destructions of live objects, but
BEFORE the dtors of live objects in parent handlers.

Today Windows 64-bit runtime (__CxxFrameHandler3 & 4) expects nested Catch
handers
are stored in pre-order (outer first, inner next) in $tryMap$ table, so
that given a State, its Catch's beginning State can be properly
retrieved. The Catch beginning state (which is also the ending State) is
the State where rethrown object's copy-ctor must take place.

LLVM currently stores nested catch handlers in post-ordering because
it's the natural way to compute the highest State in Catch.
The fix is to simply store TryCatch handler in pre-order, but update
Catch's highest State after child Catches are all processed.

Differential Revision: https://reviews.llvm.org/D79474?id=263919
2020-05-15 22:03:43 -07:00
Carl Ritson
909e6f5689 [AMDGPU] Allow use of StackPtrOffsetReg when building spills
Summary:
When spilling in the entry function we should be able to borrow
StackPtrOffsetReg as a last resort.  This restores behaviour
removed in D75138, and fixes failures when shaders use all
SGPRs, VGPRs and spill in the entry function.

Reviewers: scott.linder, arsenm, tpr

Reviewed By: scott.linder, arsenm

Subscribers: qcolombet, foad, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79776
2020-05-16 11:54:43 +09:00
Eric Christopher
8442719327 Fix go bindings after FixedVectorType -> VectorType change. 2020-05-15 16:37:57 -07:00
Diogo Sampaio
0e89c7b708 Prevent register coalescing in functions whith setjmp
Summary:
In the the given example, a stack slot pointer is merged
between a setjmp and longjmp. This pointer is spilled,
so it does not get correctly restored, addinga undefined
behaviour where it shouldn't.

Change-Id: I60ec010844f2a24ce01ceccf12eb5eba5ab94abb

Reviewers: eli.friedman, thanm, efriedma

Reviewed By: efriedma

Subscribers: MatzeB, qcolombet, tpr, rnk, efriedma, hiraditya, llvm-commits, chill

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77767
2020-05-16 00:36:34 +01:00
Thomas Preud'homme
37b37d76ae [test] Improve FileCheck's numeric-expression.txt
Summary:
Various improvement for FileCheck's numeric-expression.txt test:
- remove unused values in USE DEF FMT IMPL MATCH section
- replace 14 literal for 0xe and 0xE to have example of hex literals
- rename variable to be more self-descriptive
- move CHECK as comment of the values being matched to help readability
- add conversion tests
- simplify test for use of several numeric variables by using existing
  variable
- adjust position of error message check to match the alignment of the
  error message wrt. the output matched by the previous check

Reviewed By: jhenderson, jdenny

Differential Revision: https://reviews.llvm.org/D79820
2020-05-16 00:09:24 +01:00
David Green
4c9b5189ca [ARM] Change more triples to arm-none-none-eabi. NFC 2020-05-15 22:53:07 +01:00
Hubert Tong
b8e6434bec [CMake][AIX] Add -bcdtors:mbr option when building with IBM XL
Summary:
The `-bcdtors:mbr` option causes processing for constructors and
destructors to omit otherwise-unreferenced members of static libraries,
matching the processing done on Linux, where `--whole-archive` is not
the default. Applying this option is desirable for reducing the
footprint of an installation.

Reviewed By: daltenty

Differential Revision: https://reviews.llvm.org/D79749
2020-05-15 17:34:00 -04:00
Fangrui Song
cfaadc9af4 [CMake] -gen-dag-isel: add -omit-comments if neither Debug nor RelWithDebInfo
Omitting comments can make the output much smaller. Size/time impact on
my machine:

* lib/Target/AArch64/AArch64GenDAGISel.inc, 10MiB (8.89s) -> 5MiB (3.20s)
* lib/Target/X86/X86GenDAGISel.inc, 20MiB (6.48s) -> 8.5MiB (4.18s)

In total, this change decreases lib/Target/*/*GenDAGISel.inc from
71.4MiB to 30.1MiB.

As rnk suggested, we can consider an option next to LLVM_OPTIMIZED_TABLEGEN
once we have more needs like this.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D78884
2020-05-15 14:03:05 -07:00
Vitaly Buka
c7e5d49674 [NFC,StackSafety] Rename local function 2020-05-15 13:39:07 -07:00
Nico Weber
7b857d8924 [gn build] Put HAVE_LIBZ and HAVE_ZLIB_H behind llvm_enable_zlib too.
In the CMake build, the HAVE_ vars are set based on system inspection,
and LLVM_ENABLE_ZLIB is set to false if neither's found. The GN build
doesn't do autodetection like this.

With this change, people can set llvm_enable_zlib=true on Windows
and as long as they provide a zlib.lib things should actually work.

(https://reviews.llvm.org/D79219 will remove 2 of the 3 config.h
values, hopefully soon. This change here just makes things a tiny
bit easier until that change is in.)
2020-05-15 16:18:56 -04:00
Christopher Tetreault
29a9b23aaf [SVE] Remove usages of VectorType::getNumElements() from ARM
Reviewers: efriedma, fpetrogalli, kmclaughlin, grosbach, dmgreen

Reviewed By: dmgreen

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, dmgreen, danielkiss, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79816
2020-05-15 12:55:27 -07:00
Christopher Tetreault
fc7bbafad0 [SVE] Remove usages of VectorType::getNumElements() from PowerPC
Reviewers: efriedma, sdesmalen, c-rhodes, hfinkel

Reviewed By: c-rhodes

Subscribers: wuzish, nemanjai, tschuett, hiraditya, kbarton, rkruppe, psnobl, shchenz, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79821
2020-05-15 12:30:56 -07:00
Mircea Trofin
360e912ca6 Revert "Revert "[llvm][NFC] Cleanup uses of std::function in Inlining-related APIs""
This reverts commit 454de99a6fec705e76ed7743bf538f7a77296f59.

The problem was that one of the ctor arguments of CallAnalyzer was left
to be const std::function<>&. A function_ref was passed for it, and then
the ctor stored the value in a function_ref field. So a std::function<>
would be created as a temporary, and not survive past the ctor
invocation, while the field would.

Tested locally by following https://github.com/google/sanitizers/wiki/SanitizerBotReproduceBuild

Original Differential Revision: https://reviews.llvm.org/D79917
2020-05-15 12:29:16 -07:00
Eli Friedman
ffa26401ac StoreInst should store Align, not MaybeAlign
This is D77454, except for stores.  All the infrastructure work was done
for loads, so the remaining changes necessary are relatively small.

Differential Revision: https://reviews.llvm.org/D79968
2020-05-15 12:26:58 -07:00
Scott Linder
85447130ae [NFC] Deduplicate comment in PromoteMemoryToRegister.cpp
This has been duplicated since before
2372a193ba904fdc85de3cc559e0bc162f14f144, but that commit has it
appearing twice in the space of 10 lines of the same function body. It
could also be hoisted up to the point just after where the last
special-case is considered, but I want to keep the intent of the
original authors.

Committed as obvious without a review.
2020-05-15 15:18:07 -04:00
Thomas Lively
007afc1032 [WebAssembly] Optimize splats of bitcasted vectors
Summary:
This new custom DAG combine fixes a codegen issue with the
wasm_simd128.h intrinsics. Clang lowers the

  return (v128_t)(__f32x4){__a, __a, __a, __a};

body of f32x4_splat to a splat shuffle of a bitcasted vector, as seen
in the new simd-shuffle-bitcast.ll test. The bitcast interfered with
the target-independent DAG combine that combines splat shuffles into
BUILD_VECTOR nodes, so this patch introduces a new custom DAG combine
to hoist the bitcast out of the shuffle, allowing the
target-independent combine to work as intended.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80021
2020-05-15 12:12:20 -07:00
Eli Friedman
e801af7927 [AArch64][SVE] Implement AArch64ISD::SETCC_PRED
This unifies SETCC operations along the lines of other operations.

Differential Revision: https://reviews.llvm.org/D79975
2020-05-15 11:53:21 -07:00
Christopher Tetreault
7b3e2debb8 [SVE] Restore broken LLVM-C ABI compatability
Reviewers: deadalnix, efriedma, rengolin, jyknight, joerg

Reviewed By: joerg

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79915
2020-05-15 11:50:24 -07:00
Matt Arsenault
1d56552365 IR: Remove extra name mangling from llvm.ptrmask
This should not be allowed to change the address space of the source
and result, so the pointer types should match. The only emitter of
this seems to be a disable clang change, so no tests to update.
2020-05-15 14:49:00 -04:00
Daniel Grumberg
f9d3b095c9 [NFC] Whitespace fix inside OptParserEmitter 2020-05-15 11:27:13 -07:00
Sourabh Singh Tomar
eb3dba6441 Fixed arm build bot failure after 4042ada1c1fe
This fixes bot failure seen in
http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l/builds/7378
by adding `REQUIRES: x86_64-linux` to the test case
2020-05-15 23:30:05 +05:30
Thomas Lively
cd0a1d2f7e [WebAssembly] Update latest implemented SIMD instructions
Summary:
Move instructions that have recently been implemented in V8 from the
`unimplemented-simd128` target feature to the `simd128` target
feature. The updated instructions match the update at
https://github.com/WebAssembly/simd/pull/223.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D79973
2020-05-15 10:53:02 -07:00
Wouter van Oortmerssen
ac426a5eb4 [WebAssembly] Fixed debugloc in DebugFixup pass
BuildMI requires this debug loc to be from the same sub program as the variable metadata passed in.

Differential Revision:  https://reviews.llvm.org/D80019
2020-05-15 10:50:14 -07:00
Sourabh Singh Tomar
7e530fd1fb Fixed arm build bot failure after ab699d78a26f
This fixes bot failure seen in
http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l/builds/7378
by adding `REQUIRES: x86_64-linux` to the test case
2020-05-15 23:14:56 +05:30
Nikita Popov
cf8ee33937 [IR] Convert null-pointer-is-valid into an enum attribute
The "null-pointer-is-valid" attribute needs to be checked by many
pointer-related combines. To make the check more efficient, convert
it from a string into an enum attribute.

In the future, this attribute may be replaced with data layout
properties.

Differential Revision: https://reviews.llvm.org/D78862
2020-05-15 19:41:07 +02:00
Simon Pilgrim
7b938ff5c1 [X86] Remove some duplicate ConstantSDNode casts. NFC.
Avoid repeated isa<> and cast<> by just performing a dyn_cast<ConstantSDNode>
2020-05-15 18:23:35 +01:00
Jay Foad
7b1f95d10a [IR] Trivial cleanups in Use. NFC.
Remove Use::setPrev. It provided no value because it had the same
accessibility as the underlying field Prev, and there was no
corresponding setNext anyway.

Simplify Use::removeFromList.
2020-05-15 18:14:45 +01:00
Sanjay Patel
56e81a7e51 [x86][CGP] add more tests for PR37426; NFC
This broke when we started canonicalizing more code to funnel shift.
See D79718 and D79827 for related test/transforms.
2020-05-15 13:05:21 -04:00
Craig Topper
b0f9dd5a93 [X86] Move expansion of MASKPAIR16LOAD and MASKPAIR16STORE from X86MCInstLower to X86ExpandPseudo.
It makes more sense to turn these into real instructions
a little earlier in the pipeline.

I've made sure to adjust the memoperand so the spill/reload
comments are printed correctly.
2020-05-15 09:51:32 -07:00
Alexey Lapshin
24f7fd8949 [x86][NFC] Apply clang-format to X86ISelLowering.h
Summary:
  Apply clang-format to X86ISelLowering.h

Reviewed by: aeubanks

Differential Revision: https://reviews.llvm.org/D80005
2020-05-15 19:48:16 +03:00
Yonghong Song
9f8e033a06 [Clang][BPF] implement __builtin_btf_type_id() builtin function
Such a builtin function is mostly useful to preserve btf type id
for non-global data. For example,
   extern void foo(..., void *data, int size);
   int test(...) {
     struct t { int a; int b; int c; } d;
     d.a = ...; d.b = ...; d.c = ...;
     foo(..., &d, sizeof(d));
   }

The function "foo" in the above only see raw data and does not
know what type of the data is. In certain cases, e.g., logging,
the additional type information will help pretty print.

This patch implemented a BPF specific builtin
  u32 btf_type_id = __builtin_btf_type_id(param, flag)
which will return a btf type id for the "param".
flag == 0 will indicate a BTF local relocation,
which means btf type_id only adjusted when bpf program BTF changes.
flag == 1 will indicate a BTF remote relocation,
which means btf type_id is adjusted against linux kernel or
future other entities.

Differential Revision: https://reviews.llvm.org/D74668
2020-05-15 09:44:54 -07:00
Simon Pilgrim
9bb537f0ba [X86] Use getConstantOperandVal helper in a few places. NFC.
Avoid raw cast<ConstantSDNode> calls.
2020-05-15 17:31:27 +01:00