1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
Commit Graph

7200 Commits

Author SHA1 Message Date
Stanislav Mekhanoshin
9260748488 Use bitset for assembler predicates
AMDGPU target run out of Subtarget feature flags hitting the limit of 64.
AssemblerPredicates uses at most uint64_t for their representation.
At the same time CodeGen has exhausted this a long time ago and switched
to a FeatureBitset with the current limit of 192 bits.

This patch completes transition to the bitset for feature bits extending
it to asm matcher and MC code emitter.

Differential Revision: https://reviews.llvm.org/D59002

llvm-svn: 355839
2019-03-11 17:04:35 +00:00
Craig Topper
b9b16d334d [TableGen] Replace a dyn_cast with isa to avoid an unused variable warning introduced in r355785. NFC
llvm-svn: 355837
2019-03-11 16:51:37 +00:00
Craig Topper
4f687cac14 [TableGen] Make CheckImmAllOnesVMatcher and CheckImmAllZerosVMatcher contradictory matchers.
This improves X86 factoring a little bit.

llvm-svn: 355785
2019-03-10 06:44:09 +00:00
Craig Topper
eef2c65e50 Recommit r355224 "[TableGen][SelectionDAG][X86] Add specific isel matchers for immAllZerosV/immAllOnesV. Remove bitcasts from X86 patterns that are no longer necessary."
Includes a fix to emit a CheckOpcode for build_vector when immAllZerosV/immAllOnesV is used as a pattern root. This means it can't be used to look through bitcasts when used as a root, but that's probably ok. This extra CheckOpcode will ensure that the first match in the isel table will be a SwitchOpcode which is needed by the caching optimization in the ISel Matcher.

Original commit message:

Previously we had build_vector PatFrags that called ISD::isBuildVectorAllZeros/Ones. Internally the ISD::isBuildVectorAllZeros/Ones look through bitcasts, but we aren't able to take advantage of that in isel. Instead of we have to canonicalize the types of the all zeros/ones build_vectors and insert bitcasts. Then we have to pattern match those exact bitcasts.

By emitting specific matchers for these 2 nodes, we can make isel look through any bitcasts without needing to explicitly match them. We should also be able to remove the canonicalization to vXi32 from lowering, but I've left that for a follow up.

This removes something like 40,000 bytes from the X86 isel table.

Differential Revision: https://reviews.llvm.org/D58595

llvm-svn: 355784
2019-03-10 05:21:52 +00:00
Shoaib Meenai
790f1df49a [git-llvm] Only use --force-interactive when supported
The --force-interactive option was introduced in SVN 1.8, and trying to
pass it to older SVN clients causes an error; CentOS 7 includes SVN 1.7,
for example, so this makes `git llvm` not usable out of the box. Older
clients would be interactive by default anyway [1], so just don't pass
the option if it's not supported.

An alternative would be to check the version instead of checking the
help text, but I think directly detecting the presence of the option is
more direct.

[1] http://svn.apache.org/viewvc?view=revision&revision=1424037

Differential Revision: https://reviews.llvm.org/D59161

llvm-svn: 355782
2019-03-10 01:34:42 +00:00
Mitch Phillips
5c6e533e01 [HWASan] Save + print registers when tag mismatch occurs in AArch64.
Summary:
This change change the instrumentation to allow users to view the registers at the point at which tag mismatch occured. Most of the heavy lifting is done in the runtime library, where we save the registers to the stack and emit unwind information. This allows us to reduce the overhead, as very little additional work needs to be done in each __hwasan_check instance.

In this implementation, the fast path of __hwasan_check is unmodified. There are an additional 4 instructions (16B) emitted in the slow path in every __hwasan_check instance. This may increase binary size somewhat, but as most of the work is done in the runtime library, it's manageable.

The failure trace now contains a list of registers at the point of which the failure occured, in a format similar to that of Android's tombstones. It currently has the following format:

Registers where the failure occurred (pc 0x0055555561b4):
    x0  0000000000000014  x1  0000007ffffff6c0  x2  1100007ffffff6d0  x3  12000056ffffe025
    x4  0000007fff800000  x5  0000000000000014  x6  0000007fff800000  x7  0000000000000001
    x8  12000056ffffe020  x9  0200007700000000  x10 0200007700000000  x11 0000000000000000
    x12 0000007fffffdde0  x13 0000000000000000  x14 02b65b01f7a97490  x15 0000000000000000
    x16 0000007fb77376b8  x17 0000000000000012  x18 0000007fb7ed6000  x19 0000005555556078
    x20 0000007ffffff768  x21 0000007ffffff778  x22 0000000000000001  x23 0000000000000000
    x24 0000000000000000  x25 0000000000000000  x26 0000000000000000  x27 0000000000000000
    x28 0000000000000000  x29 0000007ffffff6f0  x30 00000055555561b4

... and prints after the dump of memory tags around the buggy address.

Every register is saved exactly as it was at the point where the tag mismatch occurs, with the exception of x16/x17. These registers are used in the tag mismatch calculation as scratch registers during __hwasan_check, and cannot be saved without affecting the fast path. As these registers are designated as scratch registers for linking, there should be no important information in them that could aid in debugging.

Reviewers: pcc, eugenis

Reviewed By: pcc, eugenis

Subscribers: srhines, kubamracek, mgorny, javed.absar, krytarowski, kristof.beyls, hiraditya, jdoerfert, llvm-commits, #sanitizers

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D58857

llvm-svn: 355738
2019-03-08 21:22:35 +00:00
Mitch Phillips
93e9e5aaed [GN] Merge 355720.
llvm-svn: 355734
2019-03-08 21:05:27 +00:00
Nico Weber
ef2a886d88 gn build: Merge r355685
llvm-svn: 355695
2019-03-08 13:07:22 +00:00
Nico Weber
7f776ffee2 gn build: Unbreak finding a working gn on $PATH on Unix after r355645
From the Python subprocess docs:

   If shell is True, it is recommended to pass args as a string rather than as
   a sequence.

   [...]

   If args is a sequence, the first item specifies the command string, and any
   additional items will be treated as additional arguments to the shell itself.

Prior to this change, the `--version` would be passed to the shell, not to
a potential gn binary on $PATH, and running `gn` without any arguments makes
it exit with an exit code != 0, so the script would think that there wasn't
a working gn binary on $PATH.

Fix this by following the documentation's recommendation of using a string
now that we pass shell=True. I tested this on macOS and Windows, each with
the three cases of

- no gn on PATH (should run gn downloaded by get.py if present,
  else suggest running get.py)
- broken gn wrapper on PATH (should behave like the previous item)
- working gn on PATH (should use gn on PATH)

llvm-svn: 355694
2019-03-08 13:01:58 +00:00
Nico Weber
6e56add3ce gn build: Unbreak get.py and gn.py on Windows
`os.uname()` doesn't exist on Windows, so use `platform.machine()` which
returns `os.uname()[4]` on non-Win and (on 64-bit systems) "AMD64" on Windows.
Also use `sys.platform` instead of `platform` to check for Windows-ness for the
file extension in gn.py (get.py got this right).

Differential Revision: https://reviews.llvm.org/D59115

llvm-svn: 355693
2019-03-08 12:45:50 +00:00
Mitch Phillips
24e311da5d [GN] Locate prebuilt binaries correctly.
Use the system shell to see if we can find a 'gn' binary on $PATH. This solves the error wherein subprocess.call fails ungracefully if the binary doesn't exist.

llvm-svn: 355645
2019-03-07 22:20:36 +00:00
Mitch Phillips
7fd66c8104 [GN] Remove DataLayoutTest.cpp from IR Unittests.
Merge of GN files to fit with rL355616.

llvm-svn: 355626
2019-03-07 18:58:45 +00:00
Vlad Tsyrklevich
5004401bf0 Delete x86_64 ShadowCallStack support
Summary:
ShadowCallStack on x86_64 suffered from the same racy security issues as
Return Flow Guard and had performance overhead as high as 13% depending
on the benchmark. x86_64 ShadowCallStack was always an experimental
feature and never shipped a runtime required to support it, as such
there are no expected downstream users.

Reviewers: pcc

Reviewed By: pcc

Subscribers: mgorny, javed.absar, hiraditya, jdoerfert, cfe-commits, #sanitizers, llvm-commits

Tags: #clang, #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D59034

llvm-svn: 355624
2019-03-07 18:56:36 +00:00
Julian Lettner
4251cbff92 [Sanitizer] Add 'dispatch' feature to be used in compiler-rt tests
Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D59037

llvm-svn: 355617
2019-03-07 18:15:23 +00:00
Nico Weber
9df3cc24b3 gn build: Port r342002
I had hoped we could remove the dependency on shell32.lib from lib/Support
(there isn't much depending on it), but looks like this will take a while. So
for now, port this over.

Differential Revision: https://reviews.llvm.org/D58925

llvm-svn: 355604
2019-03-07 15:44:59 +00:00
Nico Weber
19043d8067 gn build: Merge r355522
llvm-svn: 355603
2019-03-07 15:43:14 +00:00
Peter Collingbourne
953e5cb9c2 gn build: Merge r355514.
llvm-svn: 355552
2019-03-06 21:21:45 +00:00
Peter Collingbourne
6fdb0f3c3f gn build: Merge r355439.
llvm-svn: 355480
2019-03-06 03:08:06 +00:00
Peter Collingbourne
19196e678d gn build: Add 32-bit Linux support.
Differential Revision: https://reviews.llvm.org/D58839

llvm-svn: 355467
2019-03-06 01:28:32 +00:00
Craig Topper
dde774575a Revert r355224 "[TableGen][SelectionDAG][X86] Add specific isel matchers for immAllZerosV/immAllOnesV. Remove bitcasts from X86 patterns that are no longer necessary."
This caused the first matcher in the isel table for many targets to Opc_Scope instead of Opc_SwitchOpcode. This leads to a significant increase in isel match failures.

llvm-svn: 355433
2019-03-05 19:18:16 +00:00
Craig Topper
69c69a340b [Subtarget] Merge ProcSched and ProcDesc arrays in MCSubtargetInfo into a single array.
These arrays are both keyed by CPU name and go into the same tablegenerated file. Merge them so we only need to store keys once.

This also removes a weird space saving quirk where we used the ProcDesc.size() to create to build an ArrayRef for ProcSched.

Differential Revision: https://reviews.llvm.org/D58939

llvm-svn: 355431
2019-03-05 18:54:38 +00:00
Craig Topper
9cde3703c2 [Subtarget] Create a separate SubtargetSubtargetKV struct for ProcDesc to remove fields from the stack tables that aren't needed for CPUs
The description for CPUs was just the CPU name wrapped with "Select the " and " processor". We can just do that directly in the help printer instead of making a separate version in the binary for each CPU.

Also remove the Value field that isn't needed and was always 0.

Differential Revision: https://reviews.llvm.org/D58938

llvm-svn: 355429
2019-03-05 18:54:34 +00:00
Simon Pilgrim
837d55ff6d Add wildcard support to all update_*_test_checks.py scripts (PR37500)
We can already update multiple files in each update call, this extends it to work with wildcards as well in the same way as update_mca_test_checks.py (to support shells that won't do this for us - windows command prompt etc.)

Differential Revision: https://reviews.llvm.org/D58817

llvm-svn: 355386
2019-03-05 10:44:37 +00:00
Shoaib Meenai
f5bbfca8c1 [build] Rename clang-headers to clang-resource-headers
Summary:
The current install-clang-headers target installs clang's resource
directory headers. This is different from the install-llvm-headers
target, which installs LLVM's API headers. We want to introduce the
corresponding target to clang, and the natural name for that new target
would be install-clang-headers. Rename the existing target to
install-clang-resource-headers to free up the install-clang-headers name
for the new target, following the discussion on cfe-dev [1].

I didn't find any bots on zorg referencing install-clang-headers. I'll
send out another PSA to cfe-dev to accompany this rename.

[1] http://lists.llvm.org/pipermail/cfe-dev/2019-February/061365.html

Reviewers: beanz, phosek, tstellar, rnk, dim, serge-sans-paille

Subscribers: mgorny, javed.absar, jdoerfert, #sanitizers, openmp-commits, lldb-commits, cfe-commits, llvm-commits

Tags: #clang, #sanitizers, #lldb, #openmp, #llvm

Differential Revision: https://reviews.llvm.org/D58791

llvm-svn: 355340
2019-03-04 21:19:53 +00:00
Craig Topper
de4af9e7d5 [Subtarget] Follow up to r355167, add another set of curly braces to FeatureBitArray initialization to satisfy older versions of clang.
Apparently older versions of clang like 3.6 require an extra set of curly braces around std::array initializations. I'm told the C++ language was changed regarding this by CWG 1270.

llvm-svn: 355327
2019-03-04 19:23:37 +00:00
Nico Weber
6608668abf gn build: Add a cfi/sources target.
This build target is currently unused, but after r355144 the sync script
started complaining about cfi.cpp not being listed, and this makes the
script happy again.

llvm-svn: 355275
2019-03-02 18:29:56 +00:00
Simon Pilgrim
6dbddabc3c Fix update_mir_test_checks.py to run on python3
Split off from D58817

Differential Revision: https://reviews.llvm.org/D58820

llvm-svn: 355268
2019-03-02 11:14:01 +00:00
Craig Topper
dd0dabebc0 [TableGen][SelectionDAG][X86] Add specific isel matchers for immAllZerosV/immAllOnesV. Remove bitcasts from X86 patterns that are no longer necessary.
Previously we had build_vector PatFrags that called ISD::isBuildVectorAllZeros/Ones. Internally the ISD::isBuildVectorAllZeros/Ones look through bitcasts, but we aren't able to take advantage of that in isel. Instead of we have to canonicalize the types of the all zeros/ones build_vectors and insert bitcasts. Then we have to pattern match those exact bitcasts.

By emitting specific matchers for these 2 nodes, we can make isel look through any bitcasts without needing to explicitly match them. We should also be able to remove the canonicalization to vXi32 from lowering, but I've left that for a follow up.

This removes something like 40,000 bytes from the X86 isel table.

Differential Revision: https://reviews.llvm.org/D58595

llvm-svn: 355224
2019-03-01 20:18:38 +00:00
Peter Collingbourne
d0d768581e ELF: Change FileSize back to a uint64_t.
This lets us detect file size overflows when creating a 64-bit binary on
a 32-bit machine.

Differential Revision: https://reviews.llvm.org/D58840

llvm-svn: 355218
2019-03-01 18:53:41 +00:00
Oliver Stannard
253cc9356c [ARM] Add armv8a triple to test check updaters
llvm-svn: 355186
2019-03-01 09:26:21 +00:00
Craig Topper
c702d65b9c [Subtarget] Remove static global constructor call from the tablegened subtarget feature tables
Subtarget features are stored in a std::bitset that has been subclassed. There is a special constructor to allow the tablegen files to provide a list of bits to initialize the std::bitset to. This constructor isn't constexpr and std::bitset doesn't support many constexpr operations either. This results in a static global constructor being used to initialize the feature bitsets in these files at startup.

To fix this I've introduced a new FeatureBitArray class that holds three 64-bit values representing the initial bit values and taught tablegen to emit hex constants for them based on the feature enum values. This makes the tablegen files less readable than they were before. I can add the list of features back as a comment if we think that's important.

I've added a method to convert from this class into the std::bitset subclass we had before. I considered making the new FeatureBitArray class just implement the std::bitset interface we need instead, but thought I'd see how others felts about that first.

I've simplified the interfaces to SetImpliedBits and ClearImpliedBits a little minimize the number of times we need to convert to the bitset.

This removes about 27K from my local release+asserts build of llc.

Differential Revision: https://reviews.llvm.org/D58520

llvm-svn: 355167
2019-03-01 02:19:26 +00:00
Peter Collingbourne
21b919ec87 gn build: Merge r355133.
llvm-svn: 355147
2019-02-28 22:12:09 +00:00
Nico Weber
2d05fdf5cb gn build: Merge r355035
llvm-svn: 355146
2019-02-28 22:08:18 +00:00
Nico Weber
b742f3b150 gn build: Merge r355024
llvm-svn: 355145
2019-02-28 22:07:37 +00:00
Serge Guelton
10a479ec27 Add Support for Creating and Deleting Unicode Files and Directories in Lit
This enables lit to work with unicode file names via mkdir, rm, and redirection.
Lit still uses utf-8 internally, but converts to utf-16 on Windows, or just utf-8
bytes on everything else.

Committed on behalf of Jason Mittertreiner
Differential Revision: https://reviews.llvm.org/D56754

llvm-svn: 355122
2019-02-28 19:16:17 +00:00
Dmitri Gribenko
de282e8bdd Fixed typos in a test: s/CEHCK/CHECK/
Reviewers: ilya-biryukov, serge-sans-paille

Subscribers: delcypher, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D58613

llvm-svn: 355080
2019-02-28 10:58:13 +00:00
Evgeniy Stepanov
fc38155418 [hwasan, asan] Intercept vfork.
Summary:
Intercept vfork on arm, aarch64, i386 and x86_64.

Reviewers: pcc, vitalybuka

Subscribers: kubamracek, mgorny, javed.absar, krytarowski, kristof.beyls, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D58533

llvm-svn: 355030
2019-02-27 21:11:50 +00:00
Nico Weber
571b1cee18 gn build: Merge r354989
llvm-svn: 354991
2019-02-27 15:46:51 +00:00
Nico Weber
cf711aa9cc gn build: Merge r354692
llvm-svn: 354987
2019-02-27 15:29:14 +00:00
Saleem Abdulrasool
24682f017f vim: swiftself is an attribute
Highlight the `swiftself` attribute on parameters.

llvm-svn: 354934
2019-02-27 00:12:11 +00:00
Julian Lettner
de25aa2b54 [lit] Allow setting parallelism groups to None
Check that we do not crash if a parallelism group is explicitly set to
None. Permits usage of the following pattern.

[lit.common.cfg]
  lit_config.parallelism_groups['my_group'] = None
  if <condition>:
    lit_config.parallelism_groups['my_group'] = 3

[project/lit.cfg]
  config.parallelism_group = 'my_group'

Reviewers: rnk

Differential Revision: https://reviews.llvm.org/D58305

llvm-svn: 354912
2019-02-26 19:03:26 +00:00
Andrew Ng
882c7d157c [TableGen] Make OpcodeMappings sort comparator deterministic NFCI
The previous sort comparator was not deterministic, i.e. in some
situations it would be possible for lhs < rhs && rhs < lhs. This was
discovered by an STL assertion in a Windows debug build of llvm-tblgen.

Differential Revision: https://reviews.llvm.org/D58687

llvm-svn: 354910
2019-02-26 18:50:49 +00:00
Igor Kudrin
4ca8c7b7fa [llvm-objdump] Implement -Mreg-names-raw/-std options.
The --disassembler-options, or -M, are used to customize
the disassembler and affect its output.

The two implemented options allow selecting register names on ARM:
* With -Mreg-names-raw, the disassembler uses rNN for all registers.
* With -Mreg-names-std it prints sp, lr and pc for r13, r14 and r15,
  which is the default behavior of llvm-objdump.

Differential Revision: https://reviews.llvm.org/D57680

llvm-svn: 354870
2019-02-26 12:15:14 +00:00
Simon Tatham
fb51a50eef [ARM] Make fullfp16 instructions not conditionalisable.
More or less all the instructions defined in the v8.2a full-fp16
extension are defined as UNPREDICTABLE if you put them in an IT block
(Thumb) or use with any condition other than AL (ARM). LLVM didn't
know that, and was happy to conditionalise them.

In order to force these instructions to count as not predicable, I had
to make a small Tablegen change. The code generation back end mostly
decides if an instruction was predicable by looking for something it
can identify as a predicate operand; there's an isPredicable bit flag
that overrides that check in the positive direction, but nothing that
overrides it in the negative direction.

(I considered the alternative approach of actually removing the
predicate operand from those instructions, but thought that it would
be more painful overall for instructions differing only in data type
to have different shapes of operand list. This way, the only code that
has to notice the difference is the if-converter.)

So I've added an isUnpredicable bit alongside isPredicable, and set
that bit on the right subset of FP16 instructions, and also on the
VSEL, VMAXNM/VMINNM and VRINT[ANPM] families which should be
unpredicable for all data types.

I've included a couple of representative regression tests, both of
which previously caused an fp16 instruction to be conditionalised in
ARM state and (with -arm-no-restrict-it) to be put in an IT block in
Thumb.

Reviewers: SjoerdMeijer, t.p.northover, efriedma

Reviewed By: efriedma

Subscribers: jdoerfert, javed.absar, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D57823

llvm-svn: 354768
2019-02-25 10:39:53 +00:00
Craig Topper
b506464ecb [SelectionDAG] Add a OPC_CheckChild2CondCode to SelectionDAGISel to remove a MoveChild and MoveParent pair.
OPC_CheckCondCode is always used as operand 2 of a setcc. And its always surrounded by a MoveChild2 and a MoveParent. By having a dedicated opcode for this case we can reduce the number of bytes needed for this pattern from 4 bytes to 2.

This saves ~3000 bytes in the X86 table.

llvm-svn: 354763
2019-02-25 03:11:44 +00:00
Mitch Phillips
57292f5f70 [GN] Updated build file to allow GN builds to succeed at ToT.
llvm-svn: 354683
2019-02-22 18:45:41 +00:00
Evgeniy Stepanov
e2959d78f0 [gn] Add LLVM_BUILD_EXAMPLES.
llvm-svn: 354636
2019-02-21 23:56:05 +00:00
Evgeniy Stepanov
e837813de0 Revert "[asan] Fix vfork handling.", +1
Revert r354625, r354627 - multiple build failures.

llvm-svn: 354629
2019-02-21 22:02:24 +00:00
Evgeniy Stepanov
03c39fa07c [hwasan,asan] Intercept vfork.
Summary: AArch64 only for now.

Reviewers: vitalybuka, pcc

Subscribers: srhines, kubamracek, mgorny, javed.absar, krytarowski, kristof.beyls, jdoerfert, #sanitizers, llvm-commits, kcc

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D58313

llvm-svn: 354625
2019-02-21 21:32:24 +00:00
Evgeniy Stepanov
5dc29fc521 [gn] Add target flags to asmflags.
Reviewers: pcc, thakis

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D58483

llvm-svn: 354618
2019-02-21 20:35:31 +00:00