platform/upstream/llvm.git
7 years agoIR: fix some doxygen grammar (NFC)
Saleem Abdulrasool [Fri, 28 Apr 2017 17:18:28 +0000 (17:18 +0000)]
IR: fix some doxygen grammar (NFC)

Fix a bit of the doxygen grammar that was off that I noticed while
looking at this file for another issue.

llvm-svn: 301658

7 years agoCOFF: actually synthesize CONST imports properly
Saleem Abdulrasool [Fri, 28 Apr 2017 17:06:40 +0000 (17:06 +0000)]
COFF: actually synthesize CONST imports properly

CONSTANT imports expect both the `_imp_` prefixed and non-prefixed
symbols should be added to the symbol table.  This allows for linking
symbols like _NSConcreteGlobalBlock in WinObjC.  The previous change
would generate the import library properly by handling the option but
would not consume the generated entry properly.

llvm-svn: 301657

7 years ago[APInt] Add clearSignBit method. Use it and setSignBit in a few places. NFCI
Craig Topper [Fri, 28 Apr 2017 16:58:05 +0000 (16:58 +0000)]
[APInt] Add clearSignBit method. Use it and setSignBit in a few places. NFCI

llvm-svn: 301656

7 years ago[LazyValueInfo] Fix typo in comment. NFC
Craig Topper [Fri, 28 Apr 2017 16:57:59 +0000 (16:57 +0000)]
[LazyValueInfo] Fix typo in comment. NFC

llvm-svn: 301655

7 years ago[ValueTracking] Use APInt::isSubsetOf and APInt::intersects. NFC
Craig Topper [Fri, 28 Apr 2017 16:57:55 +0000 (16:57 +0000)]
[ValueTracking] Use APInt::isSubsetOf and APInt::intersects. NFC

llvm-svn: 301654

7 years ago[bpf] add bigendian support to disassembler
Alexei Starovoitov [Fri, 28 Apr 2017 16:51:01 +0000 (16:51 +0000)]
[bpf] add bigendian support to disassembler

. swap 4-bit register encoding, 16-bit offset and 32-bit imm to support big endian archs
. add a test

Reported-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
llvm-svn: 301653

7 years ago[DOXYGEN] Minor improvements in doxygen comments.
Ekaterina Romanova [Fri, 28 Apr 2017 16:45:39 +0000 (16:45 +0000)]
[DOXYGEN] Minor improvements in doxygen comments.

- I removed doxygen comments for the intrinsics that "alias" the other existing documented intrinsics and that only sligtly differ in spelling (single underscores vs. double underscores).
 #define _tzcnt_u16(a)     (__tzcnt_u16((a)))

It will be very hard to keep the documentation for these "aliases" in sync with the documentation for the intrinsics they alias to. Out of sync documentation will be more confusing than no documentation.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream.

llvm-svn: 301652

7 years ago[clang-tidy] modernize-use-emplace: remove unnecessary make_pair calls
Jakub Kuderski [Fri, 28 Apr 2017 16:25:45 +0000 (16:25 +0000)]
[clang-tidy] modernize-use-emplace: remove unnecessary make_pair calls

Summary:
When there is a push_back with a call to make_pair, turn it into emplace_back and remove the unnecessary make_pair call.

Eg.

```
std::vector<std::pair<int, int>> v;
v.push_back(std::make_pair(1, 2)); // --> v.emplace_back(1, 2);
```

make_pair doesn't get removed when explicit template parameters are provided, because of potential problems with type conversions.

Reviewers: Prazek, aaron.ballman, hokein, alexfh

Reviewed By: Prazek, alexfh

Subscribers: JDevlieghere, JonasToth, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 301651

7 years agoCMake: ignore git stderr when trying to sort out revision. NFC.
Tim Northover [Fri, 28 Apr 2017 16:06:00 +0000 (16:06 +0000)]
CMake: ignore git stderr when trying to sort out revision. NFC.

llvm-svn: 301650

7 years ago[InlineCost] Improve the cost heuristic for Switch
Jun Bum Lim [Fri, 28 Apr 2017 16:04:03 +0000 (16:04 +0000)]
[InlineCost] Improve the cost heuristic for Switch

Summary:
The motivation example is like below which has 13 cases but only 2 distinct targets

```
lor.lhs.false2:                                   ; preds = %if.then
  switch i32 %Status, label %if.then27 [
    i32 -7012, label %if.end35
    i32 -10008, label %if.end35
    i32 -10016, label %if.end35
    i32 15000, label %if.end35
    i32 14013, label %if.end35
    i32 10114, label %if.end35
    i32 10107, label %if.end35
    i32 10105, label %if.end35
    i32 10013, label %if.end35
    i32 10011, label %if.end35
    i32 7008, label %if.end35
    i32 7007, label %if.end35
    i32 5002, label %if.end35
  ]
```
which is compiled into a balanced binary tree like this on AArch64 (similar on X86)

```
.LBB853_9:                              // %lor.lhs.false2
        mov     w8, #10012
        cmp             w19, w8
        b.gt    .LBB853_14
// BB#10:                               // %lor.lhs.false2
        mov     w8, #5001
        cmp             w19, w8
        b.gt    .LBB853_18
// BB#11:                               // %lor.lhs.false2
        mov     w8, #-10016
        cmp             w19, w8
        b.eq    .LBB853_23
// BB#12:                               // %lor.lhs.false2
        mov     w8, #-10008
        cmp             w19, w8
        b.eq    .LBB853_23
// BB#13:                               // %lor.lhs.false2
        mov     w8, #-7012
        cmp             w19, w8
        b.eq    .LBB853_23
        b       .LBB853_3
.LBB853_14:                             // %lor.lhs.false2
        mov     w8, #14012
        cmp             w19, w8
        b.gt    .LBB853_21
// BB#15:                               // %lor.lhs.false2
        mov     w8, #-10105
        add             w8, w19, w8
        cmp             w8, #9          // =9
        b.hi    .LBB853_17
// BB#16:                               // %lor.lhs.false2
        orr     w9, wzr, #0x1
        lsl     w8, w9, w8
        mov     w9, #517
        and             w8, w8, w9
        cbnz    w8, .LBB853_23
.LBB853_17:                             // %lor.lhs.false2
        mov     w8, #10013
        cmp             w19, w8
        b.eq    .LBB853_23
        b       .LBB853_3
.LBB853_18:                             // %lor.lhs.false2
        mov     w8, #-7007
        add             w8, w19, w8
        cmp             w8, #2          // =2
        b.lo    .LBB853_23
// BB#19:                               // %lor.lhs.false2
        mov     w8, #5002
        cmp             w19, w8
        b.eq    .LBB853_23
// BB#20:                               // %lor.lhs.false2
        mov     w8, #10011
        cmp             w19, w8
        b.eq    .LBB853_23
        b       .LBB853_3
.LBB853_21:                             // %lor.lhs.false2
        mov     w8, #14013
        cmp             w19, w8
        b.eq    .LBB853_23
// BB#22:                               // %lor.lhs.false2
        mov     w8, #15000
        cmp             w19, w8
        b.ne    .LBB853_3
```
However, the inline cost model estimates the cost to be linear with the number
of distinct targets and the cost of the above switch is just 2 InstrCosts.
The function containing this switch is then inlined about 900 times.

This change use the general way of switch lowering for the inline heuristic. It
etimate the number of case clusters with the suitability check for a jump table
or bit test. Considering the binary search tree built for the clusters, this
change modifies the model to be linear with the size of the balanced binary
tree. The model is off by default for now :
  -inline-generic-switch-cost=false

This change was originally proposed by Haicheng in D29870.

Reviewers: hans, bmakam, chandlerc, eraman, haicheng, mcrosier

Reviewed By: hans

Subscribers: joerg, aemerson, llvm-commits, rengolin

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

llvm-svn: 301649

7 years ago[libclang] Expose some target information via the C API.
Emilio Cobos Alvarez [Fri, 28 Apr 2017 15:56:39 +0000 (15:56 +0000)]
[libclang] Expose some target information via the C API.

This allows users to query the target triple and target pointer width, which
would make me able to fix https://github.com/servo/rust-bindgen/issues/593 and
other related bugs in an elegant way (without having to manually parse the
target triple in the command line arguments).

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

llvm-svn: 301648

7 years agoUse the -Wunknown-warning-option group for the "unknown warning group"
Alex Lorenz [Fri, 28 Apr 2017 14:45:25 +0000 (14:45 +0000)]
Use the -Wunknown-warning-option group for the "unknown warning group"
diagnostic in #pragma diagnostic

This matches the warning group that's specified for the unknown warning options
that are passed-in as command line arguments.

rdar://29526025

llvm-svn: 301647

7 years agoMove variable local to where ita used. NFCI.
Simon Pilgrim [Fri, 28 Apr 2017 14:42:15 +0000 (14:42 +0000)]
Move variable local to where ita used. NFCI.

llvm-svn: 301646

7 years agoMemory intrinsic value profile optimization: Avoid divide by 0
Teresa Johnson [Fri, 28 Apr 2017 14:30:54 +0000 (14:30 +0000)]
Memory intrinsic value profile optimization: Avoid divide by 0

Summary:
Skip memops if the total value profiled count is 0, we can't correctly
scale up the counts and there is no point anyway.

Reviewers: davidxl

Subscribers: llvm-commits

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

llvm-svn: 301645

7 years ago[DAGCombiner] Add ComputeNumSignBits vector demanded elements support to ASHR and...
Simon Pilgrim [Fri, 28 Apr 2017 13:21:18 +0000 (13:21 +0000)]
[DAGCombiner] Add ComputeNumSignBits vector demanded elements support to ASHR and INSERT_VECTOR_ELT (reapplied)

Reapplied r299221 after fix for nondeterminism in ThinLTO builder (rL301599), with extra check for implicit truncation of inserted element.

llvm-svn: 301644

7 years ago[Sema] Avoid an invalid redefinition error that was presented for
Alex Lorenz [Fri, 28 Apr 2017 12:30:05 +0000 (12:30 +0000)]
[Sema] Avoid an invalid redefinition error that was presented for
of a function whose previous definition was typo-corrected

rdar://28550928

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

llvm-svn: 301643

7 years agoRemove lock from ConstString::GetLength
Pavel Labath [Fri, 28 Apr 2017 12:08:28 +0000 (12:08 +0000)]
Remove lock from ConstString::GetLength

Summary: ConstStrings are immutable, so there is no need to grab even a reader lock in order to read the length field.

Reviewers: #lldb, labath

Reviewed By: labath

Subscribers: zturner, labath, lldb-commits

Differential Revision: https://reviews.llvm.org/D32306
Patch by Scott Smith <scott.smith@purestorage.com>

llvm-svn: 301642

7 years ago[X86][SSE] Added new tests from D32416 to show codegen delta
Simon Pilgrim [Fri, 28 Apr 2017 11:53:08 +0000 (11:53 +0000)]
[X86][SSE] Added new tests from D32416 to show codegen delta

llvm-svn: 301641

7 years ago[Polly] [PPCGCodeGeneration] Add managed memory support to GPU code
Siddharth Bhat [Fri, 28 Apr 2017 11:16:30 +0000 (11:16 +0000)]
[Polly] [PPCGCodeGeneration] Add managed memory support to GPU code
generation.

This needs changes to GPURuntime to expose synchronization between host
and device.

1. Needs better function naming, I want a better name than
"getOrCreateManagedDeviceArray"

2. DeviceAllocations is used by both the managed memory and the
non-managed memory path. This exploits the fact that the two code paths
are never run together. I'm not sure if this is the best design decision

Reviewed by: PhilippSchaad

Tags: #polly

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

llvm-svn: 301640

7 years ago[X86][SSE] Renames all ones test to better match type.
Simon Pilgrim [Fri, 28 Apr 2017 11:12:30 +0000 (11:12 +0000)]
[X86][SSE] Renames all ones test to better match type.

Added 8f32/4f64 optsize tests discussed on D32416

llvm-svn: 301639

7 years ago[X86][SSE] Add codegen test for _mm_set_pd1 (PR32827)
Simon Pilgrim [Fri, 28 Apr 2017 10:31:42 +0000 (10:31 +0000)]
[X86][SSE] Add codegen test for _mm_set_pd1 (PR32827)

llvm-svn: 301638

7 years ago[X86][SSE] Add _mm_set_pd1 (PR32827)
Simon Pilgrim [Fri, 28 Apr 2017 10:28:32 +0000 (10:28 +0000)]
[X86][SSE] Add _mm_set_pd1 (PR32827)

Matches _mm_set_ps1 implementation

llvm-svn: 301637

7 years agoResurrect pselect MainLoop implementation
Pavel Labath [Fri, 28 Apr 2017 10:26:06 +0000 (10:26 +0000)]
Resurrect pselect MainLoop implementation

Summary:
It turns out that even though ppoll is available on all the android
devices we support, it does not seem to be working properly on all of
them -- MainLoop just does a busy loop with ppoll returning EINTR and
not making any progress.

This brings back the pselect implementation and makes it available on
android. I could not do any cmake checks for this as the ppoll symbol is
actually avaiable -- it just does not work.

Reviewers: beanz, eugene

Subscribers: srhines, lldb-commits

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

llvm-svn: 301636

7 years ago[index] Handle vector types in USR generator
Alex Lorenz [Fri, 28 Apr 2017 09:46:36 +0000 (09:46 +0000)]
[index] Handle vector types in USR generator

rdar://25339187

llvm-svn: 301635

7 years ago[ARM] GlobalISel: fixup r301632
Diana Picus [Fri, 28 Apr 2017 09:20:31 +0000 (09:20 +0000)]
[ARM] GlobalISel: fixup r301632

Actually remove ARMInstructionSelector.h... Forgot to stage the removal
in the previous commit.

llvm-svn: 301633

7 years ago[ARM] GlobalISel: Get rid of ARMInstructionSelector.h. NFC.
Diana Picus [Fri, 28 Apr 2017 09:10:38 +0000 (09:10 +0000)]
[ARM] GlobalISel: Get rid of ARMInstructionSelector.h. NFC.

Declare the ARMInstructionSelector in an anonymous namespace, to make it
more in line with the other targets which were migrated to this in
r299637 in order to avoid TableGen'erated headers being included in
non-GlobalISel builds.

llvm-svn: 301632

7 years ago[DWARF] - Fix mistype in dump output of pub* tables. NFC.
George Rimar [Fri, 28 Apr 2017 08:54:10 +0000 (08:54 +0000)]
[DWARF] - Fix mistype in dump output of pub* tables. NFC.

There was a garbage character in output introduced by myself in
r290040 "[DWARF] - Introduce DWARFDebugPubTable class for dumping pub* sections."

llvm-svn: 301631

7 years ago[DebugInfo][X86] Improve X86 Optimize LEAs handling of debug values.
Andrew Ng [Fri, 28 Apr 2017 08:44:30 +0000 (08:44 +0000)]
[DebugInfo][X86] Improve X86 Optimize LEAs handling of debug values.

This is a follow up to the fix in r298360 to improve the handling of debug
values when redundant LEAs are removed. The fix in r298360 effectively
discarded the debug values. This patch now attempts to preserve the debug
values by using the DWARF DW_OP_stack_value operation via prependDIExpr.

Moved functions appendOffset and prependDIExpr from Local.cpp to
DebugInfoMetadata.cpp and made them available as static member functions of
DIExpression.

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

llvm-svn: 301630

7 years ago[WebAssembly] Update calls to computeKnownBits after the changes from r301620.
Craig Topper [Fri, 28 Apr 2017 08:15:33 +0000 (08:15 +0000)]
[WebAssembly] Update calls to computeKnownBits after the changes from r301620.

I didn't realize WebAssembly wasn't a default build target so I missed that changes were needed.

llvm-svn: 301629

7 years ago[X86][NFC] Refactor RepMovsRepeats in preparation for D32481.
Clement Courbet [Fri, 28 Apr 2017 07:56:31 +0000 (07:56 +0000)]
[X86][NFC] Refactor RepMovsRepeats in preparation for D32481.

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

llvm-svn: 301628

7 years ago[ARM] GlobalISel: Tighten test. NFC
Diana Picus [Fri, 28 Apr 2017 07:50:47 +0000 (07:50 +0000)]
[ARM] GlobalISel: Tighten test. NFC

Explicitly check types and load sizes in the IRTranslator test.

llvm-svn: 301627

7 years ago[ValueTracking] Convert computeKnownBitsFromRangeMetadata to use KnownBits struct.
Craig Topper [Fri, 28 Apr 2017 06:28:56 +0000 (06:28 +0000)]
[ValueTracking] Convert computeKnownBitsFromRangeMetadata to use KnownBits struct.

llvm-svn: 301626

7 years ago[EarlyCSE] Mark the condition of assume intrinsic as true
Max Kazantsev [Fri, 28 Apr 2017 06:25:39 +0000 (06:25 +0000)]
[EarlyCSE] Mark the condition of assume intrinsic as true

EarlyCSE should not just ignore assumes. It should use the fact that its condition is true for all dominated instructions.

Reviewers: sanjoy, reames, apilipenko, anna, skatkov

Reviewed By: reames, sanjoy

Subscribers: llvm-commits

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

llvm-svn: 301625

7 years agoUpdate to isl-0.18-592-gb50ad59
Tobias Grosser [Fri, 28 Apr 2017 06:11:17 +0000 (06:11 +0000)]
Update to isl-0.18-592-gb50ad59

This is just a general maintenance update.

llvm-svn: 301624

7 years ago[EarlyCSE] Remove guards with conditions known to be true
Max Kazantsev [Fri, 28 Apr 2017 06:05:48 +0000 (06:05 +0000)]
[EarlyCSE] Remove guards with conditions known to be true

If a condition is calculated only once, and there are multiple guards on this condition, we should be able
to remove all guards dominated by the first of them. This patch allows EarlyCSE to try to find the condition
of a guard among the known values, and if it is true, remove the guard. Otherwise we keep the guard and
mark its condition as 'true' for future consideration.

Reviewers: sanjoy, reames, apilipenko, skatkov, anna, dberlin

Reviewed By: reames, sanjoy

Subscribers: llvm-commits

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

llvm-svn: 301623

7 years agoFix unset-insert-libraries-on-exec.cc to use "%env" to make it work in iOS simulator.
Kuba Mracek [Fri, 28 Apr 2017 05:50:46 +0000 (05:50 +0000)]
Fix unset-insert-libraries-on-exec.cc to use "%env" to make it work in iOS simulator.

llvm-svn: 301622

7 years agoFix the reexec-insert-libraries-env.cc testcase to use %env to make it work on iOS...
Kuba Mracek [Fri, 28 Apr 2017 05:48:27 +0000 (05:48 +0000)]
Fix the reexec-insert-libraries-env.cc testcase to use %env to make it work on iOS simulator.

llvm-svn: 301621

7 years ago[SelectionDAG] Use KnownBits struct in DAG's computeKnownBits and simplifyDemandedBits
Craig Topper [Fri, 28 Apr 2017 05:31:46 +0000 (05:31 +0000)]
[SelectionDAG] Use KnownBits struct in DAG's computeKnownBits and simplifyDemandedBits

This patch replaces the separate APInts for KnownZero/KnownOne with a single KnownBits struct. This is similar to what was done to ValueTracking's version recently.

This is largely a mechanical transformation from KnownZero to Known.Zero.

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

llvm-svn: 301620

7 years agoclang/test/ARCMT/remap-applying.c: Use %/s on the command line of echo(1).
NAKAMURA Takumi [Fri, 28 Apr 2017 05:02:52 +0000 (05:02 +0000)]
clang/test/ARCMT/remap-applying.c: Use %/s on the command line of echo(1).

llvm-svn: 301619

7 years ago[SelectionDAG] Use various APInt methods to reduce temporary APInt creation
Craig Topper [Fri, 28 Apr 2017 04:57:59 +0000 (04:57 +0000)]
[SelectionDAG] Use various APInt methods to reduce temporary APInt creation

This patch uses various APInt methods to reduce the number of temporary APInts. These were all found while working through converting SelectionDAG's computeKnownBits to also use the KnownBits struct recently added to the ValueTracking version.

llvm-svn: 301618

7 years ago[asan] Add a compilation wrapper that codesigns shared libraries to support iOS simul...
Kuba Mracek [Fri, 28 Apr 2017 04:55:35 +0000 (04:55 +0000)]
[asan] Add a compilation wrapper that codesigns shared libraries to support iOS simulator testing

Tests that run on the iOS simulator require the dlopen'd dylibs are codesigned. This patch adds the "iossim_compile.py" wrapper that codesigns any produces dylib.

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

llvm-svn: 301617

7 years agoRemove unnecessary semicolon
Sanjoy Das [Fri, 28 Apr 2017 04:49:32 +0000 (04:49 +0000)]
Remove unnecessary semicolon

This shows up as a -Wpendatic error on GCC.

llvm-svn: 301616

7 years ago[StackMaps] Increase the size of the "location size" field
Sanjoy Das [Fri, 28 Apr 2017 04:48:42 +0000 (04:48 +0000)]
[StackMaps] Increase the size of the "location size" field

Summary:
In some cases LLVM (especially the SLP vectorizer) will create vectors
that are 256 bytes (or larger).  Given that this is intentional[0] is
likely to get more common, this patch updates the StackMap binary
format to deal with the spill locations for said vectors.

This change also bumps the stack map version from 2 to 3.

[0]: https://reviews.llvm.org/D32533#738350

Reviewers: reames, kavon, skatkov, javed.absar

Subscribers: mcrosier, nemanjai, llvm-commits

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

llvm-svn: 301615

7 years agoCOFF Import: expose both symbols
Saleem Abdulrasool [Fri, 28 Apr 2017 04:29:43 +0000 (04:29 +0000)]
COFF Import: expose both symbols

COFF Import libraries which use the obsolete CONSTANT export are
supposed to get two symbols, one with the `_imp_` prefix and one
without.  Ensure that we expose both for iteration.  This is necessary
to fix the librarian with COFF CONSTANT exports.

llvm-svn: 301614

7 years agoclang/test/Index/index-module.m: Relax expressions to satisfy DOSish path separator...
NAKAMURA Takumi [Fri, 28 Apr 2017 04:17:31 +0000 (04:17 +0000)]
clang/test/Index/index-module.m: Relax expressions to satisfy DOSish path separator \\, since r301597.

llvm-svn: 301613

7 years ago[APInt] Use inplace shift methods where possible. NFCI
Craig Topper [Fri, 28 Apr 2017 03:36:24 +0000 (03:36 +0000)]
[APInt] Use inplace shift methods where possible. NFCI

llvm-svn: 301612

7 years agoMove functionality for handling module maps as inputs from the -emit-module
Richard Smith [Fri, 28 Apr 2017 01:49:42 +0000 (01:49 +0000)]
Move functionality for handling module maps as inputs from the -emit-module
action to the general FrontendAction infrastructure.

This permits applying -E, -ast-dump, -fsyntax-only, and so on to a module map
compilation. (The -E form is not currently especially useful yet as there's no
good way to take the output and use it to actually build a module.)

In order to support this, -cc1 now accepts -x <lang>-module-map in all cases
where it accepts -x <lang> for a language we can parse (not ir/ast). And for
uniformity, we also accept -x <lang>-header for all such languages (we used
to reject for cuda and renderscript), and -x <lang>-cpp-output for all such
languages (we used to reject for c, cl, and renderscript).

(None of these new alternatives are accepted by the driver yet, so no
user-visible changes.)

llvm-svn: 301610

7 years agoProvide a mechanism to do some pre-loading of symbols up front.
Jim Ingham [Fri, 28 Apr 2017 00:51:06 +0000 (00:51 +0000)]
Provide a mechanism to do some pre-loading of symbols up front.

Loading a shared library can require a large amount of work; rather than do that serially for each library,
this patch will allow parallelization of the symbols and debug info name indexes.

From scott.smith@purestorage.com

https://reviews.llvm.org/D32598

llvm-svn: 301609

7 years agoAdd a newline to suppress compiler warnings.
Jim Ingham [Fri, 28 Apr 2017 00:44:07 +0000 (00:44 +0000)]
Add a newline to suppress compiler warnings.

llvm-svn: 301608

7 years ago[llvm-pdbdump] Allow printing only a portion of a stream.
Zachary Turner [Fri, 28 Apr 2017 00:43:38 +0000 (00:43 +0000)]
[llvm-pdbdump] Allow printing only a portion of a stream.

When dumping raw data from a stream, you might know the offset
of a certain record you're interested in, as well as how long
that record is.  Previously, you had to dump the entire stream
and wade through the bytes to find the interesting record.

This patch allows you to specify an offset and length on the
command line, and it will only dump the requested range.

llvm-svn: 301607

7 years ago[WebAssembly] Add some tests for wasm MC layer
Sam Clegg [Fri, 28 Apr 2017 00:36:36 +0000 (00:36 +0000)]
[WebAssembly] Add some tests for wasm MC layer

Subscribers: jfb, dschuff

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

llvm-svn: 301606

7 years ago[ASTImporter] Move structural equivalence context to its own file. NFCI
Bruno Cardoso Lopes [Fri, 28 Apr 2017 00:31:30 +0000 (00:31 +0000)]
[ASTImporter] Move structural equivalence context to its own file. NFCI

Create a header and impl file for the structural equivalence context.
This is to allow other users outside clang importer. NFCI

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

rdar://problem/30167717

llvm-svn: 301604

7 years agoResurrect the standalone build of LLDB
Kamil Rytarowski [Fri, 28 Apr 2017 00:29:54 +0000 (00:29 +0000)]
Resurrect the standalone build of LLDB

Switch includes "llvm/Config/config.h" to "llvm/Config/llvm-config.h".

Tested on NetBSD 7.99.70 amd64

llvm-svn: 301603

7 years ago[ARCMigrate] When applying changes from remap files, disable the 'adjustRemovals...
Argyrios Kyrtzidis [Fri, 28 Apr 2017 00:25:06 +0000 (00:25 +0000)]
[ARCMigrate] When applying changes from remap files, disable the 'adjustRemovals' functionality of EditedSource

'adjustRemovals' is used to avoid situation when removing a range inadvertently causes 2 separate identifiers to get joined into one.
But it is not useful when the edits are character precise, as is the case with the remap files.

llvm-svn: 301602

7 years agoUse a consistent style. NFC
George Burgess IV [Thu, 27 Apr 2017 23:59:45 +0000 (23:59 +0000)]
Use a consistent style. NFC

llvm-svn: 301601

7 years agointegrate SBTrace changes into Xcode project
Tim Hammerquist [Thu, 27 Apr 2017 23:09:08 +0000 (23:09 +0000)]
integrate SBTrace changes into Xcode project

llvm-svn: 301600

7 years ago[SROA] Fix nondeterminism exposed by Simon's r299221.
Davide Italiano [Thu, 27 Apr 2017 23:09:01 +0000 (23:09 +0000)]
[SROA] Fix nondeterminism exposed by Simon's r299221.

Use a SmallSetSetVector instead of a SmallPtrSet as iterating
over the latter is not stable ('<' relies on addresses).

llvm-svn: 301599

7 years agoCOFF ICF: Merge only functions. Do not merge read-only data.
Rui Ueyama [Thu, 27 Apr 2017 23:03:22 +0000 (23:03 +0000)]
COFF ICF: Merge only functions. Do not merge read-only data.

This seems to be the behavior of the MSVC linker. Previously, this
incompatibility caused nasty issues in chromium build a few times.

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

llvm-svn: 301598

7 years ago[Modules] Improve diagnostics for incomplete umbrella
Bruno Cardoso Lopes [Thu, 27 Apr 2017 22:29:14 +0000 (22:29 +0000)]
[Modules] Improve diagnostics for incomplete umbrella

One of the -Wincomplete-umbrella warnings diagnoses when a header is present in
the directory but it's not present in the umbrella header. Currently, this
warning only happens on top level modules; any submodule using an umbrella
header does not get this warning. Fix that by also considering the submodules.

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

rdar://problem/22623686

llvm-svn: 301597

7 years ago[Modules] Refactor logic for incomplete umbrella warnings. NFC
Bruno Cardoso Lopes [Thu, 27 Apr 2017 22:29:10 +0000 (22:29 +0000)]
[Modules] Refactor logic for incomplete umbrella warnings. NFC

llvm-svn: 301596

7 years agoFix a few pedantic warnings.
Frederich Munch [Thu, 27 Apr 2017 22:10:57 +0000 (22:10 +0000)]
Fix a few pedantic warnings.

Reviewers: zturner, hansw, hans

Reviewed By: hans

Subscribers: hans, llvm-commits

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

llvm-svn: 301595

7 years ago[InstCombine] fix matcher to bind to specific operand (PR32830)
Sanjay Patel [Thu, 27 Apr 2017 21:55:03 +0000 (21:55 +0000)]
[InstCombine] fix matcher to bind to specific operand (PR32830)

Matching any random value would be very wrong:
https://bugs.llvm.org/show_bug.cgi?id=32830

llvm-svn: 301594

7 years agoHeaders: Make the type of SIZE_MAX the same as size_t
Duncan P. N. Exon Smith [Thu, 27 Apr 2017 21:49:45 +0000 (21:49 +0000)]
Headers: Make the type of SIZE_MAX the same as size_t

size_t is usually defined as unsigned long, but on 64-bit platforms,
stdint.h currently defines SIZE_MAX using "ull" (unsigned long long).
Although this is the same width, it doesn't necessarily have the same
alignment or calling convention.  It also triggers printf warnings when
using the format flag "%zu" to print SIZE_MAX.

This changes SIZE_MAX to reuse the compiler-provided __SIZE_MAX__, and
provides similar fixes for the other integers:

  - INTPTR_MIN
  - INTPTR_MAX
  - UINTPTR_MAX
  - PTRDIFF_MIN
  - PTRDIFF_MAX
  - INTMAX_MIN
  - INTMAX_MAX
  - UINTMAX_MAX
  - INTMAX_C()
  - UINTMAX_C()

... and fixes the typedefs for intptr_t and uintptr_t to use
__INTPTR_TYPE__ and __UINTPTR_TYPE__ instead of int32_t, effectively
reverting r89224, r89226, and r89237 (r89221 already having been
effectively reverted).

We can probably also kill __INTPTR_WIDTH__, __INTMAX_WIDTH__, and
__UINTMAX_WIDTH__ in a follow-up, but I was hesitant to delete all the
per-target CHECK lines in this commit since those might serve their own
purpose.

rdar://problem/11811377

llvm-svn: 301593

7 years agoPreprocessor: Suppress -Wnonportable-include-path for header maps
Duncan P. N. Exon Smith [Thu, 27 Apr 2017 21:41:51 +0000 (21:41 +0000)]
Preprocessor: Suppress -Wnonportable-include-path for header maps

If a file search involves a header map, suppress
-Wnonportable-include-path.  It's firing lots of false positives for
framework authors internally, and it's not trivial to fix.

Consider a framework called "Foo" with a main (installed) framework header
"Foo/Foo.h".  It's atypical for "Foo.h" to actually live inside a
directory called "Foo" in the source repository.  Instead, the
build system generates a header map while building the framework.
If Foo.h lives at the top-level of the source repository (common), and
the git repo is called ssh://some.url/foo.git, then the header map will
have something like:

    Foo/Foo.h -> /Users/myname/code/foo/Foo.h

where "/Users/myname/code/foo" is the clone of ssh://some.url/foo.git.

After #import <Foo/Foo.h>, the current implementation of
-Wnonportable-include-path will falsely assume that Foo.h was found in a
nonportable way, because of the name of the git clone (.../foo/Foo.h).
However, that directory name was not involved in the header search at
all.

This commit adds an extra parameter to Preprocessor::LookupFile and
HeaderSearch::LookupFile to track if the search used a header map,
making it easy to suppress the warning.  Longer term, once we find a way
to avoid the false positive, we should turn the warning back on.

rdar://problem/28863903

llvm-svn: 301592

7 years agoSpecify something that's true in practice
Sanjoy Das [Thu, 27 Apr 2017 20:55:07 +0000 (20:55 +0000)]
Specify something that's true in practice

llvm-svn: 301591

7 years ago[ubsan] Make the cast overflow message less redundant
Vedant Kumar [Thu, 27 Apr 2017 20:48:17 +0000 (20:48 +0000)]
[ubsan] Make the cast overflow message less redundant

llvm-svn: 301589

7 years ago[asan] Fix dead stripping of globals on Linux (compiler-rt).
Evgeniy Stepanov [Thu, 27 Apr 2017 20:27:33 +0000 (20:27 +0000)]
[asan] Fix dead stripping of globals on Linux (compiler-rt).

Third attempt. See the description of the corresponding commit in
LLVM for more details.

llvm-svn: 301588

7 years ago[asan] Fix dead stripping of globals on Linux.
Evgeniy Stepanov [Thu, 27 Apr 2017 20:27:27 +0000 (20:27 +0000)]
[asan] Fix dead stripping of globals on Linux.

Use a combination of !associated, comdat, @llvm.compiler.used and
custom sections to allow dead stripping of globals and their asan
metadata. Sometimes.

Currently this works on LLD, which supports SHF_LINK_ORDER with
sh_link pointing to the associated section.

This also works on BFD, which seems to treat comdats as
all-or-nothing with respect to linker GC. There is a weird quirk
where the "first" global in each link is never GC-ed because of the
section symbols.

At this moment it does not work on Gold (as in the globals are never
stripped).

This is a second re-land of r298158. This time, this feature is
limited to -fdata-sections builds.

llvm-svn: 301587

7 years ago[asan] Put ctor/dtor in comdat.
Evgeniy Stepanov [Thu, 27 Apr 2017 20:27:23 +0000 (20:27 +0000)]
[asan] Put ctor/dtor in comdat.

When possible, put ASan ctor/dtor in comdat.

The only reason not to is global registration, which can be
TU-specific. This is not the case when there are no instrumented
globals. This is also limited to ELF targets, because MachO does
not have comdat, and COFF linkers may GC comdat constructors.

The benefit of this is a lot less __asan_init() calls: one per DSO
instead of one per TU. It's also necessary for the upcoming
gc-sections-for-globals change on Linux, where multiple references to
section start symbols trigger quadratic behaviour in gold linker.

This is a second re-land of r298756. This time with a flag to disable
the whole thing to avoid a bug in the gold linker:
  https://sourceware.org/bugzilla/show_bug.cgi?id=19002

llvm-svn: 301586

7 years agolibclang: remove unused variable.
Tim Northover [Thu, 27 Apr 2017 20:22:40 +0000 (20:22 +0000)]
libclang: remove unused variable.

llvm-svn: 301585

7 years ago[scudo] Move thread local variables into their own files
Kostya Kortchinsky [Thu, 27 Apr 2017 20:21:16 +0000 (20:21 +0000)]
[scudo] Move thread local variables into their own files

Summary:
This change introduces scudo_tls.h & scudo_tls_linux.cpp, where we move the
thread local variables used by the allocator, namely the cache, quarantine
cache & prng. `ScudoThreadContext` will hold those. This patch doesn't
introduce any new platform support yet, this will be the object of a later
patch. This also changes the PRNG so that the structure can be POD.

Reviewers: kcc, dvyukov, alekseyshl

Reviewed By: dvyukov, alekseyshl

Subscribers: llvm-commits, mgorny

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

llvm-svn: 301584

7 years ago[X86][SSE] Add tests for broadcast from larger vector loads
Simon Pilgrim [Thu, 27 Apr 2017 20:19:00 +0000 (20:19 +0000)]
[X86][SSE] Add tests for broadcast from larger vector loads

llvm-svn: 301583

7 years ago[ScopInfo] Consider only write-free dereferencable loads as invariant
Tobias Grosser [Thu, 27 Apr 2017 20:08:16 +0000 (20:08 +0000)]
[ScopInfo] Consider only write-free dereferencable loads as invariant

When we introduced in r297375 support for hoisting loads that are known
to be dereferencable without any conditional guard, we forgot to keep the check
to verify that no other write into the very same location exists. This
change ensures now that dereferencable loads are allowed to access everything,
but can only be hoisted in case no conflicting write exists.

This resolves llvm.org/PR32778

Reported-by: Huihui Zhang <huihuiz@codeaurora.org>
llvm-svn: 301582

7 years agoFixing Windows bot
Chris Bieneman [Thu, 27 Apr 2017 19:56:54 +0000 (19:56 +0000)]
Fixing Windows bot

URL:
http://lab.llvm.org:8011/builders/lldb-x86-windows-msvc2015/builds/8700

llvm-svn: 301581

7 years agoNFC. Add comment about debugserver usage
Chris Bieneman [Thu, 27 Apr 2017 19:45:16 +0000 (19:45 +0000)]
NFC. Add comment about debugserver usage

This just adds a comment to SocketAddress about it being used by debugserver and the implications of that.

If we need to make changes to this class that make it unsuitable for debugserver we can re-implement the minimal abstractions we need from this file in debugserver. I would prefer not to do that because code duplication is bad. Nuff said.

llvm-svn: 301580

7 years agoFix GreenDragon bots
Chris Bieneman [Thu, 27 Apr 2017 19:45:13 +0000 (19:45 +0000)]
Fix GreenDragon bots

We don't actually need to include Compiler.h here because it is only used on Windows and Windows/PosixAPI.h includes it.

llvm-svn: 301579

7 years ago[llvm-readobj] Dump COFF Resources section.
Zachary Turner [Thu, 27 Apr 2017 19:38:38 +0000 (19:38 +0000)]
[llvm-readobj] Dump COFF Resources section.

This patch dumps the raw bytes of the .rsrc sections that
are present in COFF object and executable files.  Subsequent
patches will parse this information and dump in a more human
readable format.

Differential Revision: https://reviews.llvm.org/D32463
Patch By: Eric Beckmann

llvm-svn: 301578

7 years ago[OpenMP] libomptarget: test correction for use with OpenMP 4.5
George Rokos [Thu, 27 Apr 2017 18:54:00 +0000 (18:54 +0000)]
[OpenMP] libomptarget: test correction for use with OpenMP 4.5

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

Thanks to Sergey Dmitriev for submitting the patch.

llvm-svn: 301577

7 years ago[PM/LoopUnswitch] Introduce a new, simpler loop unswitch pass.
Chandler Carruth [Thu, 27 Apr 2017 18:45:20 +0000 (18:45 +0000)]
[PM/LoopUnswitch] Introduce a new, simpler loop unswitch pass.

Currently, this pass only focuses on *trivial* loop unswitching. At that
reduced problem it remains significantly better than the current loop
unswitch:
- Old pass is worse than cubic complexity. New pass is (I think) linear.
- New pass is much simpler in its design by focusing on full unswitching. (See
  below for details on this).
- New pass doesn't carry state for thresholds between pass iterations.
- New pass doesn't carry state for correctness (both miscompile and
  infloop) between pass iterations.
- New pass produces substantially better code after unswitching.
- New pass can handle more trivial unswitch cases.
- New pass doesn't recompute the dominator tree for the entire function
  and instead incrementally updates it.

I've ported all of the trivial unswitching test cases from the old pass
to the new one to make sure that major functionality isn't lost in the
process. For several of the test cases I've worked to improve the
precision and rigor of the CHECKs, but for many I've just updated them
to handle the new IR produced.

My initial motivation was the fact that the old pass carried state in
very unreliable ways between pass iterations, and these mechansims were
incompatible with the new pass manager. However, I discovered many more
improvements to make along the way.

This pass makes two very significant assumptions that enable most of these
improvements:

1) Focus on *full* unswitching -- that is, completely removing whatever
   control flow construct is being unswitched from the loop. In the case
   of trivial unswitching, this means removing the trivial (exiting)
   edge. In non-trivial unswitching, this means removing the branch or
   switch itself. This is in opposition to *partial* unswitching where
   some part of the unswitched control flow remains in the loop. Partial
   unswitching only really applies to switches and to folded branches.
   These are very similar to full unrolling and partial unrolling. The
   full form is an effective canonicalization, the partial form needs
   a complex cost model, cannot be iterated, isn't canonicalizing, and
   should be a separate pass that runs very late (much like unrolling).

2) Leverage LLVM's Loop machinery to the fullest. The original unswitch
   dates from a time when a great deal of LLVM's loop infrastructure was
   missing, ineffective, and/or unreliable. As a consequence, a lot of
   complexity was added which we no longer need.

With these two overarching principles, I think we can build a fast and
effective unswitcher that fits in well in the new PM and in the
canonicalization pipeline. Some of the remaining functionality around
partial unswitching may not be relevant today (not many test cases or
benchmarks I can find) but if they are I'd like to add support for them
as a separate layer that runs very late in the pipeline.

Purely to make reviewing and introducing this code more manageable, I've
split this into first a trivial-unswitch-only pass and in the next patch
I'll add support for full non-trivial unswitching against a *fixed*
threshold, exactly like full unrolling. I even plan to re-use the
unrolling thresholds, as these are incredibly similar cost tradeoffs:
we're cloning a loop body in order to end up with simplified control
flow. We should only do that when the total growth is reasonably small.

One of the biggest changes with this pass compared to the previous one
is that previously, each individual trivial exiting edge from a switch
was unswitched separately as a branch. Now, we unswitch the entire
switch at once, with cases going to the various destinations. This lets
us unswitch multiple exiting edges in a single operation and also avoids
numerous extremely bad behaviors, where we would introduce 1000s of
branches to test for thousands of possible values, all of which would
take the exact same exit path bypassing the loop. Now we will use
a switch with 1000s of cases that can be efficiently lowered into
a jumptable. This avoids relying on somehow forming a switch out of the
branches or getting horrible code if that fails for any reason.

Another significant change is that this pass actively updates the CFG
based on unswitching. For trivial unswitching, this is actually very
easy because of the definition of loop simplified form. Doing this makes
the code coming out of loop unswitch dramatically more friendly. We
still should run loop-simplifycfg (at the least) after this to clean up,
but it will have to do a lot less work.

Finally, this pass makes much fewer attempts to simplify instructions
based on the unswitch. Something like loop-instsimplify, instcombine, or
GVN can be used to do increasingly powerful simplifications based on the
now dominating predicate. The old simplifications are things that
something like loop-instsimplify should get today or a very, very basic
loop-instcombine could get. Keeping that logic separate is a big
simplifying technique.

Most of the code in this pass that isn't in the old one has to do with
achieving specific goals:
- Updating the dominator tree as we go
- Unswitching all cases in a switch in a single step.

I think it is still shorter than just the trivial unswitching code in
the old pass despite having this functionality.

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

llvm-svn: 301576

7 years ago[GlobalOpt] Correctly update metadata when localizing a global.
Eli Friedman [Thu, 27 Apr 2017 18:39:08 +0000 (18:39 +0000)]
[GlobalOpt] Correctly update metadata when localizing a global.

Just calling dropAllReferences leaves pointers to the ConstantExpr
behind, so we would eventually crash with a null pointer dereference.

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

llvm-svn: 301575

7 years agoMemory intrinsic value profile optimization: Improve debug output (NFC)
Teresa Johnson [Thu, 27 Apr 2017 18:25:22 +0000 (18:25 +0000)]
Memory intrinsic value profile optimization: Improve debug output (NFC)

Summary:
Misc improvements to debug output. Fix a couple typos and also dump the
value profile before we make any profitability checks.

Reviewers: davidxl

Subscribers: llvm-commits

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

llvm-svn: 301574

7 years agoAdded an Importer test for in-class member initializers.
Sean Callanan [Thu, 27 Apr 2017 18:10:29 +0000 (18:10 +0000)]
Added an Importer test for in-class member initializers.

llvm-svn: 301573

7 years agoLimit disabling of warnings emitted from r301571 by checking __GNUC__.
Frederich Munch [Thu, 27 Apr 2017 18:05:29 +0000 (18:05 +0000)]
Limit disabling of warnings emitted from r301571 by checking __GNUC__.

llvm-svn: 301572

7 years agoFix warnings from test added in r301562 on Windows (when built without exceptions).
Frederich Munch [Thu, 27 Apr 2017 17:33:50 +0000 (17:33 +0000)]
Fix warnings from test added in r301562 on Windows (when built without exceptions).

llvm-svn: 301571

7 years ago[Profile] Add off-by-default -Wprofile-instr-missing warning
Vedant Kumar [Thu, 27 Apr 2017 17:30:58 +0000 (17:30 +0000)]
[Profile] Add off-by-default -Wprofile-instr-missing warning

Clang warns that a profile is out-of-date if it can't find a profile
record for any function in a TU. This warning became noisy after llvm
started allowing dead-stripping of instrumented functions.

To fix this, this patch changes the existing profile out-of-date warning
(-Wprofile-instr-out-of-date) so that it only complains about mismatched
data. Further, it introduces a new, off-by-default warning about missing
function data (-Wprofile-instr-missing).

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

llvm-svn: 301570

7 years agoSync with changes from r300825 in clang.
Vassil Vassilev [Thu, 27 Apr 2017 17:23:53 +0000 (17:23 +0000)]
Sync with changes from r300825 in clang.

Generate the better include paths. Instead of #include <llvm_header.h> doxygen
produces #include "llvm/Folder/llvm_header.h"

Patch by Yuka Takahashi (D32342)!

llvm-svn: 301569

7 years ago[libclang] Enhance clang_Cursor_isDynamicCall and clang_Cursor_getReceiverType to...
Argyrios Kyrtzidis [Thu, 27 Apr 2017 17:23:04 +0000 (17:23 +0000)]
[libclang] Enhance clang_Cursor_isDynamicCall and clang_Cursor_getReceiverType to handle ObjC property references

Also enhance clang_Cursor_getReceiverType to handle C++ method calls.

llvm-svn: 301568

7 years agoclang-cl: Alias /d1reportAllClassLayout to -fdump-record-layouts (PR32826)
Hans Wennborg [Thu, 27 Apr 2017 17:19:07 +0000 (17:19 +0000)]
clang-cl: Alias /d1reportAllClassLayout to -fdump-record-layouts (PR32826)

llvm-svn: 301567

7 years agoUse a pointer type for target frame indices during statepoint lowering
Sanjoy Das [Thu, 27 Apr 2017 17:17:16 +0000 (17:17 +0000)]
Use a pointer type for target frame indices during statepoint lowering

Summary:
The type of the target frame index is intptr, not the type of the value we're
going to store into it.  Without this change we crash in the attached test case
when trying to type-legalize a TargetFrameIndex.

Patchpoint lowering types the target frame index as intptr as well.

Reviewers: reames, bogner, arsenm

Subscribers: arsenm, mcrosier, llvm-commits

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

llvm-svn: 301566

7 years agocmake: Touch $GIT_DIR/logs/HEAD if it does not already exist.
Peter Collingbourne [Thu, 27 Apr 2017 17:04:05 +0000 (17:04 +0000)]
cmake: Touch $GIT_DIR/logs/HEAD if it does not already exist.

Apparently some git tools (such as "repo") may not create this file.
Patch by Quentin Neill.

llvm-svn: 301565

7 years agoFix -Wpedantic about extra semicolons in CGStmtOpenMP.cpp
Hans Wennborg [Thu, 27 Apr 2017 17:02:25 +0000 (17:02 +0000)]
Fix -Wpedantic about extra semicolons in CGStmtOpenMP.cpp

llvm-svn: 301564

7 years agoRemove leaking UnknownPragmaHandlers right after we are done with them.
Vassil Vassilev [Thu, 27 Apr 2017 16:58:33 +0000 (16:58 +0000)]
Remove leaking UnknownPragmaHandlers right after we are done with them.

The UnknownPragmaHandlers added by DoPrintPreprocessedInput conflict with the
real PragmaHandlers from clang::Parser because they try to handle the same
#pragma directives. This makes it impossible to use a Preprocessor (that was
previously passed to DoPrintPreprocessedInput), as an Preprocessor for a
clang::Parser instance which is what we currently do in cling.

This patch removes the added UnknownPragmaHandler to avoid conflicts these
conflicts and leave the PragmaHandlers of the Preprocessors in a the same state
as before calling DoPrintPreprocessedInput.

Patch by Raphael Isemann (D32486)!

llvm-svn: 301563

7 years agoRefactor DynamicLibrary so searching for a symbol will have a defined order and
Frederich Munch [Thu, 27 Apr 2017 16:55:24 +0000 (16:55 +0000)]
Refactor DynamicLibrary so searching for a symbol will have a defined order and
libraries are properly unloaded when llvm_shutdown is called.

Summary:
This was mostly affecting usage of the JIT, where storing the library handles in
a set made iteration unordered/undefined. This lead to disagreement between the
JIT and native code as to what the address and implementation of particularly on
Windows with stdlib functions:

JIT: putenv_s("TEST", "VALUE") // called msvcrt.dll, putenv_s
JIT: getenv("TEST") -> "VALUE" // called msvcrt.dll, getenv
Native: getenv("TEST") -> NULL // called ucrt.dll, getenv

Also fixed is the issue of DynamicLibrary::getPermanentLibrary(0,0) on Windows
not giving priority to the process' symbols as it did on Unix.

Reviewers: chapuni, v.g.vassilev, lhames

Reviewed By: lhames

Subscribers: danalbert, srhines, mgorny, vsk, llvm-commits

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

llvm-svn: 301562

7 years ago[PartialInlining]: Improve partial inlining to handle complex conditions
Xinliang David Li [Thu, 27 Apr 2017 16:34:00 +0000 (16:34 +0000)]
[PartialInlining]: Improve partial inlining to handle complex conditions

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

llvm-svn: 301561

7 years agoTSan: update line number after XFAIL on iOS.
Tim Northover [Thu, 27 Apr 2017 16:21:50 +0000 (16:21 +0000)]
TSan: update line number after XFAIL on iOS.

llvm-svn: 301560

7 years agoUpdate GDB remote command regex for IPv6
Chris Bieneman [Thu, 27 Apr 2017 16:13:58 +0000 (16:13 +0000)]
Update GDB remote command regex for IPv6

This updates the regular expression used to match host/port pairs for the gdb-remote command to also match IPv6 addresses.

The IPv6 address matcher is very generic and does not really check for structural validity of the address. It turns out that IPv6 addresses are very complicated.

llvm-svn: 301559

7 years ago[CMake] Use object library to build the two flavours of Polly.
Michael Kruse [Thu, 27 Apr 2017 16:13:03 +0000 (16:13 +0000)]
[CMake] Use object library to build the two flavours of Polly.

Polly comes in two library flavors: One loadable module to use the
LLVM framework -load mechanism, and another one that host applications
can link to. These have very different requirements for Polly's
own dependencies.

The loadable module assumes that all its LLVM dependencies are already
available in the address space of the host application, and is not allowed
to bring in its own copy of any LLVM library (including the NVPTX
backend in case of Polly-ACC).

The non-module library is intended to be linked to using
target_link_libraries. CMake would then resolve all of its dependencies,
including NVPTX and ensure that only a single instance of each library
will be used.

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

llvm-svn: 301558

7 years ago[CodeView] Isolate Debug Info Fragments into standalone classes.
Zachary Turner [Thu, 27 Apr 2017 16:12:16 +0000 (16:12 +0000)]
[CodeView] Isolate Debug Info Fragments into standalone classes.

Previously parsing of these were all grouped together into a
single master class that could parse any type of debug info
fragment.

With writing forthcoming, the complexity of each individual
fragment is enough to warrant them having their own classes so
that reading and writing of each fragment type can be grouped
together, but isolated from the code for reading and writing
other fragment types.

In doing so, I found a place where parsing code was duplicated
for the FileChecksums fragment, across llvm-readobj and the
CodeView library, and one of the implementations had a bug.
Now that the codepaths are merged, the bug is resolved.

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

llvm-svn: 301557

7 years ago[Support] Make BinaryStreamArray extractors stateless.
Zachary Turner [Thu, 27 Apr 2017 16:11:47 +0000 (16:11 +0000)]
[Support] Make BinaryStreamArray extractors stateless.

Instead, we now pass a context memeber through the extraction
process.

llvm-svn: 301556

7 years agoRename some PDB classes.
Zachary Turner [Thu, 27 Apr 2017 16:11:19 +0000 (16:11 +0000)]
Rename some PDB classes.

We have a lot of very similarly named classes related to
dealing with module debug info.  This patch has NFC, it just
renames some classes to be more descriptive (albeit slightly
more to type).  The mapping from old to new class names is as
follows:

   Old          |        New
ModInfo         | DbiModuleDescriptor
ModuleSubstream | ModuleDebugFragment
ModStream       | ModuleDebugStream

With the corresponding Builder classes renamed accordingly.

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

llvm-svn: 301555