28161 Commits

Author SHA1 Message Date
Kevin Enderby
317de7ce5b Thread Expected<...> up from libObject’s getSymbolAddress() for symbols to allow
a good error message to be produced.

This is nearly the last libObject interface that used ErrorOr and the last one
that appears in llvm/include/llvm/Object/MachO.h .  For Mach-O objects this is
just a clean up because it’s version of getSymbolAddress() can’t return an
error.

I will leave it to the experts on COFF and ELF to actually add meaning full
error messages in their tests if they wish.  And also leave it to these experts
to change the last two ErrorOr interfaces in llvm/include/llvm/Object/ObjectFile.h
for createCOFFObjectFile() and createELFObjectFile() if they wish.

Since there are no test cases for COFF and ELF error cases with respect to
getSymbolAddress() in the test suite this is no functional change (NFC).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273701 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-24 18:24:42 +00:00
Peter Collingbourne
43c5139fd2 Linker: Copy metadata when linking declarations.
Differential Revision: http://reviews.llvm.org/D21624

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273692 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-24 17:42:21 +00:00
Reid Kleckner
b892430f09 [codeview] Use one byte for S_FRAMECOOKIE CookieKind and add flags byte
We bailed out while printing codeview for an MSVC compiled
SemaExprCXX.cpp that used this record. The MS reference headers look
incorrect here, which is probably why we had this bug. They use a 32-bit
enum as the field type, but the actual record appears to use one byte
for the cookie kind followed by a flags byte.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273691 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-24 17:23:49 +00:00
Artur Pilipenko
140d9e6906 Remangle intrinsics names when types are renamed
This is a resubmittion of previously reverted rL273568.

This is a fix for the problem mentioned in "LTO and intrinsics mangling" llvm-dev mail thread:
http://lists.llvm.org/pipermail/llvm-dev/2016-April/098387.html

Reviewers: mehdi_amini, reames

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273686 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-24 15:10:29 +00:00
Artur Pilipenko
2630656dc9 NFC. Move verifyIntrinsicIsVarArg from verifier to Intrinsic::matchIntrinsicVarArg since it will be reused for intrinsic remangling code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273685 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-24 14:47:27 +00:00
Chad Rosier
238d855bdc [MachineDominatorTree] Add a MDT verifier.
Differential Revision: http://reviews.llvm.org/D21657

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273678 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-24 13:32:22 +00:00
Hubert Tong
29f4c94251 Revert r273664
Revert change until build issues with MSVC can be resolved.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273670 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-24 12:25:15 +00:00
Hubert Tong
84a2040038 Add FixedSizeStorage to TrailingObjects; NFC
Summary: This change introduces two types, `FixedSizeStorage` and `FixedSizeStorageOwner`, which can be used to provide stack-allocated objects with trailing objects.

Reviewers: rsmith, faisalv, aaron.ballman

Subscribers: llvm-commits, cfe-commits, nwilson

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273664 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-24 11:34:16 +00:00
Simon Dardis
111ec25a8e Revert "Revert "[misched] Extend scheduler to handle unsupported features""
This reverts commit r273565.

This was an over-eager revert.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273658 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-24 08:43:27 +00:00
David Majnemer
8970c8886c Use the same underlying type for bitfields
MSVC allocates fresh storage for consecutive bitfields with different
underlying types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273645 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-24 04:05:25 +00:00
Tom Stellard
6898ae0d22 Support/ELF: Add R_AMDGPU_GOTPCREL relocation
Summary:
We will start generating this in a future patch.

Reviewers: arsenm, kzhuravl, rafael, ruiu, tony-tye

Subscribers: arsenm, llvm-commits, kzhuravl

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273628 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 23:11:29 +00:00
Chandler Carruth
6ee5dc2094 [LCG] Make the name of an SCC include more of the functions in it.
This makes it much easier to debug issues when the logging contains the
name of the SCC. It requires to create a temporary string, but for
logging and debugging uses that seems fine. I've added logic to try to
output all the function names with an elipsis if there are too many.
This was helpful fro me in debugging issues with the new pass manager.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273625 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 22:51:14 +00:00
Anna Thomas
dce5fb2295 InstCombine rule to fold trunc when value available
Summary:
This instcombine rule folds away trunc operations that have value available from a prior load or store.
This kind of code can be generated as a result of GVN widening the load or from source code as well.

Reviewers: reames, majnemer, sanjoy

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273608 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 20:22:22 +00:00
Vassil Vassilev
ec3f1412f3 Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273592 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 18:13:46 +00:00
Sanjoy Das
bad5ba7b5f [SCEV] Don't unnecessarily namespace; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273587 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 18:03:32 +00:00
Nirav Dave
218e5843a6 Preserve DebugInfo when replacing values in DAGCombiner
Recommiting after correcting over-eager Debug Value transfer fixing PR28270.

[DAG] Previously debug values would transfer debuginfo for the selected
start node for a replacement which allows for debug to be dropped.

Push debug value transfer to occur with node/value replacement in
SelectionDAG, remove now extraneous transfers of debug values.

This refixes PR9817 which was being incompletely checked in the
testsuite.

Reviewers: jyknight

Subscribers: dblaikie, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273585 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 17:52:57 +00:00
Pablo Barrio
e8da13b383 [ARM] Lower (select_cc k k (select_cc ~k ~k x)) into (SSAT l_k x)
Summary:
SSAT saturates an integer, making sure that its value lies within
an interval [-k, k]. Since the constant is given to SSAT as the
number of bytes set to one, k + 1 must be a power of 2, otherwise
the optimization is not possible. Also, the select_cc must use <
and > respectively so that they define an interval.

Reviewers: mcrosier, jmolloy, rengolin

Subscribers: aemerson, rengolin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273581 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 16:53:49 +00:00
Hans Wennborg
99faa52b7b Revert r273568 "Remangle intrinsics names when types are renamed"
It broke 2008-07-15-Bswap.ll and 2009-09-01-PostRAProlog.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273574 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 16:13:23 +00:00
Artur Pilipenko
8f9264543d Remangle intrinsics names when types are renamed
This is a fix for the problem mentioned in "LTO and intrinsics mangling" llvm-dev mail thread:
http://lists.llvm.org/pipermail/llvm-dev/2016-April/098387.html

Reviewers: mehdi_amini, reames

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273568 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 15:25:09 +00:00
Simon Dardis
f84be7849c Revert "[misched] Extend scheduler to handle unsupported features"
This reverts commit r273551.

Patch contained a wrong check for isUnsupported.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273565 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 14:54:47 +00:00
Simon Dardis
53391f414b [misched] Extend scheduler to handle unsupported features
Currently isComplete = 1 requires that every instruction must
be described, declared unsupported or marked as having no
scheduling information for a processor.

For some backends such as MIPS, this requirement entails
long regex lists of instructions that are unsupported.

This patch teaches Tablegen to skip over instructions that
are associated with unsupported feature when checking if the
scheduling model is complete.

Patch by: Daniel Sanders

Contributions by: Simon Dardis

Reviewers: MatzeB

Differential Reviewer: http://reviews.llvm.org/D20522


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273551 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 09:22:11 +00:00
Craig Topper
12d48c9c94 [AVX512] Remove masked unpack intrinsics and autoupgrade to vectorshuffle and selects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273543 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 07:37:33 +00:00
Vassil Vassilev
6b0bf92307 [modules] Good ol' JIT is gone.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273541 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 07:33:03 +00:00
Vassil Vassilev
42bb3896ef Add missing include. Should fix modules builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273540 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 07:30:12 +00:00
David Majnemer
7867935f71 [ADT] Add a range variant of std::transform
This will be used in a followup change in clang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273520 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 00:14:26 +00:00
Peter Collingbourne
7cbcee7cad Revert r273456, "Preserve DebugInfo when replacing values in DAGCombiner" as it caused pr28270.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273518 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 00:06:17 +00:00
Reid Kleckner
26f1ddead4 Prune some includes from headers and sink some inline functions
MCSymbol.h shouldn't pull in MCAssembler.h, just MCFragment.h.
MCLinkerOptimizationHint.h shouldn't need MCMachObjectWriter.h.  The
rest is fixing the fallout.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273507 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 23:23:08 +00:00
Xinliang David Li
42fe7e4c85 [PM]: LoopAccessInfo simple refactoring
To make definition of mov ctors easier.
Differential Revision: http://reviews.llvm.org/D21563



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273506 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 23:20:59 +00:00
Chris Bieneman
1a713c6e05 [MachO] Finish moving fat header swap functions to MachO.h
This is a follow-up to r273479. At the time I wrote r273479 I didn't connect the dots that the functions I was adding had to exist somewhere. Turns out, they do. This finishes moving the functions to MachO.h.

Existing MachO fat header tests like test/tools/llvm-readobj/Inputs/macho-universal-archive.x86_64.i386 execute this code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273502 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 22:19:08 +00:00
Changpeng Fang
7cde679f44 AMDGPU/SI: Define an intrinsic to expose ds_swizzle_b32
Reviewers: tstellarAMD, arsenm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273496 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 21:33:49 +00:00
Pawel Bylica
9b666b1681 Do not require __STDC_LIMIT_MACROS and others
Summary: Do not require __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS macros to be defined globally. They are not needed for C++11 compliant standard headers.

Reviewers: joerg, jyknight

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273493 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 21:15:51 +00:00
Chris Bieneman
57b5696e1a [MachO] Adding a few missing swapStruct functions
These are just missing swap functions for handling endian conversion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273478 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 21:01:17 +00:00
Daniel Berlin
c81dea1072 Update header documentation for API deliberately made public
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273473 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 20:31:12 +00:00
Peter Collingbourne
277258478e IR: Introduce Module::global_objects().
This is a convenience iterator that allows clients to enumerate the
GlobalObjects within a Module.

Also start using it in a few places where it is obviously the right thing
to use.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273470 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 20:29:42 +00:00
Davide Italiano
e93d6b14f7 [UpdateCompilerUsed] API rename and cleanup, suggested by Rafaael.
* UpdateCompilerUsed() -> updateCompilerUsed()
* ThinLTO doesn't use the API so we can remove the include
* Clean up unused #include <functional> from the header
* Rename #ifdef guard comment to be correct.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273461 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 19:50:42 +00:00
Xinliang David Li
9e588d89c5 [MBFI]: Add a new suboption for graph viewer
-view-machine-block-freq-propagation-dags currently
support integer and fraction as the suboptions. This
patch adds the 'count' suboption to display actual
profile count if available.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273460 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 19:26:44 +00:00
Sanjay Patel
efa1f7f367 [ValueTracking] improve ComputeNumSignBits for vector constants
This is similar to the computeKnownBits improvement in rL268479. 
There's probably more we can do for vector logic instructions, but 
this should let us see non-splat constant masking ops that can
become vector selects instead of and/andn/or sequences.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273459 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 19:20:59 +00:00
Nirav Dave
123be93bcd Preserve DebugInfo when replacing values in DAGCombiner
Recommiting after fixing over-aggressive assertion

[DAG] Previously debug values would transfer debuginfo for the selected
start node for a replacement which allows for debug to be dropped.

Push debug value transfer to occur with node/value replacement in
SelectionDAG, remove now extraneous transfers of debug values.

This refixes PR9817 which was being incompletely checked in the
testsuite.

Reviewers: jyknight

Subscribers: dblaikie, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273456 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 19:03:26 +00:00
Wei Ding
ef86963806 AMDGPU: Add convergent flag to INLINEASM instruction.
Differential Revision: http://reviews.llvm.org/D21214

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273455 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 18:51:08 +00:00
Reid Kleckner
2ec3f6d303 [codeview] Add IntroducingVirtual debug info flag
CodeView needs to know if a virtual method was introduced in the current
class, and base classes may not have complete type information, so we
need to thread this bit through from the frontend.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273453 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 18:31:14 +00:00
Reid Kleckner
b0625ca074 [codeview] Fix trivial bug in OneMethodRecord::isIntroducingVirtual
These should be equality comparisons. Fixes assertions while
self-hosting clang with codeview debug info.

Ultimately this is going to be covered by real tests for virtual method
emission, so I'm not adding a "don't crash on this input" test that I'll
remove soon afterwards.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273446 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 17:32:59 +00:00
Xinliang David Li
7f4f1f640d [BFI]: NFC refactoring
move getBlockProfileCount implementation to the
base class so that MBFI can share too.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273442 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 17:12:12 +00:00
Artur Pilipenko
5e371d9c0c NFC. Move Verifier::verifyIntrinsicType to Intrinsics.h
Move Verifier::verifyIntrinsicType to Intrinsics::matchIntrinsicsType. Will be used to accumulate overloaded types of a given intrinsic by the upcoming patch to fix intrinsics names when overloaded types are renamed.
    
Reviewed By: reames
    
Differential Revision: http://reviews.llvm.org/D19372


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273424 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 14:56:33 +00:00
Krzysztof Parzyszek
d140aab2ca [SDAG] Remove FixedArgs parameter from CallLoweringInfo::setCallee
The setCallee function will set the number of fixed arguments based
on the size of the argument list. The FixedArgs parameter was often
explicitly set to 0, leading to a lack of consistent value for non-
vararg functions.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273403 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 12:54:25 +00:00
Davide Italiano
e5ebd46f63 [LTO] Move UpdateCompilerUsed.h from lib/ to include/
I plan to use it in lld soon.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273380 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 04:52:43 +00:00
Craig Topper
8d6ae3340f [X86] Remove GCC builtins from masked integer cmp and ucmp instrinsics so we can emit native IR in clang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273376 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 04:47:42 +00:00
Peter Collingbourne
99e2e27b37 IR: Allow metadata attachments on declarations, and fix lazy loaded metadata issue with globals.
This change is motivated by an upcoming change to the metadata representation
used for CFI. The indirect function call checker needs type information for
external function declarations in order to correctly generate jump table
entries for such declarations. We currently associate such type information
with declarations using a global metadata node, but I plan [1] to move all
such metadata to global object attachments.

In bitcode, metadata attachments for function declarations appear in the
global metadata block. This seems reasonable to me because I expect metadata
attachments on declarations to be uncommon. In the long term I'd also expect
this to be the case for CFI, because we'd want to use some specialized bitcode
format for this metadata that could be read as part of the ThinLTO thin-link
phase, which would mean that it would not appear in the global metadata block.

To solve the lazy loaded metadata issue I was seeing with D20147, I use the
same bitcode representation for metadata attachments for global variables as I
do for function declarations. Since there's a use case for metadata attachments
in the global metadata block, we might as well use that representation for
global variables as well, at least until we have a mechanism for lazy loading
global variables.

In the assembly format, the metadata attachments appear after the "declare"
keyword in order to avoid a parsing ambiguity.

[1] http://lists.llvm.org/pipermail/llvm-dev/2016-June/100462.html

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273336 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-21 23:42:48 +00:00
Vedant Kumar
1037ef2574 [Coverage] Clarify ownership of a MemoryBuffer in the reader (NFC)
Pass a `MemoryBuffer &` to BinaryCoverageReader::create() instead of a
`std::unique_ptr<MemoryBuffer> &`. This makes it easier to reason about
the ownership of the buffer at a glance.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273326 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-21 22:22:33 +00:00
Jan Vesely
fe07a9a04c AMDGPU: Remove gcc builtin names from workitem intrinsics
We'll need to emit these manually in clang to add range metadata

Reviewers: arsenm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273318 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-21 20:46:22 +00:00
Jan Vesely
7d5ce4d892 AMDGPU: Add implicitarg.ptr intrinsic.
Points to the start of implicit arguments (appended after explicit arguments)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273317 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-21 20:46:20 +00:00