platform/upstream/llvm.git
6 years agoUsersManual.rst: update text for /GX- to match r328708
Hans Wennborg [Tue, 3 Apr 2018 09:28:21 +0000 (09:28 +0000)]
UsersManual.rst: update text for /GX- to match r328708

llvm-svn: 329052

6 years ago[SCEV] Fix PR36974.
Serguei Katkov [Tue, 3 Apr 2018 07:29:00 +0000 (07:29 +0000)]
[SCEV] Fix PR36974.

The patch changes the usage of dominate to properlyDominate
to satisfy the condition !(a < a) while using std::max.

It is actually NFC due to set data structure is used to keep
the Loops and no two identical loops can be in collection.
So in reality there is no difference between usage of
dominate and properlyDominate in this particular case.
However it might be changed so it is better to fix it.

llvm-svn: 329051

6 years agoAdd a wrapper around llvm-objdump to look for indirect calls/jmps in x86 assembly.
Eric Christopher [Tue, 3 Apr 2018 07:01:33 +0000 (07:01 +0000)]
Add a wrapper around llvm-objdump to look for indirect calls/jmps in x86 assembly.

Useful when looking for indirect calls/jmps the need mitigation
via retpoline or other mitigations for Spectre v2.

Feedback, extension, additional patches welcome.

llvm-svn: 329050

6 years ago[X86] Reduce number of OpPrefix bits in TSFlags to 2. NFCI
Craig Topper [Tue, 3 Apr 2018 06:37:04 +0000 (06:37 +0000)]
[X86] Reduce number of OpPrefix bits in TSFlags to 2. NFCI

TSFlag doesn't need to disambiguate NoPrfx from PS. So shift the encodings so PS is NoPrfx|0x4.

llvm-svn: 329049

6 years ago[X86][TableGen] Add a missing error check to make sure EVEX instructions use one...
Craig Topper [Tue, 3 Apr 2018 06:37:01 +0000 (06:37 +0000)]
[X86][TableGen] Add a missing error check to make sure EVEX instructions use one PS/PD/XS/XD prefixes.

llvm-svn: 329048

6 years ago[SCEV] Make computeExitLimit more simple and more powerful
Max Kazantsev [Tue, 3 Apr 2018 05:57:19 +0000 (05:57 +0000)]
[SCEV] Make computeExitLimit more simple and more powerful

Current implementation of `computeExitLimit` has a big piece of code
the only purpose of which is to prove that after the execution of this
block the latch will be executed. What it currently checks is actually a
subset of situations where the exiting block dominates latch.

This patch replaces all these checks for simple particular cases with
domination check over loop's latch which is the only necessary condition
of taking the exiting block into consideration. This change allows to
calculate exact loop taken count for simple loops like

  for (int i = 0; i < 100; i++) {
    if (cond) {...} else {...}
    if (i > 50) break;
    . . .
  }

Differential Revision: https://reviews.llvm.org/D44677
Reviewed By: efriedma

llvm-svn: 329047

6 years ago[SLP] Fix issues with debug output in the SLP vectorizer.
Chandler Carruth [Tue, 3 Apr 2018 05:27:28 +0000 (05:27 +0000)]
[SLP] Fix issues with debug output in the SLP vectorizer.

The primary issue here is that using NDEBUG alone isn't enough to guard
debug printing -- instead the DEBUG() macro needs to be used so that the
specific pass debug logging check is employed. Without this, every
asserts-enabled build was printing out information when it hit this.

I also fixed another place where we had multiple statements in a DEBUG
macro to use {}s to be a bit cleaner. And I fixed a place that used
`errs()` rather than `dbgs()`.

llvm-svn: 329046

6 years ago[TableGen] Use llvm::cast instead of static_cast so that the cast will be checked...
Craig Topper [Tue, 3 Apr 2018 05:10:12 +0000 (05:10 +0000)]
[TableGen] Use llvm::cast instead of static_cast so that the cast will be checked. NFC

llvm-svn: 329045

6 years agoUse OffsetMap in getSectionPiece.
Rafael Espindola [Tue, 3 Apr 2018 04:06:14 +0000 (04:06 +0000)]
Use OffsetMap in getSectionPiece.

OffsetMap maps to a SectionPiece index, but we were not taking
advantage of that in getSectionPiece.

With this patch both getOffset and getSectionPiece use OffsetMap and
the binary search is moved to findSectionPiece.

llvm-svn: 329044

6 years agobpf: fix incorrect SELECT_CC lowering
Yonghong Song [Tue, 3 Apr 2018 03:56:37 +0000 (03:56 +0000)]
bpf: fix incorrect SELECT_CC lowering

Commit 37962a331c77 ("bpf: Improve expanding logic in LowerSELECT_CC")
intended to improve code quality for certain jmp conditions. The
commit, however, has a couple of issues:
  (1). In code, just swap is not enough, ConditionalCode CC
       should also be swapped, otherwise incorrect code will
       be generated.
  (2). The ConditionalCode swap should be subject to
       getHasJmpExt(). If getHasJmpExt() is False, certain
       conditional codes will not be supported and swap
       may generate incorrect code.

The original goal for this patch is to optimize jmp operations
which does not have JmpExt turned on. If JmpExt is on,
better code could be generated. For example, the test
select_ri.ll is introduced to demonstrate the optimization.
The same result can be achieved with -mcpu=v2 flag.

Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
llvm-svn: 329043

6 years agopeel loops with runtime small trip counts
Ikhlas Ajbar [Tue, 3 Apr 2018 03:39:43 +0000 (03:39 +0000)]
peel loops with runtime small trip counts

For Hexagon, peeling loops with small runtime trip count is beneficial for our
benchmarks. We set PeelCount in HexagonTargetInfo.cpp and we use PeelCount set
by the target for computing the desired peel count.

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

llvm-svn: 329042

6 years agoRemove utils/makellvm; it doesn't look like it works with cmake builds.
Nico Weber [Tue, 3 Apr 2018 02:37:49 +0000 (02:37 +0000)]
Remove utils/makellvm; it doesn't look like it works with cmake builds.

llvm-svn: 329041

6 years ago[x86] Tidy up test case, generate check lines with script. NFC.
Chandler Carruth [Tue, 3 Apr 2018 02:19:05 +0000 (02:19 +0000)]
[x86] Tidy up test case, generate check lines with script. NFC.

Just adds basic block labels and tidies up where comments go in the test
case and then generates fresh CHECK lines with the script. This way, the
check lines are much easier to maintain. They were already close to this
but not quite there.

llvm-svn: 329040

6 years agoMerge LazyArchive::fetch() and ArchiveFile::getMember(). NFC.
Rui Ueyama [Tue, 3 Apr 2018 02:06:57 +0000 (02:06 +0000)]
Merge LazyArchive::fetch() and ArchiveFile::getMember(). NFC.

They are to pull out an object file for a symbol, but for a historical
reason the code is written in two separate functions. This patch
merges them.

llvm-svn: 329039

6 years agoFix fs::proximate tests on platforms where /net exists.
Eric Fiselier [Tue, 3 Apr 2018 01:52:12 +0000 (01:52 +0000)]
Fix fs::proximate tests on platforms where /net exists.

The proximate tests depended on `/net` not being a valid path,
however, on OS X it is.

Correct the tests to handle this.

llvm-svn: 329038

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