OSDN Git Service

android-x86/external-llvm.git
8 years ago[ADT] Add make_scope_exit().
Tim Shen [Wed, 10 Aug 2016 17:52:09 +0000 (17:52 +0000)]
[ADT] Add make_scope_exit().

Summary: make_scope_exit() is described in C++ proposal p0052r2, which uses RAII to do cleanup works at scope exit.

Reviewers: chandlerc

Subscribers: llvm-commits

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

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

8 years agoFix LCSSA increased compile time
Rong Xu [Wed, 10 Aug 2016 17:49:11 +0000 (17:49 +0000)]
Fix LCSSA increased compile time

We are seeing r276077 drastically increasing compiler time for our larger
benchmarks in PGO profile generation build (both clang based and IR based
mode) -- it can be 20x slower than without the patch (like from 30 secs to
780 secs)

The increased time are all in pass LCSSA. The problematic code is about
PostProcessPHIs after use-rewrite. Note that the InsertedPhis from ssa_updater
is accumulating (never been cleared). Since the inserted PHIs are added to the
candidate for each rewrite, The earlier ones will be repeatedly added. Later
when adding the new PHIs to the work-list, we don't check the duplication
either. This can result in extremely long work-list that containing tons of
duplicated PHIs.

This patch fixes the issue by hoisting the code out of the loop.

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

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

8 years ago[Hexagon] Fix table-gen decode conflict warnings for CONST32/64
Krzysztof Parzyszek [Wed, 10 Aug 2016 17:22:24 +0000 (17:22 +0000)]
[Hexagon] Fix table-gen decode conflict warnings for CONST32/64

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

8 years agoGlobalISel: fixup copy/paste comment error
Tim Northover [Wed, 10 Aug 2016 16:51:18 +0000 (16:51 +0000)]
GlobalISel: fixup copy/paste comment error

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

8 years agoGlobalISel: avoid inserting redundant COPYs for bitcasts.
Tim Northover [Wed, 10 Aug 2016 16:51:14 +0000 (16:51 +0000)]
GlobalISel: avoid inserting redundant COPYs for bitcasts.

If the value produced by the bitcast hasn't been referenced yet, we can simply
reuse the input register avoiding an unnecessary COPY instruction.

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

8 years ago[Hexagon] Use integer instructions for floating point immediates
Krzysztof Parzyszek [Wed, 10 Aug 2016 16:46:36 +0000 (16:46 +0000)]
[Hexagon] Use integer instructions for floating point immediates

Floating point instructions use general purpose registers, so the few
instructions that can put floating point immediates into registers are,
in fact, integer instruction. Use them explicitly instead of having
pseudo-instructions specifically for dealing with floating point values.

Simplify the constant loading instructions (from sdata) to have only two:
one for 32-bit values and one for 64-bit values: CONST32 and CONST64.

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

8 years ago[Coroutines] Part 6: Elide dynamic allocation of a coroutine frame when possible
Gor Nishanov [Wed, 10 Aug 2016 16:40:39 +0000 (16:40 +0000)]
[Coroutines] Part 6: Elide dynamic allocation of a coroutine frame when possible

Summary:
A particular coroutine usage pattern, where a coroutine is created, manipulated and
destroyed by the same calling function, is common for coroutines implementing
RAII idiom and is suitable for allocation elision optimization which avoid
dynamic allocation by storing the coroutine frame as a static `alloca` in its
caller.

coro.free and coro.alloc intrinsics are used to indicate which code needs to be suppressed
when dynamic allocation elision happens:
```
entry:
  %elide = call i8* @llvm.coro.alloc()
  %need.dyn.alloc = icmp ne i8* %elide, null
  br i1 %need.dyn.alloc, label %coro.begin, label %dyn.alloc
dyn.alloc:
  %alloc = call i8* @CustomAlloc(i32 4)
  br label %coro.begin
coro.begin:
  %phi = phi i8* [ %elide, %entry ], [ %alloc, %dyn.alloc ]
  %hdl = call i8* @llvm.coro.begin(i8* %phi, i32 0, i8* null,
                          i8* bitcast ([2 x void (%f.frame*)*]* @f.resumers to i8*))
```
and
```
  %mem = call i8* @llvm.coro.free(i8* %hdl)
  %need.dyn.free = icmp ne i8* %mem, null
  br i1 %need.dyn.free, label %dyn.free, label %if.end
dyn.free:
  call void @CustomFree(i8* %mem)
  br label %if.end
if.end:
  ...
```

If heap allocation elision is performed, we replace coro.alloc with a static alloca on the caller frame and coro.free with null constant.

Also, we need to make sure that if there are any tail calls referencing the coroutine frame, we need to remote tail call attribute, since now coroutine frame lives on the stack.

Documentation and overview is here: http://llvm.org/docs/Coroutines.html.

Upstreaming sequence (rough plan)
1.Add documentation. (https://reviews.llvm.org/D22603)
2.Add coroutine intrinsics. (https://reviews.llvm.org/D22659)
3.Add empty coroutine passes. (https://reviews.llvm.org/D22847)
4.Add coroutine devirtualization + tests.
ab) Lower coro.resume and coro.destroy (https://reviews.llvm.org/D22998)
c) Do devirtualization (https://reviews.llvm.org/D23229)
5.Add CGSCC restart trigger + tests. (https://reviews.llvm.org/D23234)
6.Add coroutine heap elision + tests.  <= we are here
7.Add the rest of the logic (split into more patches)

Reviewers: mehdi_amini, majnemer

Subscribers: mehdi_amini, llvm-commits

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

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

8 years agoFix build break of VS 2013 debug builds
Roger Ferrer Ibanez [Wed, 10 Aug 2016 16:39:58 +0000 (16:39 +0000)]
Fix build break of VS 2013 debug builds

In debug mode extra macros are enabled for several C++ algorithms. Some of them
may cause unfortunate build failures.

This commit adds a redundant operator() to work around one of those troublesome
macros which was hit accidentally by change r278012.

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

8 years ago[Hexagon] Delete HexagonSelectCCInfo.td
Krzysztof Parzyszek [Wed, 10 Aug 2016 16:23:53 +0000 (16:23 +0000)]
[Hexagon] Delete HexagonSelectCCInfo.td

This file is not used. The location assignment of call arguments and
return values is implemented directly in HexagonISelLowering.

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

8 years ago[Hexagon] Remove unneeded/unused ISD opcodes ARGEXTEND and FCONST32
Krzysztof Parzyszek [Wed, 10 Aug 2016 16:20:33 +0000 (16:20 +0000)]
[Hexagon] Remove unneeded/unused ISD opcodes ARGEXTEND and FCONST32

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

8 years ago[X86][XOP] Tweak vpermil2pd test to stop it being combined away
Simon Pilgrim [Wed, 10 Aug 2016 15:15:56 +0000 (15:15 +0000)]
[X86][XOP] Tweak vpermil2pd test to stop it being combined away

The target shuffle combined to a BLENDPD pattern which we will shortly add support for.

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

8 years ago[X86][SSE] Regenerate vector shift lowering tests
Simon Pilgrim [Wed, 10 Aug 2016 15:13:49 +0000 (15:13 +0000)]
[X86][SSE] Regenerate vector shift lowering tests

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

8 years ago[LVI] Handle conditions in the form of (cond1 && cond2)
Artur Pilipenko [Wed, 10 Aug 2016 15:13:15 +0000 (15:13 +0000)]
[LVI] Handle conditions in the form of (cond1 && cond2)

Teach LVI how to gather information from conditions in the form of (cond1 && cond2). Our out-of-tree front-end emits range checks in this form.

Reviewed By: sanjoy

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

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

8 years agouse different comparison predicates for better test coverage
Sanjay Patel [Wed, 10 Aug 2016 15:06:11 +0000 (15:06 +0000)]
use different comparison predicates for better test coverage

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

8 years ago[X86][SSE] Add support for combining target shuffles to MOVSS/MOVSD
Simon Pilgrim [Wed, 10 Aug 2016 14:15:41 +0000 (14:15 +0000)]
[X86][SSE] Add support for combining target shuffles to MOVSS/MOVSD

Only do this on pre-SSE41 targets where we should be lowering to BLENDPS/BLENDPD instead

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

8 years agoAdd a test case for r278217 "[LVI] Relax the assertion about LVILatticeVal type in...
Artur Pilipenko [Wed, 10 Aug 2016 13:51:01 +0000 (13:51 +0000)]
Add a test case for r278217 "[LVI] Relax the assertion about LVILatticeVal type in getConstantRange"

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

8 years ago[LVI] NFC. Make getValueFromCondition return LVILatticeValue instead of changing...
Artur Pilipenko [Wed, 10 Aug 2016 13:38:07 +0000 (13:38 +0000)]
[LVI] NFC. Make getValueFromCondition return LVILatticeValue instead of changing reference argument

Instead of returning bool and setting LVILatticeValue reference argument return LVILattice value. Use overdefined value to denote the case when we didn't gather any information from the condition.

This change was separated from the review "[LVI] Handle conditions in the form of (cond1 && cond2)" (https://reviews.llvm.org/D23200#inline-199531). Once getValueFromCondition returns LVILatticeValue we can cache the result in Visited map.

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

8 years agoTeach CorrelatedValuePropagation to mark adds as no wrap
Artur Pilipenko [Wed, 10 Aug 2016 13:08:34 +0000 (13:08 +0000)]
Teach CorrelatedValuePropagation to mark adds as no wrap

This is a resubmission of previously reverted r277592. It was hitting overly strong assertion in getConstantRange which was relaxed in r278217.

Use LVI to prove that adds do not wrap. The change is motivated by https://llvm.org/bugs/show_bug.cgi?id=28620 bug and it's the first step to fix that problem.

Reviewed By: sanjoy

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

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

8 years ago[X86][SSE] Only treat SM_SentinelUndef as UNDEF in shuffle mask predicates
Simon Pilgrim [Wed, 10 Aug 2016 12:55:25 +0000 (12:55 +0000)]
[X86][SSE] Only treat SM_SentinelUndef as UNDEF in shuffle mask predicates

isUndefOrEqual and isUndefOrInRange treated all -ve shuffle mask values as UNDEF, now it has to be SM_SentinelUndef (-1)

We already have asserts to check that lowered SHUFFLE_VECTOR indices are in the range -1 <= index < 2*masksize (or masksize for unary shuffles)

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

8 years ago[LVI] Relax the assertion about LVILatticeVal type in getConstantRange
Artur Pilipenko [Wed, 10 Aug 2016 12:54:54 +0000 (12:54 +0000)]
[LVI] Relax the assertion about LVILatticeVal type in getConstantRange

The problem was triggered by my recent change in CVP (D23059). Current code expected that integer constants are represented by constantrange LVILatticeVal and never represented as LVILatticeVal with constant tag. That is true for ConstantInt constants, although ConstantExpr integer type constants are legally represented as constant LVILatticeVal.

This code fails with CVP change in:

@b = global i32 0, align 4
define void @test6(i32 %a) {
bb:
  %add = add i32 %a, ptrtoint (i32* @b to i32)
  ret void
}
Currently getConstantRange code is not executed by any of the upstream passes. I'm going to add a test case to test/Transforms/CorrelatedValuePropagation/add.ll once I resubmit the CVP change.

Reviewed By: sanjoy

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

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

8 years ago[X86][SSE] Reorder shuffle mask undef helper predicates. NFCI
Simon Pilgrim [Wed, 10 Aug 2016 12:34:23 +0000 (12:34 +0000)]
[X86][SSE] Reorder shuffle mask undef helper predicates. NFCI

To make it easier for a more complex helper to use a simpler one

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

8 years ago[X86][SSE] Regenerate SSE1 tests
Simon Pilgrim [Wed, 10 Aug 2016 12:26:40 +0000 (12:26 +0000)]
[X86][SSE] Regenerate SSE1 tests

Properly demonstrate the nasty codegen we get for vselect without integer vectors

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

8 years agoRegenerate test
Simon Pilgrim [Wed, 10 Aug 2016 12:24:19 +0000 (12:24 +0000)]
Regenerate test

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

8 years ago[DAGCombine] Avoid INSERT_SUBVECTOR reinsertions (PR28678)
Simon Pilgrim [Wed, 10 Aug 2016 10:50:53 +0000 (10:50 +0000)]
[DAGCombine] Avoid INSERT_SUBVECTOR reinsertions (PR28678)

If the input vector to INSERT_SUBVECTOR is another INSERT_SUBVECTOR, and this inserted subvector replaces the last insertion, then insert into the common source vector.

i.e.
INSERT_SUBVECTOR( INSERT_SUBVECTOR( Vec, SubOld, Idx ), SubNew, Idx ) --> INSERT_SUBVECTOR( Vec, SubNew, Idx )

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

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

8 years ago[ARM] Improve sxta{b|h} and uxta{b|h} tests
Sam Parker [Wed, 10 Aug 2016 09:34:34 +0000 (09:34 +0000)]
[ARM] Improve sxta{b|h} and uxta{b|h} tests

Created a Thumb2 predicated pattern matcher that uses Thumb2 and
HasT2ExtractPack and used it to redefine the patterns for sxta{b|h}
and uxta{b|h}. Also used the similar patterns to fill in isel pattern
gaps for the corresponding instructions in the ARM backend.
The patch is mainly changes to tests since most of this functionality
appears not to have been tested.

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

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

8 years ago[x86] Fix a bug in the auto-upgrade from r276416 where we failed to give
Chandler Carruth [Wed, 10 Aug 2016 07:41:26 +0000 (07:41 +0000)]
[x86] Fix a bug in the auto-upgrade from r276416 where we failed to give
a sufficiently low alignment for the IR load created.

There is no test case because we don't have any test cases for the *IR*
produced by the autoupgrade, only the x86 assembly, and it happens that
the x86 assembly for this intrinsic as it is tested in the autoupgrade
path just happens to not produce a separate load instruction where we
might have observed the alignment.

I'm going to follow up on the original commit to suggest getting
IR-level testing in addition to the asm level testing here so that we
can see and test these kinds of issues. We might never get an x86
instruction out with an alignment constraint, but we could stil
miscompile code by folding against the alignment marked on (or inferred
for in this case) the load.

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

8 years ago[SimplifyLibCalls] Restore the old behaviour, emit a libcall.
Davide Italiano [Wed, 10 Aug 2016 06:33:32 +0000 (06:33 +0000)]
[SimplifyLibCalls] Restore the old behaviour, emit a libcall.

Hal pointed out that the semantic of our intrinsic and the libc
call are slightly different. Add a comment while I'm here to
explain why we can't emit an intrinsic. Thanks Hal!

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

8 years agoDo not directly use inline threshold cl options in cost analysis.
Easwaran Raman [Wed, 10 Aug 2016 00:48:04 +0000 (00:48 +0000)]
Do not directly use inline threshold cl options in cost analysis.

This adds an InlineParams struct which is populated from the command line options by getInlineParams and passed to getInlineCost for the call analyzer to use.

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

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

8 years ago[OptDiag] Add class Doxygen comment
Adam Nemet [Wed, 10 Aug 2016 00:44:56 +0000 (00:44 +0000)]
[OptDiag] Add class Doxygen comment

This was requested in D22694.

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

8 years ago[Inliner,OptDiag] Add hotness attribute to opt diagnostics
Adam Nemet [Wed, 10 Aug 2016 00:44:44 +0000 (00:44 +0000)]
[Inliner,OptDiag] Add hotness attribute to opt diagnostics

Summary:
The inliner not being a function pass requires the work-around of
generating the OptimizationRemarkEmitter and in turn BFI on demand.
This will go away after the new PM is ready.

BFI is only computed inside ORE if the user has requested hotness
information for optimization diagnostitics (-pass-remark-with-hotness at
the 'opt' level).  Thus there is no additional overhead without the
flag.

Reviewers: hfinkel, davidxl, eraman

Subscribers: llvm-commits

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

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

8 years ago[scudo] Documentation update for Scudo, from https://reviews.llvm.org/D23332
Kostya Serebryany [Tue, 9 Aug 2016 23:57:04 +0000 (23:57 +0000)]
[scudo] Documentation update for Scudo, from https://reviews.llvm.org/D23332

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

8 years ago[IR] Remove some unused #includes (NFC)
Vedant Kumar [Tue, 9 Aug 2016 23:14:37 +0000 (23:14 +0000)]
[IR] Remove some unused #includes (NFC)

I needed a reader-writer lock for a downstream project and noticed that
llvm has one. Function.cpp is the only file in-tree that refers to it.
To anyone reading this: are you using RWMutex in out-of-tree code? Maybe
it's not worth keeping around any more...

Since we're not actually using RWMutex *here*, remove the #include (and
a few other stale headers while we're at it).

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

8 years agoMake LLVM_PRETTY_FUNCTION support __func__.
Zachary Turner [Tue, 9 Aug 2016 23:03:55 +0000 (23:03 +0000)]
Make LLVM_PRETTY_FUNCTION support __func__.

In case there are compilers that support neither __FUNCSIG__ or
__PRETTY_FUNCTION__, we fall back to __func__ as a last resort,
which should be guaranteed by C++11 and C99.

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

8 years agoGlobalISel: support 'undef' constant.
Tim Northover [Tue, 9 Aug 2016 23:01:30 +0000 (23:01 +0000)]
GlobalISel: support 'undef' constant.

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

8 years ago[LoopSimplify] Rebuild LCSSA for the inner loop after separating nested loops.
Michael Zolotukhin [Tue, 9 Aug 2016 22:44:56 +0000 (22:44 +0000)]
[LoopSimplify] Rebuild LCSSA for the inner loop after separating nested loops.

Summary:
This hopefully fixes PR28825. The problem now was that a value from the
original loop was used in a subloop, which became a sibling after separation.
While a subloop doesn't need an lcssa phi node, a sibling does, and that's
where we broke LCSSA. The most natural way to fix this now is to simply call
formLCSSA on the original loop: it'll do what we've been doing before plus
it'll cover situations described above.

I think we don't need to run formLCSSARecursively here, and we have an assert
to verify this (I've tried testing it on LLVM testsuite + SPECs). I'd be happy
to be corrected here though.

I also changed a run line in the test from '-lcssa -loop-unroll' to
'-lcssa -loop-simplify -indvars', because it exercises LCSSA
preservation to the same extent, but also makes less unrelated
transformation on the CFG, which makes it easier to verify.

Reviewers: chandlerc, sanjoy, silvas

Subscribers: llvm-commits

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

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

8 years ago[ValueTracking] Improve ValueTracking on left shift with nsw flag
Andrew Kaylor [Tue, 9 Aug 2016 22:41:35 +0000 (22:41 +0000)]
[ValueTracking] Improve ValueTracking on left shift with nsw flag

Patch by Li Huang

Differential Revison: https://reviews.llvm.org/D23296

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

8 years ago[WebAssembly] Add -emscripten-cxx-exceptions-whitelist option
Derek Schuff [Tue, 9 Aug 2016 22:37:00 +0000 (22:37 +0000)]
[WebAssembly] Add -emscripten-cxx-exceptions-whitelist option

This patch adds -emscripten-cxx-exceptions-whitelist option to
WebAssemblyLowerEmscriptenExceptions pass. This options is the list of
function names in which Emscripten-style exception handling is enabled.
This is to support emscripten's EXCEPTION_CATCHING_WHITELIST which
exists because of the performance impact of emscripten's non-zero-cost
EH method.

Patch by Heejin Ahn

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

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

8 years agoAdd a platform independent version of __PRETTY_FUNCTION__.
Zachary Turner [Tue, 9 Aug 2016 22:03:45 +0000 (22:03 +0000)]
Add a platform independent version of __PRETTY_FUNCTION__.

MSVC doesn't have this, it only has __FUNCSIG__.  So this adds
a new macro called LLVM_PRETTY_FUNCTION which evaluates to the
right thing on any platform.

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

8 years agoGlobalISel: first translation support for Constants.
Tim Northover [Tue, 9 Aug 2016 21:28:04 +0000 (21:28 +0000)]
GlobalISel: first translation support for Constants.

For now put them all in the entry block. This should be correct but may give
poor runtime performance. Hopefully MachineSinking combined with
isReMaterializable can solve those issues, but if not the interface is sound
enough to support alternatives.

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

8 years agoadd test cases for missed vselect optimizations (PR28895)
Sanjay Patel [Tue, 9 Aug 2016 21:07:17 +0000 (21:07 +0000)]
add test cases for missed vselect optimizations (PR28895)

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

8 years ago[ExecutionEngine] Disable weak symbol tests for COFF.
Lang Hames [Tue, 9 Aug 2016 20:48:22 +0000 (20:48 +0000)]
[ExecutionEngine] Disable weak symbol tests for COFF.

COFF doesn't support weak linkage on functions.

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

8 years agoFix the runtime error caused by "Use ValueOffsetPair to enhance value reuse during...
Wei Mi [Tue, 9 Aug 2016 20:40:03 +0000 (20:40 +0000)]
Fix the runtime error caused by "Use ValueOffsetPair to enhance value reuse during SCEV expansion".

The patch is to fix the bug in PR28705. It was caused by setting wrong return
value for SCEVExpander::findExistingExpansion. The return values of findExistingExpansion
have different meanings when the function is used in different ways so it is easy to make
mistake. The fix creates two new interfaces to replace SCEVExpander::findExistingExpansion,
and specifies where each interface is expected to be used.

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

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

8 years agoRecommit "Use ValueOffsetPair to enhance value reuse during SCEV expansion".
Wei Mi [Tue, 9 Aug 2016 20:37:50 +0000 (20:37 +0000)]
Recommit "Use ValueOffsetPair to enhance value reuse during SCEV expansion".

The fix for PR28705 will be committed consecutively.

In D12090, the ExprValueMap was added to reuse existing value during SCEV expansion.
However, const folding and sext/zext distribution can make the reuse still difficult.

A simplified case is: suppose we know S1 expands to V1 in ExprValueMap, and
  S1 = S2 + C_a
  S3 = S2 + C_b
where C_a and C_b are different SCEVConstants. Then we'd like to expand S3 as
V1 - C_a + C_b instead of expanding S2 literally. It is helpful when S2 is a
complex SCEV expr and S2 has no entry in ExprValueMap, which is usually caused
by the fact that S3 is generated from S1 after const folding.

In order to do that, we represent ExprValueMap as a mapping from SCEV to
ValueOffsetPair. We will save both S1->{V1, 0} and S2->{V1, C_a} into the
ExprValueMap when we create SCEV for V1. When S3 is expanded, it will first
expand S2 to V1 - C_a because of S2->{V1, C_a} in the map, then expand S3 to
V1 - C_a + C_b.

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

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

8 years agoWithout explicitly including <string>, I'm getting an error on the new code in this...
Chris Dewhurst [Tue, 9 Aug 2016 20:32:59 +0000 (20:32 +0000)]
Without explicitly including <string>, I'm getting an error on the new code in this file. Won't present an issue for anyone that isn't having the same trouble as me.

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

8 years ago[ADT] Change iterator_adaptor_base's default template arguments to forward more under...
Tim Shen [Tue, 9 Aug 2016 20:23:13 +0000 (20:23 +0000)]
[ADT] Change iterator_adaptor_base's default template arguments to forward more underlying typedefs

Reviewers: chandlerc

Subscribers: llvm-commits

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

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

8 years agoregenerate checks and remove 'opt' run dependency
Sanjay Patel [Tue, 9 Aug 2016 20:09:16 +0000 (20:09 +0000)]
regenerate checks and remove 'opt' run dependency

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

8 years ago[EarlyCSE] Teach about CSE'ing over invariant.start intrinsics
Anna Thomas [Tue, 9 Aug 2016 20:00:47 +0000 (20:00 +0000)]
[EarlyCSE] Teach about CSE'ing over invariant.start intrinsics

Summary:
Teach EarlyCSE about invariant.start intrinsic. Specifically, we can perform
store-load, load-load forwarding over this call.

Reviewers: majnemer, reames, dberlin, sanjoy

Subscribers: llvm-commits

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

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

8 years ago[llvm-cov] Swapped the line and count columns.
Ying Yi [Tue, 9 Aug 2016 19:53:35 +0000 (19:53 +0000)]
[llvm-cov]  Swapped the line and count columns.

In the coverage report, the line and count columns have been swapped to make it more readable.
A follow-up commit in compiler-rt is needed

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

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

8 years agoupdate to use FileCheck and auto-generate checks
Sanjay Patel [Tue, 9 Aug 2016 19:42:52 +0000 (19:42 +0000)]
update to use FileCheck and auto-generate checks

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

8 years agoRe-apply r278065 (Weak symbol support in RuntimeDyld) with a fix for ELF.
Lang Hames [Tue, 9 Aug 2016 19:27:17 +0000 (19:27 +0000)]
Re-apply r278065 (Weak symbol support in RuntimeDyld) with a fix for ELF.

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

8 years ago[vim] Update the llvm.vim syntax file
David Majnemer [Tue, 9 Aug 2016 18:34:19 +0000 (18:34 +0000)]
[vim] Update the llvm.vim syntax file

We never updated this file to contain the WinEH instructions.
Also, add the dereferenceable attribute.

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

8 years ago[X86] Don't model UD2/UD2B as a terminator
David Majnemer [Tue, 9 Aug 2016 17:55:12 +0000 (17:55 +0000)]
[X86] Don't model UD2/UD2B as a terminator

A UD2 might make its way into the program via a call to @llvm.trap.
Obviously, calls are not terminators.  However, we modeled the X86
instruction, UD2, as a terminator.  Later on, this confuses the epilogue
insertion machinery which results in the epilogue getting inserted
before the UD2.  For some platforms, like x64, the result is a
violation of the ABI.

Instead, model UD2/UD2B as a side effecting instruction which may
observe memory.

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

8 years ago[DAGCombiner] Better support for shifting large value type by constants
Simon Pilgrim [Tue, 9 Aug 2016 17:39:11 +0000 (17:39 +0000)]
[DAGCombiner] Better support for shifting large value type by constants

As detailed on D22726, much of the shift combining code assume constant values will fit into a uint64_t value and calls ConstantSDNode::getZExtValue where it probably shouldn't (leading to asserts). Using APInt directly avoids this problem but we encounter other assertions if we attempt to compare/operate on 2 APInt of different bitwidths.

This patch adds a helper function to ensure that 2 APInt values are zero extended as required so that they can be safely used together. I've only added an initial example use for this to the '(SHIFT (SHIFT x, c1), c2) --> (SHIFT x, (ADD c1, c2))' combines. Further cases can easily be added as required.

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

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

8 years ago[AliasAnalysis] Treat invariant.start as read-memory
Anna Thomas [Tue, 9 Aug 2016 17:18:05 +0000 (17:18 +0000)]
[AliasAnalysis] Treat invariant.start as read-memory

Summary:
We teach alias analysis that invariant.start is readonly.
This helps with GVN and memcopy optimizations that currently treat.
invariant.start as a clobber.
We need to treat this as readonly, so that DSE does not incorrectly
remove stores prior to the invariant.start

Reviewers: sanjoy, reames, majnemer, dberlin

Subscribers: llvm-commits

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

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

8 years agoauto-generate checks
Sanjay Patel [Tue, 9 Aug 2016 17:03:51 +0000 (17:03 +0000)]
auto-generate checks

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

8 years agoauto-generate checks
Sanjay Patel [Tue, 9 Aug 2016 17:02:17 +0000 (17:02 +0000)]
auto-generate checks

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

8 years agoauto-generate checks
Sanjay Patel [Tue, 9 Aug 2016 16:59:54 +0000 (16:59 +0000)]
auto-generate checks

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

8 years agotest-release.sh: Drop autoconf support
Hans Wennborg [Tue, 9 Aug 2016 16:46:02 +0000 (16:46 +0000)]
test-release.sh: Drop autoconf support

The autoconf build was deleted some time ago.

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

8 years agoadd tests for missing vector icmp folds
Sanjay Patel [Tue, 9 Aug 2016 16:39:05 +0000 (16:39 +0000)]
add tests for missing vector icmp folds

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

8 years agoupdate to use FileCheck and auto-generate checks
Sanjay Patel [Tue, 9 Aug 2016 16:19:57 +0000 (16:19 +0000)]
update to use FileCheck and auto-generate checks

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

8 years agoregenerate checks
Sanjay Patel [Tue, 9 Aug 2016 16:17:46 +0000 (16:17 +0000)]
regenerate checks

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

8 years agoadd tests for missing vector icmp folds
Sanjay Patel [Tue, 9 Aug 2016 16:05:57 +0000 (16:05 +0000)]
add tests for missing vector icmp folds

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

8 years ago[Profile] turn off verbose warnings by default
Xinliang David Li [Tue, 9 Aug 2016 15:35:28 +0000 (15:35 +0000)]
[Profile] turn off verbose warnings by default

no prof data for func warning is turned off by default
due to its high verbosity and minimal usefulness.

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

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

8 years ago[LVI] Make LVI smarter about comparisons with non-constants
Artur Pilipenko [Tue, 9 Aug 2016 14:50:08 +0000 (14:50 +0000)]
[LVI] Make LVI smarter about comparisons with non-constants

Make LVI smarter about comparisons with a non-constant. For example, a s< b constraints a to be in [INT_MIN, INT_MAX) range. This is a part of https://llvm.org/bugs/show_bug.cgi?id=28620 fix.

Reviewed By: sanjoy

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

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

8 years ago[X86][XOP] Add support for combining target shuffles to VPERMIL2PD/VPERMIL2PS
Simon Pilgrim [Tue, 9 Aug 2016 12:56:15 +0000 (12:56 +0000)]
[X86][XOP] Add support for combining target shuffles to VPERMIL2PD/VPERMIL2PS

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

8 years agoAdd `#ifdef __cplusplus` around `extern "C"` in Compiler.h. NFC.
Kuba Brecka [Tue, 9 Aug 2016 12:12:15 +0000 (12:12 +0000)]
Add `#ifdef __cplusplus` around `extern "C"` in Compiler.h.  NFC.

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

8 years agoAVX-512: A new test for FMA intrinsic
Elena Demikhovsky [Tue, 9 Aug 2016 11:54:14 +0000 (11:54 +0000)]
AVX-512: A new test for FMA intrinsic

A new test that explores sub-optimal sequence of FMA intrinsic and FNEG operation.
An upcoming patch will fix it.

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

8 years ago[X86][XOP] Add support for combining target shuffles to VPPERM
Simon Pilgrim [Tue, 9 Aug 2016 10:56:29 +0000 (10:56 +0000)]
[X86][XOP] Add support for combining target shuffles to VPPERM

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

8 years ago[XRay] Test for xray_instr_map in object file. (NFC)
Dean Michael Berris [Tue, 9 Aug 2016 10:42:11 +0000 (10:42 +0000)]
[XRay] Test for xray_instr_map in object file. (NFC)

This makes a trivial change in the emission of the per-function XRay
tables, and makes sure that the xray_instr_map section does show up in
the object file.

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

8 years agoRevert 278107 which causes buildbot failures and in addition has wrong commit message
Artur Pilipenko [Tue, 9 Aug 2016 10:00:22 +0000 (10:00 +0000)]
Revert 278107 which causes buildbot failures and in addition has wrong commit message

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

8 years ago[modules]Add missing include.
Vassil Vassilev [Tue, 9 Aug 2016 09:46:11 +0000 (09:46 +0000)]
[modules]Add missing include.

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

8 years agoTeach CorrelatedValuePropagation to mark adds as no wrap
Artur Pilipenko [Tue, 9 Aug 2016 09:41:34 +0000 (09:41 +0000)]
Teach CorrelatedValuePropagation to mark adds as no wrap

Use LVI to prove that adds do not wrap. The change is motivated by https://llvm.org/bugs/show_bug.cgi?id=28620 bug and it's the first step to fix that problem.

Reviewed By: sanjoy

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

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

8 years ago[X86][SSE] Fix memory folding of (v)roundsd / (v)roundss
Simon Pilgrim [Tue, 9 Aug 2016 09:32:34 +0000 (09:32 +0000)]
[X86][SSE] Fix memory folding of (v)roundsd / (v)roundss

We only had partial memory folding support for the intrinsic definitions, and (as noted on PR27481) was causing FR32/FR64/VR128 mismatch errors with the machine verifier.

This patch adds missing memory folding support for both intrinsics and the ffloor/fnearbyint/fceil/frint/ftrunc patterns and in doing so fixes the failing machine verifier stack folding tests from PR27481.

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

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

8 years ago[LVI] NFC. Fix a typo Bofore -> Before
Artur Pilipenko [Tue, 9 Aug 2016 09:14:29 +0000 (09:14 +0000)]
[LVI] NFC. Fix a typo Bofore -> Before

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

8 years ago[X86] Reduce duplicated code in the execution domain lookup functions by passing...
Craig Topper [Tue, 9 Aug 2016 05:26:09 +0000 (05:26 +0000)]
[X86] Reduce duplicated code in the execution domain lookup functions by passing tables as an argument.

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

8 years ago[AVX-512] Add support for execution domain switching masked logical ops between float...
Craig Topper [Tue, 9 Aug 2016 05:26:07 +0000 (05:26 +0000)]
[AVX-512] Add support for execution domain switching masked logical ops between floating point and integer domain.

This switches PS<->D and PD<->Q.

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

8 years ago[X86] Remove the Fv packed logical operation alias instructions. Replace them with...
Craig Topper [Tue, 9 Aug 2016 03:06:33 +0000 (03:06 +0000)]
[X86] Remove the Fv packed logical operation alias instructions. Replace them with patterns to the regular instructions.

This enables execution domain fixing which is why the tests changed.

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

8 years ago[X86] Cleanup patterns for AVX/SSE for PS operations. Always try to look for bitcasts...
Craig Topper [Tue, 9 Aug 2016 03:06:28 +0000 (03:06 +0000)]
[X86] Cleanup patterns for AVX/SSE for PS operations. Always try to look for bitcasts from floating point types. If only AVX1 is supported we also need to handle integer types with floating point ops without looking for bitcasts.

Previously SSE1 had a pattern that looked for integer types without bitcasts, but the type wasn't legal with only SSE1 and SSE2 add an identical pattern for the integer instructions.

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

8 years ago[X86] Remove unnecessary bitcast from the front of AVX1Only 256-bit logical operation...
Craig Topper [Tue, 9 Aug 2016 03:06:26 +0000 (03:06 +0000)]
[X86] Remove unnecessary bitcast from the front of AVX1Only 256-bit logical operation patterns.

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

8 years agoX86InstrInfo: Update liveness in classifyLea()
Matthias Braun [Tue, 9 Aug 2016 01:47:26 +0000 (01:47 +0000)]
X86InstrInfo: Update liveness in classifyLea()

We need to update liveness information when we create COPYs in
classifyLea().

This fixes http://llvm.org/28301

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

8 years ago[WebAssembly] Fix bugs in WebAssemblyLowerEmscriptenExceptions pass
Derek Schuff [Tue, 9 Aug 2016 00:29:55 +0000 (00:29 +0000)]
[WebAssembly] Fix bugs in WebAssemblyLowerEmscriptenExceptions pass

* Delete extra '_' prefixes from JS library function names. fixImports()
  function in JS glue code deals with this for wasm.
* Change command-line option names in order to be consistent with
  asm.js.
* Add missing lowering code for llvm.eh.typeid.for intrinsics
* Delete commas in mangled function names
* Fix a function argument attributes bug. Because we add the pointer to
  the original callee as the first argument of invoke wrapper, all
  argument attribute indices have to be incremented by one.

Patch by Heejin Ahn

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

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

8 years agoConsistently use CGSCCAnalysisManager
Sean Silva [Tue, 9 Aug 2016 00:28:56 +0000 (00:28 +0000)]
Consistently use CGSCCAnalysisManager

Besides a general consistently benefit, the extra layer of indirection
allows the mechanical part of https://reviews.llvm.org/D23256 that
requires touching every transformation and analysis to be factored out
cleanly.

Thanks to David for the suggestion.

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

8 years agoConsistently use LoopAnalysisManager
Sean Silva [Tue, 9 Aug 2016 00:28:52 +0000 (00:28 +0000)]
Consistently use LoopAnalysisManager

One exception here is LoopInfo which must forward-declare it (because
the typedef is in LoopPassManager.h which depends on LoopInfo).

Also, some includes for LoopPassManager.h were needed since that file
provides the typedef.

Besides a general consistently benefit, the extra layer of indirection
allows the mechanical part of https://reviews.llvm.org/D23256 that
requires touching every transformation and analysis to be factored out
cleanly.

Thanks to David for the suggestion.

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

8 years agoConsistently use ModuleAnalysisManager
Sean Silva [Tue, 9 Aug 2016 00:28:38 +0000 (00:28 +0000)]
Consistently use ModuleAnalysisManager

Besides a general consistently benefit, the extra layer of indirection
allows the mechanical part of https://reviews.llvm.org/D23256 that
requires touching every transformation and analysis to be factored out
cleanly.

Thanks to David for the suggestion.

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

8 years agoConsistently use FunctionAnalysisManager
Sean Silva [Tue, 9 Aug 2016 00:28:15 +0000 (00:28 +0000)]
Consistently use FunctionAnalysisManager

Besides a general consistently benefit, the extra layer of indirection
allows the mechanical part of https://reviews.llvm.org/D23256 that
requires touching every transformation and analysis to be factored out
cleanly.

Thanks to David for the suggestion.

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

8 years agoCodeView: extract the OMF Directory Header
Saleem Abdulrasool [Tue, 9 Aug 2016 00:25:12 +0000 (00:25 +0000)]
CodeView: extract the OMF Directory Header

The DebugDirectory contains a pointer to the CodeView info structure which is a
derivative of the OMF debug directory.  The structure has evolved a bit over
time, and PDB 2.0 used a slightly different definition from PDB 7.0.  Both of
these are specific to CodeView and not COFF.  Reflect this by moving the
structure definitions into the DebugInfo/CodeView headers.  Define a generic
DebugInfo union type that can be used to pass around a reference to the
DebugInfo irrespective of the versioning.  NFC.

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

8 years ago[x86] split combineVSelectWithAllOnesOrZeros into a helper function; NFCI
Sanjay Patel [Tue, 9 Aug 2016 00:01:11 +0000 (00:01 +0000)]
[x86] split combineVSelectWithAllOnesOrZeros into a helper function; NFCI

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

8 years ago[WebAssembly] Fix CFI index to account for padding nullptr function
Derek Schuff [Mon, 8 Aug 2016 23:56:01 +0000 (23:56 +0000)]
[WebAssembly] Fix CFI index to account for padding nullptr function

The WebAssembly linker now creates a dummy function at index 0 to
prevent miscomparisons with the NULL pointer, see
https://github.com/WebAssembly/binaryen/pull/658. Thanks to pcc for
pointing out this problem!

Patch by Dominic Chen

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

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

8 years agoRevert "Do not ignore SizeOfOptionalHeader in COFF header even if PE header is not...
Rui Ueyama [Mon, 8 Aug 2016 23:07:03 +0000 (23:07 +0000)]
Revert "Do not ignore SizeOfOptionalHeader in COFF header even if PE header is not present."

This reverts commit r278066 to unbreak buildbots.

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

8 years agoRevert r278065 while I investigate some build-bot breakage.
Lang Hames [Mon, 8 Aug 2016 22:57:30 +0000 (22:57 +0000)]
Revert r278065 while I investigate some build-bot breakage.

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

8 years agoDo not ignore SizeOfOptionalHeader in COFF header even if PE header is not present.
Rui Ueyama [Mon, 8 Aug 2016 22:54:22 +0000 (22:54 +0000)]
Do not ignore SizeOfOptionalHeader in COFF header even if PE header is not present.

Attribute SizeOfOptionalHeader is ignored if no PE header is present
in the file. This attribute should be ignored according to standard,
however there are uses of this field even though it should not be used.

This change does not conform to PE/COFF standard, but there are several
COFF files without PE header, where you had to add up SizeOfOptionalHeader
in order to get proper section headers. Other tools and their own parsers
do take this into account.

Patch by Marek Milkovič!

https://reviews.llvm.org/D22750

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

8 years ago[RuntimeDyld][Orc][MCJIT] Add partial weak-symbol support to RuntimeDyld.
Lang Hames [Mon, 8 Aug 2016 22:53:37 +0000 (22:53 +0000)]
[RuntimeDyld][Orc][MCJIT] Add partial weak-symbol support to RuntimeDyld.

This patch causes RuntimeDyld to check for existing definitions when it
encounters weak symbols. If a definition already exists then the new weak
definition is discarded. All symbol lookups within a "logical dylib" should now
agree on the address of any given weak symbol. This allows the JIT to better
match the behavior of the static linker for C++ code.

This support is only partial, as it does not allow strong definitions that
occur after the first weak definition (in JIT symbol lookup order) to override
the previous weak definitions. Support for this will be added in a future
patch.

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

8 years agoRevert "[X86] Support the "ms-hotpatch" attribute."
Charles Davis [Mon, 8 Aug 2016 21:20:15 +0000 (21:20 +0000)]
Revert "[X86] Support the "ms-hotpatch" attribute."

This reverts commit r278048. Something changed between the last time I
built this--it takes awhile on my ridiculously slow and ancient
computer--and now that broke this.

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

8 years agoInstCombine: Remove a redundant #ifdef NDEBUG. NFC
Justin Bogner [Mon, 8 Aug 2016 21:02:11 +0000 (21:02 +0000)]
InstCombine: Remove a redundant #ifdef NDEBUG. NFC

The DEBUG() macro already does this.

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

8 years ago[X86] Support the "ms-hotpatch" attribute.
Charles Davis [Mon, 8 Aug 2016 21:01:39 +0000 (21:01 +0000)]
[X86] Support the "ms-hotpatch" attribute.

Summary:
Based on two patches by Michael Mueller.

This is a target attribute that causes a function marked with it to be
emitted as "hotpatchable". This particular mechanism was originally
devised by Microsoft for patching their binaries (which they are
constantly updating to stay ahead of crackers, script kiddies, and other
ne'er-do-wells on the Internet), but is now commonly abused by Windows
programs to hook API functions.

This mechanism is target-specific. For x86, a two-byte no-op instruction
is emitted at the function's entry point; the entry point must be
immediately preceded by 64 (32-bit) or 128 (64-bit) bytes of padding.
This padding is where the patch code is written. The two byte no-op is
then overwritten with a short jump into this code. The no-op is usually
a `movl %edi, %edi` instruction; this is used as a magic value
indicating that this is a hotpatchable function.

Reviewers: majnemer, sanjoy, rnk

Subscribers: dberris, llvm-commits

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

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

8 years ago[MemorySSA] Fix windows build breakage caused by r278028 (take 2)
Geoff Berry [Mon, 8 Aug 2016 19:33:27 +0000 (19:33 +0000)]
[MemorySSA] Fix windows build breakage caused by r278028 (take 2)

r278028: [MemorySSA] Ensure address stability of MemorySSA object.

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

8 years ago[Hexagon] Add pattern for 64-bit mulhs
Krzysztof Parzyszek [Mon, 8 Aug 2016 19:24:25 +0000 (19:24 +0000)]
[Hexagon] Add pattern for 64-bit mulhs

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

8 years ago[LoopUnroll] Simplify loops created by unrolling.
Michael Zolotukhin [Mon, 8 Aug 2016 19:02:15 +0000 (19:02 +0000)]
[LoopUnroll] Simplify loops created by unrolling.

Summary:
Currently loop-unrolling doesn't preserve loop-simplified form. This patch
fixes it by resimplifying affected loops.

Reviewers: chandlerc, sanjoy, hfinkel

Subscribers: llvm-commits

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

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

8 years agoRefreshCallGraph does not modify the SCC, adding "const" to make it clear (NFC)
Mehdi Amini [Mon, 8 Aug 2016 18:51:05 +0000 (18:51 +0000)]
RefreshCallGraph does not modify the SCC, adding "const" to make it clear (NFC)

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

8 years ago[MemorySSA] Fix windows build breakage caused by r278028
Geoff Berry [Mon, 8 Aug 2016 18:27:22 +0000 (18:27 +0000)]
[MemorySSA] Fix windows build breakage caused by r278028

r278028: [MemorySSA] Ensure address stability of MemorySSA object.

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