139702 Commits

Author SHA1 Message Date
Justin Lebar
6461aabcfc [ADT] Add SmallDenseSet.
Summary: This matches SmallDenseMap.

Reviewers: timshen

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284432 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 22:24:28 +00:00
Kevin Enderby
9296e5f5f6 Next set of additional error checks for invalid Mach-O files for the
load commands that use the MachO::sub_framework_command,
MachO::sub_umbrella_command, MachO::sub_library_command
and MachO::sub_client_command types but are not used in llvm
libObject code but used in llvm tool code.

This includes the LC_SUB_FRAMEWORK, LC_SUB_UMBRELLA,
LC_SUB_LIBRARY and LC_SUB_CLIENT load commands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284431 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 22:09:25 +00:00
Zachary Turner
fdfb1c554e Revert formatting changes.
This reverts r288425 and r284428 as they are causing test crashes
on some systems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284429 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 21:25:41 +00:00
Zachary Turner
d4bb10c270 Try to fix build after invalid pointer conversion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284428 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 21:14:27 +00:00
Sanjay Patel
5a8c8ece66 remove FIXME comment (fixed with r284424); NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284427 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 21:08:39 +00:00
Zachary Turner
0a7eca8829 [Support] Add support for "advanced" number formatting.
raw_ostream has not afforded a lot of flexibility in terms of
how to format numbers when outputting.  Wrap this all up into
a set of low level helper functions that can be used to output
numbers with arbitrary precision, alignment, format, etc and
then update raw_ostream to use these functions.

This will be useful for upcoming improvements to llvm's string
formatting libraries, but are still useful independently.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284425 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 20:57:45 +00:00
Sanjay Patel
8cc4b69873 [DAG] use isConstOrConstSplat in ComputeNumSignBits to optimize SRA
The scalar version of this pattern was noted in:
https://reviews.llvm.org/D25485

and fixed with:
https://reviews.llvm.org/rL284395

More refactoring of the constant/splat helpers is needed and will happen in follow-up patches.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284424 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 20:41:39 +00:00
Sanjay Patel
8a2a445fa8 [DAG] make isConstOrConstSplat and isConstOrConstSplatFP more accessible; NFC
As noted in:
https://reviews.llvm.org/D25685

This is the next-to-smallest step needed to enable the ComputeNumSignBits fix in that patch. 
In a minor attempt to keep some structure, we're pulling the FP helper over along with its
integer sibling, but clearly we can and should do more refactoring of the similar helper
functions in DAGCombiner and SelectionDAG to simplify and not duplicate functionality.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284421 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 20:26:46 +00:00
Davide Italiano
ac38a647dc [opt] Strip coverage if debug info is not present.
If -coverage is passed, but -g is not, clang populates the PassManager
pipeline with StripSymbols(debugOnly = true).
The stripSymbol pass therefore scans the list of named metadata,
drops !llvm.dbg.cu, but leaves !llvm.gcov and !0 (the compileUnit MD)
around. The verifier runs, and finds out that there's a CU not listed
in !llvm.dbg.cu (as it was previously dropped) -> crash.
When we strip debug info, so, check if there's coverage data,
and strip it as well, in order to avoid pending metadata left around.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284418 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 20:05:35 +00:00
Dehao Chen
d0ef0440cf Ignore debug info when making optimization decisions in SimplifyCFG.
Summary: Debug info should *not* affect code generation. This patch properly handles debug info to make sure the generated code are the same with or without debug info.

Reviewers: davidxl, mzolotukhin, jmolloy

Subscribers: aprantl, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284415 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 19:28:44 +00:00
Rafael Espindola
29dee96fbe Delete dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284414 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 19:25:42 +00:00
Mehdi Amini
303d287af0 [doc] use double `` to prevent html output of merging double dash
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284412 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 19:23:19 +00:00
Michael LeMay
6b54de2a5a Test commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284411 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 19:09:19 +00:00
Walter Erquinigo
f68eeb3359 Handle relocations to thumb functions when dynamic linking COFF modules
Summary:
This adds the necessary logic to support relocations to thumb functions in the COFF dynamic linker.
The jumps to function addresses are mostly blx, which requires the ISA selection bit when jumping to a thumb function.

Note: I'm determining if the relocation requires the ISA bit when creating the relocation entries and not when resolving the relocation. I have to do that because I need the ObjectFile and the actual Symbol, which are available only when creating the entries. It would require a gross refactor if I do it otherwise, but I'm okay with doing it if you think it's better.

Reviewers: peter.smith, compnerd

Subscribers: rengolin, sas

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284410 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 18:56:18 +00:00
Rafael Espindola
58121fbe76 Return a StringRef instead of a Comdat*.
This is a small step in making this interface compatible with an
bitcode symbol table.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284408 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 18:51:02 +00:00
Tim Northover
087ac0bf03 GlobalISel: support wider range of load/store sizes in AArch64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284406 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 18:36:53 +00:00
Tom Stellard
0d8c32f076 AMDGPU/SI: LowerParameter() should be computing align based on memory type
Reviewers: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, tony-tye, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284398 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 16:56:19 +00:00
Tom Stellard
de864533c8 AMDGPU/SI: Fix LowerParameter() for i16 arguments
Summary:
If we are loading an i16 value from a 32-bit memory location, then
we need to be able to truncate the loaded value to i16.

Reviewers: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, tony-tye, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284397 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 16:21:45 +00:00
Sanjay Patel
6eae33cd6b [DAG] optimize away an arithmetic-right-shift of a 0 or -1 value
This came up as part of:
https://reviews.llvm.org/D25485

Note that the vector case is missed because ComputeNumSignBits() is deficient for vectors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284395 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 15:58:28 +00:00
Sanjay Patel
c595aad3ca [x86] add tests to show missing DAG folds for arithmetic-shift-right
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284394 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 15:44:59 +00:00
Sanjay Patel
e4e17f8c53 [x86] auto-generate checks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284393 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 15:38:41 +00:00
Teresa Johnson
6fb063ad06 Rename interface for querying physical hardware concurrency
Based on post-commit review for D25585/r284180, rename
hardware_physical_concurrency to heavyweight_hardware_concurrency,
to better reflect what type of tasks it should be used for and
to enable other systems to map this to something other than the
number of physical cores.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284390 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 14:56:53 +00:00
George Rimar
1a38c9c045 [Object/ELF] - Check Header->e_shoff value earlier and do not crash.
Patch checks that section pointer is aligned properly.
This should be done before getStringTable() call.

Differential revision: https://reviews.llvm.org/D25462

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284387 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 14:28:12 +00:00
Benjamin Kramer
573d9cc8f2 [Support] remove_dots: Remove windows test.
Windows doesn't have roots, so I think this test doesn't make sense
there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284386 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 13:57:16 +00:00
Benjamin Kramer
94b3ee41bc [Support] remove_dots: Remove .. from absolute paths.
/../foo is still a proper path after removing the dotdot. This should
now finally match https://9p.io/sys/doc/lexnames.html [Cleaning names].

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284384 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 13:28:21 +00:00
James Molloy
63b1eba065 [SDAG] Use ABI type alignment for constant pools when optimizing for size
SelectionDAG::getConstantPool will automatically determine an appropriate alignment if one is not specified. It does this by querying the type's preferred alignment. This can end up creating quite a lot of padding when the preferred alignment for vectors is 128.

In optimize-for-size mode, it makes sense to instead query the ABI type alignment which is often smaller and causes less padding.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284381 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 12:54:07 +00:00
Renato Golin
e4c66df4b4 [docs] Reduce the number of places 'minimum requirements' is mentioned to one
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284380 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 12:29:00 +00:00
Oliver Stannard
7b3797ef4f [SimplifyCFG] Don't lower complex ConstantExprs to lookup tables
Not all ConstantExprs can be represented by a global variable, for example most
pointer arithmetic other than addition of a constant, so we can't convert these
values from switch statements to lookup tables.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284379 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 12:00:24 +00:00
Tobias Grosser
a00e39fd38 [SCEV] Consider delinearization pattern with extension with identity factor
Summary: The delinearization algorithm did not consider terms which had an extension without a multiply factor, i.e. a identify factor. We lose cases where size is char type where there will no multiply factor.

Reviewers: sanjoy, grosser

Subscribers: mzolotukhin, Eugene.Zelenko, llvm-commits, mssimpso, sanjoy, grosser

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284378 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 11:56:26 +00:00
Andrea Di Biagio
fe42b012cd [CodeGenPrepare] When moving a zext near to its associated load, do not retain the original debug location.
CodeGenPrepare knows how to move a zext of a load into the same basic block
where the load lives. The goal is to help ISel match a zero-extending load
instead of two separated instructions.

CGP attempts to move a zext computation even if it lives in a basic block that
does not post-dominate the load's basic block. That means, the hoisted zext may
be speculated. Preserving the zext location would hurt the debugging experience
and the quality of sample pgo.
With this patch, when moving a zext near to its associated load, CGP no longer
propagates the zext's debug location. Instead, CGP conservatively reuses the
same debug location for the load and the zext.

An alternative approach would be to assign an artificial line-0 location to the
zext. However we don't want to over-use the 'line-0' for this particular case
because it would have a size cost in the line-table section for no additional
benefit.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284377 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 11:32:26 +00:00
George Rimar
2c7c85dbd2 Recommit r284371 "[Object/ELF] - Check that e_shnum is null when e_shoff is."
With fix: hex edited the precompiled inputs from another testcases to pass new checks.

Original commit message:

[Object/ELF] - Check that e_shnum is null when e_shoff is.

Spec says (http://www.sco.com/developers/gabi/1998-04-29/ch4.eheader.html) :
e_shnum
This member holds the number of entries in the section header table. Thus the product of e_shentsize and e_shnum gives the section header table's size in bytes. If a file has no section header table, e_shnum holds the value zero.

Revealed using "id_000037,sig_11,src_000015,op_havoc,rep_8" from PR30540

That was the reason of crash in lld on incorrect input file.
Binary reduced using afl-min.

Differential revision: https://reviews.llvm.org/D25090

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284374 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 10:58:02 +00:00
George Rimar
50d445a24c Revert r284371 "[Object/ELF] - Check that e_shnum is null when e_shoff is."
It broke build bot:
http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/908/steps/test-stage1-compiler/logs/stdio

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284373 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 10:20:47 +00:00
George Rimar
a43813b85e [Object/ELF] - Check that e_shnum is null when e_shoff is.
Spec says (http://www.sco.com/developers/gabi/1998-04-29/ch4.eheader.html) :
e_shnum
This member holds the number of entries in the section header table. Thus the product of e_shentsize and e_shnum gives the section header table's size in bytes. If a file has no section header table, e_shnum holds the value zero.

Revealed using "id_000037,sig_11,src_000015,op_havoc,rep_8" from PR30540

That was the reason of crash in lld on incorrect input file.
Binary reduced using afl-min.

Differential revision: https://reviews.llvm.org/D25090

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284371 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 10:06:44 +00:00
George Rimar
b987363712 [Object/ELF] - Do not crash on invalid section index.
If object has wrong (large) string table index and
also incorrect large value for amount of sections in total,
then section index passes the check:

  if (Index >= getNumSections())
    return object_error::invalid_section_index;

But result pointer then is far after end of file data, what
result in a crash.

Differential revision: https://reviews.llvm.org/D25081

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284369 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 09:30:06 +00:00
Justin Bogner
0ebe9c2f81 Support: Drop LLVM_ATTRIBUTE_UNUSED_RESULT
Uses of this have all been updated to use LLVM_NODISCARD, which
matches the C++17 [[nodiscard]] semantics rather than those of GCC's
__attribute__((warn_unused_result)).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284367 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 07:37:11 +00:00
Craig Topper
043b10deff [X86] Fix shuffle decoding assertions to print the right number of required operands. Update the checks themselves to be >= to the same number instead of > one less than the required number.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284365 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 06:41:18 +00:00
Justin Bogner
4e1daa7c89 ADT: Use LLVM_NODISCARD instead of LLVM_ATTRIBUTE_UNUSED_RESULT for StringRef
Instead of annotating (most of) the StringRef API, we can just
annotate the type directly. This is less code and it will warn in more
cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284364 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 06:35:23 +00:00
Craig Topper
d56fafdbd2 [AVX-512] Add shuffle combining support for vpermi2var shuffles derived from existing support for vpermt2var.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284357 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 04:26:47 +00:00
Craig Topper
11061fd0cb [AVX-512] Add vpermi2var test cases to shuffle combining test case. Combining will be added in a future commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284356 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 04:26:44 +00:00
Craig Topper
4da8984f9e [AVX-512] Add support for turning a 256-bit load that goes to both halfs of an insert_subvector into a subvector broadcast.
Differential Revision: https://reviews.llvm.org/D25650

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284353 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16 23:29:51 +00:00
Justin Bogner
13579ede05 unittests: Explicitly ignore some return values in crash tests
Ideally these would actually check that the results are reasonable,
but given that we're looping over so many different kinds of path that
isn't really practical.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284350 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16 22:09:24 +00:00
Justin Bogner
0f82c946ae Support: Return void from Scanner::scan_ns_uri_char, no one uses the result
Simplify this a little bit since the result is never used. It can be
added back easily enough if that changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284348 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16 22:01:22 +00:00
Justin Bogner
215b6d51e1 MachineModuleInfo: Prefer the LLVM_NODISCARD spelling
Update a function annotated with LLVM_ATTRIBUTE_UNUSED_RESULT to use
LLVM_NODISCARD instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284346 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16 21:18:26 +00:00
Justin Bogner
e1d1c98dc3 SCEV: Prefer the LLVM_NODISCARD spelling
Update functions annotated with LLVM_ATTRIBUTE_UNUSED_RESULT to use
LLVM_NODISCARD instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284345 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16 21:17:29 +00:00
Justin Bogner
9febba8e12 Support: Prefer the LLVM_NODISCARD spelling
Update functions annotated with LLVM_ATTRIBUTE_UNUSED_RESULT to use
LLVM_NODISCARD instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284344 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16 20:56:20 +00:00
Justin Bogner
fcec9152da ADT: Prefer the LLVM_NODISCARD spelling
Update functions annotated with LLVM_ATTRIBUTE_UNUSED_RESULT to use
LLVM_NODISCARD instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284343 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16 20:42:34 +00:00
Justin Bogner
097967f645 ADT: Use LLVM_NODISCARD instead of LLVM_ATTRIBUTE_UNUSED_RESULT for ArrayRef
Instead of annotating (most of) the ArrayRef API, we can just annotate
the type directly. This is less code and it will warn in more cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284342 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16 20:30:40 +00:00
Richard Smith
6ae3d4e42d PR30711: Fix incorrect profiling of 'long long' in FoldingSet, then use it to
fix TBAA violation in profiling of pointers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284336 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16 17:49:09 +00:00
Craig Topper
3a558dd477 [AVX-512] Fix the operand order for vpermi2var_qi intrinsics to match the other vpermi2var intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284329 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16 04:54:35 +00:00
Craig Topper
bc745ca586 [AVX-512] Correct execution domain for VPERMT2PS and VPERMI2PS.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284328 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16 04:54:31 +00:00