Eric Fiselier [Thu, 15 Dec 2016 07:05:19 +0000 (07:05 +0000)]
Add more test cases for PR31384
llvm-svn: 289778
Yaxun Liu [Thu, 15 Dec 2016 06:59:23 +0000 (06:59 +0000)]
Attempt to fix llvm-readobj crash on ppc64 due to r289674
llvm-svn: 289777
Saleem Abdulrasool [Thu, 15 Dec 2016 06:59:05 +0000 (06:59 +0000)]
CodeGen: fix runtime function dll storage
Properly attribute DLL storage to runtime functions. When generating the
runtime function, scan for an existing declaration which may provide an explicit
declaration (local storage) or a DLL import or export storage from the user.
Honour that if available. Otherwise, if building with a local visibility of the
public or standard namespaces (-flto-visibility-public-std), give the symbols
local storage (it indicates a /MT[d] link, so static runtime). Otherwise,
assume that the link is dynamic, and give the runtime function dllimport
storage.
This allows for implementations to get the correct storage as long as they are
properly declared, the user to override the import storage, and in case no
explicit storage is given, use of the import storage.
llvm-svn: 289776
Daniel Jasper [Thu, 15 Dec 2016 06:54:29 +0000 (06:54 +0000)]
Fix go bindings after r289702 (hopefully, don't really know how to build
them, build.sh seems to be broken).
llvm-svn: 289775
Eric Fiselier [Thu, 15 Dec 2016 06:38:07 +0000 (06:38 +0000)]
Add test case for PR31384
llvm-svn: 289774
Eric Fiselier [Thu, 15 Dec 2016 06:34:54 +0000 (06:34 +0000)]
Revert r289727 due to PR31384
This patch reverts the changes to tuple which fixed construction from
types derived from tuple. It breaks the code mentioned in llvm.org/PR31384.
I'll follow this commit up with a test case.
llvm-svn: 289773
Kostya Serebryany [Thu, 15 Dec 2016 06:21:21 +0000 (06:21 +0000)]
[libFuzzer] enable the failure-resistant merge by default (with trace-pc-guard only)
llvm-svn: 289772
Dylan McKay [Thu, 15 Dec 2016 06:04:53 +0000 (06:04 +0000)]
[AVR] Whitelist the avrlit config environment variables
This allows us to use `lit` to run on-target execution tests.
llvm-svn: 289769
Hal Finkel [Thu, 15 Dec 2016 05:50:45 +0000 (05:50 +0000)]
Revert part of r289765 that is not necessary
CS.doesNotAccessMemory(ArgNo) and CS.onlyReadsMemory(ArgNo) calls
dataOperandHasImpliedAttr, so revert this part of r289765 because
it should not be necessary.
llvm-svn: 289768
Eric Fiselier [Thu, 15 Dec 2016 05:41:07 +0000 (05:41 +0000)]
XFAIL test for more apple-clang versions
llvm-svn: 289767
Hal Finkel [Thu, 15 Dec 2016 05:33:19 +0000 (05:33 +0000)]
Trying to fix NDEBUG build after r289764
llvm-svn: 289766
Hal Finkel [Thu, 15 Dec 2016 05:09:15 +0000 (05:09 +0000)]
Fix argument attribute queries with bundle operands
When iterating over data operands in AA, don't make argument-attribute-specific
queries on bundle operands. Trying to fix self hosting...
llvm-svn: 289765
Sanjoy Das [Thu, 15 Dec 2016 05:08:57 +0000 (05:08 +0000)]
[MachineBlockPlacement] Don't make blocks "uneditable"
Summary:
This fixes an issue with MachineBlockPlacement due to a badly timed call
to `analyzeBranch` with `AllowModify` set to true. The timeline is as
follows:
1. `MachineBlockPlacement::maybeTailDuplicateBlock` calls
`TailDup.shouldTailDuplicate` on its argument, which in turn calls
`analyzeBranch` with `AllowModify` set to true.
2. This `analyzeBranch` call edits the terminator sequence of the block
based on the physical layout of the machine function, turning an
unanalyzable non-fallthrough block to a unanalyzable fallthrough
block. Normally MBP bails out of rearranging such blocks, but this
block was unanalyzable non-fallthrough (and thus rearrangeable) the
first time MBP looked at it, and so it goes ahead and decides where
it should be placed in the function.
3. When placing this block MBP fails to analyze and thus update the
block in keeping with the new physical layout.
Concretely, before (1) we have something like:
```
LBL0:
< unknown terminator op that may branch to LBL1 >
jmp LBL1
LBL1:
... A
LBL2:
... B
```
In (2), analyze branch simplifies this to
```
LBL0:
< unknown terminator op that may branch to LBL2 >
;; jmp LBL1 <- redundant jump removed
LBL1:
... A
LBL2:
... B
```
In (3), MachineBlockPlacement goes ahead with its plan of putting LBL2
after the first block since that is profitable.
```
LBL0:
< unknown terminator op that may branch to LBL2 >
;; jmp LBL1 <- redundant jump
LBL2:
... B
LBL1:
... A
```
and the program now has incorrect behavior (we no longer fall-through
from `LBL0` to `LBL1`) because MBP can no longer edit LBL0.
There are several possible solutions, but I went with removing the teeth
off of the `analyzeBranch` calls in TailDuplicator. That makes thinking
about the result of these calls easier, and breaks nothing in the lit
test suite.
I've also added some bookkeeping to the MachineBlockPlacement pass and
used that to write an assert that would have caught this.
Reviewers: chandlerc, gberry, MatzeB, iteratee
Subscribers: mcrosier, llvm-commits
Differential Revision: https://reviews.llvm.org/D27783
llvm-svn: 289764
Mehdi Amini [Thu, 15 Dec 2016 04:58:51 +0000 (04:58 +0000)]
Revert "Fix printf specifier handling: invalid specifier should not be marked as "consuming data arguments""
This reverts commit r289762, wasn't ready to be pushed, it broke the printf tests.
llvm-svn: 289763
Mehdi Amini [Thu, 15 Dec 2016 04:51:22 +0000 (04:51 +0000)]
Fix printf specifier handling: invalid specifier should not be marked as "consuming data arguments"
llvm-svn: 289762
Mehdi Amini [Thu, 15 Dec 2016 04:02:31 +0000 (04:02 +0000)]
Fix os_log formating with arbitrary precision and field width
llvm-svn: 289761
Peter Collingbourne [Thu, 15 Dec 2016 04:02:23 +0000 (04:02 +0000)]
COFF: Open and map input files asynchronously on Windows.
Profiling revealed that the majority of lld's execution time on Windows was
spent opening and mapping input files. We can reduce this cost significantly
by performing these operations asynchronously.
This change introduces a queue for all operations on input file data. When
we discover that we need to load a file (for example, when we find a lazy
archive for an undefined symbol, or when we read a linker directive to
load a file from disk), the file operation is launched using a future and
the symbol resolution operation is enqueued. This implies another change
to symbol resolution semantics, but it seems to be harmless ("ninja All"
in Chromium still succeeds).
To measure the perf impact of this change I linked Chromium's chrome_child.dll
with both thin and fat archives.
Thin archives:
Before (median of 5 runs): 19.50s
After: 10.93s
Fat archives:
Before: 12.00s
After: 9.90s
On Linux I found that doing this asynchronously had a negative effect on
performance, probably because the cost of mapping a file is small enough that
it becomes outweighed by the cost of managing the futures. So on non-Windows
platforms I use the deferred execution strategy.
Differential Revision: https://reviews.llvm.org/D27768
llvm-svn: 289760
Craig Topper [Thu, 15 Dec 2016 03:49:45 +0000 (03:49 +0000)]
[AVX-512][InstCombine] Add masked scalar FMA intrinsics to SimplifyDemandedVectorElts.
llvm-svn: 289759
Rui Ueyama [Thu, 15 Dec 2016 03:31:53 +0000 (03:31 +0000)]
Rename functions as per post commit review for r289072.
llvm-svn: 289758
Hal Finkel [Thu, 15 Dec 2016 03:30:40 +0000 (03:30 +0000)]
Fix iterator-invalidation issue
Inserting a new key into a DenseMap potentially invalidates iterators into that
map. Trying to fix an issue from r289755 triggering this assertion:
Assertion `isHandleInSync() && "invalid iterator access!"' failed.
llvm-svn: 289757
Hal Finkel [Thu, 15 Dec 2016 03:02:15 +0000 (03:02 +0000)]
Remove the AssumptionCache
After r289755, the AssumptionCache is no longer needed. Variables affected by
assumptions are now found by using the new operand-bundle-based scheme. This
new scheme is more computationally efficient, and also we need much less
code...
llvm-svn: 289756
Hal Finkel [Thu, 15 Dec 2016 02:53:42 +0000 (02:53 +0000)]
Make processing @llvm.assume more efficient by using operand bundles
There was an efficiency problem with how we processed @llvm.assume in
ValueTracking (and other places). The AssumptionCache tracked all of the
assumptions in a given function. In order to find assumptions relevant to
computing known bits, etc. we searched every assumption in the function. For
ValueTracking, that means that we did O(#assumes * #values) work in InstCombine
and other passes (with a constant factor that can be quite large because we'd
repeat this search at every level of recursion of the analysis).
Several of us discussed this situation at the last developers' meeting, and
this implements the discussed solution: Make the values that an assume might
affect operands of the assume itself. To avoid exposing this detail to
frontends and passes that need not worry about it, I've used the new
operand-bundle feature to add these extra call "operands" in a way that does
not affect the intrinsic's signature. I think this solution is relatively
clean. InstCombine adds these extra operands based on what ValueTracking, LVI,
etc. will need and then those passes need only search the users of the values
under consideration. This should fix the computational-complexity problem.
At this point, no passes depend on the AssumptionCache, and so I'll remove
that as a follow-up change.
Differential Revision: https://reviews.llvm.org/D27259
llvm-svn: 289755
Richard Smith [Thu, 15 Dec 2016 02:35:39 +0000 (02:35 +0000)]
[c++1z] Permit constant evaluation of a call through a function pointer whose
type differs from the type of the actual function due to having a different
exception specification.
llvm-svn: 289754
Richard Smith [Thu, 15 Dec 2016 02:28:18 +0000 (02:28 +0000)]
Move checks for creation of objects of abstract class type from the various
constructs that can do so into the initialization code. This fixes a number
of different cases in which we used to fail to check for abstract types.
Thanks to Tim Shen for inspiring the weird code that uncovered this!
llvm-svn: 289753
Hal Finkel [Thu, 15 Dec 2016 02:19:17 +0000 (02:19 +0000)]
Include SmallSet.h in BackendUtil.cpp
BackendUtil.cpp uses llvm::SmallSet but did not include the header. It was
included indirectly, but this will change once the AssumptionCache is removed.
NFC.
llvm-svn: 289752
Eli Friedman [Thu, 15 Dec 2016 01:47:15 +0000 (01:47 +0000)]
Add testcases for some shuffle bugs.
See https://llvm.org/bugs/show_bug.cgi?id=31301 and
https://llvm.org/bugs/show_bug.cgi?id=31364 .
llvm-svn: 289751
Nico Weber [Thu, 15 Dec 2016 01:31:38 +0000 (01:31 +0000)]
Fix test/tools/lto/hide-linkonce-odr.ll after r289719
llvm-svn: 289750
Marcos Pividori [Thu, 15 Dec 2016 01:21:04 +0000 (01:21 +0000)]
Fix simple cmake error when COMPILER_RT_SUPPORTED_ARCH is empty.
Differential Revision: https://reviews.llvm.org/D27719
llvm-svn: 289749
Sean Silva [Thu, 15 Dec 2016 00:57:53 +0000 (00:57 +0000)]
Rename this variable.
`SC` didn't make much sense. We don't seem to have a clear convention,
but `IS` sounds good here because it emphasizes that it is an input
section (this is one place in the code where we are dealing with both
input sections and output sections at the same time so that extra
emphasis makes it a bit clearer).
llvm-svn: 289748
Justin Lebar [Thu, 15 Dec 2016 00:45:06 +0000 (00:45 +0000)]
[NVPTX] Remove dead #defines from NVPTXUtilities.h.
llvm-svn: 289747
Jim Ingham [Thu, 15 Dec 2016 00:30:30 +0000 (00:30 +0000)]
Fix incorrectly named variables.
llvm-svn: 289746
Peter Collingbourne [Thu, 15 Dec 2016 00:11:17 +0000 (00:11 +0000)]
COFF: We no longer require lib.exe to test DLL exports.
llvm-svn: 289745
Joerg Sonnenberger [Thu, 15 Dec 2016 00:02:57 +0000 (00:02 +0000)]
Use PIC relocation mode by default for PowerPC64 ELF
Most of the PowerPC64 code generation already creates PIC access. This
changes to a full PIC default, similar to what GCC is doing.
Overall, a monolithic clang binary shrinks by 600KB (about 1%). This can
be a slight regression for TLS access and will use the TOC more
aggressively instead of synthesizing immediates. It is expected to be
performance neutral.
Differential Revision: https://reviews.llvm.org/D26564
llvm-svn: 289744
Joerg Sonnenberger [Thu, 15 Dec 2016 00:01:53 +0000 (00:01 +0000)]
Use PIC relocation model as default for PowerPC64 ELF.
Most of the PowerPC64 code generation for the ELF ABI is already PIC.
There are four main exceptions:
(1) Constant pointer arrays etc. should in writeable sections.
(2) The TOC restoration NOP after a call is needed for all global
symbols. While GNU ld has a workaround for questionable GCC self-calls,
we trigger the checks for calls from COMDAT sections as they cross input
sections and are therefore not considered self-calls. The current
decision is questionable and suboptimal, but outside the scope of the
change.
(3) TLS access can not use the initial-exec model.
(4) Jump tables should use relative addresses. Note that the current
encoding doesn't work for the large code model, but it is more compact
than the default for any non-trivial jump table. Improving this is again
beyond the scope of this change.
At least (1) and (3) are assumptions made in target-independent code and
introducing additional hooks is a bit messy. Testing with clang shows
that a -fPIC binary is 600KB smaller than the corresponding -fno-pic
build. Separate testing from improved jump table encodings would explain
only about 100KB or so. The rest is expected to be a result of more
aggressive immediate forming for -fno-pic, where the -fPIC binary just
uses TOC entries.
This change brings the LLVM output in line with the GCC output, other
PPC64 compilers like XLC on AIX are known to produce PIC by default
as well. The relocation model can still be provided explicitly, i.e.
when using MCJIT.
One test case for case (1) is included, other test cases with relocation
mode sensitive behavior are wired to static for now. They will be
reviewed and adjusted separately.
Differential Revision: https://reviews.llvm.org/D26566
llvm-svn: 289743
Justin Lebar [Wed, 14 Dec 2016 23:24:43 +0000 (23:24 +0000)]
[AMDGPU] Fix runtime-metadata.ll test so it doesn't leave an object file in the source tree.
llvm-svn: 289742
Eric Fiselier [Wed, 14 Dec 2016 23:24:12 +0000 (23:24 +0000)]
Work around bug in initialization of std::array base class with older clangs
llvm-svn: 289741
Justin Lebar [Wed, 14 Dec 2016 23:20:40 +0000 (23:20 +0000)]
[NVPTX] Remove dead code.
I've chosen to remove NVPTXInstrInfo::CanTailMerge but not
NVPTXInstrInfo::isLoadInstr and isStoreInstr (which are also dead)
because while the latter two are reasonably useful utilities, the former
cannot be used safely: It relies on successful address space inference
to identify writes to shared memory, but addrspace inference is a
best-effort thing.
llvm-svn: 289740
Jonathan Peyton [Wed, 14 Dec 2016 23:01:24 +0000 (23:01 +0000)]
Follow up to r289732: Update comments in source files to reference .cpp files
Patch by Hansang Bae
llvm-svn: 289739
Sanjay Patel [Wed, 14 Dec 2016 22:59:14 +0000 (22:59 +0000)]
[DAG] allow more select folding for targets that have 'and not' (PR31175)
The original motivation for this patch comes from wanting to canonicalize
more IR to selects and also canonicalizing min/max.
If we're going to do that, we need more backend fixups to undo select codegen
when simpler ops will do. I chose AArch64 for the tests because that shows the
difference in the simplest way. This should fix:
https://llvm.org/bugs/show_bug.cgi?id=31175
Differential Revision: https://reviews.llvm.org/D27489
llvm-svn: 289738
Davide Italiano [Wed, 14 Dec 2016 22:53:43 +0000 (22:53 +0000)]
[gold] Add datalayout to two tests where it was missing.
Reported by: thakis via chromium bots.
llvm-svn: 289737
Eugene Zelenko [Wed, 14 Dec 2016 22:50:46 +0000 (22:50 +0000)]
[Hexagon] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 289736
Eric Fiselier [Wed, 14 Dec 2016 22:48:38 +0000 (22:48 +0000)]
Fix PR31378 - std::list::remove should not require a default constructible allocator.
In list::remove we collect the nodes we're removing in a seperate
list instance. However we construct this list using the default
constructor which default constructs the allocator. However allocators
are not required to be default constructible. This patch fixes the
construction of the second list.
llvm-svn: 289735
Stephan T. Lavavej [Wed, 14 Dec 2016 22:46:46 +0000 (22:46 +0000)]
[libcxx] [test] Fix MSVC x64 truncation warnings with 32-bit allocator size_type/difference_type.
test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp
test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp
Iterate with C::size_type because that's what operator[] takes.
test/std/containers/sequences/vector/contiguous.pass.cpp
test/std/strings/basic.string/string.require/contiguous.pass.cpp
Add static_cast<typename C::difference_type> because that's what the iterator's operator+ takes.
Fixes D27777.
llvm-svn: 289734
Sean Silva [Wed, 14 Dec 2016 22:45:52 +0000 (22:45 +0000)]
Rename InputSection.cpp:getSymVA to getRelocTargetVA.
This name was really confusing because there is also another static
helper Symbols.cpp:getSymVA which has the same name.
llvm-svn: 289733
Jonathan Peyton [Wed, 14 Dec 2016 22:39:11 +0000 (22:39 +0000)]
Change source files from .c to .cpp
Patch by Hansang Bae
Differential Revision: https://reviews.llvm.org/D26688
llvm-svn: 289732
Greg Clayton [Wed, 14 Dec 2016 22:38:08 +0000 (22:38 +0000)]
Add the ability to get attribute values as Optional<T>
When getting attributes it is sometimes nicer to use Optional<T> some of the time instead of magic values. I tried to cut over to only using the Optional values but it made many of the call sites very messy, so it makes sense the leave in the calls that can return a default value. Otherwise code that looks like this:
uint64_t CallColumn = Die.getAttributeValueAsAddress(DW_AT_call_line, 0);
Has to be turned into:
uint64_t CallColumn = 0;
if (auto CallColumnValue = Die.getAttributeValueAsAddress(DW_AT_call_line))
CallColumn = *CallColumnValue;
The first snippet of code looks much better. But in cases where you want an offset that may or may not be there, the following code looks better:
if (auto StmtOffset = Die.getAttributeValueAsSectionOffset(DW_AT_stmt_list)) {
// Use StmtOffset
}
Differential Revision: https://reviews.llvm.org/D27772
llvm-svn: 289731
Justin Lebar [Wed, 14 Dec 2016 22:32:55 +0000 (22:32 +0000)]
Whitespace cleanup in test/CodeGen/NVPTX/annotations.ll.
llvm-svn: 289730
Justin Lebar [Wed, 14 Dec 2016 22:32:50 +0000 (22:32 +0000)]
[NVPTX] Support .maxnreg annotation.
Reviewers: tra
Subscribers: llvm-commits, jholewinski
Differential Revision: https://reviews.llvm.org/D27638
llvm-svn: 289729
Justin Lebar [Wed, 14 Dec 2016 22:32:44 +0000 (22:32 +0000)]
[NVPTX] Remove string constants from NVPTXBaseInfo.h.
Summary:
Previously they were defined as a 2D char array in a header file. This
is kind of overkill -- we can let the linker lay out these strings
however it pleases. While we're at it, we might as well just inline
these constants where they're used, as each of them is used only once.
Also move NVPTXUtilities.{h,cpp} into namespace llvm.
Reviewers: tra
Subscribers: jholewinski, mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D27636
llvm-svn: 289728
Eric Fiselier [Wed, 14 Dec 2016 22:22:38 +0000 (22:22 +0000)]
[libcxx] Fix tuple construction/assignment from types derived from tuple/pair/array.
Summary:
The standard requires tuple have the following constructors:
```
tuple(tuple<OtherTypes...> const&);
tuple(tuple<OtherTypes...> &&);
tuple(pair<T1, T2> const&);
tuple(pair<T1, T2> &&);
tuple(array<T, N> const&);
tuple(array<T, N> &&);
```
However libc++ implements these as a single constructor with the signature:
```
template <class TupleLike, enable_if_t<__is_tuple_like<TupleLike>::value>>
tuple(TupleLike&&);
```
This causes the constructor to reject types derived from tuple-like types; Unlike if we had all of the concrete overloads, because they cause the derived->base conversion in the signature.
This patch fixes this issue by detecting derived types and the tuple-like base they are derived from. It does this by creating an overloaded function with signatures for each of tuple/pair/array and checking if the possibly derived type can convert to any of them.
This patch fixes [PR17550]( https://llvm.org/bugs/show_bug.cgi?id=17550)
This patch
Reviewers: mclow.lists, K-ballo, mpark, EricWF
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D27606
llvm-svn: 289727
Peter Collingbourne [Wed, 14 Dec 2016 22:19:22 +0000 (22:19 +0000)]
LibDriver: Reject inputs that are not COFF objects or bitcode files.
Fixes PR31372.
Differential Revision: https://reviews.llvm.org/D27776
llvm-svn: 289726
Dehao Chen [Wed, 14 Dec 2016 22:06:49 +0000 (22:06 +0000)]
Only sets profile summary when it was not preset.
Summary: SampleProfileLoader pass may be invoked twice by LTO. The 2nd pass should not append more summary info as it is already preset by the 1st pass.
Reviewers: eraman, davidxl
Subscribers: mehdi_amini, llvm-commits
Differential Revision: https://reviews.llvm.org/D27733
llvm-svn: 289725
Dehao Chen [Wed, 14 Dec 2016 22:03:08 +0000 (22:03 +0000)]
Fix the bug in r289714 (NFC).
llvm-svn: 289724
Jan Sjodin [Wed, 14 Dec 2016 21:58:42 +0000 (21:58 +0000)]
Revert revision 289721.
llvm-svn: 289723
Davide Italiano [Wed, 14 Dec 2016 21:58:26 +0000 (21:58 +0000)]
[LTO] Catch up with llvm. Modules without DL are now considered invalid.
llvm-svn: 289722
Jan Sjodin [Wed, 14 Dec 2016 21:57:18 +0000 (21:57 +0000)]
Dummy commit.
llvm-svn: 289721
Davide Italiano [Wed, 14 Dec 2016 21:57:14 +0000 (21:57 +0000)]
[LTO] Add the missing datalayout in a test.
llvm-svn: 289720
Davide Italiano [Wed, 14 Dec 2016 21:57:04 +0000 (21:57 +0000)]
[LTO] Reject modules without datalayout.
Also, udpate the ~60 failing tests in the tree which did
not contain a valid datalayout.
This fixes PR31123. lld will be updated in a following patch,
immediately after this is committed.
Differential Revision: https://reviews.llvm.org/D27082
llvm-svn: 289719
Filipe Cabecinhas [Wed, 14 Dec 2016 21:57:04 +0000 (21:57 +0000)]
[asan] Don't skip instrumentation of masked load/store unless we've seen a full load/store on that pointer.
Reviewers: kcc, RKSimon
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D27625
llvm-svn: 289718
Filipe Cabecinhas [Wed, 14 Dec 2016 21:56:59 +0000 (21:56 +0000)]
[asan] Hook ClInstrumentWrites and ClInstrumentReads to masked operation instrumentation.
Reviewers: kcc
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D27548
llvm-svn: 289717
Eric Fiselier [Wed, 14 Dec 2016 21:44:08 +0000 (21:44 +0000)]
XFAIL test on apple-clang-7.0
llvm-svn: 289716
Dehao Chen [Wed, 14 Dec 2016 21:41:04 +0000 (21:41 +0000)]
Create SampleProfileLoader pass in llvm instead of clang
Summary:
We used to create SampleProfileLoader pass in clang. This makes LTO/ThinLTO unable to add this pass in the linker plugin. This patch moves the SampleProfileLoader pass creation from
clang to llvm pass manager builder.
Reviewers: tejohnson, davidxl, dnovillo
Subscribers: mehdi_amini, cfe-commits
Differential Revision: https://reviews.llvm.org/D27744
llvm-svn: 289715
Dehao Chen [Wed, 14 Dec 2016 21:40:47 +0000 (21:40 +0000)]
Create SampleProfileLoader pass in llvm instead of clang
Summary: We used to create SampleProfileLoader pass in clang. This makes LTO/ThinLTO unable to add this pass in the linker plugin. This patch moves the SampleProfileLoader pass creation from clang to llvm pass manager builder.
Reviewers: tejohnson, davidxl, dnovillo
Subscribers: llvm-commits, mehdi_amini
Differential Revision: https://reviews.llvm.org/D27743
llvm-svn: 289714
Nico Weber [Wed, 14 Dec 2016 21:38:18 +0000 (21:38 +0000)]
Revert 289252 (and follow-up 289285), it caused PR31374
llvm-svn: 289713
Nico Weber [Wed, 14 Dec 2016 21:34:19 +0000 (21:34 +0000)]
Update MSVC compat docs about debug info
https://reviews.llvm.org/D27769
llvm-svn: 289712
Sean Callanan [Wed, 14 Dec 2016 21:31:31 +0000 (21:31 +0000)]
Adopt PrettyStackTrace in LLDB
LLDB needs some minor changes to adopt PrettyStackTrace after https://reviews.llvm.org/D27683.
We remove our own SetCrashDescription() function and use LLVM-provided RAII objects instead.
We also make sure LLDB doesn't define __crashtracer_info__ which would collide with LLVM's definition.
Differential Revision: https://reviews.llvm.org/D27735
llvm-svn: 289711
Eric Fiselier [Wed, 14 Dec 2016 21:29:29 +0000 (21:29 +0000)]
[libcxx] Fix PR24075, PR23841 - Add scoped_allocator_adaptor::construct(pair<T, U>*, ...) overloads.
Summary:
For more information see:
* https://llvm.org/bugs/show_bug.cgi?id=23841
* https://llvm.org/bugs/show_bug.cgi?id=24075
I hope you have as much fun reviewing as I did writing these insane tests!
Reviewers: mclow.lists, AlisdairM, EricWF
Subscribers: AlisdairM, Potatoswatter, cfe-commits
Differential Revision: https://reviews.llvm.org/D27612
llvm-svn: 289710
Eric Fiselier [Wed, 14 Dec 2016 21:22:48 +0000 (21:22 +0000)]
Recommit r286884: P0503R0, adopted in Issaquah, rewords some requirements on nullptr_t and istream_iterator.
No code changes were needed, but I updated a few tests.
Also resolved P0509 and P0521, which required no changes to the library or tests.
This patch was reverted due to llvm.org/PR31016. There is a bug in Clang 3.7
which causes default.pass.cpp to fails. That test is now marked as XFAIL for that
clang version.
This patch was originally authored by Marshall Clow.
llvm-svn: 289708
Michal Gorny [Wed, 14 Dec 2016 20:53:57 +0000 (20:53 +0000)]
Remove unnecessary llvm/Config/config.h includes
Remove the includes of <llvm/Config/config.h> private LLVM header.
The relevant files seem not to use any definitions from that file,
and it is not available when building against installed LLVM.
The use in lib/ReaderWriter/MachO/MachOLinkingContext.cpp originates
from rL218718, and the use in ELF/Strings.cpp from rL274804 (where it
was moved from Symbols.cpp). In both cases, they were added as a part of
demangling support, and they provided HAVE_CXXABI_H.
Since we are now using the LLVM demangler library instead, the code was
removed and the includes and no longer necessary.
Differential Revision: https://reviews.llvm.org/D27757
llvm-svn: 289707
Eli Friedman [Wed, 14 Dec 2016 20:44:38 +0000 (20:44 +0000)]
[ARM] Split 128-bit vectors in BUILD_VECTOR lowering
Given that INSERT_VECTOR_ELT operates on D registers anyway, combining
64-bit vectors into a 128-bit vector is basically free. Therefore, try
to split BUILD_VECTOR nodes before giving up and lowering them to a series
of INSERT_VECTOR_ELT instructions. Sometimes this allows dramatically
better lowerings; see testcases for examples. Inspired by similar code
in the x86 backend for AVX.
Differential Revision: https://reviews.llvm.org/D27624
llvm-svn: 289706
Nico Weber [Wed, 14 Dec 2016 20:33:54 +0000 (20:33 +0000)]
fix gcc warning about a superfluous ;
llvm-svn: 289705
Robert Lougher [Wed, 14 Dec 2016 20:27:22 +0000 (20:27 +0000)]
[InstCombine] Folding of a compare with RHS const should merge debug locations
If all the operands to a phi node are compares that have a RHS constant,
instcombine will try to pull them through the phi node, combining them into
a single operation. When it does this, the debug location of the new op
should be the merged debug locations of the phi node arguments.
Patch 8 of 8 for D26256. Folding of a compare that has a RHS constant.
Differential Revision: https://reviews.llvm.org/D26256
llvm-svn: 289704
Eli Friedman [Wed, 14 Dec 2016 20:25:26 +0000 (20:25 +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).
Differential Revision: https://reviews.llvm.org/D27694
llvm-svn: 289703
Amjad Aboud [Wed, 14 Dec 2016 20:24:54 +0000 (20:24 +0000)]
[DebugInfo] Changed DIBuilder::createCompileUnit() to take DIFile instead of FileName and Directory.
This way it will be easier to expand DIFile (e.g., to contain checksum) without the need to modify the createCompileUnit() API.
Reviewers: llvm-commits, rnk
Differential Revision: https://reviews.llvm.org/D27762
llvm-svn: 289702
Amjad Aboud [Wed, 14 Dec 2016 20:24:40 +0000 (20:24 +0000)]
[DebugInfo] Changed DIBuilder::createCompileUnit() to take DIFile instead of FileName and Directory.
This way it will be easier to expand DIFile (e.g., to contain checksum) without the need to modify the createCompileUnit() API.
Reviewers: cfe-commits, rnk
Differential Revision: https://reviews.llvm.org/D27763
llvm-svn: 289701
Yaxun Liu [Wed, 14 Dec 2016 20:17:47 +0000 (20:17 +0000)]
Fix build failure due to r289674 on certain systems
Removed a useless include which caused conflict.
llvm-svn: 289700
Robert Lougher [Wed, 14 Dec 2016 20:07:49 +0000 (20:07 +0000)]
[InstCombine] Folding of a binop with RHS const should merge the debug locations
If all the operands to a phi node are a binop with a RHS constant, instcombine
will try to pull them through the phi node, combining them into a single
operation. When it does this, the debug location of the new op should be the
merged debug locations of the phi node arguments.
Patch 7 of 8 for D26256. Folding of a binop with RHS constant.
Differential Revision: https://reviews.llvm.org/D26256
llvm-svn: 289699
Richard Smith [Wed, 14 Dec 2016 19:45:03 +0000 (19:45 +0000)]
Remove unused variable found by GCC warning.
llvm-svn: 289698
David Blaikie [Wed, 14 Dec 2016 19:38:39 +0000 (19:38 +0000)]
DebugInfo: Improve type safety and simplify some subprogram finalization code
This probably ended up this way aften the subprogram<>function link
inversion and debug info metadata schema changes.
llvm-svn: 289697
Geoff Berry [Wed, 14 Dec 2016 19:38:22 +0000 (19:38 +0000)]
[GVNHoist] Move GVNHoist to function simplification part of pipeline.
Summary:
Move GVNHoist to later in the optimization pipeline, specifically, to
the function simplification part of the pipeline. The new pipeline
location allows GVNHoist to run on a function after its callees have
been inlined but before the function has been considered for inlining
into its callers, exposing more opportunities for hoisting.
Performance results on AArch64 kryo:
Improvements:
Benchmarks/CoyoteBench/fftbench -24.952%
spec2006/bzip2 -4.071%
internal bmark -3.177%
Benchmarks/PAQ8p/paq8p -1.754%
spec2000/perlbmk -1.328%
spec2006/h264ref -1.140%
Regressions:
internal bmark +1.818%
Benchmarks/mafft/pairlocalalign +1.084%
Reviewers: sebpop, dberlin, hiraditya
Subscribers: aemerson, mehdi_amini, mcrosier, llvm-commits
Differential Revision: https://reviews.llvm.org/D27722
llvm-svn: 289696
Jim Ingham [Wed, 14 Dec 2016 19:35:56 +0000 (19:35 +0000)]
Test num locations >= 1 not == 1.
llvm-svn: 289695
Andrew Kaylor [Wed, 14 Dec 2016 19:30:18 +0000 (19:30 +0000)]
[WinEH] Avoid holding references to BlockColor (DenseMap) entries while inserting new elements
Differential Revision: https://reviews.llvm.org/D27693
llvm-svn: 289694
Robert Lougher [Wed, 14 Dec 2016 19:24:01 +0000 (19:24 +0000)]
[InstCombine] When folding casts through a phi node merge the debug locations
If all the operands to a phi node are a cast, instcombine will try to pull
them through the phi node, combining them into a single cast. When it does
this, the debug location of the new cast should be the merged debug locations
of the phi node arguments.
Patch 6 of 8 for D26256. Folding of a cast operation.
Differential Revision: https://reviews.llvm.org/D26256
llvm-svn: 289693
Tim Northover [Wed, 14 Dec 2016 19:21:30 +0000 (19:21 +0000)]
AArch64: add architecture version feature to Clang invocation.
Otherwise we don't get the correct predefines and so on in the front-end (or
the right features in the backend).
llvm-svn: 289692
Sean Callanan [Wed, 14 Dec 2016 19:19:53 +0000 (19:19 +0000)]
Include <cstdarg> in PrettyStackTrace.cpp, fixing the bots.
llvm-svn: 289691
Kostya Serebryany [Wed, 14 Dec 2016 19:10:17 +0000 (19:10 +0000)]
[sanitizer] intercept bstring functions, patch by Kuang-che Wu (https://reviews.llvm.org/D27659)
llvm-svn: 289690
Sean Callanan [Wed, 14 Dec 2016 19:09:43 +0000 (19:09 +0000)]
Prepare PrettyStackTrace for LLDB adoption
This patch fixes the linkage for __crashtracer_info__, making it have the proper mangling (extern "C") and linkage (private extern).
It also adds a new PrettyStackTrace type, allowing LLDB to adopt this instead of Host::SetCrashDescriptionWithFormat().
Without this patch, CrashTracer on macOS won't pick up pretty stack traces from any LLVM client.
An LLDB commit adopting this API will follow shortly.
Differential Revision: https://reviews.llvm.org/D27683
llvm-svn: 289689
Robert Lougher [Wed, 14 Dec 2016 19:02:14 +0000 (19:02 +0000)]
[InstCombine] Folding loads through a phi node should merge the debug locations
If all the operands to a phi node are a load, instcombine will try to pull
them through the phi node, combining them into a single load. When it does
this, the debug location of the new load should be the merged debug locations
of the phi node arguments.
Patch 5 of 8 for D26256. Folding of a load operation.
Differential Revision: https://reviews.llvm.org/D26256
llvm-svn: 289688
David Gross [Wed, 14 Dec 2016 18:52:33 +0000 (18:52 +0000)]
[DebugInfo] Restore test case for long double constants.
Summary:
D27549 (partial fix for PR26619) emits a constant value in the debug
metadata for a floating-point static const that does not exceed 64
bits in size. Whether or not a long double exceeds 64 bits in size
depends on the target. Modify the test case so that it expects a
constant value for long double if and only if the long double is no
larger than 64 bits.
Reviewers: cfe-commits, probinson
Differential Revision: https://reviews.llvm.org/D27597
llvm-svn: 289686
Devin Coughlin [Wed, 14 Dec 2016 18:46:01 +0000 (18:46 +0000)]
[Driver] Add tests for enabled static analyzer checkers.
The driver passes flags to cc1 that enable various checkers based on
the target triple. This commit adds tests for these flags on Darwin, Linux,
and Windows.
This is a test-only change.
llvm-svn: 289685
Robert Lougher [Wed, 14 Dec 2016 18:37:50 +0000 (18:37 +0000)]
[InstCombine] When folding GEP through a phi node merge the debug locations
If all the operands to a phi node are getelementptr, instcombine
will try to pull them through the phi node, combining them into a single
operation. When it does this, the debug location of the new getelementptr
should be the merged debug locations of the phi node arguments.
Patch 4 of 8 for D26256. Folding of a getelementptr operation.
Differential Revision: https://reviews.llvm.org/D26256
llvm-svn: 289684
Eric Christopher [Wed, 14 Dec 2016 18:29:39 +0000 (18:29 +0000)]
This change does two things:
Adds a "Discriminator" field to struct DILineInfo, which defaults to 0.
Fills out the "Discriminator" field in DILineInfo in DWARFDebugLine::LineTable::getFileLineInfoForAddress().
in order to have a slightly nicer interface in getFileLineInfoForAddress.
Patch by Simon Que!
Differential Revision: https://reviews.llvm.org/D27649
llvm-svn: 289683
Dmitry Vyukov [Wed, 14 Dec 2016 18:20:18 +0000 (18:20 +0000)]
tsan: allow Java VM iterate over allocated objects
Objects may move during the garbage collection, and JVM needs
to notify ThreadAnalyzer about that. The new function
__tsan_java_find eliminates the need to maintain these
objects both in ThreadAnalyzer and JVM.
Author: Alexander Smundak (asmundak)
Reviewed in https://reviews.llvm.org/D27720
llvm-svn: 289682
Robert Lougher [Wed, 14 Dec 2016 18:14:57 +0000 (18:14 +0000)]
[InstCombine] Merge debug locations when folding through a phi node
If all the operands to a phi node are of the same operation, instcombine
will try to pull them through the phi node, combining them into a single
operation. When it does this, the debug location of the operation should
be the merged debug locations of the phi node arguments.
Patch 3 of 8 for D26256. Folding of a compare operation.
Differential Revision: https://reviews.llvm.org/D26256
llvm-svn: 289681
Kostya Serebryany [Wed, 14 Dec 2016 18:13:02 +0000 (18:13 +0000)]
[libFuzzer] disable msan for one more hook that reads target's data that might be uninitialized
llvm-svn: 289680
Robert Lougher [Wed, 14 Dec 2016 17:49:19 +0000 (17:49 +0000)]
[InstCombine] Merge debug locations when folding through a phi node
If all the operands to a phi node are of the same operation, instcombine
will try to pull them through the phi node, combining them into a single
operation. When it does this, the debug location of the operation should
be the merged debug locations of the phi node arguments.
Patch 2 of 8 for D26256. Folding of a binary operation.
Differential Revision: https://reviews.llvm.org/D26256
llvm-svn: 289679
Reid Kleckner [Wed, 14 Dec 2016 17:44:11 +0000 (17:44 +0000)]
Improve our handling of tag decls in function prototypes
r289225 broke AST invariants by reparenting enumerators into function
decl contexts. This improves things by only reparenting TagDecls while
also attempting to preserve the lexical declcontext chain. The
interesting example here is:
int f(struct S { enum E { a = 1 } b; } c);
The semantic contexts of E and S should be f, and the lexical context of
S should be f and the lexical context of E should be S. We didn't do
that with r289225, but now we should.
This change should also improve our behavior on this example:
void f() {
extern void ext(struct S { } o);
// S injected here
}
Before r289225 we would only remove 'S' from the surrounding tag
injection context if it was the TU, but now we properly reparent S from
f to ext.
Fixes PR31366
llvm-svn: 289678
Dehao Chen [Wed, 14 Dec 2016 17:23:16 +0000 (17:23 +0000)]
revert r289669 which breaks bots
llvm-svn: 289676
Dehao Chen [Wed, 14 Dec 2016 17:22:53 +0000 (17:22 +0000)]
revert r289670 which breaks bot.
llvm-svn: 289675
Yaxun Liu [Wed, 14 Dec 2016 17:16:52 +0000 (17:16 +0000)]
AMDGPU: Emit runtime metadata version 2 as YAML
Differential Revision: https://reviews.llvm.org/D25046
llvm-svn: 289674