platform/upstream/llvm.git
8 years agoRemove flaky decorator from two tests on linux
Pavel Labath [Mon, 25 Apr 2016 10:32:23 +0000 (10:32 +0000)]
Remove flaky decorator from two tests on linux

The flakyness is no longer reproducible, and the tests seem to be passing reliably now.

llvm-svn: 267392

8 years ago[ELF] Delete extra line. NFC
Simon Atanasyan [Mon, 25 Apr 2016 10:18:48 +0000 (10:18 +0000)]
[ELF] Delete extra line. NFC

llvm-svn: 267391

8 years ago[Coverage] Restore the correct count value after processing a nested region in case...
Igor Kudrin [Mon, 25 Apr 2016 09:43:37 +0000 (09:43 +0000)]
[Coverage] Restore the correct count value after processing a nested region in case of combined regions.

If several regions cover the same area of code, we have to restore
the combined value for that area when return from a nested region.

This patch achieves that by combining regions before calling buildSegments.

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

llvm-svn: 267390

8 years ago[SCEV] Improve the run-time checking of the NoWrap predicate
Silviu Baranga [Mon, 25 Apr 2016 09:27:16 +0000 (09:27 +0000)]
[SCEV] Improve the run-time checking of the NoWrap predicate

Summary:
This implements a new method of run-time checking the NoWrap
SCEV predicates, which should be easier to optimize and nicer
for targets that don't correctly handle multiplication/addition
of large integer types (like i128).

If the AddRec is {a,+,b} and the backedge taken count is c,
the idea is to check that |b| * c doesn't have unsigned overflow,
and depending on the sign of b, that:

   a + |b| * c >= a (b >= 0) or
   a - |b| * c <= a (b <= 0)

where the comparisons above are signed or unsigned, depending on
the flag that we're checking.

The advantage of doing this is that we avoid extending to a larger
type and we avoid the multiplication of large types (multiplying
i128 can be expensive).

Reviewers: sanjoy

Subscribers: llvm-commits, mzolotukhin

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

llvm-svn: 267389

8 years ago[PowerPC] [PR27387] Disallow r0 for ADD8TLS.
Marcin Koscielnicki [Mon, 25 Apr 2016 09:24:34 +0000 (09:24 +0000)]
[PowerPC] [PR27387] Disallow r0 for ADD8TLS.

ADD8TLS, a variant of add instruction used for initial-exec TLS,
currently accepts r0 as a source register.  While add itself supports
r0 just fine, linker can relax it to a local-exec sequence, converting
it to addi - which doesn't support r0.

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

llvm-svn: 267388

8 years agoRun GlobalOpt before emitting the bitcode for ThinLTO
Mehdi Amini [Mon, 25 Apr 2016 08:47:49 +0000 (08:47 +0000)]
Run GlobalOpt before emitting the bitcode for ThinLTO

This is motivated by reducing the size of the IR and thus reduce
compile time.

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

8 years agoThinLTO: Move createNameAnonFunctionPass insertion in PassManagerBuilder (NFC)
Mehdi Amini [Mon, 25 Apr 2016 08:47:37 +0000 (08:47 +0000)]
ThinLTO: Move createNameAnonFunctionPass insertion in PassManagerBuilder (NFC)

It is just code motion, but makes more sense this way.

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

8 years agofix comments
Igor Breger [Mon, 25 Apr 2016 08:30:28 +0000 (08:30 +0000)]
fix comments
related to
Differential Revision: http://reviews.llvm.org/D17913

llvm-svn: 267383

8 years ago[ELF] - Implemented comparsion operators for linkerscript.
George Rimar [Mon, 25 Apr 2016 08:14:41 +0000 (08:14 +0000)]
[ELF] - Implemented comparsion operators for linkerscript.

Patch adds support of <,>,!=,==,>=,<= operators.

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

llvm-svn: 267382

8 years ago[ELF] - Removed dead declarations. NFC.
George Rimar [Mon, 25 Apr 2016 08:08:54 +0000 (08:08 +0000)]
[ELF] - Removed dead declarations. NFC.

llvm-svn: 267381

8 years ago[Clang][AVX512][BuiltIn] Adding support to intrinsics of VPERMD and VPERMW instructio...
Michael Zuckerman [Mon, 25 Apr 2016 05:32:35 +0000 (05:32 +0000)]
[Clang][AVX512][BuiltIn] Adding support to intrinsics of VPERMD and VPERMW instruction set

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

llvm-svn: 267380

8 years agoFixing wrong mask size error. From __mmask8 to __mmask16.
Michael Zuckerman [Mon, 25 Apr 2016 05:27:51 +0000 (05:27 +0000)]
Fixing wrong mask size error. From __mmask8 to __mmask16.
Was reviewed over the shoulder by AsafBadouh.
Connected to review http://reviews.llvm.org/D19195.

llvm-svn: 267379

8 years ago[Support/ELFRelocs] Add R_386_GOT32X.
Davide Italiano [Mon, 25 Apr 2016 04:38:08 +0000 (04:38 +0000)]
[Support/ELFRelocs] Add R_386_GOT32X.

The new relocation recently defined in the Intel386 psABI
was still missing from this file. A subsequent commit will
add support for GOT32X in MC, together with a test.

llvm-svn: 267378

8 years ago[X86] Replace a SmallVector used to pass 2 values to an ArrayRef parameter with a...
Craig Topper [Mon, 25 Apr 2016 04:30:29 +0000 (04:30 +0000)]
[X86] Replace a SmallVector used to pass 2 values to an ArrayRef parameter with a fixed size array. NFC

llvm-svn: 267377

8 years ago[esan] Fix uninitialized warning from interception context
Derek Bruening [Mon, 25 Apr 2016 03:56:20 +0000 (03:56 +0000)]
[esan] Fix uninitialized warning from interception context

The interception context is not used by esan, but the compiler complains
about it being uninitialized all the same.  We set it to null to avoid the
warning.

llvm-svn: 267376

8 years agoMinor code cleanups. NFC.
Junmo Park [Mon, 25 Apr 2016 01:40:54 +0000 (01:40 +0000)]
Minor code cleanups. NFC.

llvm-svn: 267375

8 years ago[llgo] llgoi: separate evaluation from printing
Andrew Wilkins [Mon, 25 Apr 2016 01:18:20 +0000 (01:18 +0000)]
[llgo] llgoi: separate evaluation from printing

Summary:
Separate the evaluation of expressions from printing
of results. This is in preparation for splitting the
core of the interpreter out for use in alternative
interpreter frontends.

At the same time, the output is made less noisy in
response to comments on the golang-nuts announcement.
We would ideally print out values using Go syntax,
but this is impractical until we have libgo based on
Go 1.5. When that happens, fmt's %#v will handle
reflect.Value better, and so we can fix/filter type
names to remove automatically generated package names.

Reviewers: pcc

Subscribers: llvm-commits, axw

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

llvm-svn: 267374

8 years ago[X86] Add a complete set of tests for all operand sizes of cttz/ctlz with and without...
Craig Topper [Mon, 25 Apr 2016 01:01:15 +0000 (01:01 +0000)]
[X86] Add a complete set of tests for all operand sizes of cttz/ctlz with and without zero undef being lowered to bsf/bsr.

llvm-svn: 267373

8 years agoAdd a --element-count option to the expression command
Enrico Granata [Mon, 25 Apr 2016 00:52:47 +0000 (00:52 +0000)]
Add a --element-count option to the expression command
This option evaluates an expression and, if the result is of pointer type, treats it as if it was an array of that many elements and displays such elements

This has a couple subtle points but is mostly as straightforward as it sounds

Add a parray N <expr> alias for this new mode

Also, extend the --object-description mode to do the moral equivalent of the above but display each element in --object-description mode
Add a poarray N <expr> alias for this

llvm-svn: 267372

8 years agoAdd a note to the test explaining why it doesn't match gold's behaviour.
Peter Collingbourne [Mon, 25 Apr 2016 00:19:47 +0000 (00:19 +0000)]
Add a note to the test explaining why it doesn't match gold's behaviour.

llvm-svn: 267371

8 years agoVerifier: Verify that each inlinable callsite of a debug-info-bearing function
Adrian Prantl [Sun, 24 Apr 2016 22:23:13 +0000 (22:23 +0000)]
Verifier: Verify that each inlinable callsite of a debug-info-bearing function
in a debug-info-bearing function has a debug location attached to it. Failure to
do so causes an "!dbg attachment points at wrong subprogram for function"
assertion failure when the inliner sets up inline scope info.

rdar://problem/25878916

This reaplies r267320 without changes after fixing an issue in the OpenMP IR
generator in clang.

llvm-svn: 267370

8 years agoDebug info: Apply an empty debug location for global OpenMP destructors.
Adrian Prantl [Sun, 24 Apr 2016 22:22:29 +0000 (22:22 +0000)]
Debug info: Apply an empty debug location for global OpenMP destructors.
LLVM really wants a debug location on every inlinable call in a function
with debug info, because it otherwise cannot set up inlining debug info.

This change applies an artificial line 0 debug location (which is how
DWARF marks automatically generated code that has no corresponding
source code) to the .__kmpc_global_dtor_. functions to avoid the
LLVM Verifier complaining.

llvm-svn: 267369

8 years agoclang-format: [JS] generator and async functions.
Martin Probst [Sun, 24 Apr 2016 22:05:09 +0000 (22:05 +0000)]
clang-format: [JS] generator and async functions.

For generators, see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_generators
async functions are not quite in the spec yet, but stage 3 and already widely used:
http://tc39.github.io/ecmascript-asyncawait/

Reviewers: djasper

Subscribers: klimek

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

llvm-svn: 267368

8 years agoAlso check the IR.
Rafael Espindola [Sun, 24 Apr 2016 21:42:56 +0000 (21:42 +0000)]
Also check the IR.

llvm-svn: 267367

8 years agoAdd a test for how we handle protected visibility.
Rafael Espindola [Sun, 24 Apr 2016 21:30:18 +0000 (21:30 +0000)]
Add a test for how we handle protected visibility.

llvm-svn: 267366

8 years agounwind: remove unnecessary header
Saleem Abdulrasool [Sun, 24 Apr 2016 21:01:04 +0000 (21:01 +0000)]
unwind: remove unnecessary header

Availablity.h is not used within config.h.  The locations which use the
availability infrastructure already include the necessary header(s).  NFC.

llvm-svn: 267365

8 years agounwind: unify _LIBUNWIND_ABORT
Saleem Abdulrasool [Sun, 24 Apr 2016 21:00:59 +0000 (21:00 +0000)]
unwind: unify _LIBUNWIND_ABORT

Rather than use the `__assert_rtn` on libSystem based targets and a local
`assert_rtn` function on others, expand the function definition into a macro
which will perform the writing to stderr and then abort.  This unifies the
definition and behaviour across targets.

Ensure that we flush stderr prior to aborting.

llvm-svn: 267364

8 years agoFix unwind failures when PC points beyond the end of a function
Ulrich Weigand [Sun, 24 Apr 2016 20:49:56 +0000 (20:49 +0000)]
Fix unwind failures when PC points beyond the end of a function

RegisterContextLLDB::InitializeNonZerothFrame already has code to attempt
to detect and handle the case where the PC points beyond the end of a
function, but there are certain cases where this doesn't work correctly.

In fact, there are *two* different places where this detection is attempted,
and the failure is in fact a result of an unfortunate interaction between
those two separate attempts.

First, the ResolveSymbolContextForAddress routine is called with the
resolve_tail_call_address flag set to true.  This causes the routine
to internally accept a PC pointing beyond the end of a function, and
still resolving the PC to that function symbol.

Second, the InitializeNonZerothFrame routine itself maintains a
"decr_pc_and_recompute_addr_range" flag and, if that turns out to
be true, itself decrements the PC by one and searches again for
a symbol at that new PC value.

Both approaches correctly identify the symbol associated with the PC.
However, the problem is now that later on, we also need to find the
DWARF CFI record associated with the PC.  This is done in the
RegisterContextLLDB::GetFullUnwindPlanForFrame routine, and uses
the "m_current_offset_backed_up_one" member variable.

However, that variable only actually contains the PC "backed up by
one" if the *second* approach above was taken.  If the function was
already identified via the first approach above, that member variable
is *not* backed up by one but simply points to the original PC.
This in turn causes GetEHFrameUnwindPlan to not correctly identify
the DWARF CFI record associated with the PC.

Now, in many cases, if the first method had to back up the PC by one,
we *still* use the second method too, because of this piece of code:

    // Or if we're in the middle of the stack (and not "above" an asynchronous event like sigtramp),
    // and our "current" pc is the start of a function...
    if (m_sym_ctx_valid
        && GetNextFrame()->m_frame_type != eTrapHandlerFrame
        && GetNextFrame()->m_frame_type != eDebuggerFrame
        && addr_range.GetBaseAddress().IsValid()
        && addr_range.GetBaseAddress().GetSection() == m_current_pc.GetSection()
        && addr_range.GetBaseAddress().GetOffset() == m_current_pc.GetOffset())
    {
        decr_pc_and_recompute_addr_range = true;
    }

In many cases, when the PC is one beyond the end of the current function,
it will indeed then be exactly at the start of the next function.  But this
is not always the case, e.g. if there happens to be alignment padding
between the end of one function and the start of the next.

In those cases, we may sucessfully look up the function symbol via
ResolveSymbolContextForAddress, but *not* set decr_pc_and_recompute_addr_range,
and therefore fail to find the correct DWARF CFI record.

A very simple fix for this problem is to just never use the first method.
Call ResolveSymbolContextForAddress with resolve_tail_call_address set
to false, which will cause it to fail if the PC is beyond the end of
the current function; or else, identify the next function if the PC
is also at the start of the next function.  In either case, we will
then set the decr_pc_and_recompute_addr_range variable and back up the
PC anyway, but this time also find the correct DWARF CFI.

A related problem is that the ResolveSymbolContextForAddress sometimes
returns a "symbol" with empty name.  This turns out to be an ELF section
symbol.  Now, usually those get type eSymbolTypeInvalid.  However, there
is code in ObjectFileELF::ParseSymbols that tries to change the type of
invalid symbols to eSymbolTypeCode or eSymbolTypeData if the symbol
lies within the code or data section.

Unfortunately, this check also hits the symbol for the code section
itself, which is then marked as eSymbolTypeCode.  While the size of
the section symbol is 0 according to the ELF file, LLDB considers
this size invalid and attempts to figure out the "correct" size.
Depending on how this goes, we may end up with a symbol that overlays
part of the code section, even outside areas covered by real function
symbols.

Therefore, if we call ResolveSymbolContextForAddress with PC pointing
beyond the end of a function, we may get this bogus section symbol.
This again means InitializeNonZerothFrame thinks we have a valid PC,
but then we don't find any unwind info for it.

The fix for this problem is me to simply always leave ELF section
symbols as type eSymbolTypeInvalid.

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

llvm-svn: 267363

8 years ago[X86][AVX] Added PR24935 test case
Simon Pilgrim [Sun, 24 Apr 2016 20:30:48 +0000 (20:30 +0000)]
[X86][AVX] Added PR24935 test case

llvm-svn: 267362

8 years agoARM: fix __chkstk Frame Setup on WoA
Saleem Abdulrasool [Sun, 24 Apr 2016 20:12:48 +0000 (20:12 +0000)]
ARM: fix __chkstk Frame Setup on WoA

This corrects the MI annotations for the stack adjustment following the __chkstk
invocation.  We were marking the original SP usage as a Def rather than Kill.
The (new) assigned value is the definition, the original reference is killed.

Adjust the ISelLowering to mark Kills and FrameSetup as well.

This partially resolves PR27480.

llvm-svn: 267361

8 years agoTweak comments to make it clear that these combines are for SSE scalar instructions.
Simon Pilgrim [Sun, 24 Apr 2016 19:31:56 +0000 (19:31 +0000)]
Tweak comments to make it clear that these combines are for SSE scalar instructions.

llvm-svn: 267360

8 years ago[InstCombine][SSE] Reduce DIVSS/DIVSD to FDIV if only first element is required
Simon Pilgrim [Sun, 24 Apr 2016 18:35:59 +0000 (18:35 +0000)]
[InstCombine][SSE] Reduce DIVSS/DIVSD to FDIV if only first element is required

As discussed on D19318, if we only demand the first element of a DIVSS/DIVSD intrinsic, then reduce to a FDIV call. This matches the existing FADD/FSUB/FMUL patterns.

llvm-svn: 267359

8 years ago[ELF] Reinstate 'else' which was previously removed.
Davide Italiano [Sun, 24 Apr 2016 18:23:21 +0000 (18:23 +0000)]
[ELF] Reinstate 'else' which was previously removed.

It turns out it's actually needed.

llvm-svn: 267358

8 years ago[InstCombine][SSE] Demanded vector elements for scalar intrinsics (Part 2 of 2)
Simon Pilgrim [Sun, 24 Apr 2016 18:23:14 +0000 (18:23 +0000)]
[InstCombine][SSE] Demanded vector elements for scalar intrinsics (Part 2 of 2)

Split from D17490. This patch improves support for determining the demanded vector elements through SSE scalar intrinsics:

1 - demanded vector element support for unary and some extra binary scalar intrinsics (RCP/RSQRT/SQRT/FRCZ and ADD/CMP/DIV/ROUND).

2 - addss/addsd get simplified to a fadd call if we aren't interested in the pass through elements

3 - if we don't need the lowest element of a scalar operation then just use the first argument (the pass through elements) directly

We can add support for propagating demanded elements through any equivalent packed SSE intrinsics in a future patch (these wouldn't use the pass through patterns).

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

llvm-svn: 267357

8 years ago[InstCombine][SSE] Demanded vector elements for scalar intrinsics (Part 1 of 2)
Simon Pilgrim [Sun, 24 Apr 2016 18:12:42 +0000 (18:12 +0000)]
[InstCombine][SSE] Demanded vector elements for scalar intrinsics (Part 1 of 2)

This patch improves support for determining the demanded vector elements through SSE scalar intrinsics:

1 - recognise that we only need the lowest element of the second input for binary scalar operations (and all the elements of the first input)

2 - recognise that the roundss/roundsd intrinsics use the lowest element of the second input and the remaining elements from the first input

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

llvm-svn: 267356

8 years ago[InstCombine] Avoid updating argument demanded elements in separate passes.
Simon Pilgrim [Sun, 24 Apr 2016 17:57:27 +0000 (17:57 +0000)]
[InstCombine] Avoid updating argument demanded elements in separate passes.

As discussed on D17490, we should attempt to update an intrinsic's arguments demanded elements in one pass if we can.

llvm-svn: 267355

8 years agoFix typo in comment. NFC
Nick Lewycky [Sun, 24 Apr 2016 17:55:57 +0000 (17:55 +0000)]
Fix typo in comment. NFC

llvm-svn: 267354

8 years agoRemove emacs mode markers from .cpp files. NFC
Nick Lewycky [Sun, 24 Apr 2016 17:55:41 +0000 (17:55 +0000)]
Remove emacs mode markers from .cpp files. NFC

.cpp files are unambiguously C++, you only need the mode markers on .h files.

llvm-svn: 267353

8 years ago[X86][InstCombine] Tidyup VPERMILVAR -> shufflevector conversion to helper function...
Simon Pilgrim [Sun, 24 Apr 2016 17:23:46 +0000 (17:23 +0000)]
[X86][InstCombine] Tidyup VPERMILVAR -> shufflevector conversion to helper function. NFCI.

llvm-svn: 267352

8 years ago[X86][InstCombine] Tidyup PSHUFB -> shufflevector conversion to helper function....
Simon Pilgrim [Sun, 24 Apr 2016 17:00:34 +0000 (17:00 +0000)]
[X86][InstCombine] Tidyup PSHUFB -> shufflevector conversion to helper function. NFCI.

llvm-svn: 267351

8 years ago[X86][SSE] getTargetShuffleMaskIndices - dropped (unused) UNDEF handling
Simon Pilgrim [Sun, 24 Apr 2016 16:49:53 +0000 (16:49 +0000)]
[X86][SSE] getTargetShuffleMaskIndices - dropped (unused) UNDEF handling

We aren't currently making use of this in any successful mask decode and its actually incorrect as it inserts the wrong number of SM_SentinelUndef mask elements.

llvm-svn: 267350

8 years ago[X86][SSE] Use range loop. NFCI.
Simon Pilgrim [Sun, 24 Apr 2016 16:33:35 +0000 (16:33 +0000)]
[X86][SSE] Use range loop. NFCI.

llvm-svn: 267349

8 years ago[Lanai] Use EVT::getEVTString() to print a type as a string instead of an enum encodi...
Craig Topper [Sun, 24 Apr 2016 16:30:51 +0000 (16:30 +0000)]
[Lanai] Use EVT::getEVTString() to print a type as a string instead of an enum encoding value.

llvm-svn: 267348

8 years ago[X86][SSE] Added SSSE3/AVX/AVX2 BITREVERSE tests
Simon Pilgrim [Sun, 24 Apr 2016 15:45:06 +0000 (15:45 +0000)]
[X86][SSE] Added SSSE3/AVX/AVX2 BITREVERSE tests

Codegen is pretty bad at the moment but could use PSHUFB quite efficiently

llvm-svn: 267347

8 years ago[X86][XOP] Fixed VPPERM permute op decoding (PR27472).
Simon Pilgrim [Sun, 24 Apr 2016 15:05:04 +0000 (15:05 +0000)]
[X86][XOP] Fixed VPPERM permute op decoding (PR27472).

Fixed issue with VPPERM target shuffle mask decoding that was incorrectly masking off the 3-bit permute op with a 2-bit mask.

llvm-svn: 267346

8 years agoBitcodeReader: Delay metadata parsing until reading a function body
Duncan P. N. Exon Smith [Sun, 24 Apr 2016 15:04:28 +0000 (15:04 +0000)]
BitcodeReader: Delay metadata parsing until reading a function body

There's hardly any functionality change here.  Instead of calling
materializeMetadata on the first call to materialize(GlobalValue*), wait
until the first one that's actually going to do something.  Noticed by
inspection; I don't have a concrete case where this makes a difference.

Added an assertion in materializeMetadata to be sure this (or a future
change) doesn't delay materializeMetadata after function-level metadata.

llvm-svn: 267345

8 years ago[ThinLTO] Remove GlobalValueInfo class from index
Teresa Johnson [Sun, 24 Apr 2016 14:57:11 +0000 (14:57 +0000)]
[ThinLTO] Remove GlobalValueInfo class from index

Summary:
Remove the GlobalValueInfo and change the ModuleSummaryIndex to directly
reference summary objects. The info structure was there to support lazy
parsing of the combined index summary objects, which is no longer
needed and not supported.

Reviewers: joker.eph

Subscribers: joker.eph, llvm-commits

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

llvm-svn: 267344

8 years ago[X86][SSE] Improved support for decoding target shuffle masks through bitcasts
Simon Pilgrim [Sun, 24 Apr 2016 14:53:54 +0000 (14:53 +0000)]
[X86][SSE] Improved support for decoding target shuffle masks through bitcasts

Reused the ability to split constants of a type wider than the shuffle mask to work with masks generated from scalar constants transfered to xmm.

This fixes an issue preventing PSHUFB target shuffle masks decoding rematerialized scalar constants and also exposes the XOP VPPERM bug described in PR27472.

llvm-svn: 267343

8 years agoModuleSummaryIndex: Avoid enum bitfields for MSVC portability
Duncan P. N. Exon Smith [Sun, 24 Apr 2016 14:25:37 +0000 (14:25 +0000)]
ModuleSummaryIndex: Avoid enum bitfields for MSVC portability

Enum bitfields have crazy portability issues with MSVC.  Use unsigned
instead of LinkageTypes here in the ModuleSummaryIndex to address
Takumi's concerns from r267335.

llvm-svn: 267342

8 years agoRevert "Declare GlobalValue::LinkageTypes based on unsigned."
Duncan P. N. Exon Smith [Sun, 24 Apr 2016 14:13:17 +0000 (14:13 +0000)]
Revert "Declare GlobalValue::LinkageTypes based on unsigned."

This reverts commit r267335.  The build has been broken for hours
because of it:

  http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/23352/

The correct fix is avoid using any enum in a bitfield.

llvm-svn: 267341

8 years ago[SystemZ] [SSP] Add support for LOAD_STACK_GUARD.
Marcin Koscielnicki [Sun, 24 Apr 2016 13:57:49 +0000 (13:57 +0000)]
[SystemZ] [SSP] Add support for LOAD_STACK_GUARD.

This fixes PR22248 on s390x.  The previous attempt at this was D19101,
which was before LOAD_STACK_GUARD existed.  Compared to the previous
version, this always emits a rather ugly block of 4 instructions, involving
a thread pointer load that can't be shared with other potential users.
However, this is necessary for SSP - spilling the guard value (or thread
pointer used to load it) is counter to the goal, since it could be
overwritten along with the frame it protects.

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

llvm-svn: 267340

8 years ago[X86][SSE] Demonstrate issue with decoding shuffle masks that have been lowered as...
Simon Pilgrim [Sun, 24 Apr 2016 13:45:30 +0000 (13:45 +0000)]
[X86][SSE] Demonstrate issue with decoding shuffle masks that have been lowered as rematerialized constants on scalar unit

Found whilst investigating PR27472

llvm-svn: 267339

8 years agoImprove diagnostic checking for va_start to also warn on other instances of undefined...
Aaron Ballman [Sun, 24 Apr 2016 13:30:21 +0000 (13:30 +0000)]
Improve diagnostic checking for va_start to also warn on other instances of undefined behavior, such as a parameter declared with the register keyword in C, or a parameter of a type that undergoes default argument promotion.

This helps cover some more of the CERT secure coding rule EXP58-CPP. Pass an object of the correct type to va_start (https://www.securecoding.cert.org/confluence/display/cplusplus/EXP58-CPP.+Pass+an+object+of+the+correct+type+to+va_start).

llvm-svn: 267338

8 years agoSilence two C4806 warnings ('|': unsafe operation: no value of type 'bool' promoted...
Aaron Ballman [Sun, 24 Apr 2016 13:03:20 +0000 (13:03 +0000)]
Silence two C4806 warnings ('|': unsafe operation: no value of type 'bool' promoted to type 'const unsigned int' can equal the given constant). The fact that they trigger with this code seems like it may be a bug, but the warning itself is still generally useful enough to retain it for now.

llvm-svn: 267337

8 years agoRemove unused iterators [NFC]
Johannes Doerfert [Sun, 24 Apr 2016 12:31:02 +0000 (12:31 +0000)]
Remove unused iterators [NFC]

llvm-svn: 267336

8 years agoDeclare GlobalValue::LinkageTypes based on unsigned.
NAKAMURA Takumi [Sun, 24 Apr 2016 10:11:45 +0000 (10:11 +0000)]
Declare GlobalValue::LinkageTypes based on unsigned.

Or, "LinkageTypes Linkage : 4;" might be sign-extended on msc.

llvm-svn: 267335

8 years agollvm/test/tools/gold/X86/thinlto.ll: Possible fix corresponding to r267318.
NAKAMURA Takumi [Sun, 24 Apr 2016 08:02:00 +0000 (08:02 +0000)]
llvm/test/tools/gold/X86/thinlto.ll: Possible fix corresponding to r267318.

llvm-svn: 267334

8 years ago[ELF] Simplify. Remove unneeded else. NFC.
Davide Italiano [Sun, 24 Apr 2016 07:19:32 +0000 (07:19 +0000)]
[ELF] Simplify. Remove unneeded else. NFC.

llvm-svn: 267333

8 years agoBitcodeReader: Fix some holes in upgrade from r267296
Duncan P. N. Exon Smith [Sun, 24 Apr 2016 06:52:01 +0000 (06:52 +0000)]
BitcodeReader: Fix some holes in upgrade from r267296

Add tests for some missing cases to bitcode upgrade in r267296.

  - DICompositeType with an 'elements:' field, which will cause it to be
    involved in a cycle after the upgrade.

  - A DIDerivedType that references a class in 'extraData:'.

I updated test/Bitcode/dityperefs-3.8.ll with the missing cases and
regenerated test/Bitcode/dityperefs-3.8.ll.bc.

llvm-svn: 267332

8 years ago[X86] Merge LowerCTLZ and LowerCTLZ_ZERO_UNDEF into a single function that branches...
Craig Topper [Sun, 24 Apr 2016 06:27:39 +0000 (06:27 +0000)]
[X86] Merge LowerCTLZ and LowerCTLZ_ZERO_UNDEF into a single function that branches internally for the one difference, allowing the rest of the code to be common. NFC

llvm-svn: 267331

8 years ago[X86] Node need to check if AVX512 is supported when lowering vector CTLZ. The CTLZ...
Craig Topper [Sun, 24 Apr 2016 06:27:35 +0000 (06:27 +0000)]
[X86] Node need to check if AVX512 is supported when lowering vector CTLZ. The CTLZ operation is only Custom for vectors if AVX512 is enabled so if a vector gets here AVX512 is implied. NFC

llvm-svn: 267330

8 years agoAdd "hasSection" flag in the Summary
Mehdi Amini [Sun, 24 Apr 2016 05:31:43 +0000 (05:31 +0000)]
Add "hasSection" flag in the Summary

Reviewers: tejohnson

Subscribers: llvm-commits

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

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

8 years ago[MachineCombiner] Support for floating-point FMA on ARM64 (re-commit r267098)
Gerolf Hoflehner [Sun, 24 Apr 2016 05:14:01 +0000 (05:14 +0000)]
[MachineCombiner] Support for floating-point FMA on ARM64 (re-commit r267098)

The original patch caused crashes because it could derefence a null pointer
for SelectionDAGTargetInfo for targets that do not define it.

Evaluates fmul+fadd -> fmadd combines and similar code sequences in the
machine combiner. It adds support for float and double similar to the existing
integer implementation. The key features are:

- DAGCombiner checks whether it should combine greedily or let the machine
combiner do the evaluation. This is only supported on ARM64.
- It gives preference to throughput over latency: the heuristic used is
to combine always in loops. The targets decides whether the machine
combiner should optimize for throughput or latency.
- Supports for fmadd, f(n)msub, fmla, fmls patterns
- On by default at O3 ffast-math

llvm-svn: 267328

8 years ago[ELF][MIPS] Add test case to check creation of GOT entries for weak symbols. NFC
Simon Atanasyan [Sun, 24 Apr 2016 05:08:43 +0000 (05:08 +0000)]
[ELF][MIPS] Add test case to check creation of GOT entries for weak symbols. NFC

llvm-svn: 267327

8 years ago[X86] Remove isel patterns for selecting tzcnt/lzcnt from cmove/ne+cttz/ctlz. These...
Craig Topper [Sun, 24 Apr 2016 04:38:34 +0000 (04:38 +0000)]
[X86] Remove isel patterns for selecting tzcnt/lzcnt from cmove/ne+cttz/ctlz. These are folded by DAG combine now.

llvm-svn: 267326

8 years ago[CodeGen] Teach DAG combine to fold select_cc seteq X, 0, sizeof(X), ctlz_zero_undef...
Craig Topper [Sun, 24 Apr 2016 04:38:32 +0000 (04:38 +0000)]
[CodeGen] Teach DAG combine to fold select_cc seteq X, 0, sizeof(X), ctlz_zero_undef(X) -> ctlz(X). InstCombine already does this for IR and X86 pattern matches this during isel.

A follow up commit will remove the X86 patterns to allow this to be tested.

llvm-svn: 267325

8 years agoFix an assertion that can never fire because the condition ANDed with the string...
Craig Topper [Sun, 24 Apr 2016 04:38:29 +0000 (04:38 +0000)]
Fix an assertion that can never fire because the condition ANDed with the string is just true or 1.

llvm-svn: 267324

8 years agoELF: Simplify preemption logic. Do not include weak undefined symbols in non-DSOs.
Peter Collingbourne [Sun, 24 Apr 2016 04:29:59 +0000 (04:29 +0000)]
ELF: Simplify preemption logic. Do not include weak undefined symbols in non-DSOs.
Add a test for -Bsymbolic + undefined symbols.

llvm-svn: 267323

8 years agoRevert "Verifier: Verify that each inlinable callsite of a debug-info-bearing function"
Adrian Prantl [Sun, 24 Apr 2016 03:47:37 +0000 (03:47 +0000)]
Revert "Verifier: Verify that each inlinable callsite of a debug-info-bearing function"

This reverts commit r267320 while investigating an OpenMP buildbot failure.

llvm-svn: 267322

8 years agoMake thinlto clang test more robust against LLVM changes.
Mehdi Amini [Sun, 24 Apr 2016 03:44:55 +0000 (03:44 +0000)]
Make thinlto clang test more robust against LLVM changes.

We should just test the effect of the clang level option here, i.e.
that a summary is correctly emitted with -flto=thin

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

8 years agoVerifier: Verify that each inlinable callsite of a debug-info-bearing function
Adrian Prantl [Sun, 24 Apr 2016 03:23:02 +0000 (03:23 +0000)]
Verifier: Verify that each inlinable callsite of a debug-info-bearing function
in a debug-info-bearing function has a debug location attached to it. Failure to
do so causes an "!dbg attachment points at wrong subprogram for function"
assertion failure when the inliner sets up inline scope info.

rdar://problem/25878916

llvm-svn: 267320

8 years agoReorganize GlobalValueSummary with a "Flags" bitfield.
Mehdi Amini [Sun, 24 Apr 2016 03:18:18 +0000 (03:18 +0000)]
Reorganize GlobalValueSummary with a "Flags" bitfield.

Right now it only contains the LinkageType, but will be extended
with "hasSection", "isOptSize", "hasInlineAssembly", etc.

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

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

8 years agoAdd a version field in the bitcode for the summary
Mehdi Amini [Sun, 24 Apr 2016 03:18:11 +0000 (03:18 +0000)]
Add a version field in the bitcode for the summary

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

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

8 years agoAdd an internalization step to the ThinLTOCodeGenerator
Mehdi Amini [Sun, 24 Apr 2016 03:18:01 +0000 (03:18 +0000)]
Add an internalization step to the ThinLTOCodeGenerator

Keeping as much as possible internal/private is
known to help the optimizer. Let's try to benefit from
this in ThinLTO.
Note: this is early work, but is enough to build clang (and
all the LLVM tools). I still need to write some lit-tests...

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

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

8 years agoTest what I intended to test.
Peter Collingbourne [Sun, 24 Apr 2016 02:42:34 +0000 (02:42 +0000)]
Test what I intended to test.

llvm-svn: 267316

8 years agoELF: Forbid undefined symbols with non-default visibility in DSOs.
Peter Collingbourne [Sun, 24 Apr 2016 02:31:04 +0000 (02:31 +0000)]
ELF: Forbid undefined symbols with non-default visibility in DSOs.

llvm-svn: 267315

8 years agoELF: Always include undefined DSO symbols in the symbol table.
Peter Collingbourne [Sun, 24 Apr 2016 02:31:02 +0000 (02:31 +0000)]
ELF: Always include undefined DSO symbols in the symbol table.

Fixes check-llvm when bootstrapping.

Also remove mostly dead and most likely incorrect logic regarding preemption
of weak undefined symbols.

llvm-svn: 267314

8 years agoFix a couple assertions that can never fire because the condition ANDed with the...
Craig Topper [Sun, 24 Apr 2016 02:08:22 +0000 (02:08 +0000)]
Fix a couple assertions that can never fire because the condition ANDed with the string is just true or 1.

llvm-svn: 267313

8 years agoFix a couple assertions that can never fire because they just contained the text...
Craig Topper [Sun, 24 Apr 2016 02:01:25 +0000 (02:01 +0000)]
Fix a couple assertions that can never fire because they just contained the text string which always evaluates to true. Add a ! so they'll evaluate to false.

llvm-svn: 267312

8 years ago[X86] Fix patterns that turn cmove/cmovne+ctlz/cttz into lzcnt/tzcnt instructions...
Craig Topper [Sun, 24 Apr 2016 02:01:22 +0000 (02:01 +0000)]
[X86] Fix patterns that turn cmove/cmovne+ctlz/cttz into lzcnt/tzcnt instructions. Only one of the conditions should be valid for each pattern, not both. Update tests accordingly.

llvm-svn: 267311

8 years ago[ELF] Use llvm-mc rather than checking in a file.
Davide Italiano [Sun, 24 Apr 2016 01:56:02 +0000 (01:56 +0000)]
[ELF] Use llvm-mc rather than checking in a file.

Now that the support for the 'new' relocations is available.

llvm-svn: 267310

8 years ago[RuntimeDyldELF] Handle GOTPCRELX/REX_GOTPCRELX.
Davide Italiano [Sun, 24 Apr 2016 01:36:37 +0000 (01:36 +0000)]
[RuntimeDyldELF] Handle GOTPCRELX/REX_GOTPCRELX.

llvm-svn: 267309

8 years ago[MC/ELF] Make the relaxation test more interesting.
Davide Italiano [Sun, 24 Apr 2016 01:08:35 +0000 (01:08 +0000)]
[MC/ELF] Make the relaxation test more interesting.

Add a case where we can't relax.

llvm-svn: 267308

8 years ago[MC/ELF] Implement support for GOTPCRELX/REX_GOTPCRELX.
Davide Italiano [Sun, 24 Apr 2016 01:03:57 +0000 (01:03 +0000)]
[MC/ELF] Implement support for GOTPCRELX/REX_GOTPCRELX.

The option to control the emission of the new relocations
is -relax-relocations (blatantly copied from GNU as).
It can't be enabled by default because it breaks relatively
recent versions of ld.bfd/ld.gold (late 2015).

llvm-svn: 267307

8 years agoRelax test using CHECK-DAG instead of CHECK-NEXT
Mehdi Amini [Sun, 24 Apr 2016 00:25:15 +0000 (00:25 +0000)]
Relax test using CHECK-DAG instead of CHECK-NEXT

It seems we still have some ordering issue in the combined index
emission, but I can't figure out why right now.

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

8 years agoFix test stability (was sensitive to the path)
Mehdi Amini [Sun, 24 Apr 2016 00:03:57 +0000 (00:03 +0000)]
Fix test stability (was sensitive to the path)

This is a fixup for r267304.
The test was sensitive to the path in a subtle way:
the index in memory is sorted by GUID, which are hashes
that include the source filename for local globals.
Teresa recently added a directive at the IR level, so
we can specify it here to make the test independent of
the path.

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

8 years agoStore and emit original name in combined index
Mehdi Amini [Sat, 23 Apr 2016 23:38:17 +0000 (23:38 +0000)]
Store and emit original name in combined index

Summary:
As discussed in D18298, some local globals can't
be renamed/promoted (because they have a section, or because
they are referenced from inline assembly).
To be able to detect naming collision, we need to keep around
the "GUID" using their original name without taking the linkage
into account.

Reviewers: tejohnson

Subscribers: joker.eph, llvm-commits

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

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

8 years agoAlways traverse GlobalVariable initializer when computing the export list
Mehdi Amini [Sat, 23 Apr 2016 23:29:24 +0000 (23:29 +0000)]
Always traverse GlobalVariable initializer when computing the export list

Summary:
We are always importing the initializer for a GlobalVariable.
So if a GlobalVariable is in the export-list, we pull in any
refs as well.

Reviewers: tejohnson

Subscribers: llvm-commits

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

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

8 years agoDebugInfo: DIGlobalVariables became 'distinct' in LLVM r267301
Duncan P. N. Exon Smith [Sat, 23 Apr 2016 22:29:26 +0000 (22:29 +0000)]
DebugInfo: DIGlobalVariables became 'distinct' in LLVM r267301

Update testcases due to DIBuilder change.

llvm-svn: 267302

8 years agoDebugInfo: Change DIBuilder to make distinct DIGlobalVariables
Duncan P. N. Exon Smith [Sat, 23 Apr 2016 22:29:09 +0000 (22:29 +0000)]
DebugInfo: Change DIBuilder to make distinct DIGlobalVariables

A long overdue change to make DIGlobalVariable distinct.  Much like
DISubprogram definitions (changed in r246098), it isn't logical to
unique DIGlobalVariable definitions from two different compile units.

(Longer-term, we should also find a way to reverse the link between
GlobalVariable and DIGlobalVariable, and between DIGlobalVariable and
DICompileUnit, so that debug info to do with optimized-out globals
disappears.  Admittedly it's harder than with Function/DISubprogram,
since global variables may be constant-folded and the debug info should
still describe that somehow.)

llvm-svn: 267301

8 years ago[MC/ELF] Pass Fixup to getRelocType64.
Davide Italiano [Sat, 23 Apr 2016 22:26:31 +0000 (22:26 +0000)]
[MC/ELF] Pass Fixup to getRelocType64.

In preparation for other changes.

llvm-svn: 267300

8 years agoBitcodeReader: Avoid std::vector with non-movable types from r267296
Duncan P. N. Exon Smith [Sat, 23 Apr 2016 21:36:59 +0000 (21:36 +0000)]
BitcodeReader: Avoid std::vector with non-movable types from r267296

r267298 didn't quite fix the build errors.  Use SmallVector instead of
std::vector, the latter of which I think is trying to maintain a strong
exception safety guarantee.

http://lab.llvm.org:8011/builders/lldb-amd64-ninja-freebsd11/builds/6228

llvm-svn: 267299

8 years agoBitcodeReader: Avoid non-moving std::piecewise_construct from r267296
Duncan P. N. Exon Smith [Sat, 23 Apr 2016 21:23:41 +0000 (21:23 +0000)]
BitcodeReader: Avoid non-moving std::piecewise_construct from r267296

Not exactly sure why the host tries to use a copy constructor here, but
it's easy enough to work around it.

http://lab.llvm.org:8011/builders/lldb-amd64-ninja-freebsd11/builds/6227

llvm-svn: 267298

8 years agoDebugInfo: Adapt to loss of DITypeRef in LLVM r267296
Duncan P. N. Exon Smith [Sat, 23 Apr 2016 21:08:27 +0000 (21:08 +0000)]
DebugInfo: Adapt to loss of DITypeRef in LLVM r267296

LLVM stopped using MDString-based type references, and DIBuilder no
longer fills 'retainedTypes:' with every DICompositeType that has an
'identifier:' field.   There are just minor changes to keep the same
behaviour in CFE.

Leaving 'retainedTypes:' unfilled has a dramatic impact on the output
order of the IR though.  There are a huge number of testcase changes,
which were unfortunately not really scriptable.

llvm-svn: 267297

8 years agoDebugInfo: Remove MDString-based type references
Duncan P. N. Exon Smith [Sat, 23 Apr 2016 21:08:00 +0000 (21:08 +0000)]
DebugInfo: Remove MDString-based type references

Eliminate DITypeIdentifierMap and make DITypeRef a thin wrapper around
DIType*.  It is no longer legal to refer to a DICompositeType by its
'identifier:', and DIBuilder no longer retains all types with an
'identifier:' automatically.

Aside from the bitcode upgrade, this is mainly removing logic to resolve
an MDString-based reference to an actualy DIType.  The commits leading
up to this have made the implicit type map in DICompileUnit's
'retainedTypes:' field superfluous.

This does not remove DITypeRef, DIScopeRef, DINodeRef, and
DITypeRefArray, or stop using them in DI-related metadata.  Although as
of this commit they aren't serving a useful purpose, there are patchces
under review to reuse them for CodeView support.

The tests in LLVM were updated with deref-typerefs.sh, which is attached
to the thread "[RFC] Lazy-loading of debug info metadata":

  http://lists.llvm.org/pipermail/llvm-dev/2016-April/098318.html

llvm-svn: 267296

8 years agoreplace duplicated static functions for profile metadata access with BranchInst membe...
Sanjay Patel [Sat, 23 Apr 2016 20:01:22 +0000 (20:01 +0000)]
replace duplicated static functions for profile metadata access with BranchInst member function; NFCI

llvm-svn: 267295

8 years agoRevert "[AArch64] Fix optimizeCondBranch logic."
Renato Golin [Sat, 23 Apr 2016 19:30:52 +0000 (19:30 +0000)]
Revert "[AArch64] Fix optimizeCondBranch logic."

This reverts commit r267206, as it broke self-hosting on AArch64.

llvm-svn: 267294

8 years ago[esan] EfficiencySanitizer libc interceptors
Derek Bruening [Sat, 23 Apr 2016 16:41:24 +0000 (16:41 +0000)]
[esan] EfficiencySanitizer libc interceptors

Summary:
Adds libc interceptors to the runtime library for the new
EfficiencySanitizer ("esan") family of tools.  The interceptors cover
the memory operations in most common library calls and will be shared
among all esan tools.

Reviewers: aizatsky

Subscribers: zhaoqin, tberghammer, danalbert, srhines, llvm-commits, vitalybuka, eugenis, kcc

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

llvm-svn: 267293

8 years agoimprove documentation comments; NFC
Sanjay Patel [Sat, 23 Apr 2016 16:31:48 +0000 (16:31 +0000)]
improve documentation comments; NFC

llvm-svn: 267292

8 years agoObjectFile: parse EABI Attributes
Saleem Abdulrasool [Sat, 23 Apr 2016 16:00:15 +0000 (16:00 +0000)]
ObjectFile: parse EABI Attributes

This adds basic parsing of the EABI attributes section.  This section contains
additional information about the target for which the file was built.  Attempt
to infer additional architecture information from that section.

llvm-svn: 267291