OSDN Git Service

android-x86/external-llvm.git
8 years ago[IRCE] Be resilient in the face of non-simplified loops
Sanjoy Das [Sat, 13 Aug 2016 23:36:35 +0000 (23:36 +0000)]
[IRCE] Be resilient in the face of non-simplified loops

Loops containing `indirectbr` may not be in simplified form, even after
running LoopSimplify.  Reject then gracefully, instead of tripping an
assert.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278611 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix bitcode auto-upgrade when using bitcode lazy loading
Mehdi Amini [Sat, 13 Aug 2016 23:31:53 +0000 (23:31 +0000)]
Fix bitcode auto-upgrade when using bitcode lazy loading

The auto-upgrade path could be called before the VST (global
names) was fully parsed, and thus intrinsic names were not
available and the autoupgrade logic could not operate.

Fix link failures with ThinLTO.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278610 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert "Revert "Invariant start/end intrinsics overloaded for address space""
Mehdi Amini [Sat, 13 Aug 2016 23:31:24 +0000 (23:31 +0000)]
Revert "Revert "Invariant start/end intrinsics overloaded for address space""

This reverts commit 32fc6488e48eafc0ca1bac1bd9cbf0008224d530.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278609 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert "Invariant start/end intrinsics overloaded for address space"
Mehdi Amini [Sat, 13 Aug 2016 23:27:32 +0000 (23:27 +0000)]
Revert "Invariant start/end intrinsics overloaded for address space"

This reverts commit r276447.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278608 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[IRCE] Use dyn_cast instead of explicit isa/cast; NFC
Sanjoy Das [Sat, 13 Aug 2016 22:00:12 +0000 (22:00 +0000)]
[IRCE] Use dyn_cast instead of explicit isa/cast; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278607 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[IRCE] Use range-for; NFC
Sanjoy Das [Sat, 13 Aug 2016 22:00:09 +0000 (22:00 +0000)]
[IRCE] Use range-for; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278606 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[ADT] Add a reserve() method to DenseSet as well as an insert() for R-value
Mehdi Amini [Sat, 13 Aug 2016 20:42:19 +0000 (20:42 +0000)]
[ADT] Add a reserve() method to DenseSet as well as an insert() for R-value

Recommit 278600 with some fixes to make the test more robust.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278604 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert "[ADT] Add a reserve method to DenseSet as well as an insert() for R-value"
Mehdi Amini [Sat, 13 Aug 2016 20:14:39 +0000 (20:14 +0000)]
Revert "[ADT] Add a reserve method to DenseSet as well as an insert() for R-value"

This reverts commit r278600. The unittest does not pass on MSVC, there is
an extra move. Investigating how to make it more robust.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278603 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoLimit DenseMap::setNumEntries input to 1<<31, in accordance with the 31 bits allocate...
Yaron Keren [Sat, 13 Aug 2016 19:46:31 +0000 (19:46 +0000)]
Limit DenseMap::setNumEntries input to 1<<31, in accordance with the 31 bits allocated to NumEntries.
std::numeric_limits<int>::max() may be something else than 1<<31.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278602 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd missing REQUIRES in sancov/print_coverage_pcs.test: it requires aarch64 as well now
Mehdi Amini [Sat, 13 Aug 2016 19:44:02 +0000 (19:44 +0000)]
Add missing REQUIRES in sancov/print_coverage_pcs.test: it requires aarch64 as well now

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278601 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[ADT] Add a reserve method to DenseSet as well as an insert() for R-value
Mehdi Amini [Sat, 13 Aug 2016 19:40:13 +0000 (19:40 +0000)]
[ADT] Add a reserve method to DenseSet as well as an insert() for R-value

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278600 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[x86] add tests to show missed 64-bit immediate merging
Sanjay Patel [Sat, 13 Aug 2016 18:42:14 +0000 (18:42 +0000)]
[x86] add tests to show missed 64-bit immediate merging

Tests are slightly modified versions of those written by
Sunita Marathe in D23391.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278599 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoTest commit
Aditya Kumar [Sat, 13 Aug 2016 11:56:50 +0000 (11:56 +0000)]
Test commit

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278598 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[X86] Add a check of isCommutable at the top of X86InstrInfo::findCommutedOpIndices...
Craig Topper [Sat, 13 Aug 2016 06:48:44 +0000 (06:48 +0000)]
[X86] Add a check of isCommutable at the top of X86InstrInfo::findCommutedOpIndices. Most callers don't check if the instruction is commutable before calling.

This saves us the trouble of ending up in the default of the switch and having to determine if this is an FMA or not.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278597 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[AVX-512] Add isCommutable to scalar FMA3 instructions.
Craig Topper [Sat, 13 Aug 2016 06:48:41 +0000 (06:48 +0000)]
[AVX-512] Add isCommutable to scalar FMA3 instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278596 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[AVX-512] Add commutable flags to 132 form FMA3 instructions.
Craig Topper [Sat, 13 Aug 2016 06:48:39 +0000 (06:48 +0000)]
[AVX-512] Add commutable flags to 132 form FMA3 instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278595 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[X86] Remove patterns for (vzmovl (insert_subvector undef, (scalar_to_vector))) as...
Craig Topper [Sat, 13 Aug 2016 06:02:19 +0000 (06:02 +0000)]
[X86] Remove patterns for (vzmovl (insert_subvector undef, (scalar_to_vector))) as the (vzmovl VR256) pattern has higher priority. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278594 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[AVX-512] Remove an AddedComplexity that was prioritizing basic vzmovl patterns over...
Craig Topper [Sat, 13 Aug 2016 05:43:20 +0000 (05:43 +0000)]
[AVX-512] Remove an AddedComplexity that was prioritizing basic vzmovl patterns over more complex ones that produce better code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278593 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[AVX-512] Add patterns to support VZEXT_MOVL from 512-bit vectors with 64-bit and...
Craig Topper [Sat, 13 Aug 2016 05:33:12 +0000 (05:33 +0000)]
[AVX-512] Add patterns to support VZEXT_MOVL from 512-bit vectors with 64-bit and 32-bit elements.

Fixes PR28961.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278592 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PM] Port LoopDataPrefetch to new pass manager
Teresa Johnson [Sat, 13 Aug 2016 04:11:27 +0000 (04:11 +0000)]
[PM] Port LoopDataPrefetch to new pass manager

Summary:
Refactor the existing support into a LoopDataPrefetch implementation
class and a LoopDataPrefetchLegacyPass class that invokes it.
Add a new LoopDataPrefetchPass for the new pass manager that utilizes
the LoopDataPrefetch implementation class.

Reviewers: mehdi_amini

Subscribers: sanjoy, mzolotukhin, nemanjai, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278591 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAMDGPU: Fix not estimating MBB operand sizes correctly
Matt Arsenault [Sat, 13 Aug 2016 01:43:54 +0000 (01:43 +0000)]
AMDGPU: Fix not estimating MBB operand sizes correctly

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278590 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAMDGPU: Fix missing test for addressing mode with odd offsets
Matt Arsenault [Sat, 13 Aug 2016 01:43:51 +0000 (01:43 +0000)]
AMDGPU: Fix missing test for addressing mode with odd offsets

Add test if the constant offset looks unaligned.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278589 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAMDGPU/R600: Remove macros
Matt Arsenault [Sat, 13 Aug 2016 01:43:46 +0000 (01:43 +0000)]
AMDGPU/R600: Remove macros

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278588 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix more dereferenced end() iterators after r278532
Hans Wennborg [Sat, 13 Aug 2016 01:12:49 +0000 (01:12 +0000)]
Fix more dereferenced end() iterators after r278532

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278587 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoConstify ValueTracking. NFC.
Pete Cooper [Sat, 13 Aug 2016 01:05:32 +0000 (01:05 +0000)]
Constify ValueTracking.  NFC.

Almost all of the method here are only analysing Value's as opposed to
mutating them.  Mark all of the easy ones as const.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278585 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[IndVars] Ignore (s|z)exts that don't extend the induction variable
Sanjoy Das [Sat, 13 Aug 2016 00:58:31 +0000 (00:58 +0000)]
[IndVars] Ignore (s|z)exts that don't extend the induction variable

`IVVisitor::visitCast` used to have the invariant that if the
instruction it was passed was a sext or zext instruction, the result of
the instruction would be wider than the induction variable.  This is no
longer true after rL275037, so this change teaches `IndVarSimplify` s
implementation of `IVVisitor::visitCast` to work with the relaxed
invariant.

A corresponding change to SimplifyIndVar to preserve the said invariant
after rL275037 would also work, but given how `IVVisitor::visitCast` is
spelled (no indication of said invariant), I figured the current fix is
cleaner.

Fixes PR28935.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278584 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix some Clang-tidy modernize-use-using and Include What You Use warnings.
Eugene Zelenko [Sat, 13 Aug 2016 00:50:41 +0000 (00:50 +0000)]
Fix some Clang-tidy modernize-use-using and Include What You Use warnings.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278583 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[libFuzzer] mention one more trophie in LLVM
Kostya Serebryany [Sat, 13 Aug 2016 00:12:32 +0000 (00:12 +0000)]
[libFuzzer] mention one more trophie in LLVM

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278582 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[LSV] Use a set rather than an ArraySlice at the end of getVectorizablePrefix. NFC
Justin Lebar [Sat, 13 Aug 2016 00:04:12 +0000 (00:04 +0000)]
[LSV] Use a set rather than an ArraySlice at the end of getVectorizablePrefix. NFC

Summary: This avoids a small O(n^2) loop.

Reviewers: asbirlea

Subscribers: mzolotukhin, llvm-commits, arsenm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278581 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[LSV] Use OrderedBasicBlock instead of rolling it ourselves. NFC
Justin Lebar [Sat, 13 Aug 2016 00:04:08 +0000 (00:04 +0000)]
[LSV] Use OrderedBasicBlock instead of rolling it ourselves. NFC

Summary:
In getVectorizablePrefix, this is less efficient (because we have to
iterate over the BB twice), but boy is it simpler.  Given how much
trouble we've had here, I think the simplicity gain is worthwhile.

In reorder(), this is actually more efficient, as
DominatorTree::dominates iterates over the BB from the beginning when
the two instructions are in the same BB.

Reviewers: asbirlea

Subscribers: arsenm, llvm-commits, mzolotukhin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278580 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoMinor comment fix ("generate" --> "generates").
Justin Lebar [Fri, 12 Aug 2016 23:58:19 +0000 (23:58 +0000)]
Minor comment fix ("generate" --> "generates").

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278578 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoX86: Fix another dereferenced end() iterator after r278532
Hans Wennborg [Fri, 12 Aug 2016 23:35:59 +0000 (23:35 +0000)]
X86: Fix another dereferenced end() iterator after r278532

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278577 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[WebAssembly] Re-enable disabled debug value test
Dominic Chen [Fri, 12 Aug 2016 23:14:18 +0000 (23:14 +0000)]
[WebAssembly] Re-enable disabled debug value test

Summary:
This test was resulting in asan/valgrind failures due to undefined
DWARF register mappings for WebAssembly, and was disabled in r278495.
These have been resolved.

Reviewers: sunfish, dschuff

Subscribers: bkramer, llvm-commits, jfb

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278576 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoReapply [BranchFolding] Restrict tail merging loop blocks after MBP
Haicheng Wu [Fri, 12 Aug 2016 23:13:38 +0000 (23:13 +0000)]
Reapply [BranchFolding] Restrict tail merging loop blocks after MBP

Fixed a bug in the test case.

To fix PR28104, this patch restricts tail merging to blocks that belong to the
same loop after MBP.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278575 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAvoid accessing LLVM/DWARF register mappings if undefined
Dominic Chen [Fri, 12 Aug 2016 23:12:59 +0000 (23:12 +0000)]
Avoid accessing LLVM/DWARF register mappings if undefined

Summary:
If the backend does not define LLVM/DWARF register mappings, the associated
variables are undefined since the map initializer is called by auto-generated
TableGen routines. This patch initializes the pointers and sizes to nullptr
and zero, respectively, and checks that they are valid before searching
for a mapping.

Reviewers: grosbach, dschuff

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278574 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[LoopVectorize] Detect loops in the innermost loop before creating InnerLoopVectorizer
Tim Shen [Fri, 12 Aug 2016 22:47:13 +0000 (22:47 +0000)]
[LoopVectorize] Detect loops in the innermost loop before creating InnerLoopVectorizer

InnerLoopVectorizer shouldn't handle a loop with cycles inside the loop
body, even if that cycle isn't a natural loop.

Fixes PR28541.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278573 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoX86: Stop dereferencing end() in X86FrameLowering::emitEpilogue
Duncan P. N. Exon Smith [Fri, 12 Aug 2016 22:43:33 +0000 (22:43 +0000)]
X86: Stop dereferencing end() in X86FrameLowering::emitEpilogue

On a Windows build of Chromium, r278532 (up to r278539)
X86FrameLowering::emitEpilogue because it wasn't wary enough of the
return of MachineBasicBlock::getFirstTerminator.  Guard all the uses
here.

Note that r278532 *looks* like an NFC commit (just an API change), but
it removes a couple of layers of abstraction and is probably causing
optimization differences in MSVC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278572 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Inliner] Don't treat inalloca allocas as static
Reid Kleckner [Fri, 12 Aug 2016 22:23:04 +0000 (22:23 +0000)]
[Inliner] Don't treat inalloca allocas as static

They aren't static, and moving them to the entry block across something
else will only result in tears.

Root cause of http://crbug.com/636558.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278571 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd support to paternmatch for simple const Value cases.
Pete Cooper [Fri, 12 Aug 2016 22:16:05 +0000 (22:16 +0000)]
Add support to paternmatch for simple const Value cases.

Pattern match has some paths which can operate on constant instructions,
but not all.  This adds a version of m_value() to return const Value* and
changes ICmp matching to use auto so that it can match both constant and
mutable instructions.

Tests also included for both mutable and constant ICmpInst matching.

This will be used in a future commit to constify ValueTracking.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278570 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[ADT] Add filter_iterator for filtering elements
Tim Shen [Fri, 12 Aug 2016 22:03:28 +0000 (22:03 +0000)]
[ADT] Add filter_iterator for filtering elements

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278569 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[NVPTX] Use untyped (.b) integer registers in PTX.
Artem Belevich [Fri, 12 Aug 2016 22:02:19 +0000 (22:02 +0000)]
[NVPTX] Use untyped (.b) integer registers in PTX.

This bring LLVM-generated PTX closer to what nvcc generates and avoids
triggering issues in ptxas.

For instance, ptxas does not accept .s16 (or .u16) registers as operands
for .fp16 instructions.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278568 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agogold: add a cast to appease std::max NFC
Saleem Abdulrasool [Fri, 12 Aug 2016 21:56:12 +0000 (21:56 +0000)]
gold: add a cast to appease std::max NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278567 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PM] BitcodeWriterPass should derive from PassInfoMixin
Teresa Johnson [Fri, 12 Aug 2016 21:33:36 +0000 (21:33 +0000)]
[PM] BitcodeWriterPass should derive from PassInfoMixin

Summary:
The BitcodeWriterPass was ported a couple years ago, and predates the
PassInfoMixin. Make BitcodeWriterPass from that base class.

Should BitcodeWriterPass be added to the PassRegistry.def file? It seems
like that is only for passes that can be added arbitrarily, e.g. via the
-passes flag to the opt tool. Whereas the bitcode writer is added
specially based on the output type (and requires an output stream and
other parameters). For now I have left it out of the PassRegistry, but
let me know if it should go there.

Finally, I was considering an NFC change of the legacy WriteBitcodePass
to BitcodeWriterLegacyPass to make its usage clearer and more consistent
with other legacy passes. WDYT?

Reviewers: mehdi_amini

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278566 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFixed typo.
David L Kreitzer [Fri, 12 Aug 2016 21:06:53 +0000 (21:06 +0000)]
Fixed typo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278565 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Hexagon] Cleanup and standardize vector load/store pseudo instructions
Krzysztof Parzyszek [Fri, 12 Aug 2016 21:05:05 +0000 (21:05 +0000)]
[Hexagon] Cleanup and standardize vector load/store pseudo instructions

Remove the following single-vector load/store pseudo instructions, use real
instructions instead:
  LDriv_pseudo_V6         STriv_pseudo_V6
  LDriv_pseudo_V6_128B    STriv_pseudo_V6_128B
  LDrivv_indexed          STrivv_indexed
  LDrivv_indexed_128B     STrivv_indexed_128B

Rename the double-vector load/store pseudo instructions, add unaligned
counterparts:

  -- old --               -- new --            -- unaligned --
  LDrivv_pseudo_V6        PS_vloadrw_io        PS_vloadrwu_io
  LDrivv_pseudo_V6_128B   PS_vloadrw_io_128B   PS_vloadrwu_io_128B
  STrivv_pseudo_V6        PS_vstorerw_io       PS_vstorerwu_io
  STrivv_pseudo_V6_128B   PS_vstorerw_io_128   PS_vstorerwu_io_128

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278564 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[libFuzzer] fix typo in docs
Kostya Serebryany [Fri, 12 Aug 2016 20:42:24 +0000 (20:42 +0000)]
[libFuzzer] fix typo in docs

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278563 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[AArch64LoadStoreOptimizer] Check aliasing correctly when creating paired loads/stores.
Eli Friedman [Fri, 12 Aug 2016 20:39:51 +0000 (20:39 +0000)]
[AArch64LoadStoreOptimizer] Check aliasing correctly when creating paired loads/stores.

The existing code accidentally skipped the aliasing check in edge cases.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278562 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[AArch64] Registering default MCInstrAnalysis
Mike Aizatsky [Fri, 12 Aug 2016 20:28:05 +0000 (20:28 +0000)]
[AArch64] Registering default MCInstrAnalysis

Even in this form it is useful: it can detect branch instructions.

https://github.com/google/sanitizers/issues/706

Subscribers: aemerson, rengolin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278560 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[AArch64LoadStoreOpt] Handle offsets correctly for post-indexed paired loads.
Eli Friedman [Fri, 12 Aug 2016 20:28:02 +0000 (20:28 +0000)]
[AArch64LoadStoreOpt] Handle offsets correctly for post-indexed paired loads.

Trunk would try to create something like "stp x9, x8, [x0], #512", which isn't actually a valid instruction.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278559 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRemove autoconf references from LICENSE.TXT
Chris Bieneman [Fri, 12 Aug 2016 20:11:03 +0000 (20:11 +0000)]
Remove autoconf references from LICENSE.TXT

Since we don't actually have the autoconf subdirectories anymore, we don't need this reference here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278558 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoNext set of additional error checks for invalid Mach-O files.
Kevin Enderby [Fri, 12 Aug 2016 20:10:25 +0000 (20:10 +0000)]
Next set of additional error checks for invalid Mach-O files.

This contains the two missing checks for LC_SEGMENT load command fields.
And checks for the Mach-O sections fields that would make them invalid.

With the new checks, some of the existing malformed file checks now trips one
of these instead of the issue it was having before so those tests were adjusted.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278557 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[sancov] test file cleanup
Mike Aizatsky [Fri, 12 Aug 2016 20:06:32 +0000 (20:06 +0000)]
[sancov] test file cleanup

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278556 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[sancov] MachO indirect symbols support.
Mike Aizatsky [Fri, 12 Aug 2016 19:25:59 +0000 (19:25 +0000)]
[sancov] MachO indirect symbols support.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278551 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PPC] Memoize getValueBits. NFC.
Tim Shen [Fri, 12 Aug 2016 18:40:04 +0000 (18:40 +0000)]
[PPC] Memoize getValueBits. NFC.

Summary: It triggers exponential behavior when the DAG has many branches.

Reviewers: hfinkel, kbarton

Subscribers: iteratee, nemanjai, echristo

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278548 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[WebAssembly] Plug MachineMemOperand leaks.
Benjamin Kramer [Fri, 12 Aug 2016 18:33:50 +0000 (18:33 +0000)]
[WebAssembly] Plug MachineMemOperand leaks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278545 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[LibFuzzer] Fix `-jobs=<N>` where <N> > 1 and the number of workers is > 1 on macOS.
Dan Liew [Fri, 12 Aug 2016 18:29:36 +0000 (18:29 +0000)]
[LibFuzzer] Fix `-jobs=<N>` where <N> > 1 and the number of workers is > 1 on macOS.

The original `ExecuteCommand()` called `system()` from the C library.
The C library implementation of this on macOS contains a mutex which
serializes calls to `system()`. This prevented the `-jobs=` flag
from running copies of the fuzzing binary in parallel which is
the opposite of what is intended.

To fix this on macOS an alternative implementation of `ExecuteCommand()`
is provided that can be used concurrently. This is provided in
`FuzzerUtilDarwin.cpp` which is guarded to only compile code on Apple
platforms. The existing implementation has been moved to a new file
`FuzzerUtilLinux.cpp` which is guarded to only compile code on Linux.

This commit includes a simple test to check that LibFuzzer is being
executed in parallel when requested.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278544 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoADT: Remove stale header comments about next/prev after r278532
Duncan P. N. Exon Smith [Fri, 12 Aug 2016 18:14:42 +0000 (18:14 +0000)]
ADT: Remove stale header comments about next/prev after r278532

Thanks to Mehdi for noticing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278542 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoHide type trait from r278532 from MSVC
Duncan P. N. Exon Smith [Fri, 12 Aug 2016 18:10:29 +0000 (18:10 +0000)]
Hide type trait from r278532 from MSVC

The fixup from r278537 was insufficient.  Just #ifdef it out for MSVC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278539 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoTry to appease win7 bots after r278532 by cleaning up type trait
Duncan P. N. Exon Smith [Fri, 12 Aug 2016 17:54:54 +0000 (17:54 +0000)]
Try to appease win7 bots after r278532 by cleaning up type trait

The HasGetNext type trait was cluttered with a few things it didn't
need.  Try to clean it up, hoping to fix windows bots:
  http://lab.llvm.org:8011/builders/lld-x86_64-win7/builds/38063

I may just have to delete the trait...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278537 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRemove whitespace
David Majnemer [Fri, 12 Aug 2016 17:53:06 +0000 (17:53 +0000)]
Remove whitespace

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278536 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoADT: Remove the ilist_nextprev_traits customization point
Duncan P. N. Exon Smith [Fri, 12 Aug 2016 17:32:34 +0000 (17:32 +0000)]
ADT: Remove the ilist_nextprev_traits customization point

No one is using the capability to implement next and prev another way
(since lld stopped doing it in r278468).  Remove the customization point
by moving the API from ilist_nextprev_traits<T> to ilist_node_access.

The old traits class is still useful/necessary API as a target for
friends of node types that inherit privately from ilist_node.
Eventually I plan to either remove it entirely or move the template
parameters to the methods.

(Note: if there's desire to bring back customization of next/prev
pointers in the future (e.g., to pack some bits in there), I think a
traits class like this is an awkward way to accomplish it.  Instead, we
should change ilist<T> to be ilist<ilist_node<T>>, and give an extra
template parameter to ilist_node.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278532 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PM] Port LowerInvoke to the new pass manager
Michael Kuperstein [Fri, 12 Aug 2016 17:28:27 +0000 (17:28 +0000)]
[PM] Port LowerInvoke to the new pass manager

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278531 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoconstify InstCombine::foldAllocaCmp. NFC.
Pete Cooper [Fri, 12 Aug 2016 17:13:28 +0000 (17:13 +0000)]
constify InstCombine::foldAllocaCmp.  NFC.

This is part of an effort to constify ValueTracking.cpp.  This change is
to methods which need const Value* instead of Value* to go with the upcoming
changes to ValueTracking.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278528 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFine tuning of sample profile propagation algorithm.
Dehao Chen [Fri, 12 Aug 2016 16:22:12 +0000 (16:22 +0000)]
Fine tuning of sample profile propagation algorithm.

Summary: The refined propagation algorithm is more accurate and robust.

Reviewers: davidxl, dnovillo

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278522 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[x86] X86ISelLowering zext(add_nuw(x, C)) --> add(zext(x), C_zext)
Artur Pilipenko [Fri, 12 Aug 2016 16:08:30 +0000 (16:08 +0000)]
[x86] X86ISelLowering zext(add_nuw(x, C)) --> add(zext(x), C_zext)

Currently X86ISelLowering has a similar transformation for sexts:
sext(add_nsw(x, C)) --> add(sext(x), C_sext)

In this change I extend this code to handle zexts as well.

Reviewed By: spatel

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278520 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[BasicAA] Avoid calling GetUnderlyingObject, when the result of a previous call can...
Ehsan Amiri [Fri, 12 Aug 2016 16:05:03 +0000 (16:05 +0000)]
[BasicAA] Avoid calling GetUnderlyingObject, when the result of a previous call can be reused.

Recursive calls to aliasCheck from alias[GEP|Select|PHI] may result in a second call to GetUnderlyingObject for a Value, whose underlying object is already computed. This patch ensures that in this situations, the underlying object is not computed again, and the result of the previous call is resued.

https://reviews.llvm.org/D22305

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278519 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[LVI] Take guards into account
Artur Pilipenko [Fri, 12 Aug 2016 15:52:23 +0000 (15:52 +0000)]
[LVI] Take guards into account

Teach LVI to gather control dependant constraints from guards.

Reviewed By: sanjoy

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278518 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd move ops to satisfy MSVC.
Teresa Johnson [Fri, 12 Aug 2016 15:39:26 +0000 (15:39 +0000)]
Add move ops to satisfy MSVC.

Try to appease Windows bots after r278508:
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/27250
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/14776

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278517 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[AArch64] Re-factor code shared by AArch64LoadStoreOpt and AArch64InstrInfo.
Geoff Berry [Fri, 12 Aug 2016 15:26:00 +0000 (15:26 +0000)]
[AArch64] Re-factor code shared by AArch64LoadStoreOpt and AArch64InstrInfo.

This re-factoring could cause the following slight changes in generated
code, though none were observed during testing:

- MachineScheduler could decide not to cluster some loads/stores if
  there are other load/stores with non-pairable opcodes that have the
  same base register and offset as a pairable set of load/stores.  One
  case of different MachineScheduler pairing did show up in my testing,
  but it wasn't due to this issue, but due
  BaseMemOpClusterMutation::clusterNeighboringMemOps() being unstable
  w.r.t. the order it considers memory operations.  See PR28942.

- The ImplicitNullChecks optimization could be done for more load/store
  opcodes.  This optimization isn't done for C/C++ code, so it didn't
  show up in my testing.

Reviewers: mcrosier, t.p.northover

Subscribers: aemerson, rengolin, mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278515 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[LVI] Fix potential memory corruption in getValueFromCondition
Artur Pilipenko [Fri, 12 Aug 2016 15:08:15 +0000 (15:08 +0000)]
[LVI] Fix potential memory corruption in getValueFromCondition

Rewrite Visited[Cond] = getValueFromConditionImpl(..., Visited) statement which can lead to a memory corruption since getValueFromConditionImpl changes Visited map and invalidates the iterators.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278514 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoADT: Share code for embedded sentinel traits, NFC
Duncan P. N. Exon Smith [Fri, 12 Aug 2016 15:00:55 +0000 (15:00 +0000)]
ADT: Share code for embedded sentinel traits, NFC

Share code for the (mostly problematic) embedded sentinel traits.
- Move the LLVM_NO_SANITIZE("object-size") attribute to
  ilist_half_embedded_sentinel_traits and ilist_embedded_sentinel_traits
  (previously it spread throughout the code duplication).
- Add an ilist_full_embedded_sentinel_traits which has no UB (but has
  the downside of storing the complete node).
- Replace all the custom sentinel traits in LLVM with a declaration of
  ilist_sentinel_traits that inherits from one of the embedded sentinel
  traits classes.

There are still custom sentinel traits in other LLVM subprojects.  I'll
remove those in a follow-up.

Nothing at all should be changing here, this is just rearranging code.
Note that the final goal here is to remove the sentinel traits
altogether, settling on the memory layout of
ilist_half_embedded_sentinel_traits without the UB.  This intermediate
step moves the logic into ilist.h.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278513 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix type to avoid problems on 32-bit builds
Teresa Johnson [Fri, 12 Aug 2016 14:55:43 +0000 (14:55 +0000)]
Fix type to avoid problems on 32-bit builds

lto::InputFile::Symbol::getCommonSize should return uint64_t instead of
size_t since it is returning the result of DataLayout::getTypeAllocSize
which returns uint64_t, and the result of getCommonSize is assigned to a
uint64_t variable. On 32-bit builds size_t is unsigned int and there are
type errors. This was introduced in r278338.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278512 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert "[Sparc] Leon errata fix passes."
James Y Knight [Fri, 12 Aug 2016 14:48:09 +0000 (14:48 +0000)]
Revert "[Sparc] Leon errata fix passes."
...and the two followup commits:
Revert "[Sparc][Leon] Missed resetting option flags from check-in 278489."
Revert "[Sparc][Leon] Errata fixes for various errata in different
versions of the Leon variants of the Sparc 32 bit processor."

This reverts commit r274856, r278489, and r278492.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278511 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PM] Port NameAnonFunction pass to new pass manager
Teresa Johnson [Fri, 12 Aug 2016 14:03:36 +0000 (14:03 +0000)]
[PM] Port NameAnonFunction pass to new pass manager

Summary:
Port the NameAnonFunction pass and add a test.

Depends on D23439.

Reviewers: mehdi_amini

Subscribers: llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278509 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PM] Port ModuleSummaryIndex analysis to new pass manager
Teresa Johnson [Fri, 12 Aug 2016 13:53:02 +0000 (13:53 +0000)]
[PM] Port ModuleSummaryIndex analysis to new pass manager

Summary:
Port the ModuleSummaryAnalysisWrapperPass to the new pass manager.
Use it in the ported BitcodeWriterPass (similar to how we use the
legacy ModuleSummaryAnalysisWrapperPass in the legacy WriteBitcodePass).

Also, pass the -module-summary opt flag through to the new pass
manager pipeline and through to the bitcode writer pass, and add
a test that uses it.

Reviewers: mehdi_amini

Subscribers: llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278508 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[X86][SSE] Add support for combining target shuffles to PSLLDQ/PSRLDQ byte shifts
Simon Pilgrim [Fri, 12 Aug 2016 11:24:34 +0000 (11:24 +0000)]
[X86][SSE] Add support for combining target shuffles to PSLLDQ/PSRLDQ byte shifts

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278502 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Hexagon] Standardize pseudo-instructions for calls and returns
Krzysztof Parzyszek [Fri, 12 Aug 2016 11:12:02 +0000 (11:12 +0000)]
[Hexagon] Standardize pseudo-instructions for calls and returns

- CALLv3nr        PS_call_nr
- CALLRv3nr       PS_callr_nr
- CALLstk         PS_call_stk

- TCRETURNi       PS_tailcall_i
- TCRETURNr       PS_tailcall_r

- JMPret          PS_jmpret
- JMPrett         PS_jmprett
- JMPretf         PS_jmpretf
- JMPrettnew      PS_jmprettnew
- JMPretfnew      PS_jmpretfnew
- JMPrettnewpt    PS_jmprettnewpt
- JMPretfnewpt    PS_jmpretfnewpt

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278499 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Hexagon] Treat non-returning indirect calls as scheduling boundaries
Krzysztof Parzyszek [Fri, 12 Aug 2016 11:01:10 +0000 (11:01 +0000)]
[Hexagon] Treat non-returning indirect calls as scheduling boundaries

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278498 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[LVI] Take range metadata into account while calculating icmp condition constraints
Artur Pilipenko [Fri, 12 Aug 2016 10:14:11 +0000 (10:14 +0000)]
[LVI] Take range metadata into account while calculating icmp condition constraints

Take range metadata into account for conditions like this:

%length = load i32, i32* %length_ptr, !range !{i32 0, i32 2147483647}
%cmp = icmp ult i32 %a, %length

This is a common pattern for range checks where the length of the array is dynamically loaded.

Reviewed By: sanjoy

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278496 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Webassembly] disable unstable test.
Benjamin Kramer [Fri, 12 Aug 2016 10:13:45 +0000 (10:13 +0000)]
[Webassembly] disable unstable test.

It reads uninitialized memory and crashes randomly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278495 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[X86][SSE] Fixed PALIGNR target shuffle decode
Simon Pilgrim [Fri, 12 Aug 2016 10:10:51 +0000 (10:10 +0000)]
[X86][SSE] Fixed PALIGNR target shuffle decode

The PALIGNR target shuffle decode was not taking into account that DecodePALIGNRMask (rather oddly) expects the operands to be in reverse order, nor was it detecting unary patterns, causing combines to combine with the incorrect input.

The cgbuiltin, auto upgrade and instruction comments code correctly swap the operands so are not affected.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278494 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[LVI] Handle any predicate in comparisons like icmp <pred> (add Val, Offset), ...
Artur Pilipenko [Fri, 12 Aug 2016 10:05:11 +0000 (10:05 +0000)]
[LVI] Handle any predicate in comparisons like icmp <pred> (add Val, Offset), ...

Currently LVI can only gather value constraints from comparisons like:

* icmp <pred> Val, ...
* icmp ult (add Val, Offset), ...

In fact we can handle any predicate in latter comparisons.

Reviewed By: sanjoy

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278493 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Sparc][Leon] Missed resetting option flags from check-in 278489.
Chris Dewhurst [Fri, 12 Aug 2016 09:54:39 +0000 (09:54 +0000)]
[Sparc][Leon] Missed resetting option flags from check-in 278489.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278492 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Sparc][Leon] Errata fixes for various errata in different versions of the Leon varia...
Chris Dewhurst [Fri, 12 Aug 2016 09:34:26 +0000 (09:34 +0000)]
[Sparc][Leon] Errata fixes for various errata in different versions of the Leon variants of the Sparc 32 bit processor.

The nature of the errata are listed in the comments preceding the errata fix passes. Relevant unit tests are implemented for each of these.

These changes update older versions of these errata fixes with improvements to code and unit tests.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278489 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Coroutines] Move class into anonymous namespace.
Benjamin Kramer [Fri, 12 Aug 2016 08:47:13 +0000 (08:47 +0000)]
[Coroutines] Move class into anonymous namespace.

Hopefully fixes visibility warnings from GCC. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278485 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert "[BranchFolding] Restrict tail merging loop blocks after MBP"
Haicheng Wu [Fri, 12 Aug 2016 08:40:24 +0000 (08:40 +0000)]
Revert "[BranchFolding] Restrict tail merging loop blocks after MBP"

This reverts commit r278463 because it hits the bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278484 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Coroutines]: Part6b: Add coro.id intrinsic.
Gor Nishanov [Fri, 12 Aug 2016 05:45:49 +0000 (05:45 +0000)]
[Coroutines]: Part6b: Add coro.id intrinsic.

Summary:
1. Make coroutine representation more robust against optimization that may duplicate instruction by introducing coro.id intrinsics that returns a token that will get fed into coro.alloc and coro.begin. Due to coro.id returning a token, it won't get duplicated and can be used as reliable indicator of coroutine identify when a particular coroutine call gets inlined.
2. Move last three arguments of coro.begin into coro.id as they will be shared if coro.begin will get duplicated.
3. doc + test + code updated to support the new intrinsic.

Reviewers: mehdi_amini, majnemer

Subscribers: mehdi_amini, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278481 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoADT: Remove all ilist_iterator => pointer casts, NFC
Duncan P. N. Exon Smith [Fri, 12 Aug 2016 05:05:36 +0000 (05:05 +0000)]
ADT: Remove all ilist_iterator => pointer casts, NFC

Remove all ilist_iterator to pointer casts.  There were two reasons for
casts:

  - Checking for an uninitialized (i.e., null) iterator.  I added
    MachineInstrBundleIterator::isValid() to check for that case.

  - Comparing an iterator against the underlying pointer value while
    avoiding converting the pointer value to an iterator.  This is
    occasionally necessary in MachineInstrBundleIterator, since there is
    an assertion in the constructors that the underlying MachineInstr is
    not bundled (but we don't care about that if we're just checking for
    pointer equality).

To support the latter case, I rewrote the == and != operators for
ilist_iterator and MachineInstrBundleIterator.

  - The implicit constructors now use enable_if to exclude
    const-iterator => non-const-iterator conversions from overload
    resolution (previously it was a compiler error on instantiation, now
    it's SFINAE).

  - The == and != operators are now global (friends), and are not
    templated.

  - MachineInstrBundleIterator has overloads to compare against both
    const_pointer and const_reference.  This avoids the implicit
    conversions to MachineInstrBundleIterator that assert, instead just
    checking the address (and I added unit tests to confirm this).

Notably, the only remaining uses of ilist_iterator::getNodePtrUnchecked
are in ilist.h, and no code outside of ilist*.h directly relies on this
UB end-iterator-to-pointer conversion anymore.  It's still needed for
ilist_*sentinel_traits, but I'll clean that up soon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278478 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoUse the range variant of transform instead of unpacking begin/end
David Majnemer [Fri, 12 Aug 2016 04:32:45 +0000 (04:32 +0000)]
Use the range variant of transform instead of unpacking begin/end

No functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278477 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoUse the range variant of transform instead of unpacking begin/end
David Majnemer [Fri, 12 Aug 2016 04:32:42 +0000 (04:32 +0000)]
Use the range variant of transform instead of unpacking begin/end

No functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278476 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoUse the range variant of remove_if instead of unpacking begin/end
David Majnemer [Fri, 12 Aug 2016 04:32:37 +0000 (04:32 +0000)]
Use the range variant of remove_if instead of unpacking begin/end

No functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278475 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoUse the range variant of count_if instead of unpacking begin/end
David Majnemer [Fri, 12 Aug 2016 04:32:29 +0000 (04:32 +0000)]
Use the range variant of count_if instead of unpacking begin/end

No functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278474 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoUse the range variant of find/find_if instead of unpacking begin/end
David Majnemer [Fri, 12 Aug 2016 03:55:06 +0000 (03:55 +0000)]
Use the range variant of find/find_if instead of unpacking begin/end

If the result of the find is only used to compare against end(), just
use is_contained instead.

No functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278469 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoADT: Add ilist_iterator conversions to/from ilist_node
Duncan P. N. Exon Smith [Fri, 12 Aug 2016 03:35:33 +0000 (03:35 +0000)]
ADT: Add ilist_iterator conversions to/from ilist_node

Allow an ilist_iterator to be constructed from an ilist_node, and give
access to the underlying ilist_node as well.

This will be used immediately in lld to support a type-erasure use case.
Longer term, they'll stick around once the iterator is using
ilist_node<NodeTy>* instead of NodeTy*.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278467 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRecommit 'Remove the restriction that MachineSinking is now stopped by
Wei Mi [Fri, 12 Aug 2016 03:33:22 +0000 (03:33 +0000)]
Recommit 'Remove the restriction that MachineSinking is now stopped by
"insert_subreg, subreg_to_reg, and reg_sequence" instructions' after
adjusting some unittest checks.

This is to solve PR28852. The restriction was added at 2010 to make better register
coalescing. We assumed that it was not necessary any more. Testing results on x86
supported the assumption.

We will look closely to any performance impact it will bring and will be prepared
to help analyzing performance problem found on other architectures.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278466 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[BranchFolding] Restrict tail merging loop blocks after MBP
Haicheng Wu [Fri, 12 Aug 2016 03:30:23 +0000 (03:30 +0000)]
[BranchFolding] Restrict tail merging loop blocks after MBP

To fix PR28014, this patch restricts tail merging to blocks that belong to the
same loop after MBP.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278463 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoWholeProgramDevirt: initialize WasDevirt in all constructors.
Ivan Krasin [Fri, 12 Aug 2016 01:40:10 +0000 (01:40 +0000)]
WholeProgramDevirt: initialize WasDevirt in all constructors.

Summary: This is a follow up to r278389 and r278442.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278455 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[DSE] Don't remove stores made live by a call which unwinds.
Eli Friedman [Fri, 12 Aug 2016 01:09:53 +0000 (01:09 +0000)]
[DSE] Don't remove stores made live by a call which unwinds.

Issue exposed by noalias or more aggressive alias analysis.

Fixes http://llvm.org/PR25422.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278451 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRefactor isValidAssumeForContext to reduce duplication and indentation. NFC.
Pete Cooper [Fri, 12 Aug 2016 01:00:15 +0000 (01:00 +0000)]
Refactor isValidAssumeForContext to reduce duplication and indentation.  NFC.

This method had some duplicate code when we did or did not have a dom tree.  Refactor
it to remove the duplication, but also clean up the control flow to have less duplication.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278450 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoUse the range variant of find_if instead of unpacking begin/end
David Majnemer [Fri, 12 Aug 2016 00:18:03 +0000 (00:18 +0000)]
Use the range variant of find_if instead of unpacking begin/end

No functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278443 91177308-0d34-0410-b5e6-96231b3b80d8