platform/upstream/llvm.git
7 years ago[ARM] Add ARMISD::VLD1DUP to match vld1_dup more consistently.
Eli Friedman [Fri, 16 Dec 2016 18:44:08 +0000 (18:44 +0000)]
[ARM] Add ARMISD::VLD1DUP to match vld1_dup more consistently.

Currently, there are substantial problems forming vld1_dup even if the
VDUP survives legalization. The lack of an actual node
leads to terrible results: not only can we not form post-increment vld1_dup
instructions, but we form scalar pre-increment and post-increment
loads which force the loaded value into a GPR. This patch fixes that
by combining the vdup+load into an ARMISD node before DAGCombine
messes it up.

Also includes a crash fix for vld2_dup (see testcase @vld2dupi8_postinc_variable).

Recommiting with fix to avoid forming vld1dup if the type of the load
doesn't match the type of the vdup (see
https://llvm.org/bugs/show_bug.cgi?id=31404).

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

llvm-svn: 289972

7 years agoFollow-up for r289831: Lower the unjoined thread count to 100 in the libcxx-future...
Kuba Mracek [Fri, 16 Dec 2016 18:44:01 +0000 (18:44 +0000)]
Follow-up for r289831: Lower the unjoined thread count to 100 in the libcxx-future.mm testcase.

Turns out 1000 unjoined threads are a bit too rough in certain environments.

llvm-svn: 289971

7 years ago[analyzer] Fix crash in MallocChecker.
Devin Coughlin [Fri, 16 Dec 2016 18:41:40 +0000 (18:41 +0000)]
[analyzer] Fix crash in MallocChecker.

Fix a crash in the MallocChecker when the extent size for the argument
to new[] is not known.

A patch by Abramo Bagnara and Dániel Krupp!

https://reviews.llvm.org/D27849

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

llvm-svn: 289970

7 years agoFix name typo in SelectonDAG
Joel Jones [Fri, 16 Dec 2016 18:22:54 +0000 (18:22 +0000)]
Fix name typo in SelectonDAG

llvm-svn: 289969

7 years ago[ELF] - Linkerscript: Implement two argument version of ALIGN()
Rui Ueyama [Fri, 16 Dec 2016 18:19:35 +0000 (18:19 +0000)]
[ELF] - Linkerscript: Implement two argument version of ALIGN()

Fixes http://llvm.org/PR31129

Patch by Alexander Richardson!

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

llvm-svn: 289968

7 years agoAMDGPU: Fix name for v_ashrrev_i16
Matt Arsenault [Fri, 16 Dec 2016 17:40:11 +0000 (17:40 +0000)]
AMDGPU: Fix name for v_ashrrev_i16

llvm-svn: 289967

7 years ago[libFuzzer] Fix index error in SearchMemory() implementation for Windows.
Marcos Pividori [Fri, 16 Dec 2016 17:35:25 +0000 (17:35 +0000)]
[libFuzzer] Fix index error in SearchMemory() implementation for Windows.

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

llvm-svn: 289966

7 years ago[libFuzzer] Remove unnecessary includes of posix headers.
Marcos Pividori [Fri, 16 Dec 2016 17:35:21 +0000 (17:35 +0000)]
[libFuzzer] Remove unnecessary includes of posix headers.

Remove includes of "unistd.h" header, which is missing in non posix
systems.

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

llvm-svn: 289965

7 years ago[libFuzzer] Update tests to use more general functions instead of posix specific.
Marcos Pividori [Fri, 16 Dec 2016 17:35:13 +0000 (17:35 +0000)]
[libFuzzer] Update tests to use more general functions instead of posix specific.

Replace sleep() posix function by a more portable sleep_for() function
from std. Also, ignore memmem() and strcasestr() on Windows.

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

llvm-svn: 289964

7 years ago[CMake] Put headers relative to clang
Chris Bieneman [Fri, 16 Dec 2016 17:30:51 +0000 (17:30 +0000)]
[CMake] Put headers relative to clang

When libcxx isn't building with an installed LLVM we copy the libcxx headers into the LLVM build directory so that a clang in that build tree can find the headers relative to itself.

This is only important in situations where you don't have headers installed under /, which is common these days on Darwin.

llvm-svn: 289963

7 years agoFix -Wself-assign from r289955
Hans Wennborg [Fri, 16 Dec 2016 17:16:46 +0000 (17:16 +0000)]
Fix -Wself-assign from r289955

llvm-svn: 289962

7 years agoRevert "dwarfdump: Support/process relocations on a CU's abbrev_off"
David Blaikie [Fri, 16 Dec 2016 17:10:17 +0000 (17:10 +0000)]
Revert "dwarfdump: Support/process relocations on a CU's abbrev_off"

Reverting because this breaks lld's gdb_index support - it's probably
double counting the abbrev relocation offset.

This reverts commit r289954.

llvm-svn: 289961

7 years agoRevert "[CodeGenPrep] Skip merging empty case blocks"
Jun Bum Lim [Fri, 16 Dec 2016 17:06:14 +0000 (17:06 +0000)]
Revert "[CodeGenPrep] Skip merging empty case blocks"

This reverts commit r289951.

llvm-svn: 289960

7 years ago[InstCombine] auto-generate checks; NFC
Sanjay Patel [Fri, 16 Dec 2016 16:58:54 +0000 (16:58 +0000)]
[InstCombine] auto-generate checks; NFC

llvm-svn: 289959

7 years ago[LV] Don't attempt to type-shrink scalarized instructions
Matthew Simpson [Fri, 16 Dec 2016 16:52:35 +0000 (16:52 +0000)]
[LV] Don't attempt to type-shrink scalarized instructions

After r288909, instructions feeding predicated instructions may be scalarized
if profitable. Since these instructions will remain scalar, we shouldn't
attempt to type-shrink them. We should only truncate vector types to their
minimal bit widths. This bug was exposed by enabling the vectorization of loops
containing conditional stores by default.

llvm-svn: 289958

7 years agoPass sample pgo flags to thinlto.
Dehao Chen [Fri, 16 Dec 2016 16:48:46 +0000 (16:48 +0000)]
Pass sample pgo flags to thinlto.

Summary: ThinLTO needs to invoke SampleProfileLoader pass during link time in order to annotate profile correctly after module importing.

Reviewers: davidxl, mehdi_amini, tejohnson

Subscribers: pcc, davide, llvm-commits, mehdi_amini

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

llvm-svn: 289957

7 years agoFix broken escaping of commands in the build
Luke Drummond [Fri, 16 Dec 2016 16:38:25 +0000 (16:38 +0000)]
Fix broken escaping of commands in the build

A combination of broken escaping in CMake and in the python swig
generation scripts meant that the swig generation step would fail
whenever there were spaces or special characters in parameters passed to
swig.

The fix for this in CMakeLists is to use the VERBATIM option on all
COMMAND-based custom builders relying on CMake to properly escape each
argument in the generated file.

Within the python swig scripts, the fix is to call subprocess.Popen with
a list of raw argument strings rather than ones that are incorrectly
manually escaped, then passed to a shell subprocess via
subprocess.Popen(' '.join(params)). This also prevents nasty things
happening such as accidental command-injection.

This allows us to have the swig / python executables in paths containing
special chars and spaces, (or on shared storage on Win32, e.g
\\some\path or C:\Program Files\swig\swig.exe).

Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D26757

llvm-svn: 289956

7 years ago[X86] Fold (setcc (cmp (atomic_load_add x, -C) C), COND) to (setcc (LADD x, -C),...
Hans Wennborg [Fri, 16 Dec 2016 16:34:59 +0000 (16:34 +0000)]
[X86] Fold (setcc (cmp (atomic_load_add x, -C) C), COND) to (setcc (LADD x, -C), COND) (PR31367)

atomic_load_add returns the value before addition, but sets EFLAGS based on the
result of the addition. That means it's setting the flags based on effectively
subtracting C from the value at x, which is also what the outer cmp does.

This targets a pattern that occurs frequently with reference counting pointers:

  void decrement(long volatile *ptr) {
    if (_InterlockedDecrement(ptr) == 0)
      release();
  }

Clang would previously compile it (for 32-bit at -Os) as:

00000000 <?decrement@@YAXPCJ@Z>:
   0:   8b 44 24 04             mov    0x4(%esp),%eax
   4:   31 c9                   xor    %ecx,%ecx
   6:   49                      dec    %ecx
   7:   f0 0f c1 08             lock xadd %ecx,(%eax)
   b:   83 f9 01                cmp    $0x1,%ecx
   e:   0f 84 00 00 00 00       je     14 <?decrement@@YAXPCJ@Z+0x14>
  14:   c3                      ret

and with this patch it becomes:

00000000 <?decrement@@YAXPCJ@Z>:
   0:   8b 44 24 04             mov    0x4(%esp),%eax
   4:   f0 ff 08                lock decl (%eax)
   7:   0f 84 00 00 00 00       je     d <?decrement@@YAXPCJ@Z+0xd>
   d:   c3                      ret

(Equivalent variants with _InterlockedExchangeAdd, std::atomic<>'s fetch_add
or pre-decrement operator generate the same code.)

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

llvm-svn: 289955

7 years agodwarfdump: Support/process relocations on a CU's abbrev_off
David Blaikie [Fri, 16 Dec 2016 16:31:10 +0000 (16:31 +0000)]
dwarfdump: Support/process relocations on a CU's abbrev_off

Input can be produced by ld -r, for example (a normal LLVM workflow
never hits this - LLVM only ever produces a single abbrev table in an
object (shared by multiple CUs), so the reloc's always 0, and when it's
linked together the relocation's resolved so it doesn't need to be
handled)

llvm-svn: 289954

7 years agoFix debug info metadata for upstream change in LLVM.
Adrian Prantl [Fri, 16 Dec 2016 16:17:24 +0000 (16:17 +0000)]
Fix debug info metadata for upstream change in LLVM.

llvm-svn: 289953

7 years ago[include-fixer] Desugar incomplete types.
Benjamin Kramer [Fri, 16 Dec 2016 16:09:06 +0000 (16:09 +0000)]
[include-fixer] Desugar incomplete types.

This will look through typedefs so include-fixer will look up the target
of the typedef instead of the typedef itself (which is already in
scope).

llvm-svn: 289952

7 years ago[CodeGenPrep] Skip merging empty case blocks
Jun Bum Lim [Fri, 16 Dec 2016 16:03:31 +0000 (16:03 +0000)]
[CodeGenPrep] Skip merging empty case blocks

This is recommit of r287553 after fixing the invalid loop info after eliminating an empty block:

Summary: Merging an empty case block into the header block of switch could cause ISel to add COPY instructions in the header of switch, instead of the case block, if the case block is used as an incoming block of a PHI. This could potentially increase dynamic instructions, especially when the switch is in a loop. I added a test case which was reduced from the benchmark I was targetting.

Reviewers: t.p.northover, mcrosier, manmanren, wmi, joerg, davidxl

Subscribers: joerg, qcolombet, danielcdh, hfinkel, mcrosier, llvm-commits

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

llvm-svn: 289951

7 years ago[X86][AVX] Call lowerVectorShuffleWithSHUFPS directly instead of calling DAG.getVecto...
Simon Pilgrim [Fri, 16 Dec 2016 15:23:32 +0000 (15:23 +0000)]
[X86][AVX] Call lowerVectorShuffleWithSHUFPS directly instead of calling DAG.getVectorShuffle (PR27885)

We've already done the hardwork of ensuring the mask is safe for 'SHUFPS'.

llvm-svn: 289950

7 years agoRemove an unused type declaration.
Hafiz Abid Qadeer [Fri, 16 Dec 2016 14:44:34 +0000 (14:44 +0000)]
Remove an unused type declaration.

llvm-svn: 289947

7 years ago[X86][AVX512] use a single shufps for 512-bit vectors when it can save instructions
Simon Pilgrim [Fri, 16 Dec 2016 14:30:04 +0000 (14:30 +0000)]
[X86][AVX512] use a single shufps for 512-bit vectors when it can save instructions

This is the 512-bit counterpart to the 128-bit transform checked in here:
https://reviews.llvm.org/rL289837

This patch is based on the draft by @sroland (Roland Scheidegger) that is attached to PR27885:
https://llvm.org/bugs/show_bug.cgi?id=27885

llvm-svn: 289946

7 years ago[X86][AVX512] Add tests showing missed opportunity to efficiently lower v16i32 to...
Simon Pilgrim [Fri, 16 Dec 2016 14:21:57 +0000 (14:21 +0000)]
[X86][AVX512] Add tests showing missed opportunity to efficiently lower v16i32 to VSHUFPS (PR27885)

llvm-svn: 289945

7 years agoSpeculatively revert r289925, see PR31407
Nico Weber [Fri, 16 Dec 2016 14:02:28 +0000 (14:02 +0000)]
Speculatively revert r289925, see PR31407

llvm-svn: 289944

7 years ago[MIRParser] Add parsing hex literals of arbitrary size as unsigned integers
Krzysztof Parzyszek [Fri, 16 Dec 2016 13:58:01 +0000 (13:58 +0000)]
[MIRParser] Add parsing hex literals of arbitrary size as unsigned integers

The current code does not parse hex literals larger than 32-bit.

llvm-svn: 289943

7 years agoMove VerifierSupport into namespace llvm.
Daniel Jasper [Fri, 16 Dec 2016 13:53:46 +0000 (13:53 +0000)]
Move VerifierSupport into namespace llvm.

It currently is in an unnamed namespace and then it shouldn't be used
from something in the header file. This actually triggers a warning with
GCC:
../include/llvm/IR/Verifier.h:39:7: warning: ‘llvm::TBAAVerifier’ has a field ‘llvm::TBAAVerifier::Diagnostic’ whose type uses the anonymous namespace [enabled by default]

llvm-svn: 289942

7 years ago[GlobalISel] Silence unused variable warnings in Release builds.
Benjamin Kramer [Fri, 16 Dec 2016 13:13:03 +0000 (13:13 +0000)]
[GlobalISel] Silence unused variable warnings in Release builds.

llvm-svn: 289941

7 years ago[ARM] GlobalISel: Select add i32, i32
Diana Picus [Fri, 16 Dec 2016 12:54:46 +0000 (12:54 +0000)]
[ARM] GlobalISel: Select add i32, i32

Add the minimal support necessary to select a function that returns the sum of
two i32 values.

This includes some support for argument/return lowering of i32 values through
registers, as well as the handling of copy and add instructions throughout the
GlobalISel pipeline.

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

llvm-svn: 289940

7 years ago[analyzer] Add another exception for Qt in MallocChecker
Artem Dergachev [Fri, 16 Dec 2016 12:21:55 +0000 (12:21 +0000)]
[analyzer] Add another exception for Qt in MallocChecker

Treat pointers passed to QObject::connectImpl() as escaping.

rdar://problem/29550440

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

llvm-svn: 289939

7 years ago[ELF] - Accept --sort-section=xxx command form.
George Rimar [Fri, 16 Dec 2016 11:59:52 +0000 (11:59 +0000)]
[ELF] - Accept --sort-section=xxx command form.

--sort-section=xxx is the same as --sort-section xxx,
was found in one of FreeBSD ports.

llvm-svn: 289938

7 years ago[X86][SSE] Combine shuffles to MOVSS/MOVSD whatever the domain.
Simon Pilgrim [Fri, 16 Dec 2016 11:48:51 +0000 (11:48 +0000)]
[X86][SSE] Combine shuffles to MOVSS/MOVSD whatever the domain.

We already do the same thing in shuffle lowering; but don't do it if we have SSE41 (PBLEND) instead.

llvm-svn: 289937

7 years ago[AVR] Add a test for 64-bit left shifts
Dylan McKay [Fri, 16 Dec 2016 11:40:00 +0000 (11:40 +0000)]
[AVR] Add a test for 64-bit left shifts

llvm-svn: 289936

7 years agoRevert r289863: [LV] Enable vectorization of loops with conditional
Chandler Carruth [Fri, 16 Dec 2016 11:31:39 +0000 (11:31 +0000)]
Revert r289863: [LV] Enable vectorization of loops with conditional
stores by default

This uncovers a crasher in the loop vectorizer on PPC when building the
Python runtime. I'll send the testcase to the review thread for the
original commit.

llvm-svn: 289934

7 years ago [codegen] Add generic functions to skip debug values.
Florian Hahn [Fri, 16 Dec 2016 11:10:26 +0000 (11:10 +0000)]
 [codegen] Add generic functions to skip debug values.

Summary:
This commits moves skipDebugInstructionsForward and
skipDebugInstructionsBackward from lib/CodeGen/IfConversion.cpp
to include/llvm/CodeGen/MachineBasicBlock.h and updates
some codgen files to use them.

This refactoring was suggested in https://reviews.llvm.org/D27688
and I thought it's best to do the refactoring in a separate
review, but I could also put both changes in a single review
if that's preferred.

Also, the names for the functions aren't the snappiest and
I would be happy to rename them if anybody has suggestions.

Reviewers: eli.friedman, iteratee, aprantl, MatzeB

Subscribers: MatzeB, llvm-commits

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

llvm-svn: 289933

7 years ago[ARM] Expose methods to get the CCAssignFn. NFCI
Diana Picus [Fri, 16 Dec 2016 10:35:20 +0000 (10:35 +0000)]
[ARM] Expose methods to get the CCAssignFn. NFCI

Add two public methods to ARMTargetLowering: CCAssignFnForCall and
CCAssignFnForReturn, which are just calling the already existing private method
CCAssignFnForNode. These will come in handy for GlobalISel on ARM.

We also replace all calls to CCAssignFnForNode in ARMISelLowering.cpp, because
the new methods are friendlier to the reader.

llvm-svn: 289932

7 years agoExtra coverage tests to demonstrate fixes in D72618 and D26855
Andrew V. Tischenko [Fri, 16 Dec 2016 09:56:02 +0000 (09:56 +0000)]
Extra coverage tests to demonstrate fixes in D72618 and D26855

llvm-svn: 289931

7 years ago[clang-tidy] fix missing anchor for MPI Module
Piotr Padlewski [Fri, 16 Dec 2016 09:14:47 +0000 (09:14 +0000)]
[clang-tidy] fix missing anchor for MPI Module

Summary: MPIModule was not linked to plugins

Reviewers: alexfh, Alexander_Droste, hokein

Subscribers: JDevlieghere, cfe-commits

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

llvm-svn: 289930

7 years agoRevert r289638: [PowerPC] Fix logic dealing with nop after calls (and tail-call eligi...
Chandler Carruth [Fri, 16 Dec 2016 07:31:20 +0000 (07:31 +0000)]
Revert r289638: [PowerPC] Fix logic dealing with nop after calls (and tail-call eligibility)

This patch appears to result in trampolines in vtables being miscompiled
when they in turn tail call a method.

I've posted some preliminary details about the failure on the thread for
this commit and talked to Hal. He was comfortable going ahead and
reverting until we sort out what is wrong.

llvm-svn: 289928

7 years agoExtract a TBAAVerifier out of the verifier (NFC)
Mehdi Amini [Fri, 16 Dec 2016 06:29:14 +0000 (06:29 +0000)]
Extract a TBAAVerifier out of the verifier (NFC)

This is intended to be used (in a later patch) by the BitcodeReader
to detect invalid TBAA and drop them when loading bitcode, so that
we don't break client that have legacy bitcode with possible invalid
TBAA.

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

llvm-svn: 289927

7 years agoattempt to fix windows build
Nico Weber [Fri, 16 Dec 2016 05:13:02 +0000 (05:13 +0000)]
attempt to fix windows build

llvm-svn: 289926

7 years agoUpdate .debug_line section version information to match DWARF version.
Ekaterina Romanova [Fri, 16 Dec 2016 05:10:11 +0000 (05:10 +0000)]
Update .debug_line section version information to match DWARF version.

One more attempt to re-commit the patch r285355, which I had to revert in r285362, because some tests were failing (the reason is because the size of the line_table varied depending on the full file name).

In the past the compiler always emitted .debug_line version 2, though some opcodes from DWARF 3 (e.g. DW_LNS_set_prologue_end, DW_LNS_set_epilogue_begin or DW_LNS_set_isa) and from DWARF 4 could be emitted by the compiler.

This patch changes version information of .debug_line to exactly match the DWARF version. For .debug_line version 4, a new field maximum_operations_per_instruction is emitted.

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

llvm-svn: 289925

7 years agoattempt to fix bots after r289914/r289919
Nico Weber [Fri, 16 Dec 2016 05:03:44 +0000 (05:03 +0000)]
attempt to fix bots after r289914/r289919

llvm-svn: 289924

7 years agoRevert 279703, it caused PR31404.
Nico Weber [Fri, 16 Dec 2016 04:51:25 +0000 (04:51 +0000)]
Revert 279703, it caused PR31404.

llvm-svn: 289923

7 years agoAdd methods to enable using formatv syntax in LLDB.
Zachary Turner [Fri, 16 Dec 2016 04:27:00 +0000 (04:27 +0000)]
Add methods to enable using formatv syntax in LLDB.

This adds formatv-backed formatting functions in various
places in LLDB such as StreamString, logging, constructing
error messages, etc.  A couple of callsites are changed
from Printf style syntax to formatv style syntax to
illustrate its usage.  Additionally, a FileSpec formatter
is introduced so that FileSpecs can be formatted natively.

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

llvm-svn: 289922

7 years agoUpdate for LLVM global variable debug info API change.
Adrian Prantl [Fri, 16 Dec 2016 04:26:15 +0000 (04:26 +0000)]
Update for LLVM global variable debug info API change.

llvm-svn: 289921

7 years ago[IR] Remove the DIExpression field from DIGlobalVariable.
Adrian Prantl [Fri, 16 Dec 2016 04:25:54 +0000 (04:25 +0000)]
[IR] Remove the DIExpression field from DIGlobalVariable.

This patch implements PR31013 by introducing a
DIGlobalVariableExpression that holds a pair of DIGlobalVariable and
DIExpression.

Currently, DIGlobalVariables holds a DIExpression. This is not the
best way to model this:

(1) The DIGlobalVariable should describe the source level variable,
    not how to get to its location.

(2) It makes it unsafe/hard to update the expressions when we call
    replaceExpression on the DIGLobalVariable.

(3) It makes it impossible to represent a global variable that is in
    more than one location (e.g., a variable with multiple
    DW_OP_LLVM_fragment-s).  We also moved away from attaching the
    DIExpression to DILocalVariable for the same reasons.

This reapplies r289902 with additional testcase upgrades.

<rdar://problem/29250149>
https://llvm.org/bugs/show_bug.cgi?id=31013
Differential Revision: https://reviews.llvm.org/D26769

llvm-svn: 289920

7 years agoRemove "-disable-llvm-optzns -verify" from the RUN line.
Akira Hatanaka [Fri, 16 Dec 2016 04:18:53 +0000 (04:18 +0000)]
Remove "-disable-llvm-optzns -verify" from the RUN line.

llvm-svn: 289919

7 years ago[ThinLTO] Thin link efficiency: More efficient export list computation
Teresa Johnson [Fri, 16 Dec 2016 04:11:51 +0000 (04:11 +0000)]
[ThinLTO] Thin link efficiency: More efficient export list computation

Summary:
Instead of checking whether a global referenced by a function being
imported is defined in the same module, speculatively always add the
referenced globals to the module's export list. After all imports are
computed, for each module prune any not in its defined set from its
export list.

For a huge C++ app with aggressive importing thresholds, even with
D27687 we spent a lot of time invoking modulePath() from
exportGlobalInModule (modulePath() was still the 2nd hottest routine in
profile). The reason is that with comdat/linkonce the summary lists for
each GUID can be long. For the app in question, for example, we were
invoking exportGlobalInModule almost 2 million times, and we traversed
an average of 63 entries in the summary list each time.

This patch reduced the thin link time for the app by about 10% (on top
of D27687) when using aggressive importing thresholds, and about 3.5% on
average with default importing thresholds.

Reviewers: mehdi_amini

Subscribers: llvm-commits

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

llvm-svn: 289918

7 years agoAdd extra headers that got deleted by my revert in r289916 but for which
Chandler Carruth [Fri, 16 Dec 2016 04:08:31 +0000 (04:08 +0000)]
Add extra headers that got deleted by my revert in r289916 but for which
new usage had already grown in the file.

llvm-svn: 289917

7 years agoRevert patch series introducing the DAG combine to match a load-by-bytes
Chandler Carruth [Fri, 16 Dec 2016 04:05:22 +0000 (04:05 +0000)]
Revert patch series introducing the DAG combine to match a load-by-bytes
idiom.

r289538: Match load by bytes idiom and fold it into a single load
r289540: Fix a buildbot failure introduced by r289538
r289545: Use more detailed assertion messages in the code ...
r289646: Add a couple of assertions to the load combine code ...

This DAG combine has a bad crash in it that is quite hard to trigger
sadly -- it relies on sneaking code with UB through the SDAG build and
into this particular combine. I've responded to the original commit with
a test case that reproduces it.

However, the code also has other problems that will require substantial
changes to address and so I'm going ahead and reverting it for now. This
should unblock us and perhaps others that are hitting the crash in the
wild and will let a fresh patch with updated approach come in cleanly
afterward.

Sorry for any trouble or disruption!

llvm-svn: 289916

7 years agoCOFF: Cache the result of library searches.
Peter Collingbourne [Fri, 16 Dec 2016 03:45:59 +0000 (03:45 +0000)]
COFF: Cache the result of library searches.

File system operations were still dominating the profile on Windows. In this
case we were spending a significant amount of our time repeatedly searching
for libraries as a result of processing linker directives. Address this
by caching whether we have already found a library with a given name. For
chrome_child.dll:

Before: 10.53s
After: 6.88s

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

llvm-svn: 289915

7 years ago[Sema] Fix handling of enumerators used as default arguments of lambda
Akira Hatanaka [Fri, 16 Dec 2016 03:19:41 +0000 (03:19 +0000)]
[Sema] Fix handling of enumerators used as default arguments of lambda
expressions in a function or class template.

This patch makes the following changes:

- Create a DependentScopeDeclRefExpr for the default argument instead of
  a CXXDependentScopeMemberExpr.
- Pass CombineWithOuterScope=true so that the outer scope in which the
  enum is declared is searched for the instantiation of the enum.

This is the first part of https://reviews.llvm.org/D23096. Fixes PR28795

rdar://problem/27535319

llvm-svn: 289914

7 years agoFix a bug when using a StructuredData darwin-log plugin
Jason Molenda [Fri, 16 Dec 2016 02:48:39 +0000 (02:48 +0000)]
Fix a bug when using a StructuredData darwin-log plugin
where we would insert a breakpoint into a system library
but never remove it, so the second time we ran the binary
there would be two breakpoints and the debugger would
stop there.

<rdar://problem/29654974>

llvm-svn: 289913

7 years ago[clang-tidy] Do not move parameter if only DeclRefExpr occurs inside of a loop
Felix Berger [Fri, 16 Dec 2016 02:47:56 +0000 (02:47 +0000)]
[clang-tidy] Do not move parameter if only DeclRefExpr occurs inside of a loop

Summary: This fixes a bug where the performance-unnecessary-value-param check suggests a fix to move the parameter inside of a loop which could be invoked multiple times.

Reviewers: sbenza, aaron.ballman, alexfh

Subscribers: JDevlieghere, cfe-commits

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

llvm-svn: 289912

7 years ago[SimplifyLibCalls] Use a lambda. NFCI.
Davide Italiano [Fri, 16 Dec 2016 02:28:38 +0000 (02:28 +0000)]
[SimplifyLibCalls] Use a lambda. NFCI.

llvm-svn: 289911

7 years agoclang-format-vsix: add command to format document
Antonio Maiorano [Fri, 16 Dec 2016 01:51:43 +0000 (01:51 +0000)]
clang-format-vsix: add command to format document

Bound to Ctrl+R, Ctrl+D by default. Also added section on how to debug the extension to the Readme.

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

llvm-svn: 289910

7 years agoclang-format-vsix: add a date stamp to the VSIX version number to ensure upgradability
Antonio Maiorano [Fri, 16 Dec 2016 01:37:01 +0000 (01:37 +0000)]
clang-format-vsix: add a date stamp to the VSIX version number to ensure upgradability

Presently, the version number of the VSIX matches the LLVM version number. However, as this number doesn't change often, it means that as we release new versions of this VSIX, it will have the same version number, which means users must first uninstall the old version before installing the new one. With this change, we generate a 4th part to the version number that is a date stamp (year, month, day); for example: 4.0.0.161203.

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

llvm-svn: 289909

7 years agoRevert "Update for LLVM global variable debug info API change."
Adrian Prantl [Fri, 16 Dec 2016 01:01:40 +0000 (01:01 +0000)]
Revert "Update for LLVM global variable debug info API change."

This reverts commit 289901 while investigating bot breakage.

llvm-svn: 289908

7 years ago[Hexagon] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Fri, 16 Dec 2016 01:00:40 +0000 (01:00 +0000)]
[Hexagon] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 289907

7 years agoRevert "[IR] Remove the DIExpression field from DIGlobalVariable."
Adrian Prantl [Fri, 16 Dec 2016 01:00:30 +0000 (01:00 +0000)]
Revert "[IR] Remove the DIExpression field from DIGlobalVariable."

This reverts commit 289902 while investigating bot berakage.

llvm-svn: 289906

7 years ago[c++1z] P0195R2: Allow multiple using-declarators in a single using-declaration.
Richard Smith [Fri, 16 Dec 2016 00:58:48 +0000 (00:58 +0000)]
[c++1z] P0195R2: Allow multiple using-declarators in a single using-declaration.

llvm-svn: 289905

7 years ago[APFloatTest] Log when test fails. NFC
Tim Shen [Fri, 16 Dec 2016 00:47:17 +0000 (00:47 +0000)]
[APFloatTest] Log when test fails. NFC

Reviewers: iteratee

Subscribers: llvm-commits

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

llvm-svn: 289904

7 years agoAdd missing library dep.
Peter Collingbourne [Fri, 16 Dec 2016 00:43:00 +0000 (00:43 +0000)]
Add missing library dep.

llvm-svn: 289903

7 years ago[IR] Remove the DIExpression field from DIGlobalVariable.
Adrian Prantl [Fri, 16 Dec 2016 00:36:43 +0000 (00:36 +0000)]
[IR] Remove the DIExpression field from DIGlobalVariable.

This patch implements PR31013 by introducing a
DIGlobalVariableExpression that holds a pair of DIGlobalVariable and
DIExpression.

Currently, DIGlobalVariables holds a DIExpression. This is not the
best way to model this:

(1) The DIGlobalVariable should describe the source level variable,
    not how to get to its location.

(2) It makes it unsafe/hard to update the expressions when we call
    replaceExpression on the DIGLobalVariable.

(3) It makes it impossible to represent a global variable that is in
    more than one location (e.g., a variable with multiple
    DW_OP_LLVM_fragment-s).  We also moved away from attaching the
    DIExpression to DILocalVariable for the same reasons.

<rdar://problem/29250149>
https://llvm.org/bugs/show_bug.cgi?id=31013
Differential Revision: https://reviews.llvm.org/D26769

llvm-svn: 289902

7 years agoUpdate for LLVM global variable debug info API change.
Adrian Prantl [Fri, 16 Dec 2016 00:35:42 +0000 (00:35 +0000)]
Update for LLVM global variable debug info API change.

llvm-svn: 289901

7 years ago[PPC] corrections in two testcases
Ehsan Amiri [Fri, 16 Dec 2016 00:33:07 +0000 (00:33 +0000)]
[PPC] corrections in two testcases

Removing sensitivity to scheduling (by using CHECK-DAG instead of CHECK) and
some other minor corrections.

In preparation to commit Power9 processor model.

llvm-svn: 289900

7 years agoIPO: Introduce ThinLTOBitcodeWriter pass.
Peter Collingbourne [Fri, 16 Dec 2016 00:26:30 +0000 (00:26 +0000)]
IPO: Introduce ThinLTOBitcodeWriter pass.

This pass prepares a module containing type metadata for ThinLTO by splitting
it into regular and thin LTO parts if possible, and writing both parts to
a multi-module bitcode file. Modules that do not contain type metadata are
written unmodified as a single module.

All globals with type metadata are added to the regular LTO module, and
the rest are added to the thin LTO module.

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

llvm-svn: 289899

7 years ago[AArch64] Add FeatureSlowMisaligned128Store to Exynos M1 and M2
Evandro Menezes [Fri, 16 Dec 2016 00:18:00 +0000 (00:18 +0000)]
[AArch64] Add FeatureSlowMisaligned128Store to Exynos M1 and M2

This feature now gates such stores after r289845.  Thus the Exynos
processors now need this feature.

llvm-svn: 289898

7 years agoFix typo in error messages. NFC.
Kelvin Li [Fri, 16 Dec 2016 00:15:54 +0000 (00:15 +0000)]
Fix typo in error messages. NFC.

llvm-svn: 289897

7 years ago[ThinLTO] Thin link efficiency improvement: don't re-export globals (NFC)
Teresa Johnson [Thu, 15 Dec 2016 23:50:06 +0000 (23:50 +0000)]
[ThinLTO] Thin link efficiency improvement: don't re-export globals (NFC)

Summary:
We were reinvoking exportGlobalInModule numerous times redundantly.
No need to re-export globals referenced by a global that was already
imported from its module. This resulted in a large speedup in the thin
link for a big application, particularly when importing aggressiveness
was cranked up.

Reviewers: mehdi_amini

Subscribers: llvm-commits

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

llvm-svn: 289896

7 years ago[SimplifyLibCalls] Add a test to make sure we lower fls(0) correctly.
Davide Italiano [Thu, 15 Dec 2016 23:48:07 +0000 (23:48 +0000)]
[SimplifyLibCalls] Add a test to make sure we lower fls(0) correctly.

llvm-svn: 289895

7 years ago[SimplifyLibCalls] Lower fls() to llvm.ctlz().
Davide Italiano [Thu, 15 Dec 2016 23:45:11 +0000 (23:45 +0000)]
[SimplifyLibCalls] Lower fls() to llvm.ctlz().

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

llvm-svn: 289894

7 years agoDebugInfo: Make a Generic test case actually generic (remove datalayout/triple)
David Blaikie [Thu, 15 Dec 2016 23:39:25 +0000 (23:39 +0000)]
DebugInfo: Make a Generic test case actually generic (remove datalayout/triple)

llvm-svn: 289893

7 years agoDebugInfo: Address non-deterministic output (iterating a SmallPtrSet) in 289697
David Blaikie [Thu, 15 Dec 2016 23:37:38 +0000 (23:37 +0000)]
DebugInfo: Address non-deterministic output (iterating a SmallPtrSet) in 289697

Post-commit review feedback from Adrian Prantl.

Hopefully this fixes that up :)

llvm-svn: 289892

7 years ago[IRTranslator] Merge the entry and ABI lowering blocks.
Quentin Colombet [Thu, 15 Dec 2016 23:32:25 +0000 (23:32 +0000)]
[IRTranslator] Merge the entry and ABI lowering blocks.

The IRTranslator uses an additional block before the LLVM-IR entry block
to perform all the ABI lowering and the constant hoisting. Thus, this
block is the actual entry block and it falls through the LLVM-IR entry
block. However, with such representation, we end up with two basic
blocks that are not maximal.

Therefore, this patch adds a bit of canonicalization by merging both the
LLVM-IR entry block and the ABI lowering/constants hoisting into one
block, making the resulting block more likely to be maximal (indeed the
LLVM-IR entry block might not have been maximal).

llvm-svn: 289891

7 years ago[sanitizer] Passthrough CMAKE_OSX_DEPLOYMENT_TARGET and CMAKE_OSX_SYSROOT when buildi...
Kuba Mracek [Thu, 15 Dec 2016 23:20:54 +0000 (23:20 +0000)]
[sanitizer] Passthrough CMAKE_OSX_DEPLOYMENT_TARGET and CMAKE_OSX_SYSROOT when building compiler-rt from clang/runtime/CMakeLists.txt

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

llvm-svn: 289890

7 years agoDebugInfo: Emit ranges for functions with DISubprograms but lacking locations on...
David Blaikie [Thu, 15 Dec 2016 23:17:52 +0000 (23:17 +0000)]
DebugInfo: Emit ranges for functions with DISubprograms but lacking locations on any instructions

This seems more consistent, and helps tidy up/simplify some other code
in this change.

llvm-svn: 289889

7 years ago[SimplifyLibCalls] Remove redundant folding logic for ffs().
Davide Italiano [Thu, 15 Dec 2016 23:11:00 +0000 (23:11 +0000)]
[SimplifyLibCalls] Remove redundant folding logic for ffs().

Lowering to llvm.cttz() will result in constant folding anyway
if the argument to ffs is a constant. Pointed out by Eli for
fls() in D14590.

llvm-svn: 289888

7 years ago[asan][docs] Fix the documentation to use clang++ for the C++ example
Anna Zaks [Thu, 15 Dec 2016 22:55:21 +0000 (22:55 +0000)]
[asan][docs] Fix the documentation to use clang++ for the C++ example

After Darwin has been updated not to link in stdc++ on Darwin this actually
started to break.

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

llvm-svn: 289887

7 years ago[analyzer] Teach the analyzer that pointers can escape into __cxa_demangle
Anna Zaks [Thu, 15 Dec 2016 22:55:18 +0000 (22:55 +0000)]
[analyzer] Teach the analyzer that pointers can escape into __cxa_demangle

This fixes a reported false positive in the malloc checker.

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

llvm-svn: 289886

7 years ago[analyzer] Refine the diagnostics in the nullability checker to differentiate between...
Anna Zaks [Thu, 15 Dec 2016 22:55:15 +0000 (22:55 +0000)]
[analyzer] Refine the diagnostics in the nullability checker to differentiate between nil and null

This is a big deal for ObjC, where nullability annotations are extensively
used. I've also changed "Null" -> "null" and removed "is" as this is the
pattern that Sema is using.

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

llvm-svn: 289885

7 years ago[analyzer] Refer to macro names in diagnostics for macros representing a literal
Anna Zaks [Thu, 15 Dec 2016 22:55:11 +0000 (22:55 +0000)]
[analyzer] Refer to macro names in diagnostics for macros representing a literal

When a macro expending to a literal is used in a comparison, use the macro name
in the diagnostic rather than the literal. This improves readability of path
notes.

Added tests for various macro literals that could occur. Only BOOl, Int, and
NULL tests have changed behavior with this patch.

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

llvm-svn: 289884

7 years ago[analyzer] Include type name in Retain Count Checker diagnostics
Anna Zaks [Thu, 15 Dec 2016 22:55:03 +0000 (22:55 +0000)]
[analyzer] Include type name in Retain Count Checker diagnostics

The more detailed diagnostic will make identifying which object the
diagnostics refer to easier.

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

llvm-svn: 289883

7 years agoDon't combine splats with other shuffles.
Eli Friedman [Thu, 15 Dec 2016 22:41:40 +0000 (22:41 +0000)]
Don't combine splats with other shuffles.

We sometimes end up creating shuffles which are worse than the obvious
translation of the IR.

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

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

llvm-svn: 289882

7 years agoIfdef out utmp.h on Darwin to un-break the build after r289878 ([msan] Intercept...
Kuba Mracek [Thu, 15 Dec 2016 22:40:24 +0000 (22:40 +0000)]
Ifdef out utmp.h on Darwin to un-break the build after r289878 ([msan] Intercept getutent and friends).

llvm-svn: 289881

7 years agoFix R_AARCH64_MOVW_UABS_G3 relocation
Yichao Yu [Thu, 15 Dec 2016 22:36:53 +0000 (22:36 +0000)]
Fix R_AARCH64_MOVW_UABS_G3 relocation

Summary: The relocation is missing mask so an address that has non-zero bits in 47:43 may overwrite the register number. (Frequently shows up as target register changed to `xzr`....)

Reviewers: t.p.northover, lhames

Subscribers: davide, aemerson, rengolin, llvm-commits

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

llvm-svn: 289880

7 years ago[CMake] Refactor LLDB libraries and tools to be components
Chris Bieneman [Thu, 15 Dec 2016 22:01:17 +0000 (22:01 +0000)]
[CMake] Refactor LLDB libraries and tools to be components

In LLVM's CMake we have a convention that components have both a build and an install target. Making LLDB follow this convention will allow LLDB to take advantage of the LLVM_DISTRIBUTION_COMPONENTS build option from LLVM.

llvm-svn: 289879

7 years ago[msan] Intercept getutent and friends.
Evgeniy Stepanov [Thu, 15 Dec 2016 22:00:14 +0000 (22:00 +0000)]
[msan] Intercept getutent and friends.

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

llvm-svn: 289878

7 years agoAMDGPU: Select branch on undef to uniform scc branch
Matt Arsenault [Thu, 15 Dec 2016 21:57:11 +0000 (21:57 +0000)]
AMDGPU: Select branch on undef to uniform scc branch

llvm-svn: 289877

7 years ago[gold] Add datalayout to test where it was missing
Teresa Johnson [Thu, 15 Dec 2016 21:42:56 +0000 (21:42 +0000)]
[gold] Add datalayout to test where it was missing

Needed due to change to require datalayout (r289719).

Found this in my own testing, maybe there aren't any bots using a v1.12
gold yet.

llvm-svn: 289876

7 years ago[ThinLTO] Revert part of r289843 that belonged to another patch.
Teresa Johnson [Thu, 15 Dec 2016 21:39:42 +0000 (21:39 +0000)]
[ThinLTO] Revert part of r289843 that belonged to another patch.

The code change for D27687 accidentally got committed along with the
main change in r289843. Revert it temporarily, so that I can recommit it
along with its test as intended.

llvm-svn: 289875

7 years agoDon't combine a shuffle of two BUILD_VECTORs with duplicate elements.
Eli Friedman [Thu, 15 Dec 2016 21:36:59 +0000 (21:36 +0000)]
Don't combine a shuffle of two BUILD_VECTORs with duplicate elements.

Targets can't handle this case well in general; we often transform
a shuffle of two cheap BUILD_VECTORs to element-by-element insertion,
which is very inefficient.

Fixes https://llvm.org/bugs/show_bug.cgi?id=31364 . Partially
fixes https://llvm.org/bugs/show_bug.cgi?id=31301.

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

llvm-svn: 289874

7 years ago[analyzer] Add a new SVal to support pointer-to-member operations.
Devin Coughlin [Thu, 15 Dec 2016 21:27:06 +0000 (21:27 +0000)]
[analyzer] Add a new SVal to support pointer-to-member operations.

Add a new type of NonLoc SVal for C++ pointer-to-member operations. This SVal
supports both pointers to member functions and pointers to member data.

A patch by Kirill Romanenkov!

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

llvm-svn: 289873

7 years ago[Verifier] Allow TBAA metadata on atomicrmw and atomiccmpxchg
Sanjoy Das [Thu, 15 Dec 2016 21:23:44 +0000 (21:23 +0000)]
[Verifier] Allow TBAA metadata on atomicrmw and atomiccmpxchg

This used to be allowed before r289402 by default (before r289402 you
could have TBAA metadata on any instruction), and while I'm not sure
that it helps, it does sound reasonable enough to not fail the verifier
and we have out-of-tree users who use this.

llvm-svn: 289872

7 years ago[ThinLTO] Remove stale comment (NFC)
Teresa Johnson [Thu, 15 Dec 2016 20:53:31 +0000 (20:53 +0000)]
[ThinLTO] Remove stale comment (NFC)

This should have been removed with r288446.

llvm-svn: 289871

7 years agoAdd a class ASTRecordReader which wraps an ASTReader, a RecordData, and ModuleFile.
David L. Jones [Thu, 15 Dec 2016 20:53:26 +0000 (20:53 +0000)]
Add a class ASTRecordReader which wraps an ASTReader, a RecordData, and ModuleFile.

Summary:
When reading an ASTRecord, each RecordData is logically contained within a
single ModuleFile, and global(er) state is contained by a single ASTReader. This
means that any operations that read from a RecordData and reference an ASTReader
or a ModuleFile, will always reference the same ASTReader or ModuleFile.
ASTRecordReader groups these together so that parameters don't need to be
duplicated ad infinitum. Most uses of the Idx variable seem to be redunant
aliases as well, but I'll leave that for now.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 289870

7 years ago[PPC] Use CHECK-DAG instead of CHECK in the testcase
Ehsan Amiri [Thu, 15 Dec 2016 20:51:09 +0000 (20:51 +0000)]
[PPC] Use CHECK-DAG instead of CHECK in the testcase

This test is currently sensitive to scheduling. Using CHECK-DAG allows us to
preserve the main purpose of the test and remove this sensivity.

In preparation to commit Power9 processor model.

llvm-svn: 289869