5 years ago[StripGCRelocates] New pass to remove gc.relocates added by RS4GC
Anna Thomas [Fri, 21 Oct 2016 18:43:16 +0000 (18:43 +0000)]
[StripGCRelocates] New pass to remove gc.relocates added by RS4GC

Utility pass to remove gc.relocates created by rewrite statepoints for GC.
With respect to safepoint verification, the IR generated would be incorrect, and cannot run
as such.

This would be a single transformation on the final optimized IR.
The benefit of the pass is for easy analysis when the IRs are 'polluted' by too
many gc.relocates.
Added tests.

test run: All RS4GC tests with -verify option. Local downstream tests on large
IR files. This also works when the pointer being gc.relocated is another

Reviewers: sanjoy, reames

Subscribers: beanz, mgorny, llvm-commits

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

llvm-svn: 284855

5 years ago[CMake] Fix standalone build
Chris Bieneman [Fri, 21 Oct 2016 18:38:44 +0000 (18:38 +0000)]
[CMake] Fix standalone build

not and FileCheck targets may not be defined in standalone builds.

llvm-svn: 284854

5 years agoFor llvm-objdump for Mach-O files add printing of
Kevin Enderby [Fri, 21 Oct 2016 18:22:35 +0000 (18:22 +0000)]
For llvm-objdump for Mach-O files add printing of
the ARM_THREAD_STATE in the same format as
otool-classic(1) on darwin.

Also remove an extra space in printing the initprot to make
the output match otool-classic(1) on darwin.


llvm-svn: 284852

5 years agoAdd the new stdcpp formatters to the Xcode project.
Jim Ingham [Fri, 21 Oct 2016 18:18:25 +0000 (18:18 +0000)]
Add the new stdcpp formatters to the Xcode project.

llvm-svn: 284851

5 years ago[SCEVAffinator] Make precise modular math more correct.
Eli Friedman [Fri, 21 Oct 2016 18:08:02 +0000 (18:08 +0000)]
[SCEVAffinator] Make precise modular math more correct.

Integer math in LLVM IR is modular. Integer math in isl is
arbitrary-precision. Modeling LLVM IR math correctly in isl requires
either adding assumptions that math doesn't actually overflow, or
explicitly wrapping the math. However, expressions with the "nsw" flag
are special; we can pretend they're arbitrary-precision because it's
undefined behavior if the result wraps. SCEV expressions based on IR
instructions with an nsw flag also carry an nsw flag (roughly; actually,
the real rule is a bit more complicated, but the details don't matter

Before this patch, SCEV flags were also overloaded with an additional
function: the ZExt code was mutating SCEV expressions as a hack to
indicate to checkForWrapping that we don't need to add assumptions to
the operand of a ZExt; it'll add explicit wrapping itself. This kind of
works... the problem is that if anything else ever touches that SCEV
expression, it'll get confused by the incorrect flags.

Instead, with this patch, we make the decision about whether to
explicitly wrap the math a bit earlier, basing the decision purely on
the SCEV expression itself, and not its users.

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

llvm-svn: 284848

5 years agoI hadn't fixed all the instances of the old marker for scripted format strings; do...
Enrico Granata [Fri, 21 Oct 2016 18:03:55 +0000 (18:03 +0000)]
I hadn't fixed all the instances of the old marker for scripted format strings; do so now

llvm-svn: 284847

5 years agoUse FileCheck's -strict-whitespace option instead of sed.
Rui Ueyama [Fri, 21 Oct 2016 17:50:26 +0000 (17:50 +0000)]
Use FileCheck's -strict-whitespace option instead of sed.

llvm-svn: 284846

5 years ago[polly] Change SmallPtrSet which are being iterated into SmallSetVector
Mandeep Singh Grang [Fri, 21 Oct 2016 17:29:10 +0000 (17:29 +0000)]
[polly] Change SmallPtrSet which are being iterated into SmallSetVector

Summary: Otherwise the lack of an iteration order results in non-determinism in codegen.

Reviewers: _jdoerfert, zinob, grosser

Tags: #polly

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

llvm-svn: 284845

5 years ago[DAG] fold negation of sign-bit
Sanjay Patel [Fri, 21 Oct 2016 17:24:26 +0000 (17:24 +0000)]
[DAG] fold negation of sign-bit

0 - X --> 0, if the sub is NUW
0 - X --> 0, if X is 0 or the minimum signed value and the sub is NSW
0 - X --> X, if X is 0 or the minimum signed value

This is the DAG equivalent of:

plus the fold for the NUW case which already existed in InstSimplify.

Note that we miss a vector fold because of a deficiency in the DAG version of

llvm-svn: 284844

5 years agoRemoved unused function argument. NFC.
Artem Belevich [Fri, 21 Oct 2016 17:15:46 +0000 (17:15 +0000)]
Removed unused function argument. NFC.

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

llvm-svn: 284843

5 years ago[x86] add tests for potential negation folds
Sanjay Patel [Fri, 21 Oct 2016 16:56:29 +0000 (16:56 +0000)]
[x86] add tests for potential negation folds

These are the backend equivalents for the tests added in r284627.
The patterns may emerge late, so we should have folds for these in the DAG too.

llvm-svn: 284842

5 years ago[Hexagon] Handle spills of partially defined double vector registers
Krzysztof Parzyszek [Fri, 21 Oct 2016 16:38:29 +0000 (16:38 +0000)]
[Hexagon] Handle spills of partially defined double vector registers

After register allocation it is possible to have a spill of a register
that is only partially defined. That in itself it fine, but creates a
problem for double vector registers. Stores of such registers are pseudo
instructions that are expanded into pairs of individual vector stores,
and in case of a partially defined source, one of the stores may use
an entirely undefined register. To avoid this, track the defined parts
and only generate actual stores for those.

llvm-svn: 284841

5 years ago[WebAssembly] Fix for 0xc call_indirect changes
Derek Schuff [Fri, 21 Oct 2016 16:38:07 +0000 (16:38 +0000)]
[WebAssembly] Fix for 0xc call_indirect changes

Need to reorder the operands to have the callee as the last argument.
Adds a pseudo-instruction, and a pass to lower it into a real

This is the first of two options for how to fix the problem.

Reviewers: dschuff, sunfish

Subscribers: jfb, beanz, mgorny, llvm-commits

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

llvm-svn: 284840

5 years agoSet the vectorizer MaxInterleaveFactor for Exynos.
Abderrazek Zaafrani [Fri, 21 Oct 2016 16:28:27 +0000 (16:28 +0000)]
Set the vectorizer MaxInterleaveFactor for Exynos.

llvm-svn: 284839

5 years agoFix -Wunused-variable warning in libFuzzer
Reid Kleckner [Fri, 21 Oct 2016 16:26:27 +0000 (16:26 +0000)]
Fix -Wunused-variable warning in libFuzzer

llvm-svn: 284838

5 years ago[X86][SSE] Regenerated sext/zext constant folding tests and added i686 tests
Simon Pilgrim [Fri, 21 Oct 2016 16:22:16 +0000 (16:22 +0000)]
[X86][SSE] Regenerated sext/zext constant folding tests and added i686 tests

llvm-svn: 284837

5 years agoRemove unnecessary x86 backend requirements from OpenMP tests
Reid Kleckner [Fri, 21 Oct 2016 16:09:20 +0000 (16:09 +0000)]
Remove unnecessary x86 backend requirements from OpenMP tests

Clang can generate LLVM IR for x86 without a registered x86 backend.

llvm-svn: 284836

5 years ago[X86] Use DAG::getBuildVector helper wrapper where possible. NFCI.
Simon Pilgrim [Fri, 21 Oct 2016 16:07:51 +0000 (16:07 +0000)]
[X86] Use DAG::getBuildVector helper wrapper where possible. NFCI.

llvm-svn: 284835

5 years ago[MachineMemOperand][AtomicSDNode] Remove getSuccessOrdering()
Konstantin Zhuravlyov [Fri, 21 Oct 2016 16:02:35 +0000 (16:02 +0000)]
[MachineMemOperand][AtomicSDNode] Remove getSuccessOrdering()

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

llvm-svn: 284834

5 years ago[X86][SSE] Regenerated chained pmovsx store tests and added i686 tests
Simon Pilgrim [Fri, 21 Oct 2016 15:51:24 +0000 (15:51 +0000)]
[X86][SSE] Regenerated chained pmovsx store tests and added i686 tests

llvm-svn: 284833

5 years agoTest commit
Abderrazek Zaafrani [Fri, 21 Oct 2016 15:24:08 +0000 (15:24 +0000)]
Test commit

llvm-svn: 284832

5 years agoFix incorrect header order introduced in rL284830
Tamas Berghammer [Fri, 21 Oct 2016 15:05:03 +0000 (15:05 +0000)]
Fix incorrect header order introduced in rL284830

llvm-svn: 284831

5 years agoAdd data formatter for libstdc++ unique_ptr
Tamas Berghammer [Fri, 21 Oct 2016 15:02:44 +0000 (15:02 +0000)]
Add data formatter for libstdc++ unique_ptr

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

llvm-svn: 284830

5 years agoAdd data formatter for libstdc++ tuple
Tamas Berghammer [Fri, 21 Oct 2016 15:02:38 +0000 (15:02 +0000)]
Add data formatter for libstdc++ tuple

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

llvm-svn: 284829

5 years agoImprove the libstdc++ smart pointer formatters
Tamas Berghammer [Fri, 21 Oct 2016 15:02:32 +0000 (15:02 +0000)]
Improve the libstdc++ smart pointer formatters

* Display the strong/weak count in the summary
* Display the pointed object as a synthetic member
* Create synthetic children for weak/strong count

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

llvm-svn: 284828

5 years ago[LVI] Fix a bug with a guard being the very first instruction in a BB not taken into...
Artur Pilipenko [Fri, 21 Oct 2016 15:02:21 +0000 (15:02 +0000)]
[LVI] Fix a bug with a guard being the very first instruction in a BB not taken into account

While looking for guards use reverse iterator and scan up to rend() not to begin()

llvm-svn: 284827

5 years agofix variable names; NFCI
Sanjay Patel [Fri, 21 Oct 2016 14:58:30 +0000 (14:58 +0000)]
fix variable names; NFCI

Because we're just 'or-ing' these 2 variables later in the code, I
don't think there's a logical bug here, but of course the string with
"no size" is the one that should have the size suffix stripped off.

llvm-svn: 284826

5 years ago[AMDGPU][mc] Fix ds_min/max[_rtn]_f32 - extra source operand removed.
Artem Tamazov [Fri, 21 Oct 2016 14:49:22 +0000 (14:49 +0000)]
[AMDGPU][mc] Fix ds_min/max[_rtn]_f32 - extra source operand removed.

Fixes Bug 28215. Lit tests updated.

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

llvm-svn: 284825

5 years ago[DAG] use SDNode flags 'nsz' to enable fadd/fsub with zero folds
Sanjay Patel [Fri, 21 Oct 2016 14:36:58 +0000 (14:36 +0000)]
[DAG] use SDNode flags 'nsz' to enable fadd/fsub with zero folds

As discussed in D24815, let's start the process of killing off the broken fast-math global
state housed in TargetOptions and eliminate the need for function-level fast-math attributes.

Here we enable two similar folds that are possible when we don't care about signed-zero:
fadd nsz x, 0 --> x
fsub nsz 0, x --> -x

Note that although the test cases include a 'sin' function call, I'm side-stepping the
FMF-on-calls question (and lack of support in the DAG) for now. It's not needed for these
tests - isNegatibleForFree/GetNegatedExpression just look through a ISD::FSIN node.

Also, when we create an FNEG node and propagate the Flags of the FSUB to it, this doesn't
actually do anything today because Flags are silently dropped for any node that is not a
binary operator.

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

llvm-svn: 284824

5 years ago[X86][AVX2] Begun generalizing lowering to VPERMD/VPERMPS in preparation for AVX512...
Simon Pilgrim [Fri, 21 Oct 2016 13:00:47 +0000 (13:00 +0000)]
[X86][AVX2] Begun generalizing lowering to VPERMD/VPERMPS in preparation for AVX512 support.

llvm-svn: 284823

5 years agoWdocumentation fix
Simon Pilgrim [Fri, 21 Oct 2016 12:51:16 +0000 (12:51 +0000)]
Wdocumentation fix

llvm-svn: 284822

5 years ago[X86][AVX512] Add mask/maskz writemask support to subvector broadcast shuffle decode...
Simon Pilgrim [Fri, 21 Oct 2016 12:14:24 +0000 (12:14 +0000)]
[X86][AVX512] Add mask/maskz writemask support to subvector broadcast shuffle decode comments

llvm-svn: 284821

5 years ago[ELF] Add sh_link field to .ARM.exidx sections for relocatable links
Peter Smith [Fri, 21 Oct 2016 11:25:33 +0000 (11:25 +0000)]
[ELF] Add sh_link field to .ARM.exidx sections for relocatable links

When doing a relocatable link the .ARM.exidx sections with the
SHF_LINK_ORDER flag set need to set the sh_link field to the executable
section they describe. We find the appropriate OutputSection by
following the sh_link field of the .ARM.exidx InputSections.

The getOutputSectionName() function rules make sure that when there are
multiple .ARM.exidx InputSections in an OutputSection they all have the
same sh_link field.

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

llvm-svn: 284820

5 years agoAdd TestMultipleHits.py
Pavel Labath [Fri, 21 Oct 2016 11:14:04 +0000 (11:14 +0000)]
Add TestMultipleHits.py

This tests that lldb handles the situation when a single instruction triggers
multiple watchpoint hits. It currently fails on arm due to what appears to be a
lldb-server bug (pr30758).

llvm-svn: 284819

5 years ago[LoopUnroll] Keep the loop test only on the first iteration of max-or-zero loops
John Brawn [Fri, 21 Oct 2016 11:08:48 +0000 (11:08 +0000)]
[LoopUnroll] Keep the loop test only on the first iteration of max-or-zero loops

When we have a loop with a known upper bound on the number of iterations, and
furthermore know that either the number of iterations will be either exactly
that upper bound or zero, then we can fully unroll up to that upper bound
keeping only the first loop test to check for the zero iteration case.

Most of the work here is in plumbing this 'max-or-zero' information from the
part of scalar evolution where it's detected through to loop unrolling. I've
also gone for the safe default of 'false' everywhere but howManyLessThans which
could probably be improved.

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

llvm-svn: 284818

5 years agoRevert "Fix a race condition between "ephemeral watchpoint disable/enable" and contin...
Pavel Labath [Fri, 21 Oct 2016 10:52:11 +0000 (10:52 +0000)]
Revert "Fix a race condition between "ephemeral watchpoint disable/enable" and continue in commands."

This reverts commit r284795, as it breaks watchpoint handling on arm (and
presumable all architectures that report watchpoint hits without executing the
tripping instruction).

There seems to be something fundamentally wrong with this patch: it uses
process_sp->AddPreResumeAction to re-enable the watchpoint, but the whole point
of the step-over-watchpoint logic (which AFAIK is the only user of this class) is
to disable the watchpoint *after* we resume to do the single step.

I have no idea how to fix this except by reverting the offending patch.

llvm-svn: 284817

5 years ago[X86][AVX] Add 32-bit target tests for vector lzcnt/tzcnt to demonstrate missed foldi...
Simon Pilgrim [Fri, 21 Oct 2016 10:50:52 +0000 (10:50 +0000)]
[X86][AVX] Add 32-bit target tests for vector lzcnt/tzcnt to demonstrate missed folding opportunities

llvm-svn: 284816

5 years agoRemove non-existing file from modulemap.
Benjamin Kramer [Fri, 21 Oct 2016 10:19:37 +0000 (10:19 +0000)]
Remove non-existing file from modulemap.

This picked up a builtin header if it happened to be available.

llvm-svn: 284815

5 years ago[AArch64] Corrected spill size for DDD register class. NFCI
Bjorn Pettersson [Fri, 21 Oct 2016 09:53:42 +0000 (09:53 +0000)]
[AArch64] Corrected spill size for DDD register class. NFCI

The spill size was incorrectly set to 196 bits,
which isn't a multiple of 8. This problem was detected when
experimenting with asserts that the spill size should be a
multiple of the byte size.

New corrected value for the spill size is set to 192 bits.

Note that tablegen (RegisterInfoEmitter) will divide the
size set in the RegisterClass definition by 8. So this
change should not have any impact on the tablegen output
(trunc(192/8) == trunc(196/8) == 24 bytes).

Reviewers: t.p.northover

Subscribers: llvm-commits, aemerson, rengolin

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

llvm-svn: 284814

5 years agoFix WebAssembly test after r284757.
Benjamin Kramer [Fri, 21 Oct 2016 09:51:41 +0000 (09:51 +0000)]
Fix WebAssembly test after r284757.

The change to MachineSink shuffles code around, disable it.

llvm-svn: 284813

5 years ago[Support] Fix AlignOf test on i386-linux.
Benjamin Kramer [Fri, 21 Oct 2016 09:15:57 +0000 (09:15 +0000)]
[Support] Fix AlignOf test on i386-linux.

On i386 alignof(double) = 8 is not the same as alignof(struct { double
}) = 4. This used to be not an issue because the old implementation
always measured alignment inside of structs. Wrap a dummy struct around
the test to avoid this issue.

llvm-svn: 284812

5 years agoRevert "DR583, DR1512: Implement a rewrite to C++'s 'composite pointer type' rules."
Renato Golin [Fri, 21 Oct 2016 08:03:49 +0000 (08:03 +0000)]
Revert "DR583, DR1512: Implement a rewrite to C++'s 'composite pointer type' rules."

This reverts commit r284800, as it failed all ARM/AArch64 bots.

llvm-svn: 284811

5 years ago[ELF] Add DebugInfoDWARF dependency
George Rimar [Fri, 21 Oct 2016 07:46:24 +0000 (07:46 +0000)]
[ELF] Add DebugInfoDWARF dependency

rL284708 introduces a link error when building with BUILD_SHARED_LIBS:

undefined reference to `llvm::DWARFContext::parseCompileUnits()'
undefined reference to `llvm::DWARFContextInMemory::DWARFContextInMemory(
                            llvm::object::ObjectFile const&,
                            llvm::LoadedObjectInfo const*)'
The functions are available in libDebugInfoDWARF, from llvm.

Patch by Visoiu Mistrih Francis

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

llvm-svn: 284810

5 years ago[ELF][MIPS] Put local GOT entries accessed via a 16-bit index first
Simon Atanasyan [Fri, 21 Oct 2016 07:22:30 +0000 (07:22 +0000)]
[ELF][MIPS] Put local GOT entries accessed via a 16-bit index first

Some MIPS relocations used to access GOT entries are able to manipulate
16-bit index. The other ones like R_MIPS_CALL_HI16/LO16 can handle
32-bit indexes. 16-bit relocations are generated by default. The 32-bit
relocations are generated by -mxgot flag passed to compiler. Usually
these relocation are not mixed in the same code but files like crt*.o
contain 16-bit relocations so even if all "user's" code compiled with
-mxgot flag a few 16-bit relocations might come to the linking phase.

Now LLD does not differentiate local GOT entries accessed via a 16-bit
and 32-bit indexes. That might lead to relocation's overflow if 16-bit
entries are allocated to far from the beginning of the GOT.

The patch introduces new "part" of MIPS GOT dedicated to the local GOT
entries accessed by 32-bit relocations. That allows to put local GOT
entries accessed via a 16-bit index first and escape relocation's overflow.

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

llvm-svn: 284809

5 years ago[AVX-512] Add tests to show opportunities for commuting vpermi2/vpermt2 instructions.
Craig Topper [Fri, 21 Oct 2016 05:55:40 +0000 (05:55 +0000)]
[AVX-512] Add tests to show opportunities for commuting vpermi2/vpermt2 instructions.

Commuting will be added in a future commit.

llvm-svn: 284808

5 years agoclang-format: [JS] Fix template string ASI.
Martin Probst [Fri, 21 Oct 2016 05:11:38 +0000 (05:11 +0000)]
clang-format: [JS] Fix template string ASI.

Previously, automatic semicolon insertion would add an unwrapped line
when a template string contained a line break.

    var x = `foo${

Would be formatted with `bar...` on a separate line and no indent.

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 284807

5 years agoSimplify. NFC.
Rui Ueyama [Fri, 21 Oct 2016 04:52:13 +0000 (04:52 +0000)]
Simplify. NFC.

llvm-svn: 284806

5 years agoAdd comments.
Rui Ueyama [Fri, 21 Oct 2016 04:52:11 +0000 (04:52 +0000)]
Add comments.

llvm-svn: 284805

5 years agoSimplify by merging a lambda with addSymbol. NFC.
Rui Ueyama [Fri, 21 Oct 2016 04:32:46 +0000 (04:32 +0000)]
Simplify by merging a lambda with addSymbol. NFC.

llvm-svn: 284804

5 years agoDo not create .shstrtab and use .strtab instead.
Rui Ueyama [Fri, 21 Oct 2016 03:23:23 +0000 (03:23 +0000)]
Do not create .shstrtab and use .strtab instead.

In-memory ELF object files created here are consumed immediately,
so as long as the generated files are syntactically correct, we don't
care about the details.

llvm-svn: 284803

5 years agoDon't try to use !Previous.empty() as a proxy for "Is this a redeclaration?" --
Richard Smith [Fri, 21 Oct 2016 03:15:03 +0000 (03:15 +0000)]
Don't try to use !Previous.empty() as a proxy for "Is this a redeclaration?" --
we don't collapse that down to a single entry if it's not a redeclaration.
Instead, set the Redeclaration bit on the Declarator to indicate whether a
function is a redeclaration (which may not have been linked into the
redeclaration chain if it's a dependent context friend).

Fixes a rejects-valid; see testcase.

llvm-svn: 284802

5 years ago[ModuleMap] Add more module entries to cover some non modular headers
Bruno Cardoso Lopes [Fri, 21 Oct 2016 03:14:27 +0000 (03:14 +0000)]
[ModuleMap] Add more module entries to cover some non modular headers

These modules are necessary on Darwin to allow modules with
'no_undeclared_includes' (introduced in clang r284797) to work properly
while using libc++ headers.

Patch extracted from a suggested module.modulemap from Richard Smith!

llvm-svn: 284801

5 years agoDR583, DR1512: Implement a rewrite to C++'s 'composite pointer type' rules.
Richard Smith [Fri, 21 Oct 2016 02:36:37 +0000 (02:36 +0000)]
DR583, DR1512: Implement a rewrite to C++'s 'composite pointer type' rules.
This has two significant effects:

1) Direct relational comparisons between null pointer constants (0 and nullopt)
   and pointers are now ill-formed. This was always the case for C, and it
   appears that C++ only ever permitted by accident. For instance, cases like
     nullptr < &a
   are now rejected.

2) Comparisons and conditional operators between differently-cv-qualified
   pointer types now work, and produce a composite type that both source
   pointer types can convert to (when possible). For instance, comparison
   between 'int **' and 'const int **' is now valid, and uses an intermediate
   type of 'const int *const *'.

Clang previously supported #2 as an extension.

We do not accept the cases in #1 as an extension. I've tested a fair amount of
code to check that this doesn't break it, but if it turns out that someone is
relying on this, we can easily add it back as an extension.

llvm-svn: 284800

5 years agoGuard GetEscapedHostname against a nullptr hostname.
Jason Molenda [Fri, 21 Oct 2016 02:32:08 +0000 (02:32 +0000)]
Guard GetEscapedHostname against a nullptr hostname.
This can happen if you debug an iOS corefile on
a mac, where PlatformPOSIX::GetHostname ends up
not providing a hostname because we're working
with a platform of remote-ios.

llvm-svn: 284799

5 years ago[Driver][Darwin] Pass -no_deduplicate to ld64
Bruno Cardoso Lopes [Fri, 21 Oct 2016 01:49:14 +0000 (01:49 +0000)]
[Driver][Darwin] Pass -no_deduplicate to ld64

Recent versions of ld64 run a deduplicate pass, which is on by default.
Disable the pass by using -no_deduplicate in certain condition and
enhance total compile time.


llvm-svn: 284798

5 years ago[Modules] Add 'no_undeclared_includes' module map attribute
Bruno Cardoso Lopes [Fri, 21 Oct 2016 01:41:56 +0000 (01:41 +0000)]
[Modules] Add 'no_undeclared_includes' module map attribute

The 'no_undeclared_includes' attribute should be used in a module to
tell that only non-modular headers and headers from used modules are

The main motivation behind this is to prevent dep cycles between system
libraries (such as darwin) and libc++.

Patch by Richard Smith!

llvm-svn: 284797

5 years agoRevert "[GVN/PRE] Hoist global values outside of loops."
Davide Italiano [Fri, 21 Oct 2016 01:37:02 +0000 (01:37 +0000)]
Revert "[GVN/PRE] Hoist global values outside of loops."

There's no agreement about this patch. I personally find the
PRE machinery of the current GVN hard enough to reason about
that I'm not sure I'll try to land this again, instead of working
on the rewrite).

llvm-svn: 284796

5 years agoFix a race condition between "ephemeral watchpoint disable/enable" and continue in...
Jim Ingham [Fri, 21 Oct 2016 00:06:38 +0000 (00:06 +0000)]
Fix a race condition between "ephemeral watchpoint disable/enable" and continue in commands.

Also, watchpoint commands, like breakpoint commands, need to run in async mode.

This was causing intermittent failures in TestWatchpointCommandPython.py, which is now solid.

llvm-svn: 284795

5 years agoRevert 9 changes from r284793, they still fail on some bots
Reid Kleckner [Thu, 20 Oct 2016 23:30:39 +0000 (23:30 +0000)]
Revert 9 changes from r284793, they still fail on some bots

llvm-svn: 284794

5 years agoRemove 24 instances of 'REQUIRES: shell'
Reid Kleckner [Thu, 20 Oct 2016 23:11:45 +0000 (23:11 +0000)]
Remove 24 instances of 'REQUIRES: shell'

Tests fall into one of the following categories:

- The requirement was unnecessary

- Additional quoting was required for backslashes in paths (see "sed -e
  's/\\/\\\\/g'") in the sanitizer tests.

- OpenMP used 'REQUIRES: shell' as a proxy for the test failing on
  Windows. Those tests fail there reliably, so use XFAIL instead.

I tried not to remove shell requirements that were added to suppress
flaky test failures, but if I screwed up, we can add it back as needed.

llvm-svn: 284793

5 years agoAdd an API to remove an action from the Process PreResumeActions.
Jim Ingham [Thu, 20 Oct 2016 22:50:00 +0000 (22:50 +0000)]
Add an API to remove an action from the Process PreResumeActions.

llvm-svn: 284792

5 years agoRemove an unnecessary and incorrect check for num locations of a breakpoint
Jim Ingham [Thu, 20 Oct 2016 22:49:06 +0000 (22:49 +0000)]
Remove an unnecessary and incorrect check for num locations of a breakpoint
by grubbing the break list output.  If you pass a number of locations into
the run_break_* functions, they will check that this is right for you.

llvm-svn: 284791

5 years agoAttempt to fix buildbots.
Rui Ueyama [Thu, 20 Oct 2016 22:29:22 +0000 (22:29 +0000)]
Attempt to fix buildbots.

llvm-svn: 284790

5 years agoFix cross-endianness RuntimeDyld relocation for ARM
Keno Fischer [Thu, 20 Oct 2016 22:15:56 +0000 (22:15 +0000)]
Fix cross-endianness RuntimeDyld relocation for ARM

rL284780 fixed the PREL31 relocation and added a test for it. Being
the first such test for ARM relocations, it exposed incorrect endianness
assumptions (causing buildbot failures on big-endian hosts). Fix that by
using the same helpers used for the x86 case.

llvm-svn: 284789

5 years agoframe.script became script.frame a while ago; fix up the docs
Enrico Granata [Thu, 20 Oct 2016 22:10:07 +0000 (22:10 +0000)]
frame.script became script.frame a while ago; fix up the docs

llvm-svn: 284788

5 years agoThis debugging message has been left in the code for years, until one day it randomly...
Enrico Granata [Thu, 20 Oct 2016 22:05:21 +0000 (22:05 +0000)]
This debugging message has been left in the code for years, until one day it randomly hit on some corrupted memory

It is misleading to users in its current form, and only interesting to me - remove it


llvm-svn: 284787

5 years agoMove code from InputFile to ELFCreator to decouple the two files.
Rui Ueyama [Thu, 20 Oct 2016 21:57:06 +0000 (21:57 +0000)]
Move code from InputFile to ELFCreator to decouple the two files.

Now that only one non-member function is exported from ELFCreator.h.
All the details are handled internally in ELFCreator.cpp file.

llvm-svn: 284786

5 years agoRe-commit r284753, reverted in r284778, with a fix for PR30749.
Richard Smith [Thu, 20 Oct 2016 21:53:09 +0000 (21:53 +0000)]
Re-commit r284753, reverted in r284778, with a fix for PR30749.

Original commit message:

[c++1z] Teach composite pointer type computation how to compute the composite
pointer type of two function pointers with different noexcept specifications.
While I'm here, also teach it how to merge dynamic exception specifications.

llvm-svn: 284785

5 years ago[SCEV] Add a threshold to restrict number of mul operands to be inlined into SCEV
Li Huang [Thu, 20 Oct 2016 21:38:39 +0000 (21:38 +0000)]
[SCEV] Add a threshold to restrict number of mul operands to be inlined into SCEV

This is to avoid inlining too many multiplication operands into a SCEV, which could
take exponential time in the worst case.

Reviewers: Sanjoy Das, Mehdi Amini, Michael Zolotukhin

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

llvm-svn: 284784

5 years ago[clang] Remove FileEntry copy-constructor
Alexander Shaposhnikov [Thu, 20 Oct 2016 21:20:35 +0000 (21:20 +0000)]
[clang] Remove FileEntry copy-constructor

Code cleanup: address FIXME in the file
include/clang/Basic/FileManager.h and remove
copy-constructor of the class FileEntry.

Test plan: make check-clang

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

llvm-svn: 284782

5 years agoRevert "Disable swiftcall test on windows: More brutal way to appease windows bots"
Reid Kleckner [Thu, 20 Oct 2016 21:17:28 +0000 (21:17 +0000)]
Revert "Disable swiftcall test on windows: More brutal way to appease windows bots"

This reverts commit r284174. The tests pass for me locally. It must have
been a 2015 only crash.

Fixes PR30699

llvm-svn: 284781

5 years agoFix PREL31 relocation on ARM
Keno Fischer [Thu, 20 Oct 2016 21:15:29 +0000 (21:15 +0000)]
Fix PREL31 relocation on ARM

This is a 31bits relative relocation instead of a 32bits absolute relocation.

Reviewers: t.p.northover, peter.smith, rengolin

Subscribers: aemerson, llvm-commits, samparker

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

llvm-svn: 284780

5 years ago[X86] Enable interleaved memory access by default
Michael Kuperstein [Thu, 20 Oct 2016 21:04:31 +0000 (21:04 +0000)]
[X86] Enable interleaved memory access by default

This lets the loop vectorizer generate interleaved memory accesses on x86.

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

llvm-svn: 284779

5 years agoRevert r284753 "[c++1z] Teach composite pointer type computation how to compute the...
Hans Wennborg [Thu, 20 Oct 2016 20:54:32 +0000 (20:54 +0000)]
Revert r284753 "[c++1z] Teach composite pointer type computation how to compute the composite"

It caused PR30749.

llvm-svn: 284778

5 years agoFix off-by-one error in PPCaching.cpp token annotation assertion
Reid Kleckner [Thu, 20 Oct 2016 20:53:20 +0000 (20:53 +0000)]
Fix off-by-one error in PPCaching.cpp token annotation assertion

This assert is intended to defend against backtracking into the middle
of a sequence of tokens that is being replaced with an annotation, but
it's OK if we backtrack to the exact position of the start of the
annotation sequence. Use a <= comparison instead of <.

Fixes PR25946

llvm-svn: 284777

5 years agollvm-dwarfdump is now used in a test, so add a depedency on the tool.
Rui Ueyama [Thu, 20 Oct 2016 20:50:00 +0000 (20:50 +0000)]
llvm-dwarfdump is now used in a test, so add a depedency on the tool.

llvm-svn: 284776

5 years ago[Driver] Refactor DetectDistro() parameters to take VFS ref only. NFC
Michal Gorny [Thu, 20 Oct 2016 20:45:40 +0000 (20:45 +0000)]
[Driver] Refactor DetectDistro() parameters to take VFS ref only. NFC

Refactor the DetectDistro() function to take a single vfs::FileSystem
reference only, instead of Driver and llvm::Triple::ArchType.
The ArchType parameter was not used anyway, and Driver was only used to
obtain the VFS.

Aside to making the API simpler and more transparent, it makes it
easier to add unit tests for the function in the future -- since
the tests would need only to provide an appropriate VFS.

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

llvm-svn: 284774

5 years agoadding new symbols to llvm-symbolizer symbol test
Mike Aizatsky [Thu, 20 Oct 2016 20:33:54 +0000 (20:33 +0000)]
adding new symbols to llvm-symbolizer symbol test

llvm-svn: 284773

5 years ago[MSSA] Avoid unnecessary use walks when calling getClobberingMemoryAccess
Daniel Berlin [Thu, 20 Oct 2016 20:13:45 +0000 (20:13 +0000)]
[MSSA] Avoid unnecessary use walks when calling getClobberingMemoryAccess

This allows us to mark when uses have been optimized.
This lets us avoid rewalking (IE when people call getClobberingAccess on everything), and also
enables us to later relax the requirement of use optimization during updates with less cost.

Reviewers: george.burgess.iv

Subscribers: llvm-commits

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

llvm-svn: 284771

5 years ago[Driver] Parse Debian version as integer when possible. NFC
Michal Gorny [Thu, 20 Oct 2016 20:13:35 +0000 (20:13 +0000)]
[Driver] Parse Debian version as integer when possible. NFC

Replace the string matching for /etc/debian_version with split
integer/string matching algorithm. When the file contains 'major.minor'
version number, parse the major version as integer and use a switch
clause to match it. Otherwise, attempt 'codename/sid' matching using
a StringSwitch.

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

llvm-svn: 284770

5 years agoAnother additional error check for invalid Mach-O files for the
Kevin Enderby [Thu, 20 Oct 2016 20:10:30 +0000 (20:10 +0000)]
Another additional error check for invalid Mach-O files for the
load commands that use the MachO::twolevel_hints_command type
which includes only the LC_TWOLEVEL_HINTS load command.

This is not used in llvm libObject code or in llvm tool code.  But
does appear in one of the binary test files.  While this load command is
obsolete it is easier to add code for it in libObject than edit or change
the binary test case.

llvm-svn: 284769

5 years agoAdd a space to work around a Windows CPython / MSys quoting bug
Reid Kleckner [Thu, 20 Oct 2016 20:02:24 +0000 (20:02 +0000)]
Add a space to work around a Windows CPython / MSys quoting bug

The rules for quoting the command line that a subprocess receives are
user space conventions implemented by the C runtime. Python's quoting
rules are implemented here:

The result is that the final command line C string computed by Python is
'echo \"'. Mingw doesn't appear to interpret that backslash as escaping
the quote because it is not already inside a quoted region. As a result,
our echo command prints a single backslash instead of a quote.

The whole issue can be sidestepped by adding a space a forcing Python to
put the argument to echo in double quotes.

Reviewers: inglorion, ruiu

Subscribers: llvm-commits

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

llvm-svn: 284768

5 years ago[CodeGen] Devirtualize calls to methods marked final in a derived class
Vedant Kumar [Thu, 20 Oct 2016 18:44:14 +0000 (18:44 +0000)]
[CodeGen] Devirtualize calls to methods marked final in a derived class

If we see a virtual method call to Base::foo() but can infer that the
object is an instance of Derived, and that 'foo' is marked 'final' in
Derived, we can devirtualize the call to Derived::foo().

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

llvm-svn: 284766

5 years ago[AMDGPU] Handle R_AMDGPU_ABS64 relocation
Konstantin Zhuravlyov [Thu, 20 Oct 2016 18:34:58 +0000 (18:34 +0000)]
[AMDGPU] Handle R_AMDGPU_ABS64 relocation

This is needed for the following case (OpenCL example):
  __global int Var = 0;
  __global int* Ptr[] = {&Var};

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

llvm-svn: 284764

5 years agoFix case of file include path.
Zachary Turner [Thu, 20 Oct 2016 18:34:37 +0000 (18:34 +0000)]
Fix case of file include path.

llvm-svn: 284763

5 years ago[CodeView] Refactor serialization to use StreamInterface.
Zachary Turner [Thu, 20 Oct 2016 18:31:19 +0000 (18:31 +0000)]
[CodeView] Refactor serialization to use StreamInterface.

This was all using ArrayRef<>s before which presents a problem
when you want to serialize to or deserialize from an actual
PDB stream.  An ArrayRef<> is really just a special case of
what can be handled with StreamInterface though (e.g. by using
a ByteStream), so changing this to use StreamInterface allows
us to plug in a PDB stream and get all the record serialization
and deserialization for free on a MappedBlockStream.

Subsequent patches will try to remove TypeTableBuilder and
TypeRecordBuilder in favor of class that operate on
Streams as well, which should allow us to completely merge
the reading and writing codepaths for both types and symbols.

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

llvm-svn: 284762

5 years ago[c++1z] Fix assertion failure when using the wrong number of bindings for a
Richard Smith [Thu, 20 Oct 2016 18:29:25 +0000 (18:29 +0000)]
[c++1z] Fix assertion failure when using the wrong number of bindings for a
struct with unnamed bitfields.

llvm-svn: 284761

5 years ago[AMDGPU] Make note record name a static const member of target streamer
Konstantin Zhuravlyov [Thu, 20 Oct 2016 18:22:36 +0000 (18:22 +0000)]
[AMDGPU] Make note record name a static const member of target streamer

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

llvm-svn: 284760

5 years ago[AMDGPU] Emit constant address space data in .rodata section and use relocations...
Konstantin Zhuravlyov [Thu, 20 Oct 2016 18:12:38 +0000 (18:12 +0000)]
[AMDGPU] Emit constant address space data in .rodata section and use relocations instead of fixups (amdhsa only)

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

llvm-svn: 284759

5 years agoRemove unused #include.
Rui Ueyama [Thu, 20 Oct 2016 18:07:11 +0000 (18:07 +0000)]
Remove unused #include.

llvm-svn: 284758

5 years agoUsing branch probability to guide critical edge splitting.
Dehao Chen [Thu, 20 Oct 2016 18:06:52 +0000 (18:06 +0000)]
Using branch probability to guide critical edge splitting.

The original heuristic to break critical edge during machine sink is relatively conservertive: when there is only one instruction sinkable to the critical edge, it is likely that the machine sink pass will not break the critical edge. This leads to many speculative instructions executed at runtime. However, with profile info, we could model the splitting benefits: if the critical edge has 50% taken rate, it would always be beneficial to split the critical edge to avoid the speculated runtime instructions. This patch uses profile to guide critical edge splitting in machine sink pass.

The performance impact on speccpu2006 on Intel sandybridge machines:

spec/2006/fp/C++/444.namd                  25.3  +0.26%
spec/2006/fp/C++/447.dealII               45.96  -0.10%
spec/2006/fp/C++/450.soplex               41.97  +1.49%
spec/2006/fp/C++/453.povray               36.83  -0.96%
spec/2006/fp/C/433.milc                   23.81  +0.32%
spec/2006/fp/C/470.lbm                    41.17  +0.34%
spec/2006/fp/C/482.sphinx3                48.13  +0.69%
spec/2006/int/C++/471.omnetpp             22.45  +3.25%
spec/2006/int/C++/473.astar               21.35  -2.06%
spec/2006/int/C++/483.xalancbmk           36.02  -2.39%
spec/2006/int/C/400.perlbench              33.7  -0.17%
spec/2006/int/C/401.bzip2                  22.9  +0.52%
spec/2006/int/C/403.gcc                   32.42  -0.54%
spec/2006/int/C/429.mcf                   39.59  +0.19%
spec/2006/int/C/445.gobmk                 26.98  -0.00%
spec/2006/int/C/456.hmmer                 24.52  -0.18%
spec/2006/int/C/458.sjeng                 28.26  +0.02%
spec/2006/int/C/462.libquantum            55.44  +3.74%
spec/2006/int/C/464.h264ref               46.67  -0.39%

geometric mean                                   +0.20%

Manually checked 473 and 471 to verify the diff is in the noise range.

Reviewers: rengolin, davidxl

Subscribers: llvm-commits

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

llvm-svn: 284757

5 years agoRe-landing a cleaned up implementation of r284550
Chris Bieneman [Thu, 20 Oct 2016 18:01:19 +0000 (18:01 +0000)]
Re-landing a cleaned up implementation of r284550

This time it should actually work. The previous implementaiton was not
getting the linker or compiler flag set correctly in all the right
situations. By moving the check down and basing it of whether or not CXX
is set I we can have the logic to add the flags exist only once for the
linker and once for the compiler instead of duplicating it.

llvm-svn: 284756

5 years ago[CostModel][X86] Fixed AVX1/AVX512 sdiv/udiv uniformconst costs for 256/512 bit integ...
Simon Pilgrim [Thu, 20 Oct 2016 18:00:35 +0000 (18:00 +0000)]
[CostModel][X86] Fixed AVX1/AVX512 sdiv/udiv uniformconst costs for 256/512 bit integer vectors

We weren't checking for uniform const costs before the general cost, resulting in very high estimates.

llvm-svn: 284755

5 years agoAdd more doxygen comments to emmintrin.h's intrinsics.
Ekaterina Romanova [Thu, 20 Oct 2016 17:59:15 +0000 (17:59 +0000)]
Add more doxygen comments to emmintrin.h's intrinsics.

With this patch, 75% of the intrinsics in this file will be documented now. The patches for the rest of the intrisics in this file will be send out later.

The doxygen comments are automatically generated based on Sony's intrinsics document.

I got an OK from Eric Christopher to commit doxygen comments without prior code review upstream. This patch was internally reviewed by Yunzhong Gao.

llvm-svn: 284754

5 years ago[c++1z] Teach composite pointer type computation how to compute the composite
Richard Smith [Thu, 20 Oct 2016 17:57:33 +0000 (17:57 +0000)]
[c++1z] Teach composite pointer type computation how to compute the composite
pointer type of two function pointers with different noexcept specifications.
While I'm here, also teach it how to merge dynamic exception specifications.

llvm-svn: 284753

5 years agoFix *_EXTEND_VECTOR_INREG legalization
Pirama Arumuga Nainar [Thu, 20 Oct 2016 17:56:36 +0000 (17:56 +0000)]
Fix *_EXTEND_VECTOR_INREG legalization

While promoting *_EXTEND_VECTOR_INREG nodes whose inputs are already
promoted, perform the appropriate sign extension for the promoted node
before doing the *_EXTEND_VECTOR_INREG operation.  If not, the undefined
high-order bits of the promoted operand may (a) be garbage inc ase of
zext) or (b) contribute the wrong sign-bit (in case of sext)

Updated the promote-vec3.ll test after this change.  The diff shows
explicit zeroing in case of zext and intermediate sign extension in case
of sext.

Reviewers: RKSimon

Subscribers: llvm-commits, srhines

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

llvm-svn: 284752

5 years ago[ELF][MIPS] Use getMipsLocalEntriesNum() everywhere we need number of `local` GOT...
Simon Atanasyan [Thu, 20 Oct 2016 17:53:59 +0000 (17:53 +0000)]
[ELF][MIPS] Use getMipsLocalEntriesNum() everywhere we need number of `local` GOT entries. NFC

llvm-svn: 284751

5 years ago[ELF][MIPS] Separate calculation of MIPS GOT index and offset of the corresponding...
Simon Atanasyan [Thu, 20 Oct 2016 17:53:55 +0000 (17:53 +0000)]
[ELF][MIPS] Separate calculation of MIPS GOT index and offset of the corresponding part of the GOT. NFC

MIPS GOT consists of some parts: local, global, TLS entries. This change
separates calculation of MIPS GOT index and offset of the corresponding
part of the GOT. That makes code a bit clear and allow to extend number
of parts in the future.

llvm-svn: 284750

5 years ago[clang-cl] Fix test that shouldn't be running on non-x86
Renato Golin [Thu, 20 Oct 2016 17:41:08 +0000 (17:41 +0000)]
[clang-cl] Fix test that shouldn't be running on non-x86

The clang-cl test required x86-registered-target but it defaulted to the
host's triple and AArch64 still doesn't support COFF, so the test failed.

The triple was "aarch64-pc-windows-msvc18.0.0" with ObjectFormat equals
llvm::Triple::COFF, failing assertion:

Assertion `(TT.isOSBinFormatELF() || TT.isOSBinFormatMachO()) &&
          "Only expect Darwin and ELF targets"

in AArch64MCTargetDesc.cpp:78.

Making the test only run on Windows hosts obviously fixes the problem.

llvm-svn: 284749

5 years ago[CostModel][X86] Added tests for sdiv/udiv costs for uniform const and uniform const...
Simon Pilgrim [Thu, 20 Oct 2016 17:16:38 +0000 (17:16 +0000)]
[CostModel][X86] Added tests for sdiv/udiv costs for uniform const and uniform const power-of-2

Shows poor costings in AVX1/AVX512BW for certain vector types

llvm-svn: 284748