OSDN Git Service

android-x86/external-llvm.git
7 years ago[X86] Fix header comment. NFC
Craig Topper [Tue, 3 Jan 2017 05:46:05 +0000 (05:46 +0000)]
[X86] Fix header comment. NFC

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

7 years ago[AVX-512] Add support for pushing bitcasts through INSERT_SUBVEC in order to select...
Craig Topper [Tue, 3 Jan 2017 05:46:02 +0000 (05:46 +0000)]
[AVX-512] Add support for pushing bitcasts through INSERT_SUBVEC in order to select a masked operation.

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

7 years ago[AVX-512] Remove vinsert intrinsics and autoupgrade to native shufflevectors. There...
Craig Topper [Tue, 3 Jan 2017 05:45:57 +0000 (05:45 +0000)]
[AVX-512] Remove vinsert intrinsics and autoupgrade to native shufflevectors. There are some codegen problems here that I'll try to fix in future commits.

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

7 years ago[AVX-512] Remove vextract intrinsics and autoupgrade to native shufflevectors. This...
Craig Topper [Tue, 3 Jan 2017 05:45:46 +0000 (05:45 +0000)]
[AVX-512] Remove vextract intrinsics and autoupgrade to native shufflevectors. This unfortunately generates some really terrible code without VLX support due to v2i1 and v4i1 not being legal.

Hopefully we can improve that in future patches.

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

7 years agoInstCombine: Add fma with constant transforms
Matt Arsenault [Tue, 3 Jan 2017 04:32:35 +0000 (04:32 +0000)]
InstCombine: Add fma with constant transforms

DAGCombine already does these.

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

7 years agoInstCombine: Add fma + fabs/fneg transforms
Matt Arsenault [Tue, 3 Jan 2017 04:32:31 +0000 (04:32 +0000)]
InstCombine: Add fma + fabs/fneg transforms

fma (fneg x), (fneg y), z -> fma x, y, z
fma (fabs x), (fabs x), z -> fma x, x, z

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

7 years ago[XRay] Merge instrumentation point table emission code into AsmPrinter.
Dean Michael Berris [Tue, 3 Jan 2017 04:30:21 +0000 (04:30 +0000)]
[XRay] Merge instrumentation point table emission code into AsmPrinter.

Summary:
No need to have this per-architecture.  While there, unify 32-bit ARM's
behaviour with what changed elsewhere and start function names lowercase
as per the coding standards.  Individual entry emission code goes to the
entry's own class.

Fully tested on amd64, cross-builds on both ARMs and PowerPC.

Reviewers: dberris

Subscribers: aemerson, llvm-commits

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

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

7 years ago[EarlyCSE] less else, more auto; NFC
Sanjay Patel [Tue, 3 Jan 2017 00:16:24 +0000 (00:16 +0000)]
[EarlyCSE] less else, more auto; NFC

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

7 years ago[InstCombine] use combineMetadataForCSE instead of copying it; NFCI
Sanjay Patel [Mon, 2 Jan 2017 23:25:28 +0000 (23:25 +0000)]
[InstCombine] use combineMetadataForCSE instead of copying it; NFCI

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

7 years ago[CMake] Set HAVE_${runtime} before including any subdirectories
Chris Bieneman [Mon, 2 Jan 2017 20:33:33 +0000 (20:33 +0000)]
[CMake] Set HAVE_${runtime} before including any subdirectories

This should allow us to avoid most order dependence in the runtime library configurations.

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

7 years agoMake sure total loop body weight is preserved in loop peeling
Xin Tong [Mon, 2 Jan 2017 20:27:23 +0000 (20:27 +0000)]
Make sure total loop body weight is preserved in loop peeling

Summary:
Regardless how the loop body weight is distributed, we should preserve
total loop body weight. i.e. we should have same weight reaching the body of the loop
or its duplicates in peeled and unpeeled case.

Reviewers: mkuper, davidxl, anemet

Subscribers: llvm-commits

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

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

7 years ago[cmake] Normalize LLVM_ENABLE_DIA_SDK to fix Windows tests
Michal Gorny [Mon, 2 Jan 2017 20:22:45 +0000 (20:22 +0000)]
[cmake] Normalize LLVM_ENABLE_DIA_SDK to fix Windows tests

Attempts to fix Windows build breakage caused by r290818.

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

7 years agoNewGVN: Add a test case for equivalent phis.
Daniel Berlin [Mon, 2 Jan 2017 19:55:13 +0000 (19:55 +0000)]
NewGVN: Add a test case for equivalent phis.

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

7 years agoNewGVN: Add forgotten testcase for PR 31483
Daniel Berlin [Mon, 2 Jan 2017 19:49:20 +0000 (19:49 +0000)]
NewGVN: Add forgotten testcase for PR 31483

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

7 years agoNewGVN: Clean up after removing possibility of null expressions.
Daniel Berlin [Mon, 2 Jan 2017 19:49:17 +0000 (19:49 +0000)]
NewGVN: Clean up after removing possibility of null expressions.

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

7 years agofix typo; NFC
Sanjay Patel [Mon, 2 Jan 2017 19:05:11 +0000 (19:05 +0000)]
fix typo; NFC

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

7 years ago[ValueTracking] remove stale comments; NFC
Sanjay Patel [Mon, 2 Jan 2017 19:04:07 +0000 (19:04 +0000)]
[ValueTracking] remove stale comments; NFC

The checks were improved with:
https://reviews.llvm.org/rL290194

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

7 years ago[NewGVN] Fold single-use variable inside the assertion.
Davide Italiano [Mon, 2 Jan 2017 19:03:16 +0000 (19:03 +0000)]
[NewGVN] Fold single-use variable inside the assertion.

It placates some bots which complain because they compile the
assertion out and think the variable is unused.

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

7 years ago[NewGVN] Restore old code to placate buildbots.
Davide Italiano [Mon, 2 Jan 2017 18:41:34 +0000 (18:41 +0000)]
[NewGVN] Restore old code to placate buildbots.

Apparently my suggestion of using ternary doesn't really work
as clang complains about incompatible types on LHS and RHS. Some
GCC versions happen to accept the code but clang behaviour is
correct here.

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

7 years agoNewGVN: Fix some formatting and comment issues
Daniel Berlin [Mon, 2 Jan 2017 18:22:38 +0000 (18:22 +0000)]
NewGVN: Fix some formatting and comment issues

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

7 years ago[cmake] Add LLVM_ENABLE_DIA_SDK option, and expose it in LLVMConfig
Michal Gorny [Mon, 2 Jan 2017 18:19:35 +0000 (18:19 +0000)]
[cmake] Add LLVM_ENABLE_DIA_SDK option, and expose it in LLVMConfig

Add an explicit LLVM_ENABLE_DIA_SDK option to control building support
for DIA SDK-based debugging. Control its value to match whether DIA SDK
support was found and expose it in LLVMConfig (alike LLVM_ENABLE_ZLIB).

Its value is needed for LLDB to determine whether to run tests requiring
DIA support. Currently it is obtained from llvm/Config/config.h;
however, this file is not available for standalone builds. Following
this change, LLDB will be modified to use the value from LLVMConfig.

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

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

7 years agoEmit .cfi_sections before the first .cfi_startproc
Joerg Sonnenberger [Mon, 2 Jan 2017 18:05:27 +0000 (18:05 +0000)]
Emit .cfi_sections before the first .cfi_startproc

GNU as rejects input where .cfi_sections is used after .cfi_startproc,
if the new section differs from the old. Adjust our output to always
emit .cfi_sections before the first .cfi_startproc to minimize necessary
code.

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

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

7 years agoNewGVN: Add UnknownExpression and create them for things we can't symbolize. Kill...
Daniel Berlin [Mon, 2 Jan 2017 18:00:53 +0000 (18:00 +0000)]
NewGVN: Add UnknownExpression and create them for things we can't symbolize. Kill fragile machinery for handling null expressions.

Summary:
This avoids the very fragile code for null expressions. We could also use a denseset that tracks which things have null expressions instead, but that seems pretty fragile and premature optimization.

This resolves a number of infinite loop cases, test reductions coming.

Reviewers: davide

Subscribers: llvm-commits

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

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

7 years agoNewGVN: Fix PR31480, PR31483, PR31499, by rewriting how memory congruence handling...
Daniel Berlin [Mon, 2 Jan 2017 18:00:46 +0000 (18:00 +0000)]
NewGVN: Fix PR31480, PR31483, PR31499, by rewriting how memory congruence handling works.

Summary: Previously, we tried to fix up the equivalences during symbolic evaluation.  This does not work. Now, we change the equivalences during congruence finding, where it belongs.  We also initialize the equivalence table to give a maximal answer.

Reviewers: davide

Subscribers: llvm-commits

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

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

7 years ago[PMBuilder] Remove RunFloat2Int cl::opt.
Davide Italiano [Mon, 2 Jan 2017 17:49:18 +0000 (17:49 +0000)]
[PMBuilder] Remove RunFloat2Int cl::opt.

The pass has been on by default for a long time without problems.

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

7 years agoFixed shuffle-reverse cost on AVX-512.
Elena Demikhovsky [Mon, 2 Jan 2017 11:44:10 +0000 (11:44 +0000)]
Fixed shuffle-reverse cost on AVX-512.

(This changed was approved in https://reviews.llvm.org/D28118, but Simon asked to submit it separately).

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

7 years agoAVX-512 Loop Vectorizer: Cost calculation for interleave load/store patterns.
Elena Demikhovsky [Mon, 2 Jan 2017 10:37:52 +0000 (10:37 +0000)]
AVX-512 Loop Vectorizer: Cost calculation for interleave load/store patterns.

X86 target does not provide any target specific cost calculation for interleave patterns.It uses the common target-independent calculation, which gives very high numbers. As a result, the scalar version is chosen in many cases. The situation on AVX-512 is even worse, since we have 3-src shuffles that significantly reduce the cost.

In this patch I calculate the cost on AVX-512. It will allow to compare interleave pattern with gather/scatter and choose a better solution (PR31426).

* Shiffle-broadcast cost will be changed in Simon's upcoming patch.

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

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

7 years agoReapply "[CodeGen] Fix invalid DWARF info on Win64"
Keno Fischer [Mon, 2 Jan 2017 03:00:19 +0000 (03:00 +0000)]
Reapply "[CodeGen] Fix invalid DWARF info on Win64"

This reapplies rL289013 (reverted in rL289014) with the fixes identified
in D21731. Should hopefully pass the buildbots this time.

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

7 years ago[InstCombine] add explanatory comment to test; NFC
Sanjay Patel [Sun, 1 Jan 2017 18:20:49 +0000 (18:20 +0000)]
[InstCombine] add explanatory comment to test; NFC

The test was added at r290797, and a patch to enable the transform is proposed in D28204.

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

7 years ago[InstCombine] add test to show potential nonnull attribute propagation; NFC
Sanjay Patel [Sun, 1 Jan 2017 17:18:00 +0000 (17:18 +0000)]
[InstCombine] add test to show potential nonnull attribute propagation; NFC

This will change with the current draft of:
https://reviews.llvm.org/D28204

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

7 years ago[selectiondag] Check PromotedFloats map during expansive checks.
Florian Hahn [Sun, 1 Jan 2017 13:58:27 +0000 (13:58 +0000)]
[selectiondag] Check PromotedFloats map during expansive checks.

Summary:
`PromotedFloats` needs to be checked in
`DAGTypeLegalizer::PerformExpensiveChecks`. This patch fixes a few type
legalization failures with expansive checks for ARM fp16 tests.

Reviewers: baldrick, bogner, arsenm

Subscribers: arsenm, aemerson, llvm-commits

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

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

7 years agoFix an issue with isGuaranteedToTransferExecutionToSuccessor
Sanjoy Das [Sat, 31 Dec 2016 22:12:34 +0000 (22:12 +0000)]
Fix an issue with isGuaranteedToTransferExecutionToSuccessor

I'm not sure if this was intentional, but today
isGuaranteedToTransferExecutionToSuccessor returns true for readonly and
argmemonly calls that may throw.  This commit changes the function to
not implicitly infer nounwind this way.

Even if we eventually specify readonly calls as not throwing,
isGuaranteedToTransferExecutionToSuccessor is not the best place to
infer that.  We should instead teach FunctionAttrs or some other such
pass to tag readonly functions / calls as nounwind instead.

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

7 years agoAvoid const_cast; NFC
Sanjoy Das [Sat, 31 Dec 2016 22:12:31 +0000 (22:12 +0000)]
Avoid const_cast; NFC

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

7 years ago[ValueTracking] add tests for known-nonnull-at; NFC
Sanjay Patel [Sat, 31 Dec 2016 19:23:26 +0000 (19:23 +0000)]
[ValueTracking] add tests for known-nonnull-at; NFC

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

7 years ago[Inliner] remove unnecessary null checks from AddAlignmentAssumptions(); NFCI
Sanjay Patel [Sat, 31 Dec 2016 17:54:05 +0000 (17:54 +0000)]
[Inliner] remove unnecessary null checks from AddAlignmentAssumptions(); NFCI

We bail out on the 1st line if the assumption cache is not set, so there's
no need to check it after that.

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

7 years ago[ValueTracking] make dominator tree requirement explicit for isKnownNonNullFromDomina...
Sanjay Patel [Sat, 31 Dec 2016 17:37:01 +0000 (17:37 +0000)]
[ValueTracking] make dominator tree requirement explicit for isKnownNonNullFromDominatingCondition(); NFCI

I don't think this hole is currently exposed, but I crashed regression tests for
jump-threading and loop-vectorize after I added calls to isKnownNonNullAt() in
InstSimplify as part of trying to solve PR28430:
https://llvm.org/bugs/show_bug.cgi?id=28430

That's because they call into value tracking with a context instruction, but no
other parts of the query structure filled in.

For more background, see the discussion in:
https://reviews.llvm.org/D27855

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

7 years agoNewGVN: Print out DefiningAccess for both loads and stores when debugging.
Daniel Berlin [Sat, 31 Dec 2016 07:34:36 +0000 (07:34 +0000)]
NewGVN: Print out DefiningAccess for both loads and stores when debugging.

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

7 years ago[SmallPtrSet] Introduce a find primitive and rewrite count/erase in terms of it
Philip Reames [Sat, 31 Dec 2016 02:33:22 +0000 (02:33 +0000)]
[SmallPtrSet] Introduce a find primitive and rewrite count/erase in terms of it

This was originally motivated by a compile time problem I've since figured out how to solve differently, but the cleanup seemed useful. We had the same logic - which essentially implemented find - in several places. By commoning them out, I can implement find and allow erase to be inlined at the call sites if profitable.

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

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

7 years ago[AVR] Optimize 16-bit ANDs with '1'
Dylan McKay [Sat, 31 Dec 2016 01:07:14 +0000 (01:07 +0000)]
[AVR]  Optimize 16-bit ANDs with '1'

Summary: Fixes PR 31345

Reviewers: dylanmckay

Subscribers: fhahn, llvm-commits

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

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

7 years ago[InstCombine][AVX-512] Teach InstCombine that llvm.x86.avx512.vcomi.sd and llvm.x86...
Craig Topper [Sat, 31 Dec 2016 00:45:06 +0000 (00:45 +0000)]
[InstCombine][AVX-512] Teach InstCombine that llvm.x86.avx512.vcomi.sd and llvm.x86.avx512.vcomi.ss don't use the upper elements of their input.

This was already done for the SSE/SSE2 version of the intrinsics.

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

7 years ago[InstCombine][AVX-512] When turning intrinsics with masking into native IR, don't...
Craig Topper [Fri, 30 Dec 2016 23:06:28 +0000 (23:06 +0000)]
[InstCombine][AVX-512] When turning intrinsics with masking into native IR, don't emit a select if the mask is known to be all ones.

This saves InstCombine the burden of having to optimize the select later.

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

7 years ago[X86][AVX512DQ] Add truncated math tests for AVX512DQ.
Simon Pilgrim [Fri, 30 Dec 2016 22:43:41 +0000 (22:43 +0000)]
[X86][AVX512DQ] Add truncated math tests for AVX512DQ.

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

7 years ago[X86][SSE] Fix truncated math test names.
Simon Pilgrim [Fri, 30 Dec 2016 22:40:32 +0000 (22:40 +0000)]
[X86][SSE] Fix truncated math test names.

Inconsistent naming convention and wrong name for some input/output types.

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

7 years ago[X86][AVX512] Regenerate test - missing shuffle comments
Simon Pilgrim [Fri, 30 Dec 2016 22:31:33 +0000 (22:31 +0000)]
[X86][AVX512] Regenerate test - missing shuffle comments

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

7 years agoAdd a comment for a todo in LoopUnroll post cleanup
Philip Reames [Fri, 30 Dec 2016 22:10:19 +0000 (22:10 +0000)]
Add a comment for a todo in LoopUnroll post cleanup

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

7 years ago[LVI] Remove count/erase idiom in favor of checking result value of erase
Philip Reames [Fri, 30 Dec 2016 22:09:10 +0000 (22:09 +0000)]
[LVI] Remove count/erase idiom in favor of checking result value of erase

Minor compile time win.  Avoids an additional O(N) scan in the case where we are removing an element and costs nothing when we aren't.

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

7 years ago[doc] Clarify steps for contributors without commit access.
Florian Hahn [Fri, 30 Dec 2016 21:28:30 +0000 (21:28 +0000)]
[doc] Clarify steps for contributors without commit access.

Summary: Update the Phabricator docs to clarify how changes are merged for contributors without commit access.

Reviewers: delcypher, aaron.ballman

Subscribers: aaron.ballman, anmol, llvm-commits

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

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

7 years agoDebugInfo: change the PDB UniqueId type to uint8_t
Saleem Abdulrasool [Fri, 30 Dec 2016 19:42:13 +0000 (19:42 +0000)]
DebugInfo: change the PDB UniqueId type to uint8_t

Since we type-erase the Windows GUID structure, use unsigned bytes
rather than char, which may be signed (-fsigned-char).  NFC

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

7 years ago[MemDep] Handle gep with zeros for invariant.group
Piotr Padlewski [Fri, 30 Dec 2016 18:45:07 +0000 (18:45 +0000)]
[MemDep] Handle gep with zeros for invariant.group

Summary:
gep 0, 0 is equivalent to bitcast. LLVM canonicalizes it
to getelementptr because it make SROA can then handle it.

Simple case like

    void g(A &a) {
        z(a);
        if (glob)
            a.foo();
    }
    void testG() {
        A a;
        g(a);
    }

was not devirtualized with -fstrict-vtable-pointers because luck of
handling for gep 0 in Memory Dependence Analysis

Reviewers: dberlin, nlewycky, chandlerc

Subscribers: llvm-commits

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

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

7 years ago[CVP] Adjust iteration order to reduce the amount of work required
Philip Reames [Fri, 30 Dec 2016 18:00:55 +0000 (18:00 +0000)]
[CVP] Adjust iteration order to reduce the amount of work required

CVP doesn't care about the order of blocks visited, but by using a pre-order traversal over the graph we can a) not visit unreachable blocks and b) optimize as we go so that analysis of later blocks produce slightly more precise results.

I noticed this via inspection and don't have a concrete example which points to the issue.

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

7 years ago[LVI] Manually hoist computation from loop
Philip Reames [Fri, 30 Dec 2016 17:56:47 +0000 (17:56 +0000)]
[LVI] Manually hoist computation from loop

Minor compile time win.  Not known to be a hot spot, just something I noticed while reading.

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

7 years agoCaught a simple typo. I do not know of a way to test this, but it seems like an unlik...
Aaron Ballman [Fri, 30 Dec 2016 15:57:56 +0000 (15:57 +0000)]
Caught a simple typo. I do not know of a way to test this, but it seems like an unlikely thing to regress in the future.

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

7 years ago[NewGVN] Remove unneeded newline from assertion message.
Davide Italiano [Fri, 30 Dec 2016 15:01:17 +0000 (15:01 +0000)]
[NewGVN] Remove unneeded newline from assertion message.

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

7 years ago[ADT] Fix for compilation error when operator++(int) (post-increment function) of...
Abhilash Bhandari [Fri, 30 Dec 2016 12:34:36 +0000 (12:34 +0000)]
[ADT] Fix for compilation error when operator++(int) (post-increment function) of SmallPtrSetIterator is used.
The bug was introduced in r289619.

Reviewers: Mehdi Amini

Subscribers: llvm-commits

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

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

7 years ago[InstCombine] Address post-commit feedback
David Majnemer [Fri, 30 Dec 2016 03:36:17 +0000 (03:36 +0000)]
[InstCombine] Address post-commit feedback

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

7 years agoFix test change in r290736: restore index generation
Mehdi Amini [Fri, 30 Dec 2016 01:15:50 +0000 (01:15 +0000)]
Fix test change in r290736: restore index generation

I remove one extra line, but because annoyingly llvm-lit does not
clean the output directory before running the test, it didn't fail
locally (the file was present from a previous run).

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

7 years ago[libFuzzer] cleaner implementation of -print_pcs=1
Kostya Serebryany [Fri, 30 Dec 2016 01:13:07 +0000 (01:13 +0000)]
[libFuzzer] cleaner implementation of -print_pcs=1

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

7 years ago[LICM] When promoting scalars, allow inserting stores to thread-local allocas.
Michael Kuperstein [Fri, 30 Dec 2016 01:03:17 +0000 (01:03 +0000)]
[LICM] When promoting scalars, allow inserting stores to thread-local allocas.

This is similar to the allocfn case - if an alloca is not captured, then it's
necessarily thread-local.

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

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

7 years agoUse continuous boosting factor for complete unroll.
Dehao Chen [Fri, 30 Dec 2016 00:50:28 +0000 (00:50 +0000)]
Use continuous boosting factor for complete unroll.

Summary:
The current loop complete unroll algorithm checks if unrolling complete will reduce the runtime by a certain percentage. If yes, it will apply a fixed boosting factor to the threshold (by discounting cost). The problem for this approach is that the threshold abruptly. This patch makes the boosting factor a function of runtime reduction percentage, capped by a fixed threshold. In this way, the threshold changes continuously.

The patch also simplified the code by reducing one parameter in UP.

The patch only affects code-gen of two speccpu2006 benchmark:

445.gobmk binary size decreases 0.08%, no performance change.
464.h264ref binary size increases 0.24%, no performance change.

Reviewers: mzolotukhin, chandlerc

Subscribers: llvm-commits

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

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

7 years agoReplace test from using llvm-lto to use llvm-link (NFC)
Mehdi Amini [Fri, 30 Dec 2016 00:45:26 +0000 (00:45 +0000)]
Replace test from using llvm-lto to use llvm-link (NFC)

Some incoming changes in ThinLTO will break this test.
Instead of relying on the heuristic to import, we
force the importing to happen with llvm-link.

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

7 years ago[LICM] Remove unneeded tracking of whether changes were made. NFC.
Michael Kuperstein [Fri, 30 Dec 2016 00:43:22 +0000 (00:43 +0000)]
[LICM] Remove unneeded tracking of whether changes were made. NFC.

"Changed" doesn't actually change within the loop, so there's
no reason to keep track of it - we always return false during
analysis and true after the transformation is made.

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

7 years ago[LICM] Make logic in promoteLoopAccessesToScalars easier to follow. NFC.
Michael Kuperstein [Fri, 30 Dec 2016 00:39:00 +0000 (00:39 +0000)]
[LICM] Make logic in promoteLoopAccessesToScalars easier to follow. NFC.

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

7 years ago[InstCombine] More thoroughly canonicalize the position of zexts
David Majnemer [Fri, 30 Dec 2016 00:28:58 +0000 (00:28 +0000)]
[InstCombine] More thoroughly canonicalize the position of zexts

We correctly canonicalized (add (sext x), (sext y)) to (sext (add x, y))
where possible.  However, we didn't perform the same canonicalization
for zexts or for muls.

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

7 years ago[AVR] Optimize 16-bit ORs with '0'
Dylan McKay [Fri, 30 Dec 2016 00:21:56 +0000 (00:21 +0000)]
[AVR] Optimize 16-bit ORs with '0'

Summary: Fixes PR 31344

Authored by Anmol P. Paralkar

Reviewers: dylanmckay

Subscribers: fhahn, llvm-commits

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

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

7 years agoSimplify FunctionLoweringInfo.cpp with range for loops
Reid Kleckner [Fri, 30 Dec 2016 00:21:38 +0000 (00:21 +0000)]
Simplify FunctionLoweringInfo.cpp with range for loops

I'm preparing to add some pattern matching code here, so simplify the
code before I do. NFC

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

7 years agoInclude <algorithm> for std::max etc
Reid Kleckner [Fri, 30 Dec 2016 00:15:40 +0000 (00:15 +0000)]
Include <algorithm> for std::max etc

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

7 years ago[LICM] Compute exit blocks for promotion eagerly. NFC.
Michael Kuperstein [Thu, 29 Dec 2016 23:11:19 +0000 (23:11 +0000)]
[LICM] Compute exit blocks for promotion eagerly. NFC.

This moves the exit block and insertion point computation to be eager,
instead of after seeing the first scalar we can promote.

The cost is relatively small (the computation happens anyway, see discussion
on D28147), and the code is easier to follow, and can bail out earlier
if there's a catchswitch present.

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

7 years ago[LICM] Don't try to promote in loops where we have no chance to promote. NFC.
Michael Kuperstein [Thu, 29 Dec 2016 22:51:22 +0000 (22:51 +0000)]
[LICM] Don't try to promote in loops where we have no chance to promote. NFC.

We would check whether we have a prehader *or* dedicated exit blocks,
and go into the promotion loop. Then, for each alias set we'd check
if we have a preheader *and* dedicated exit blocks, and bail if not.

Instead, bail immediately if we don't have both.

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

7 years ago[LICM] Only recompute LCSSA when we actually promoted something.
Michael Kuperstein [Thu, 29 Dec 2016 22:37:13 +0000 (22:37 +0000)]
[LICM] Only recompute LCSSA when we actually promoted something.

We want to recompute LCSSA only when we actually promoted a value.
This means we only need to look at changes made by promotion when
deciding whether to recompute it or not, not at regular sinking/hoisting.

(This was what the code was documented as doing, just not what it did)

Hopefully NFC.

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

7 years agoNewGVN: Fix PR 31491 by ensuring that we touch the right instructions. Change to...
Daniel Berlin [Thu, 29 Dec 2016 22:15:12 +0000 (22:15 +0000)]
NewGVN: Fix PR 31491 by ensuring that we touch the right instructions.  Change to one based numbering so we can assert we don't cause the same bug again.

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

7 years ago[Analysis] Remove repeated text from a comment. NFC
Craig Topper [Thu, 29 Dec 2016 21:48:28 +0000 (21:48 +0000)]
[Analysis] Remove repeated text from a comment. NFC

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

7 years agoFix indentation in r290716.
Bryant Wong [Thu, 29 Dec 2016 20:05:51 +0000 (20:05 +0000)]
Fix indentation in r290716.

Use two-space indentation like the rest of the file.

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

7 years ago[ADT] Rewrite IntrusiveRefCntPtr's comments. NFC
Justin Lebar [Thu, 29 Dec 2016 19:59:38 +0000 (19:59 +0000)]
[ADT] Rewrite IntrusiveRefCntPtr's comments. NFC

Edit for voice, and also add examples.  In particular, add an
explanation for why you might want to specialize IntrusiveRefCntPtrInfo,
which is not obvious.

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

7 years ago[ADT] Rename RefCountedBase::ref_cnt to RefCount. NFC
Justin Lebar [Thu, 29 Dec 2016 19:59:34 +0000 (19:59 +0000)]
[ADT] Rename RefCountedBase::ref_cnt to RefCount.  NFC

This makes it comply with the LLVM style guide, and also makes it
consistent with ThreadSafeRefCountedBase below.

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

7 years ago[ADT] clang-format IntrusiveRefCntrPtr.h. NFC
Justin Lebar [Thu, 29 Dec 2016 19:59:30 +0000 (19:59 +0000)]
[ADT] clang-format IntrusiveRefCntrPtr.h. NFC

This file had some strange indentation.

Also remove some unnecessary whitespace between one-line member
functions.

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

7 years ago[ADT] Delete RefCountedBaseVPTR.
Justin Lebar [Thu, 29 Dec 2016 19:59:26 +0000 (19:59 +0000)]
[ADT] Delete RefCountedBaseVPTR.

Summary:
This class is unnecessary.

Its comment indicated that it was a compile error to allocate an
instance of a class that inherits from RefCountedBaseVPTR on the stack.
This may have been true at one point, but it's not today.

Moreover you really do not want to allocate *any* refcounted object on
the stack, vptrs or not, so if we did have a way to prevent these
objects from being stack-allocated, we'd want to apply it to regular
RefCountedBase too, obviating the need for a separate RefCountedBaseVPTR
class.

It seems that the main way RefCountedBaseVPTR provides safety is by
making its subclass's destructor virtual.  This may have been helpful at
one point, but these days clang will emit an error if you define a class
with virtual functions that inherits from RefCountedBase but doesn't
have a virtual destructor.

Reviewers: compnerd, dblaikie

Subscribers: cfe-commits, klimek, llvm-commits, mgorny

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

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

7 years agoCorrectly handle multi-lined RUN lines.
Bryant Wong [Thu, 29 Dec 2016 19:32:34 +0000 (19:32 +0000)]
Correctly handle multi-lined RUN lines.

`utils/update_{llc_test,test}_checks` ought to be able to handle RUN commands
that span multiple lines, as shown in the example at
http://llvm.org/docs/CommandGuide/FileCheck.html#the-filecheck-check-prefix-option

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

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

7 years ago[ADT] Use memcpy for type punning in MathExtras.
Justin Lebar [Thu, 29 Dec 2016 18:15:34 +0000 (18:15 +0000)]
[ADT] Use memcpy for type punning in MathExtras.

Summary: Previously we type-punned through a union, which is not safe.

Reviewers: rnk

Subscribers: llvm-commits

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

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

7 years agoRevert "[COFF] Use 32-bit jump table entries in .rdata for Win64"
Reid Kleckner [Thu, 29 Dec 2016 17:07:10 +0000 (17:07 +0000)]
Revert "[COFF] Use 32-bit jump table entries in .rdata for Win64"

This reverts commit r290694. It broke sanitizer tests on Win64. I'll
probably bring this back, but the jump tables will just live in .text
like they do for MSVC.

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

7 years ago[TBAAVerifier] Be stricter around verifying scalar nodes
Sanjoy Das [Thu, 29 Dec 2016 15:47:05 +0000 (15:47 +0000)]
[TBAAVerifier] Be stricter around verifying scalar nodes

This fixes the issue exposed in PR31393, where we weren't trying
sufficiently hard to diagnose bad TBAA metadata.

This does reduce the variety in the error messages we print out, but I
think the tradeoff of verifying more, simply and quickly overrules the
need for more helpful error messags here.

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

7 years ago[TBAAVerifier] Make things const-consistent; NFC
Sanjoy Das [Thu, 29 Dec 2016 15:47:01 +0000 (15:47 +0000)]
[TBAAVerifier] Make things const-consistent; NFC

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

7 years ago[TBAAVerifier] Memoize validity of scalar tbaa nodes; NFCI
Sanjoy Das [Thu, 29 Dec 2016 15:46:57 +0000 (15:46 +0000)]
[TBAAVerifier] Memoize validity of scalar tbaa nodes; NFCI

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

7 years ago[AMDGPU][mc] Enable absolute expressions in .hsa_code_object_isa directive
Artem Tamazov [Thu, 29 Dec 2016 15:41:52 +0000 (15:41 +0000)]
[AMDGPU][mc] Enable absolute expressions in .hsa_code_object_isa directive

Among other stuff, this allows to use predefined .option.machine_version_major
/minor/stepping symbols in the directive.

Relevant test expanded at once (also file renamed for clarity).

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

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

7 years agoFix documentation generator warnings after rL290708.
Igor Laevsky [Thu, 29 Dec 2016 15:08:57 +0000 (15:08 +0000)]
Fix documentation generator warnings after rL290708.

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

7 years agoIntroduce element-wise atomic memcpy intrinsic
Igor Laevsky [Thu, 29 Dec 2016 14:31:07 +0000 (14:31 +0000)]
Introduce element-wise atomic memcpy intrinsic

This change adds a new intrinsic which is intended to provide memcpy functionality
with additional atomicity guarantees. Please refer to the review thread
or language reference for further details.

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

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

7 years ago[InstCombine] Use getVectorNumElements instead of explicitly casting to VectorType...
Craig Topper [Thu, 29 Dec 2016 07:03:18 +0000 (07:03 +0000)]
[InstCombine] Use getVectorNumElements instead of explicitly casting to VectorType and calling getNumElements. NFC

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

7 years ago[InstCombine] Fix typo in comment. NFC
Craig Topper [Thu, 29 Dec 2016 05:38:31 +0000 (05:38 +0000)]
[InstCombine] Fix typo in comment. NFC

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

7 years ago[InstCombine] Use a 32-bits instead of 64-bits for storing the number of elements...
Craig Topper [Thu, 29 Dec 2016 04:24:32 +0000 (04:24 +0000)]
[InstCombine] Use a 32-bits instead of 64-bits for storing the number of elements in VectorType for a ShuffleVector. While there getVectorNumElements to avoid an explicit cast. NFC

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

7 years ago[InstCombine][X86] If the lowest element of a scalar intrinsic isn't used make sure...
Craig Topper [Thu, 29 Dec 2016 03:30:17 +0000 (03:30 +0000)]
[InstCombine][X86] If the lowest element of a scalar intrinsic isn't used make sure we add it to the worklist so we can DCE it sooner.

We bypassed the intrinsic and returned the passthru operand, but we should also add the intrinsic to the worklist since its now dead. This can allow DCE to find it sooner and remove it. Similar was done for InsertElement when the inserted element isn't demanded.

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

7 years ago[libFuzzer] make __sanitizer_cov_trace_switch more predictable
Kostya Serebryany [Thu, 29 Dec 2016 02:50:35 +0000 (02:50 +0000)]
[libFuzzer] make __sanitizer_cov_trace_switch more predictable

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

7 years ago[InstCombine] Fix some of the AVX-512 scalar arithmetic test cases to do a better...
Craig Topper [Thu, 29 Dec 2016 02:29:04 +0000 (02:29 +0000)]
[InstCombine] Fix some of the AVX-512 scalar arithmetic test cases to do a better job of testing what they intended to test.

The accidentally had trivially dead code. Also needed to adjust the rounding mode to not CUR_DIRECTION so the intrinsics don't get converted to native operations before going through SimplifyDemandedVectorElts.

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

7 years agoRemove BitstreamWriter::Emit64(), it was never called (NFC)
Mehdi Amini [Thu, 29 Dec 2016 01:40:53 +0000 (01:40 +0000)]
Remove BitstreamWriter::Emit64(), it was never called (NFC)

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

7 years agoFix mingw build by moving the static const data member before the bitfields
Reid Kleckner [Thu, 29 Dec 2016 01:14:41 +0000 (01:14 +0000)]
Fix mingw build by moving the static const data member before the bitfields

Apparently GCC targeting Windows breaks bitfields on static data members:
  struct Foo {
    unsigned X : 16;
    static const int M = 42;
    unsigned Y : 16;
  };
  static_assert(sizeof(Foo) == 4, "asdf"); // fails

Who knew.

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

7 years agoNewGVN: Sort Dominator Tree in RPO order, and use that for generating order.
Daniel Berlin [Thu, 29 Dec 2016 01:12:36 +0000 (01:12 +0000)]
NewGVN: Sort Dominator Tree in RPO order, and use that for generating order.

Summary:
The optimal iteration order for this problem is RPO order. We want to
process as many preds of a backedge as we can before we process the
backedge.

At the same time, as we add predicate handling, we want to be able to
touch instructions that are dominated by a given block by
ranges (because a change in value numbering a predicate possibly
affects all users we dominate that are using that predicate).
If we don't do it this way, we can't do value inference over
backedges (the paper covers this in depth).

The newgvn branch currently overshoots the last part, and guarantees
that it will touch *at least* the right set of instructions, but it
does touch more.  This is because the bitvector instruction ranges are
currently generated in RPO order (so we take the max and the min of
the ranges of dominated blocks, which means there are some in the
middle we didn't have to touch that we did).

We can do better by sorting the dominator tree, and then just using
dominator tree order.

As a preliminary, the dominator tree has some RPO guarantees, but not
enough. It guarantees that for a given node, your idom must come
before you in the RPO ordering. It guarantees no relative RPO ordering
for siblings.  We add siblings in whatever order they appear in the module.

So that is what we fix.

We sort the children array of the domtree into RPO order, and then use
the dominator tree for ordering, instead of RPO, since the dominator
tree is now a valid RPO ordering.

Note: This would help any other pass that iterates a forward problem
in dominator tree order.  Most of them are single pass.  It will still
maximize whatever result they compute.  We could also build the
dominator tree in this order, but our incremental updates would still
put it out of sort order, and recomputing the sort order is almost as
hard as general incremental updates of the domtree.

Also note that the sorting does not affect any tests, etc. Nothing
depends on domtree order, including the verifier, the equals
functions for domtree nodes, etc.

How much could this matter, you ask?
Here are the current numbers.
This is generated by running NewGVN over all files in LLVM.

Note that once we propagate equalities, the differences go up by an
order of magnitude or two (IE instead of 29, the max ends up in the
thousands, since the worst case we add a factor of N, where N is the
number of branch predicates).  So while it doesn't look that stark for
the default ordering, it gets *much much* worse.  There are also
programs in the wild where the difference is already pretty stark
(2 iterations vs hundreds).

RPO ordering:
759040 Number of iterations is 1
112908 Number of iterations is 2

Default dominator tree ordering:
755081 Number of iterations is 1
116234 Number of iterations is 2
   603 Number of iterations is 3
    27 Number of iterations is 4
     2 Number of iterations is 5
     1 Number of iterations is 7

Dominator tree sorted:
759040 Number of iterations is 1
112908 Number of iterations is 2
<yay!>

Really bad ordering (sort domtree siblings in postorder. not quite the
worst possible, but yeah):
754008 Number of iterations is 1
    21 Number of iterations is 10
     8 Number of iterations is 11
     6 Number of iterations is 12
     5 Number of iterations is 13
     2 Number of iterations is 14
     2 Number of iterations is 15
     3 Number of iterations is 16
     1 Number of iterations is 17
     2 Number of iterations is 18
 96642 Number of iterations is 2
     1 Number of iterations is 20
     2 Number of iterations is 21
     1 Number of iterations is 22
     1 Number of iterations is 29
 17266 Number of iterations is 3
  2598 Number of iterations is 4
   798 Number of iterations is 5
   273 Number of iterations is 6
   186 Number of iterations is 7
    80 Number of iterations is 8
    42 Number of iterations is 9

Reviewers: chandlerc, davide

Subscribers: llvm-commits

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

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

7 years agoAdd a static_assert about the sizeof(GlobalValue)
Reid Kleckner [Thu, 29 Dec 2016 00:55:51 +0000 (00:55 +0000)]
Add a static_assert about the sizeof(GlobalValue)

I added one for Value back in r262045, and I'm starting to think we
should have these for any class with bitfields whose memory efficiency
really matters.

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

7 years agoUpdate equalsStoreHelper for the fact that only one branch can be true
Daniel Berlin [Thu, 29 Dec 2016 00:49:32 +0000 (00:49 +0000)]
Update equalsStoreHelper for the fact that only one branch can be true

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

7 years ago[GlobalValue] Move HasLLVMReservedName into existing bitfield. NFC
Justin Lebar [Thu, 29 Dec 2016 00:30:46 +0000 (00:30 +0000)]
[GlobalValue] Move HasLLVMReservedName into existing bitfield. NFC

Summary:
Follow-up to r290691, where I introduced HasLLVMReservedName.  rnk
pointed out that that patch added an extra word to GlobalValue on MSVC,
because it doesn't pack bitfields with different types.

This patch moves HasLLVMReservedName into the existing bitfield, where
we appear to have plenty of bits to spare.

Reviewers: rnk

Subscribers: llvm-commits

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

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

7 years ago[IR] Clarify that Value::getName() is not actually cheap.
Justin Lebar [Thu, 29 Dec 2016 00:30:42 +0000 (00:30 +0000)]
[IR] Clarify that Value::getName() is not actually cheap.

It involves a hashtable lookup when the Value has a name.

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

7 years ago[COFF] Use 32-bit jump table entries in .rdata for Win64
Reid Kleckner [Thu, 29 Dec 2016 00:12:39 +0000 (00:12 +0000)]
[COFF] Use 32-bit jump table entries in .rdata for Win64

Summary:
We were already using 32-bit jump table entries, but this was a
consequence of the default PIC model on Win64, and not an intentional
design decision. This patch ensures that we always use 32-bit label
difference jump table entries on Win64 regardless of the PIC model. This
is a good idea because it saves executable size and object file size.

Moving the jump tables to .rdata cleans up the disassembled object code
and reduces the available ROP targets, but it requires adding one more
RIP-relative lea to the code.  COFF doesn't have relocations to express
the difference between two arbitrary symbols, so we can't use the jump
table label in the label difference like we do elsewhere.

Fixes PR31488

Reviewers: majnemer, compnerd

Subscribers: llvm-commits

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

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

7 years agoChange Metadata Index emission in the bitcode to use 2x32 bits for the placeholder
Mehdi Amini [Wed, 28 Dec 2016 23:45:54 +0000 (23:45 +0000)]
Change Metadata Index emission in the bitcode to use 2x32 bits for the placeholder

The Bitstream reader and writer are limited to handle a "size_t" at
most, which means that we can't backpatch and read back a 64bits
value on 32 bits platform.

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