platform/upstream/llvm.git
7 years ago[asan] Add openlog() on Android.
Evgeniy Stepanov [Wed, 7 Sep 2016 22:56:02 +0000 (22:56 +0000)]
[asan] Add openlog() on Android.

Normally, syslog() uses argv[0] for the log tag; bionic, however,
would crash in syslog() before libc constructor unless the log
tag is explicitly set with openlog().

llvm-svn: 280875

7 years agoclang-format: [JavaScript] Do requoting in a separate pass
Daniel Jasper [Wed, 7 Sep 2016 22:48:53 +0000 (22:48 +0000)]
clang-format: [JavaScript] Do requoting in a separate pass

The attempt to fix requoting behavior in r280487 after changes to
tooling::Replacements are incomplete. We essentially need to add to
replacements at the same position, one to insert a line break and one to
change the quoting and that's incompatible with the new
tooling::Replacement API, which does not allow for order-dependent
Replacements. To make the order clear, Replacements::merge() has to be
used, but that requires the merged Replacement to actually refer to the
changed text, which is hard to reproduce for the requoting.

This change fixes the behavior by moving the requoting to a completely
separate pass. The added benefit is that no weird ColumnWidth
calculations are necessary anymore and this should just work even if we
implement string literal splitting in the future.

llvm-svn: 280874

7 years ago[InstCombine] use m_APInt to allow icmp (and (sh X, Y), C2), C1 folds for splat const...
Sanjay Patel [Wed, 7 Sep 2016 22:33:03 +0000 (22:33 +0000)]
[InstCombine] use m_APInt to allow icmp (and (sh X, Y), C2), C1 folds for splat constant vectors

llvm-svn: 280873

7 years ago[SE] Add getName method to Device class
Jason Henline [Wed, 7 Sep 2016 22:26:20 +0000 (22:26 +0000)]
[SE] Add getName method to Device class

Reviewers: jhen

Subscribers: parallel_libs-commits

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

llvm-svn: 280872

7 years agoAvoid ambiguity in calling atom_add functions.
Jan Vesely [Wed, 7 Sep 2016 22:11:02 +0000 (22:11 +0000)]
Avoid ambiguity in calling atom_add functions.

clang (since r280553) allows pointer casts in function overloads,
so we need to disambiguate the second argument.

clang might be smarter about overloads in the future
see https://reviews.llvm.org/D24113, but let's be safe in libclc anyway.

llvm-svn: 280871

7 years agoFix some Clang-tidy modernize-use-using and Include What You Use warnings; other...
Eugene Zelenko [Wed, 7 Sep 2016 21:53:17 +0000 (21:53 +0000)]
Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes.

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

llvm-svn: 280870

7 years ago[CUDA] Rework "optimizations" and "publication" section in CompileCudaWithLLVM.rst.
Justin Lebar [Wed, 7 Sep 2016 21:46:53 +0000 (21:46 +0000)]
[CUDA] Rework "optimizations" and "publication" section in CompileCudaWithLLVM.rst.

llvm-svn: 280869

7 years ago[CUDA] Clarify that -l and -L only need to be passed when linking, in CompileCudaWith...
Justin Lebar [Wed, 7 Sep 2016 21:46:49 +0000 (21:46 +0000)]
[CUDA] Clarify that -l and -L only need to be passed when linking, in CompileCudaWithLLVM.rst.

llvm-svn: 280868

7 years ago[CUDA] Further reformat "invoking clang" section of CompileCudaWithLLVM.rst.
Justin Lebar [Wed, 7 Sep 2016 21:46:21 +0000 (21:46 +0000)]
[CUDA] Further reformat "invoking clang" section of CompileCudaWithLLVM.rst.

llvm-svn: 280867

7 years ago[SimplifyCFG] Don't try to create metadata-valued PHIs
Hal Finkel [Wed, 7 Sep 2016 21:38:22 +0000 (21:38 +0000)]
[SimplifyCFG] Don't try to create metadata-valued PHIs

We can't create metadata-valued PHIs; don't try to do so when sinking.

I created a test case for this using the @llvm.type.test intrinsic, because it
takes a metadata parameter and does not have severe side effects (thus
SimplifyCFG is willing to otherwise sink it).

Previously, running the test case would crash with:

  Invalid use of metadata!
    %.sink = select i1 %flag, metadata <...>, metadata <0x4e45dc0>
  LLVM ERROR: Broken function found, compilation aborted!

llvm-svn: 280866

7 years ago[LoopUnroll] Correct a debug message. NFC.
Haicheng Wu [Wed, 7 Sep 2016 21:30:16 +0000 (21:30 +0000)]
[LoopUnroll] Correct a debug message. NFC.

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

llvm-svn: 280865

7 years agoELF: Add -Qy as ignored option
Ed Maste [Wed, 7 Sep 2016 21:10:25 +0000 (21:10 +0000)]
ELF: Add -Qy as ignored option

GCC passes it by default on powerpc64 on FreeBSD. GNU ld claims "this
option is ignored for SVR4 compatibility", so we can ignore it too.

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

llvm-svn: 280864

7 years ago[compiler-rt] Allow sanitizers to be compiled for windows with clang
Francis Ricci [Wed, 7 Sep 2016 21:03:22 +0000 (21:03 +0000)]
[compiler-rt] Allow sanitizers to be compiled for windows with clang

Summary:
A few small changes required to permit building the sanitizers
with Clang instead of only with MSVC.

Reviewers: compnerd, beanz, rnk

Subscribers: beanz, timurrrr, kubabrecka, dberris, llvm-commits

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

llvm-svn: 280863

7 years agoShift-left (ISD::SHL) operation crashes on "DAG Legalization" phase.
Elena Demikhovsky [Wed, 7 Sep 2016 20:54:33 +0000 (20:54 +0000)]
Shift-left (ISD::SHL) operation crashes on "DAG Legalization" phase.
https://llvm.org/bugs/show_bug.cgi?id=29058.

While node legalization we tried to legalize its operands.
If an operand node is replaced during legalization the user node may be destroyed.

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

llvm-svn: 280862

7 years ago[InstCombine] allow icmp (and X, C2), C1 folds for splat constant vectors
Sanjay Patel [Wed, 7 Sep 2016 20:50:44 +0000 (20:50 +0000)]
[InstCombine] allow icmp (and X, C2), C1 folds for splat constant vectors

This is a revert of r280676 which was a revert of r280637;
ie, this is r280637 again. It was speculatively reverted to
help debug buildbot failures.

llvm-svn: 280861

7 years agoFix inconsistent indentation.
Rui Ueyama [Wed, 7 Sep 2016 20:50:41 +0000 (20:50 +0000)]
Fix inconsistent indentation.

llvm-svn: 280860

7 years ago[CUDA] Fix typo in link in CompileCudaWithLLVM.
Justin Lebar [Wed, 7 Sep 2016 20:42:24 +0000 (20:42 +0000)]
[CUDA] Fix typo in link in CompileCudaWithLLVM.

llvm-svn: 280859

7 years agoMove field to the base class. NFC.
Rafael Espindola [Wed, 7 Sep 2016 20:41:19 +0000 (20:41 +0000)]
Move field to the base class. NFC.

llvm-svn: 280858

7 years ago[CUDA] Move AXPY example into gist.
Justin Lebar [Wed, 7 Sep 2016 20:37:41 +0000 (20:37 +0000)]
[CUDA] Move AXPY example into gist.

No need to have a long inline code snippet in this doc.

Also move "flags that control numerical code" underneath the "invoking
clang" section, and reformat things a bit.

llvm-svn: 280857

7 years agoDelete dead field. NFC.
Rafael Espindola [Wed, 7 Sep 2016 20:37:34 +0000 (20:37 +0000)]
Delete dead field. NFC.

llvm-svn: 280856

7 years ago[RDF] Fix liveness analysis for phi nodes with shadow uses
Krzysztof Parzyszek [Wed, 7 Sep 2016 20:37:05 +0000 (20:37 +0000)]
[RDF] Fix liveness analysis for phi nodes with shadow uses

Shadow uses need to be analyzed together, since each individual shadow
will only have a partial reaching def. All shadows together may cover
a given register ref, while each individual shadow may not.

llvm-svn: 280855

7 years ago[compiler-rt] Fix library suffixes on windows
Francis Ricci [Wed, 7 Sep 2016 20:32:48 +0000 (20:32 +0000)]
[compiler-rt] Fix library suffixes on windows

Summary:
Make sure that windows libraries contain the suffixes expected by clang.
This is expecially important when compiling the windows builtins with
clang, as cmake will use .a as the suffix by default.

Reviewers: beanz, compnerd

Subscribers: llvm-commits, dberris

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

llvm-svn: 280854

7 years agoDon't reuse a variable name in a nested scope. NFC.
Michael Kuperstein [Wed, 7 Sep 2016 20:29:49 +0000 (20:29 +0000)]
Don't reuse a variable name in a nested scope. NFC.

llvm-svn: 280853

7 years agoMove CHECK right before the function it describes.
George Burgess IV [Wed, 7 Sep 2016 20:15:03 +0000 (20:15 +0000)]
Move CHECK right before the function it describes.

llvm-svn: 280852

7 years ago[RDF] Introduce "undef" flag for ref nodes
Krzysztof Parzyszek [Wed, 7 Sep 2016 20:10:56 +0000 (20:10 +0000)]
[RDF] Introduce "undef" flag for ref nodes

llvm-svn: 280851

7 years ago[CUDA] Simplify build/install instructions in CompileCudaWithLLVM.rst.
Justin Lebar [Wed, 7 Sep 2016 20:09:53 +0000 (20:09 +0000)]
[CUDA] Simplify build/install instructions in CompileCudaWithLLVM.rst.

llvm-svn: 280850

7 years ago[CUDA] Call it "CUDA", not "CUDA C/C++" in our docs.
Justin Lebar [Wed, 7 Sep 2016 20:09:50 +0000 (20:09 +0000)]
[CUDA] Call it "CUDA", not "CUDA C/C++" in our docs.

CUDA is an extension to C++ -- there is no such thing as "CUDA C".  But
also, the language is much more commonly called "CUDA" than "CUDA C++".

llvm-svn: 280849

7 years ago[CUDA] Expand upon --cuda-gpu-arch flag in CompileCudaWithLLVM doc.
Justin Lebar [Wed, 7 Sep 2016 20:09:46 +0000 (20:09 +0000)]
[CUDA] Expand upon --cuda-gpu-arch flag in CompileCudaWithLLVM doc.

llvm-svn: 280848

7 years ago[Sema] Compare bad conversions in overload resolution.
George Burgess IV [Wed, 7 Sep 2016 20:03:19 +0000 (20:03 +0000)]
[Sema] Compare bad conversions in overload resolution.

r280553 introduced an issue where we'd emit ambiguity errors for code
like:

```
void foo(int *, int);
void foo(unsigned int *, unsigned int);

void callFoo() {
  unsigned int i;
  foo(&i, 0); // ambiguous: int->unsigned int is worse than int->int,
              // but unsigned int*->unsigned int* is better than
              // int*->int*.
}
```

This patch fixes this issue by changing how we handle ill-formed (but
valid) implicit conversions. Candidates with said conversions now always
rank worse than candidates without them, and two candidates are
considered to be equally bad if they both have these conversions for
the same argument.

Additionally, this fixes a case in C++11 where we'd complain about an
ambiguity in a case like:

```
void f(char *, int);
void f(const char *, unsigned);
void g() { f("abc", 0); }
```

...Since conversion to char* from a string literal is considered
ill-formed in C++11 (and deprecated in C++03), but we accept it as an
extension.

llvm-svn: 280847

7 years ago[powerpc] Move #if to appease warnings-as-errors tests
Bill Seurer [Wed, 7 Sep 2016 19:44:04 +0000 (19:44 +0000)]
[powerpc] Move #if to appease warnings-as-errors tests

Previous patch added a #if which caused a variable and function
to be unused.

llvm-svn: 280846

7 years agoAdd a few more test for []-style uuid attributes.
Nico Weber [Wed, 7 Sep 2016 19:41:35 +0000 (19:41 +0000)]
Add a few more test for []-style uuid attributes.

- Should diag on a function (clang-cl warns; it's an error in cl)
- Test the attribute on nested classes (clang-cl is more permissive and more
  self-consistent than cl here)

llvm-svn: 280845

7 years agoFix a few oversights in the clang-tidy VS plugin.
Zachary Turner [Wed, 7 Sep 2016 19:41:19 +0000 (19:41 +0000)]
Fix a few oversights in the clang-tidy VS plugin.

Over-zealous cleanup of using statements removed some that were
actually needed.  Also cleaned up a few warnings.

llvm-svn: 280844

7 years agoRename test pr30298.ll to shrink_vmul_sse.ll, to make the name more meaningful, NFC.
Wei Mi [Wed, 7 Sep 2016 18:46:15 +0000 (18:46 +0000)]
Rename test pr30298.ll to shrink_vmul_sse.ll, to make the name more meaningful, NFC.

Add PR number and comment in pr30298.ll to explain what is testing.

llvm-svn: 280843

7 years agoDo not validate pch when -fno-validate-pch is set
Yaxun Liu [Wed, 7 Sep 2016 18:40:20 +0000 (18:40 +0000)]
Do not validate pch when -fno-validate-pch is set

There is a bug causing pch to be validated even though -fno-validate-pch is set. This patch fixes it.

ASTReader relies on ASTReaderListener to initialize SuggestedPredefines, which is required for compilations using PCH. Before this change, PCHValidator is the default ASTReaderListener. After this change, when -fno-validate-pch is set, PCHValidator is disabled, but we need a replacement ASTReaderListener to initialize SuggestedPredefines. Class SimpleASTReaderListener is implemented for this purpose.

This change only affects -fno-validate-pch. There is no functional change if -fno-validate-pch is not set.

If -fno-validate-pch is not set, conflicts in predefined macros between pch and current compiler instance causes error.

If -fno-validate-pch is set, predefine macros in current compiler override those in pch so that compilation can continue.

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

llvm-svn: 280842

7 years agoAMDGPU: Remove a useless variable which caused build failure for lld.
Yaxun Liu [Wed, 7 Sep 2016 18:31:11 +0000 (18:31 +0000)]
AMDGPU: Remove a useless variable which caused build failure for lld.

llvm-svn: 280841

7 years agoAdd a clang-tidy visual studio extension.
Zachary Turner [Wed, 7 Sep 2016 18:28:55 +0000 (18:28 +0000)]
Add a clang-tidy visual studio extension.

For now this only adds the UI necessary to configure clang-tidy
settings graphically, and it enables reading in and saving out
of .clang-tidy files.  It does not actually run clang-tidy on
any source files yet.

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

llvm-svn: 280840

7 years agoResubmit "Add a test for clang-tidy using the clang-cl driver."
Zachary Turner [Wed, 7 Sep 2016 18:28:42 +0000 (18:28 +0000)]
Resubmit "Add a test for clang-tidy using the clang-cl driver."

This was originally reverted because the patch on the clang
tooling side was reverted.  That patch is being resubmitted,
so this patch is resubmitted as well.

llvm-svn: 280839

7 years agoTry contextually converting condition of constexpr if to Boolean value
Ismail Pazarbasi [Wed, 7 Sep 2016 18:24:54 +0000 (18:24 +0000)]
Try contextually converting condition of constexpr if to Boolean value

Summary:
C++1z 6.4.1/p2:
 If the if statement is of the form if constexpr, the value of the
 condition shall be a contextually converted constant expression of type
 bool [...]
C++1z 5.20/p4:
 [...] A contextually converted constant expression of type bool is an
 expression, contextually converted to bool (Clause4), where the
 converted expression is a constant expression and the conversion
 sequence contains only the conversions above. [...]

Contextually converting result of an expression `e` to a Boolean value
requires `bool t(e)` to be well-formed.

An explicit conversion function is only considered as a user-defined
conversion for direct-initialization, which is essentially what
//contextually converted to bool// requires.

Also, fixes PR28470.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 280838

7 years agoDon't reduce the width of vector mul if the target doesn't support SSE2.
Wei Mi [Wed, 7 Sep 2016 18:22:17 +0000 (18:22 +0000)]
Don't reduce the width of vector mul if the target doesn't support SSE2.

The patch is to fix PR30298, which is caused by rL272694. The solution is to
bail out if the target has no SSE2.

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

llvm-svn: 280837

7 years ago[MS] Fix prologue this adjustment when 'this' is passed indirectly
Reid Kleckner [Wed, 7 Sep 2016 18:21:30 +0000 (18:21 +0000)]
[MS] Fix prologue this adjustment when 'this' is passed indirectly

Move the logic for doing this from the ABI argument lowering into
EmitParmDecl, which runs for all parameters. Our codegen is slightly
suboptimal in this case, as we may leave behind a dead store after
optimization, but it's 32-bit inalloca, and this fixes the bug in a
robust way.

Fixes PR30293

llvm-svn: 280836

7 years agoAdd more triple to conditional-tailcall.ll test
Hans Wennborg [Wed, 7 Sep 2016 18:19:31 +0000 (18:19 +0000)]
Add more triple to conditional-tailcall.ll test

llvm-svn: 280835

7 years agoTypo. NFC.
Chad Rosier [Wed, 7 Sep 2016 18:15:12 +0000 (18:15 +0000)]
Typo. NFC.

llvm-svn: 280834

7 years agoCodeGen: ensure that libcalls are always AAPCS CC
Saleem Abdulrasool [Wed, 7 Sep 2016 17:56:09 +0000 (17:56 +0000)]
CodeGen: ensure that libcalls are always AAPCS CC

The original commit was too aggressive about marking LibCalls as AAPCS.  The
libcalls contain libc/libm/libunwind calls which are not AAPCS, but C.

llvm-svn: 280833

7 years agoX86: Fold tail calls into conditional branches where possible (PR26302)
Hans Wennborg [Wed, 7 Sep 2016 17:52:14 +0000 (17:52 +0000)]
X86: Fold tail calls into conditional branches where possible (PR26302)

When branching to a block that immediately tail calls, it is possible to fold
the call directly into the branch if the call is direct and there is no stack
adjustment, saving one byte.

Example:

  define void @f(i32 %x, i32 %y) {
  entry:
    %p = icmp eq i32 %x, %y
    br i1 %p, label %bb1, label %bb2
  bb1:
    tail call void @foo()
    ret void
  bb2:
    tail call void @bar()
    ret void
  }

before:

  f:
          movl    4(%esp), %eax
          cmpl    8(%esp), %eax
          jne     .LBB0_2
          jmp     foo
  .LBB0_2:
          jmp     bar

after:

  f:
          movl    4(%esp), %eax
          cmpl    8(%esp), %eax
          jne     bar
  .LBB0_1:
          jmp     foo

I don't expect any significant size savings from this (on a Clang bootstrap I
saw 288 bytes), but it does make the code a little tighter.

This patch only does 32-bit, but 64-bit would work similarly.

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

llvm-svn: 280832

7 years agoELF: add version script void function test case
Ed Maste [Wed, 7 Sep 2016 17:51:00 +0000 (17:51 +0000)]
ELF: add version script void function test case

After r280733 we use LLVM's demangler in lld. As a result we no longer
have a discrepancy between f() and f(void) on FreeBSD (due to an issue
with FreeBSD's system demangler).

Restore a test case for a void arg function.

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

llvm-svn: 280831

7 years ago[lib/LTO] Add a way to run a custom pipeline
Davide Italiano [Wed, 7 Sep 2016 17:46:16 +0000 (17:46 +0000)]
[lib/LTO] Add a way to run a custom pipeline

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

llvm-svn: 280830

7 years agoAMDGPU: Add hidden kernel arguments to runtime metadata
Yaxun Liu [Wed, 7 Sep 2016 17:44:00 +0000 (17:44 +0000)]
AMDGPU: Add hidden kernel arguments to runtime metadata

OpenCL kernels have hidden kernel arguments for global offset and printf buffer. For consistency, these hidden argument should be included in the runtime metadata. Also updated kernel argument kind metadata.

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

llvm-svn: 280829

7 years ago[clang-offload-bundler] Fix some Clang-tidy modernize-use-override and Include What...
Eugene Zelenko [Wed, 7 Sep 2016 17:37:28 +0000 (17:37 +0000)]
[clang-offload-bundler] Fix some Clang-tidy modernize-use-override and Include What You Use warnings; other minor fixes.

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

llvm-svn: 280828

7 years agoAdd missing include. White space.
Vassil Vassilev [Wed, 7 Sep 2016 17:30:50 +0000 (17:30 +0000)]
Add missing  include. White space.

llvm-svn: 280827

7 years agoAdd MS __nop intrinsic to intrin.h
Reid Kleckner [Wed, 7 Sep 2016 16:55:12 +0000 (16:55 +0000)]
Add MS __nop intrinsic to intrin.h

Summary: There was no definition for __nop function - added inline
assembly.

Patch by Albert Gutowski!

Reviewers: rnk, thakis

Subscribers: cfe-commits

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

llvm-svn: 280826

7 years agoParsing MS pragma intrinsic
Reid Kleckner [Wed, 7 Sep 2016 16:38:32 +0000 (16:38 +0000)]
Parsing MS pragma intrinsic

Parse pragma intrinsic, display warning if the function isn't a builtin
function in clang and suggest including intrin.h.

Patch by Albert Gutowski!

Reviewers: aaron.ballman, rnk

Subscribers: aaron.ballman, cfe-commits

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

llvm-svn: 280825

7 years ago[include-fixer] Support finding headers for the symbol under cursor.
Haojian Wu [Wed, 7 Sep 2016 16:34:35 +0000 (16:34 +0000)]
[include-fixer] Support finding headers for the symbol under cursor.

Summary:
* Add a `query-symbol` option to query symbol without parsing the source file.
* Update Vim & Emacs integration scripts.

Reviewers: bkramer, massberg

Subscribers: cfe-commits

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

llvm-svn: 280824

7 years ago[powerpc] Disable ManyThreadsWithStatsStressTest test for ppc64
Bill Seurer [Wed, 7 Sep 2016 16:30:31 +0000 (16:30 +0000)]
[powerpc] Disable ManyThreadsWithStatsStressTest test for ppc64

Since r279664 this test causes frequent failures of test runs for ppc64le and
occasional failures for ppc64be which makes buildbot results unreliable.  If
the underlying problem is fixed it can be re-enabled.

llvm-svn: 280823

7 years ago[codeview] Add new directives to record inlined call site line info
Reid Kleckner [Wed, 7 Sep 2016 16:15:31 +0000 (16:15 +0000)]
[codeview] Add new directives to record inlined call site line info

Summary:
Previously we were trying to represent this with the "contains" list of
the .cv_inline_linetable directive, which was not enough information.
Now we directly represent the chain of inlined call sites, so we know
what location to emit when we encounter a .cv_loc directive of an inner
inlined call site while emitting the line table of an outer function or
inlined call site. Fixes PR29146.

Also fixes PR29147, where we would crash when .cv_loc directives crossed
sections. Now we write down the section of the first .cv_loc directive,
and emit an error if any other .cv_loc directive for that function is in
a different section.

Also fixes issues with discontiguous inlined source locations, like in
this example:

  volatile int unlikely_cond = 0;
  extern void __declspec(noreturn) abort();
  __forceinline void f() {
    if (!unlikely_cond) abort();
  }
  int main() {
    unlikely_cond = 0;
    f();
    unlikely_cond = 0;
  }

Previously our tables gave bad location information for the 'abort'
call, and the debugger wouldn't snow the inlined stack frame for 'f'.
It is important to emit good line tables for this code pattern, because
it comes up whenever an asan bug occurs in an inlined function. The
__asan_report* stubs are generally placed after the normal function
epilogue, leading to discontiguous regions of inlined code.

Reviewers: majnemer, amccarth

Subscribers: llvm-commits

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

llvm-svn: 280822

7 years agoUse llvm's demangler.
Rafael Espindola [Wed, 7 Sep 2016 16:14:00 +0000 (16:14 +0000)]
Use llvm's demangler.

LLVM now has a copy of libcxxabi demangler, so lldb doesn't need to
keep one too.

llvm-svn: 280821

7 years ago[LoopInterchange] Improve debug output. NFC.
Chad Rosier [Wed, 7 Sep 2016 16:07:17 +0000 (16:07 +0000)]
[LoopInterchange] Improve debug output. NFC.

llvm-svn: 280820

7 years ago[LoopInterchange] Improve debug output. NFC.
Chad Rosier [Wed, 7 Sep 2016 15:56:59 +0000 (15:56 +0000)]
[LoopInterchange] Improve debug output. NFC.

llvm-svn: 280819

7 years ago[LSV] Use the original loads' names for the extractelement instructions.
Justin Lebar [Wed, 7 Sep 2016 15:49:48 +0000 (15:49 +0000)]
[LSV] Use the original loads' names for the extractelement instructions.

Summary:
LSV replaces multiple adjacent loads with one vectorized load and a
bunch of extractelement instructions.  This patch makes the
extractelement instructions' names match those of the original loads,
for (hopefully) improved readability.

Reviewers: asbirlea, tstellarAMD

Subscribers: arsenm, mzolotukhin

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

llvm-svn: 280818

7 years ago[x86] move combines of 'select of 2 constants' to its own function; NFC
Sanjay Patel [Wed, 7 Sep 2016 15:47:34 +0000 (15:47 +0000)]
[x86] move combines of 'select of 2 constants' to its own function; NFC

There are missing folds here and possibly folds that could be made generic.

llvm-svn: 280817

7 years agoFix typo in test - it should be masking bits0-15 not bit16
Simon Pilgrim [Wed, 7 Sep 2016 15:19:07 +0000 (15:19 +0000)]
Fix typo in test - it should be masking bits0-15 not bit16

llvm-svn: 280816

7 years ago[MS] Fix 'this' type when calling virtual methods with inalloca
Reid Kleckner [Wed, 7 Sep 2016 15:15:51 +0000 (15:15 +0000)]
[MS] Fix 'this' type when calling virtual methods with inalloca

If the virtual method comes from a secondary vtable, then the type of
the 'this' parameter should be i8*, and not a pointer to the complete
class. In the MS ABI, the 'this' parameter on entry points to the vptr
containing the virtual method that was called, so we use i8* instead of
the normal type. We had a mismatch where the CGFunctionInfo of the call
didn't match the CGFunctionInfo of the declaration, and this resulted in
some assertions, but now both sides agree the type of 'this' is i8*.

Fixes one issue raised in PR30293

llvm-svn: 280815

7 years agoRegenerate vector bitcast folding tests using update_test_checks.py.
Andrea Di Biagio [Wed, 7 Sep 2016 14:50:07 +0000 (14:50 +0000)]
Regenerate vector bitcast folding tests using update_test_checks.py.

Two tests have been merged together, regenerated and then moved to
a more appropriate directory. No functional change.

llvm-svn: 280814

7 years ago[X86][SSE] Added or combine tests for known bits of vectors
Simon Pilgrim [Wed, 7 Sep 2016 14:49:50 +0000 (14:49 +0000)]
[X86][SSE] Added or combine tests for known bits of vectors

Part of the yak shaving for D24253

llvm-svn: 280813

7 years ago[asan] Reify ErrorNewDeleteSizeMismatch
Filipe Cabecinhas [Wed, 7 Sep 2016 14:20:54 +0000 (14:20 +0000)]
[asan] Reify ErrorNewDeleteSizeMismatch

Summary: Keep reifying other errors.

Reviewers: kcc, samsonov

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 280812

7 years agoDisable MSVC warnings on ISL.
Michael Kruse [Wed, 7 Sep 2016 14:11:20 +0000 (14:11 +0000)]
Disable MSVC warnings on ISL.

Disable some Visual C++ warnings on ISL. These are not reported by GCC/Clang in
the ISL build system. We do not intend to fix them in the Polly in-tree copy,
hence disable these warnings.

llvm-svn: 280811

7 years ago[X86][SSE] Added and+or+zext combine tests for known bits of vectors
Simon Pilgrim [Wed, 7 Sep 2016 14:00:52 +0000 (14:00 +0000)]
[X86][SSE] Added and+or+zext combine tests for known bits of vectors

Part of the yak shaving for D24253

llvm-svn: 280810

7 years ago[X86][SSE] Added and+or combine tests currently failing with vectors
Simon Pilgrim [Wed, 7 Sep 2016 13:40:03 +0000 (13:40 +0000)]
[X86][SSE] Added and+or combine tests currently failing with vectors

(and (or x, C), D) -> D if (C & D) == D

Part of the yak shaving for D24253

llvm-svn: 280809

7 years ago[ARM] Lower UDIV+UREM to UDIV+MLS (and the same for SREM)
Pablo Barrio [Wed, 7 Sep 2016 12:49:15 +0000 (12:49 +0000)]
[ARM] Lower UDIV+UREM to UDIV+MLS (and the same for SREM)

Summary:
This saves a library call to __aeabi_uidivmod. However, the
processor must feature hardware division in order to benefit from
the transformation.

Reviewers: scott-0, jmolloy, compnerd, rengolin

Subscribers: t.p.northover, compnerd, aemerson, rengolin, samparker, llvm-commits

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

llvm-svn: 280808

7 years ago[InstCombine][SSE4a] Fix assertion failure in the insertq/insertqi combining logic.
Andrea Di Biagio [Wed, 7 Sep 2016 12:47:53 +0000 (12:47 +0000)]
[InstCombine][SSE4a] Fix assertion failure in the insertq/insertqi combining logic.

This fixes a similar issue to the one already fixed by r280804
(revieved in D24256). Revision 280804 fixed the problem with unsafe dyn_casts
in the extrq/extrqi combining logic. However, it turns out that even the
insertq/insertqi logic was affected by the same problem.

llvm-svn: 280807

7 years ago[EfficiencySanitizer] [MIPS64] Enables esan clang driver options for MIPS64
Sagar Thakur [Wed, 7 Sep 2016 12:23:15 +0000 (12:23 +0000)]
[EfficiencySanitizer] [MIPS64] Enables esan clang driver options for MIPS64

Reviewed by bruening
Differential: D23800

llvm-svn: 280806

7 years agoEnable test on windows.
Rafael Espindola [Wed, 7 Sep 2016 12:09:10 +0000 (12:09 +0000)]
Enable test on windows.

It looks like it was disable just because we were missing a demangler.

llvm-svn: 280805

7 years ago[InstCombine][SSE4a] Fix assertion failure caused by unsafe dyn_casts on the operands...
Andrea Di Biagio [Wed, 7 Sep 2016 12:03:03 +0000 (12:03 +0000)]
[InstCombine][SSE4a] Fix assertion failure caused by unsafe dyn_casts on the operands of extrq/extrqi intrinsic calls.

This patch fixes an assertion failure caused by unsafe dynamic casts on the
constant operands of sse4a intrinsic calls to extrq/extrqi

The combine logic that simplifies sse4a extrq/extrqi intrinsic calls currently
checks if the input operands are constants. Internally, that logic relies on
dyn_casts of values returned by calls to method Constant::getAggregateElement.
However, method getAggregateElemet may return nullptr if the constant element
cannot be retrieved. So, all the dyn_casts can potentially fail. This is what
happens for example if a constexpr value is passed in input to an extrq/extrqi
intrinsic call.

This patch fixes the problem by using a dyn_cast_or_null (instead of a simple
dyn_cast) on the result of each call to Constant::getAggregateElement.

Added reproducible test cases to x86-sse4a.ll.

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

llvm-svn: 280804

7 years ago[ELF] - Sort command line options. NFC.
George Rimar [Wed, 7 Sep 2016 11:43:18 +0000 (11:43 +0000)]
[ELF] - Sort command line options. NFC.

llvm-svn: 280803

7 years agoRevert "[EfficiencySanitizer] Adds shadow memory parameters for 40-bit virtual memory...
Renato Golin [Wed, 7 Sep 2016 10:54:42 +0000 (10:54 +0000)]
Revert "[EfficiencySanitizer] Adds shadow memory parameters for 40-bit virtual memory address."

This reverts commit r280796, as it broke the AArch64 bots for no reason.

The tests were passing and we should try to keep them passing, so a proper
review should make that happen.

llvm-svn: 280802

7 years ago[ELF] - Linkerscript: create multiple output sections for inputs with different attri...
George Rimar [Wed, 7 Sep 2016 10:46:07 +0000 (10:46 +0000)]
[ELF] - Linkerscript: create multiple output sections for inputs with different attributes.

Previously we combined sections by name if linkerscript was used.
For that we had to disable SHF_MERGE handling temporarily, but then
found that implementing it properly will require additional complexity layers like
subsections or something.
At the same time looks we can live with multiple output sections approach for now.
That patch do this change.

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

llvm-svn: 280801

7 years ago[OpenCL] Fix pipe built-in functions return type.
Alexey Bader [Wed, 7 Sep 2016 10:32:03 +0000 (10:32 +0000)]
[OpenCL] Fix pipe built-in functions return type.

By default return type of call expressions calling built-in
functions is set to bool.

Fixes https://llvm.org/bugs/show_bug.cgi?id=30219.

Reviewers: Anastasia

Subscribers: dmitry, cfe-commits, yaxunl

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

llvm-svn: 280800

7 years ago[ELF] - Fix for: PR29093 - version script does not support [chars] wildcards
George Rimar [Wed, 7 Sep 2016 10:19:44 +0000 (10:19 +0000)]
[ELF] - Fix for: PR29093 - version script does not support [chars] wildcards

GNU ld supports [chars] wildcards in version scripts, to match a single instance of any of the chars.
Here is an extern example from libstdc++'s version script in FreeBSD:

extern "C++"
{
...

std::locale::_[T-Za-z]*;
std::[A-Zm]*;
std::n[^u]*;
std::nu[^m]*;
std::num[^e]*;
...

}

Patch adds support for scripts above. This is PR29093.

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

llvm-svn: 280799

7 years ago[mips] Disable the TImode shift libcalls for 32-bit targets.
Vasileios Kalintiris [Wed, 7 Sep 2016 10:01:18 +0000 (10:01 +0000)]
[mips] Disable the TImode shift libcalls for 32-bit targets.

Summary:
The o32 ABI doesn't not support the TImode helpers. For the time being,
disable just the shift libcalls as they break recursive builds on MIPS.

Reviewers: sdardis

Subscribers: llvm-commits, sdardis

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

llvm-svn: 280798

7 years ago[ELF] - Enable testcases that uses demangler to run under windows and escape quotes...
George Rimar [Wed, 7 Sep 2016 09:59:29 +0000 (09:59 +0000)]
[ELF] - Enable testcases that uses demangler to run under windows and escape quotes around "C++".

Previously testcases were enabled only for shell.
r280733 added c++ itanium demangler to lld and we can enable them fully.

Also this change make quotes to be escaped:

extern "C++" -> extern \"C++\", which worked before just because we are dropping tokens
quotes internally at this moment.

llvm-svn: 280797

7 years ago[EfficiencySanitizer] Adds shadow memory parameters for 40-bit virtual memory address.
Sagar Thakur [Wed, 7 Sep 2016 09:45:37 +0000 (09:45 +0000)]
[EfficiencySanitizer] Adds shadow memory parameters for 40-bit virtual memory address.

Adding 40-bit shadow memory parameters because MIPS64 uses 40-bit virtual memory addresses.

Reviewed by bruening
Differential: D23801

llvm-svn: 280796

7 years ago[ESan][MIPS] Adds support for MIPS64
Sagar Thakur [Wed, 7 Sep 2016 09:09:03 +0000 (09:09 +0000)]
[ESan][MIPS] Adds support for MIPS64

With this patch 10 out of 13 tests are passing.

Following is the list of failing tests:

    struct-simple.cpp
    workingset-signal-posix.cpp
    mmap-shadow-conflict.c

Reviewed by bruening
Differential: D23799

llvm-svn: 280795

7 years ago[SimplifyCFG] Followup fix to r280790
James Molloy [Wed, 7 Sep 2016 09:01:22 +0000 (09:01 +0000)]
[SimplifyCFG] Followup fix to r280790

In failure cases it's not guaranteed that the PHI we're inspecting is actually in the successor block! In this case we need to bail out early, and never query getIncomingValueForBlock() as that will cause an assert.

llvm-svn: 280794

7 years agoFix unittest compilation on windows
Pavel Labath [Wed, 7 Sep 2016 08:46:50 +0000 (08:46 +0000)]
Fix unittest compilation on windows

After the reformat, the unittests do not compile due to missing due to redefinition errors
between PosixApi.h and ucrt/direct.h. This is a bit of a shot in the dark, as I have not tested
it on windows, but I am restoring the original include order, so it should hopefully fix it.

llvm-svn: 280793

7 years ago[SimplifyCFG] Update workaround for PR30188 to also include loads
James Molloy [Wed, 7 Sep 2016 08:40:20 +0000 (08:40 +0000)]
[SimplifyCFG] Update workaround for PR30188 to also include loads

I should have realised this the first time around, but if we're avoiding sinking stores where the operands come from allocas so they don't create selects, we also have to do the same for loads because SROA will be just as defective looking at loads of selected addresses as stores.

Fixes PR30188 (again).

llvm-svn: 280792

7 years ago[CMake] Use CMake's default RPATH for the unit tests
Diana Picus [Wed, 7 Sep 2016 08:37:15 +0000 (08:37 +0000)]
[CMake] Use CMake's default RPATH for the unit tests

In the top-level CMakeLists.txt, we set CMAKE_BUILD_WITH_INSTALL_RPATH to ON,
and then for the unit tests we set it to <test>/../../lib. This works for tests
that live in unittest/<whatever>, but not for those that live in subdirectories
e.g. unittest/Transforms/IPO or unittest/ExecutionEngine/Orc. When building
with BUILD_SHARED_LIBRARIES, such tests don't manage to find their libraries.

Since the tests are run from the build directory, it makes sense to set their
RPATH for the build tree, rather than the install tree. This is the default in
CMake since 2.6, so all we have to do is set CMAKE_BUILD_WITH_INSTALL_RPATH to
OFF for the unit tests.

llvm-svn: 280791

7 years ago[SimplifyCFG] Check PHI uses more accurately
James Molloy [Wed, 7 Sep 2016 08:15:54 +0000 (08:15 +0000)]
[SimplifyCFG] Check PHI uses more accurately

PR30292 showed a case where our PHI checking wasn't correct. We were checking that all values were used by the same PHI before deciding to sink, but we weren't checking that the incoming values for that PHI were what we expected. As a result, we had to bail out after block splitting which caused us to never reach a steady state in SimplifyCFG.

Fixes PR30292.

llvm-svn: 280790

7 years ago[PowerPC] Fix address-offset folding for plain addi
Hal Finkel [Wed, 7 Sep 2016 07:36:11 +0000 (07:36 +0000)]
[PowerPC] Fix address-offset folding for plain addi

When folding an addi into a memory access that can take an immediate offset, we
were implicitly assuming that the existing offset was zero. This was incorrect.
If we're dealing with an addi with a plain constant, we can add it to the
existing offset (assuming that doesn't overflow the immediate, etc.), but if we
have anything else (i.e. something that will become a relocation expression),
we'll go back to requiring the existing immediate offset to be zero (because we
don't know what the requirements on that relocation expression might be - e.g.
maybe it is paired with some addis in some relevant way).

On the other hand, when dealing with a plain addi with a regular constant
immediate, the alignment restrictions (from the TOC base pointer, etc.) are
irrelevant.

I've added the test case from PR30280, which demonstrated the bug, but also
demonstrates a missed optimization opportunity (i.e. we don't need the memory
accesses at all).

Fixes PR30280.

llvm-svn: 280789

7 years agoSupport ABSOLUE keyword in symbol assignments
Eugene Leviant [Wed, 7 Sep 2016 07:08:43 +0000 (07:08 +0000)]
Support ABSOLUE keyword in symbol assignments

This patch allows making section defined symbols absolute:
.foo : {
  begin_foo = ABSOLUTE(.);
  *(.foo)
}

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

llvm-svn: 280788

7 years agoOpenCL: Defining __ENDIAN_LITTLE__ and fix target endianness
Matt Arsenault [Wed, 7 Sep 2016 07:08:02 +0000 (07:08 +0000)]
OpenCL: Defining __ENDIAN_LITTLE__ and fix target endianness

OpenCL requires __ENDIAN_LITTLE__ be set for little endian targets.
The default for targets was also apparently big endian, so AMDGPU
was incorrectly reported as big endian. Set this from the triple
so targets don't have another place to set the endianness.

llvm-svn: 280787

7 years agoFix whitespace issues
Matt Arsenault [Wed, 7 Sep 2016 07:07:59 +0000 (07:07 +0000)]
Fix whitespace issues

^M and extra space

llvm-svn: 280786

7 years agoAVX512F: FMA intrinsic + FNEG - sequence optimization
Elena Demikhovsky [Wed, 7 Sep 2016 06:54:28 +0000 (06:54 +0000)]
AVX512F: FMA intrinsic + FNEG - sequence optimization

The previous commit (r280368 - https://reviews.llvm.org/D23313) does not cover AVX-512F, KNL set.
FNEG(x) operation is lowered to (bitcast (vpxor (bitcast x), (bitcast constfp(0x80000000))).
It happens because FP XOR is not supported for 512-bit data types on KNL and we use integer XOR instead.
I added pattern match for integer XOR.

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

llvm-svn: 280785

7 years agoAMDGPU: Make some scalar instructions commutable
Matt Arsenault [Wed, 7 Sep 2016 06:25:55 +0000 (06:25 +0000)]
AMDGPU: Make some scalar instructions commutable

llvm-svn: 280784

7 years agoRemove unnecessary call to getAllocatableRegClass
Matt Arsenault [Wed, 7 Sep 2016 06:16:45 +0000 (06:16 +0000)]
Remove unnecessary call to getAllocatableRegClass

This reapplies r252565 and r252674, effectively reverting r252956.

This allows VS_32/VS_64 to be unallocatable like they should be.

llvm-svn: 280783

7 years ago[X86] Add hasSideEffects=0 to some instructions.
Craig Topper [Wed, 7 Sep 2016 04:46:15 +0000 (04:46 +0000)]
[X86] Add hasSideEffects=0 to some instructions.

llvm-svn: 280782

7 years ago[AVX-512] Add support for commuting masked instructions in findCommutedOpIndices...
Craig Topper [Wed, 7 Sep 2016 04:46:11 +0000 (04:46 +0000)]
[AVX-512] Add support for commuting masked instructions in findCommutedOpIndices. The default implementation doesn't skip the mask input or the preserved input.

llvm-svn: 280781

7 years agoAvoid compile error by giving the test type a user defined default constructor
Eric Fiselier [Wed, 7 Sep 2016 03:50:36 +0000 (03:50 +0000)]
Avoid compile error by giving the test type a user defined default constructor

llvm-svn: 280780

7 years agoFix PR#30303 - no matching function for call to '__ptr_in_range'
Marshall Clow [Wed, 7 Sep 2016 03:32:06 +0000 (03:32 +0000)]
Fix PR#30303 - no matching function for call to '__ptr_in_range'

llvm-svn: 280779

7 years agoRevert "CodeGen: ensure that libcalls are always AAPCS CC"
Saleem Abdulrasool [Wed, 7 Sep 2016 03:17:19 +0000 (03:17 +0000)]
Revert "CodeGen: ensure that libcalls are always AAPCS CC"

This reverts SVN r280683.  Revert until I figure out why this is breaking lli
tests.

llvm-svn: 280778

7 years agoImprove constexpr tests for std::any
Eric Fiselier [Wed, 7 Sep 2016 02:38:48 +0000 (02:38 +0000)]
Improve constexpr tests for std::any

llvm-svn: 280777

7 years agoFix clang's handling of the copy performed in the second phase of class
Richard Smith [Wed, 7 Sep 2016 02:14:33 +0000 (02:14 +0000)]
Fix clang's handling of the copy performed in the second phase of class
copy-initialization. We previously got this wrong in a couple of ways:
 - we only looked for copy / move constructors and constructor templates for
   this copy, and thus would fail to copy in cases where doing so should use
   some other constructor (but see core issue 670),
 - we mishandled the special case for disabling user-defined conversions that
   blocks infinite recursion through repeated application of a copy constructor
   (applying it in slightly too many cases) -- though as far as I can tell,
   this does not ever actually affect the result of overload resolution, and
 - we misapplied the special-case rules for constructors taking a parameter
   whose type is a (reference to) the same class type by incorrectly assuming
   that only happens for copy/move constructors (it also happens for
   constructors instantiated from templates and those inherited from base
   classes).

These changes should only affect strange corner cases (for instance, where the
copy constructor exists but has a non-const-qualified parameter type), so for
the most part it only causes us to produce more 'candidate' notes, but see the
test changes for other cases whose behavior is affected.

llvm-svn: 280776