platform/upstream/llvm.git
8 years ago[lanai] Add areMemAccessesTriviallyDisjoint, getMemOpBaseRegImmOfs and getMemOpBaseRe...
Jacques Pienaar [Thu, 14 Apr 2016 16:47:42 +0000 (16:47 +0000)]
[lanai] Add areMemAccessesTriviallyDisjoint, getMemOpBaseRegImmOfs and getMemOpBaseRegImmOfsWidth.

Summary: Add getMemOpBaseRegImmOfsWidth to enable determining independence during MiSched.

Reviewers: eliben, majnemer

Subscribers: mcrosier, llvm-commits

Differential Revision: http://reviews.llvm.org/D18903

llvm-svn: 266338

8 years agoAMDGPU: allow specifying a workgroup size that needs to fit in a compute unit
Tom Stellard [Thu, 14 Apr 2016 16:27:07 +0000 (16:27 +0000)]
AMDGPU: allow specifying a workgroup size that needs to fit in a compute unit

Summary:
For GL_ARB_compute_shader we need to support workgroup sizes of at least 1024. However, if we want to allow large workgroup sizes, we may need to use less registers, as we have to run more waves per SIMD.

This patch adds an attribute to specify the maximum work group size the compiled program needs to support. It defaults, to 256, as that has no wave restrictions.

Reducing the number of registers available is done similarly to how the registers were reserved for chips with the sgpr init bug.

Reviewers: mareko, arsenm, tstellarAMD, nhaehnle

Subscribers: FireBurn, kerberizer, llvm-commits, arsenm

Differential Revision: http://reviews.llvm.org/D18340

Patch By: Bas Nieuwenhuizen

llvm-svn: 266337

8 years agoAMDGPU/SI: Use the correct scratch wave offset register for shaders.
Tom Stellard [Thu, 14 Apr 2016 16:27:03 +0000 (16:27 +0000)]
AMDGPU/SI: Use the correct scratch wave offset register for shaders.

Summary:
The code previously always used s1 as it was using the user + system SGPR
information for compute kernels. This is incorrect for Mesa shaders though,

The register should be the next SGPR after all user and system SGPR's.
We use that Mesa adds arguments for all input and system SGPR's and
take the next available SGPR for the scratch wave offset register.

Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewers: mareko, arsenm, nhaehnle, tstellarAMD

Subscribers: qcolombet, arsenm, llvm-commits

Differential Revision: http://reviews.llvm.org/D18941

Patch By: Bas Nieuwenhuizen

llvm-svn: 266336

8 years ago[PGO] Do not attach VP metadata if value count at site is 0 [NFC]
Betul Buyukkurt [Thu, 14 Apr 2016 16:25:45 +0000 (16:25 +0000)]
[PGO] Do not attach VP metadata if value count at site is 0 [NFC]

llvm-svn: 266335

8 years ago[SCEV][LAA] Add tests for SCEV expression transformations performed during LAA
Silviu Baranga [Thu, 14 Apr 2016 16:08:45 +0000 (16:08 +0000)]
[SCEV][LAA] Add tests for SCEV expression transformations performed during LAA

Summary:
Add a print method to Predicated Scalar Evolution which prints all interesting
transformations done by PSE.

Loop Access Analysis will now print this as part of the analysis output.
We now use this to check the exact expression transformations that were done
by PSE in LAA.

The additional checking also acts as white-box testing for the getAsAddRec method.

Reviewers: anemet, sanjoy

Subscribers: sanjoy, mzolotukhin, llvm-commits

Differential Revision: http://reviews.llvm.org/D18792

llvm-svn: 266334

8 years ago[clang-tidy] Fix documentation generation.
Etienne Bergeron [Thu, 14 Apr 2016 16:08:04 +0000 (16:08 +0000)]
[clang-tidy] Fix documentation generation.

Summary: The patch is fixing the generation of clang-tidy documentation.

Reviewers: alexfh

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D19121

llvm-svn: 266333

8 years ago[ITTNOTIFY] Correct barrier imbalance time in case of tasks
Jonathan Peyton [Thu, 14 Apr 2016 16:06:49 +0000 (16:06 +0000)]
[ITTNOTIFY] Correct barrier imbalance time in case of tasks

ittnotify fix for barrier imbalance time in case tasks exist. In the current
implementation, task execution time is included into aggregated time on a
barrier. This fix calculates task execution time and corrects the arrive time
by subtracting the task execution time.

Since __kmp_invoke_task() can not only be called on a barrier, the field
th.th_bar_arrive_time is used to check if the function was called at the
barrier (th.th_bar_arrive_time != 0). So for this check, th_bar_arrive_time
is set to zero right after the value is used on the barrier.

Differential Revision: http://reviews.llvm.org/D19030

llvm-svn: 266332

8 years agoAdd typedefNameDecl() and typeAliasDecl() to the AST matchers; improves hasType(...
Aaron Ballman [Thu, 14 Apr 2016 16:05:45 +0000 (16:05 +0000)]
Add typedefNameDecl() and typeAliasDecl() to the AST matchers; improves hasType() to match on TypedefNameDecl nodes.

Patch by Clement Courbet.

llvm-svn: 266331

8 years agoRemove the only case where we would relocate a R_386_TLS_TPOFF.
Rafael Espindola [Thu, 14 Apr 2016 16:05:42 +0000 (16:05 +0000)]
Remove the only case where we would relocate a R_386_TLS_TPOFF.

llvm-svn: 266330

8 years agoExponential back off logic for test-and-set lock
Jonathan Peyton [Thu, 14 Apr 2016 16:00:37 +0000 (16:00 +0000)]
Exponential back off logic for test-and-set lock

This change adds back off logic in the test and set lock for better contended
lock performance. It uses a simple truncated binary exponential back off
function. The default back off parameters are tuned for x86.

The main back off logic has a two loop structure where each is controlled by a
user-level parameter:
max_backoff - limits the outer loop number of iterations.
    This parameter should be a power of 2.
min_ticks - the inner spin wait loop number of "ticks" which is system
    dependent and should be tuned for your system if you so choose.
    The "ticks" on x86 correspond to the time stamp counter,
    but on other architectures ticks is a timestamp derived
    from gettimeofday().

The user can modify these via the environment variable:
KMP_SPIN_BACKOFF_PARAMS=max_backoff[,min_ticks]
Currently, since the default user lock is a queuing lock,
one would have to also specify KMP_LOCK_KIND=tas to use the test-and-set locks.

Differential Revision: http://reviews.llvm.org/D19020

llvm-svn: 266329

8 years agoMerge duplicated cases. NFC.
Rafael Espindola [Thu, 14 Apr 2016 15:56:14 +0000 (15:56 +0000)]
Merge duplicated cases. NFC.

llvm-svn: 266328

8 years ago[test] make expect_state_changes actually expect *only* them
Pavel Labath [Thu, 14 Apr 2016 15:52:58 +0000 (15:52 +0000)]
[test] make expect_state_changes actually expect *only* them

The android dirty stderr problem has uncovered an issue where lldbutil.expect_state_changes was
reading events other than state change events, which resulted in general confusion. Make it more
strict to accept *only* state changes.

llvm-svn: 266327

8 years ago[test] Relax stderr expectations on targets with chatty output
Pavel Labath [Thu, 14 Apr 2016 15:52:53 +0000 (15:52 +0000)]
[test] Relax stderr expectations on targets with chatty output

Summary:
On some android targets, a binary can produce additional garbage (e.g. warning messages from the
dynamic linker) on the standard error, which confuses some tests. This relaxes the stderr
expectations for targets known for their chattyness.

Reviewers: tfiala, ovyalov

Subscribers: tberghammer, danalbert, srhines, lldb-commits

Differential Revision: http://reviews.llvm.org/D19114

llvm-svn: 266326

8 years agoFix testcase for the LLVM_LIBDIR_SUFFIX=64 case. Fallout from r266108.
Ismail Donmez [Thu, 14 Apr 2016 15:32:24 +0000 (15:32 +0000)]
Fix testcase for the LLVM_LIBDIR_SUFFIX=64 case. Fallout from r266108.

llvm-svn: 266324

8 years agoAdd contexts to test cases. NFC.
Michael Kruse [Thu, 14 Apr 2016 15:22:13 +0000 (15:22 +0000)]
Add contexts to test cases. NFC.

As discussed in the Polly weekly phone call and reviews.llvm.org/D18878,
the assumed contexts changed (widen) due to D18878/r265942. Also check
these contexts in the tests affected by that change.

llvm-svn: 266323

8 years agoAdd InvalidContext to update_test.py.
Michael Kruse [Thu, 14 Apr 2016 15:22:04 +0000 (15:22 +0000)]
Add InvalidContext to update_test.py.

This allows the test update script to add 'Invalid Context:' to test
cases. Enable with --check-include=InvalidContext.

llvm-svn: 266322

8 years agoclang-format: Last line in incomplete block is indented incorrectly
Marianne Mailhot-Sarrasin [Thu, 14 Apr 2016 14:56:49 +0000 (14:56 +0000)]
clang-format: Last line in incomplete block is indented incorrectly

Indentation of the last line was reset to the initial indentation of the block when reaching EOF.

Patch by Maxime Beaulieu

Differential Revision: http://reviews.llvm.org/D19065

llvm-svn: 266321

8 years agoclang-format: Implemented tab usage for continuation and indentation
Marianne Mailhot-Sarrasin [Thu, 14 Apr 2016 14:52:26 +0000 (14:52 +0000)]
clang-format: Implemented tab usage for continuation and indentation

Use tabs to fill whitespace at the start of a line.

Patch by Maxime Beaulieu

Differential Revision: http://reviews.llvm.org/D19028

llvm-svn: 266320

8 years agoclang-format: Allow include of clangFormat.h in managed context
Marianne Mailhot-Sarrasin [Thu, 14 Apr 2016 14:47:37 +0000 (14:47 +0000)]
clang-format: Allow include of clangFormat.h in managed context

Including VirtualFileSystem.h in the clangFormat.h indirectly includes <atomic>.
This header is blocked when compiling with /clr.

Patch by Maxime Beaulieu

Differential Revision: http://reviews.llvm.org/D19064

llvm-svn: 266319

8 years agoAdd missing typename.
Rafael Espindola [Thu, 14 Apr 2016 14:40:38 +0000 (14:40 +0000)]
Add missing typename.

llvm-svn: 266318

8 years ago[ELF] - Refactoring of end/edata/etext implementation.
George Rimar [Thu, 14 Apr 2016 14:37:59 +0000 (14:37 +0000)]
[ELF] - Refactoring of end/edata/etext implementation.

Minor refactoring of how end/edata/etext symbols are handled.

Differential revision: http://reviews.llvm.org/D19109

llvm-svn: 266317

8 years agoFind .plt section in object files generated by recent ld
Ulrich Weigand [Thu, 14 Apr 2016 14:36:29 +0000 (14:36 +0000)]
Find .plt section in object files generated by recent ld

Code in ObjectFileELF::ParseTrampolineSymbols assumes that the sh_info
field of the .rel(a).plt section identifies the .plt section.

However, with recent GNU ld this is no longer true.  As a result of this:
https://sourceware.org/bugzilla/show_bug.cgi?id=18169
in object files generated with current linkers the sh_info field of
.rel(a).plt now points to the .got.plt section (or .got on some targets).

This causes LLDB to fail to identify any PLT stubs, causing a number of
test case failures.

This patch changes LLDB to simply always look for the .plt section by
name.  This should be safe across all linkers and targets.

Differential Revision: http://reviews.llvm.org/D18973

llvm-svn: 266316

8 years agoFix test cases for big-endian systems
Ulrich Weigand [Thu, 14 Apr 2016 14:35:02 +0000 (14:35 +0000)]
Fix test cases for big-endian systems

A number of test cases were failing on big-endian systems simply due to
byte order assumptions in the tests themselves, and no underlying bug
in LLDB.

These two test cases:
  tools/lldb-server/lldbgdbserverutils.py
  python_api/process/TestProcessAPI.py
actually check for big-endian target byte order, but contain Python errors
in the corresponding code paths.

These test cases:
  functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
  functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
  functionalities/data-formatter/synthcapping/TestSyntheticCapping.py
  lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py
  python_api/sbdata/TestSBData.py  (first change)
could be fixed to check for big-endian target byte order and update the
expected result strings accordingly.  For the two synthetic tests, I've
also updated the source to make sure the fake_a value is always nonzero
on both big- and little-endian platforms.

These test case:
  python_api/sbdata/TestSBData.py  (second change)
  functionalities/memory/cache/TestMemoryCache.py
simply accessed memory with the wrong size, which wasn't noticed on LE
but fails on BE.

Differential Revision: http://reviews.llvm.org/D18985

llvm-svn: 266315

8 years agoFix ARM instruction emulation tests on big-endian systems
Ulrich Weigand [Thu, 14 Apr 2016 14:34:19 +0000 (14:34 +0000)]
Fix ARM instruction emulation tests on big-endian systems

Running the ARM instruction emulation test on a big-endian system
would fail, since the code doesn't respect endianness properly.

In EmulateInstructionARM::TestEmulation, code assumes that an
instruction opcode read in from the test file is in target byte
order, but it was in fact read in in host byte order.

More difficult to fix, the EmulationStateARM structure models
the overlapping sregs and dregs by a union in _sd_regs.  This
only works correctly if the host is a little-endian system.
I've removed the union in favor of a simple array containing
the 32 sregs, and changed any code accessing dregs to explicitly
use the correct two sregs overlaying that dreg in the proper
target order.

Also, the EmulationStateARM::ReadPseudoMemory and WritePseudoMemory
track memory as a map of uint32_t values in host byte order, and
implement 64-bit memory accessing by splitting them up into two
uint32_t ones.  However, callers expect memory contents to be
provided in the form of a byte array (in target byte order).
This means the uint32_t contents need to be byte-swapped on
BE systems, and when splitting up a 64-bit access into two 32-bit
ones, byte order has to be respected.

Differential Revision: http://reviews.llvm.org/D18984

llvm-svn: 266314

8 years agoMiscellaneous fixes for big-endian systems
Ulrich Weigand [Thu, 14 Apr 2016 14:33:47 +0000 (14:33 +0000)]
Miscellaneous fixes for big-endian systems

This patch fixes a bunch of issues that show up on big-endian systems:

- The gnu_libstdcpp.py script doesn't follow the way libstdc++ encodes
  bit vectors: it should identify the enclosing *word* and then access
  the appropriate bit within that word.  Instead, the script simply
  operates on bytes.  This gives the same result on little-endian
  systems, but not on big-endian.

- lldb_private::formatters::WCharSummaryProvider always assumes wchar_t
  is UTF16, even though it could also be UTF8 or UTF32.  This is mostly
  not an issue on little-endian systems, but immediately fails on BE.
  Fixed by checking the size of wchar_t like WCharStringSummaryProvider
  already does.

- ClangASTContext::GetChildCompilerTypeAtIndex uses uint32_t to access
  the virtual base offset stored in the vtable, even though the size
  of this field matches the target pointer size according to the C++
  ABI.  Again, this is mostly not visible on LE, but fails on BE.

- Process::ReadStringFromMemory uses strncmp to search for a terminator
  consisting of multiple zero bytes.  This doesn't work since strncmp
  will stop already at the first zero byte.  Use memcmp instead.

Differential Revision: http://reviews.llvm.org/D18983

llvm-svn: 266313

8 years agoHandle bit fields on big-endian systems correctly
Ulrich Weigand [Thu, 14 Apr 2016 14:32:57 +0000 (14:32 +0000)]
Handle bit fields on big-endian systems correctly

Currently, the DataExtractor::GetMaxU64Bitfield and GetMaxS64Bitfield
routines assume the incoming "bitfield_bit_offset" parameter uses
little-endian bit numbering, i.e. a bitfield_bit_offset 0 refers to
a bitfield whose least-significant bit coincides with the least-
significant bit of the surrounding integer.

On many big-endian systems, however, the big-endian bit numbering
is used for bit fields.  Here, a bitfield_bit_offset 0 refers to
a bitfield whose most-significant bit conincides with the most-
significant bit of the surrounding integer.

Now, in principle LLDB could arbitrarily choose which semantics of
bitfield_bit_offset to use.  However, there are two problems with
the current approach:

- When parsing DWARF, LLDB decodes bit offsets in little-endian
  bit numbering on LE systems, but in big-endian bit numbering
  on BE systems.  Passing those offsets later on into the
  DataExtractor routines gives incorrect results on BE.

- In the interim, LLDB's type layer combines byte and bit offsets
  into a single number.  I.e. instead of recording bitfields by
  specifying the byte offset and byte size of the surrounding
  integer *plus* the bit offset of the bit field within that field,
  it simply records a single bit offset number.

  Now, note that converting from byte offset + bit offset to a
  single offset value and back is well-defined if we either use
  little-endian byte order *and* little-endian bit numbering,
  or use big-endian byte order *and* big-endian bit numbering.
  Any other combination will yield incorrect results.

Therefore, the simplest approach would seem to be to always use
the bit numbering that matches the system byte order.  This makes
storing a single bit offset valid, and makes the existing DWARF
code correct.  The only place to fix is to teach DataExtractor
to use big-endian bit numbering on big endian systems.

However, there is only additional caveat: we also get bit offsets
from LLDB synthetic bitfields.  While the exact semantics of those
doesn't seem to be well-defined, from test cases it appears that
the intent was for the user-provided synthetic bitfield offset to
always use little-endian bit numbering.  Therefore, on a big-endian
system we now have to convert those to big-endian bit numbering
to remain consistent.

Differential Revision: http://reviews.llvm.org/D18982

llvm-svn: 266312

8 years agoFix usage of APInt.getRawData for big-endian systems
Ulrich Weigand [Thu, 14 Apr 2016 14:32:01 +0000 (14:32 +0000)]
Fix usage of APInt.getRawData for big-endian systems

The Scalar implementation and a few other places in LLDB directly
access the internal implementation of APInt values using the
getRawData method.  Unfortunately, pretty much all of these places
do not handle big-endian systems correctly.  While on little-endian
machines, the pointer returned by getRawData can simply be used as
a pointer to the integer value in its natural format, no matter
what size, this is not true on big-endian systems: getRawData
actually points to an array of type uint64_t, with the first element
of the array always containing the least-significant word of the
integer.  This means that if the bitsize of that integer is smaller
than 64, we need to add an offset to the pointer returned by
getRawData in order to access the value in its natural type, and
if the bitsize is *larger* than 64, we actually have to swap the
constituent words before we can access the value in its natural type.

This patch fixes every incorrect use of getRawData in the code base.
For the most part, this is done by simply removing uses of getRawData
in the first place, and using other APInt member functions to operate
on the integer data.

This can be done in many member functions of Scalar itself, as well
as in Symbol/Type.h and in IRInterpreter::Interpret.  For the latter,
I've had to add a Scalar::MakeUnsigned routine to parallel the existing
Scalar::MakeSigned, e.g. in order to implement an unsigned divide.

The Scalar::RawUInt, Scalar::RawULong, and Scalar::RawULongLong
were already unused and can be simply removed.  I've also removed
the Scalar::GetRawBits64 function and its few users.

The one remaining user of getRawData in Scalar.cpp is GetBytes.
I've implemented all the cases described above to correctly
implement access to the underlying integer data on big-endian
systems.  GetData now simply calls GetBytes instead of reimplementing
its contents.

Finally, two places in the clang interface code were also accessing
APInt.getRawData in order to actually construct a byte representation
of an integer.  I've changed those to make use of a Scalar instead,
to avoid having to re-implement the logic there.

The patch also adds a couple of unit tests verifying correct operation
of the GetBytes routine as well as the conversion routines.  Those tests
actually exposed more problems in the Scalar code: the SetValueFromData
routine didn't work correctly for 128- and 256-bit data types, and the
SChar routine should have an explicit "signed char" return type to work
correctly on platforms where char defaults to unsigned.

Differential Revision: http://reviews.llvm.org/D18981

llvm-svn: 266311

8 years agoMake Scalar::GetBytes and RegisterValue::GetBytes const
Ulrich Weigand [Thu, 14 Apr 2016 14:31:08 +0000 (14:31 +0000)]
Make Scalar::GetBytes and RegisterValue::GetBytes const

Scalar::GetBytes provides a non-const access to the underlying bytes
of the scalar value, supposedly allowing for modification of those
bytes.  However, even with the current implementation, this is not
really possible.  For floating-point scalars, the pointer returned
by GetBytes refers to a temporary copy; modifications to that copy
will be simply ignored.  For integer scalars, the pointer refers
to internal memory of the APInt implementation, which isn't
supposed to be directly modifyable; GetBytes simply casts aways
the const-ness of the pointer ...

With my upcoming patch to fix Scalar::GetBytes for big-endian
systems, this problem is going to get worse, since there we need
temporary copies even for some integer scalars.  Therefore, this
patch makes Scalar::GetBytes const, fixing all those problems.

As a follow-on change, RegisterValues::GetBytes must be made const
as well.  This in turn means that the way of initializing a
RegisterValue by doing a SetType followed by writing to GetBytes
no longer works.  Instead, I've changed SetValueFromData to do
the equivalent of SetType itself, and then re-implemented
SetFromMemoryData to work on top of SetValueFromData.

There is still a need for RegisterValue::SetType, since some
platform-specific code uses it to reinterpret the contents of
an already filled RegisterValue.  To make this usage work in
all cases (even changing from a type implemented via Scalar
to a type implemented as a byte buffer), SetType now simply
copies the old contents out, and then reloads the RegisterValue
from this data using the new type via SetValueFromData.

This in turn means that there is no remaining caller of
Scalar::SetType, so it can be removed.

The only other follow-on change was in MIPS EmulateInstruction
code, where some uses of RegisterValue::GetBytes could be made
const trivially.

Differential Revision: http://reviews.llvm.org/D18980

llvm-svn: 266310

8 years agoFixes for platforms that default to unsigned char
Ulrich Weigand [Thu, 14 Apr 2016 14:30:12 +0000 (14:30 +0000)]
Fixes for platforms that default to unsigned char

This fixes several test case failure on s390x caused by the fact that
on this platform, the default "char" type is unsigned.

- In ClangASTContext::GetBuiltinTypeForEncodingAndBitSize we should return
  an explicit *signed* char type for encoding eEncodingSint and bit size 8,
  instead of the default platform char type (which may be unsigned).
  This fix matches existing code in ClangASTContext::GetIntTypeFromBitSize,
  and fixes the TestClangASTContext.TestBuiltinTypeForEncodingAndBitSize
  unit test case.

- The test/expression_command/char/TestExprsChar.py test case is known to
  fail on platforms defaulting to unsigned char (pr23069), and just needs
  to be xfailed on s390x like on arm.

- The test/functionalities/watchpoint/watchpoint_on_vectors/main.c test
  case defines a vector of "char" and implicitly assumes to be signed.
  Use an explicit "signed char" instead.

Differential Revision: http://reviews.llvm.org/D18979

llvm-svn: 266309

8 years agoSupport Linux on SystemZ as platform
Ulrich Weigand [Thu, 14 Apr 2016 14:28:34 +0000 (14:28 +0000)]
Support Linux on SystemZ as platform

This patch adds support for Linux on SystemZ:
- A new ArchSpec value of eCore_s390x_generic
- A new directory Plugins/ABI/SysV-s390x providing an ABI implementation
- Register context support
- Native Linux support including watchpoint support
- ELF core file support
- Misc. support throughout the code base (e.g. breakpoint opcodes)
- Test case updates to support the platform

This should provide complete support for debugging the SystemZ platform.
Not yet supported are optional features like transaction support (zEC12)
or SIMD vector support (z13).

There is no instruction emulation, since our ABI requires that all code
provide correct DWARF CFI at all PC locations in .eh_frame to support
unwinding (i.e. -fasynchronous-unwind-tables is on by default).

The implementation follows existing platforms in a mostly straightforward
manner.  A couple of things that are different:

- We do not use PTRACE_PEEKUSER / PTRACE_POKEUSER to access single registers,
  since some registers (access register) reside at offsets in the user area
  that are multiples of 4, but the PTRACE_PEEKUSER interface only allows
  accessing aligned 8-byte blocks in the user area.  Instead, we use a s390
  specific ptrace interface PTRACE_PEEKUSR_AREA / PTRACE_POKEUSR_AREA that
  allows accessing a whole block of the user area in one go, so in effect
  allowing to treat parts of the user area as register sets.

- SystemZ hardware does not provide any means to implement read watchpoints,
  only write watchpoints.  In fact, we can only support a *single* write
  watchpoint (but this can span a range of arbitrary size).  In LLDB this
  means we support only a single watchpoint.  I've set all test cases that
  require read watchpoints (or multiple watchpoints) to expected failure
  on the platform.  [ Note that there were two test cases that install
  a read/write watchpoint even though they nowhere rely on the "read"
  property.  I've changed those to simply use plain write watchpoints. ]

Differential Revision: http://reviews.llvm.org/D18978

llvm-svn: 266308

8 years agoAdd new ABI callback to provide fallback unwind register locations
Ulrich Weigand [Thu, 14 Apr 2016 14:25:20 +0000 (14:25 +0000)]
Add new ABI callback to provide fallback unwind register locations

If the UnwindPlan did not identify how to unwind the stack pointer
register, LLDB currently assumes it can determine to caller's SP
from the current frame's CFA.  This is true on most platforms
where CFA is by definition equal to the incoming SP at function
entry.

However, on the s390x target, we instead define the CFA to equal
the incoming SP plus an offset of 160 bytes.  This is because
our ABI defines that the caller has to provide a register save
area of size 160 bytes.  This area is allocated by the caller,
but is considered part of the callee's stack frame, and therefore
the CFA is defined as pointing to the top of this area.

In order to make this work on s390x, this patch introduces a new
ABI callback GetFallbackRegisterLocation that provides platform-
specific fallback register locations for unwinding.  The existing
code to handle SP unwinding as well as volatile registers is moved
into the default implementation of that ABI callback, to allow
targets where that implementation is incorrect to override it.

This patch in itself is a no-op for all existing platforms.
But it is a pre-requisite for adding s390x support.

Differential Revision: http://reviews.llvm.org/D18977

llvm-svn: 266307

8 years agoReturn back the zero parameter of aggregate initialization in OutputSectionFactory...
George Rimar [Thu, 14 Apr 2016 14:24:23 +0000 (14:24 +0000)]
Return back the zero parameter of aggregate initialization in OutputSectionFactory::lookup().

That was removed in r266304, but leads to warnings by Clang.
Thanks to Rafael Espíndola for pointing on that.

Though I think change was legal from point of C++.

llvm-svn: 266306

8 years ago[sanitizer] remove FreeBSD PS_STRINGS fallback
Ed Maste [Thu, 14 Apr 2016 14:17:42 +0000 (14:17 +0000)]
[sanitizer] remove FreeBSD PS_STRINGS fallback

The PS_STRINGS constant can easily be incorrect with mismatched
kernel/userland - e.g. when building i386 sanitizers on FreeBSD/amd64
with -m32. The kern.ps_strings sysctl was introduced over 20 years ago
as the supported way to fetch the environment and argument string
addresses from the kernel, so the fallback is never used.

Differential Revision: http://reviews.llvm.org/D19027

llvm-svn: 266305

8 years agoMake OutputSectionFactory::lookup() inline. NFC.
George Rimar [Thu, 14 Apr 2016 14:07:54 +0000 (14:07 +0000)]
Make OutputSectionFactory::lookup() inline. NFC.

Also I removed the last zero parameter of
aggregate initialization as it is excessive here.

llvm-svn: 266304

8 years agoRemoved excessive line. NFC.
George Rimar [Thu, 14 Apr 2016 13:56:28 +0000 (13:56 +0000)]
Removed excessive line. NFC.

llvm-svn: 266303

8 years agoReduce expression to single line. NFC.
George Rimar [Thu, 14 Apr 2016 13:47:04 +0000 (13:47 +0000)]
Reduce expression to single line. NFC.

llvm-svn: 266302

8 years agoSummary:
Simon Dardis [Thu, 14 Apr 2016 13:43:17 +0000 (13:43 +0000)]
Summary:
Alias 'jic $reg, 0' to 'jrc $reg' and 'jialc $reg, 0' to 'jalrc $reg' like
binutils.

This patch was previous committed as r266055 as seemed to have caused some spurious
test failures. They did not reappear after further local testing.

llvm-svn: 266301

8 years agoRevert "Make tsan tests more portable (take 2)"
Renato Golin [Thu, 14 Apr 2016 13:31:22 +0000 (13:31 +0000)]
Revert "Make tsan tests more portable (take 2)"

This reverts commit r266294, as it broke some buildbots again. :/

llvm-svn: 266300

8 years agoClang formated file. NFC.
George Rimar [Thu, 14 Apr 2016 13:23:02 +0000 (13:23 +0000)]
Clang formated file. NFC.

llvm-svn: 266299

8 years agoCombine code branch into single line. NFC.
George Rimar [Thu, 14 Apr 2016 13:00:03 +0000 (13:00 +0000)]
Combine code branch into single line. NFC.

llvm-svn: 266298

8 years ago[sanitizer] [SystemZ] Abort if the kernel might be vulnerable to CVE-2016-2143.
Marcin Koscielnicki [Thu, 14 Apr 2016 12:56:24 +0000 (12:56 +0000)]
[sanitizer] [SystemZ] Abort if the kernel might be vulnerable to CVE-2016-2143.

In short, CVE-2016-2143 will crash the machine if a process uses both >4TB
virtual addresses and fork().  ASan, TSan, and MSan will, by necessity, map
a sizable chunk of virtual address space, which is much larger than 4TB.
Even worse, sanitizers will always use fork() for llvm-symbolizer when a bug
is detected.  Disable all three by aborting on process initialization if
the running kernel version is not known to contain a fix.

Unfortunately, there's no reliable way to detect the fix without crashing
the kernel.  So, we rely on whitelisting - I've included a list of upstream
kernel versions that will work.  In case someone uses a distribution kernel
or applied the fix themselves, an override switch is also included.

Differential Revision: http://reviews.llvm.org/D18915

llvm-svn: 266297

8 years ago[sanitizer] [SystemZ] Add virtual space size.
Marcin Koscielnicki [Thu, 14 Apr 2016 12:56:15 +0000 (12:56 +0000)]
[sanitizer] [SystemZ] Add virtual space size.

This teaches sanitizer_common about s390 and s390x virtual space size.
s390 is unusual in that it has 31-bit virtual space.

Differential Revision: http://reviews.llvm.org/D18896

llvm-svn: 266296

8 years ago[sanitizer] [SystemZ] Implement internal_mmap.
Marcin Koscielnicki [Thu, 14 Apr 2016 12:51:45 +0000 (12:51 +0000)]
[sanitizer] [SystemZ] Implement internal_mmap.

mmap on s390 is quite a special snowflake: since it has too many
parameters to pass them in registers, it passes a pointer to a struct
with all the parameters instead.

Differential Revision: http://reviews.llvm.org/D18889

llvm-svn: 266295

8 years agoMake tsan tests more portable (take 2)
Renato Golin [Thu, 14 Apr 2016 12:10:21 +0000 (12:10 +0000)]
Make tsan tests more portable (take 2)

Using stderr more uniformily, avoiding potential races when scanning stdout
and stderr output.

Patch by Maxim Kuvyrkov.

llvm-svn: 266294

8 years ago[analyzer] Make it possible to query the function name from a CallDescription.
Gabor Horvath [Thu, 14 Apr 2016 11:56:28 +0000 (11:56 +0000)]
[analyzer] Make it possible to query the function name from a CallDescription.

llvm-svn: 266293

8 years ago[ASTImporter] Implement some expression-related AST node import.
Artem Dergachev [Thu, 14 Apr 2016 11:51:27 +0000 (11:51 +0000)]
[ASTImporter] Implement some expression-related AST node import.

Introduce ASTImporter unit test framework.

Fix a memory leak introduced in cf8ccff5: an array is allocated
in ImportArray and never freed.

Support new node kinds:

- GCCAsmStmt

- AddrLabelExpr
- AtomicExpr
- CompoundLiteralExpr
- CXXBoolLiteralExpr
- CXXNullPtrLiteralExpr
- CXXThisExpr
- DesignatedInitExpr
- GNUNullExpr
- ImplicitValueInitExpr
- InitListExpr
- OpaqueValueExpr
- PredefinedExpr
- ParenListExpr
- StmtExpr
- VAArgExpr

- BinaryConditionalOperator
- ConditionalOperator

- FloatingLiteral
- StringLiteral

- InjectedClassNameType
- TemplateTypeParmType

- LabelDecl

Patch by Aleksei Sidorin!

Differential Revision: http://reviews.llvm.org/D14286

llvm-svn: 266292

8 years agoasan: fix build
Dmitry Vyukov [Thu, 14 Apr 2016 11:40:08 +0000 (11:40 +0000)]
asan: fix build

Some bots failed with:

sanitizer_quarantine.h:104:7: error: unused typedef 'assertion_failed__104' [-Werror,-Wunused-local-typedef]
      COMPILER_CHECK(kPrefetch <= ARRAY_SIZE(b->batch));

Replace COMPILER_CHECK with CHECK.

llvm-svn: 266291

8 years agoReapply r258505 after r266254, this time with a comment to make it more sticky.
Nico Weber [Thu, 14 Apr 2016 11:12:32 +0000 (11:12 +0000)]
Reapply r258505 after r266254, this time with a comment to make it more sticky.

llvm-svn: 266290

8 years ago[Coverage] Update testing methods to support more than two files
Igor Kudrin [Thu, 14 Apr 2016 10:43:37 +0000 (10:43 +0000)]
[Coverage] Update testing methods to support more than two files

Differential Revision: http://reviews.llvm.org/D18757

llvm-svn: 266289

8 years agoasan: fix out-of-bounds access in quarantine
Dmitry Vyukov [Thu, 14 Apr 2016 09:52:33 +0000 (09:52 +0000)]
asan: fix out-of-bounds access in quarantine

llvm-svn: 266288

8 years ago[MSVC] Fix check for wchar_t type in case of -fno-wchar
Dmitry Polukhin [Thu, 14 Apr 2016 09:52:06 +0000 (09:52 +0000)]
[MSVC] Fix check for wchar_t type in case of -fno-wchar

The example below should work identically with and without compiler native
wchar_t support.

void foo(wchar_t * t = L"");

Differential Revision: http://reviews.llvm.org/D19056

llvm-svn: 266287

8 years agoFileSpec: make matching separator-agnostic again
Pavel Labath [Thu, 14 Apr 2016 09:38:06 +0000 (09:38 +0000)]
FileSpec: make matching separator-agnostic again

Summary:
In D18689, I removed the call to Normalize() in FileSpec::SetFile, because it no longer seemed
needed, and it resolved a quirk in the FileSpec API (spec.GetCString() returnes a path with
backslashes, but spec.GetDirectory().GetCString() has forward slashes). This turned out to be a
problem because we would consider paths with different separators as different (which led to
unresolved breakpoints for instance).

Here, I am putting back in the call to Normalize() and adding a unittest for FileSpec::Equal. I
am commenting out the GetDirectory unittests until we figure out the what is the expected
behaviour here.

Reviewers: zturner

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D19060

llvm-svn: 266286

8 years ago[mips] Remove duplicate tests and add missing prefixes for *-LABEL checks. NFC.
Vasileios Kalintiris [Thu, 14 Apr 2016 09:13:13 +0000 (09:13 +0000)]
[mips] Remove duplicate tests and add missing prefixes for *-LABEL checks. NFC.

Summary:
The only difference between the removed tests and the pre-existing
ones, is the materialization of the zero constant, which shouldn't
matter for these cases.

Reviewers: dsanders, sdardis

Subscribers: dsanders, sdardis, llvm-commits

Differential Revision: http://reviews.llvm.org/D18693

llvm-svn: 266285

8 years ago[Coverage] Avoid unnecessary copying of std::vector
Igor Kudrin [Thu, 14 Apr 2016 09:10:00 +0000 (09:10 +0000)]
[Coverage] Avoid unnecessary copying of std::vector

Approved by: Justin Bogner <mail@justinbogner.com>

Differential Revision: http://reviews.llvm.org/D18756

llvm-svn: 266284

8 years ago[tsan] Fix size reporting for OS X zone allocator with 0-sized allocations
Kuba Brecka [Thu, 14 Apr 2016 09:05:19 +0000 (09:05 +0000)]
[tsan] Fix size reporting for OS X zone allocator with 0-sized allocations

The custom zone implementation for OS X must not return 0 (even for 0-sized allocations). Returning 0 indicates that the pointer doesn't belong to the zone. This can break existing applications. The underlaying allocator allocates 1 byte for 0-sized allocations anyway, so returning 1 in this case is okay.

Differential Revision: http://reviews.llvm.org/D19100

llvm-svn: 266283

8 years agoRevert "Support arbitrary addrspace pointers in masked load/store intrinsics"
Adam Nemet [Thu, 14 Apr 2016 08:47:17 +0000 (08:47 +0000)]
Revert "Support arbitrary addrspace pointers in masked load/store intrinsics"

This reverts commit r266086.

It breaks the LTO build of gcc in SPEC2000.

llvm-svn: 266282

8 years agoThinLTO: linkonce compile-time optimization, do not bother when there is only one...
Mehdi Amini [Thu, 14 Apr 2016 08:46:22 +0000 (08:46 +0000)]
ThinLTO: linkonce compile-time optimization, do not bother when there is only one input file

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266281

8 years ago[Clang][AVX512][BUILTIN] Adding support for intrinsics of vpmov{d|q}{b|w|d}{128|256...
Michael Zuckerman [Thu, 14 Apr 2016 07:56:51 +0000 (07:56 +0000)]
[Clang][AVX512][BUILTIN] Adding support for intrinsics of vpmov{d|q}{b|w|d}{128|256|512} instruction set

Differential Revision: http://reviews.llvm.org/D19055

llvm-svn: 266280

8 years ago[CodeGen] Teach LLVM how to lower @llvm.{min,max}num to {MIN,MAX}NAN
David Majnemer [Thu, 14 Apr 2016 07:13:24 +0000 (07:13 +0000)]
[CodeGen] Teach LLVM how to lower @llvm.{min,max}num to {MIN,MAX}NAN

The behavior of {MIN,MAX}NAN differs from that of {MIN,MAX}NUM when only
one of the inputs is NaN: -NUM will return the non-NaN argument while
-NAN would return NaN.

It is desirable to lower to @llvm.{min,max}num to -NAN if they don't
have a native instruction for -NUM.  Notably, ARMv7 NEON's vmin has the
-NAN semantics.

N.B.  Of course, it is only safe to do this if the intrinsic call is
marked nnan.

llvm-svn: 266279

8 years ago[Clang][AVX512][Builtin] Adding intrinsics of vpmovus{d|q}{b|w|d}{128|256|512} instru...
Michael Zuckerman [Thu, 14 Apr 2016 06:48:09 +0000 (06:48 +0000)]
[Clang][AVX512][Builtin] Adding intrinsics of vpmovus{d|q}{b|w|d}{128|256|512} instruction set

Differential Revision: http://reviews.llvm.org/D19050

llvm-svn: 266278

8 years agoMake sure the LLVMContext outlive the CompilerInstance
Mehdi Amini [Thu, 14 Apr 2016 05:37:41 +0000 (05:37 +0000)]
Make sure the LLVMContext outlive the CompilerInstance

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266277

8 years agoDo not use llvm:getGlobalContext() in unittests
Mehdi Amini [Thu, 14 Apr 2016 05:34:32 +0000 (05:34 +0000)]
Do not use llvm:getGlobalContext() in unittests

Currently trying to nuke this API from LLVM.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266276

8 years agoDo not use getGlobalContext()... ever.
Mehdi Amini [Thu, 14 Apr 2016 04:36:40 +0000 (04:36 +0000)]
Do not use getGlobalContext()... ever.

This code was creating a new type in the global context, regardless
of which context the user is sitting in, what can possibly go wrong?

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266275

8 years agoFix Android build after r266267
Oleksiy Vyalov [Thu, 14 Apr 2016 02:02:12 +0000 (02:02 +0000)]
Fix Android build after r266267

llvm-svn: 266274

8 years agoELF: Do not create copy relocations for references in writable sections.
Peter Collingbourne [Thu, 14 Apr 2016 01:48:11 +0000 (01:48 +0000)]
ELF: Do not create copy relocations for references in writable sections.

They are unnecessary, as the dynamic loader can apply the original relocations
directly. This was also resulting in the creation of copy relocations in PIEs.

Differential Revision: http://reviews.llvm.org/D19089

llvm-svn: 266273

8 years agoAMDGPU: Implement canonicalize
Matt Arsenault [Thu, 14 Apr 2016 01:42:16 +0000 (01:42 +0000)]
AMDGPU: Implement canonicalize

Also add generic DAG node for it.

llvm-svn: 266272

8 years agoDon't use auto - (try to) appease the Android g++ bot
Enrico Granata [Thu, 14 Apr 2016 01:23:01 +0000 (01:23 +0000)]
Don't use auto - (try to) appease the Android g++ bot

llvm-svn: 266271

8 years agoTargetLowering: Factor out common code for tail call eligibility checking; NFC
Matthias Braun [Thu, 14 Apr 2016 01:10:42 +0000 (01:10 +0000)]
TargetLowering: Factor out common code for tail call eligibility checking; NFC

llvm-svn: 266270

8 years ago[modules] Store the location of the lexical update record in a decl update as
Richard Smith [Thu, 14 Apr 2016 00:50:18 +0000 (00:50 +0000)]
[modules] Store the location of the lexical update record in a decl update as
an offset from the current record rather than as an absolute bit number. This
gives a minor .pcm file size reduction.

llvm-svn: 266269

8 years agoReorder ASTNodeKind::AllKindInfo to match NodeKindId.
Alexander Kornienko [Thu, 14 Apr 2016 00:47:40 +0000 (00:47 +0000)]
Reorder ASTNodeKind::AllKindInfo to match NodeKindId.

Summary:
AllKindInfo is being indexed by NodeKindId, so the order must match.
Extended ASTTypeTraits tests to cover this.

Reviewers: sbenza

Subscribers: cfe-commits, klimek

Differential Revision: http://reviews.llvm.org/D19059

llvm-svn: 266268

8 years agoAugment the 'language objc class-table dump' command to take a "-v" option, which...
Enrico Granata [Thu, 14 Apr 2016 00:43:20 +0000 (00:43 +0000)]
Augment the 'language objc class-table dump' command to take a "-v" option, which makes it print ivar and method information, as well as an optional regex argument which filters out all class names that don't match the regex

llvm-svn: 266267

8 years ago[modules] Remove CXX_BASE_SPECIFIERS_OFFSETS table. Instead of storing an ID of
Richard Smith [Thu, 14 Apr 2016 00:29:55 +0000 (00:29 +0000)]
[modules] Remove CXX_BASE_SPECIFIERS_OFFSETS table. Instead of storing an ID of
a table entry in the corresponding decl, store an offset from the current
record to the relevant CXX_BASE_SPECIFIERS record. This results in fewer
indirections and a minor .pcm file size reduction.

llvm-svn: 266266

8 years agoclang-tools-extra/test/clang-tidy/readability-deleted-default.cpp: Add -fno-ms-compat...
NAKAMURA Takumi [Wed, 13 Apr 2016 23:50:45 +0000 (23:50 +0000)]
clang-tools-extra/test/clang-tidy/readability-deleted-default.cpp: Add -fno-ms-compatibility.

llvm-svn: 266265

8 years agoObjC kindof: order the methods in global pool relative to availability.
Manman Ren [Wed, 13 Apr 2016 23:43:56 +0000 (23:43 +0000)]
ObjC kindof: order the methods in global pool relative to availability.

r265877 tries to put methods that are deprecated or unavailable to the
front of the global pool to emit diagnostics, but it breaks some of
our existing codes that depend on choosing a certain method for id
lookup.

This commit orders the methods with the same declaration with respect
to the availability, but do not order methods with different declaration.

rdar://25707511

llvm-svn: 266264

8 years ago[CodeGen] Avoid ctor/dtor boilerplate with some C++11
Reid Kleckner [Wed, 13 Apr 2016 23:37:17 +0000 (23:37 +0000)]
[CodeGen] Avoid ctor/dtor boilerplate with some C++11

Non-owning pointers that cache LLVM types and constants can use
'nullptr' default member initializers so that we don't need to mention
them in the constructor initializer list.

Owning pointers should use std::unique_ptr so that we don't need to
manually delete them in the destructor. They also don't need to be
mentioned in the constructor at that point.

NFC

llvm-svn: 266263

8 years ago[CFLAA] Fix up code style a bit. NFC.
George Burgess IV [Wed, 13 Apr 2016 23:27:37 +0000 (23:27 +0000)]
[CFLAA] Fix up code style a bit. NFC.

llvm-svn: 266262

8 years ago[ppc] add tests to show potential andc optimization
Sanjay Patel [Wed, 13 Apr 2016 23:23:30 +0000 (23:23 +0000)]
[ppc] add tests to show potential andc optimization

llvm-svn: 266261

8 years agoARM: override cost function to re-enable ConstantHoisting (& fix it).
Tim Northover [Wed, 13 Apr 2016 23:08:27 +0000 (23:08 +0000)]
ARM: override cost function to re-enable ConstantHoisting (& fix it).

At some point, ARM stopped getting any benefit from ConstantHoisting because
the pass called a different variant of getIntImmCost. Reimplementing the
correct variant revealed some problems, however:

  + ConstantHoisting was modifying switch statements. This is simply invalid,
    the cases must remain integer constants no matter the notional cost.
  + ConstantHoisting was mangling alloca instructions in the entry block. These
    should be handled by FrameLowering, so constants actually have a cost of 0.
    Worse, the resulting bitcasts meant they became dynamic allocas.

rdar://25707382

llvm-svn: 266260

8 years agoRevert "Add LLVMGetAttrKindIDInContext in the C API in order to facilitate migration...
Amaury Sechet [Wed, 13 Apr 2016 23:01:39 +0000 (23:01 +0000)]
Revert "Add LLVMGetAttrKindIDInContext in the C API in order to facilitate migration away from LLVMAttribute"

This reverts commit 0bcfd95c268bcb180a525e1837e84475df8acdc7.

llvm-svn: 266259

8 years agoValueMapper: Resolve cycles on the new nodes
Duncan P. N. Exon Smith [Wed, 13 Apr 2016 22:54:01 +0000 (22:54 +0000)]
ValueMapper: Resolve cycles on the new nodes

Fix a major bug from r265456.  Although it's now much rarer, ValueMapper
sometimes has to duplicate cycles.  The
might-transitively-reference-a-temporary counts don't decrement on their
own when there are cycles, and you need to call MDNode::resolveCycles to
fix it.

r265456 was checking the input nodes to see if they were unresolved.
This is useless; they should never be unresolved.  Instead we should
check the output nodes and resolve cycles on them.

llvm-svn: 266258

8 years agoAdd LLVMGetAttrKindIDInContext in the C API in order to facilitate migration away...
Amaury Sechet [Wed, 13 Apr 2016 22:51:40 +0000 (22:51 +0000)]
Add LLVMGetAttrKindIDInContext in the C API in order to facilitate migration away from LLVMAttribute

Summary: LLVMAttribute has outlived its utility and is becoming a problem for C API users that what to use all the LLVM attributes. In order to help moving away from LLVMAttribute in a smooth manner, this diff introduce LLVMGetAttrKindIDInContext, which can be used instead of the enum values.

Reviewers: Wallbraker, whitequark, joker.eph, echristo

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D18749

llvm-svn: 266257

8 years ago[IR] Optimize memory usage of Metadata on MSVC
Reid Kleckner [Wed, 13 Apr 2016 22:46:06 +0000 (22:46 +0000)]
[IR] Optimize memory usage of Metadata on MSVC

An unsigned 2 bit bitfield takes 4 bytes in MSVC. Instead of a bitfield,
just use an unsigned char. We can go back to a bitfield when someone
implements the TODO of exposing and reusing the remaining 6 bits.

llvm-svn: 266256

8 years ago[llvm-lto] Uniform error handling. NFC.
Davide Italiano [Wed, 13 Apr 2016 22:08:26 +0000 (22:08 +0000)]
[llvm-lto] Uniform error handling. NFC.

llvm-svn: 266255

8 years ago[modules] Remove CXX_CTOR_INITIALIZERS_OFFSETS table. Instead of storing an ID
Richard Smith [Wed, 13 Apr 2016 21:57:08 +0000 (21:57 +0000)]
[modules] Remove CXX_CTOR_INITIALIZERS_OFFSETS table. Instead of storing an ID
of a table entry in the corresponding decl, store an offset from the current
record to the relevant CXX_CTOR_INITIALIZERS record. This results in fewer
indirections and a minor .pcm file size reduction.

llvm-svn: 266254

8 years agoARM: Use a callee save register for the swiftself parameter.
Matthias Braun [Wed, 13 Apr 2016 21:43:25 +0000 (21:43 +0000)]
ARM: Use a callee save register for the swiftself parameter.

It is very likely that the swiftself parameter is alive throughout most
functions function so putting it into a callee save register should
avoid spills for the callers with only a minimum amount of extra spills
in the callees.

Currently the generated code is correct but unnecessarily spills and
reloads arguments passed in callee save registers, I will address this
in upcoming patches.

This also adds a missing check that for tail calls the preserved value
of the caller must be the same as the callees parameter.

Differential Revision: http://reviews.llvm.org/D18901

llvm-svn: 266253

8 years agoX86: Use a callee save register for the swiftself parameter.
Matthias Braun [Wed, 13 Apr 2016 21:43:21 +0000 (21:43 +0000)]
X86: Use a callee save register for the swiftself parameter.

It is very likely that the swiftself parameter is alive throughout most
functions function so putting it into a callee save register should
avoid spills for the callers with only a minimum amount of extra spills
in the callees.

Currently the generated code is correct but unnecessarily spills and
reloads arguments passed in callee save registers, I will address this
in upcoming patches.

This also adds a missing check that for tail calls the preserved value
of the caller must be the same as the callees parameter.

Differential Revision: http://reviews.llvm.org/D18902

llvm-svn: 266252

8 years agoAArch64: Use a callee save registers for swiftself parameters
Matthias Braun [Wed, 13 Apr 2016 21:43:16 +0000 (21:43 +0000)]
AArch64: Use a callee save registers for swiftself parameters

It is very likely that the swiftself parameter is alive throughout most
functions function so putting it into a callee save register should
avoid spills for the callers with only a minimum amount of extra spills
in the callees.

Currently the generated code is correct but unnecessarily spills and
reloads arguments passed in callee save registers, I will address this
in upcoming patches.

This also adds a missing check that for tail calls the preserved value
of the caller must be the same as the callees parameter.

Differential Revision: http://reviews.llvm.org/D19007

llvm-svn: 266251

8 years ago[llvm-lto] clang-format before working on this file.
Davide Italiano [Wed, 13 Apr 2016 21:41:35 +0000 (21:41 +0000)]
[llvm-lto] clang-format before working on this file.

llvm-svn: 266250

8 years agoReturn immediately from analyzeCall if analyzeBlock returns false.
Easwaran Raman [Wed, 13 Apr 2016 21:20:22 +0000 (21:20 +0000)]
Return immediately from analyzeCall if analyzeBlock returns false.

This is part of the patch reviewed at http://reviews.llvm.org/D17584

llvm-svn: 266249

8 years agoStart to add real error messages for malformed Mach-O files.
Kevin Enderby [Wed, 13 Apr 2016 21:17:58 +0000 (21:17 +0000)]
Start to add real error messages for malformed Mach-O files.
And update the existing test cases in test/Object/macho-invalid.test
to use llvm-objdump with the -macho option to produce these
error messages and stop producing the generic "Invalid data
was encountered while parsing the file" message.

Working from the beginning of the file, if the mach header is too large for
the size of the file and then if the load commands that follow extend past
the end of the file these two errors now generate correct error messages.

Both of these have existing test cases in test/Object/macho-invalid.test .

But the first with macho-invalid-header it will never trigger the error message
"mach header extends past the end of the file" using any of the llvm tools as
they all use identify_magic() which rejects files with the correct magic number
that are too small in size.  So I tested this by hacking that code and seeing the
error message down in parseHeader() really does happen.  So in case there
is ever code in llvm that directly calls createMachOObjectFile() this error
message will be correctly produced.

The second error message of "load commands extends past the end of the file"
is triggered by a number of existing tests cases in test/Object/macho-invalid.test .
Also other tests trigger different error messages now like "ilocalsym plus
nlocalsym in LC_DYSYMTAB load command extends past the end of the
symbol table".

There are two existing test cases that still get the "Invalid data was encountered ..."
error messages that I will tackle next.  But they will involve a bit of pluming an
Expect<...> up through the call stack and I want to do those as separate changes.

FYI, for those test cases that were trying to test specific errors that now get
different errors I’ll fix those in follow on changes and create new test cases
for those so they test the error they were meant to test.

llvm-svn: 266248

8 years agoNFC mergefunc: const correctness
JF Bastien [Wed, 13 Apr 2016 21:12:21 +0000 (21:12 +0000)]
NFC mergefunc: const correctness

Some of the comparators were const others weren't making it annoying to add new comparators which call existing ones.

llvm-svn: 266247

8 years ago[asan] Prefer alloc-dealloc-mismatch to new-delete-type-mismatch.
Evgeniy Stepanov [Wed, 13 Apr 2016 21:04:27 +0000 (21:04 +0000)]
[asan] Prefer alloc-dealloc-mismatch to new-delete-type-mismatch.

With -fsized-deallocation, new[] vs delete mismatch is reported as
new-delete-type-mismatch. This is technically true, but
alloc-dealloc-mismatch describes it better.

llvm-svn: 266246

8 years ago[SemaObjC] Properly handle mix between type arguments and protocols.
Bruno Cardoso Lopes [Wed, 13 Apr 2016 20:59:07 +0000 (20:59 +0000)]
[SemaObjC] Properly handle mix between type arguments and protocols.

Under certain conditions clang currently fails to properly diagnostic ObjectC
parameter list when type args and protocols are mixed in the same list. This
happens when the first item in the parameter list is a (1) protocol, (2)
unknown type or (3) a list of protocols/unknown types up to the first type
argument. Fix the problem to report the proper error, example:

NSArray<M, NSValue *, NSURL, NSArray <id <M>>> *foo = @[@"a"];
NSNumber *bar = foo[0];
NSLog(@"%@", bar);

$ clang ...
x.m:7:13: error: angle brackets contain both a type ('NSValue') and a protocol ('M')
        NSArray<M, NSValue *, NSURL, NSArray <id <M>>> *foo = @[@"a"];
                ~  ^

Differential Revision: http://reviews.llvm.org/D18997

rdar://problem/22204367

llvm-svn: 266245

8 years agoAMDGPU/SI: Add support for spilling VGPRs without having to scavenge registers
Tom Stellard [Wed, 13 Apr 2016 20:44:16 +0000 (20:44 +0000)]
AMDGPU/SI: Add support for spilling VGPRs without having to scavenge registers

Summary:
When we are spilling SGPRs to scratch memory, we usually don't have
free SGPRs to do the address calculation, so we need to re-use the
ScratchOffset register for the calculation.

Reviewers: arsenm

Subscribers: arsenm, llvm-commits

Differential Revision: http://reviews.llvm.org/D18917

llvm-svn: 266244

8 years ago[x86] add tests to show potential BMI optimization
Sanjay Patel [Wed, 13 Apr 2016 20:40:43 +0000 (20:40 +0000)]
[x86] add tests to show potential BMI optimization

llvm-svn: 266243

8 years agoMake sure CheckDestructor gets called on dllimported classes if the vtable is used...
Hans Wennborg [Wed, 13 Apr 2016 20:21:15 +0000 (20:21 +0000)]
Make sure CheckDestructor gets called on dllimported classes if the vtable is used (PR27319)

llvm-svn: 266242

8 years ago[DebugInfo] Optimize memory layout of DISubprogram.
Davide Italiano [Wed, 13 Apr 2016 20:17:42 +0000 (20:17 +0000)]
[DebugInfo] Optimize memory layout of DISubprogram.

A DISubprogram on x86_64 was 48 bytes. During an LTO build we
end up allocating *a lot* of these (see Duncan's numbers on
llvm-dev and/or my numbers in the review link).
This change reduces the size to 40 bytes, with a nice effect
on peak memory usage when LTO'ing clang.
There are more classes in the hierarchy which can be compacted
so more patches will come. DISubprogram was the biggest offender
in my profiling, anyway.

Differential Revision:  http://reviews.llvm.org/D18918

llvm-svn: 266241

8 years ago[PGO] Fix the buildbots for r266229.
Betul Buyukkurt [Wed, 13 Apr 2016 20:02:07 +0000 (20:02 +0000)]
[PGO] Fix the buildbots for r266229.

llvm-svn: 266240

8 years agoLit C++11 Compatibility Patch #7
Charles Li [Wed, 13 Apr 2016 20:00:45 +0000 (20:00 +0000)]
Lit C++11 Compatibility Patch #7

13 tests have been updated for C++11 compatibility.
Differential Revision: http://reviews.llvm.org/D19068

llvm-svn: 266239

8 years agoAsmParser: record "# line file" context to calculate location for diag
Tim Northover [Wed, 13 Apr 2016 19:46:54 +0000 (19:46 +0000)]
AsmParser: record "# line file" context to calculate location for diag

Since we can't emit diagnostics for missing "jmp 1f" labels until the end of
the file, we need to be able to restore the context used to calculate
file/line. This is basically the "# line file" directive that's being used at
the time the expression is seen.

rdar://25706972

llvm-svn: 266238