platform/upstream/llvm.git
7 years ago[Bash-autocompletion] Show HelpText with possible flags
Yuka Takahashi [Wed, 26 Jul 2017 13:36:58 +0000 (13:36 +0000)]
[Bash-autocompletion] Show HelpText with possible flags

Summary:
`clang --autocomplete=-std` will show
```
-std:   Language standard to compile for
-std=   Language standard to compile for
-stdlib=        C++ standard library to use
```
after this change.

However, showing HelpText with completion in bash seems super tricky, so
this feature will be used in other shells (fish, zsh...).

Reviewers: v.g.vassilev, teemperor, ruiu

Subscribers: cfe-commits, hiraditya

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

llvm-svn: 309113

7 years ago[Bash-completion] Fixed a bug that file doesn't autocompleted after =
Yuka Takahashi [Wed, 26 Jul 2017 13:30:36 +0000 (13:30 +0000)]
[Bash-completion] Fixed a bug that file doesn't autocompleted after =

Summary:
File path wasn't autocompleted after `-fmodule-cache-path=[tab]`, so
fixed this bug by checking if $flags contains only a newline or not.

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

llvm-svn: 309112

7 years agoRevert r309094: [globalisel][tablegen] Fuse the generated tables together.
Daniel Sanders [Wed, 26 Jul 2017 13:28:40 +0000 (13:28 +0000)]
Revert r309094: [globalisel][tablegen] Fuse the generated tables together.

The ARM bots have started failing and while this patch should be an improvement
for these bots, it's also the only suspect in the blamelist. Reverting while
Diana and I investigate the problem.

llvm-svn: 309111

7 years ago[ScopInfo] Avoid use of getStmtFor(BB). NFC.
Michael Kruse [Wed, 26 Jul 2017 13:25:28 +0000 (13:25 +0000)]
[ScopInfo] Avoid use of getStmtFor(BB). NFC.

Since there will be no more a 1:1 correspondence between statements and
basic blocks, we would like to get rid of the method getStmtFor(BB)
and its uses. Here we remove one of its uses in ScopInfo by fetching
the statement in which the call instruction lies.

Contributed-by: Nandini Singhal <cs15mtech01004@iith.ac.in>
Differential Revision: https://reviews.llvm.org/D35691

llvm-svn: 309110

7 years ago[SCEVValidator] Loop exit values of loops before the SCoP are synthesizable.
Michael Kruse [Wed, 26 Jul 2017 13:05:45 +0000 (13:05 +0000)]
[SCEVValidator] Loop exit values of loops before the SCoP are synthesizable.

 In the following loop:

   int i;
   for (i = 0; i < func(); i+=1)
     ;
SCoP:
   for (int j = 0; j<n; j+=1)
     S(i, j)

The value i is synthesizable in the SCoP that includes only the j-loop.
This is because i is fixed within the SCoP, it is irrelevant whether
it originates from another loop.

This fixes a strange case where a PHI was synthesiable in a SCoP,
but not its incoming value, triggering an assertion.

This should fix MultiSource/Applications/sgefa/sgefa of the
perf-x86_64-penryn-O3-polly-before-vectorizer-unprofitable buildbot.

llvm-svn: 309109

7 years agoDAGCombiner: Extend reduceBuildVecToTrunc to handle non-zero offset
Zvi Rackover [Wed, 26 Jul 2017 12:57:03 +0000 (12:57 +0000)]
DAGCombiner: Extend reduceBuildVecToTrunc to handle non-zero offset

Summary:
Adding support for combining power2-strided build_vector's where the
first build_vectori's operand is extracted from a non-zero index.

Example:

 v4i32 build_vector((extract_elt V, 1),
                    (extract_elt V, 3),
                    (extract_elt V, 5),
                    (extract_elt V, 7))
 -->
 v4i32 truncate (bitcast (shuffle<1,u,3,u,5,u,7,u> V, u) to v4i64)

Reviewers: delena, RKSimon, guyblank

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 309108

7 years ago[X86] Regenerated BT tests
Simon Pilgrim [Wed, 26 Jul 2017 12:49:20 +0000 (12:49 +0000)]
[X86] Regenerated BT tests

Test on 32/64 bit targets where appropriate

llvm-svn: 309107

7 years agoRecommit r308327 2nd time: Add a warning for missing
Alex Lorenz [Wed, 26 Jul 2017 12:20:57 +0000 (12:20 +0000)]
Recommit r308327 2nd time: Add a warning for missing
'#pragma pack (pop)' and suspicious uses of '#pragma pack' in included files

The first recommit (r308441) caused a "non-default #pragma pack value might
change the alignment of struct or union members in the included file" warning
in LLVM itself. This recommit tweaks the added warning to avoid warnings for
#includes that don't have any records that are affected by the non-default
alignment. This tweak avoids the previously emitted warning in LLVM.

Original message:

This commit adds a new -Wpragma-pack warning. It warns in the following cases:

- When a translation unit is missing terminating #pragma pack (pop) directives.
- When entering an included file if the current alignment value as determined
  by '#pragma pack' directives is different from the default alignment value.
- When leaving an included file that changed the state of the current alignment
  value.

rdar://10184173

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

llvm-svn: 309106

7 years ago[COFF, ARM64] Fix symbol offsets in ADRP/ADD/LDR/STR relocations
Martin Storsjo [Wed, 26 Jul 2017 11:19:17 +0000 (11:19 +0000)]
[COFF, ARM64] Fix symbol offsets in ADRP/ADD/LDR/STR relocations

In COFF, a symbol offset can't be stored in the relocation (as is
done in ELF or MachO), but is stored as the immediate in the
instruction itself. The immediate in the ADRP thus is the symbol
offset in bytes, not in pages. For the PAGEOFFSET_12A/L relocations,
ignore any offset outside of the lowest 12 bits; they won't have any
effect on the ADD/LDR/STR instruction itself but only on the associated
ADRP.

This is similar to how the same issue is handled for MOVW/MOVT
instructions in ELF (see e.g. SVN r307713, and r307728 in lld).

This fixes "fixup out of range" errors while building larger object
files, where temporary symbols end up as a plain section symbol and
an offset, and fixes any cases where the symbol offset mean that
the actual target ended up on a different page than the symbol
itself.

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

llvm-svn: 309105

7 years ago[X86] Add urem vector test for non-uniform pow2 constants
Simon Pilgrim [Wed, 26 Jul 2017 11:07:45 +0000 (11:07 +0000)]
[X86] Add urem vector test for non-uniform pow2 constants

llvm-svn: 309104

7 years ago[X86] Regenerated urem pow2 tests on 32/64 bit targets
Simon Pilgrim [Wed, 26 Jul 2017 11:05:16 +0000 (11:05 +0000)]
[X86] Regenerated urem pow2 tests on 32/64 bit targets

llvm-svn: 309103

7 years ago[X86] Regenerated umul overflow tests on 32/64 bit targets
Simon Pilgrim [Wed, 26 Jul 2017 11:04:18 +0000 (11:04 +0000)]
[X86] Regenerated umul overflow tests on 32/64 bit targets

llvm-svn: 309102

7 years ago[ARM] GlobalISel: Map G_GLOBAL_VALUE to GPR
Diana Picus [Wed, 26 Jul 2017 11:01:13 +0000 (11:01 +0000)]
[ARM] GlobalISel: Map G_GLOBAL_VALUE to GPR

A G_GLOBAL_VALUE is basically a pointer, so it should live in the GPR.

llvm-svn: 309101

7 years ago[X86][AVX] Regenerated and cleaned up AVX1 intrinsic tests.
Simon Pilgrim [Wed, 26 Jul 2017 10:54:51 +0000 (10:54 +0000)]
[X86][AVX] Regenerated and cleaned up AVX1 intrinsic tests.

Cleaned up triple settings, added 32-bit/64-bit targets where useful, added broadcast comments

llvm-svn: 309100

7 years ago[X86][AVX2] Regenerated and cleaned up broadcast tests.
Simon Pilgrim [Wed, 26 Jul 2017 10:47:51 +0000 (10:47 +0000)]
[X86][AVX2] Regenerated and cleaned up broadcast tests.

llvm-svn: 309099

7 years ago[X86][AVX512] Regenerated and added 32-bit targets to select tests
Simon Pilgrim [Wed, 26 Jul 2017 10:39:55 +0000 (10:39 +0000)]
[X86][AVX512] Regenerated and added 32-bit targets to select tests

llvm-svn: 309098

7 years ago[X86][AVX] Regenerated and cleaned up masked gather/scatter tests.
Simon Pilgrim [Wed, 26 Jul 2017 10:37:12 +0000 (10:37 +0000)]
[X86][AVX] Regenerated and cleaned up masked gather/scatter tests.

Remove unused KNL checks and triple settings, added broadcast comments

llvm-svn: 309097

7 years ago[ELF] - Ignore --warn-once option.
George Rimar [Wed, 26 Jul 2017 10:25:49 +0000 (10:25 +0000)]
[ELF] - Ignore --warn-once option.

Was discussed in D35797 thread.

llvm-svn: 309096

7 years ago[X86][AVX] Regenerate lzcnt test.
Simon Pilgrim [Wed, 26 Jul 2017 10:22:56 +0000 (10:22 +0000)]
[X86][AVX] Regenerate lzcnt test.

Tidied up triples and checks.

llvm-svn: 309095

7 years ago[globalisel][tablegen] Fuse the generated tables together.
Daniel Sanders [Wed, 26 Jul 2017 10:20:56 +0000 (10:20 +0000)]
[globalisel][tablegen] Fuse the generated tables together.

Summary:
Now that we have control flow in place, fuse the per-rule tables into a
single table. This is a compile-time saving at this point. However, this will
also enable the optimization of a table so that similar instructions can be
tested together, reducing the time spent on the matching the code.

This is NFC in terms of externally visible behaviour but some internals have
changed slightly. State.MIs is no longer reset between each rule that is
attempted because it's not necessary to do so. As a consequence of this the
restriction on the order that instructions are added to State.MIs has been
relaxed to only affect recorded instructions that require new elements to be
added to the vector. GIM_RecordInsn can now write to any element from 1 to
State.MIs.size() instead of just State.MIs.size().

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Reviewed By: rovka

Subscribers: kristof.beyls, igorb, llvm-commits

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

llvm-svn: 309094

7 years ago[X86][FMA] Regenerate test with broadcast comments.
Simon Pilgrim [Wed, 26 Jul 2017 10:20:49 +0000 (10:20 +0000)]
[X86][FMA] Regenerate test with broadcast comments.

llvm-svn: 309093

7 years agoFollow up for r307085: a better fix for a dangling StringRef.
Alexander Kornienko [Wed, 26 Jul 2017 10:14:55 +0000 (10:14 +0000)]
Follow up for r307085: a better fix for a dangling StringRef.

llvm-svn: 309092

7 years ago[ELF] - Change way how we handle --noinhibit-exec
George Rimar [Wed, 26 Jul 2017 09:46:59 +0000 (09:46 +0000)]
[ELF] - Change way how we handle --noinhibit-exec

Previously we handled this option implicitly, only
for infering unresolved symbols handling policy.

ld man says: "--noinhibit-exec Retain the executable
output file whenever it is still usable",
and we may want to handle other cases too.

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

llvm-svn: 309091

7 years ago[ARM] GlobalISel: Mark G_GLOBAL_VALUE as legal
Diana Picus [Wed, 26 Jul 2017 09:25:15 +0000 (09:25 +0000)]
[ARM] GlobalISel: Mark G_GLOBAL_VALUE as legal

llvm-svn: 309090

7 years ago[ELF] - Print options aliases in --help
George Rimar [Wed, 26 Jul 2017 09:21:10 +0000 (09:21 +0000)]
[ELF] - Print options aliases in --help

This is PR30422,
previously LLD did not render all option aliases in --help.
With this patch it will.

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

llvm-svn: 309089

7 years agoUpdate after LLVM change r309087
George Rimar [Wed, 26 Jul 2017 09:10:17 +0000 (09:10 +0000)]
Update after LLVM change r309087

llvm-svn: 309088

7 years ago[libOption] - Add flag allowing to print options aliases in help text.
George Rimar [Wed, 26 Jul 2017 09:09:56 +0000 (09:09 +0000)]
[libOption] - Add flag allowing to print options aliases in help text.

By default, we display only options that are not
hidden and have help texts. This patch adds flag
allowing to display aliases that have no help text.
In this case help text of aliased option used instead.

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

llvm-svn: 309087

7 years ago[X86][LLVM]Expanding Supports lowerInterleavedStore() in X86InterleavedAccess.
Michael Zuckerman [Wed, 26 Jul 2017 08:10:14 +0000 (08:10 +0000)]
[X86][LLVM]Expanding Supports lowerInterleavedStore() in X86InterleavedAccess.

This patch expands the support of lowerInterleavedStore to 32x8i stride 4.

LLVM creates suboptimal shuffle code-gen for AVX2. In overall, this patch is a specific fix for the pattern (Strid=4 VF=32) and we plan to include more patterns in the future. To reach our goal of "more patterns". We include two mask creators. The first function creates shuffle's mask equivalent to unpacklo/unpackhi instructions. The other creator creates mask equivalent to a concat of two half vectors(high/low).

The patch goal is to optimize the following sequence:
At the end of the computation, we have ymm2, ymm0, ymm12 and ymm3 holding
each 32 chars:

c0, c1, , c31
m0, m1, , m31
y0, y1, , y31
k0, k1, ., k31

And these need to be transposed/interleaved and stored like so:

c0 m0 y0 k0 c1 m1 y1 k1 c2 m2 y2 k2 c3 m3 y3 k3 ....

Reviewers:
dorit
Farhana
RKSimon
guyblank
DavidKreitzer

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

llvm-svn: 309086

7 years agoTargetLowering: Change isShuffleMaskLegal's mask argument type to ArrayRef<int>....
Zvi Rackover [Wed, 26 Jul 2017 08:06:58 +0000 (08:06 +0000)]
TargetLowering: Change isShuffleMaskLegal's mask argument type to ArrayRef<int>. NFCI.

Changing mask argument type from const SmallVectorImpl<int>& to
ArrayRef<int>.

This came up in D35700 where a mask is received as an ArrayRef<int> and
we want to pass it to TargetLowering::isShuffleMaskLegal().
Also saves a few lines of code.

llvm-svn: 309085

7 years ago[X86][LLVM]Expanding Supports lowerInterleavedStore() in X86InterleavedAccess part1.
Michael Zuckerman [Wed, 26 Jul 2017 07:45:02 +0000 (07:45 +0000)]
[X86][LLVM]Expanding Supports lowerInterleavedStore() in X86InterleavedAccess part1.

splitting patch D34601 into two part. This part changes the location of two functions.
The second part will be based on that patch. This was requested by @RKSimon.

Reviewers:
1. dorit
2. Farhana
3. RKSimon
4. guyblank
5. DavidKreitzer

llvm-svn: 309084

7 years agoRevert "[sanitizer] Support compiler-rt builtins"
Petr Hosek [Wed, 26 Jul 2017 06:46:11 +0000 (06:46 +0000)]
Revert "[sanitizer] Support compiler-rt builtins"

This reverts commit fd63314d6770e0da62572a3fea2c41c4cc0fc58a.

llvm-svn: 309083

7 years agoRevert "[sanitizer] Support libc++abi in addition to libstdc++"
Petr Hosek [Wed, 26 Jul 2017 06:46:10 +0000 (06:46 +0000)]
Revert "[sanitizer] Support libc++abi in addition to libstdc++"

This reverts commit d1997bff31cf6b484eb59c2ee1fc3155442e338c.

llvm-svn: 309082

7 years ago[clang] Add ARM64 support to armintr.h for MSVC compatibility
Mandeep Singh Grang [Wed, 26 Jul 2017 05:29:40 +0000 (05:29 +0000)]
[clang] Add ARM64 support to armintr.h for MSVC compatibility

Summary: This fixes compiling with headers from the Windows SDK for ARM64.

Reviewers: compnerd, ruiu, mstorsjo

Reviewed By: compnerd, mstorsjo

Subscribers: mgorny, aemerson, javed.absar, kristof.beyls, llvm-commits, cfe-commits

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

llvm-svn: 309081

7 years ago[SCEV] Cache results of computeExitLimit
Max Kazantsev [Wed, 26 Jul 2017 04:55:54 +0000 (04:55 +0000)]
[SCEV] Cache results of computeExitLimit

This patch adds a cache for computeExitLimit to save compilation time. A lot of examples of
tests that take extensive time to compile are attached to the bug 33494.

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

llvm-svn: 309080

7 years ago[X86] Prevent selecting masked aligned load instructions if the load should be non...
Craig Topper [Wed, 26 Jul 2017 04:31:04 +0000 (04:31 +0000)]
[X86] Prevent selecting masked aligned load instructions if the load should be non-temporal

Summary: The aligned load predicates don't  suppress themselves if the load is non-temporal the way the unaligned predicates do. For the most part this isn't a problem because the aligned predicates are mostly used for instructions that only load the the non-temporal loads have priority over those. The exception are masked loads.

Reviewers: RKSimon, zvi

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 309079

7 years agoAdd test coverage for new PM PGOOpt handling.
Dehao Chen [Wed, 26 Jul 2017 02:00:43 +0000 (02:00 +0000)]
Add test coverage for new PM PGOOpt handling.

Summary: This patch adds flags and tests to cover the PGOOpt handling logic in new PM.

Reviewers: chandlerc, davide

Reviewed By: chandlerc

Subscribers: sanjoy, llvm-commits

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

llvm-svn: 309076

7 years ago[gold] Enable data-sections by default for the gold-plugin.
Davide Italiano [Wed, 26 Jul 2017 01:47:17 +0000 (01:47 +0000)]
[gold] Enable data-sections by default for the gold-plugin.

Follow up to r309056.

llvm-svn: 309075

7 years ago[sanitizer] Support libc++abi in addition to libstdc++
Petr Hosek [Wed, 26 Jul 2017 01:43:02 +0000 (01:43 +0000)]
[sanitizer] Support libc++abi in addition to libstdc++

This change adds sanitizer support for LLVM's libunwind and libc++abi
as an alternative to libstdc++. This allows using the in tree version
of libunwind and libc++abi which is useful when building a toolchain
for different target.

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

llvm-svn: 309074

7 years agoAdd "REQUIRES: asserts" for test unswitch-equality-undef.ll.
Wei Mi [Wed, 26 Jul 2017 01:34:46 +0000 (01:34 +0000)]
Add "REQUIRES: asserts" for test unswitch-equality-undef.ll.

llvm-svn: 309073

7 years ago[SCEV] Remove unnecessary call to forgetMemoizedResults
Sanjoy Das [Wed, 26 Jul 2017 01:32:19 +0000 (01:32 +0000)]
[SCEV] Remove unnecessary call to forgetMemoizedResults

`SCEVUnknown::allUsesReplacedWith` does not need to call `forgetMemoizedResults`
since RAUW does a value-equivalent replacement by assumption.  If this
assumption was false then the later setValPtr(New) call would be incorrect too.

This is a non-trivial performance optimization for functions with a large number
of loops since `forgetMemoizedResults` walks all loop backedge taken counts to
see if any of them use the SCEVUnknown being RAUWed.  However, this improvement
is difficult to demonstrate without checking in an excessively large IR file.

llvm-svn: 309072

7 years ago[lit] Attempt to fix Python unittest adaptor logic
Reid Kleckner [Wed, 26 Jul 2017 01:27:18 +0000 (01:27 +0000)]
[lit] Attempt to fix Python unittest adaptor logic

llvm-svn: 309071

7 years agoMove manifest utils into separate lib, to reduce libxml2 deps.
Eric Beckmann [Wed, 26 Jul 2017 01:21:55 +0000 (01:21 +0000)]
Move manifest utils into separate lib, to reduce libxml2 deps.

Summary:
Previously were in support.  Since many many things depend on support,
were all forced to also depend on libxml2, which we only want in a few cases.
This puts all the libxml2 deps in a separate lib to be used only in a few
places.

Reviewers: ruiu, thakis, rnk

Subscribers: mgorny, hiraditya, llvm-commits

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

llvm-svn: 309070

7 years ago[PDB] Remove stale GSI.h header that I intended to remove in the previous commit
Reid Kleckner [Wed, 26 Jul 2017 00:58:49 +0000 (00:58 +0000)]
[PDB] Remove stale GSI.h header that I intended to remove in the previous commit

llvm-svn: 309069

7 years ago[DWARF] Generalized verification of .apple_names accelerator table to be applicable...
Spyridoula Gravani [Wed, 26 Jul 2017 00:52:31 +0000 (00:52 +0000)]
[DWARF] Generalized verification of .apple_names accelerator table to be applicable to any acceleration table. Added verification for .apple_types, .apple_namespaces and .apple_objc sections.

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

llvm-svn: 309068

7 years ago[clang-tidy] Do not issue fixit for explicit template specializations
Felix Berger [Wed, 26 Jul 2017 00:45:41 +0000 (00:45 +0000)]
[clang-tidy] Do not issue fixit for explicit template specializations

Summary:

Do not issue fixit in UnnecessaryValueParamCheck if the function is an explicit template specialization as this could cause build breakages.

Reviewers: alexfh

Subscribers: JDevlieghere, xazax.hun, cfe-commits

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

llvm-svn: 309067

7 years ago[PDB] Improve GSI hash table dumping for publics and globals
Reid Kleckner [Wed, 26 Jul 2017 00:40:36 +0000 (00:40 +0000)]
[PDB] Improve GSI hash table dumping for publics and globals

The PDB "symbol stream" actually contains symbol records for the publics
and the globals stream. The globals and publics streams are essentially
hash tables that point into a single stream of records. In order to
match cvdump's behavior, we need to only dump symbol records referenced
from the hash table. This patch implements that, and then implements
global stream dumping, since it's just a subset of public stream
dumping.

Now we shouldn't see S_PROCREF or S_GDATA32 records when dumping
publics, and instead we should see those record in the globals stream.

llvm-svn: 309066

7 years agoReapply "llvm-mt: implement simple merging of manifests, not factoring namespaces.
Eric Beckmann [Wed, 26 Jul 2017 00:25:12 +0000 (00:25 +0000)]
Reapply "llvm-mt: implement simple merging of manifests, not factoring namespaces.

This time with correct #if.

This reverts commit 9cf4eca0e0383040c1ff1416815c7f649650c2a0.

llvm-svn: 309064

7 years ago[AArch64] Fix some Clang-tidy modernize-use-using and Include What You Use warnings...
Eugene Zelenko [Tue, 25 Jul 2017 23:51:02 +0000 (23:51 +0000)]
[AArch64] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 309062

7 years ago[StaticAnalyzer] LoopUnrolling - Attempt #2 to fix a crash in r309006.
Peter Szecsi [Tue, 25 Jul 2017 23:49:16 +0000 (23:49 +0000)]
[StaticAnalyzer] LoopUnrolling - Attempt #2 to fix a crash in r309006.

llvm-svn: 309061

7 years ago[sanitizer] Support compiler-rt builtins
Petr Hosek [Tue, 25 Jul 2017 23:38:25 +0000 (23:38 +0000)]
[sanitizer] Support compiler-rt builtins

This change adds support for compiler-rt builtins as an alternative
compiler runtime to libgcc.

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

llvm-svn: 309060

7 years agoDisable loop unswitching for some patterns containing equality comparison with undef.
Wei Mi [Tue, 25 Jul 2017 23:37:17 +0000 (23:37 +0000)]
Disable loop unswitching for some patterns containing equality comparison with undef.

This is a workaround for the bug described in PR31652 and
http://lists.llvm.org/pipermail/llvm-dev/2017-July/115497.html. The temporary
solution is to add a function EqualityPropUnSafe. In EqualityPropUnSafe, for
some simple patterns we can know the equality comparison may contains undef,
so we regard such comparison as unsafe and will not do loop-unswitching for
them. We also need to disable the select simplification when one of select
operand is undef and its result feeds into equality comparison.

The patch cannot clear the safety issue caused by the bug, but it can suppress
the issue from happening to some extent.

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

llvm-svn: 309059

7 years ago[CodeGen] Correctly model std::byte's aliasing properties
David Majnemer [Tue, 25 Jul 2017 23:33:58 +0000 (23:33 +0000)]
[CodeGen] Correctly model std::byte's aliasing properties

std::byte, when defined as an enum, needs to be given special treatment
with regards to its aliasing properties. An array of std::byte is
allowed to be used as storage for other types.

This fixes PR33916.

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

llvm-svn: 309058

7 years agoDebug Info: Support fragmented variables in the MMI side table
Adrian Prantl [Tue, 25 Jul 2017 23:32:59 +0000 (23:32 +0000)]
Debug Info: Support fragmented variables in the MMI side table

This reapplies commit r309034 with a bugfix+test for inlined variables.

llvm-svn: 309057

7 years ago[gold] Enable function-sections by default.
Davide Italiano [Tue, 25 Jul 2017 23:32:50 +0000 (23:32 +0000)]
[gold] Enable function-sections by default.

This is needed, among others, to respect --section-ordering-file
with LTO. I'll follow up with a similar change for data sections.

I hope every version of gold available on the bots has support for
--section-ordering file.

llvm-svn: 309056

7 years agoSimplify ignored options.
Rui Ueyama [Tue, 25 Jul 2017 23:32:05 +0000 (23:32 +0000)]
Simplify ignored options.

Since the flag is ignored anyway, it doesn't matter whether
it is an alias or not.

llvm-svn: 309055

7 years agoReorder tests to match latest SD-6 draft.
Richard Smith [Tue, 25 Jul 2017 23:31:42 +0000 (23:31 +0000)]
Reorder tests to match latest SD-6 draft.

llvm-svn: 309054

7 years agoSimplify. NFC.
Rafael Espindola [Tue, 25 Jul 2017 23:23:40 +0000 (23:23 +0000)]
Simplify. NFC.

llvm-svn: 309053

7 years agoclang/StaticAnalyzer/Core/PathSensitive/LoopUnrolling.h: Add a forward decl AnalysisM...
NAKAMURA Takumi [Tue, 25 Jul 2017 23:23:17 +0000 (23:23 +0000)]
clang/StaticAnalyzer/Core/PathSensitive/LoopUnrolling.h: Add a forward decl AnalysisManager, to unbreak modules build.

llvm-svn: 309052

7 years agoReduce templating. NFC.
Rafael Espindola [Tue, 25 Jul 2017 23:15:35 +0000 (23:15 +0000)]
Reduce templating. NFC.

llvm-svn: 309051

7 years agoRevert "llvm-mt: implement simple merging of manifests, not factoring namespaces."
Eric Beckmann [Tue, 25 Jul 2017 23:06:46 +0000 (23:06 +0000)]
Revert "llvm-mt: implement simple merging of manifests, not factoring namespaces."

This reverts commit 813308e240792ca70ed2f998f21df24a5061ada0.

llvm-svn: 309050

7 years ago[clang] Add abi-breaking-checks support to clang
Mandeep Singh Grang [Tue, 25 Jul 2017 23:00:02 +0000 (23:00 +0000)]
[clang] Add abi-breaking-checks support to clang

Summary: You can now use REQUIRES:abi-breaking-checks in clang too

Reviewers: chapuni, probinson, ddunbar, jroelofs

Reviewed By: jroelofs

Subscribers: jroelofs, cfe-commits

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

llvm-svn: 309049

7 years agoLTO: Handle sections with valid C names.
Rafael Espindola [Tue, 25 Jul 2017 22:51:05 +0000 (22:51 +0000)]
LTO: Handle sections with valid C names.

These can be referenced with __start_/__stop_ symbols. I will try to make
this more precise in a followup patch.

llvm-svn: 309048

7 years agollvm-mt: implement simple merging of manifests, not factoring namespaces.
Eric Beckmann [Tue, 25 Jul 2017 22:50:25 +0000 (22:50 +0000)]
llvm-mt: implement simple merging of manifests, not factoring namespaces.

Summary:
Does a simple merge, where mergeable elements are combined, all others
are appended.  Does not apply trickly namespace rules.

Subscribers: llvm-commits, hiraditya

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

llvm-svn: 309047

7 years agoSkip test_unique_stacks on Darwin, because it doesn't terminate reliably.
Sean Callanan [Tue, 25 Jul 2017 22:44:34 +0000 (22:44 +0000)]
Skip test_unique_stacks on Darwin, because it doesn't terminate reliably.

rdar://problem/33462362

llvm-svn: 309046

7 years agoRevert "Reland "[LLVM][llvm-objcopy] Added basic plumbing to get things started""
Petr Hosek [Tue, 25 Jul 2017 22:39:52 +0000 (22:39 +0000)]
Revert "Reland "[LLVM][llvm-objcopy] Added basic plumbing to get things started""

This reverts commit 0d9d9250483761eb2f50236830161b0e2137d483.

llvm-svn: 309045

7 years ago[lit] Fix UnboundLocalError for invalid shtest redirects
Michal Gorny [Tue, 25 Jul 2017 22:38:31 +0000 (22:38 +0000)]
[lit] Fix UnboundLocalError for invalid shtest redirects

Replace the incorrect variable reference when invalid redirect is used.
This fixes the following issue:

  File "/usr/src/llvm/utils/lit/lit/TestRunner.py", line 316, in processRedirects
    raise InternalShellError(cmd, "Unsupported redirect: %r" % (r,))
UnboundLocalError: local variable 'r' referenced before assignment

which in turn broke shtest-shell.py and max-failures.py lit tests.

The breakage was introduced during refactoring in rL307310.

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

llvm-svn: 309044

7 years agoReland "[LLVM][llvm-objcopy] Added basic plumbing to get things started"
Petr Hosek [Tue, 25 Jul 2017 22:38:08 +0000 (22:38 +0000)]
Reland "[LLVM][llvm-objcopy] Added basic plumbing to get things started"

As discussed on llvm-dev I've implemented the first basic steps towards
llvm-objcopy/llvm-objtool (name pending).

This change adds the ability to copy (without modification) 64-bit
little endian ELF executables that have SHT_PROGBITS, SHT_NOBITS,
SHT_NULL and SHT_STRTAB sections.

Patch by Jake Ehrlich

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

llvm-svn: 309043

7 years ago[ubsan] Update a test missed in r309008, NFC
Vedant Kumar [Tue, 25 Jul 2017 22:33:28 +0000 (22:33 +0000)]
[ubsan] Update a test missed in r309008, NFC

llvm-svn: 309042

7 years agoUpdate the comments on default subtargets based on feedback.
Eric Christopher [Tue, 25 Jul 2017 22:21:08 +0000 (22:21 +0000)]
Update the comments on default subtargets based on feedback.

llvm-svn: 309041

7 years agoRevert accidental isl changes in 308923
Tobias Grosser [Tue, 25 Jul 2017 22:15:47 +0000 (22:15 +0000)]
Revert accidental isl changes in 308923

It seems I still had some incomplete changes in the tree when committing.
In general, we only import changes from isl upstream. In this case, the
changes were especially unfortunate, as they broke the error management
in isl_flow.c and consequently caused regressions.

Thanks to Michael Kruse for spotting this mistake.

llvm-svn: 309039

7 years ago[libFuzzer] don't disable msan for TracePC::CollectFeatures: this started to cause...
Kostya Serebryany [Tue, 25 Jul 2017 22:05:31 +0000 (22:05 +0000)]
[libFuzzer] don't disable msan for TracePC::CollectFeatures: this started to cause false positives in msan. No tests for libFuzzer+msan yet -- tests will need to wait until we move libFuzzer to compiler-rt

llvm-svn: 309038

7 years agoRevert "Reland "[LLVM][llvm-objcopy] Added basic plumbing to get things started""
Petr Hosek [Tue, 25 Jul 2017 21:55:00 +0000 (21:55 +0000)]
Revert "Reland "[LLVM][llvm-objcopy] Added basic plumbing to get things started""

This reverts commit 960873b10dd071298c817ba74ef2228f94ead7a1.

llvm-svn: 309037

7 years ago[StaticAnalyzer] LoopUnrolling - Attempt to fix a crash in r309006.
Peter Szecsi [Tue, 25 Jul 2017 21:54:58 +0000 (21:54 +0000)]
[StaticAnalyzer] LoopUnrolling - Attempt to fix a crash in r309006.

llvm-svn: 309036

7 years agoRevert "Debug Info: Support fragmented variables in the MMI side table"
Adrian Prantl [Tue, 25 Jul 2017 21:50:45 +0000 (21:50 +0000)]
Revert "Debug Info: Support fragmented variables in the MMI side table"

This reverts commit r309034 because of a sanitizer issue.

llvm-svn: 309035

7 years agoDebug Info: Support fragmented variables in the MMI side table
Adrian Prantl [Tue, 25 Jul 2017 21:29:22 +0000 (21:29 +0000)]
Debug Info: Support fragmented variables in the MMI side table

<rdar://problem/17816343>

llvm-svn: 309034

7 years ago[scudo] Check for pvalloc overflow
Kostya Kortchinsky [Tue, 25 Jul 2017 21:18:02 +0000 (21:18 +0000)]
[scudo] Check for pvalloc overflow

Summary:
Previously we were rounding up the size passed to `pvalloc` to the next
multiple of page size no matter what. There is an overflow possibility that
wasn't accounted for. So now, return null in the event of an overflow. The man
page doesn't seem to indicate the errno to set in this particular situation,
but the glibc unit tests go for ENOMEM (https://code.woboq.org/userspace/glibc/malloc/tst-pvalloc.c.html#54)
so we'll do the same.
Update the aligned allocation funtions tests to check for properly aligned
returned pointers, and the `pvalloc` corner cases.

@alekseyshl: do you want me to do the same in the other Sanitizers?

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: kubamracek, alekseyshl, llvm-commits

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

llvm-svn: 309033

7 years agoReland "[LLVM][llvm-objcopy] Added basic plumbing to get things started"
Petr Hosek [Tue, 25 Jul 2017 21:16:33 +0000 (21:16 +0000)]
Reland "[LLVM][llvm-objcopy] Added basic plumbing to get things started"

As discussed on llvm-dev I've implemented the first basic steps towards
llvm-objcopy/llvm-objtool (name pending).

This change adds the ability to copy (without modification) 64-bit
little endian ELF executables that have SHT_PROGBITS, SHT_NOBITS,
SHT_NULL and SHT_STRTAB sections.

Patch by Jake Ehrlich

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

llvm-svn: 309032

7 years ago[CMAKE] Speedup developer builds when passing LLVM_APPEND_VC_REV = OFF
Don Hinton [Tue, 25 Jul 2017 21:13:18 +0000 (21:13 +0000)]
[CMAKE] Speedup developer builds when passing LLVM_APPEND_VC_REV = OFF

Make sure multiple targets don't get rebuilt unnecessarily when LLVM_APPEND_VC_REV = OFF.

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

llvm-svn: 309031

7 years ago[CMake] Fix broken builds from r309029
Chris Bieneman [Tue, 25 Jul 2017 20:58:14 +0000 (20:58 +0000)]
[CMake] Fix broken builds from r309029

Fixing the mismatched beginning if and endif contents.

llvm-svn: 309030

7 years ago[CMake] Allow TableGen.cmake to be included multiple times
Chris Bieneman [Tue, 25 Jul 2017 20:53:31 +0000 (20:53 +0000)]
[CMake] Allow TableGen.cmake to be included multiple times

This patch allows TableGen.cmake to be safely included multiple times in sub-projects.

llvm-svn: 309029

7 years agoAMDGPU/SI: Fix Depth and Height computation for SI scheduler
Marek Olsak [Tue, 25 Jul 2017 20:37:03 +0000 (20:37 +0000)]
AMDGPU/SI: Fix Depth and Height computation for SI scheduler

Patch by: Axel Davy

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

llvm-svn: 309028

7 years agoAMDGPU/SI: Force exports at the end for SI scheduler
Marek Olsak [Tue, 25 Jul 2017 20:36:58 +0000 (20:36 +0000)]
AMDGPU/SI: Force exports at the end for SI scheduler

Patch by: Axel Davy

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

llvm-svn: 309027

7 years ago[CMake] Build debugserver & debugserver_nonui
Chris Bieneman [Tue, 25 Jul 2017 20:31:53 +0000 (20:31 +0000)]
[CMake] Build debugserver & debugserver_nonui

When building for iOS we build two variants of debugserver. One which supports UI functionality like Springboard for launching applications, and one which does not.

This patch adds support for building debugserver with and without UI support libraries being available.

llvm-svn: 309026

7 years ago[CMake] Update Framework construction for iOS
Chris Bieneman [Tue, 25 Jul 2017 20:31:15 +0000 (20:31 +0000)]
[CMake] Update Framework construction for iOS

On iOS frameworks don't have versions or resources, they are flatter bundles. This updates the LLDB framework build to accommodate the flatter bundles.

llvm-svn: 309025

7 years ago[CMake] Rework construction of framework bundle
Chris Bieneman [Tue, 25 Jul 2017 20:30:58 +0000 (20:30 +0000)]
[CMake] Rework construction of framework bundle

This adds an explicit step for processing the headers and restructures how the framework bundles are constructed. This should make the frameworks more reliably constructed.

llvm-svn: 309024

7 years ago[CMake] Fix framework build
Chris Bieneman [Tue, 25 Jul 2017 20:30:35 +0000 (20:30 +0000)]
[CMake] Fix framework build

The LLDB framework build looks for the swig-generated source in the wrong place. This should resolve that.

llvm-svn: 309023

7 years ago[CMake] NFC. Cleanup unnecessary CMake policy
Chris Bieneman [Tue, 25 Jul 2017 20:30:18 +0000 (20:30 +0000)]
[CMake] NFC. Cleanup unnecessary CMake policy

This is just setting to the default behavior, so it does nothing.

llvm-svn: 309022

7 years ago[CMake] Cleanup unnecessary definition
Chris Bieneman [Tue, 25 Jul 2017 20:29:45 +0000 (20:29 +0000)]
[CMake] Cleanup unnecessary definition

This is only used in one file, and we already set it correctly on that file, so we don't need to set this everywhere.

llvm-svn: 309021

7 years ago[CMake] Add debugserver entitlements
Chris Bieneman [Tue, 25 Jul 2017 20:29:28 +0000 (20:29 +0000)]
[CMake] Add debugserver entitlements

When consigning debugserver we should also include the entitlements file on the code sign command.

llvm-svn: 309020

7 years agoImprove the fix for PR33875 by not hardcoding the section name.
Adrian Prantl [Tue, 25 Jul 2017 20:12:25 +0000 (20:12 +0000)]
Improve the fix for PR33875 by not hardcoding the section name.
This is a follow-up to r308905.

llvm-svn: 309019

7 years agoFix a bot by linking clang-import-test against libclangDriver
Sean Callanan [Tue, 25 Jul 2017 20:09:30 +0000 (20:09 +0000)]
Fix a bot by linking clang-import-test against libclangDriver

llvm-svn: 309018

7 years ago[COFF] Add support for delay loading DLLs on ARM
Martin Storsjo [Tue, 25 Jul 2017 20:00:37 +0000 (20:00 +0000)]
[COFF] Add support for delay loading DLLs on ARM

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

llvm-svn: 309017

7 years ago[AArch64] Update a comment in a test
Martin Storsjo [Tue, 25 Jul 2017 19:57:26 +0000 (19:57 +0000)]
[AArch64] Update a comment in a test

The comment ended up outdated when the test was rewritten in SVN r192281.

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

llvm-svn: 309016

7 years ago[AArch64] Add a test for float argument passing to win64 vararg functions
Martin Storsjo [Tue, 25 Jul 2017 19:57:22 +0000 (19:57 +0000)]
[AArch64] Add a test for float argument passing to win64 vararg functions

The existing tests only tested how a va_start is lowered.

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

llvm-svn: 309015

7 years ago[ExternalASTMerger] Import Objective-C classes
Sean Callanan [Tue, 25 Jul 2017 19:54:22 +0000 (19:54 +0000)]
[ExternalASTMerger] Import Objective-C classes

This patch adds functionality and a test for importing Objective-C classes
and their methods.

It also adds a flag to clang-import-test to set the language used for
parsing. This takes the same argument format as the -x option to the
driver.

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

llvm-svn: 309014

7 years ago[Frontend] Mark some ASTUnit methods as const. NFC.
Vedant Kumar [Tue, 25 Jul 2017 19:53:27 +0000 (19:53 +0000)]
[Frontend] Mark some ASTUnit methods as const. NFC.

Patch by Hamza Sood!

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

llvm-svn: 309013

7 years ago[LTO] Prevent dead stripping and internalization of symbols with sections
Teresa Johnson [Tue, 25 Jul 2017 19:42:32 +0000 (19:42 +0000)]
[LTO] Prevent dead stripping and internalization of symbols with sections

Summary:
ELF linkers generate __start_<secname> and __stop_<secname> symbols
when there is a value in a section <secname> where the name is a valid
C identifier.  If dead stripping determines that the values declared
in section <secname> are dead, and we then internalize (and delete)
such a symbol, programs that reference the corresponding start and end
section symbols will get undefined reference linking errors.

To fix this, add the section name to the IRSymtab entry when a symbol is
defined in a specific section. Then use this in the gold-plugin to mark
the symbol as external and visible from outside the summary when the
section name is a valid C identifier.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, eraman, llvm-commits

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

llvm-svn: 309009

7 years ago[ubsan] -fsanitize=vptr now requires -fsanitize=null, update tests
Vedant Kumar [Tue, 25 Jul 2017 19:34:27 +0000 (19:34 +0000)]
[ubsan] -fsanitize=vptr now requires -fsanitize=null, update tests

See: https://bugs.llvm.org/show_bug.cgi?id=33881
llvm-svn: 309008

7 years ago[ubsan] Null-check pointers in -fsanitize=vptr (PR33881)
Vedant Kumar [Tue, 25 Jul 2017 19:34:23 +0000 (19:34 +0000)]
[ubsan] Null-check pointers in -fsanitize=vptr (PR33881)

The instrumentation generated by -fsanitize=vptr does not null check a
user pointer before loading from it. This causes crashes in the face of
UB member calls (this=nullptr), i.e it's causing user programs to crash
only after UBSan is turned on.

The fix is to make run-time null checking a prerequisite for enabling
-fsanitize=vptr, and to then teach UBSan to reuse these run-time null
checks to make -fsanitize=vptr safe.

Testing: check-clang, check-ubsan, a stage2 ubsan-enabled build

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

https://bugs.llvm.org/show_bug.cgi?id=33881

llvm-svn: 309007

7 years ago[StaticAnalyzer] Completely unrolling specific loops with known bound option
Peter Szecsi [Tue, 25 Jul 2017 19:23:23 +0000 (19:23 +0000)]
[StaticAnalyzer] Completely unrolling specific loops with known bound option

This feature allows the analyzer to consider loops to completely unroll.
New requirements/rules (for unrolling) can be added easily via ASTMatchers.

Right now it is hidden behind a flag, the aim is to find the correct heuristic
and create a solution which results higher coverage % and more precise
analysis, thus can be enabled by default.

Right now the blocks which belong to an unrolled loop are marked by the
LoopVisitor which adds them to the ProgramState.
Then whenever we encounter a CFGBlock in the processCFGBlockEntrance which is
marked then we skip its investigating. That means, it won't be considered to
be visited more than the maximal bound for visiting since it won't be checked.

llvm-svn: 309006