platform/upstream/llvm.git
7 years ago[asan] Reify ErrorDeadlySignal
Filipe Cabecinhas [Thu, 8 Sep 2016 12:58:15 +0000 (12:58 +0000)]
[asan] Reify ErrorDeadlySignal

Summary: Keep reifying other errors.

Reviewers: kcc, samsonov

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 280930

7 years ago[Thumb1] AND with a constant operand can be converted into BIC
James Molloy [Thu, 8 Sep 2016 12:58:12 +0000 (12:58 +0000)]
[Thumb1] AND with a constant operand can be converted into BIC

So model the cost of materializing the constant operand C as the minimum of
C and ~C.

llvm-svn: 280929

7 years ago[Thumb1] Fix cost calculation for complemented immediates
James Molloy [Thu, 8 Sep 2016 12:58:04 +0000 (12:58 +0000)]
[Thumb1] Fix cost calculation for complemented immediates

Materializing something like "-3" can be done as 2 instructions:
  MOV r0, #3
  MVN r0, r0

This has a cost of 2, not 3. It looks like we were already trying to detect this pattern in TII::getIntImmCost(), but were taking the complement of the zero-extended value instead of the sign-extended value which is unlikely to ever produce a number < 256.

There were no tests failing after changing this... :/

llvm-svn: 280928

7 years ago[SelectionDAG] Add BUILD_VECTOR support to computeKnownBits and SimplifyDemandedBits
Simon Pilgrim [Thu, 8 Sep 2016 12:57:51 +0000 (12:57 +0000)]
[SelectionDAG] Add BUILD_VECTOR support to computeKnownBits and SimplifyDemandedBits

Add the ability to computeKnownBits and SimplifyDemandedBits to extract the known zero/one bits from BUILD_VECTOR, returning the known bits that are shared by every vector element.

This is an initial step towards determining the sign bits of a vector (PR29079).

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

llvm-svn: 280927

7 years ago[DAGCombiner] Enable AND combines of splatted constant vectors
Simon Pilgrim [Thu, 8 Sep 2016 12:36:39 +0000 (12:36 +0000)]
[DAGCombiner] Enable AND combines of splatted constant vectors

Allow AND combines to use a vector splatted constant as well as a constant scalar.

Preliminary part of D24253.

llvm-svn: 280926

7 years agoPack InputSectionData from 72 to 64 bytes. NFC.
Rafael Espindola [Thu, 8 Sep 2016 12:33:41 +0000 (12:33 +0000)]
Pack InputSectionData from 72 to 64 bytes. NFC.

llvm-svn: 280925

7 years agoLLDB: API for iPermission of object file's sections
Abhishek Aggarwal [Thu, 8 Sep 2016 12:22:56 +0000 (12:22 +0000)]
LLDB: API for iPermission of object file's sections

 Summary:
 - Added an API to public interface that provides permissions (RWX) of
   individual sections of an object file

 - Earlier, there was no way to find out this information through SB
   APIs

 - A possible use case of this API is:
   when a user wants to know the sections that have executable machine
   instructions and want to write a tool on top of LLDB based on this
   information

 - Differential Revision: https://reviews.llvm.org/D24251

llvm-svn: 280924

7 years agoScopInfo: Add missing __isl_take annotation
Tobias Grosser [Thu, 8 Sep 2016 11:18:56 +0000 (11:18 +0000)]
ScopInfo: Add missing __isl_take annotation

llvm-svn: 280923

7 years agoFix test breakage in r280919
Pavel Labath [Thu, 8 Sep 2016 11:09:14 +0000 (11:09 +0000)]
Fix test breakage in r280919

It turns out that self.dbg.GetSelectedPlatform().GetTriple() is not a good way
to get the triple of the process, as it returns the incorrect triple in case of a
32-bit process running on a 64-bit platform.

Instead, go the long way round and ask the stub for the process triple. This
fixes the test for i386.

llvm-svn: 280922

7 years agoMoved unreachable to appease msvc, gcc and clang
Simon Pilgrim [Thu, 8 Sep 2016 11:03:41 +0000 (11:03 +0000)]
Moved unreachable to appease msvc, gcc and clang

llvm-svn: 280921

7 years ago[tsan] Support C++11 call_once in TSan on Darwin
Kuba Brecka [Thu, 8 Sep 2016 10:15:20 +0000 (10:15 +0000)]
[tsan] Support C++11 call_once in TSan on Darwin

This patch adds a wrapper for call_once, which uses an already-compiled helper __call_once with an atomic release which is invisible to TSan. To avoid false positives, the interceptor performs an explicit atomic release in the callback wrapper.

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

llvm-svn: 280920

7 years agogdb-remote: Add jModulesInfo packet
Pavel Labath [Thu, 8 Sep 2016 10:07:04 +0000 (10:07 +0000)]
gdb-remote: Add jModulesInfo packet

Summary:
This adds the jModulesInfo packet, which is the equivalent of qModulesInfo, but it enables us to
query multiple modules at once. This makes a significant speed improvement in case the
application has many (over a hundred) modules, and the communication link has a non-negligible
latency. This functionality is accessed by ProcessGdbRemote::PrefetchModuleSpecs(), which does
the caching. GetModuleSpecs() is modified to first consult the cache before asking the remote
stub. PrefetchModuleSpecs is currently only called from POSIX-DYLD dynamic loader plugin, after
it reads the list of modules from the inferior memory, but other uses are possible.

This decreases the attach time to an android application by about 40%.

Reviewers: clayborg

Subscribers: tberghammer, lldb-commits, danalbert

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

llvm-svn: 280919

7 years agoRevert "[ARM] Lower UDIV+UREM to UDIV+MLS (and the same for SREM)"
Pablo Barrio [Thu, 8 Sep 2016 10:05:57 +0000 (10:05 +0000)]
Revert "[ARM] Lower UDIV+UREM to UDIV+MLS (and the same for SREM)"

This reverts commit r280808.

It is possible that this change results in an infinite loop. This
is causing timeouts in some tests on ARM, and a Chromebook bot is
failing.

llvm-svn: 280918

7 years agoFixed a 'not all control paths return a value' warning on MSVC builds
Simon Pilgrim [Thu, 8 Sep 2016 09:59:58 +0000 (09:59 +0000)]
Fixed a 'not all control paths return a value' warning on MSVC builds

llvm-svn: 280917

7 years ago[ELF] - Add virtual destructor to LinkerScriptBase class. NFC.
George Rimar [Thu, 8 Sep 2016 09:59:13 +0000 (09:59 +0000)]
[ELF] - Add virtual destructor to LinkerScriptBase class. NFC.

Absence of it caused a clang warning:
warning: 'lld::elf::LinkerScriptBase' has virtual functions but non-virtual destructor [-Wnon-virtual-dtor]

At fact we don't need it here because do not destroy this object by
base pointer.

llvm-svn: 280916

7 years agoLinker script: implement ALIGNOF
Eugene Leviant [Thu, 8 Sep 2016 09:08:30 +0000 (09:08 +0000)]
Linker script: implement ALIGNOF

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

llvm-svn: 280915

7 years ago[ELF][MIPS] Fix initialization of TLS-related GOT entries
Simon Atanasyan [Thu, 8 Sep 2016 09:07:19 +0000 (09:07 +0000)]
[ELF][MIPS] Fix initialization of TLS-related GOT entries

This patch allows static linking of TLS code. To do that it fixes
GOT entries initialization.

If TLS-related GOT entry created for a preemptible symbol i.e. has
a corresponding dynamic relocation, leave the entry initialized by zero.
Write down adjusted TLS symbol's values otherwise. For the adjustments
calculation use offsets for thread-local storage.

https://www.linux-mips.org/wiki/NPTL

llvm-svn: 280914

7 years ago[ELF][MIPS] Update the comment
Simon Atanasyan [Thu, 8 Sep 2016 09:07:12 +0000 (09:07 +0000)]
[ELF][MIPS] Update the comment

llvm-svn: 280913

7 years agoSet entry address to 0x0 if no _start symbol
Eugene Leviant [Thu, 8 Sep 2016 08:57:51 +0000 (08:57 +0000)]
Set entry address to 0x0 if no _start symbol

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

llvm-svn: 280912

7 years ago[ELF] - Apply clang-format to LinkerScript.cpp, NFC.
George Rimar [Thu, 8 Sep 2016 08:20:30 +0000 (08:20 +0000)]
[ELF] - Apply clang-format to LinkerScript.cpp, NFC.

llvm-svn: 280911

7 years ago[ELF] - Linkerscript: simplify access to templated methods from parser.
George Rimar [Thu, 8 Sep 2016 08:19:13 +0000 (08:19 +0000)]
[ELF] - Linkerscript: simplify access to templated methods from parser.

Previous way of accessing templated methods was a bit bulky,
Patch introduces small interface based solution.

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

llvm-svn: 280910

7 years ago[mips][microMIPS] Implement DBITSWAP, DLSA and LWUPC and add tests for AUI instructions
Hrvoje Varga [Thu, 8 Sep 2016 07:41:43 +0000 (07:41 +0000)]
[mips][microMIPS] Implement DBITSWAP, DLSA and LWUPC and add tests for AUI instructions
Differential Revision: https://reviews.llvm.org/D16452

llvm-svn: 280909

7 years ago[asan] Test that asan does not report use-after-scope if program jumped over variable...
Vitaly Buka [Thu, 8 Sep 2016 06:43:02 +0000 (06:43 +0000)]
[asan] Test that asan does not report use-after-scope if program jumped over variable declaration.

Summary:
Test to check if PR28267 workaround works.

PR28267
PR27453

Reviewers: eugenis

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 280908

7 years ago[asan] Avoid lifetime analysis for allocas with can be in ambiguous state
Vitaly Buka [Thu, 8 Sep 2016 06:27:58 +0000 (06:27 +0000)]
[asan] Avoid lifetime analysis for allocas with can be in ambiguous state

Summary:
C allows to jump over variables declaration so lifetime.start can be
avoid before variable usage. To avoid false-positives on such rare cases
we detect them and remove from lifetime analysis.

PR27453
PR28267

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 280907

7 years agoI'm experimenting with changing how the mixed source & assembly
Jason Molenda [Thu, 8 Sep 2016 05:12:41 +0000 (05:12 +0000)]
I'm experimenting with changing how the mixed source & assembly
mode in lldb works.  I've been discussing this with Jim Ingham,
Greg Clayton, and Kate Stone for the past week or two.

Previously lldb would print three source lines (centered on the
line table entry line for the current line) followed by the assembly.
It would print the context information (module`function + offset)
before those three lines of source.

Now lldb will print up to two lines before/after the line table
entry.  It prints two '*' characters for the line table line to
make it clear what line is showing assembly.  There is one line of
whitespace before/after the source lines so the separation between
source & assembly is clearer.  I don't print the context line
(module`function + offset).  I stop printing context lines if it's
a different line table entry, or if it's a source line I've already
printed as context to another source line.  If I have two line table
entries one after another for the same source line (I get these often
with clang - with different column information in them), I only print
the source line once.

I'm also using the target.process.thread.step-avoid-regexp setting
(which keeps you from stepping into STL functions that have been inlined
into your own code) and avoid printing any source lines from functions
that match that regexp.

When lldb disassembles into a new function, it will try to find the
declaration line # for the function and print all of the source lines
between the decl and the first line table entry (usually a { curly brace)
so we have a good chance of including the arguments, at least with the
debug info emitted by clang.

Finally, the # of source lines of context to show has been separated
from whether we're doing mixed source & assembly or not.  Previously
specifying 0 lines of context would turn off mixed source & assembly.

I think there's room for improvement, and maybe some bugs I haven't
found yet, but it's in good enough shape to upstream and iterate at
this point.

I'm not sure how best to indicate which source line is the actual line
table # versus context lines.  I'm using '**' right now.  Both Kate
and Greg had the initial idea to reuse '->' (normally used to indicate
"currently executing source line") - I tried it but I wasn't thrilled,
I'm too used to the established meaning of ->.

Greg had the interesting idea of avoiding context source lines only
in two line table entries in the same source file.  So we'd print
two lines before & after a source line, and then the next line table
entry (if it was on the next source line after those two context lines)
we'd display only the following two lines -- the previous two had just
been printed.  If an inline source line was printed between these two,
though, we'd print the context lines for both of them.  It's an
interesting idea, and I want to see how it works with both -O0 and -O3
codegen where we have different amounts of inlining.

<rdar://problem/27961419>

llvm-svn: 280906

7 years agoRevert "[LoopUnroll] Properly update loop-info when cloning prologues and epilogues."
Michael Zolotukhin [Thu, 8 Sep 2016 03:51:30 +0000 (03:51 +0000)]
Revert "[LoopUnroll] Properly update loop-info when cloning prologues and epilogues."

This reverts commit r280901.

This caused a bunch of failures, reverting it until I investigate them.

llvm-svn: 280905

7 years agoRename test file. NFC.
Rui Ueyama [Thu, 8 Sep 2016 03:08:05 +0000 (03:08 +0000)]
Rename test file. NFC.

llvm-svn: 280904

7 years agoI had a problem with one SDK where dispatch_release was actually a
Jason Molenda [Thu, 8 Sep 2016 02:29:40 +0000 (02:29 +0000)]
I had a problem with one SDK where dispatch_release was actually a
macro, so writing ::dispatch_release did not work as expected.
Remove the global anon namespace :: designation; the header will
get us the correct declaration.

llvm-svn: 280903

7 years agoForce the initialization of the m_type ivar in
Jason Molenda [Thu, 8 Sep 2016 02:26:58 +0000 (02:26 +0000)]
Force the initialization of the m_type ivar in
Function::GetStartLineSourceInfo before we try to
return the start line information about a function;
this function requires it to have been initialized.

llvm-svn: 280902

7 years ago[LoopUnroll] Properly update loop-info when cloning prologues and epilogues.
Michael Zolotukhin [Thu, 8 Sep 2016 01:52:26 +0000 (01:52 +0000)]
[LoopUnroll] Properly update loop-info when cloning prologues and epilogues.

Summary:
When cloning blocks for prologue/epilogue we need to replicate the loop
structure from the original loop. It wasn't a problem for the innermost
loops, but it led to an incorrect loop info when we unrolled a loop with
a child loop - in this case created prologue-loop had a child loop, but
loop info didn't reflect that.

This fixes PR28888.

Reviewers: chandlerc, sanjoy, hfinkel

Subscribers: llvm-commits, silvas

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

llvm-svn: 280901

7 years agoCorrectly escape %.
Nico Weber [Thu, 8 Sep 2016 01:46:52 +0000 (01:46 +0000)]
Correctly escape %.

Found be an MSVC warning; I filed PR30320 for adding a similar warning to clang.

llvm-svn: 280900

7 years agoAdd explicit casts to size_t to try to appease MSVC.
Peter Collingbourne [Thu, 8 Sep 2016 01:45:28 +0000 (01:45 +0000)]
Add explicit casts to size_t to try to appease MSVC.

llvm-svn: 280899

7 years ago[llvm-cov] Disable zlib compression in a test input, unbreaks bots
Vedant Kumar [Thu, 8 Sep 2016 01:19:29 +0000 (01:19 +0000)]
[llvm-cov] Disable zlib compression in a test input, unbreaks bots

Disable name compression in the inputs used to produce
multiple-files.covmapping. Should fix bots which don't compile with
zlib:

  http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/19610/steps/test/logs/stdio

llvm-svn: 280898

7 years agoCodeGen: Clean up implementation of vtable initializer builder. NFC.
Peter Collingbourne [Thu, 8 Sep 2016 01:14:39 +0000 (01:14 +0000)]
CodeGen: Clean up implementation of vtable initializer builder. NFC.

- Simplify signature of CreateVTableInitializer function.
- Move vtable component builder to a separate function.
- Remove unnecessary accessors from VTableLayout class.

This is in preparation for a future change that will alter the type of the
vtable initializer.

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

llvm-svn: 280897

7 years ago[llvm-cov] Use less space to describe source names
Vedant Kumar [Thu, 8 Sep 2016 00:56:48 +0000 (00:56 +0000)]
[llvm-cov] Use less space to describe source names

In r279628, we made SourceCoverageView list the binary associated with a
view and started adding labels (e.g "Source: foo" or "Function: bar") to
everything. Condense this information a bit to unclutter reports.

llvm-svn: 280896

7 years ago[llvm-cov] Drop the longest common filename prefix from summaries
Vedant Kumar [Thu, 8 Sep 2016 00:56:43 +0000 (00:56 +0000)]
[llvm-cov] Drop the longest common filename prefix from summaries

Remove the longest common prefix from filenames when printing coverage
summaries. This makes them easier to compare.

llvm-svn: 280895

7 years ago[CGP] Be less conservative about tail-duplicating a ret to allow tail calls
Michael Kuperstein [Thu, 8 Sep 2016 00:48:37 +0000 (00:48 +0000)]
[CGP] Be less conservative about tail-duplicating a ret to allow tail calls

CGP tail-duplicates rets into blocks that end with a call that feed the ret.
This puts the call in tail position, potentially allowing the DAG builder to
lower it as a tail call. To avoid tail duplication in cases where we won't
form the tail call, CGP tried to predict whether this is going to be possible,
and avoids doing it when lowering as a tail call will definitely fail.
However, it was being too conservative by always throwing away calls to
functions with a signext/zeroext attribute on the return type.

Instead, we can use the same logic the builder uses to determine whether the
attributes work out.

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

llvm-svn: 280894

7 years ago[AA] Fix typo in comment (s/hase/has).
Justin Lebar [Thu, 8 Sep 2016 00:48:12 +0000 (00:48 +0000)]
[AA] Fix typo in comment (s/hase/has).

llvm-svn: 280893

7 years agoRemove lldb coding conventions as they are no longer relevant.
Jim Ingham [Thu, 8 Sep 2016 00:42:02 +0000 (00:42 +0000)]
Remove lldb coding conventions as they are no longer relevant.

llvm-svn: 280892

7 years ago[XRay] Remove unused variable
Dean Michael Berris [Thu, 8 Sep 2016 00:38:22 +0000 (00:38 +0000)]
[XRay] Remove unused variable

llvm-svn: 280891

7 years ago[XRay] ARM 32-bit no-Thumb support in compiler-rt
Dean Michael Berris [Thu, 8 Sep 2016 00:28:26 +0000 (00:28 +0000)]
[XRay] ARM 32-bit no-Thumb support in compiler-rt

This is a port of XRay to ARM 32-bit, without Thumb support yet.
This is one of 3 commits to different repositories of XRay ARM port. The
other 2 are:

1. https://reviews.llvm.org/D23931 (LLVM)
2. https://reviews.llvm.org/D23932 (Clang test)

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

llvm-svn: 280890

7 years ago[XRay] ARM 32-bit no-Thumb support in Clang
Dean Michael Berris [Thu, 8 Sep 2016 00:23:28 +0000 (00:23 +0000)]
[XRay] ARM 32-bit no-Thumb support in Clang

Just a test for now, adapted from x86_64 tests of XRay.
This is one of 3 commits to different repositories of XRay ARM port. The
other 2 are:

1. https://reviews.llvm.org/D23931 (LLVM)
2. https://reviews.llvm.org/D23933 (compiler-rt)

Differential Review: https://reviews.llvm.org/D23932

llvm-svn: 280889

7 years ago[XRay] ARM 32-bit no-Thumb support in LLVM
Dean Michael Berris [Thu, 8 Sep 2016 00:19:04 +0000 (00:19 +0000)]
[XRay] ARM 32-bit no-Thumb support in LLVM

This is a port of XRay to ARM 32-bit, without Thumb support yet. The XRay instrumentation support is moving up to AsmPrinter.
This is one of 3 commits to different repositories of XRay ARM port. The other 2 are:

1. https://reviews.llvm.org/D23932 (Clang test)
2. https://reviews.llvm.org/D23933 (compiler-rt)

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

llvm-svn: 280888

7 years agoDeleted right file
Piotr Padlewski [Wed, 7 Sep 2016 23:46:52 +0000 (23:46 +0000)]
Deleted right file

llvm-svn: 280887

7 years agoRevert "[thinlto] Deleted unused test file"
Piotr Padlewski [Wed, 7 Sep 2016 23:46:50 +0000 (23:46 +0000)]
Revert "[thinlto] Deleted unused test file"

This reverts commit a7ad00460027c4a92640c2a5706a7d1869b60989.

llvm-svn: 280886

7 years ago[sanitizer] Fix a conflict between abort_on_error and handle_abort.
Evgeniy Stepanov [Wed, 7 Sep 2016 23:40:53 +0000 (23:40 +0000)]
[sanitizer] Fix a conflict between abort_on_error and handle_abort.

Reset the SIGABRT signal handler before calling abort().

Also, change the error message when catching SIGABRT to say "ABRT"
instead of "SEGV".

llvm-svn: 280885

7 years agoIR: Remove Value::intersectOptionalDataWith, replace all calls with calls to Instruct...
Peter Collingbourne [Wed, 7 Sep 2016 23:39:04 +0000 (23:39 +0000)]
IR: Remove Value::intersectOptionalDataWith, replace all calls with calls to Instruction::andIRFlags.

The two functions are functionally equivalent.

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

llvm-svn: 280884

7 years agoRevert "[asan] Avoid lifetime analysis for allocas with can be in ambiguous state"
Vitaly Buka [Wed, 7 Sep 2016 23:37:15 +0000 (23:37 +0000)]
Revert "[asan] Avoid lifetime analysis for allocas with can be in ambiguous state"

Fails on Windows.

This reverts commit r280880.

llvm-svn: 280883

7 years ago[thinlto] Deleted unused test file
Piotr Padlewski [Wed, 7 Sep 2016 23:35:46 +0000 (23:35 +0000)]
[thinlto] Deleted unused test file

Summary:
This file should be referenced from
thinlto-function-summary-callgraph-pgo.ll file,
but someone forgot to use it there. Everything worked because
we store pgo data about callsite blocks, so there is no need to have
pgo count of @func.

Reviewers: tejohnson, eraman, mehdi_amini

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 280882

7 years ago[asan] Fix build on Linux.
Evgeniy Stepanov [Wed, 7 Sep 2016 23:19:16 +0000 (23:19 +0000)]
[asan] Fix build on Linux.

llvm-svn: 280881

7 years ago[asan] Avoid lifetime analysis for allocas with can be in ambiguous state
Vitaly Buka [Wed, 7 Sep 2016 23:18:23 +0000 (23:18 +0000)]
[asan] Avoid lifetime analysis for allocas with can be in ambiguous state

Summary:
C allows to jump over variables declaration so lifetime.start can be
avoid before variable usage. To avoid false-positives on such rare cases
we detect them and remove from lifetime analysis.

PR27453
PR28267

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 280880

7 years agoRemove CxaDemangle.cpp / .h from xcode project file.
Jason Molenda [Wed, 7 Sep 2016 23:08:36 +0000 (23:08 +0000)]
Remove CxaDemangle.cpp / .h from xcode project file.

llvm-svn: 280879

7 years agoclang-format: [JavaScript] Change default AllowShortFunctionsOnASingleLine
Daniel Jasper [Wed, 7 Sep 2016 23:01:13 +0000 (23:01 +0000)]
clang-format: [JavaScript] Change default AllowShortFunctionsOnASingleLine
for Google style to "empty".

llvm-svn: 280878

7 years agobuiltins: make sure that flags is setup properly for __clear_cache
Saleem Abdulrasool [Wed, 7 Sep 2016 22:59:54 +0000 (22:59 +0000)]
builtins: make sure that flags is setup properly for __clear_cache

On Linux ARM, the syscall will take 3 arguments (start, end, flags).  Ensure
that we do not pass garbage to the flags, which can cause the cacheflush call to
fail, and therefore cause an abort at runtime.

llvm-svn: 280877

7 years ago[asan] Fix a crash in GetCurrentThread() before init.
Evgeniy Stepanov [Wed, 7 Sep 2016 22:57:06 +0000 (22:57 +0000)]
[asan] Fix a crash in GetCurrentThread() before init.

Android-specific code in GetCurrentThread() does not handle the situation when there is no
ThreadContext for the current thread. This happens if the current thread is requested before the
main thread is added to the registry. 64-bit allocator does that to record map/unmap stats during
initialization.

llvm-svn: 280876

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