oota-llvm.git
9 years agoIR: Remove a redundant function. NFC
Justin Bogner [Wed, 2 Sep 2015 22:28:47 +0000 (22:28 +0000)]
IR: Remove a redundant function. NFC

Function::print isn't interestingly different from Value::print. Just
let the only caller (in PrintCallGraphPass) call the Value version.

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

9 years ago[X86] Cleanup nontemporal fragments. NFCI.
Ahmed Bougacha [Wed, 2 Sep 2015 22:27:38 +0000 (22:27 +0000)]
[X86] Cleanup nontemporal fragments. NFCI.

We can chain other fragments to avoid repeating conditions.
This also fixes a potential bug (that realistically can't happen),
where we would match indexed nontemporal stores for i32/i64.

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

9 years ago[RewriteStatepointsForGC] Bugfix for change 246133
Philip Reames [Wed, 2 Sep 2015 22:25:07 +0000 (22:25 +0000)]
[RewriteStatepointsForGC] Bugfix for change 246133

Fix a bug in change 246133. I didn't handle the case where we had a cycle in the use graph and could add an instruction we were about to erase back on to the worklist. Oddly, I have not been able to write a small test case for this, even with the AssertingVH added. I have confirmed the basic theory for the fix on a large failing example, but all attempts to reduce that to something appropriate for a test case have failed.

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

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

9 years agoFix release build warning for unused function
Philip Reames [Wed, 2 Sep 2015 21:57:17 +0000 (21:57 +0000)]
Fix release build warning for unused function

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

9 years ago[RewriteStatepointsForGC] Improve debug output [NFC]
Philip Reames [Wed, 2 Sep 2015 21:11:44 +0000 (21:11 +0000)]
[RewriteStatepointsForGC] Improve debug output [NFC]

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

9 years ago[PowerPC] Cleanup cost model for unaligned vector loads/stores
Hal Finkel [Wed, 2 Sep 2015 21:03:28 +0000 (21:03 +0000)]
[PowerPC] Cleanup cost model for unaligned vector loads/stores

I'm adding a regression test to better cover code generation for unaligned
vector loads and stores, but there's no functional change to the code
generation here. There is an improvement to the cost model for unaligned vector
loads and stores, mostly for QPX (for which we were not previously accounting
for the permutation-based loads), and the cost model implementation is cleaner.

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

9 years agoMove twice-repeated clang path operation into a new function.
Douglas Katzman [Wed, 2 Sep 2015 21:02:10 +0000 (21:02 +0000)]
Move twice-repeated clang path operation into a new function.

And make it more robust in the edge case of exactly "./" as input.

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

9 years agoSmall docs fix
Piotr Padlewski [Wed, 2 Sep 2015 20:33:16 +0000 (20:33 +0000)]
Small docs fix

http://reviews.llvm.org/D12572

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

9 years ago[lit] Add basic flaky test retry functionality
Reid Kleckner [Wed, 2 Sep 2015 20:32:41 +0000 (20:32 +0000)]
[lit] Add basic flaky test retry functionality

The plan is to use this for the sanitizer test suite on Windows.  See
PR24554 for more details on why we need this.

Tested manually by injecting rand() into a sanitizer test and watching
what it does.

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

9 years agoassuem(X) handling in GVN bugfix
Piotr Padlewski [Wed, 2 Sep 2015 20:00:03 +0000 (20:00 +0000)]
assuem(X) handling in GVN bugfix

There was infinite loop because it was trying to change assume(true) into
assume(true)
Also added handling when assume(false) appear

http://reviews.llvm.org/D12516

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

9 years agoConstant propagation after hitting assume(cmp) bugfix
Piotr Padlewski [Wed, 2 Sep 2015 19:59:59 +0000 (19:59 +0000)]
Constant propagation after hitting assume(cmp) bugfix

Last time code run into assertion `BBE.isSingleEdge()` in
lib/IR/Dominators.cpp:200.

http://reviews.llvm.org/D12170

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

9 years agoConstant propagation after hiting llvm.assume
Piotr Padlewski [Wed, 2 Sep 2015 19:59:53 +0000 (19:59 +0000)]
Constant propagation after hiting llvm.assume

After hitting @llvm.assume(X) we can:
- propagate equality that X == true
- if X is icmp/fcmp (with eq operation), and one of operand
  is constant we can change all variables with constants in the same BasicBlock

http://reviews.llvm.org/D11918

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

9 years ago[RemoveDuplicatePHINodes] Start over after removing a PHI.
Benjamin Kramer [Wed, 2 Sep 2015 19:52:23 +0000 (19:52 +0000)]
[RemoveDuplicatePHINodes] Start over after removing a PHI.

This makes RemoveDuplicatePHINodes more effective and fixes an assertion
failure. Triggering the assertions requires a DenseSet reallocation
so this change only contains a constructive test.

I'll explain the issue with a small example. In the following function
there's a duplicate PHI, %4 and %5 are identical. When this is found
the DenseSet in RemoveDuplicatePHINodes contains %2, %3 and %4.

define void @F() {
  br label %1

; <label>:1                                       ; preds = %1, %0
  %2 = phi i32 [ 42, %0 ], [ %4, %1 ]
  %3 = phi i32 [ 42, %0 ], [ %5, %1 ]
  %4 = phi i32 [ 42, %0 ], [ 23, %1 ]
  %5 = phi i32 [ 42, %0 ], [ 23, %1 ]
  br label %1
}

after RemoveDuplicatePHINodes runs the function looks like this. %3 has
changed and is now identical to %2, but RemoveDuplicatePHINodes never
saw this.

define void @F() {
  br label %1

; <label>:1                                       ; preds = %1, %0
  %2 = phi i32 [ 42, %0 ], [ %4, %1 ]
  %3 = phi i32 [ 42, %0 ], [ %4, %1 ]
  %4 = phi i32 [ 42, %0 ], [ 23, %1 ]
  br label %1
}

If the DenseSet does a reallocation now it will reinsert all
keys and stumble over %3 now having a different hash value than it had
when inserted into the map for the first time. This change clears the
set whenever a PHI is deleted and starts the progress from the
beginning, allowing %3 to be deleted and avoiding inconsistent DenseSet
state. This potentially has a negative performance impact because
it rescans all PHIs, but I don't think that this ever makes a difference
in practice.

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

9 years agofix underline
Sanjay Patel [Wed, 2 Sep 2015 19:35:31 +0000 (19:35 +0000)]
fix underline

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

9 years agouse "unpredictable" metadata in fast-isel when splitting compares
Sanjay Patel [Wed, 2 Sep 2015 19:23:23 +0000 (19:23 +0000)]
use "unpredictable" metadata in fast-isel when splitting compares

This patch uses the metadata defined in D12341 to avoid creating an unpredictable branch.

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

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

9 years agouse "unpredictable" metadata in SelectionDAG when splitting compares
Sanjay Patel [Wed, 2 Sep 2015 19:17:25 +0000 (19:17 +0000)]
use "unpredictable" metadata in SelectionDAG when splitting compares

This patch uses the metadata defined in D12341 to avoid creating an unpredictable branch.

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

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

9 years ago[libFuzzer] honour -only_ascii=1 when reading the initial corpus. Also, remove ugly...
Kostya Serebryany [Wed, 2 Sep 2015 19:08:08 +0000 (19:08 +0000)]
[libFuzzer] honour -only_ascii=1 when reading the initial corpus. Also, remove ugly #ifdef

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

9 years agoadd unpredictable metadata type for control flow
Sanjay Patel [Wed, 2 Sep 2015 19:06:43 +0000 (19:06 +0000)]
add unpredictable metadata type for control flow

This patch defines 'unpredictable' metadata. This metadata can be used to signal to the optimizer
or backend that a branch or switch is unpredictable, and therefore, it's probably better to not
split a compound predicate into multiple branches such as in CodeGenPrepare::splitBranchCondition().

This was discussed in:
https://llvm.org/bugs/show_bug.cgi?id=23827

Dependent patches to alter codegen and expose this in clang to follow.

Differential Revision; http://reviews.llvm.org/D12341

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

9 years ago[AArch64] More consistently separate asm opc and operands with '\t'.
Ahmed Bougacha [Wed, 2 Sep 2015 18:52:54 +0000 (18:52 +0000)]
[AArch64] More consistently separate asm opc and operands with '\t'.

Somehow missed these in r246686.

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

9 years ago[AArch64] Consistently separate asm opc and operands with '\t'.
Ahmed Bougacha [Wed, 2 Sep 2015 18:38:36 +0000 (18:38 +0000)]
[AArch64] Consistently separate asm opc and operands with '\t'.

Some of the instructions use ' ', which drives OCD-me nuts.
Let's put an end to this.

NFC-ish: hopefully nobody cares about whitespace.

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

9 years agotest: Only warn about missing substitutions for required tools
Justin Bogner [Wed, 2 Sep 2015 18:03:01 +0000 (18:03 +0000)]
test: Only warn about missing substitutions for required tools

Every time lit is invoked, I get warnings like so:

  lit.py: lit.cfg:286: note: Did not find llvm-go in /Users/bogner/build/llvm/./bin
  lit.py: lit.cfg:286: note: Did not find Kaleidoscope-Ch3 in /Users/bogner/build/llvm/./bin

Since these tools are only built in certain configs, these warnings
are superfluous. Change it so that we only warn about tools that are
built in all configs.

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

9 years agoIR: Invert a condition to make it more legible. NFC
Justin Bogner [Wed, 2 Sep 2015 17:54:41 +0000 (17:54 +0000)]
IR: Invert a condition to make it more legible. NFC

Also updates the style to more modern conventions.

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

9 years ago[ValueTracking] Minor comment change in test
James Molloy [Wed, 2 Sep 2015 17:29:54 +0000 (17:29 +0000)]
[ValueTracking] Minor comment change in test

This test was updated in r246678 - fix a copypasta in a comment noticed post-commit.

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

9 years ago[ValueTracking] Look through casts when both operands are casts.
James Molloy [Wed, 2 Sep 2015 17:25:25 +0000 (17:25 +0000)]
[ValueTracking] Look through casts when both operands are casts.

We only looked through casts when one operand was a constant. We can also look through casts when both operands are non-constant, but both are in fact the same cast type. For example:

%1 = icmp ult i8 %a, %b
%2 = zext i8 %a to i32
%3 = zext i8 %b to i32
%4 = select i1 %1, i32 %2, i32 %3

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

9 years ago[llvm-reaodbj] Simplify code. No functional change (intended).
Davide Italiano [Wed, 2 Sep 2015 16:53:25 +0000 (16:53 +0000)]
[llvm-reaodbj] Simplify code. No functional change (intended).

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

9 years ago[PowerPC] Don't always consider P8Altivec-only masks in LowerVECTOR_SHUFFLE
Hal Finkel [Wed, 2 Sep 2015 16:52:37 +0000 (16:52 +0000)]
[PowerPC] Don't always consider P8Altivec-only masks in LowerVECTOR_SHUFFLE

LowerVECTOR_SHUFFLE needs to decide whether to pass a vector shuffle off to the
TableGen-generated matching code, and it does this by testing the same
predicates used by the TableGen files. Unfortunately, when we added new
P8Altivec-only predicates, we started universally testing them in
LowerVECTOR_SHUFFLE, and if then matched when targeting a system prior to a P8,
we'd end up with a selection failure.

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

9 years agoReapply r246012 [dsymutil] Emit real dSYM companion binaries.
Frederic Riss [Wed, 2 Sep 2015 16:49:13 +0000 (16:49 +0000)]
Reapply r246012 [dsymutil] Emit real dSYM companion binaries.

With a fix for big endian machines. Thanks to Daniel Sanders for the debugging!

Original commit message:

The binaries containing the linked DWARF generated by dsymutil are not
standard relocatable object files like emitted did previsously. They should be
dSYM companion files, which means they have a different file type in the
header, but also a couple other peculiarities:
 - they contain the segments and sections from the original binary in their
load commands, but not the actual contents. This means they get an address
and a size, but their offset is always 0 (but these are not virtual sections)
 - they also conatin all the defined symbols from the original binary

This makes MC a really bad fit to emit these kind of binaries. The approach
that was used in this patch is to leverage MC's section layout for the
debug sections, but to use a replacement for MachObjectWriter that lives
in MachOUtils.cpp. Some of the low-level helpers from MachObjectWriter
were reused too.

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

9 years ago[llvm-readobj] MachO: Dump segment command.
Davide Italiano [Wed, 2 Sep 2015 16:24:24 +0000 (16:24 +0000)]
[llvm-readobj] MachO: Dump segment command.

Example output:

File: <stdin>
Format: Mach-O arm
Arch: arm
AddressSize: 32bit
Segment {
  Cmd: LC_SEGMENT
  Name:
  Size: 260
  vmaddr: 0x0
  vmsize: 0x10
  fileoff: 408
  filesize: 408
  maxprot: rwx
  initprot: rwx
  nsects: 3
  flags: 0x0
}

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

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

9 years agoMCAssembler.h: Prune unused \param since r246604. [-Wdocumentation]
NAKAMURA Takumi [Wed, 2 Sep 2015 16:21:27 +0000 (16:21 +0000)]
MCAssembler.h: Prune unused \param since r246604. [-Wdocumentation]

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

9 years ago[x86] fix allowsMisalignedMemoryAccesses() for 8-byte and smaller accesses
Sanjay Patel [Wed, 2 Sep 2015 15:42:49 +0000 (15:42 +0000)]
[x86] fix allowsMisalignedMemoryAccesses() for 8-byte and smaller accesses

This is a continuation of the fix from:
http://reviews.llvm.org/D10662

and discussion in:
http://reviews.llvm.org/D12154

Here, we distinguish slow unaligned SSE (128-bit) accesses from slow unaligned
scalar (64-bit and under) accesses. Other lowering (eg, getOptimalMemOpType)
assumes that unaligned scalar accesses are always ok, so this changes
allowsMisalignedMemoryAccesses() to match that behavior.

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

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

9 years agoPass a symbol table to getRelocationSymbol instead of returning one.
Rafael Espindola [Wed, 2 Sep 2015 15:07:39 +0000 (15:07 +0000)]
Pass a symbol table to getRelocationSymbol instead of returning one.

This removes a report_fatal_error from library and avoids checking a
section property for every section entry.

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

9 years ago[X86][AVX512VLBW] add support in byte shift and SAD
Asaf Badouh [Wed, 2 Sep 2015 14:21:54 +0000 (14:21 +0000)]
[X86][AVX512VLBW] add  support in byte shift and SAD
add byte shift left/right
add SAD - compute sum of absolute differences

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

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

9 years agoAdd newline to test. NFC.
Chad Rosier [Wed, 2 Sep 2015 14:06:16 +0000 (14:06 +0000)]
Add newline to test. NFC.

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

9 years ago[TableGen] Allow TokenTy in intrinsic signatures
Joseph Tremoulet [Wed, 2 Sep 2015 13:36:25 +0000 (13:36 +0000)]
[TableGen] Allow TokenTy in intrinsic signatures

Summary:
Add the necessary plumbing so that llvm_token_ty can be used as an
argument/return type in intrinsic definitions and correspondingly require
TokenTy in function types.  TokenTy is an opaque type that has no target
lowering, but can be used in machine-independent intrinsics.  It is
required for the upcoming llvm.eh.padparam intrinsic.

Reviewers: majnemer, rnk

Subscribers: stoklund, llvm-commits

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

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

9 years agoAVX512: Implemented encoding and intrinsics for VGETMANTPD/S , VGETMANTSD/S instructions
Igor Breger [Wed, 2 Sep 2015 11:18:55 +0000 (11:18 +0000)]
AVX512: Implemented encoding and intrinsics for VGETMANTPD/S , VGETMANTSD/S instructions
Added tests for intrinsics and encoding.

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

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

9 years agoSuppress llvm/test/tools/gold/X86/parallel.ll while investigating.
NAKAMURA Takumi [Wed, 2 Sep 2015 10:59:21 +0000 (10:59 +0000)]
Suppress llvm/test/tools/gold/X86/parallel.ll while investigating.

For me,

  Program received signal SIGSEGV, Segmentation fault.
  0x00007ffff7deb0dc in _dl_fixup () from /lib64/ld-linux-x86-64.so.2

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

9 years agoAVX512: Implemented encoding and intrinsics for vshufps/d.
Igor Breger [Wed, 2 Sep 2015 10:50:58 +0000 (10:50 +0000)]
AVX512: Implemented encoding and intrinsics for vshufps/d.
Added tests for intrinsics and encoding.

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

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

9 years ago[LV] Don't bail to MiddleBlock if a runtime check fails, bail to ScalarPH instead
James Molloy [Wed, 2 Sep 2015 10:15:39 +0000 (10:15 +0000)]
[LV] Don't bail to MiddleBlock if a runtime check fails, bail to ScalarPH instead

We were bailing to two places if our runtime checks failed. If the initial overflow check failed, we'd go to ScalarPH. If any other check failed, we'd go to MiddleBlock. This caused us to have to have an extra PHI per induction and reduction as the vector loop's exit block was not dominated by its latch.

There's no need to have this behavior - if we just always go to ScalarPH we can get rid of a bunch of complexity.

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

9 years ago[LV] Move some code around slightly to make the intent of the function more clear.
James Molloy [Wed, 2 Sep 2015 10:15:32 +0000 (10:15 +0000)]
[LV] Move some code around slightly to make the intent of the function more clear.

NFC.

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

9 years ago[LV] Cleanup: Sink an IRBuilder closer to its uses.
James Molloy [Wed, 2 Sep 2015 10:15:27 +0000 (10:15 +0000)]
[LV] Cleanup: Sink an IRBuilder closer to its uses.

NFC.

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

9 years ago[LV] Refactor all runtime check emissions into helper functions.
James Molloy [Wed, 2 Sep 2015 10:15:22 +0000 (10:15 +0000)]
[LV] Refactor all runtime check emissions into helper functions.

This reduces the complexity of createEmptyBlock() and will open the door to further refactoring.

The test change is simply because we're now constant folding a trivial test.

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

9 years ago[LV] Pull creation of trip counts into a helper function.
James Molloy [Wed, 2 Sep 2015 10:15:16 +0000 (10:15 +0000)]
[LV] Pull creation of trip counts into a helper function.

... and do a tad of tidyup while we're at it. Because StartIdx must now be zero, there's no difference between Count and EndIdx.

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

9 years ago[LV] Factor the creation of the loop induction variable out of createEmptyLoop()
James Molloy [Wed, 2 Sep 2015 10:15:09 +0000 (10:15 +0000)]
[LV] Factor the creation of the loop induction variable out of createEmptyLoop()

It makes things easier to understand if this is in a helper method. This is part of my ongoing spaghetti-removal operation on createEmptyLoop.

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

9 years ago[LV] Never widen an induction variable.
James Molloy [Wed, 2 Sep 2015 10:15:05 +0000 (10:15 +0000)]
[LV] Never widen an induction variable.

There's no need to widen canonical induction variables. It's just as efficient to create a *new*, wide, induction variable.

Consider, if we widen an indvar, then we'll have to truncate it before its uses anyway (1 trunc). If we create a new indvar instead, we'll have to truncate that instead (1 trunc) [besides which IndVars should go and clean up our mess after us anyway on principle].

This lets us remove a ton of special-casing code.

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

9 years ago[LV] Switch to using canonical induction variables.
James Molloy [Wed, 2 Sep 2015 10:14:54 +0000 (10:14 +0000)]
[LV] Switch to using canonical induction variables.

Vectorized loops only ever have one induction variable. All induction PHIs from the scalar loop are rewritten to be in terms of this single indvar.

We were trying very hard to pick an indvar that already existed, even if that indvar wasn't canonical (didn't start at zero). But trying so hard is really fruitless - creating a new, canonical, indvar only results in one extra add in the worst case and that add is trivially easy to push through the PHI out of the loop by instcombine.

If we try and be less clever here and instead let instcombine clean up our mess (as we do in many other places in LV), we can remove unneeded complexity.

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

9 years ago[CMake] Don't use OBJLIB on Xcode.
NAKAMURA Takumi [Wed, 2 Sep 2015 10:11:26 +0000 (10:11 +0000)]
[CMake] Don't use OBJLIB on Xcode.

I got a few reports it didn't work.

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

9 years agoAVX-512: store <4 x i1> and <2 x i1> values in memory
Elena Demikhovsky [Wed, 2 Sep 2015 09:20:58 +0000 (09:20 +0000)]
AVX-512: store <4 x i1> and <2 x i1> values in memory
Enabled DAG pattern lowering for SKX with DQI predicate.

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

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

9 years agoOptimization for Gather/Scatter with uniform base
Elena Demikhovsky [Wed, 2 Sep 2015 08:39:13 +0000 (08:39 +0000)]
Optimization for Gather/Scatter with uniform base
Vector 'getelementptr' with scalar base is an opportunity for gather/scatter intrinsic to generate a better sequence.
While looking for uniform base, we want to use the scalar base pointer of GEP, if exists.

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

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

9 years agoMove createEliminateAvailableExternallyPass earlier in the pass pipeline
Yaron Keren [Wed, 2 Sep 2015 06:34:11 +0000 (06:34 +0000)]
Move createEliminateAvailableExternallyPass earlier in the pass pipeline
to save running many ModulePasses on available external functions that
are thrown away anyhow.

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

9 years ago[CodeGen] Fix FREM on 32-bit MSVC on x86
Vedant Kumar [Wed, 2 Sep 2015 01:31:58 +0000 (01:31 +0000)]
[CodeGen] Fix FREM on 32-bit MSVC on x86

Patch by Dylan McKay!

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

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

9 years ago[MC] Generate a timestamp for COFF object files
David Majnemer [Tue, 1 Sep 2015 23:46:11 +0000 (23:46 +0000)]
[MC] Generate a timestamp for COFF object files

The MS incremental linker seems to inspect the timestamp written into
the object file to determine whether or not it's contents need to be
considered.  Failing to set the timestamp to a date newer than the
executable will result in the object file not participating in
subsequent links.  To ameliorate this, write the current time into the
object file's TimeDateStamp field.

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

9 years ago[MC] Remove MCAssembler's copy of OS
David Majnemer [Tue, 1 Sep 2015 23:19:38 +0000 (23:19 +0000)]
[MC] Remove MCAssembler's copy of OS

We can just ask the ObjectWriter for it's stream instead of caching
around our own reference to it.  No functionality change is intended.

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

9 years ago[ARM] Don't abort on variable-idx extractelt in ReconstructShuffle.
Ahmed Bougacha [Tue, 1 Sep 2015 21:56:00 +0000 (21:56 +0000)]
[ARM] Don't abort on variable-idx extractelt in ReconstructShuffle.

The code introduced in r244314 assumed that EXTRACT_VECTOR_ELT only
takes constant indices, but it does accept variables.
Bail out for those: we can't use them, as the shuffles we want to
reconstruct do require constant masks.

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

9 years ago[MC] Add support for generating COFF CRCs
David Majnemer [Tue, 1 Sep 2015 21:23:58 +0000 (21:23 +0000)]
[MC] Add support for generating COFF CRCs

COFF sections are accompanied with an auxiliary symbol which includes a
checksum.  This checksum used to be filled with just zero but this seems
to upset LINK.exe when it is processing a /INCREMENTAL link job.
Instead, fill the CheckSum field with the JamCRC of the section
contents.  This matches MSVC's behavior.

This fixes PR19666.

N.B.  A rather simple implementation of JamCRC is given.  It implements
a byte-wise calculation using the method given by Sarwate.  There are
implementations with higher throughput like slice-by-eight and making
use of PCLMULQDQ.  We can switch to one of those techniques if it turns
out to be a significant use of time.

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

9 years agoMake trunk release notes point to 3.7, not 3.6
Nico Weber [Tue, 1 Sep 2015 21:10:56 +0000 (21:10 +0000)]
Make trunk release notes point to 3.7, not 3.6

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

9 years agorename "slow-unaligned-mem-under-32" to slow-unaligned-mem-16" (NFCI)
Sanjay Patel [Tue, 1 Sep 2015 20:51:51 +0000 (20:51 +0000)]
rename "slow-unaligned-mem-under-32" to slow-unaligned-mem-16" (NFCI)

This is a follow-on suggested by:
http://reviews.llvm.org/D12154 ( http://reviews.llvm.org/rL245729 )
http://reviews.llvm.org/D10662 ( http://reviews.llvm.org/rL245075 )

This makes the attribute name match most of the existing lowering logic
and regression test expectations.

But the current use of this attribute is inconsistent; see the FIXME
comment for "allowsMisalignedMemoryAccesses()". That change will
result in functional changes and should be coming soon.

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

9 years agogold-plugin: Implement parallel LTO code generation using llvm::splitCodeGen.
Peter Collingbourne [Tue, 1 Sep 2015 20:40:22 +0000 (20:40 +0000)]
gold-plugin: Implement parallel LTO code generation using llvm::splitCodeGen.

Parallelism can be enabled using a new plugin option, jobs=N, where N is
the number of code generation threads.

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

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

9 years agoRemove OutputBuffer.
Benjamin Kramer [Tue, 1 Sep 2015 18:25:34 +0000 (18:25 +0000)]
Remove OutputBuffer.

This was last used by the pre-MC object emitter and has been dead for
quite a while. We have better ways to emit endian-dependent stuff now.

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

9 years agoDeadArgElim: don't eliminate arguments from naked functions
Hans Wennborg [Tue, 1 Sep 2015 18:06:46 +0000 (18:06 +0000)]
DeadArgElim: don't eliminate arguments from naked functions

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

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

9 years agoNew bitcode linker flags:
Artem Belevich [Tue, 1 Sep 2015 17:55:55 +0000 (17:55 +0000)]
New bitcode linker flags:

-only-needed -- link in only symbols needed by destination module
-internalize -- internalize linked symbols

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

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

9 years ago[llvm-readobj] MachO -- correctly dump section field 'Reserved3'
Davide Italiano [Tue, 1 Sep 2015 16:29:02 +0000 (16:29 +0000)]
[llvm-readobj] MachO -- correctly dump section field 'Reserved3'

Before we incorrectly ignored it.

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

9 years ago[AArch64] Lower READCYCLECOUNTER using MRS PMCCTNR_EL0.
Ahmed Bougacha [Tue, 1 Sep 2015 16:23:45 +0000 (16:23 +0000)]
[AArch64] Lower READCYCLECOUNTER using MRS PMCCTNR_EL0.

This matches the ARM behavior. In both cases, the register is part
of the optional Performance Monitors extension, so, add the feature,
and enable it for the A-class processors we support.

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

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

9 years ago[MC] Allow MCObjectWriter's output stream to be swapped out
David Majnemer [Tue, 1 Sep 2015 16:19:03 +0000 (16:19 +0000)]
[MC] Allow MCObjectWriter's output stream to be swapped out

There are occasions where it is useful to consider the entirety of the
contents of a section.  For example, compressed debug info needs the
entire section available before it can compress it and write it out.
The compressed debug info scenario was previously implemented by
mirroring the implementation of writeSectionData in the ELFObjectWriter.

Instead, allow the output stream to be swapped on demand.  This lets
callers redirect the output stream to a more convenient location before
it hits the object file.

No functionality change is intended.

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

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

9 years agoAVX512: Implemented intrinsics for valign.
Igor Breger [Tue, 1 Sep 2015 15:27:18 +0000 (15:27 +0000)]
AVX512: Implemented intrinsics for valign.

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

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

9 years agouse CHECK-LABEL for more precision
Sanjay Patel [Tue, 1 Sep 2015 14:35:05 +0000 (14:35 +0000)]
use CHECK-LABEL for more precision

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

9 years ago[AArch64] Turn on by default interleaved access vectorization
Silviu Baranga [Tue, 1 Sep 2015 11:26:46 +0000 (11:26 +0000)]
[AArch64] Turn on by default interleaved access vectorization

Summary:
This change turns on by default interleaved access vectorization
for AArch64.

We also clean up some tests which were spedifically enabling this
behaviour.

Reviewers: rengolin

Subscribers: aemerson, llvm-commits, rengolin

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

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

9 years ago[ARM] Turn on by default interleaved access vectorization
Silviu Baranga [Tue, 1 Sep 2015 11:19:15 +0000 (11:19 +0000)]
[ARM] Turn on by default interleaved access vectorization

Summary:
This change turns on by default interleaved access vectorization on ARM,
as it has shown to be beneficial on ARM.

Reviewers: rengolin

Subscribers: aemerson, llvm-commits, rengolin

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

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

9 years ago[ARM][AArch64] Turn on by default interleaved access lowering
Silviu Baranga [Tue, 1 Sep 2015 11:12:35 +0000 (11:12 +0000)]
[ARM][AArch64] Turn on by default interleaved access lowering

Summary:
Interleaved access lowering removes a memory operation and a
sequence of vector shuffles and replaces it with a series of
memory operations. This should be always beneficial.

This pass in only enabled on ARM/AArch64.

Reviewers: rengolin

Subscribers: aemerson, llvm-commits, rengolin

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

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

9 years agoFix typo.
Yaron Keren [Tue, 1 Sep 2015 10:13:49 +0000 (10:13 +0000)]
Fix typo.

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

9 years agoObject: Fix COFF import file's symbols.
Rui Ueyama [Tue, 1 Sep 2015 06:01:53 +0000 (06:01 +0000)]
Object: Fix COFF import file's symbols.

If a symbol is marked as "data", the symbol should be exported
with __imp_ prefix. Previously, the symbol was exported as-is.

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

9 years agocmake: Error instead of warning and dropping invalid LLVM_USE_SANITIZER
Justin Bogner [Tue, 1 Sep 2015 05:45:07 +0000 (05:45 +0000)]
cmake: Error instead of warning and dropping invalid LLVM_USE_SANITIZER

Currently, if you call cmake with a typo in an LLVM_USE_SANITIZER
value, there's a cmake warning and the build goes on with no
sanitizers at all. This isn't a good behaviour, since cmake warnings
are fairly easy to miss and the resulting behaviour is that it looks
like the build is sanitizer clean.

Upgrade these warnings to errors so misconfigurations are more
obvious.

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

9 years agoEnable linking tools, shared libraries against libLLVM
Andrew Wilkins [Tue, 1 Sep 2015 03:14:31 +0000 (03:14 +0000)]
Enable linking tools, shared libraries against libLLVM

Summary:
Three closely related changes, to have a mode in which we link all
executables and shared libraries against libLLVM.

1. Add a new LLVM_LINK_LLVM_DYLIB cmake option, which, when ON, will link
   executables and shared libraries against libLLVM. For this to work, it
   is necessary to also set LLVM_BUILD_LLVM_DYLIB and LLVM_DYLIB_EXPORT_ALL.

   It is not strictly necessary to set LLVM_DISABLE_LLVM_DYLIB_ATEXIT, but
   we also default to OFF in this mode, or tools tend to misbehave (e.g.
   stdout may not flush on exit when output is buffered.)

   llvm-config and Tablegen do not use libLLVM, as they are dependencies of
   libLLVM.

2. Modify llvm-go to take a new flag, "linkmode=component-libs|dylib".
   Depending on which one is passed (default is component-libs), we link
   with the individual libraries or libLLVM respectively. We pass in dylib
   when LLVM_LINK_LLVM_DYLIB is ON.

3. Fix LLVM_DYLIB_EXPORT_ALL on Linux, and expand the symbols exported to
   actually export all. Don't strip leading underscore from symbols on Linux,
   and make sure we get all exported symbols and weak-with-default symbols
   ("W" in nm output). Without these changes, passes won't load because
   the "Annotate..." symbols defined in lib/Support/Valigrind.cpp are not
   found.

Testing:
 - Ran default build ("ninja") with LLVM, clang, compiler-rt, llgo, lldb.
 - Ran "check", "check-clang", "check-tsan", "check-libgo" targets. I've
   never had much success with LLDB tests, and llgoi is currently broken
   so check-llgo fails for an unrelated reason.
 - Ran "lldb" to ensure it loads.

Reviewers: chandlerc, beanz, pcc, rnk

Subscribers: rnk, chapuni, sylvestre.ledru, llvm-commits

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

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

9 years agoAMDGPU: Fix adding redundant implicit operands
Matt Arsenault [Tue, 1 Sep 2015 02:02:21 +0000 (02:02 +0000)]
AMDGPU: Fix adding redundant implicit operands

These are already added during the MachineInstr construction,
so this was adding the implicit registers twice.

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

9 years agoDistribute the weight on the edge from switch to default statement to edges generated...
Cong Hou [Tue, 1 Sep 2015 01:42:16 +0000 (01:42 +0000)]
Distribute the weight on the edge from switch to default statement to edges generated in lowering switch.

Currently, when edge weights are assigned to edges that are created when lowering switch statement, the weight on the edge to default statement (let's call it "default weight" here) is not considered. We need to distribute this weight properly. However, without value profiling, we have no idea how to distribute it. In this patch, I applied the heuristic that this weight is evenly distributed to successors.

For example, given a switch statement with cases 1,2,3,5,10,11,20, and every edge from switch to each successor has weight 10. If there is a binary search tree built to test if n < 10, then its two out-edges will have weight 4x10+10/2 = 45 and 3x10 + 10/2 = 35 respectively (currently they are 40 and 30 without considering the default weight). Each distribution (which is 5 here) will be stored in each SwitchWorkListItem for further distribution.

There are some exceptions:

For a jump table header which doesn't have any edge to default statement, we don't distribute the default weight to it.
For a bit test header which covers a contiguous range and hence has no edges to default statement, we don't distribute the default weight to it.
When the branch checks a single value or a contiguous range with no edge to default statement, we don't distribute the default weight to it.
In other cases, the default weight is evenly distributed to successors.

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

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

9 years agoremove unnecessary/conflicting target info
Sanjay Patel [Tue, 1 Sep 2015 00:27:36 +0000 (00:27 +0000)]
remove unnecessary/conflicting target info

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

9 years agofixed test to specify triple rather than arch and CPU
Sanjay Patel [Tue, 1 Sep 2015 00:25:23 +0000 (00:25 +0000)]
fixed test to specify triple rather than arch and CPU

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

9 years agoLTO: Cleanup parameter names and header docs, NFC
Duncan P. N. Exon Smith [Mon, 31 Aug 2015 23:44:06 +0000 (23:44 +0000)]
LTO: Cleanup parameter names and header docs, NFC

Follow LLVM style for the parameter names (`CamelCase` not `camelCase`),
and surface the header docs in doxygen.  No functionality change
intended.

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

9 years ago[DAGCombine] Fixup SETCC legality checking
Hal Finkel [Mon, 31 Aug 2015 23:15:04 +0000 (23:15 +0000)]
[DAGCombine] Fixup SETCC legality checking

SETCC is one of those special node types for which operation actions (legality,
etc.) is keyed off of an operand type, not the node's value type. This makes
sense because the value type of a legal SETCC node is determined by its
operands' value type (via the TLI function getSetCCResultType). When the
SDAGBuilder creates SETCC nodes, it either creates them with an MVT::i1 value
type, or directly with the value type provided by TLI.getSetCCResultType.

The first problem being fixed here is that DAGCombine had several places
querying TLI.isOperationLegal on SETCC, but providing the return of
getSetCCResultType, instead of the operand type directly. This does not mean
what the author thought, and "luckily", most in-tree targets have SETCC with
Custom lowering, instead of marking them Legal, so these checks return false
anyway.

The second problem being fixed here is that two of the DAGCombines could create
SETCC nodes with arbitrary (integer) value types; specifically, those that
would simplify:

  (setcc a, b, op1) and|or (setcc a, b, op2) -> setcc a, b, op3
     (which is possible for some combinations of (op1, op2))

If the operands of the and|or node are actual setcc nodes, then this is not an
issue (because the and|or must share the same type), but, the relevant code in
DAGCombiner::visitANDLike and DAGCombiner::visitORLike actually calls
DAGCombiner::isSetCCEquivalent on each operand, and that function will
recognise setcc-like select_cc nodes with other return types. And, thus, when
creating new SETCC nodes, we need to be careful to respect the value-type
constraint. This is even true before type legalization, because it is quite
possible for the SELECT_CC node to have a legal type that does not happen to
match the corresponding TLI.getSetCCResultType type.

To be explicit, there is nothing that later fixes the value types of SETCC
nodes (if the type is legal, but does not happen to match
TLI.getSetCCResultType). Creating SETCCs with an MVT::i1 value type seems to
work only because, either MVT::i1 is not legal, or it is what
TLI.getSetCCResultType returns if it is legal. Fixing that is a larger change,
however. For the time being, restrict the relevant transformations to produce
only SETCC nodes with a value type matching TLI.getSetCCResultType (or MVT::i1
prior to type legalization).

Fixes PR24636.

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

9 years agodon't set a legal vector type if we know we can't use that type (NFCI)
Sanjay Patel [Mon, 31 Aug 2015 22:59:03 +0000 (22:59 +0000)]
don't set a legal vector type if we know we can't use that type (NFCI)

Added benefit: the 'if' logic now matches the text of the comment that describes it.

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

9 years ago[BasicAA] Fix the handling of sext and zext in the analysis of GEPs.
Quentin Colombet [Mon, 31 Aug 2015 22:32:47 +0000 (22:32 +0000)]
[BasicAA] Fix the handling of sext and zext in the analysis of GEPs.
Hopefully this will end the GEPs saga!

This commit reverts r245394, i.e., it reapplies r221876 while incorporating the
fixes from D11847.
r221876 was not reapplied alone because it was not safe and D11847 was not
applied alone because it needs r221876 to produce correct results.

This should fix PR24596.

Original commit message for r221876:
Let's try this again...

This reverts r219432, plus a bug fix.

Description of the bug in r219432 (by Nick):

The bug was using AllPositive to break out of the loop; if the loop break
condition i != e is changed to i != e && AllPositive then the
test_modulo_analysis_with_global test I've added will fail as the Modulo will
be calculated incorrectly (as the last loop iteration is skipped, so Modulo
isn't updated with its Scale).

Nick also adds this comment:

ComputeSignBit is safe to use in loops as it takes into account phi nodes, and
the  == EK_ZeroEx check is safe in loops as, no matter how the variable changes
between iterations, zero-extensions will always guarantee a zero sign bit. The
isValueEqualInPotentialCycles check is therefore definitely not needed as all
the variable analysis holds no matter how the variables change between loop
iterations.

And this patch also adds another enhancement to GetLinearExpression - basically
to convert ConstantInts to Offsets (see test_const_eval and
test_const_eval_scaled for the situations this improves).

Original commit message:

This reverts r218944, which reverted r218714, plus a bug fix.

Description of the bug in r218714 (by Nick):

The original patch forgot to check if the Scale in VariableGEPIndex flipped the
sign of the variable. The BasicAA pass iterates over the instructions in the
order they appear in the function, and so BasicAliasAnalysis::aliasGEP is
called with the variable it first comes across as parameter GEP1. Adding a
%reorder label puts the definition of %a after %b so aliasGEP is called with %b
as the first parameter and %a as the second. aliasGEP later calculates that %a
== %b + 1 - %idxprom where %idxprom >= 0 (if %a was passed as the first
parameter it would calculate %b == %a - 1 + %idxprom where %idxprom >= 0) -
ignoring that %idxprom is scaled by -1 here lead the patch to incorrectly
conclude that %a > %b.

Revised patch by Nick White, thanks! Thanks to Lang to isolating the bug.
Slightly modified by me to add an early exit from the loop and avoid
unnecessary, but expensive, function calls.

Original commit message:

Two related things:

1. Fixes a bug when calculating the offset in GetLinearExpression. The code
   previously used zext to extend the offset, so negative offsets were converted
   to large positive ones.

2. Enhance aliasGEP to deduce that, if the difference between two GEP
   allocations is positive and all the variables that govern the offset are also
   positive (i.e. the offset is strictly after the higher base pointer), then
   locations that fit in the gap between the two base pointers are NoAlias.

Patch by Nick White!

Message from D11847:
Un-revert of r241981 and fix for PR23626. The 'Or' case of GetLinearExpression
delegates to 'Add' if possible, and if not it returns an Opaque value.
Unfortunately the Scale and Offsets weren't being set (and so defaulted to 0) -
and a scale of zero effectively removes the variable from the GEP instruction.
This meant that BasicAA would return MustAliases when it should have been
returning PartialAliases (and PR23626 was an example of the GVN pass using an
incorrect MustAlias to merge loads from what should have been different
pointers).

Differential Revision: http://reviews.llvm.org/D11847
Patch by Nick White <n.j.white@gmail.com>!

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

9 years agoWebAssembly: generate load/store
JF Bastien [Mon, 31 Aug 2015 22:24:11 +0000 (22:24 +0000)]
WebAssembly: generate load/store

Summary: This handles all load/store operations that WebAssembly defines, and handles those necessary for C++ such as i1. I left a FIXME for outstanding features which aren't required for now.

Reviewers: sunfish

Subscribers: jfb, llvm-commits, dschuff

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

9 years agoInfrastructure changes for Clang r246497.
Richard Smith [Mon, 31 Aug 2015 22:17:24 +0000 (22:17 +0000)]
Infrastructure changes for Clang r246497.

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

9 years agogeneralize helper function of MergeConsecutiveStores to handle vector types (NFCI)
Sanjay Patel [Mon, 31 Aug 2015 21:50:16 +0000 (21:50 +0000)]
generalize helper function of MergeConsecutiveStores to handle vector types (NFCI)

This was part of D7208 (r227242), but that commit was reverted because it exposed
a bug in AArch64 lowering. I should have that fixed and the rest of the commit
reinstated soon.

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

9 years agoRevert "[lit] Speculatively fix PR24554 by manually closing the process handle"
Reid Kleckner [Mon, 31 Aug 2015 21:42:02 +0000 (21:42 +0000)]
Revert "[lit] Speculatively fix PR24554 by manually closing the process handle"

This reverts commit r245946. It didn't help the problem:
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/9179/steps/run%20tests/logs/stdio
LINK : fatal error LNK1104: cannot open file

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

9 years agoFix bug in method LLLexer::FP80HexToIntPair
Karl Schimpf [Mon, 31 Aug 2015 21:36:14 +0000 (21:36 +0000)]
Fix bug in method LLLexer::FP80HexToIntPair

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

9 years agoFix Windows build by including raw_ostream.h
Hans Wennborg [Mon, 31 Aug 2015 21:19:18 +0000 (21:19 +0000)]
Fix Windows build by including raw_ostream.h

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

9 years agoFix CHECK directives that weren't checking.
Hans Wennborg [Mon, 31 Aug 2015 21:10:35 +0000 (21:10 +0000)]
Fix CHECK directives that weren't checking.

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

9 years agoRollback of commit "Repress sanitization on User dtor."
Naomi Musgrave [Mon, 31 Aug 2015 21:06:08 +0000 (21:06 +0000)]
Rollback of commit "Repress sanitization on User dtor."
This would have suppressed bug 24578, about use-after-
destroy on User and MDNode. Rolled back suppression for
the sake of code cleanliness, in preferance for bug
tracking to keep track of this issue.

This reverts commit 6ff2baabc4625d5b0a8dccf76aa0f72d930ea6c0.

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

9 years ago[DAGCombine] Use getSetCCResultType utility function
Hal Finkel [Mon, 31 Aug 2015 20:42:38 +0000 (20:42 +0000)]
[DAGCombine] Use getSetCCResultType utility function

DAGCombine has a utility wrapper around TLI's getSetCCResultType; use it in the
one place in DAGCombine still directly calling the TLI function. NFC.

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

9 years ago[x86] enable machine combiner reassociations for scalar 'or' insts
Sanjay Patel [Mon, 31 Aug 2015 20:27:03 +0000 (20:27 +0000)]
[x86] enable machine combiner reassociations for scalar 'or' insts

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

9 years ago[EH] Handle non-Function personalities like unknown personalities
Reid Kleckner [Mon, 31 Aug 2015 20:02:16 +0000 (20:02 +0000)]
[EH] Handle non-Function personalities like unknown personalities

Also delete and simplify a lot of MachineModuleInfo code that used to be
needed to handle personalities on landingpads.  Now that the personality
is on the LLVM Function, we no longer need to track it this way on MMI.
Certainly it should not live on LandingPadInfo.

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

9 years ago[FunctionAttr] Infer nonnull attributes on returns
Philip Reames [Mon, 31 Aug 2015 19:44:38 +0000 (19:44 +0000)]
[FunctionAttr] Infer nonnull attributes on returns

Teach FunctionAttr to infer the nonnull attribute on return values of functions which never return a potentially null value. This is done both via a conservative local analysis for the function itself and a optimistic per-SCC analysis. If no function in the SCC returns anything which could be null (other than values from other functions in the SCC), we can conclude no function returned a null pointer. Even if some function within the SCC returns a null pointer, we may be able to locally conclude that some don't.

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

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

9 years ago[llvm-readobj] Dump MachO Dysymtab command.
Davide Italiano [Mon, 31 Aug 2015 19:32:31 +0000 (19:32 +0000)]
[llvm-readobj] Dump MachO Dysymtab command.

Example output:

File: <stdin>
Format: Mach-O 64-bit x86-64
Arch: x86_64
AddressSize: 64bit
Dysymtab {

ilocalsym: 0
nlocalsym: 6
iextdefsym: 6
nextdefsym: 2
iundefsym: 8
nundefsym: 0
tocoff: 0
ntoc: 0
modtaboff: 0
nmodtab: 0
extrefsymoff: 0
nextrefsyms: 0
indirectsymoff: 0
nindirectsyms: 0
extreloff: 0
nextrel: 0
locreloff: 0
nlocrel: 0

}

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

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

9 years ago[AArch64][CollectLOH] Remove an invalid assertion and add a test case exposing it.
Quentin Colombet [Mon, 31 Aug 2015 19:02:00 +0000 (19:02 +0000)]
[AArch64][CollectLOH] Remove an invalid assertion and add a test case exposing it.

rdar://problem/22491525

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

9 years ago[libFuzzer] update the docs to mention llvm-as-fuzzer
Kostya Serebryany [Mon, 31 Aug 2015 18:57:24 +0000 (18:57 +0000)]
[libFuzzer] update the docs to mention llvm-as-fuzzer

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

9 years agoUndo reversion on commit: Revert "Revert "Repress sanitization on User dtor.
Naomi Musgrave [Mon, 31 Aug 2015 18:49:31 +0000 (18:49 +0000)]
Undo reversion on commit: Revert "Revert "Repress sanitization on User dtor.
Modify msan macros for applying attribute""

This reverts commit 020e70a79878c96457e6882bcdfaf6628baf32b7.

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

9 years ago[DAGCombine] Remove some old dead code for forming SETCC nodes
Hal Finkel [Mon, 31 Aug 2015 18:38:55 +0000 (18:38 +0000)]
[DAGCombine] Remove some old dead code for forming SETCC nodes

This code was dead when it was committed in r23665 (Oct 7, 2005), and before it
reaches its 10th anniversary, it really should go. We can always bring it back
if we'd like, but it forms more SETCC nodes, and the way we do legality
checking on SETCC nodes is wrong in a number of places, and removing this means
fewer places to fix. NFC.

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

9 years ago[LazyValueInfo] Look through Phi nodes when trying to prove a predicate
Philip Reames [Mon, 31 Aug 2015 18:31:48 +0000 (18:31 +0000)]
[LazyValueInfo] Look through Phi nodes when trying to prove a predicate

If asked to prove a predicate about a value produced by a PHI node, LazyValueInfo was unable to do so even if the predicate was known to be true for each input to the PHI. This prevented JumpThreading from eliminating a provably redundant branch.

The problematic test case looks something like this:
ListNode *p = ...;
while (p != null) {
  if (!p) return;
  x = g->x; // unrelated
  p = p->next
}

The null check at the top of the loop is redundant since the value of 'p' is null checked on entry to the loop and before executing the backedge. This resulted in us a) executing an extra null check per iteration and b) not being able to LICM unrelated loads after the check since we couldn't prove they would execute or that their dereferenceability wasn't effected by the null check on the first iteration.

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

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

9 years agoRework of the new interface for shrink wrapping
Kit Barton [Mon, 31 Aug 2015 18:26:45 +0000 (18:26 +0000)]
Rework of the new interface for shrink wrapping

Based on comments from Hal
(http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150810/292978.html),
I've changed the interface to add a callback mechanism to the
TargetFrameLowering class to query whether the specific target
supports shrink wrapping.  By default, shrink wrapping is disabled by
default. Each target can override the default behaviour using the
TargetFrameLowering::targetSupportsShrinkWrapping() method. Shrink
wrapping can still be explicitly enabled or disabled from the command
line, using the existing -enable-shrink-wrap=<true|false> option.

Phabricator: http://reviews.llvm.org/D12293

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

9 years agoAArch64: Fix loads to lower NEON vector lanes using GPR registers
Matthias Braun [Mon, 31 Aug 2015 18:25:15 +0000 (18:25 +0000)]
AArch64: Fix loads to lower NEON vector lanes using GPR registers

The ISelLowering code turned insertion turned the element for the
lowest lane of a BUILD_VECTOR into an INSERT_SUBREG, this prohibited
the patterns for SCALAR_TO_VECTOR(Load) to match later. Restrict this
to cases without a load argument.

Reported in rdar://22223823

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

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