137217 Commits

Author SHA1 Message Date
Simon Pilgrim
50fbf501e3 [CostModel][X86] Add fdiv + frem cost tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279283 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 17:39:00 +00:00
Sanjay Patel
0cb38859e1 [InstCombine] use local variables to reduce code in foldICmpShlConstant; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279282 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 17:34:05 +00:00
Krzysztof Parzyszek
40f2f0a8b7 [Hexagon] Fix a few omissions in HexagonInstrInfo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279280 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 17:20:57 +00:00
Sanjay Patel
f5027c2a06 [InstCombine] rename variables in foldICmpShlConstant(); NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279279 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 17:20:37 +00:00
Tim Northover
2fd227abc8 GlobalISel: support overflow arithmetic intrinsics.
Unsigned addition and subtraction can reuse the instructions created to
legalize large width operations (i.e. both produce and consume a carry flag).
Signed operations and multiplies get a dedicated op-with-overflow instruction.

Once this is produced the two values are combined into a struct register (which
will almost always be merged with a corresponding G_EXTRACT as part of
legalization).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279278 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 17:17:06 +00:00
Vitaly Buka
31c625e355 Revert "[asan] Optimize store size in FunctionStackPoisoner::poisonRedZones"
This reverts commit r279178.

Speculative revert in hope to fix asan crash on arm.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279277 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 17:15:38 +00:00
Vitaly Buka
588e241acb Revert "[asan] Fix size of shadow incorrectly calculated in r279178"
This reverts commit r279222.

Speculative revert in hope to fix asan crash on arm.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279276 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 17:15:33 +00:00
Lang Hames
472f1cbd1f [RuntimeDyld] Revert r279182 and 279201 -- they broke some ARM bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279275 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 17:06:39 +00:00
Michael Kuperstein
15095e4af8 [AliasSetTracker] Degrade AliasSetTracker when may-alias sets get too large.
Repeated inserts into AliasSetTracker have quadratic behavior - inserting a
pointer into AST is linear, since it requires walking over all "may" alias
sets and running an alias check vs. every pointer in the set.

We can avoid this by tracking the total number of pointers in "may" sets,
and when that number exceeds a threshold, declare the tracker "saturated".
This lumps all pointers into a single "may" set that aliases every other
pointer.

(This is a stop-gap solution until we migrate to MemorySSA)

This fixes PR28832.
Differential Revision: https://reviews.llvm.org/D23432


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279274 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 17:05:22 +00:00
Simon Pilgrim
c05f998efe [X86][SSE] Generalised combining to VZEXT_MOVL to any vector size
This doesn't change tests codegen as we already combined to blend+zero which is what we lower VZEXT_MOVL to on SSE41+ targets, but it does put us in a better position when we improve shuffling for optsize.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279273 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 17:02:00 +00:00
Krzysztof Parzyszek
1ea0947ff4 [Hexagon] Enforce LLSC packetization rules
Ensure that load locked and store conditional instructions are only
packetized with ALU32 instructions.

Patch by Ben Craig.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279272 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 16:57:05 +00:00
Reid Kleckner
baeb19c0b9 Fix regression in InstCombine introduced by r278944
The intended transform is:
  // Simplify icmp eq (or (ptrtoint P), (ptrtoint Q)), 0
  // -> and (icmp eq P, null), (icmp eq Q, null).

P and Q are both pointer types, but may have different types. We need
two calls to getNullValue() to make the icmps.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279271 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 16:53:18 +00:00
Tom Stellard
0b2da49260 MachineScheduler: Make some GenericScheduler member variables protected
Summary: We will need these in AMDGPU's new SchedStrategy implmentation.

Reviewers: MatzeB, atrick

Subscribers: llvm-commits, MatzeB

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279270 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 16:44:32 +00:00
Krzysztof Parzyszek
3930987e21 [Hexagon] Minor updates to register definitions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279269 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 16:40:19 +00:00
David Majnemer
c00499c663 [CloneFunction] Don't remove unrelated nodes from the CGSSC
CGSCC use a WeakVH to track call sites.  RAUW a call within a function
can result in that WeakVH getting confused about whether or not the call
site is still around.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279268 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 16:37:40 +00:00
Krzysztof Parzyszek
0ad37f781f [Hexagon] Fix incorrect generation of S4_subi_asl_ri
Patch by Jyotsna Verma.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279267 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 16:35:05 +00:00
Sanjay Patel
1238f8d56b [InstCombine] use m_APInt to allow icmp (shl 1, Y), C folds for splat constant vectors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279266 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 16:12:16 +00:00
Krzysztof Parzyszek
66e19711ac [Hexagon] Add missing pattern for C4_cmplte
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279265 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 16:11:33 +00:00
Sanjay Patel
ee783de739 [InstCombine] use m_APInt to allow icmp X, C folds for splat constant vectors
Of course, we really need to refactor and fix all of the cmp predicates, 
but this one is interesting because without it, we later perform an 
information-losing transform of icmp (shl 1, Y), C, and we can't recover
the better fold.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279263 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 15:40:44 +00:00
Mehdi Amini
3287fed753 [LTO] Remove dead-code: collectUsedGlobalVariables has been moved to Thin and LTO specifc path (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279261 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 15:35:44 +00:00
Sanjay Patel
f17d15a58d [InstCombine] add tests for missing vector icmp folds
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279259 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 15:27:28 +00:00
Sanjay Patel
762d2ecc14 [InstCombine] add missing tests for basic icmp folds
These are implicitly included as part of larger test cases, but they don't 
exist stand-alone (and don't happen for vectors...).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279257 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 15:21:45 +00:00
Krzysztof Parzyszek
1e982df509 [Hexagon] Make p0 an explicit operand in VA1_clr* subinstructions, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279255 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 15:17:19 +00:00
Krzysztof Parzyszek
f7fe146c5a [Hexagon] Add explicit default constructor for HexagonSelectionDAGInfo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279254 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 15:13:54 +00:00
Krzysztof Parzyszek
2f2ca67d84 Unxfail passing tests on Hexagon
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279252 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 15:07:58 +00:00
Krzysztof Parzyszek
041a158c5d [Hexagon] Allow tail-call optimization when mixing C and fast calling conv
Patch by Arnold Schwaighofer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279251 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 15:02:18 +00:00
Krzysztof Parzyszek
b6b40cf4e9 [Hexagon] Check for empty live interval
Patch by Brendon Cahoon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279249 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 14:29:43 +00:00
Krzysztof Parzyszek
efe70d2368 [Hexagon] Consider zext/sext of a load to i32 to be free
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279248 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 14:22:07 +00:00
Anton Korobeynikov
8935d870ca Revert r279242 - it's failing the tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279247 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 14:18:34 +00:00
Krzysztof Parzyszek
09091ea512 [Hexagon] Handle J2_jumptpt and J2_jumpfpt instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279246 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 14:14:09 +00:00
Krzysztof Parzyszek
b8ce83f3cd [Hexagon] Fix indentation, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279245 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 14:12:51 +00:00
Krzysztof Parzyszek
89c1dd3771 [Hexagon] Remove unnecessary llvm::, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279244 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 14:10:57 +00:00
Krzysztof Parzyszek
288392e3a9 [Hexagon] Rename the HEXAGON_MC namespace to Hexagon_MC, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279243 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 14:09:47 +00:00
Anton Korobeynikov
b8b1bfcdcb Fix PR27500: on MSP430 the branch destination offset is measured in words, not bytes.
In addition, the branch instructions will have proper BB destinations, not offsets, like before.

Patch by Vadzim Dambrouski!

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279242 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 14:07:10 +00:00
Krzysztof Parzyszek
8fa77e005c [Hexagon] Mark PS_jumpret as pseudo-instruction, expand it into J2_jumpr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279241 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 14:04:45 +00:00
Krzysztof Parzyszek
43073745de [Hexagon] Improvements to handling and generation of FP instructions
Improved handling of fma, floating point min/max, additional load/store
instructions for floating point types.

Patch by Jyotsna Verma.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279239 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 13:34:31 +00:00
Benjamin Kramer
7393ed54be [LoopVectorize] Don't copy std::vector in for-range loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279233 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 12:44:24 +00:00
Chandler Carruth
7d191bbd95 [PM] Revert r279227 and r279228 until I can find someone to help me
solve completely opaque MSVC build errors. It complains about lots of
stuff with this change without givin nearly enough information to even
try to fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279231 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 10:51:55 +00:00
Simon Pilgrim
9962acc5e8 [X86][SSE] Add support for matching commuted insertps patterns
INSERTPS doesn't fit well with our shuffle mask canonicalization, so we need to attempt both the original mask and the commuted mask to more likely get a match

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279230 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 10:31:53 +00:00
James Molloy
028b488adc [SimplifyCFG] Rewrite SinkThenElseCodeToEnd
The new version has several advantages:
  1) IMSHO it's more readable and neater
  2) It handles loads and stores properly
  3) It can handle any number of incoming blocks rather than just two. I'll be taking advantage of this in a followup patch.

With this change we can now finally sink load-modify-store idioms such as:

    if (a)
      return *b += 3;
    else
      return *b += 4;

    =>

    %z = load i32, i32* %y
    %.sink = select i1 %a, i32 5, i32 7
    %b = add i32 %z, %.sink
    store i32 %b, i32* %y
    ret i32 %b

When this works for switches it'll be even more powerful.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279229 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 10:10:27 +00:00
Chandler Carruth
7fdf9ef04b [PM] Fix a compile error with GCC. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279228 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 09:53:10 +00:00
Chandler Carruth
73e7eb0a79 [PM] Make the the new pass manager support fully generic extra arguments
to run methods, both for transform passes and analysis passes.

This also allows the analysis manager to use a different set of extra
arguments from the pass manager where useful. Consider passes over
analysis produced units of IR like SCCs of the call graph or loops.
Passes of this nature will often want to refer to the analysis result
that was used to compute their IR units (the call graph or LoopInfo).
And for transformations, they may want to communicate special update
information to the outer pass manager. With this change, it becomes
possible to have a run method for a loop pass that looks more like:

  PreservedAnalyses run(Loop &L, AnalysisManager<Loop, LoopInfo> &AM,
                        LoopInfo &LI, LoopUpdateRecord &UR);

And to query the analysis manager like:

    AM.getResult<MyLoopAnalysis>(L, LI);

This makes accessing the known-available analyses convenient and clear,
and it makes passing customized data structures around easy.

My initial use case is going to be in updating the pass manager layers
when the analysis units of IR change. But there are more use cases here
such as having a layer that lets inner passes signal whether certain
additional passes should be run because of particular simplifications
made. Two desires for this have come up in the past: triggering
additional optimization after successfully unrolling loops, and
triggering additional inlining after collapsing indirect calls to direct
calls.

Despite adding this layer of generic extensibility, the *only* change to
existing, simple usage are for places where we forward declare the
AnalysisManager template. We really shouldn't be doing this because of
the fragility exposed here, but currently it makes coping with the
legacy PM code easier.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279227 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 09:45:16 +00:00
Chandler Carruth
ae4f3e524d [PM] Try to work-around what appears to be an MSVC SFINAE issue with
r279217 where it fails to select the path that other compilers select.

The workaround won't be as careful to produce an error when an analysis
result is incorrect, but we can rely on non-MSVC builds to catch such
errors it seems and MSVC doesn't seem to support the alternative
techniques.

Hoping this brings the windows bots back to life. If not, will have to
revert all of this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279225 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 09:26:00 +00:00
James Molloy
341574b2ad [CodeGen] Fix a trivial type conversion bug dating back to pre-2008
The heuristic above this code is incredibly suspect, but disregarding that it mutates the cast opcode so we need to check the *mutated* opcode later to see if we need to emit an AssertSext or AssertZext node.

Fixes PR29041.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279223 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 08:38:50 +00:00
Vitaly Buka
bc8fdf73ab [asan] Fix size of shadow incorrectly calculated in r279178
Summary: r279178 generates 8 times more stores than necessary.

Reviewers: eugenis

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279222 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 08:33:53 +00:00
Chandler Carruth
6567bc1e29 [PM] NFC refactoring: remove the AnalysisManagerBase class, folding it
into the AnalysisManager class template.

Back when I first added this base class there were separate analysis
managers and some plausible reason why it would be a useful factoring of
common code between them. However, after a lot of refactoring cleaning,
we now have *entirely* shared code. The base class was just an arbitrary
division between code in one class template and a separate class
template. It didn't add anything and forced lots of indirection through
"derived_this" for no real gain.

We can always factor a base CRTP class out with common code if there is
ever some *other* analysis manager that wants to share a subset of
logic. But for now, folding things into the primary template is
a non-trivial simplification with no down sides I see. It shortens the
code considerably, removes an unhelpful abstraction, and will make
subsequent patches *dramatically* less complex which enhance the
analysis manager infrastructure to effectively cope with invalidation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279221 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 08:31:47 +00:00
Vassil Vassilev
3644902da1 [modules] Add missing include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279219 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 08:30:42 +00:00
Chandler Carruth
8c3a8f8074 [PM] Redesign how the new PM detects whether an analysis result provides
its own invalidate method.

Previously, the technique would assume that if a result didn't have an
invalidate method that didn't exactly match the expected signature it
didn't have one at all. This is in fact not the case. And we had
analyses with incorrect signatures for the invalidate method in the
tree that would be erroneously invalidated in certain cases! Yikes.

Moreover a result might legitimately want to have multiple overloads for
the invalidate method, and if one changes or a new one is needed we
again really want a compiler error. For example in the tree we had not
added the overload for a *function* IR unit to the invalidate routine
for TLI. Doh.

So a new techique for the SFINAE detection here: if the result has *any*
member spelled "invalidate" we turn off the synthesis of a default
version. We don't care if it is a member function or a member variable
or how many overloads there are. Once a result has something by that
name it must provide suitable overloads for the contexts in which it is
used. This seems much more resilient and durable.

Huge props to Richard Smith who helped me figure out how on earth we
could even do this in C++. It took quite some doing. The technique is
remarkably clean however, and merely requires that the analysis results
are not *final* classes. I think that's a requirement we can live with
even if it is a bit odd.

I've fixed the two bad in-tree analysis results. And this will make my
next change which changes the API for invalidate much easier to
validate as correct.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279217 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 07:49:23 +00:00
Chandler Carruth
fefaef7b6e [PM] Rework the new PM support for building the ModuleSummaryIndex to
directly produce the index as the value type result.

This requires making the index movable which is straightforward. It
greatly simplifies things by allowing us to completely avoid the builder
API and the layers of abstraction inherent there. Instead both pass
managers can directly construct these when run by value. They still
won't be constructed truly eagerly thanks to the optional in the legacy
PM. The code that directly builds the index can also just share a direct
function.

A notable change here is that the result type of the analysis for the
new PM is no longer a reference type. This was really problematic when
making changes to how we handle result types to make our interface
requirements *much* more strict and precise. But I think this is an
overall improvement.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279216 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 07:49:19 +00:00
NAKAMURA Takumi
edd69949b5 Fix tests in llvm/test/tools/gold/X86 to satisfy r279014.
They would unexpectedly pass if test/tools/gold/X86/Output had outputs of previous tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279214 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 06:44:44 +00:00