platform/upstream/llvm.git
7 years ago[coroutines] Store an address of destroy OR cleanup part in the coroutine frame.
Gor Nishanov [Sat, 8 Oct 2016 00:22:50 +0000 (00:22 +0000)]
[coroutines] Store an address of destroy OR cleanup part in the coroutine frame.

Summary:
If heap allocation of a coroutine is elided, we need to make sure that we will update an address stored in the coroutine frame from f.destroy to f.cleanup.
Before this change, CoroSplit synthesized these stores after coro.begin:

```
    store void (%f.Frame*)* @f.resume, void (%f.Frame*)** %resume.addr
    store void (%f.Frame*)* @f.destroy, void (%f.Frame*)** %destroy.addr

```

In those cases where we did heap elision, but were not able to devirtualize all indirect calls, destroy call will attempt to "free" the coroutine frame stored on the stack. Oops.

Now we use select to put an appropriate coroutine subfunction in the destroy slot. As bellow:

```
    store void (%f.Frame*)* @f.resume, void (%f.Frame*)** %resume.addr
    %0 = select i1 %need.alloc, void (%f.Frame*)* @f.destroy, void (%f.Frame*)* @f.cleanup
    store void (%f.Frame*)* %0, void (%f.Frame*)** %destroy.addr
```

Reviewers: majnemer

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 283625

7 years ago[docs] Fix indentation bug in LangRef.
Lang Hames [Sat, 8 Oct 2016 00:20:42 +0000 (00:20 +0000)]
[docs] Fix indentation bug in LangRef.

llvm-svn: 283624

7 years ago[AVR] Add the assembly printer
Dylan McKay [Sat, 8 Oct 2016 00:02:36 +0000 (00:02 +0000)]
[AVR] Add the assembly printer

Summary: This adds the AVRAsmPrinter class.

Reviewers: arsenm, kparzysz

Subscribers: llvm-commits, wdng, beanz, japaric, mgorny

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

llvm-svn: 283623

7 years agoAMDGPU/SI: Handle div_fmas hazard in GCNHazardRecognizer
Tom Stellard [Fri, 7 Oct 2016 23:42:48 +0000 (23:42 +0000)]
AMDGPU/SI: Handle div_fmas hazard in GCNHazardRecognizer

Reviewers: arsenm

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

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

llvm-svn: 283622

7 years agoDisable alignment support of 0x4000 for Win32. https://reviews.llvm.org/D25053
Marshall Clow [Fri, 7 Oct 2016 23:19:04 +0000 (23:19 +0000)]
Disable alignment support of 0x4000 for Win32. https://reviews.llvm.org/D25053

llvm-svn: 283621

7 years agoFix PR30642 - libc++ leaks always-visible symbols into programs
Eric Fiselier [Fri, 7 Oct 2016 23:07:59 +0000 (23:07 +0000)]
Fix PR30642 -  libc++ leaks always-visible symbols into programs

This was caused by r281673, specifically changing `_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS`
from `__attribute__((__type_visibility__("default")))` to
`__attribute__((__visibility("default")))`.

I made that change because I thought the external instantiations needed
their members to have default visibility. However since libc++ never builds
with -fvisibility=hidden this appears not to be needed. Instead this change
caused previously hidden inline methods to become un-hidden, which is a regression.

This patch reverts the problematic change and fixes PR30642.

llvm-svn: 283620

7 years agoCodegen: Tail-duplicate during placement.
Kyle Butt [Fri, 7 Oct 2016 22:33:20 +0000 (22:33 +0000)]
Codegen: Tail-duplicate during placement.

The tail duplication pass uses an assumed layout when making duplication
decisions. This is fine, but passes up duplication opportunities that
may arise when blocks are outlined. Because we want the updated CFG to
affect subsequent placement decisions, this change must occur during
placement.

In order to achieve this goal, TailDuplicationPass is split into a
utility class, TailDuplicator, and the pass itself. The pass delegates
nearly everything to the TailDuplicator object, except for looping over
the blocks in a function. This allows the same code to be used for tail
duplication in both places.

This change, in concert with outlining optional branches, allows
triangle shaped code to perform much better, esepecially when the
taken/untaken branches are correlated, as it creates a second spine when
the tests are small enough.

Issue from previous rollback fixed, and a new test was added for that
case as well. Issue was worklist/scheduling/taildup issue in layout.

Issue from 2nd rollback fixed, with 2 additional tests. Issue was
tail merging/loop info/tail-duplication causing issue with loops that share
a header block.

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

llvm-svn: 283619

7 years agoFix shadow warnings. Patch from STL@microsoft.com
Eric Fiselier [Fri, 7 Oct 2016 22:10:35 +0000 (22:10 +0000)]
Fix shadow warnings. Patch from STL@microsoft.com

llvm-svn: 283618

7 years agoswifterror: Don't compute swifterror vregs during instruction selection
Arnold Schwaighofer [Fri, 7 Oct 2016 22:06:55 +0000 (22:06 +0000)]
swifterror: Don't compute swifterror vregs during instruction selection

The code used llvm basic block predecessors to decided where to insert phi
nodes. Instruction selection can and will liberally insert new machine basic
block predecessors. There is not a guaranteed one-to-one mapping from pred.
llvm basic blocks and machine basic blocks.

Therefore the current approach does not work as it assumes we can mark
predecessor machine basic block as needing a copy, and needs to know the set of
all predecessor machine basic blocks to decide when to insert phis.

Instead of computing the swifterror vregs as we select instructions, propagate
them at the end of instruction selection when the MBB CFG is complete.

When an instruction needs a swifterror vreg and we don't know the value yet,
generate a new vreg and remember this "upward exposed" use, and reconcile this
at the end of instruction selection.

This will only happen if the target supports promoting swifterror parameters to
registers and the swifterror attribute is used.

rdar://28300923

llvm-svn: 283617

7 years agoRename variable to not use C++ reserved name (leading underscore + capital) (NFC)
Mehdi Amini [Fri, 7 Oct 2016 22:03:03 +0000 (22:03 +0000)]
Rename variable to not use C++ reserved name (leading underscore + capital) (NFC)

llvm-svn: 283616

7 years agoFix MSVC build: requires namespace in front of StringRef (NFC)
Mehdi Amini [Fri, 7 Oct 2016 22:02:59 +0000 (22:02 +0000)]
Fix MSVC build: requires namespace in front of StringRef (NFC)

llvm-svn: 283615

7 years ago[DAG] clean up foldSelectOfConstants(); NFCI
Sanjay Patel [Fri, 7 Oct 2016 21:55:42 +0000 (21:55 +0000)]
[DAG] clean up foldSelectOfConstants(); NFCI

Rename variables, simplify logic.
Not clear yet why we don't handle a target with ZeroOrNegativeOneBooleanContent too.

llvm-svn: 283613

7 years ago[InstCombine] Don't unpack arrays that are too large (part 2).
Davide Italiano [Fri, 7 Oct 2016 21:53:09 +0000 (21:53 +0000)]
[InstCombine] Don't unpack arrays that are too large (part 2).

This is similar to r283599, but for store instructions.
Thanks to David for pointing out!

llvm-svn: 283612

7 years agoDriver: use StringRef instead of raw pointer in lookupTypeForExtension() (NFC)
Mehdi Amini [Fri, 7 Oct 2016 21:41:00 +0000 (21:41 +0000)]
Driver: use StringRef instead of raw pointer in lookupTypeForExtension() (NFC)

llvm-svn: 283611

7 years agoAdd missing include.
Zachary Turner [Fri, 7 Oct 2016 21:40:06 +0000 (21:40 +0000)]
Add missing include.

llvm-svn: 283610

7 years agoRefactor Symbol visitor code.
Zachary Turner [Fri, 7 Oct 2016 21:34:46 +0000 (21:34 +0000)]
Refactor Symbol visitor code.

Type visitor code had already been refactored previously to
decouple the visitor and the visitor callback interface.  This
was necessary for having the flexibility to visit in different
ways (for example, dumping to yaml, reading from yaml, dumping
to ScopedPrinter, etc).

This patch merely implements the same visitation pattern for
symbol records that has already been implemented for type records.

llvm-svn: 283609

7 years ago[cmake] Treat polly as "in tree" if LLVM_EXTERNAL_POLLY_SOURCE_DIR is provided
Hongbin Zheng [Fri, 7 Oct 2016 21:32:47 +0000 (21:32 +0000)]
[cmake] Treat polly as "in tree" if LLVM_EXTERNAL_POLLY_SOURCE_DIR is provided

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

llvm-svn: 283608

7 years agoFix a few warnings caught by clang.
Zachary Turner [Fri, 7 Oct 2016 21:32:16 +0000 (21:32 +0000)]
Fix a few warnings caught by clang.

llvm-svn: 283607

7 years agoFix various issues in std::any and the related tests.
Eric Fiselier [Fri, 7 Oct 2016 21:27:45 +0000 (21:27 +0000)]
Fix various issues in std::any and the related tests.

* Fix self-swap. Patch from Casey Carter.

* Remove workarounds and tests for types with deleted move constructors. This
  was originally added as part of a LWG proposed resolution that has since
  changed.

* Re-apply most recent PR for LWG 2769.

* Re-apply most recent PR for LWG 2754. Specifically fix the SFINAE checks to
  use the decayed type.

* Fix tests to allow moved-from std::any's to have a non-empty state. This is
  the behavior of MSVC's std::any.

* Various whitespace and test fixes.

llvm-svn: 283606

7 years agoTurn ArchName/BoundArch in Driver from raw pointer to StringRef (NFC)
Mehdi Amini [Fri, 7 Oct 2016 21:27:26 +0000 (21:27 +0000)]
Turn ArchName/BoundArch in Driver from raw pointer to StringRef (NFC)

llvm-svn: 283605

7 years agoRemove a stray dump().
Sean Callanan [Fri, 7 Oct 2016 21:25:29 +0000 (21:25 +0000)]
Remove a stray dump().

<rdar://problem/28635530>

llvm-svn: 283604

7 years agoRemove unused variable.
Zachary Turner [Fri, 7 Oct 2016 21:23:31 +0000 (21:23 +0000)]
Remove unused variable.

llvm-svn: 283603

7 years agoVisually align table def with respective enum. NFC
Douglas Katzman [Fri, 7 Oct 2016 21:02:38 +0000 (21:02 +0000)]
Visually align table def with respective enum. NFC

'warn_attribute_wrong_decl_type' has to stay in sync with
'enum AttributeDeclKind' which is much easier when they line up.

llvm-svn: 283601

7 years agoDefine PATH_MAX on windows
Hongbin Zheng [Fri, 7 Oct 2016 20:58:20 +0000 (20:58 +0000)]
Define PATH_MAX on windows

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

llvm-svn: 283600

7 years ago[InstCombine] Don't unpack arrays that are too large
Davide Italiano [Fri, 7 Oct 2016 20:57:42 +0000 (20:57 +0000)]
[InstCombine] Don't unpack arrays that are too large

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

llvm-svn: 283599

7 years ago[esan] Fix ESan test failure on Debian Sid bot
Qin Zhao [Fri, 7 Oct 2016 20:53:35 +0000 (20:53 +0000)]
[esan] Fix ESan test failure on Debian Sid bot

Summary: Increase early allocation buffer size.

Reviewers: bruening

Subscribers: kubabrecka

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

llvm-svn: 283598

7 years ago[DAG] move fold (select C, 0, 1 -> xor C, 1) to a helper function; NFC
Sanjay Patel [Fri, 7 Oct 2016 20:47:51 +0000 (20:47 +0000)]
[DAG] move fold (select C, 0, 1 -> xor C, 1) to a helper function; NFC

We're missing at least 3 other similar folds based on what we have in InstCombine.

llvm-svn: 283596

7 years agoAMDGPU/SI: Add support for 8-byte relocations
Tom Stellard [Fri, 7 Oct 2016 20:36:58 +0000 (20:36 +0000)]
AMDGPU/SI: Add support for 8-byte relocations

Reviewers: arsenm, kzhuravl

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

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

llvm-svn: 283593

7 years ago[RS4GC] Strengthen coverage: add more tests
Anna Thomas [Fri, 7 Oct 2016 20:34:00 +0000 (20:34 +0000)]
[RS4GC] Strengthen coverage: add more tests

Summary: Add tests for cases where we have zero coverage in RS4GC.

Reviewers: sanjoy, reames

Subscribers: llvm-commits

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

llvm-svn: 283591

7 years agoRevert r283572 - [Driver] Make -print-libgcc-file-name print compiler-rt lib when...
Michal Gorny [Fri, 7 Oct 2016 20:04:00 +0000 (20:04 +0000)]
Revert r283572 - [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

Revert the -print-libgcc-file-name change as the new test fails
on Darwin. It needs to be updated to run the libgcc part only on systems
supporting that rtlib.

llvm-svn: 283586

7 years agoImprove comments.
Rui Ueyama [Fri, 7 Oct 2016 19:54:57 +0000 (19:54 +0000)]
Improve comments.

Also use uint64_t instead of uintX_t so that you don't have to
think about two different cases to verify that the code is correct.

llvm-svn: 283585

7 years ago[analyzer] Re-apply r283092, attempt no.4, chunk no.4 (last)
Artem Dergachev [Fri, 7 Oct 2016 19:25:10 +0000 (19:25 +0000)]
[analyzer] Re-apply r283092, attempt no.4, chunk no.4 (last)

The problem that caused the msvc crash has been indentified and fixed
in the previous commit. This patch contains the rest of r283092.

llvm-svn: 283584

7 years agoSilence Warning. NFC.
Nirav Dave [Fri, 7 Oct 2016 19:11:33 +0000 (19:11 +0000)]
Silence Warning. NFC.

llvm-svn: 283583

7 years ago[Hexagon][NFC] Using documented instruction type name V4LDST instead of MEMOP.
Colin LeMahieu [Fri, 7 Oct 2016 19:11:28 +0000 (19:11 +0000)]
[Hexagon][NFC] Using documented instruction type name V4LDST instead of MEMOP.

llvm-svn: 283582

7 years agoRecommit "Use StringRef in LTOModule implementation (NFC)""
Mehdi Amini [Fri, 7 Oct 2016 19:05:14 +0000 (19:05 +0000)]
Recommit "Use StringRef in LTOModule implementation (NFC)""

This reverts commit r283456 and reapply r282997, with explicitly
zeroing the struct member to workaround a bug in MSVC2013 with
zero-initialization: https://connect.microsoft.com/VisualStudio/feedback/details/802160

llvm-svn: 283581

7 years agoRemove MSVC workarounds. Patch from STL@microsoft.com
Eric Fiselier [Fri, 7 Oct 2016 18:51:33 +0000 (18:51 +0000)]
Remove MSVC workarounds. Patch from STL@microsoft.com

llvm-svn: 283580

7 years ago[LoopIdiomRecognize] Merge two if conditions into one. NFCI.
Davide Italiano [Fri, 7 Oct 2016 18:39:43 +0000 (18:39 +0000)]
[LoopIdiomRecognize] Merge two if conditions into one. NFCI.

llvm-svn: 283579

7 years agoThe PR that caused this test ot fail was fixed in July, removing the XFAIL.
Jim Ingham [Fri, 7 Oct 2016 18:15:11 +0000 (18:15 +0000)]
The PR that caused this test ot fail was fixed in July, removing the XFAIL.

llvm-svn: 283578

7 years agoCode cleanup for the runtime without monitor thread
Jonathan Peyton [Fri, 7 Oct 2016 18:12:19 +0000 (18:12 +0000)]
Code cleanup for the runtime without monitor thread

This change removes/disables unnecessary code when monitor thread is not used.

Patch by Hansang Bae

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

llvm-svn: 283577

7 years agoEnable omp_get_schedule() to return static steal type.
Jonathan Peyton [Fri, 7 Oct 2016 18:01:35 +0000 (18:01 +0000)]
Enable omp_get_schedule() to return static steal type.

As the code is now, calling omp_get_schedule() when OMP_SCHEDULE=static_steal
will cause an assert.

llvm-svn: 283576

7 years ago[InstCombine] fold select X, (ext X), C
Sanjay Patel [Fri, 7 Oct 2016 17:53:07 +0000 (17:53 +0000)]
[InstCombine] fold select X, (ext X), C

If we're going to canonicalize IR towards select of constants, try harder to create those.
Also, don't lose the metadata.

This is actually 4 related transforms in one patch:
      // select X, (sext X), C --> select X, -1, C
      // select X, (zext X), C --> select X,  1, C
      // select X, C, (sext X) --> select X, C, 0
      // select X, C, (zext X) --> select X, C, 0

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

llvm-svn: 283575

7 years ago[analyzer] Re-apply r283092, attempt no.4, chunk no.3, fixup 1.
Artem Dergachev [Fri, 7 Oct 2016 17:24:06 +0000 (17:24 +0000)]
[analyzer] Re-apply r283092, attempt no.4, chunk no.3, fixup 1.

Remove the brace default initializer to see if this is what's causing
the msvc crash.

llvm-svn: 283574

7 years ago[analyzer] Re-apply r283092, attempt no.4, chunk no.3.
Artem Dergachev [Fri, 7 Oct 2016 17:12:05 +0000 (17:12 +0000)]
[analyzer] Re-apply r283092, attempt no.4, chunk no.3.

This is the primary suspect for causing the msvc crash, now that vector of
smart pointers was proven to be safe. Probably the default {}-initializer
is the problem.

llvm-svn: 283573

7 years ago[Driver] Make -print-libgcc-file-name print compiler-rt lib when used
Michal Gorny [Fri, 7 Oct 2016 17:08:06 +0000 (17:08 +0000)]
[Driver] Make -print-libgcc-file-name print compiler-rt lib when used

Make the -print-libgcc-file-name option print an appropriate compiler
runtime library, that is libgcc.a if gcc runtime is used
and an appropriate compiler-rt library if that runtime is used.

The main use for this is to allow linking executables built with
-nodefaultlibs (e.g. to avoid linking to the standard C++ library) to
the compiler runtime library, e.g. using:

  clang++ ... -nodefaultlibs $(clang++ ... -print-libgcc-file-name)

in which case currently a program built like this linked to the gcc
runtime unconditionally. The patch fixes it to use compiler-rt libraries
instead when compiler-rt is the active runtime.

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

llvm-svn: 283572

7 years agoNew utility to visualize optimization records
Adam Nemet [Fri, 7 Oct 2016 17:06:34 +0000 (17:06 +0000)]
New utility to visualize optimization records

This is a new tool built on top of the new YAML ouput generated from
optimization remarks.  It produces HTML for easy navigation and
visualization.

The tool assumes that hotness information for the remarks is available
(the YAML file was produced with PGO).  It uses hotness to list the
remarks prioritized by the hotness on the index page.  Clicking the
source location of the remark in the list takes you the source where the
remarks are rendedered inline in the source.

For now, the tool is meant as prototype.

It's written in Python.  It uses PyYAML to parse the input.

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

llvm-svn: 283571

7 years agoAMDGPU/SI: Emit fixups for long branches
Tom Stellard [Fri, 7 Oct 2016 16:01:18 +0000 (16:01 +0000)]
AMDGPU/SI: Emit fixups for long branches

Reviewers: arsenm

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

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

llvm-svn: 283570

7 years ago[X86][SSE] Reapplied: Add vector fcopysign combine tests
Simon Pilgrim [Fri, 7 Oct 2016 16:00:59 +0000 (16:00 +0000)]
[X86][SSE] Reapplied: Add vector fcopysign combine tests

Now with better lowering and fix for PR30443

llvm-svn: 283569

7 years ago[analyzer] Re-apply r283092, attempt no.4, chunk no.2.
Artem Dergachev [Fri, 7 Oct 2016 15:55:18 +0000 (15:55 +0000)]
[analyzer] Re-apply r283092, attempt no.4, chunk no.2.

Define the list of pieces in BugReport class. This is half of the changes
in the BugReport class code, which is pointed to by the msvc crash message.

llvm-svn: 283568

7 years ago[AMDGPU][mc] Add support for buffer_load_dwordx3, buffer_store_dwordx3.
Artem Tamazov [Fri, 7 Oct 2016 15:53:16 +0000 (15:53 +0000)]
[AMDGPU][mc] Add support for buffer_load_dwordx3, buffer_store_dwordx3.

Partially fixes Bug 28232.
Lit tests added.

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

llvm-svn: 283567

7 years ago[analyzer] Re-apply r283092, attempt no.4, a small chunk.
Artem Dergachev [Fri, 7 Oct 2016 15:23:02 +0000 (15:23 +0000)]
[analyzer] Re-apply r283092, attempt no.4, a small chunk.

Define PathDiagnosticNotePiece. The next commit would be able to address the
BugReport class code that is pointed to by the msvc crash message.

llvm-svn: 283566

7 years agoInvoke add-discriminator at -g0 -fsample-profile
Dehao Chen [Fri, 7 Oct 2016 15:21:31 +0000 (15:21 +0000)]
Invoke add-discriminator at -g0 -fsample-profile

Summary: -fsample-profile needs discriminator, which will not be added if built with -g0. This patch makes sure the discriminator is added for sample-profile at -g0. A followup patch will be send out to update clang tests.

Reviewers: davidxl, dblaikie, echristo, dnovillo

Subscribers: mehdi_amini, probinson, llvm-commits

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

llvm-svn: 283565

7 years agoUpdate clang test to accomendate discriminator change in https://reviews.llvm.org...
Dehao Chen [Fri, 7 Oct 2016 15:21:29 +0000 (15:21 +0000)]
Update clang test to accomendate discriminator change in https://reviews.llvm.org/D25132

Summary: https://reviews.llvm.org/D25132 added discriminator even add -g0. This leads to test fail which is addressed in thie patch.

Reviewers: davidxl, dnovillo

Subscribers: llvm-commits

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

llvm-svn: 283564

7 years ago[LV] Don't mark multi-use branch conditions uniform
Matthew Simpson [Fri, 7 Oct 2016 15:20:13 +0000 (15:20 +0000)]
[LV] Don't mark multi-use branch conditions uniform

Previously, we marked the branch conditions of latch blocks uniform after
vectorization if they were instructions contained in the loop. However, if a
condition instruction has users other than the branch, it may not remain
uniform. This patch ensures the conditions we mark uniform are only used by the
branch. This should fix PR30627.

Reference: https://llvm.org/bugs/show_bug.cgi?id=30627
llvm-svn: 283563

7 years ago[ELF] - Fixed assert fail when symbol table has zero sh_info value.
George Rimar [Fri, 7 Oct 2016 15:16:27 +0000 (15:16 +0000)]
[ELF] - Fixed assert fail when symbol table has zero sh_info value.

When sh_info of sumbol table value was set to zero, lld was asserting.

Patch fixes the issue.

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

llvm-svn: 283562

7 years agoOnly track physical registers in LivePhysRegs
Krzysztof Parzyszek [Fri, 7 Oct 2016 14:50:49 +0000 (14:50 +0000)]
Only track physical registers in LivePhysRegs

llvm-svn: 283561

7 years ago[AMDGPU] Assembler: support v_mac_f32 DPP and SDWA. Move getNamedOperandIdx to AMDGPU...
Sam Kolton [Fri, 7 Oct 2016 14:46:06 +0000 (14:46 +0000)]
[AMDGPU] Assembler: support v_mac_f32 DPP and SDWA. Move getNamedOperandIdx to AMDGPUBaseInfo.h

Reviewers: artem.tamazov, tstellarAMD

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, tony-tye

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

llvm-svn: 283560

7 years ago[X86][SSE] Tidied up tests - use standard check prefixes
Simon Pilgrim [Fri, 7 Oct 2016 14:42:22 +0000 (14:42 +0000)]
[X86][SSE] Tidied up tests - use standard check prefixes

llvm-svn: 283559

7 years ago[AMDGPU] AMDGPUCodeGenPrepare: remove extra ';'
Konstantin Zhuravlyov [Fri, 7 Oct 2016 14:39:53 +0000 (14:39 +0000)]
[AMDGPU] AMDGPUCodeGenPrepare: remove extra ';'

llvm-svn: 283558

7 years ago[ValueTracking] Fix crash in GetPointerBaseWithConstantOffset()
Tom Stellard [Fri, 7 Oct 2016 14:23:29 +0000 (14:23 +0000)]
[ValueTracking] Fix crash in GetPointerBaseWithConstantOffset()

Summary:
While walking defs of pointer operands we were assuming that the pointer
size would remain constant.  This is not true, because addresspacecast
instructions may cast the pointer to an address space with a different
pointer width.

This partial reverts r282612, which was a more conservative solution
to this problem.

Reviewers: reames, sanjoy, apilipenko

Subscribers: wdng, llvm-commits

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

llvm-svn: 283557

7 years agoAdd () for clarity. NFC.
Rafael Espindola [Fri, 7 Oct 2016 14:23:28 +0000 (14:23 +0000)]
Add () for clarity. NFC.

llvm-svn: 283556

7 years ago[AMDGPU] Promote uniform (i1, i16] operations to i32
Konstantin Zhuravlyov [Fri, 7 Oct 2016 14:22:58 +0000 (14:22 +0000)]
[AMDGPU] Promote uniform (i1, i16] operations to i32

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

llvm-svn: 283555

7 years ago[analyzer] Don't merge different return nodes in ExplodedGraph
Daniel Marjamaki [Fri, 7 Oct 2016 14:21:08 +0000 (14:21 +0000)]
[analyzer] Don't merge different return nodes in ExplodedGraph

Returns when calling an inline function should not be merged in the ExplodedGraph unless they are same.

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

llvm-svn: 283554

7 years agoRevert "[clang-move] Support moving multiple classes in one run."
Renato Golin [Fri, 7 Oct 2016 13:58:10 +0000 (13:58 +0000)]
Revert "[clang-move] Support moving multiple classes in one run."

This reverts commit r283526 et al as it keeps randomly breaking bots, even after
the commit has gone, on other people's commit ranges.

Revert "[clang-move] Simplify lint tests" (r283545).
Revert "Fix buildbot error." (r283534).
Revert "Revert "fix buildbot error" since it is not right fix." (r283538).

llvm-svn: 283553

7 years agoRemove spurious non-printable character from source file.
Benjamin Kramer [Fri, 7 Oct 2016 13:46:38 +0000 (13:46 +0000)]
Remove spurious non-printable character from source file.

NFC.

llvm-svn: 283552

7 years ago[ARM]: add missing switch case for cortex-r52
Javed Absar [Fri, 7 Oct 2016 13:41:55 +0000 (13:41 +0000)]
[ARM]: add missing switch case for cortex-r52

Adds a missing switch case for handling cortex-r52
in init-subtarget-features.

llvm-svn: 283551

7 years ago[ARM] Reapply: Use __rt_div functions for divrem on Windows
Martin Storsjo [Fri, 7 Oct 2016 13:28:53 +0000 (13:28 +0000)]
[ARM] Reapply: Use __rt_div functions for divrem on Windows

Reapplying r283383 after revert in r283442. The additional fix
is a getting rid of a stray space in a function name, in the
refactoring part of the commit.

This avoids falling back to calling out to the GCC rem functions
(__moddi3, __umoddi3) when targeting Windows.

The __rt_div functions have flipped the two arguments compared
to the __aeabi_divmod functions. To match MSVC, we emit a
check for division by zero before actually calling the library
function (even if the library function itself also might do
the same check).

Not all calls to __rt_div functions for division are currently
merged with calls to the same function with the same parameters
for the remainder. This is more wasteful than a div + mls as before,
but avoids calls to __moddi3.

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

llvm-svn: 283550

7 years agoWdocumentation fix
Simon Pilgrim [Fri, 7 Oct 2016 13:25:41 +0000 (13:25 +0000)]
Wdocumentation fix

llvm-svn: 283549

7 years agoFix build failure on lldb-amd64-ninja-freebsd11 error caused by rL283474
Valentina Giusti [Fri, 7 Oct 2016 13:21:59 +0000 (13:21 +0000)]
Fix build failure on lldb-amd64-ninja-freebsd11 error caused by rL283474

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

llvm-svn: 283548

7 years ago[cmake] Unify disabling upstream project warnings.
Michael Kruse [Fri, 7 Oct 2016 12:38:32 +0000 (12:38 +0000)]
[cmake] Unify disabling upstream project warnings.

Handle MSVC, ISL and PPCG in one place. The only functional change is that
warnings are also disabled for MSVC compiling PPCG (Which currently fails
anyway).

llvm-svn: 283547

7 years ago[cmake] Move isl_test artifacts to Polly folder.
Michael Kruse [Fri, 7 Oct 2016 12:38:24 +0000 (12:38 +0000)]
[cmake] Move isl_test artifacts to Polly folder.

Folders in Visual Studio solutions help organize the build artifacts from all
LLVM projects. There is a folder to keep Polly-built files in.

llvm-svn: 283546

7 years ago[clang-move] Simplify lint tests
Haojian Wu [Fri, 7 Oct 2016 12:35:37 +0000 (12:35 +0000)]
[clang-move] Simplify lint tests

No need to use compilation database.

llvm-svn: 283545

7 years ago[ELF] - Check that section alignment is a power of 2.
George Rimar [Fri, 7 Oct 2016 12:27:45 +0000 (12:27 +0000)]
[ELF] - Check that section alignment is a power of 2.

I found that this check still may be useful in some cases.
At fact since we use uint32_t alignment, then maximum value
that is valid for us is 0x80000000. But some broken files,
for example file from testcase may have greater value.
Because of that offset calculation overflow and crash happens.

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

llvm-svn: 283544

7 years ago[ARM]: Add Cortex-R52 target
Javed Absar [Fri, 7 Oct 2016 12:08:41 +0000 (12:08 +0000)]
[ARM]: Add Cortex-R52 target

This patch adds Cortex-R52, the new ARM real-time processor.
Cortex-R52 implements the ARMv8-R architecture.

llvm-svn: 283543

7 years ago[ARM]: Add Cortex-R52 target to LLVM
Javed Absar [Fri, 7 Oct 2016 12:06:40 +0000 (12:06 +0000)]
[ARM]: Add Cortex-R52 target to LLVM

This patch adds Cortex-R52, the new ARM real-time processor, to LLVM.
Cortex-R52 implements the ARMv8-R architecture.

llvm-svn: 283542

7 years agoRevert "[analyzer] Re-apply r283092, attempt no.3, in small chunks this time."
Artem Dergachev [Fri, 7 Oct 2016 11:29:32 +0000 (11:29 +0000)]
Revert "[analyzer] Re-apply r283092, attempt no.3, in small chunks this time."

llvm-svn: 283541

7 years ago[analyzer] Re-apply r283092, attempt no.3, in small chunks this time.
Artem Dergachev [Fri, 7 Oct 2016 11:26:15 +0000 (11:26 +0000)]
[analyzer] Re-apply r283092, attempt no.3, in small chunks this time.

llvm-svn: 283540

7 years ago[X86][SSE] Update register class during MOVSD/MOVSS - BLENDPD/BLENDPS commutation
Simon Pilgrim [Fri, 7 Oct 2016 11:18:38 +0000 (11:18 +0000)]
[X86][SSE] Update register class during MOVSD/MOVSS - BLENDPD/BLENDPS commutation

MOVSD/MOVSS take a 128-bit register and a FR32/FR64 register input, the commutation code wasn't taking this into account leading to verification errors.

This patch inserts a vreg copy mi to ensure that the registers are correct.

Fix for PR30607

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

llvm-svn: 283539

7 years agoRevert "fix buildbot error" since it is not right fix.
Haojian Wu [Fri, 7 Oct 2016 10:59:03 +0000 (10:59 +0000)]
Revert "fix buildbot error" since it is not right fix.

llvm-svn: 283538

7 years agoRevert "[analyzer] Try to re-apply r283092 "Extend bug reports with extra notes"
Artem Dergachev [Fri, 7 Oct 2016 10:56:44 +0000 (10:56 +0000)]
Revert "[analyzer] Try to re-apply r283092 "Extend bug reports with extra notes"

Vector of smart pointers wasn't the thing that caused msvc crash.

llvm-svn: 283537

7 years ago[analyzer] Try to re-apply r283092 "Extend bug reports with extra notes"
Artem Dergachev [Fri, 7 Oct 2016 10:44:09 +0000 (10:44 +0000)]
[analyzer] Try to re-apply r283092 "Extend bug reports with extra notes"

Replace SmallVector<IntrusiveRefCntPtr> with a vector of plain pointers.
Would insignificantly increase memory usage.

llvm-svn: 283536

7 years ago[SLPVectorizer] Fix for PR25748: reduction vectorization after loop
Alexey Bataev [Fri, 7 Oct 2016 09:39:22 +0000 (09:39 +0000)]
[SLPVectorizer] Fix for PR25748: reduction vectorization after loop
unrolling.

The next code is not vectorized by the SLPVectorizer:
```
 int test(unsigned int *p) {
  int sum = 0;
  for (int i = 0; i < 8; i++)
    sum += p[i];
  return sum;
 }
```
During optimization this loop is fully unrolled and SLPVectorizer is
unable to vectorize it. Patch tries to fix this problem.

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

llvm-svn: 283535

7 years agoFix buildbot error.
Haojian Wu [Fri, 7 Oct 2016 09:23:28 +0000 (09:23 +0000)]
Fix buildbot error.

The error maybe caused by the mixed environment of the two lint tests.
Cleanup the environment before running each test.

llvm-svn: 283534

7 years ago[ELF] - Do not crash on invalid size of dynamic section.
George Rimar [Fri, 7 Oct 2016 09:01:04 +0000 (09:01 +0000)]
[ELF] - Do not crash on invalid size of dynamic section.

Previously if sh_size of dynamic section was broken,
lld may crash. Or even may not crash if used 32 bits host.
(then value may be truncated to 32 bits when doing pointer arithmetic
and could be just zero).
Patch fixes the issue.

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

llvm-svn: 283533

7 years ago[ELF] - Do not crash when unable to parse ELF object file.
George Rimar [Fri, 7 Oct 2016 08:51:57 +0000 (08:51 +0000)]
[ELF] - Do not crash when unable to parse ELF object file.

createELFObj() may call error(...), for example when file is too short.
In that case header is not set and following line lead to crash:

EMachine = ELFObj.getHeader()->e_machine;

Patch fixes the issue.

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

llvm-svn: 283532

7 years agoRecommit r282692: [libc++abi] Use fallback_malloc to allocate __cxa_eh_globals in...
Igor Kudrin [Fri, 7 Oct 2016 08:48:28 +0000 (08:48 +0000)]
Recommit r282692: [libc++abi] Use fallback_malloc to allocate __cxa_eh_globals in case of dynamic memory exhaustion.

Throwing an exception for the first time may lead to call calloc to
allocate memory for __cxa_eh_globals. If the memory pool is exhausted
at that moment, it results in abnormal termination of the program.

This patch addresses the issue by using fallback_malloc in that case.

In this revision, some restrictions were added into the test to not
run it in unsuitable environments.

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

llvm-svn: 283531

7 years ago[ARM] Don't convert switches to lookup tables of pointers with ROPI/RWPI
Oliver Stannard [Fri, 7 Oct 2016 08:48:24 +0000 (08:48 +0000)]
[ARM] Don't convert switches to lookup tables of pointers with ROPI/RWPI

With the ROPI and RWPI relocation models we can't always have pointers
to global data or functions in constant data, so don't try to convert switches
into lookup tables if any value in the lookup table would require a relocation.
We can still safely emit lookup tables of other values, such as simple
constants.

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

llvm-svn: 283530

7 years agoUse StringRef in ARMELFStreamer (NFC)
Mehdi Amini [Fri, 7 Oct 2016 08:48:07 +0000 (08:48 +0000)]
Use StringRef in ARMELFStreamer (NFC)

llvm-svn: 283529

7 years agoAMDGPU: Fix use-after-free in SIOptimizeExecMasking
Nicolai Haehnle [Fri, 7 Oct 2016 08:40:14 +0000 (08:40 +0000)]
AMDGPU: Fix use-after-free in SIOptimizeExecMasking

Summary:
There was a bug with sequences like

   s_mov_b64 s[0:1], exec
   s_and_b64 s[2:3]<def>, s[0:1], s[2:3]<kill>
   ...
   s_mov_b64_term exec, s[2:3]

because s[2:3] was defined and used in the same instruction, ending up with
SaveExecInst inside OtherUseInsts.

Note that the test case also exposes an unrelated bug.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98028

Reviewers: tstellarAMD, arsenm

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

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

llvm-svn: 283528

7 years agoUse StringReg in TargetParser APIs (NFC)
Mehdi Amini [Fri, 7 Oct 2016 08:37:29 +0000 (08:37 +0000)]
Use StringReg in TargetParser APIs (NFC)

llvm-svn: 283527

7 years ago[clang-move] Support moving multiple classes in one run.
Haojian Wu [Fri, 7 Oct 2016 08:29:20 +0000 (08:29 +0000)]
[clang-move] Support moving multiple classes in one run.

Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 283526

7 years agoRevert "Revert "Add a static_assert to enforce that parameters to llvm::format()...
Mehdi Amini [Fri, 7 Oct 2016 08:25:42 +0000 (08:25 +0000)]
Revert "Revert "Add a static_assert to enforce that parameters to llvm::format() are not totally unsafe""

This reverts commit r283510 and reapply r283509, with updates to
clang-tools-extra as well.

llvm-svn: 283525

7 years ago[X86] Fix patterns for VPMULLD and VPCMPEQQ to not require aligned loads.
Craig Topper [Fri, 7 Oct 2016 06:54:43 +0000 (06:54 +0000)]
[X86] Fix patterns for VPMULLD and VPCMPEQQ to not require aligned loads.

llvm-svn: 283524

7 years ago[X86] Remove unused PatFrags. NFC
Craig Topper [Fri, 7 Oct 2016 06:54:39 +0000 (06:54 +0000)]
[X86] Remove unused PatFrags. NFC

llvm-svn: 283523

7 years ago[AVR] Add the AVRMCInstLower class
Dylan McKay [Fri, 7 Oct 2016 06:13:09 +0000 (06:13 +0000)]
[AVR] Add the AVRMCInstLower class

Summary:
This class deals with the lowering of CodeGen `MachineInstr` objects to
MC `MCInst` objects.

Reviewers: kparzysz, arsenm

Subscribers: wdng, beanz, japaric, mgorny

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

llvm-svn: 283522

7 years agoAMDGPU: Change check prefix in test
Matt Arsenault [Fri, 7 Oct 2016 03:55:04 +0000 (03:55 +0000)]
AMDGPU: Change check prefix in test

llvm-svn: 283521

7 years ago[lit] Don't assume you'll find debugserver
Hal Finkel [Fri, 7 Oct 2016 02:26:41 +0000 (02:26 +0000)]
[lit] Don't assume you'll find debugserver

On Linux, there is no "debugserver" process, and the RUN-line substitution will
fail if you try to substitute '%debugserver' with None.

Fixes PR30492.

llvm-svn: 283520

7 years ago[llvm-opt-report] Left justify unrolling counts, etc.
Hal Finkel [Fri, 7 Oct 2016 02:01:03 +0000 (02:01 +0000)]
[llvm-opt-report] Left justify unrolling counts, etc.

In the left part of the reports, we have things like U<number>; if some of
these numbers use more digits than others, we don't want a space in between the
U and the start of the number. Instead, the space should come afterward. This
way it is clear that the number goes with the U and not any other optimization
indicator that might come later on the line.

Tests committed in r283518.

llvm-svn: 283519

7 years ago[llvm-opt-report] Left justify unrolling counts, etc.
Hal Finkel [Fri, 7 Oct 2016 01:57:06 +0000 (01:57 +0000)]
[llvm-opt-report] Left justify unrolling counts, etc.

In the left part of the reports, we have things like U<number>; if some of
these numbers use more digits than others, we don't want a space in between the
U and the start of the number. Instead, the space should come afterward. This
way it is clear that the number goes with the U and not any other optimization
indicator that might come later on the line.

llvm-svn: 283518

7 years ago[SimplifyCFG] Correctly test for unconditional branches in GetCaseResults
David Majnemer [Fri, 7 Oct 2016 01:38:35 +0000 (01:38 +0000)]
[SimplifyCFG] Correctly test for unconditional branches in GetCaseResults

GetCaseResults assumed that a terminator with one successor was an
unconditional branch.  This is not necessarily the case, it could be a
cleanupret.

Strengthen the check by querying whether or not the terminator is
exceptional.

llvm-svn: 283517

7 years ago[llvm-opt-report] Use -no-demangle to disable demangling
Hal Finkel [Fri, 7 Oct 2016 01:30:59 +0000 (01:30 +0000)]
[llvm-opt-report] Use -no-demangle to disable demangling

As this is intended to be a user-facing option, -no-demangle seems much better
than -demangle=0. Add testing for the option.

llvm-svn: 283516