platform/upstream/llvm.git
7 years agoRevert "MemorySSA: Add support for caching clobbering access in stores"
Daniel Berlin [Tue, 4 Apr 2017 23:43:04 +0000 (23:43 +0000)]
Revert "MemorySSA: Add support for caching clobbering access in stores"

This reverts revision r299322.

llvm-svn: 299485

7 years ago[MC] Set defaults based on section names and support name suffixes
Petr Hosek [Tue, 4 Apr 2017 23:32:45 +0000 (23:32 +0000)]
[MC] Set defaults based on section names and support name suffixes

Set correct default flags and section type based on its name for .text,
.data, .bss, .init_array, .fini_array, .preinit_array, .tdata, and .tbss
and support section name suffixes for .data.*, .rodata.*, .text.*,
.bss.*, .tdata.* and .tbss.* which matches the behavior of GAS.

Fixes PR31888.

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

llvm-svn: 299484

7 years ago[AArch64] Avoid partial register deps on insertelt of load into lane 0.
Ahmed Bougacha [Tue, 4 Apr 2017 22:55:53 +0000 (22:55 +0000)]
[AArch64] Avoid partial register deps on insertelt of load into lane 0.

This improves upon r246462: that prevented FMOVs from being emitted
for the cross-class INSERT_SUBREGs by disabling the formation of
INSERT_SUBREGs of LOAD.  But the ld1.s that we started selecting
caused us to introduce partial dependencies on the vector register.

Avoid that by using SCALAR_TO_VECTOR: it's a first-class citizen that
is folded away by many patterns, including the scalar LDRS that we
want in this case.

Credit goes to Adam for finding the issue!

llvm-svn: 299482

7 years agoFix sphinx warning from r299470
Adam Nemet [Tue, 4 Apr 2017 22:45:20 +0000 (22:45 +0000)]
Fix sphinx warning from r299470

llvm-svn: 299481

7 years agoChange section flag character for SHF_LINK_ORDER to "o".
Evgeniy Stepanov [Tue, 4 Apr 2017 22:35:16 +0000 (22:35 +0000)]
Change section flag character for SHF_LINK_ORDER to "o".

See matching MC change in https://reviews.llvm.org/D31554.

llvm-svn: 299480

7 years agoChange section flag character for SHF_LINK_ORDER to "o".
Evgeniy Stepanov [Tue, 4 Apr 2017 22:35:08 +0000 (22:35 +0000)]
Change section flag character for SHF_LINK_ORDER to "o".

GAS uses "m" as a compatibility alias for "M" (SHF_MERGE).

"o" is free, except on ia64, where it already means SHF_LINK_ORDER.

llvm-svn: 299479

7 years agoAvoid calling basename to compute xdynamiclib_namespec.
Rafael Espindola [Tue, 4 Apr 2017 22:33:02 +0000 (22:33 +0000)]
Avoid calling basename to compute xdynamiclib_namespec.

This also exposes a xdynamiclib_filename that can be used to simplify
a few tests.

llvm-svn: 299478

7 years ago[InstCombine] Add test cases for various add/subtracts of constants(scalar, splat...
Craig Topper [Tue, 4 Apr 2017 22:22:30 +0000 (22:22 +0000)]
[InstCombine] Add test cases for various add/subtracts of constants(scalar, splat, and vector) with phis and selects. Improvements coming in a future commit.

llvm-svn: 299476

7 years ago[lit] Add a minimum export implementation.
Rafael Espindola [Tue, 4 Apr 2017 22:20:18 +0000 (22:20 +0000)]
[lit] Add a minimum export implementation.

llvm-svn: 299475

7 years ago[InstCombine] rename variable for easier reading; NFC
Sanjay Patel [Tue, 4 Apr 2017 22:06:03 +0000 (22:06 +0000)]
[InstCombine] rename variable for easier reading; NFC

We usually give constants a 'C' somewhere in the name...

llvm-svn: 299474

7 years ago[Driver] Add option to print the resource directory
Meador Inge [Tue, 4 Apr 2017 21:46:50 +0000 (21:46 +0000)]
[Driver] Add option to print the resource directory

This patch adds the option -print-resource-dir. It simply
prints the resource directory. This information will eventually
be used in compiler-rt to setup COMPILER_RT_LIBRARY_INSTALL_DIR.

Patch by Catherine Moore!

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

llvm-svn: 299473

7 years ago[InstCombine] Turn subtract of vectors of i1 into xor like we do for scalar i1. Match...
Craig Topper [Tue, 4 Apr 2017 21:44:56 +0000 (21:44 +0000)]
[InstCombine] Turn subtract of vectors of i1 into xor like we do for scalar i1. Matches what we already do for add.

llvm-svn: 299472

7 years agoDon't remove the cwd.
Rafael Espindola [Tue, 4 Apr 2017 21:42:59 +0000 (21:42 +0000)]
Don't remove the cwd.

This works with a regular shell since the kernel can keep track of a
deleted cwd. Since we just keep a path string, the following
subprocess invocations fail.

I think this would also fail on windows.

llvm-svn: 299471

7 years agoAdd #pragma clang fp
Adam Nemet [Tue, 4 Apr 2017 21:18:36 +0000 (21:18 +0000)]
Add #pragma clang fp

This adds the new pragma and the first variant, contract(on/off/fast).

The pragma has the same block scope rules as STDC FP_CONTRACT, i.e. it can be
placed at the beginning of a compound statement or at file scope.

Similarly to STDC FP_CONTRACT there is no need to use attributes.  First an
annotate token is inserted with the parsed details of the pragma.  Then the
annotate token is parsed in the proper contexts and the Sema is updated with
the corresponding FPOptions using the shared ActOn function with STDC
FP_CONTRACT.

After this the FPOptions from the Sema is propagated into the AST expression
nodes.  There is no change here.

I was going to add a 'default' option besides 'on/off/fast' similar to STDC
FP_CONTRACT but then decided against it. I think that we'd have to make option
uppercase then to avoid using 'default' the keyword.  Also because of the
scoped activation of pragma I am not sure there is really a need a for this.

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

llvm-svn: 299470

7 years agoSet FMF for -ffp-contract=fast
Adam Nemet [Tue, 4 Apr 2017 21:18:30 +0000 (21:18 +0000)]
Set FMF for -ffp-contract=fast

With this, FMF(contract) becomes an alternative way to express the request to
contract.

These are currently only propagated for FMul, FAdd and FSub.  The rest will be
added as more FMFs are hooked up for this.

This is toward fixing PR25721.

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

llvm-svn: 299469

7 years ago[AArch64] Add missing schedinfo, check completeness for Falkor.
Balaram Makam [Tue, 4 Apr 2017 21:15:53 +0000 (21:15 +0000)]
[AArch64] Add missing schedinfo, check completeness for Falkor.

llvm-svn: 299468

7 years ago[ExecutionDepsFix] Don't revisit true dependencies
Keno Fischer [Tue, 4 Apr 2017 20:30:47 +0000 (20:30 +0000)]
[ExecutionDepsFix] Don't revisit true dependencies

If an instruction has a true dependency, it makes sense for to use that
register for any undef read operands in the same instruction (we'll have
to wait for that register to become available anyway). This logic
was already implemented. However, the code would then still try to
revisit that instruction and break the dependency (and always fail,
since by definition a true dependency has to be live before the
instruction). Avoid revisiting such instructions as a performance
optimization. No functional change.

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

llvm-svn: 299467

7 years ago[InstCombine] Support folding and/or/xor with a constant vector RHS into selects...
Craig Topper [Tue, 4 Apr 2017 20:26:25 +0000 (20:26 +0000)]
[InstCombine] Support folding and/or/xor with a constant vector RHS into selects and phis

Currently we only fold with ConstantInt RHS. This generalizes to any Constant RHS.

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

llvm-svn: 299466

7 years ago[clang-format] fix crash in NamespaceEndCommentsFixer (PR32438)
Matthias Gehre [Tue, 4 Apr 2017 20:11:13 +0000 (20:11 +0000)]
[clang-format] fix crash in NamespaceEndCommentsFixer (PR32438)

Summary:
The new test case was crashing before. Now it passes
as expected.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 299465

7 years agoDon't resolve hidden undef to a DSO.
Rafael Espindola [Tue, 4 Apr 2017 20:03:34 +0000 (20:03 +0000)]
Don't resolve hidden undef to a DSO.

The ELF spec says:

all of the non-default visibility attributes, when applied to a symbol
reference, imply that a definition to satisfy that reference must be
provided within the current executable or shared object.

But we were trying to resolve those undef references to shared
symbols. That causes odd results like creating a got entry with
a relocation pointing to 0.

llvm-svn: 299464

7 years ago[analyzer] Add new Z3 constraint manager backend
Dominic Chen [Tue, 4 Apr 2017 19:52:25 +0000 (19:52 +0000)]
[analyzer] Add new Z3 constraint manager backend

Summary: Implement new Z3 constraint manager backend.

Reviewers: zaks.anna, dcoughlin, NoQ, xazax.hun

Subscribers: mgorny, cfe-commits

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

llvm-svn: 299463

7 years ago[AArch64][Fuchsia] Allow -mcmodel=kernel for --target=aarch64-fuchsia
Petr Hosek [Tue, 4 Apr 2017 19:51:53 +0000 (19:51 +0000)]
[AArch64][Fuchsia] Allow -mcmodel=kernel for --target=aarch64-fuchsia

This mode is just like -mcmodel=small except that it moves the
thread pointer from TPIDR_EL0 to TPIDR_EL1.

Patch by Roland McGrath.

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

llvm-svn: 299462

7 years ago[clangd] Link against clangSema
Jonas Devlieghere [Tue, 4 Apr 2017 19:42:29 +0000 (19:42 +0000)]
[clangd] Link against clangSema

Fixes linking issue introduced by rL299421 when building LLVM with
shared libraries.

llvm-svn: 299461

7 years ago[InstCombine] Add test cases for missing combines of phis with and/or/xor with consta...
Craig Topper [Tue, 4 Apr 2017 19:31:21 +0000 (19:31 +0000)]
[InstCombine] Add test cases for missing combines of phis with and/or/xor with constant argument. NFC

llvm-svn: 299460

7 years ago[fixup][X86][inline-asm] Add support for MS 'EVEN' directive
Coby Tayree [Tue, 4 Apr 2017 19:20:21 +0000 (19:20 +0000)]
[fixup][X86][inline-asm] Add support for MS 'EVEN' directive

refining tested targets resolution, to amend failures caused by rL299454

llvm-svn: 299459

7 years agoImplement host CPU detection for AArch64
Yi Kong [Tue, 4 Apr 2017 19:06:04 +0000 (19:06 +0000)]
Implement host CPU detection for AArch64

This shares detection logic with ARM(32), since AArch64 capable CPUs may
also run in 32-bit system mode.

We observe weird /proc/cpuinfo output for MSM8992 and MSM8994, where
they report all CPU cores as one single model, depending on which CPU
core the kernel is running on. As a workaround, we hardcode the known
CPU part name for these SoCs.

For big.LITTLE systems, this patch would only return the part name of
the first core (usually the little core). Proper support will be added
in a follow-up change.

Differential Revision: D31675

llvm-svn: 299458

7 years agoVerifier: Check some amdgpu calling convention restrictions
Matt Arsenault [Tue, 4 Apr 2017 18:43:11 +0000 (18:43 +0000)]
Verifier: Check some amdgpu calling convention restrictions

llvm-svn: 299457

7 years ago[AArch64] Refine Falkor Machine Model - Part 2
Balaram Makam [Tue, 4 Apr 2017 18:42:14 +0000 (18:42 +0000)]
[AArch64] Refine Falkor Machine Model - Part 2

llvm-svn: 299456

7 years ago[X86][inline-asm] Add support for MS 'EVEN' directive
Coby Tayree [Tue, 4 Apr 2017 17:58:28 +0000 (17:58 +0000)]
[X86][inline-asm] Add support for MS 'EVEN' directive

MS assembly syntax provide us with the 'EVEN' directive as a synonymous to at&t '.even'.
This patch include the (small, simple) changes need to allow it.

llvm-side:
https://reviews.llvm.org/D27417

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

llvm-svn: 299454

7 years ago[X86][inline-asm] Add support for MS 'EVEN' directive
Coby Tayree [Tue, 4 Apr 2017 17:57:23 +0000 (17:57 +0000)]
[X86][inline-asm] Add support for MS 'EVEN' directive

MS assembly syntax provide us with the 'EVEN' directive as a synonymous to at&t '.even'.
This patch include the (small, simple) changes need to allow it.

Test is provided at the following (clang-side) review:
https://reviews.llvm.org/D27418

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

llvm-svn: 299453

7 years agoAvoid sub shell.
Rafael Espindola [Tue, 4 Apr 2017 17:49:45 +0000 (17:49 +0000)]
Avoid sub shell.

Another step in getting these tests to run with the integrated one.

llvm-svn: 299452

7 years agoTone down the "lldb types" log a bit.
Jim Ingham [Tue, 4 Apr 2017 17:48:21 +0000 (17:48 +0000)]
Tone down the "lldb types" log a bit.

Change the get shared class info function to only
dump its results to the inferior stdout when the
log is verbose.  This matches the lldb side of the
same process, which only logs what it found if the
log is on verbose.

llvm-svn: 299451

7 years ago[InstCombine] Add more test cases for missing combines of selects with and/or/xor...
Craig Topper [Tue, 4 Apr 2017 17:48:08 +0000 (17:48 +0000)]
[InstCombine] Add more test cases for missing combines of selects with and/or/xor with constant argument. NFC

llvm-svn: 299450

7 years ago[RuntimeDyld] Make RuntimeDyld honor the ProcessAllSections flag.
Lang Hames [Tue, 4 Apr 2017 17:03:49 +0000 (17:03 +0000)]
[RuntimeDyld] Make RuntimeDyld honor the ProcessAllSections flag.

When the ProcessAllSections flag (introduced in r204398) is set RuntimeDyld is
supposed to make a call to the client's memory manager for every section in each
object that is loaded. Due to some missing checks, this was not happening in all
cases. This patch adds the missing cases, and fixes the Orc unit test that
verifies correct behavior for ProcessAllSections (The unit test had been
silently bailing out due to an ordering issue: a change in the test order meant
that this unit-test was running before the native target was registered. This
issue has also been fixed in this patch).

This fixes <rdar://problem/22789965>

llvm-svn: 299449

7 years ago[x86] remove dead select-of-constants transform; NFCI
Sanjay Patel [Tue, 4 Apr 2017 16:54:58 +0000 (16:54 +0000)]
[x86] remove dead select-of-constants transform; NFCI

https://reviews.llvm.org/D30537 / https://reviews.llvm.org/rL296977 added these transforms
and other related transforms to the generic DAGCombiner (with a hook that x86 sets to true),
so these patterns should not exist by the time we reach the target-specific combiner hook.

llvm-svn: 299448

7 years ago[Bug 25404] Fix crash on typedef in OpenCL 2.0
Anastasia Stulova [Tue, 4 Apr 2017 16:50:46 +0000 (16:50 +0000)]
[Bug 25404] Fix crash on typedef in OpenCL 2.0

Fixed the assertion due to absence of source location for
implicitly defined types (using addImplicitTypedef()).
During Sema checks the source location is being expected
and therefore an assertion is triggered.

The change is not specific to OpenCL. But it is particularly
common for OpenCL types to be declared implicitly in Clang
to support the mode without the standard header.

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

llvm-svn: 299447

7 years ago[PGO] Memory intrinsic calls optimization based on profiled size
Rong Xu [Tue, 4 Apr 2017 16:42:20 +0000 (16:42 +0000)]
[PGO] Memory intrinsic calls optimization based on profiled size

This patch optimizes two memory intrinsic operations: memset and memcpy based
on the profiled size of the operation. The high level transformation is like:
  mem_op(..., size)
  ==>
  switch (size) {
    case s1:
       mem_op(..., s1);
       goto merge_bb;
    case s2:
       mem_op(..., s2);
       goto merge_bb;
    ...
    default:
       mem_op(..., size);
       goto merge_bb;
    }
  merge_bb:

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

llvm-svn: 299446

7 years agoPreserve vec3 type.
Jin-Gu Kang [Tue, 4 Apr 2017 16:40:25 +0000 (16:40 +0000)]
Preserve vec3 type.

Summary: Preserve vec3 type with CodeGen option.

Reviewers: Anastasia, bruno

Reviewed By: Anastasia

Subscribers: bruno, ahatanak, cfe-commits

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

llvm-svn: 299445

7 years agoAMDGPU: Remove legacy export intrinsic
Matt Arsenault [Tue, 4 Apr 2017 16:34:39 +0000 (16:34 +0000)]
AMDGPU: Remove legacy export intrinsic

llvm-svn: 299444

7 years agoAMDGPU: Remove legacy image intrinsics
Matt Arsenault [Tue, 4 Apr 2017 16:34:35 +0000 (16:34 +0000)]
AMDGPU: Remove legacy image intrinsics

llvm-svn: 299443

7 years agoFix problem with test.
Michael Zuckerman [Tue, 4 Apr 2017 15:44:06 +0000 (15:44 +0000)]
Fix problem with test.

llvm-svn: 299442

7 years ago[clangd] Fix completion test to not depend on the standard library
Krasimir Georgiev [Tue, 4 Apr 2017 15:08:42 +0000 (15:08 +0000)]
[clangd] Fix completion test to not depend on the standard library

llvm-svn: 299440

7 years ago[X86][MS-compatability]Allow named synonymous for MS-assembly operators
Coby Tayree [Tue, 4 Apr 2017 14:43:23 +0000 (14:43 +0000)]
[X86][MS-compatability]Allow named synonymous for MS-assembly operators

This patch enhances X86AsmParser's immediate expression parsing abilities, to include a named synonymous for selected binary/unary bitwise operators: {and,shl,shr,or,xor,not}, ultimately achieving better MS-compatability
MASM reference:
https://msdn.microsoft.com/en-us/library/94b6khh4.aspx

Differential Revision: D31277

llvm-svn: 299439

7 years agoStrip trailing whitespace
Simon Pilgrim [Tue, 4 Apr 2017 14:40:53 +0000 (14:40 +0000)]
Strip trailing whitespace

llvm-svn: 299438

7 years agoTest cancellation_for_sections.c expectedly fails on GCC
Olga Malysheva [Tue, 4 Apr 2017 14:39:52 +0000 (14:39 +0000)]
Test cancellation_for_sections.c expectedly fails on GCC

llvm-svn: 299437

7 years ago[globalisel][tablegen] Fix non-determinism introduced in r299430.
Daniel Sanders [Tue, 4 Apr 2017 14:27:06 +0000 (14:27 +0000)]
[globalisel][tablegen] Fix non-determinism introduced in r299430.

This should fix the last issue on llvm-clang-x86_64-expensive-checks-win.

llvm-svn: 299436

7 years agoFix exception address alignment test for EHABI
Asiri Rathnayake [Tue, 4 Apr 2017 14:03:54 +0000 (14:03 +0000)]
Fix exception address alignment test for EHABI

This test fails on ARM bare-metal targets because it assumes the Itanium ABI,
whereas EHABI requires the exception address to be 8-byte aligned.

I was a bit puzzled at first because this should've failed on the public
arm-linux builder too. I think the reason it passes there is because we don't
include libunwind headers in the include path when running the libcxxabi tests,
so the system unwind.h gets picked up.

Reviewers: rengolin, EricWF
Differential revision: https://reviews.llvm.org/D31178

llvm-svn: 299435

7 years agoReset cancellation status for 'parallel', 'sections' and 'for' constracts.
Olga Malysheva [Tue, 4 Apr 2017 13:56:50 +0000 (13:56 +0000)]
Reset cancellation status for 'parallel', 'sections' and 'for' constracts.

Without this fix cancellation status for parallel, sections and for persists
across construct boundaries.

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

llvm-svn: 299434

7 years ago[globalisel][tablegen] Try to make MSVC happy with r299430
Daniel Sanders [Tue, 4 Apr 2017 13:52:00 +0000 (13:52 +0000)]
[globalisel][tablegen] Try to make MSVC happy with r299430

Fix other cases of 'const StringRef' creeping back in at the same time.

This should fix the llvm-clang-x86_64-expensive-checks-win buildbot.

llvm-svn: 299433

7 years ago[X86][LLVM] Converting __mm{|256|512}_movm_epi{8|16|32|64} LLVMIR call into generic...
Michael Zuckerman [Tue, 4 Apr 2017 13:32:14 +0000 (13:32 +0000)]
[X86][LLVM] Converting __mm{|256|512}_movm_epi{8|16|32|64} LLVMIR call into generic intrinsics.

This patch is a part one of two reviews, one for the clang and the other for LLVM.
The patch deletes the back-end intrinsics and adds support for them in the auto upgrade.

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

llvm-svn: 299432

7 years ago[X86][Clang] Converting __mm{|256|512}_movm_epi{8|16|32|64} LLVMIR call into generic...
Michael Zuckerman [Tue, 4 Apr 2017 13:29:53 +0000 (13:29 +0000)]
[X86][Clang] Converting __mm{|256|512}_movm_epi{8|16|32|64} LLVMIR call into generic intrinsics.

This patch is a part two of two reviews, one for the clang and the other for LLVM.
In this patch, I covered the clang side, by introducing the intrinsic to the front end.
This is done by creating a generic replacement.

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

llvm-svn: 299431

7 years ago[tablegen][globalisel] Add support for nested instruction matching.
Daniel Sanders [Tue, 4 Apr 2017 13:25:23 +0000 (13:25 +0000)]
[tablegen][globalisel] Add support for nested instruction matching.

Summary:
Lift the restrictions that prevented the tree walking introduced in the
previous change and add support for patterns like:
  (G_ADD (G_MUL (G_SEXT $src1), (G_SEXT $src2)), $src3) -> SMADDWrrr $dst, $src1, $src2, $src3
Also adds support for G_SEXT and G_ZEXT to support these cases.

One particular aspect of this that I should draw attention to is that I've
tried to be overly conservative in determining the safety of matches that
involve non-adjacent instructions and multiple basic blocks. This is intended
to be used as a cheap initial check and we may add a more expensive check in
the future. The current rules are:
* Reject if any instruction may load/store (we'd need to check for intervening
  memory operations.
* Reject if any instruction has implicit operands.
* Reject if any instruction has unmodelled side-effects.
See isObviouslySafeToFold().

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

Reviewed By: ab

Subscribers: igorb, dberris, llvm-commits, kristof.beyls

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

llvm-svn: 299430

7 years ago[Polly] [DependenceInfo] change WAR, WAW generation to correct semantics
Siddharth Bhat [Tue, 4 Apr 2017 13:08:23 +0000 (13:08 +0000)]
[Polly] [DependenceInfo] change WAR, WAW generation to correct semantics

= Change of WAR, WAW generation: =

- `buildFlow(Sink, MustSource, MaySource, Sink)` treates any flow of the form
    `sink <- may source <- must source` as a *may* dependence.

- we used to call:
```lang=cpp, name=old-flow-call.cpp
Flow = buildFlow(MustWrite, MustWrite, Read, Schedule);
WAW = isl_union_flow_get_must_dependence(Flow);
WAR = isl_union_flow_get_may_dependence(Flow);
```

- This caused some WAW dependences to be treated as WAR dependences.
- Incorrect semantics.

- Now, we call WAR and WAW correctly.

== Correct WAW: ==
```lang=cpp, name=new-waw-call.cpp
   Flow = buildFlow(Write, MustWrite, MayWrite, Schedule);
   WAW = isl_union_flow_get_may_dependence(Flow);
   isl_union_flow_free(Flow);
```

== Correct WAR: ==
```lang=cpp, name=new-war-call.cpp
    Flow = buildFlow(Write, Read, MustaWrite, Schedule);
    WAR = isl_union_flow_get_must_dependence(Flow);
    isl_union_flow_free(Flow);
```

- We want the "shortest" WAR possible (exact dependences).
- We mark all the *must-writes* as may-source, reads as must-souce.
- Then, we ask for *must* dependence.
- This removes all the reads that flow through a *must-write*
  before reaching a sink.
- Note that we only block ealier writes with *must-writes*. This is
  intuitively correct, as we do not want may-writes to block
  must-writes.
- Leaves us with direct (R -> W).

- This affects reduction generation since RED is built using WAW and WAR.

= New StrictWAW for Reductions: =

- We used to call:
```lang=cpp,name=old-waw-war-call.cpp
      Flow = buildFlow(MustWrite, MustWrite, Read, Schedule);
      WAW = isl_union_flow_get_must_dependence(Flow);
      WAR = isl_union_flow_get_may_dependence(Flow);
```

- This *is* the right model of WAW we need for reductions, just not in general.
- Reductions need to track only *strict* WAW, without any interfering reductions.

= Explanation: Why the new WAR dependences in tests are correct: =

- We no longer set WAR = WAR - WAW
- Hence, we will have WAR dependences that were originally removed.
- These may look incorrect, but in fact make sense.

== Code: ==
```lang=llvm, name=new-war-dependence.ll
  ;    void manyreductions(long *A) {
  ;      for (long i = 0; i < 1024; i++)
  ;        for (long j = 0; j < 1024; j++)
  ; S0:          *A += 42;
  ;
  ;      for (long i = 0; i < 1024; i++)
  ;        for (long j = 0; j < 1024; j++)
  ; S1:          *A += 42;
  ;
```
=== WAR dependence: ===
  {  S0[1023, 1023] -> S1[0, 0] }

- Between `S0[1023, 1023]` and `S1[0, 0]`, we will have the dependences:

```lang=cpp, name=dependence-incorrect, counterexample
        S0[1023, 1023]:
    *-- tmp = *A (load0)--*
WAR 2   add = tmp + 42    |
    *-> *A = add (store0) |
                         WAR 1
        S1[0, 0]:         |
        tmp = *A (load1)  |
        add = tmp + 42    |
        A = add (store1)<-*
```

- One may assume that WAR2 *hides* WAR1 (since store0 happens before
  store1). However, within a statement, Polly has no idea about the
  ordering of loads and stores.

- Hence, according to Polly, the code may have looked like this:
```lang=cpp, name=dependence-correct
    S0[1023, 1023]:
    A = add (store0)
    tmp = A (load0) ---*
    add = A + 42       |
                     WAR 1
    S1[0, 0]:          |
    tmp = A (load1)    |
    add = A + 42       |
    A = add (store1) <-*
```

- So, Polly  generates (correct) WAR dependences. It does not make sense
  to remove these dependences, since they are correct with respect to
  Polly's model.

    Reviewers: grosser, Meinersbur

    tags: #polly

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

llvm-svn: 299429

7 years agoTest check-in, comment changed
Olga Malysheva [Tue, 4 Apr 2017 12:56:55 +0000 (12:56 +0000)]
Test check-in, comment changed

llvm-svn: 299428

7 years ago[mips] Deal with empty blocks in the mips hazard scheduler
Simon Dardis [Tue, 4 Apr 2017 11:28:53 +0000 (11:28 +0000)]
[mips] Deal with empty blocks in the mips hazard scheduler

This patch teaches the hazard scheduler how to handle empty blocks
when search for the next real instruction when dealing with forbidden
slots.

Reviewers: slthakur

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

llvm-svn: 299427

7 years ago[clangd] Remove private vector fields from completion test.
Krasimir Georgiev [Tue, 4 Apr 2017 10:42:22 +0000 (10:42 +0000)]
[clangd] Remove private vector fields from completion test.

llvm-svn: 299426

7 years ago[X86] Add 64 bit pattern matching for PSADBW
Oren Ben Simhon [Tue, 4 Apr 2017 10:23:18 +0000 (10:23 +0000)]
[X86] Add 64 bit pattern matching for PSADBW

PSADBW pattern currently supports the 32 bit IR pattern and only GLT (greather than) comparison.
The patch extends the pattern to catch also 64 bit IR pattern and includes all other comparison types (not only GLT).

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

llvm-svn: 299425

7 years agoFix formatting in LoopGenerators
Philip Pfaffe [Tue, 4 Apr 2017 10:22:17 +0000 (10:22 +0000)]
Fix formatting in LoopGenerators

llvm-svn: 299424

7 years ago[Polly][NewPM] Pull references to the legacy PM interface from utilities and helpers
Philip Pfaffe [Tue, 4 Apr 2017 10:01:53 +0000 (10:01 +0000)]
[Polly][NewPM] Pull references to the legacy PM interface from utilities and helpers

Summary:
A couple of the utilities used to analyze or build IR make explicit use of the legacy PM on their interface, to access analysis results. This patch removes the legacy PM from the interface, and just passes the required results directly.

This shouldn't introduce any function changes, although the API technically allowed to obtain two different analysis results before, one passed by reference and one through the PM. I don't believe that was ever intended, however.

Reviewers: grosser, Meinersbur

Reviewed By: grosser

Subscribers: nemanjai, pollydev, llvm-commits

Tags: #polly

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

llvm-svn: 299423

7 years agoFix windows buildbot error.
Haojian Wu [Tue, 4 Apr 2017 09:53:55 +0000 (09:53 +0000)]
Fix windows buildbot error.

llvm-svn: 299422

7 years ago[clangd] Add code completion support
Krasimir Georgiev [Tue, 4 Apr 2017 09:46:39 +0000 (09:46 +0000)]
[clangd] Add code completion support

Summary: Adds code completion support to clangd.

Reviewers: bkramer, malaperle-ericsson

Reviewed By: bkramer, malaperle-ericsson

Subscribers: stanionascu, malaperle-ericsson, cfe-commits

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

llvm-svn: 299421

7 years ago[ELF] Fail the link early if the map file path is invalid
James Henderson [Tue, 4 Apr 2017 09:42:24 +0000 (09:42 +0000)]
[ELF] Fail the link early if the map file path is invalid

As with the changes made in r297645, we do not want a potentially long link to
be run, if it will ultimately fail because the map file is not writable. This
change reuses the same functionality as the output file path check. See
https://reviews.llvm.org/D30449 for further justification and explanations.

Reviewers: ruiu

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

llvm-svn: 299420

7 years ago[clang-rename] Support renaming qualified symbol
Haojian Wu [Tue, 4 Apr 2017 09:30:06 +0000 (09:30 +0000)]
[clang-rename] Support renaming qualified symbol

Summary:
The patch adds a new feature for renaming qualified symbol references.
Unlike orginal clang-rename behavior, when renaming a qualified symbol to a new
qualified symbol (e.g "A::Foo" => "B::Bar"), this new rename behavior will
consider the prefix qualifiers of the symbol, and calculate the new prefix
qualifiers.  It aims to add as few additional qualifiers as possible.

As this is an early version (only supports renaming classes), I don't change
current clang-rename interfaces at the moment, and would like to keep its
(command-line tool) behavior. So I added new interfaces for the prototype.
In the long run, these interfaces should be unified.

No functionality changes in original clang-rename command-line tool.

This patch also contains a few bug fixes of clang-rename which are discovered by
the new unittest:

* fix a potential nullptr accessment when class declaration doesn't have definition.
* add USRs of nested declartaions in "getNamedDeclFor".

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: alexfh, cfe-commits, mgorny

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

llvm-svn: 299419

7 years ago[ELF] Rename ARM Thunks in anticipation of Range Thunks
Peter Smith [Tue, 4 Apr 2017 09:29:36 +0000 (09:29 +0000)]
[ELF] Rename ARM Thunks in anticipation of Range Thunks

The existing names for the ARM and Thumb Thunks highlight their current
use as interworking Thunks. These Thunks can also be used for range
extension Thunks where there is no state change. This change makes the name
more generic so it is suitable for range extension.

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

llvm-svn: 299418

7 years agoEnable lldm-mi commands -stack-list-locals -stack-list-variables and -var-create...
Ilia K [Tue, 4 Apr 2017 08:00:28 +0000 (08:00 +0000)]
Enable lldm-mi commands -stack-list-locals -stack-list-variables and -var-create to work only with variables in scope

Patch by ayuckhulk

Reviewers: abidh, lldb-commits, ki.stfu

Reviewed By: ki.stfu

Tags: #lldb

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

llvm-svn: 299417

7 years ago[X86] Remove some code that tries to disable HLE feature. This feature flag was remov...
Craig Topper [Tue, 4 Apr 2017 06:38:44 +0000 (06:38 +0000)]
[X86] Remove some code that tries to disable HLE feature. This feature flag was removed from the backend.

llvm-svn: 299416

7 years agoAlign all scalar numbers to LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR
Jonas Hahnfeld [Tue, 4 Apr 2017 06:02:32 +0000 (06:02 +0000)]
Align all scalar numbers to LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR

Otherwise, yamlize in YAMLTraits.h might be wrongly defined.
This makes some AMDGPU tests fail when LLVM_LINK_LLVM_DYLIB is set.

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

llvm-svn: 299415

7 years agoUses quote to include cxxabi.h to make sure the local one is included
Mehdi Amini [Tue, 4 Apr 2017 05:38:38 +0000 (05:38 +0000)]
Uses quote to include cxxabi.h to make sure the local one is included

llvm-svn: 299414

7 years ago[InstCombine] Use setAllBits in place of getAllOnesValue since we know the bitwidths...
Craig Topper [Tue, 4 Apr 2017 05:03:02 +0000 (05:03 +0000)]
[InstCombine] Use setAllBits in place of getAllOnesValue since we know the bitwidths are the same. NFCI

llvm-svn: 299413

7 years agoInstCombine: Use the InstSimplify hook for shufflevector
Zvi Rackover [Tue, 4 Apr 2017 04:47:57 +0000 (04:47 +0000)]
InstCombine: Use the InstSimplify hook for shufflevector

Summary: Start using the recently added InstSimplify hook for shuffles in the respective InstCombine visitor.

Reviewers: spatel, RKSimon, craig.topper, majnemer

Reviewed By: majnemer

Subscribers: majnemer, llvm-commits

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

llvm-svn: 299412

7 years agoFix more -Wshadow warnings introduced by recent Clang change
Eric Fiselier [Tue, 4 Apr 2017 02:54:27 +0000 (02:54 +0000)]
Fix more -Wshadow warnings introduced by recent Clang change

llvm-svn: 299411

7 years agoModules/builtins.m requires shell.
Galina Kistanova [Tue, 4 Apr 2017 02:50:40 +0000 (02:50 +0000)]
Modules/builtins.m requires shell.

llvm-svn: 299410

7 years agoSkip three test cases that are asserting on macosx as of r299199. A quick
Jason Molenda [Tue, 4 Apr 2017 01:09:20 +0000 (01:09 +0000)]
Skip three test cases that are asserting on macosx as of r299199.  A quick
look showed that the target's arch has no core / byte order and so when
AuxVector::AuxVector calls into a dataextractor and sets the byte size to 0,
it asserts.  e.g.

  m_arch = {
    m_triple = (Data = "x86_64--linux", Arch = x86_64, SubArch = NoSubArch, Vendor = UnknownVendor, OS = Linux, Environment = UnknownEnvironment, ObjectFormat = ELF)
    m_core = kCore_invalid
    m_byte_order = eByteOrderInvalid
    m_flags = 0x00000000
    m_distribution_id = <no value available>
  }

<rdar://problem/31380097>

llvm-svn: 299408

7 years agoWork around recent -Wshadow changes in Clang
Eric Fiselier [Tue, 4 Apr 2017 01:05:59 +0000 (01:05 +0000)]
Work around recent -Wshadow changes in Clang

llvm-svn: 299407

7 years ago[PDB] Save one type record copy
Reid Kleckner [Tue, 4 Apr 2017 00:56:34 +0000 (00:56 +0000)]
[PDB] Save one type record copy

Summary:
The TypeTableBuilder provides stable storage for type records. We don't
need to copy all of the bytes into a flat vector before adding it to the
TpiStreamBuilder.

This makes addTypeRecord take an ArrayRef<uint8_t> and a hash code to go
with it, which seems like a simplification.

Reviewers: ruiu, zturner, inglorion

Subscribers: llvm-commits

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

llvm-svn: 299406

7 years ago[codeview] Cope with unsorted streams in type merging
Reid Kleckner [Mon, 3 Apr 2017 23:58:15 +0000 (23:58 +0000)]
[codeview] Cope with unsorted streams in type merging

Summary:
MASM can produce type streams that are not topologically sorted. It can
even produce type streams with circular references, but those are not
common in practice.

Reviewers: inglorion, ruiu

Subscribers: llvm-commits

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

llvm-svn: 299403

7 years agoAdd CPlusPlusNameParser to the xcodeproj
Sean Callanan [Mon, 3 Apr 2017 23:56:41 +0000 (23:56 +0000)]
Add CPlusPlusNameParser to the xcodeproj

llvm-svn: 299402

7 years agoFix C++17 dylib build
Eric Fiselier [Mon, 3 Apr 2017 23:23:44 +0000 (23:23 +0000)]
Fix C++17 dylib build

llvm-svn: 299401

7 years ago[Fuzzer] Flush std::cout before aborting in CxxStringEqTest
Reid Kleckner [Mon, 3 Apr 2017 23:00:25 +0000 (23:00 +0000)]
[Fuzzer] Flush std::cout before aborting in CxxStringEqTest

On Windows, abort() does not appear to flush std::cout. Should fix red
sanitizer-windows bot.

llvm-svn: 299398

7 years agoRecommit r299321 '[X86] Add __extension__ to f16c macro intrinsics to suppress warnin...
Craig Topper [Mon, 3 Apr 2017 22:59:30 +0000 (22:59 +0000)]
Recommit r299321 '[X86] Add __extension__ to f16c macro intrinsics to suppress warnings about compound literals when compiled for with earlier language standards enabled.'

The bot didn't recover after the revert. So it looks like this wasn't the issue.

llvm-svn: 299397

7 years agoadd/move codegen tests for and/or of setcc; NFC
Sanjay Patel [Mon, 3 Apr 2017 22:45:46 +0000 (22:45 +0000)]
add/move codegen tests for and/or of setcc; NFC

llvm-svn: 299396

7 years agoUpdate stale doxygen links in ProgrammersManual.rst
Tim Northover [Mon, 3 Apr 2017 22:24:32 +0000 (22:24 +0000)]
Update stale doxygen links in ProgrammersManual.rst

Patch by Wei-Ren Chen.

llvm-svn: 299395

7 years agoThe LIBLLDB_LOG_TEMPORARY channel got lost at some point where
Jason Molenda [Mon, 3 Apr 2017 22:23:01 +0000 (22:23 +0000)]
The LIBLLDB_LOG_TEMPORARY channel got lost at some point where
Logging.cpp was being changed in the past.  Re-add it.

llvm-svn: 299394

7 years agoInstSimplify: Add a hook for shufflevector
Zvi Rackover [Mon, 3 Apr 2017 22:05:30 +0000 (22:05 +0000)]
InstSimplify: Add a hook for shufflevector

Summary:
Add a hook for simplification of shufflevector's with the following rules:
- Constant folding - NFC, as it was already being done by the default handler.
-  If only one of the operands is constant, constant fold the shuffle if the
    mask does not select elements from the variable operand -  to show the hook is firing and affecting the test-cases.

Reviewers: RKSimon, craig.topper, spatel, sanjoy, nlopes, majnemer

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 299393

7 years agoReland r298901 with modifications (reverted in r298932)
Weiming Zhao [Mon, 3 Apr 2017 21:50:04 +0000 (21:50 +0000)]
Reland r298901 with modifications (reverted in r298932)

Dont emit Mapping symbols for sections that contain only data.

Summary:
Dont emit mapping symbols for sections that contain only data.

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

Reviewed By: t.p.northover

Patched by Shankar Easwaran <shankare@codeaurora.org>

Subscribers: alekseyshl, t.p.northover, llvm-commits

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

llvm-svn: 299392

7 years agoAMDGPU: Remove llvm.SI.vs.load.input
Matt Arsenault [Mon, 3 Apr 2017 21:45:13 +0000 (21:45 +0000)]
AMDGPU: Remove llvm.SI.vs.load.input

llvm-svn: 299391

7 years agoChange the error message format for an incompatible relocation.
Rui Ueyama [Mon, 3 Apr 2017 21:36:31 +0000 (21:36 +0000)]
Change the error message format for an incompatible relocation.

Previous error message style:

  error: /home/alice/src/bar.c:12: relocation R_X86_64_PLT32 cannot refer to absolute symbol 'answer' defined in /home/alice/src/foo.o

New error message style:

  error: relocation R_X86_64_PLT32 cannot refer to absolute symbol: foo
  >>> defined in /home/alice/src/foo.o
  >>> referenced by bar.c:12 (/home/alice/src/bar.c:12)
  >>>               /home/alice/src/bar.o:(.text+0x1)

llvm-svn: 299390

7 years agoDAG: Fix missing legalization for any_extend_vector_inreg operands
Matt Arsenault [Mon, 3 Apr 2017 21:28:13 +0000 (21:28 +0000)]
DAG: Fix missing legalization for any_extend_vector_inreg operands

llvm-svn: 299389

7 years ago[codeview] Add support for label type records
Reid Kleckner [Mon, 3 Apr 2017 21:25:20 +0000 (21:25 +0000)]
[codeview] Add support for label type records

MASM can produce these type records.

llvm-svn: 299388

7 years ago[X86][SSE]] Lower BUILD_VECTOR with repeated elts as BUILD_VECTOR + VECTOR_SHUFFLE
Simon Pilgrim [Mon, 3 Apr 2017 21:06:51 +0000 (21:06 +0000)]
[X86][SSE]] Lower BUILD_VECTOR with repeated elts as BUILD_VECTOR + VECTOR_SHUFFLE

It can be costly to transfer from the gprs to the xmm registers and can prevent loads merging.

This patch splits vXi16/vXi32/vXi64 BUILD_VECTORS that use the same operand in multiple elements into a BUILD_VECTOR with only a single insertion of each of those elements and then performs an unary shuffle to duplicate the values.

There are a couple of minor regressions this patch unearths due to some missing MOVDDUP/BROADCAST folds that I will address in a future patch.

Note: Now that vector shuffle lowering and combining is pretty good we should be reusing that instead of duplicating so much in LowerBUILD_VECTOR - this is the first of several patches to address this.

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

llvm-svn: 299387

7 years agoRevert r299355 "[ASTImporter] Fix for importing unnamed structs"
Gabor Horvath [Mon, 3 Apr 2017 21:06:45 +0000 (21:06 +0000)]
Revert r299355 "[ASTImporter] Fix for importing unnamed structs"

It breaks windows bots.

llvm-svn: 299386

7 years agosuppress GCC warning about noexcept functions changing mangling
Eric Fiselier [Mon, 3 Apr 2017 20:53:15 +0000 (20:53 +0000)]
suppress GCC warning about noexcept functions changing mangling

llvm-svn: 299385

7 years ago[InstCombine] Remove canonicalization for (X & C1) | C2 --> (X | C2) & (C1|C2) when...
Craig Topper [Mon, 3 Apr 2017 20:41:47 +0000 (20:41 +0000)]
[InstCombine] Remove canonicalization for (X & C1) | C2 --> (X | C2) & (C1|C2) when C1 & C2 have common bits.

It turns out that SimplifyDemandedInstructionBits will get called earlier and remove bits from C1 first. Effectively doing (X & (C1&C2)) | C2. So by the time it got to this check there could be no common bits.

I think the DAGCombiner has the same check but its check can be executed because it handles demanded bits later. I'll look at it next.

llvm-svn: 299384

7 years agox86 interrupt calling convention: re-align stack pointer on 64-bit if an error code...
Amjad Aboud [Mon, 3 Apr 2017 20:28:45 +0000 (20:28 +0000)]
x86 interrupt calling convention: re-align stack pointer on 64-bit if an error code was pushed

The x86_64 ABI requires that the stack is 16 byte aligned on function calls. Thus, the 8-byte error code, which is pushed by the CPU for certain exceptions, leads to a misaligned stack. This results in bugs such as Bug 26413, where misaligned movaps instructions are generated.

This commit fixes the misalignment by adjusting the stack pointer in these cases. The adjustment is done at the beginning of the prologue generation by subtracting another 8 bytes from the stack pointer. These additional bytes are popped again in the function epilogue.

Fixes Bug 26413

Patch by Philipp Oppermann.

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

llvm-svn: 299383

7 years agoRevert r299321 '[X86] Add __extension__ to f16c macro intrinsics to suppress warnings...
Craig Topper [Mon, 3 Apr 2017 19:43:47 +0000 (19:43 +0000)]
Revert r299321 '[X86] Add __extension__ to f16c macro intrinsics to suppress warnings about compound literals when compiled for with earlier language standards enabled.' to see if recovers a fuzzer bot.

llvm-svn: 299382

7 years agoTry to trigger the new docs builder. NFC
Jonathan Roelofs [Mon, 3 Apr 2017 19:23:11 +0000 (19:23 +0000)]
Try to trigger the new docs builder. NFC

llvm-svn: 299381

7 years ago[coroutines] Fix rebuilding of implicit and dependent coroutine statements.
Eric Fiselier [Mon, 3 Apr 2017 19:21:00 +0000 (19:21 +0000)]
[coroutines] Fix rebuilding of implicit and dependent coroutine statements.

Summary:
Certain implicitly generated coroutine statements, such as the calls to 'return_value()' or `return_void()` or `get_return_object_on_allocation_failure()`, cannot be built until the promise type is no longer dependent. This means they are not built until after the coroutine body statement has been transformed.

This patch fixes an issue where these statements would never be built for coroutine templates.

It also fixes a small issue where diagnostics about `get_return_object_on_allocation_failure()` were incorrectly suppressed.

Reviewers: rsmith, majnemer, GorNishanov, aaron.ballman

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

llvm-svn: 299380

7 years ago[CodeGenPrep] move aarch64-type-promotion to CGP
Jun Bum Lim [Mon, 3 Apr 2017 19:20:07 +0000 (19:20 +0000)]
[CodeGenPrep] move aarch64-type-promotion to CGP

Summary:
Move the aarch64-type-promotion pass within the existing type promotion framework in CGP.
This change also support forking sexts when a new sext is required for promotion.
Note that change is based on D27853 and I am submitting this out early to provide a better idea on D27853.

Reviewers: jmolloy, mcrosier, javed.absar, qcolombet

Reviewed By: qcolombet

Subscribers: llvm-commits, aemerson, rengolin, mcrosier

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

llvm-svn: 299379

7 years ago[DAGCombine][InstCombine] Fix inverted if condition in equivalent comments in DAGComb...
Craig Topper [Mon, 3 Apr 2017 19:18:48 +0000 (19:18 +0000)]
[DAGCombine][InstCombine] Fix inverted if condition in equivalent comments in DAGCombine and InstCombine. NFC

llvm-svn: 299378

7 years agoMake a helper function file-local.
Rui Ueyama [Mon, 3 Apr 2017 19:14:35 +0000 (19:14 +0000)]
Make a helper function file-local.

llvm-svn: 299377