Dylan McKay [Thu, 15 Dec 2016 09:38:09 +0000 (09:38 +0000)]
[AVR] Add argument indices to the instrumention hook functions
This allows the instrumention hook functions to do better
pretty-printing.
llvm-svn: 289793
George Rimar [Thu, 15 Dec 2016 09:30:07 +0000 (09:30 +0000)]
[ELF] - Attempt to fix ubuntu bot.
(http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/2982)
llvm-svn: 289792
Michael Kruse [Thu, 15 Dec 2016 09:25:14 +0000 (09:25 +0000)]
Remove references to AssumptionCache. NFC.
The AssumptionCache was removed in r289756 after being replaced by the an
addtional operand list of affected values in r289755. The absence of that cache
means that we have now have to manually search for llvm.assume intrinsics as
now done by other passes (LazyValueInfo, CodeMetrics) do not take into
account an llvm::Instruction's user lists (ScalarEvolution).
llvm-svn: 289791
George Rimar [Thu, 15 Dec 2016 09:08:13 +0000 (09:08 +0000)]
[ELF] - Partial support of --gdb-index command line option (Part 2).
Patch continues work started in D24706,
in this patch address area was added to .gdb_index section output.
Differential revision: https://reviews.llvm.org/D25821
llvm-svn: 289790
Dean Michael Berris [Thu, 15 Dec 2016 09:04:05 +0000 (09:04 +0000)]
[XRay][compiler-rt][NFC] Deduplicate code in x86-64 trampolines.
Summary:
The layout of all registers saved on stack shouldn't deviate and will be reused in future trampolines as well.
While there, fix whitespace and clarify comments.
Author: mpel
Reviewers: dberris
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D27799
llvm-svn: 289789
Prakhar Bahuguna [Thu, 15 Dec 2016 08:42:04 +0000 (08:42 +0000)]
Fix for build warning in execute-only support
llvm-svn: 289788
Yaxun Liu [Thu, 15 Dec 2016 08:09:08 +0000 (08:09 +0000)]
Re-commit r289252 and r289285, and fix PR31374
llvm-svn: 289787
Prakhar Bahuguna [Thu, 15 Dec 2016 07:59:24 +0000 (07:59 +0000)]
[ARM] Implement execute-only support in CodeGen
Summary:
This implements execute-only support for ARM code generation, which
prevents the compiler from generating data accesses to code sections.
The following changes are involved:
* Add the CodeGen option "-arm-execute-only" to the ARM code generator.
* Add the clang flag "-mexecute-only" as well as the GCC-compatible
alias "-mpure-code" to enable this option.
* When enabled, literal pools are replaced with MOVW/MOVT instructions,
with VMOV used in addition for floating-point literals. As the MOVT
instruction is required, execute-only support is only available in
Thumb mode for targets supporting ARMv8-M baseline or Thumb2.
* Jump tables are placed in data sections when in execute-only mode.
* The execute-only text section is assigned section ID 0, and is
marked as unreadable with the SHF_ARM_PURECODE flag with symbol 'y'.
This also overrides selection of ELF sections for globals.
Reviewers: t.p.northover, rengolin
Subscribers: llvm-commits, aemerson
Differential Revision: https://reviews.llvm.org/D27450
llvm-svn: 289786
Prakhar Bahuguna [Thu, 15 Dec 2016 07:59:15 +0000 (07:59 +0000)]
Allow ELF section flags to be specified numerically
Summary:
GAS already allows flags for sections to be specified directly as a
numeric value. This functionality is particularly useful for setting
processor or application-specific values that may not be directly
supported or understood by LLVM. This patch allows LLVM to use numeric
section flag values verbatim if specified by the assembly file.
Reviewers: grosbach, rafael, t.p.northover, rengolin
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D27451
llvm-svn: 289785
Prakhar Bahuguna [Thu, 15 Dec 2016 07:59:08 +0000 (07:59 +0000)]
[ARM] Implement execute-only support in CodeGen
This implements execute-only support for ARM code generation, which
prevents the compiler from generating data accesses to code sections.
The following changes are involved:
* Add the CodeGen option "-arm-execute-only" to the ARM code generator.
* Add the clang flag "-mexecute-only" as well as the GCC-compatible
alias "-mpure-code" to enable this option.
* When enabled, literal pools are replaced with MOVW/MOVT instructions,
with VMOV used in addition for floating-point literals. As the MOVT
instruction is required, execute-only support is only available in
Thumb mode for targets supporting ARMv8-M baseline or Thumb2.
* Jump tables are placed in data sections when in execute-only mode.
* The execute-only text section is assigned section ID 0, and is
marked as unreadable with the SHF_ARM_PURECODE flag with symbol 'y'.
This also overrides selection of ELF sections for globals.
llvm-svn: 289784
Saleem Abdulrasool [Thu, 15 Dec 2016 07:29:04 +0000 (07:29 +0000)]
CodeGen: force builtins to be local
Unfortunately _setjmp3 can be both import or local. The ASAN tests try to
emulate the flags which makes this harder to detect. Rely on the linker
creating or using thunks here instead. Should repair the ASAN windows bots.
llvm-svn: 289783
George Rimar [Thu, 15 Dec 2016 07:27:28 +0000 (07:27 +0000)]
[ELF] - Do not crash when move location counter backward.
PR31335 shows that we do that in next case:
SECTIONS { .text 0x2000 : {. = 0x100 ; *(.text) } }
though documentations says that "If . is used inside a section
description however, it refers to the byte offset from the start
of that section, not an absolute address. " looks does not work
as documented in bfd (as mentioned in comments for PR31335).
Until we find out the expected behavior was suggested at least not
to 'crash', what we do after trying to generate huge file.
Differential revision: https://reviews.llvm.org/D27712
llvm-svn: 289782
Eric Fiselier [Thu, 15 Dec 2016 07:23:44 +0000 (07:23 +0000)]
Fix typo
llvm-svn: 289781
Eric Fiselier [Thu, 15 Dec 2016 07:15:39 +0000 (07:15 +0000)]
Add tests for LWG 2796
llvm-svn: 289780
Sanjoy Das [Thu, 15 Dec 2016 07:13:50 +0000 (07:13 +0000)]
Add missing -mtriple to MIR test case
llvm-svn: 289779
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