platform/upstream/llvm.git
6 years ago[lit] Prefer opening files with open (Python 2) rather than io.open which requires io.
Aaron Smith [Tue, 3 Apr 2018 00:22:12 +0000 (00:22 +0000)]
[lit] Prefer opening files with open (Python 2) rather than io.open which requires io.

Only rely on Python 3 (io.open) when necessary. This puts TestRunnyer.py closer to how it behaved
before the changes introduced in D43165 and silences a few Windows build bot failures.

Thanks to Stella Stamenova for the patch!

llvm-svn: 329037

6 years ago[AST] Fix some Clang-tidy modernize-use-auto warnings; other minor fixes (NFC).
Eugene Zelenko [Tue, 3 Apr 2018 00:11:50 +0000 (00:11 +0000)]
[AST] Fix some Clang-tidy modernize-use-auto warnings; other minor fixes (NFC).

llvm-svn: 329036

6 years ago[SLP] Distinguish "demanded and shrinkable" from "demanded and not shrinkable" values...
Haicheng Wu [Tue, 3 Apr 2018 00:05:10 +0000 (00:05 +0000)]
[SLP] Distinguish "demanded and shrinkable" from "demanded and not shrinkable" values when determining the minimum bitwidth

We use two approaches for determining the minimum bitwidth.

   * Demanded bits
   * Value tracking

If demanded bits doesn't result in a narrower type, we then try value tracking.
We need this if we want to root SLP trees with the indices of getelementptr
instructions since all the bits of the indices are demanded.

But there is a missing piece though. We need to be able to distinguish "demanded
and shrinkable" from "demanded and not shrinkable". For example, the bits of %i
in

%i = sext i32 %e1 to i64
%gep = getelementptr inbounds i64, i64* %p, i64 %i

are demanded, but we can shrink %i's type to i32 because it won't change the
result of the getelementptr. On the other hand, in

%tmp15 = sext i32 %tmp14 to i64
%tmp16 = insertvalue { i64, i64 } undef, i64 %tmp15, 0

it doesn't make sense to shrink %tmp15 and we can skip the value tracking.

Ideas are from Matthew Simpson!

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

llvm-svn: 329035

6 years agoInline two trivial functions that are called only once. NFC.
Rui Ueyama [Mon, 2 Apr 2018 23:58:50 +0000 (23:58 +0000)]
Inline two trivial functions that are called only once. NFC.

llvm-svn: 329034

6 years ago[Coroutines] Avoid assert splitting hidden coros
Brian Gesiak [Mon, 2 Apr 2018 23:39:40 +0000 (23:39 +0000)]
[Coroutines] Avoid assert splitting hidden coros

Summary:
When attempting to split a coroutine with 'hidden' visibility (for
example, a C++ coroutine that is inlined when compiled with the option
'-fvisibility-inlines-hidden'), LLVM would hit an assertion in
include/llvm/IR/GlobalValue.h:240: "local linkage requires default
visibility". The issue is that the visibility is copied from the source
of the function split in the `CloneFunctionInto` function, but the linkage
is not. To fix, create the new function first with external linkage,
then copy the linkage from the original function *after* `CloneFunctionInto`
is called.

Since `GlobalValue::setLinkage` in turn calls `maybeSetDsoLocal`, the
explicit call to `setDSOLocal` can be removed in CoroSplit.cpp.

Test Plan: check-llvm

Reviewers: GorNishanov, lewissbaker, EricWF, majnemer, rnk

Reviewed By: rnk

Subscribers: llvm-commits, eric_niebler

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

llvm-svn: 329033

6 years ago[Driver] Wire up the -f[no-]rtlib-add-rpath flag and tests
Petr Hosek [Mon, 2 Apr 2018 23:36:14 +0000 (23:36 +0000)]
[Driver] Wire up the -f[no-]rtlib-add-rpath flag and tests

D30700 added the -f[no-]rtlib-add-rpath flag, but that flag was never
wired up in the driver and tests were updated to check whether it
actually does anything. This patch wires up the flag and updates test.

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

llvm-svn: 329032

6 years agoImplement P0430R2 - File system library on non-POSIX systems.
Eric Fiselier [Mon, 2 Apr 2018 23:35:24 +0000 (23:35 +0000)]
Implement P0430R2 - File system library on non-POSIX systems.

This patch implements P0430R2, who's largest change is adding the path::format
enumeration for supporting path format conversions in path constructors.

However, since libc++'s filesystem only really supports POSIX like systems,
there are no real changes needed. This patch simply adds the format enum
and then ignores it when it's passed to constructors.

llvm-svn: 329031

6 years agoAlign stubs for external and common global variables to pointer size.
Rafael Espindola [Mon, 2 Apr 2018 23:20:30 +0000 (23:20 +0000)]
Align stubs for external and common global variables to pointer size.

This patch fixes PR36885: clang++ generates unaligned stub symbol
holding a pointer.

Patch by Rahul Chaudhry!

llvm-svn: 329030

6 years agoRemove llvm-mcmarkup.
Eric Christopher [Mon, 2 Apr 2018 23:17:55 +0000 (23:17 +0000)]
Remove llvm-mcmarkup.

It was never used and I've checked with the original authors.

llvm-svn: 329029

6 years agoImplement filesystem NB comments, relative paths, and related issues.
Eric Fiselier [Mon, 2 Apr 2018 23:03:41 +0000 (23:03 +0000)]
Implement filesystem NB comments, relative paths, and related issues.

This is a fairly large patch that implements all of the filesystem NB comments
and the relative paths changes (ex. adding weakly_canonical). These issues
and papers are all interrelated so their implementation couldn't be split up
nicely.

This patch upgrades <experimental/filesystem> to match the C++17 spec and not
the published experimental TS spec. Some of the changes in this patch are both
API and ABI breaking, however libc++ makes no guarantee about stability for
experimental implementations.

The major changes in this patch are:

* Implement NB comments for filesystem (P0492R2), including:
  * Implement `perm_options` enum as part of NB comments, and update the
    `permissions` function to match.
  * Implement changes to `remove_filename` and `replace_filename`
  * Implement changes to `path::stem()` and `path::extension()` which support
    splitting examples like `.profile`.
  * Change path iteration to return an empty path instead of '.' for trailing
    separators.
  * Change `operator/=` to handle absolute paths on the RHS.
  * Change `absolute` to no longer accept a current path argument.

* Implement relative paths according to NB comments (P0219r1)

* Combine `path.cpp` and `operations.cpp` since some path functions require
  access to the operations internals, and some fs operations require access
  to the path parser.

llvm-svn: 329028

6 years ago[InstCombine] Don't strip function type casts from musttail calls
Reid Kleckner [Mon, 2 Apr 2018 22:49:44 +0000 (22:49 +0000)]
[InstCombine] Don't strip function type casts from musttail calls

Summary:
The cast simplifications that instcombine does here do not make any
attempt to obey the verifier rules for musttail calls. Therefore we have
to disable them.

Reviewers: efriedma, majnemer, pcc

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 329027

6 years ago[lit] One more try at fixing TestRunner.py for D43165
Aaron Smith [Mon, 2 Apr 2018 22:34:35 +0000 (22:34 +0000)]
[lit] One more try at fixing TestRunner.py for D43165

llvm-svn: 329026

6 years agoCodeGenCXX: support PreserveMostCC in MS ABI
Saleem Abdulrasool [Mon, 2 Apr 2018 22:25:50 +0000 (22:25 +0000)]
CodeGenCXX: support PreserveMostCC in MS ABI

Microsoft has reserved 'U' for the PreserveMostCC which is used in the
swift runtime.  Add support for this.  This allows the swift runtime to
be built for Windows again.

llvm-svn: 329025

6 years ago[lit] Attempt to fix builtin diff code for Python 2
Reid Kleckner [Mon, 2 Apr 2018 22:19:42 +0000 (22:19 +0000)]
[lit] Attempt to fix builtin diff code for Python 2

llvm-svn: 329024

6 years ago[libcxx] Disable testing with system lib for 2 tests verifying debug mode.
Volodymyr Sapsai [Mon, 2 Apr 2018 22:09:57 +0000 (22:09 +0000)]
[libcxx] Disable testing with system lib for 2 tests verifying debug mode.

llvm-svn: 329023

6 years ago[lit] Fix problem in how Python versions open files with different encodings
Aaron Smith [Mon, 2 Apr 2018 22:08:56 +0000 (22:08 +0000)]
[lit] Fix problem in how Python versions open files with different encodings

Reapply D43165 which was reverted because of different versions of python failing.
The one line fix for the different python versions was commited at the same time
that D43165 was reverted. If this change is giving you issues then get in touch
with your python version and we will fix it.

llvm-svn: 329022

6 years agoFix Go IR test for changes in DIBuilder API
Harlan Haskins [Mon, 2 Apr 2018 21:45:35 +0000 (21:45 +0000)]
Fix Go IR test for changes in DIBuilder API

llvm-svn: 329021

6 years ago[lit] Use io.open to compare two files since it supports different encodings while...
Aaron Smith [Mon, 2 Apr 2018 21:44:51 +0000 (21:44 +0000)]
[lit] Use io.open to compare two files since it supports different encodings while older versions of open do not

llvm-svn: 329020

6 years ago[ORC] Add a debugging check to catch dangling references to SymbolStringPools.
Lang Hames [Mon, 2 Apr 2018 21:39:39 +0000 (21:39 +0000)]
[ORC] Add a debugging check to catch dangling references to SymbolStringPools.

llvm-svn: 329019

6 years ago[ORC] Fix a think-o: ExecutionSession should create a SymbolStringPool if none
Lang Hames [Mon, 2 Apr 2018 21:34:48 +0000 (21:34 +0000)]
[ORC] Fix a think-o: ExecutionSession should create a SymbolStringPool if none
is passed in.

llvm-svn: 329018

6 years agoRevert r329012 "[lit] Fix problem in how Python versions open files with different...
Reid Kleckner [Mon, 2 Apr 2018 21:33:46 +0000 (21:33 +0000)]
Revert r329012 "[lit] Fix problem in how Python versions open files with different encodings"

This doesn't work with Python 2. See this build-in-progress:
http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/11105

llvm-svn: 329017

6 years ago[profile] Move newly added test to the supported platform
Rong Xu [Mon, 2 Apr 2018 21:24:07 +0000 (21:24 +0000)]
[profile] Move newly added test to the supported platform

Move test/profile/instrprof-value-merge.c from r328987 to Linux directory.

llvm-svn: 329016

6 years agoTreat inlining a notail call as a regular, non-tail call
Reid Kleckner [Mon, 2 Apr 2018 21:23:16 +0000 (21:23 +0000)]
Treat inlining a notail call as a regular, non-tail call

Otherwise, we end up inlining a musttail call into a non-tail position,
which breaks verifier invariants.

Fixes PR31014

llvm-svn: 329015

6 years agoDefine TrapInst for ppc64.
Rafael Espindola [Mon, 2 Apr 2018 21:11:13 +0000 (21:11 +0000)]
Define TrapInst for ppc64.

This is nice for testing since it is the first TrapInst whose bytes
are not all the same.

llvm-svn: 329014

6 years ago[ORC] Create a new SymbolStringPool by default in ExecutionSession constructor.
Lang Hames [Mon, 2 Apr 2018 20:57:56 +0000 (20:57 +0000)]
[ORC] Create a new SymbolStringPool by default in ExecutionSession constructor.

This makes the common case of constructing an ExecutionSession tidier.

llvm-svn: 329013

6 years ago[lit] Fix problem in how Python versions open files with different encodings
Aaron Smith [Mon, 2 Apr 2018 20:57:06 +0000 (20:57 +0000)]
[lit] Fix problem in how Python versions open files with different encodings

Summary:
This issue was found when running the clang unit test on Windows. Python 3.x cannot open some of the files that the tests are using with a simple open because of their encoding. Python 2.7+ and Python 3.x both support io.open which allows for an encoding to be specified.

This change will determine whether two files being compared should be opened (and then compared) as text or binary and whether to use utf-8 or the default encoding before proceeding with a line-by-line comparison.

Patch by Stella Stamenova!

Reviewers: zturner, llvm-commits, rnk, MaggieYi

Reviewed By: zturner

Subscribers: asmith, MatzeB, stella.stamenova, delcypher, llvm-commits

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

llvm-svn: 329012

6 years ago[InstCombine] add folds for icmp + sub (PR36969)
Sanjay Patel [Mon, 2 Apr 2018 20:37:40 +0000 (20:37 +0000)]
[InstCombine] add folds for icmp + sub (PR36969)

(A - B) >u A --> A <u B
C <u (C - D) --> C <u D

https://rise4fun.com/Alive/e7j

Name: ugt
  %sub = sub i8 %x, %y
  %cmp = icmp ugt i8 %sub, %x
=>
  %cmp = icmp ult i8 %x, %y

Name: ult
  %sub = sub i8 %x, %y
  %cmp = icmp ult i8 %x, %sub
=>
  %cmp = icmp ult i8 %x, %y

This should fix:
https://bugs.llvm.org/show_bug.cgi?id=36969

llvm-svn: 329011

6 years ago[InstCombine] add tests for icmp (sub x, y), x (PR36969); NFC
Sanjay Patel [Mon, 2 Apr 2018 20:23:54 +0000 (20:23 +0000)]
[InstCombine] add tests for icmp (sub x, y), x (PR36969); NFC

llvm-svn: 329010

6 years ago[MS] Emit vftable thunks for functions with incomplete prototypes
Reid Kleckner [Mon, 2 Apr 2018 20:20:33 +0000 (20:20 +0000)]
[MS] Emit vftable thunks for functions with incomplete prototypes

Summary:
The following class hierarchy requires that we be able to emit a
this-adjusting thunk for B::foo in C's vftable:

  struct Incomplete;
  struct A {
    virtual A* foo(Incomplete p) = 0;
  };
  struct B : virtual A {
    void foo(Incomplete p) override;
  };
  struct C : B { int c; };

This TU is valid, but lacks a definition of 'Incomplete', which makes it
hard to build a thunk for the final overrider, B::foo.

Before this change, Clang gives up attempting to emit the thunk, because
it assumes that if the parameter types are incomplete, it must be
emitting the thunk for optimization purposes. This is untrue for the MS
ABI, where the implementation of B::foo has no idea what thunks C's
vftable may require. Clang needs to emit the thunk without necessarily
having access to the complete prototype of foo.

This change makes Clang emit a musttail variadic call when it needs such
a thunk. I call these "unprototyped" thunks, because they only prototype
the "this" parameter, which must always come first in the MS C++ ABI.

These thunks work, but they create ugly LLVM IR. If the call to the
thunk is devirtualized, it will be a call to a bitcast of a function
pointer. Today, LLVM cannot inline through such a call, but I want to
address that soon, because we also use this pattern for virtual member
pointer thunks.

This change also implements an old FIXME in the code about reusing the
thunk's computed CGFunctionInfo as much as possible. Now we don't end up
computing the thunk's mangled name and arranging it's prototype up to
around three times.

Fixes PR25641

Reviewers: rjmccall, rsmith, hans

Subscribers: Prazek, cfe-commits

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

llvm-svn: 329009

6 years agoAnother attempt to fix papertrail-warnings.test on Windows bots by making expected...
Douglas Yung [Mon, 2 Apr 2018 20:05:05 +0000 (20:05 +0000)]
Another attempt to fix papertrail-warnings.test on Windows bots by making expected message less case sensitive.

llvm-svn: 329008

6 years agoFix some DenseMap use-after-rehash bugs and hoist MethodVFTableLocation
Reid Kleckner [Mon, 2 Apr 2018 20:00:39 +0000 (20:00 +0000)]
Fix some DenseMap use-after-rehash bugs and hoist MethodVFTableLocation

This re-lands r328845 with fixes for crbug.com/827810.

The initial motiviation was to hoist MethodVFTableLocation to global
scope so it could be forward declared.

In this patch, I noticed that MicrosoftVTableContext uses some risky
patterns. It has methods that return references to data stored in
DenseMaps. I've made some of them return by value for trivial structs
and I've moved some things into separate allocations.

llvm-svn: 329007

6 years ago[PPC64] Minor changes for Plt relocations.
Sean Fertile [Mon, 2 Apr 2018 19:47:21 +0000 (19:47 +0000)]
[PPC64] Minor changes for Plt relocations.

The Plt relative relocations are R_PPC64_JMP_SLOT in the V2 abi, and we only
reserve 2 double words instead of 3 at the start of the array of PLT entries for
lazy linking.

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

llvm-svn: 329006

6 years ago[Attr] [NFC] Revert accidental change from r327405
Joel E. Denny [Mon, 2 Apr 2018 19:43:34 +0000 (19:43 +0000)]
[Attr] [NFC] Revert accidental change from r327405

llvm-svn: 329005

6 years ago[PPC64] Write plt stubs for ElfV2 abi
Sean Fertile [Mon, 2 Apr 2018 19:17:12 +0000 (19:17 +0000)]
[PPC64] Write plt stubs for ElfV2 abi

Add the default version of a plt stub for the V2 Elf abi.

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

llvm-svn: 329004

6 years agoFix header mismatch in DIBuilder Type APIs
Harlan Haskins [Mon, 2 Apr 2018 19:11:44 +0000 (19:11 +0000)]
Fix header mismatch in DIBuilder Type APIs

Some of the headers changed slightly, and the accompanying
implementation didn't change. This caused a silent failure.

llvm-svn: 329003

6 years ago[llvm-pdbutil] Add an export subcommand.
Zachary Turner [Mon, 2 Apr 2018 18:35:21 +0000 (18:35 +0000)]
[llvm-pdbutil] Add an export subcommand.

This command can dump the binary contents of a stream to a file.
This is useful when you want to do side-by-side comparisons of
a specific stream from two PDBs to examine the differences between
them.  You can export both of them to a file, then open them up
side by side in a hex editor (for example), so as to eliminate any
differences that might arise from the contents being on different
blocks in the PDB.

In subsequent patches I plan to improve the "explain" subcommand
so that you can explain the contents of a binary file that isn't
necessarily a full PDB, but one of these dumped streams, by telling
the subcommand how to interpret the contents.

llvm-svn: 329002

6 years agoTemporarily revert r328404:
Eric Christopher [Mon, 2 Apr 2018 18:33:47 +0000 (18:33 +0000)]
Temporarily revert r328404:

commit 519b97132a4c960e8dedbfe4290d86970d92e995
Author: Richard Trieu <rtrieu@google.com>
Date:   Sat Mar 24 00:52:44 2018 +0000

    [ODRHash] Support pointer and reference types.

    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328404 91177308-0d34-0410-b5e6-96231b3b80d8

As it's breaking some tests. I've communicated with Richard offline about testcases.

llvm-svn: 329001

6 years agoAdd -fclang-abi-compat=6 flag for upcoming ABI changes.
Richard Smith [Mon, 2 Apr 2018 18:29:44 +0000 (18:29 +0000)]
Add -fclang-abi-compat=6 flag for upcoming ABI changes.

llvm-svn: 329000

6 years agoAdd helper to determine if a field is a zero-length bitfield.
Richard Smith [Mon, 2 Apr 2018 18:29:43 +0000 (18:29 +0000)]
Add helper to determine if a field is a zero-length bitfield.

llvm-svn: 328999

6 years agoRemove unused PACKAGE_TARNAME; looks like a remnant of the old autoconf build.
Nico Weber [Mon, 2 Apr 2018 18:13:05 +0000 (18:13 +0000)]
Remove unused PACKAGE_TARNAME; looks like a remnant of the old autoconf build.

llvm-svn: 328998

6 years agoRevert r328932 as it caused Windows and MacOS bot failures.
Mike Edwards [Mon, 2 Apr 2018 18:02:36 +0000 (18:02 +0000)]
Revert r328932 as it caused Windows and MacOS bot failures.

http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/43991/

llvm-svn: 328997

6 years agoRemove some unused cmake standard library includes.
Nico Weber [Mon, 2 Apr 2018 17:52:19 +0000 (17:52 +0000)]
Remove some unused cmake standard library includes.

llvm-svn: 328996

6 years agoRemove more feature test macros that became unused after r328989.
Nico Weber [Mon, 2 Apr 2018 17:45:47 +0000 (17:45 +0000)]
Remove more feature test macros that became unused after r328989.

llvm-svn: 328995

6 years ago[CUDA] Let device-side shared variables be initialized with undef
Yaxun Liu [Mon, 2 Apr 2018 17:38:24 +0000 (17:38 +0000)]
[CUDA] Let device-side shared variables be initialized with undef

CUDA shared variable should be initialized with undef.

Patch by Greg Rodgers.
Revised and lit test added by Yaxun Liu.

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

llvm-svn: 328994

6 years ago[coroutines] Add __builtin_coro_noop => llvm.coro.noop
Gor Nishanov [Mon, 2 Apr 2018 17:35:37 +0000 (17:35 +0000)]
[coroutines] Add __builtin_coro_noop => llvm.coro.noop

A recent addition to Coroutines TS (https://wg21.link/p0913) adds a pre-defined
coroutine noop_coroutine that does nothing. To implement this feature, we implemented
an llvm.coro.noop intrinsic that returns a coroutine handle to a coroutine that
does nothing when resumed or destroyed.

This patch adds a builtin __builtin_coro_noop() that maps to llvm.coro.noop intrinsic.

Related llvm change: https://reviews.llvm.org/D45114

llvm-svn: 328993

6 years agoRemove HAVE_LIBPSAPI, HAVE_SHELL32.
Nico Weber [Mon, 2 Apr 2018 17:32:48 +0000 (17:32 +0000)]
Remove HAVE_LIBPSAPI, HAVE_SHELL32.

These used to be set in the old autoconf build, but the cmake build has had a
"TODO: actually check for these" comment since it was checked in, and they
were set to 1 on mingw unconditionally.  It seems safe to say that they always
exist under mingw, so just remove them and assume they're set exactly when on
mingw (with msvc, we use `pragma comment` instead of linking these via flags).

llvm-svn: 328992

6 years ago[DeadArgumentElim] Clone function level metadatas
Rong Xu [Mon, 2 Apr 2018 17:27:38 +0000 (17:27 +0000)]
[DeadArgumentElim] Clone function level metadatas

Some Function level metadatas, such as function entry count, are not cloned in
DeadArgumentElim. This happens a lot in lto/thinlto because of DeadArgumentElim
after internalization.

This patch clones the metadatas in the original function to the new function.

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

llvm-svn: 328991

6 years agoAdded a BSD archive tool.
Greg Clayton [Mon, 2 Apr 2018 17:20:21 +0000 (17:20 +0000)]
Added a BSD archive tool.

This is a combination stand alone BSD archive tool that can dump BSD archives:

% bsd.py /path/to/foo.a

Search archives for an object file:

% bsd.py --object foo.o bar.a

Dump the symbol definitions found in the __.SYMDEF objects:

% bsd.py --symdef bar.a

Find symbols by name that are listed in the __.SYMDEF objects:

% bsd.py --symbol _Z123 bar.a

Extract objects from BSD archives:

% bsd.py --object foo.o bar.a --extract
% bsd.py --object foo.o bar.a --extract --outfile /tmp/foo.o
% bsd.py --object foo.o bar.a --extract --mtime 0x1234556

It also has installs a new LLDB command line command when imported into LLDB:

(lldb) command script import ~/Dropbox/bin/bsd.py
The "verify-debug-map-objects" command has been installed, type "help verify-debug-map-objects" for detailed help.
(lldb) verify-debug-map-objects a.out

This will iterate through all object files and verify the modification times match for any .o files, it will verify any .o files from BSD archives are found and have matching modification times and print out errors if any are found.

llvm-svn: 328990

6 years agoRemove HAVE_DIRENT_H.
Nico Weber [Mon, 2 Apr 2018 17:17:29 +0000 (17:17 +0000)]
Remove HAVE_DIRENT_H.

The autoconf manual: "This macro is obsolescent, as all current systems with
directory libraries have <dirent.h>. New programs need not use this macro."

llvm-svn: 328989

6 years ago[AMDGPU][MC][GFX9] Added instructions v_cvt_norm_*16_f16, v_sat_pk_u8_i16
Dmitry Preobrazhensky [Mon, 2 Apr 2018 17:09:20 +0000 (17:09 +0000)]
[AMDGPU][MC][GFX9] Added instructions v_cvt_norm_*16_f16, v_sat_pk_u8_i16

See bug 36847: https://bugs.llvm.org/show_bug.cgi?id=36847

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

Reviewers: artem.tamazov, arsenm, timcorringham
llvm-svn: 328988

6 years ago[profile] Fix value profile runtime merging issues
Rong Xu [Mon, 2 Apr 2018 16:57:00 +0000 (16:57 +0000)]
[profile] Fix value profile runtime merging issues

This patch fixes the following issues:
(1) The strong definition of the merge hook function was not working which
breaks the online value profile merging. This patch removes the weak
attribute of VPMergeHook and assigns the value dynamically.
(2) Truncate the proifle file so that we don't have garbage data at the end of
the file.
(3) Add new __llvm_profile_instrument_target_value() interface to do the value
profile update in batch. This is needed as the original incremental by 1
in __llvm_profile_instrument_target() is too slow for online merge.

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

llvm-svn: 328987

6 years ago[coroutines] Add support for llvm.coro.noop intrinsics
Gor Nishanov [Mon, 2 Apr 2018 16:55:12 +0000 (16:55 +0000)]
[coroutines] Add support for llvm.coro.noop intrinsics

Summary:
A recent addition to Coroutines TS (https://wg21.link/p0913) adds a pre-defined coroutine noop_coroutine that does nothing.
To implement this feature, we implemented an llvm.coro.noop intrinsic that returns a coroutine handle to a coroutine that does nothing when resumed or destroyed.

Reviewers: EricWF, modocache, rnk, lewissbaker

Reviewed By: modocache

Subscribers: llvm-commits

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

llvm-svn: 328986

6 years ago[Core] Grab-bag of improvements for Scalar.
Davide Italiano [Mon, 2 Apr 2018 16:50:54 +0000 (16:50 +0000)]
[Core] Grab-bag of improvements for Scalar.

Remove Scalar::Cast.

It was noted on the list that this method is unused. So, this patch
removes it.

Fix Scalar::Promote for most integer types

This fixes promotion of most integer types (128- and 256-bit types are
handled in a subsequent patch) to floating-point types. Previously
promotion was done bitwise, where value preservation is correct.

Fix Scalar::Promote for 128- and 256-bit integer types

This patch fixes the behavior of Scalar::Promote when trying to
perform a binary operation involving a 128- or 256-bit integer type
and a floating-point type. Now, the integer is cast to the floating
point type for the operation.

Patch by Tom Tromey!

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

llvm-svn: 328985

6 years agoSupport template template parameters
Frederic Riss [Mon, 2 Apr 2018 16:18:32 +0000 (16:18 +0000)]
Support template template parameters

Summary:
We would fail to resolve (and thus display the value of) any
templated type which contained a template template argument even
though we don't really use template arguments.

This patch adds minimal support for template template arguments,
but I doubt we need any more than that.

Reviewers: clayborg, jingham

Subscribers: JDevlieghere, lldb-commits

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

llvm-svn: 328984

6 years ago[AMDGPU][MC][GFX9] Added s_atomic_* and s_buffer_atomic_* instructions
Dmitry Preobrazhensky [Mon, 2 Apr 2018 16:10:25 +0000 (16:10 +0000)]
[AMDGPU][MC][GFX9] Added s_atomic_* and s_buffer_atomic_* instructions

Fixed a bug which caused Tablegen crash.

See bug 36837: https://bugs.llvm.org/show_bug.cgi?id=36837

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

Reviewers: artem.tamazov, arsenm, timcorringham
llvm-svn: 328983

6 years ago[PPC] Add a test for toc-relative access on ppc64le.
Sean Fertile [Mon, 2 Apr 2018 15:42:07 +0000 (15:42 +0000)]
[PPC] Add a test for toc-relative access on ppc64le.

Adds a simple test for accessing a local global variable in the ElfV2 abi.
Checks that the toc base used is the expected offset from the .TOC. symbol,
and that the offsets for the global are calculated relative to the toc base.

llvm-svn: 328982

6 years ago[Hexagon] Clean up some code in HexagonAsmPrinter, NFC
Krzysztof Parzyszek [Mon, 2 Apr 2018 15:06:55 +0000 (15:06 +0000)]
[Hexagon] Clean up some code in HexagonAsmPrinter, NFC

llvm-svn: 328981

6 years ago[SLP] Fix PR36481: vectorize reassociated instructions.
Alexey Bataev [Mon, 2 Apr 2018 14:51:37 +0000 (14:51 +0000)]
[SLP] Fix PR36481: vectorize reassociated instructions.

Summary:
If the load/extractelement/extractvalue instructions are not originally
consecutive, the SLP vectorizer is unable to vectorize them. Patch
allows reordering of such instructions.

Reviewers: RKSimon, spatel, hfinkel, mkuper, Ayal, ashahid

Subscribers: llvm-commits

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

llvm-svn: 328980

6 years agoRemove stro(u?)ll() config checks. Those were needed pre-MSVC2013, but we require...
Nico Weber [Mon, 2 Apr 2018 14:36:34 +0000 (14:36 +0000)]
Remove stro(u?)ll() config checks. Those were needed pre-MSVC2013, but we require 2015 nowadays.

llvm-svn: 328979

6 years agoRevert r328975, it makes TableGen assert on the bots.
Nico Weber [Mon, 2 Apr 2018 14:20:23 +0000 (14:20 +0000)]
Revert r328975, it makes TableGen assert on the bots.

llvm-svn: 328978

6 years agoRemove HAVE_WRITEV that's unused after r255837.
Nico Weber [Mon, 2 Apr 2018 14:18:13 +0000 (14:18 +0000)]
Remove HAVE_WRITEV that's unused after r255837.

llvm-svn: 328977

6 years agoMore fixes after r328970.
Nico Weber [Mon, 2 Apr 2018 13:55:56 +0000 (13:55 +0000)]
More fixes after r328970.

llvm-svn: 328976

6 years ago[AMDGPU][MC][GFX9] Added s_atomic_* and s_buffer_atomic_* instructions
Dmitry Preobrazhensky [Mon, 2 Apr 2018 13:52:23 +0000 (13:52 +0000)]
[AMDGPU][MC][GFX9] Added s_atomic_* and s_buffer_atomic_* instructions

See bug 36837: https://bugs.llvm.org/show_bug.cgi?id=36837

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

Reviewers: artem.tamazov, arsenm, timcorringham
llvm-svn: 328975

6 years agoAttempt to heal bots after r328970.
Nico Weber [Mon, 2 Apr 2018 13:49:35 +0000 (13:49 +0000)]
Attempt to heal bots after r328970.

llvm-svn: 328974

6 years ago[X86] Reduce Store Forward Block issues in HW - Recommit after fixing Bug 36346
Lama Saba [Mon, 2 Apr 2018 13:48:28 +0000 (13:48 +0000)]
[X86] Reduce Store Forward Block issues in HW - Recommit after fixing Bug 36346

If a load follows a store and reloads data that the store has written to memory, Intel microarchitectures can in many cases forward the data directly from the store to the load, This "store forwarding" saves cycles by enabling the load to directly obtain the data instead of accessing the data from cache or memory.
A "store forward block" occurs in cases that a store cannot be forwarded to the load. The most typical case of store forward block on Intel Core microarchiticutre that a small store cannot be forwarded to a large load.
The estimated penalty for a store forward block is ~13 cycles.

This pass tries to recognize and handle cases where "store forward block" is created by the compiler when lowering memcpy calls to a sequence
of a load and a store.

The pass currently only handles cases where memcpy is lowered to XMM/YMM registers, it tries to break the memcpy into smaller copies.
breaking the memcpy should be possible since there is no atomicity guarantee for loads and stores to XMM/YMM.

Differential revision: https://reviews.llvm.org/D41330

Change-Id: Ib48836ccdf6005989f7d4466fa2035b7b04415d9
llvm-svn: 328973

6 years ago[llvm-mca] Do not assume that implicit reads cannot be associated with ReadAdvance...
Andrea Di Biagio [Mon, 2 Apr 2018 13:46:49 +0000 (13:46 +0000)]
[llvm-mca] Do not assume that implicit reads cannot be associated with ReadAdvance entries.

Before, the instruction builder incorrectly assumed that only explicit reads
could have been associated with ReadAdvance entries.
This patch fixes the issue and adds a test to verify it.

llvm-svn: 328972

6 years agoAttempt to fix papertrail-warnings.test on Windows bots.
Nico Weber [Mon, 2 Apr 2018 13:45:39 +0000 (13:45 +0000)]
Attempt to fix papertrail-warnings.test on Windows bots.

llvm-svn: 328971

6 years agoAssume existence of inttypes.h and stdint.h in DataTypes.h.
Nico Weber [Mon, 2 Apr 2018 13:22:26 +0000 (13:22 +0000)]
Assume existence of inttypes.h and stdint.h in DataTypes.h.

These should exist in all toolchains LLVM supports nowadays.

Enables making DataTypes.h a regular header instead of a .h.cmake file and
allows deleting a bunch of cmake goop (which should also speed up cmake
configure time a bit).

All the code this removes is 9+ years old.
https://reviews.llvm.org/D45155

llvm-svn: 328970

6 years ago[PowerPC] fix assertion failure due to missing instruction in P9InstrResources.td
Hiroshi Inoue [Mon, 2 Apr 2018 12:18:21 +0000 (12:18 +0000)]
[PowerPC] fix assertion failure due to missing instruction in P9InstrResources.td

This patch adds L(D|W|H|B)XTLS instructions introduced by https://reviews.llvm.org/rL327635 in P9InstrResources.td.

llvm-svn: 328969

6 years agoFix unused variable warning introduced at revision 328910.
Andrea Di Biagio [Mon, 2 Apr 2018 12:04:37 +0000 (12:04 +0000)]
Fix unused variable warning introduced at revision 328910.

llvm-svn: 328968

6 years ago[ELF] - cref.s: check that we print symbols from archives. NFCI.
George Rimar [Mon, 2 Apr 2018 11:28:44 +0000 (11:28 +0000)]
[ELF] - cref.s: check that we print symbols from archives. NFCI.

This is consistent with bfd and we already supported it,
though test did not contain the explicit check.

llvm-svn: 328967

6 years ago[test] Exit lldb-dotest in a more Pythonic way.
Jonas Devlieghere [Mon, 2 Apr 2018 10:44:36 +0000 (10:44 +0000)]
[test] Exit lldb-dotest in a more Pythonic way.

As suggested by Keith Smiley in:
https://github.com/apple/swift-lldb/pull/486

llvm-svn: 328966

6 years ago[dsymutil] Upstream emitting of papertrail warnings.
Jonas Devlieghere [Mon, 2 Apr 2018 10:40:43 +0000 (10:40 +0000)]
[dsymutil] Upstream emitting of papertrail warnings.

When running dsymutil as part of your build system, it can be desirable
for warnings to be part of the end product, rather than just being
emitted to the output stream. This patch upstreams that functionality.

Differential revision: https://reviews.llvm.org/D44639

llvm-svn: 328965

6 years agoWdocumentation fix. NFCI.
Simon Pilgrim [Mon, 2 Apr 2018 10:34:39 +0000 (10:34 +0000)]
Wdocumentation fix. NFCI.

llvm-svn: 328964

6 years agoWdocumentation fixes. NFCI.
Simon Pilgrim [Mon, 2 Apr 2018 10:21:51 +0000 (10:21 +0000)]
Wdocumentation fixes. NFCI.

llvm-svn: 328963

6 years ago[X86][Silvermont] Use correct latency and throughput information for divide and squar...
Craig Topper [Mon, 2 Apr 2018 06:34:16 +0000 (06:34 +0000)]
[X86][Silvermont] Use correct latency and throughput information for divide and square root in the scheduler model.

Data taken from Table 16-17 in the Intel Optimization Manual.

llvm-svn: 328962

6 years ago[X86][SkylakeServer] Correct throughput for 512-bit sqrt and divide.
Craig Topper [Mon, 2 Apr 2018 05:54:34 +0000 (05:54 +0000)]
[X86][SkylakeServer] Correct throughput for 512-bit sqrt and divide.

Data taken from the AVX512_SKX_PortAssign spreadsheet at http://instlatx64.atw.hu/

llvm-svn: 328961

6 years ago[X86] Correct the throughput for divide instructions in Sandy Bridge/Haswell/Broadwel...
Craig Topper [Mon, 2 Apr 2018 05:33:28 +0000 (05:33 +0000)]
[X86] Correct the throughput for divide instructions in Sandy Bridge/Haswell/Broadwell/Skylake scheduler models.

Fixes most of PR36898. Still need to fix the 512-bit instructions, but Agner's tables don't have those.

llvm-svn: 328960

6 years ago[X86] Fix the SchedRW for AVX512 shift instructions.
Craig Topper [Mon, 2 Apr 2018 03:15:02 +0000 (03:15 +0000)]
[X86] Fix the SchedRW for AVX512 shift instructions.

It was being inadvertently defaulted to an FADD scheduler class.

llvm-svn: 328959

6 years ago[X86] Give the AVX512 VEXTRACT instructions the same SchedRWs as the SSE/AVX versions.
Craig Topper [Mon, 2 Apr 2018 02:44:55 +0000 (02:44 +0000)]
[X86] Give the AVX512 VEXTRACT instructions the same SchedRWs as the SSE/AVX versions.

llvm-svn: 328958

6 years agoRemove a few unreferenced config.h defines.
Nico Weber [Mon, 2 Apr 2018 01:46:08 +0000 (01:46 +0000)]
Remove a few unreferenced config.h defines.

Found by looking through the output of

  for f in $(grep -o '\bHAVE_[A-Z0-9_]*\b' llvm/cmake/config-ix.cmake); do
    echo $f $(git grep $f '*' | wc -l);
  done

in the monorepo.

llvm-svn: 328957

6 years ago[X86] Add an itinerary to BTR64rr.
Craig Topper [Mon, 2 Apr 2018 01:12:34 +0000 (01:12 +0000)]
[X86] Add an itinerary to BTR64rr.

llvm-svn: 328956

6 years ago[X86] Make sure all the classes declare in the Haswell scheduler model are prefixed...
Craig Topper [Mon, 2 Apr 2018 01:12:32 +0000 (01:12 +0000)]
[X86] Make sure all the classes declare in the Haswell scheduler model are prefixed with HW.

The tablegen files all share a namespace so we shouldn't use a generic names in a specific scheduler model.

llvm-svn: 328955

6 years ago[X86] Give VINSERTPS the same intinerary as INSERTPS.
Craig Topper [Mon, 2 Apr 2018 00:48:11 +0000 (00:48 +0000)]
[X86] Give VINSERTPS the same intinerary as INSERTPS.

llvm-svn: 328954

6 years agoAdd C API bindings for DIBuilder 'Type' APIs
Harlan Haskins [Mon, 2 Apr 2018 00:17:40 +0000 (00:17 +0000)]
Add C API bindings for DIBuilder 'Type' APIs

This patch adds a set of unstable C API bindings to the DIBuilder interface for
creating structure, function, and aggregate types.

This patch also removes the existing implementations of these functions from
the Go bindings and updates the Go API to fit the new C APIs.

llvm-svn: 328953

6 years ago[X86] Cleanup ADCX/ADOX instruction definitions.
Craig Topper [Sun, 1 Apr 2018 23:58:50 +0000 (23:58 +0000)]
[X86] Cleanup ADCX/ADOX instruction definitions.

Give them both the same itineraries. Add hasSideEffects = 0 to ADOX since they don't have patterns. Rename source operands to $src1 and $src2 instead of $src0 and $src. Add ReadAfterLd to the memory form SchedRW.

llvm-svn: 328952

6 years ago[Coroutines] Schedule coro-split before asan
Brian Gesiak [Sun, 1 Apr 2018 23:55:21 +0000 (23:55 +0000)]
[Coroutines] Schedule coro-split before asan

Summary:
The docs for the LLVM coroutines intrinsic `@llvm.coro.id` state that
"The second argument, if not null, designates a particular alloca instruction
to be a coroutine promise."

However, if the address sanitizer pass is run before the `@llvm.coro.id`
intrinsic is lowered, the `alloca` instruction passed to the intrinsic as its
second argument is converted, as per the
https://github.com/google/sanitizers/wiki/AddressSanitizerAlgorithm docs, to
an `inttoptr` instruction that accesses the address of the promise.

On optimization levels `-O1` and above, the `-asan` pass is run after
`-coro-early`, `-coro-split`, and `-coro-elide`, and before
`-coro-cleanup`, and so there is no issue. At `-O0`, however, `-asan`
is run in between `-coro-early` and `-coro-split`, which causes an
assertion to be hit when the `inttoptr` instruction is forcibly cast to
an `alloca`.

Rearrange the passes such that the coroutine passes are registered
before the sanitizer passes.

Test Plan:
Compile a simple C++ program that uses coroutines in `-O0` with
`-fsanitize-address`, and confirm no assertion is hit:
`clang++ coro-example.cpp -fcoroutines-ts -g -fsanitize=address -fno-omit-frame-pointer`.

Reviewers: GorNishanov, lewissbaker, EricWF

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

llvm-svn: 328951

6 years ago[AArch64] Reserve x18 register on Fuchsia
Petr Hosek [Sun, 1 Apr 2018 23:44:04 +0000 (23:44 +0000)]
[AArch64] Reserve x18 register on Fuchsia

This register is reserved as a platform register on Fuchsia.

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

llvm-svn: 328950

6 years ago[Coroutines] Find custom allocators in class scope
Brian Gesiak [Sun, 1 Apr 2018 22:59:22 +0000 (22:59 +0000)]
[Coroutines] Find custom allocators in class scope

Summary:
https://reviews.llvm.org/rL325291 implemented Coroutines TS N4723
section [dcl.fct.def.coroutine]/7, but it performed lookup of allocator
functions within both the global and class scope, whereas the specified
behavior is to perform lookup for custom allocators within just the
class scope.

To fix, add parameters to the `Sema::FindAllocationFunctions` function
such that it can be used to lookup allocators in global scope,
class scope, or both (instead of just being able to look up in just global
scope or in both global and class scope). Then, use those parameters
from within the coroutine Sema.

This incorrect behavior had the unfortunate side-effect of causing the
bug https://bugs.llvm.org/show_bug.cgi?id=36578 (or at least the reports
of that bug in C++ programs). That bug would occur for any C++ user with
a coroutine frame that took a single pointer argument, since it would
then find the global placement form `operator new`, described in the
C++ standard 18.6.1.3.1. This patch prevents Clang from generating code
that triggers the LLVM assert described in that bug report.

Test Plan: `check-clang`

Reviewers: GorNishanov, eric_niebler, lewissbaker

Reviewed By: GorNishanov

Subscribers: EricWF, cfe-commits

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

llvm-svn: 328949

6 years ago[DebugCounter] Make -debug-counter cl::Hidden.
Craig Topper [Sun, 1 Apr 2018 22:16:52 +0000 (22:16 +0000)]
[DebugCounter] Make -debug-counter cl::Hidden.

llvm-svn: 328948

6 years ago[LegacyPassManager] Make 'print-module-scope' cl::Hidden like the rest of the printin...
Craig Topper [Sun, 1 Apr 2018 21:54:26 +0000 (21:54 +0000)]
[LegacyPassManager] Make 'print-module-scope' cl::Hidden like the rest of the printing options.

llvm-svn: 328947

6 years ago[X86] Give ADC8/16/32/64mi the same scheduling information as ADC8/16/32/64mr and...
Craig Topper [Sun, 1 Apr 2018 21:54:24 +0000 (21:54 +0000)]
[X86] Give ADC8/16/32/64mi the same scheduling information as ADC8/16/32/64mr and SBB8/16/32/64mi.

It doesn't make a lot of sense that it would be different.

llvm-svn: 328946

6 years ago[x86] Correct the operand structure of the ADOX instruction.
Chandler Carruth [Sun, 1 Apr 2018 21:53:18 +0000 (21:53 +0000)]
[x86] Correct the operand structure of the ADOX instruction.

This also moves to define it in the same way as ADCX which seems to use
constraints a bit better.

This is pulled out of the review for reducing the use of popf for
restoring EFLAGS, but is independent. There are still more problems with
our definitions for these instructions that Craig is going to look at
but this is at least less broken and he can start from this to improve
them more fully.

Thanks to Craig for the review here.

llvm-svn: 328945

6 years ago[x86] Expose more of the condition conversion routines in the public API
Chandler Carruth [Sun, 1 Apr 2018 21:47:55 +0000 (21:47 +0000)]
[x86] Expose more of the condition conversion routines in the public API
for X86's instruction information. I've now got a second patch under
review that needs these same APIs. This bit is nicely orthogonal and
obvious, so landing it. NFC.

llvm-svn: 328944

6 years ago[tools] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Sun, 1 Apr 2018 21:24:53 +0000 (21:24 +0000)]
[tools] Change std::sort to llvm::sort in response to r327219

Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer the comments section in D44363 for a list of all the required patches.

Reviewers: JDevlieghere, zturner, echristo, dberris, friss

Reviewed By: echristo

Subscribers: gbedwell, llvm-commits

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

llvm-svn: 328943

6 years agoFix a major swiftcall ABI bug with trivial C++ class types.
John McCall [Sun, 1 Apr 2018 21:04:30 +0000 (21:04 +0000)]
Fix a major swiftcall ABI bug with trivial C++ class types.

The problem with the previous logic was that there might not be any
explicit copy/move constructor declarations, e.g. if the type is
trivial and we've never type-checked a copy of it.  Relying on Sema's
computation seems much more reliable.

Also, I believe Richard's recommendation is exactly the rule we use
now on the Itanium ABI, modulo the trivial_abi attribute (which this
change of course fixes our handling of in Swift).

This does mean that we have a less portable rule for deciding
indirectness for swiftcall.  I would prefer it if we just applied the
Itanium rule universally under swiftcall, but in the meantime, I need
to fix this bug.

This only arises when defining functions with class-type arguments
in C++, as we do in the Swift runtime.  It doesn't affect normal Swift
operation because we don't import code as C++.

llvm-svn: 328942

6 years ago[include] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Sun, 1 Apr 2018 18:39:50 +0000 (18:39 +0000)]
[include] Change std::sort to llvm::sort in response to r327219

Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer the comments section in D44363 for a list of all the required patches.

Reviewers: echristo, zturner, mzolotukhin, lhames

Reviewed By: echristo

Subscribers: llvm-commits

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

llvm-svn: 328940

6 years agoAMDGPU: Make isIntrinsicSourceOfDivergence table-driven
Nicolai Haehnle [Sun, 1 Apr 2018 17:09:14 +0000 (17:09 +0000)]
AMDGPU: Make isIntrinsicSourceOfDivergence table-driven

Summary:
This is in preparation for the new dimension-aware image intrinsics,
which I'd rather not have to list here by hand.

Change-Id: Iaa16e3a635a11283918ce0d9e1e618591b0bf6fa

Reviewers: arsenm, rampitec, b-sumner

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, llvm-commits, t-tye

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

llvm-svn: 328939

6 years agoAMDGPU: Make getTgtMemIntrinsic table-driven for resource-based intrinsics
Nicolai Haehnle [Sun, 1 Apr 2018 17:09:07 +0000 (17:09 +0000)]
AMDGPU: Make getTgtMemIntrinsic table-driven for resource-based intrinsics

Summary:
Avoids having to list all intrinsics manually.

This is in preparation for the new dimension-aware image intrinsics,
which I'd rather not have to list here by hand.

Change-Id: If7ced04998397ef68c4cb8f7de66b5050fb767e5

Reviewers: arsenm, rampitec, b-sumner

Subscribers: kzhuravl, wdng, mgorny, yaxunl, dstuttard, tpr, llvm-commits, t-tye

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

llvm-svn: 328938

6 years agoTableGen: Support Intrinsic values in SearchableTable
Nicolai Haehnle [Sun, 1 Apr 2018 17:08:58 +0000 (17:08 +0000)]
TableGen: Support Intrinsic values in SearchableTable

Summary:
We will use this in the AMDGPU backend in a subsequent patch
in the stack to lookup target-specific per-intrinsic information.

The generic CodeGenIntrinsic machinery is used to ensure that,
even though we don't calculate actual enum values here, we do
get the intrinsics in the right order for the binary search
index.

Change-Id: If61cd5587963a4c5a1cc53df1e59c5e4dec1f9dc

Reviewers: arsenm, rampitec, b-sumner

Subscribers: wdng, tpr, llvm-commits

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

llvm-svn: 328937