Commit Graph

121067 Commits

Author SHA1 Message Date
Alex Lorenz
baf422e9ec MIR Serialization: Serialize defined registers that require 'def' register flag.
The defined registers are already serialized - they are represented by placing
them before the '=' in a machine instruction. However, certain instructions like
INLINEASM can have defined register operands after the '=', so this commit
introduces the 'def' register flag for such operands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245480 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 18:55:47 +00:00
Bruno Cardoso Lopes
71a40e6fef [PeepholeOptimizer] Look through PHIs to find additional register sources
Reintroduce r245442. Remove an overly conservative assertion introduced
in r245442. We could replace the assertion to use `shareSameRegisterFile`
instead, but in that point in `insertPHI` we already lost the original
Def subreg to check against. So drop the assertion completely.

Original commit message:

- Teaches the ValueTracker in the PeepholeOptimizer to look through PHI
instructions.
- Add findNextSourceAndRewritePHI method to lookup into multiple sources
returnted by the ValueTracker and rewrite PHIs with new sources.

With these changes we can find more register sources and rewrite more
copies to allow coaslescing of bitcast instructions. Hence, we eliminate
unnecessary VR64 <-> GR64 copies in x86, but it could be extended to
other archs by marking "isBitcast" on target specific instructions. The
x86 example follows:

A:
  psllq %mm1, %mm0
  movd  %mm0, %r9
  jmp C

B:
  por %mm1, %mm0
  movd  %mm0, %r9
  jmp C

C:
  movd  %r9, %mm0
  pshufw  $238, %mm0, %mm0

Becomes:

A:
  psllq %mm1, %mm0
  jmp C

B:
  por %mm1, %mm0
  jmp C

C:
  pshufw  $238, %mm0, %mm0

Differential Revision: http://reviews.llvm.org/D11197
rdar://problem/20404526

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245479 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 18:53:36 +00:00
Douglas Katzman
52dfca7612 [SPARC] Enable writing to floating-point-state register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245475 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 18:34:48 +00:00
Lang Hames
1356c7901a [Kaleidoscope] More inter-chapter diff reduction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245474 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 18:32:58 +00:00
Vedant Kumar
4d554fb21d [docs] Fix minor typo in CodingStandards.rst
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245473 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 18:19:12 +00:00
Lang Hames
44364a33be [Kaleidoscope] Clang-format the Kaleidoscope tutorials.
Also reduces changes between tutorial chapters.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245472 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 18:15:58 +00:00
Ahmed Bougacha
09f1564d23 [AArch64] Improve short-form diags on long-form Match_InvalidOperand.
Since r244955, we try to use the short-form ErrorInfo when both
tries failed, and the long-form match failed on a suffix operand.
However, this means we sometimes mix ErrorInfo and MatchResult
(one manifestation of this being PR24498). Instead, restore both.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245469 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 17:40:19 +00:00
Hal Finkel
25faeeb8fe [SCEV] Fix GCC 4.8.0 ICE in lambda function
Rewrite some code to not use a lambda function. The non-lambda code is just
about as clean as the original, and not any longer. The lambda function causes
an internal compiler error in GCC 4.8.0, and it is not worth breaking support
for that compiler over this. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245466 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 17:26:07 +00:00
Adam Nemet
fc5268df60 [LAA] Comment how memchecks are codegened
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245465 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 17:24:36 +00:00
Renato Golin
29471d2cb3 Revert "[AArch64] Simplify/refactor code to ease code review. NFC."
This reverts commit r245443, as it broke AArch64 test-suite tramp3d
with an assert "Reg && "Null register has no regunits".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245455 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 16:29:53 +00:00
Derek Schuff
946eb8b5c6 x32. Fixes a bug in x32 exception handling.
This patch updates the X86 lowering so that the Exception Pointer and Selector
are 64-bit wide only if Subtarget.isTarget64BitLP64.

Patch by João Porto

Reviewers: dschuff, rnk
Differential Revision: http://reviews.llvm.org/D12111

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245454 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 16:28:21 +00:00
JF Bastien
36fdcfb93a x32. Fixes jmp %reg in x32
x32 has 32-bit pointers; x86-64 can't jmp %r32. This patch addresses this issue by explicitly zero-extending brind's target to 64-bits.

Author: jpp

Reviewers: jfb, dschuff, pavel.v.chupin

Subscribers: llvm-commits

Differential revision: http://reviews.llvm.org/D12112

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245452 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 16:17:08 +00:00
James Y Knight
f760d95bde [Sparc] Rename LoadASR and StoreASR from r245360 to *ASI, as was intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245450 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 15:59:49 +00:00
Bruno Cardoso Lopes
1b1f2b2c94 Revert "[PeepholeOptimizer] Look through PHIs to find additional register sources"
Revert r245442 while investigating a fix. An assertion hit in
http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_build/11380

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245446 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 15:10:32 +00:00
James Y Knight
77c6e1a3a4 [SPARC] Fix BooleanContents, so that select of a trunc doesn't
eliminate the trunc.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245444 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 14:47:04 +00:00
Chad Rosier
468e70fe4f [AArch64] Simplify/refactor code to ease code review. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245443 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 14:34:54 +00:00
Bruno Cardoso Lopes
bccacca585 [PeepholeOptimizer] Look through PHIs to find additional register sources
Reapply r243486.

- Teaches the ValueTracker in the PeepholeOptimizer to look through PHI
instructions.
- Add findNextSourceAndRewritePHI method to lookup into multiple sources
returnted by the ValueTracker and rewrite PHIs with new sources.

With these changes we can find more register sources and rewrite more
copies to allow coaslescing of bitcast instructions. Hence, we eliminate
unnecessary VR64 <-> GR64 copies in x86, but it could be extended to
other archs by marking "isBitcast" on target specific instructions. The
x86 example follows:

A:
  psllq %mm1, %mm0
  movd  %mm0, %r9
  jmp C

B:
  por %mm1, %mm0
  movd  %mm0, %r9
  jmp C

C:
  movd  %r9, %mm0
  pshufw  $238, %mm0, %mm0

Becomes:

A:
  psllq %mm1, %mm0
  jmp C

B:
  por %mm1, %mm0
  jmp C

C:
  pshufw  $238, %mm0, %mm0

Differential Revision: http://reviews.llvm.org/D11197
rdar://problem/20404526

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245442 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 14:34:41 +00:00
Silviu Baranga
5a1af3657c [ARM] Add instruction selection patterns for vmin/vmax
Summary:
The mid-end was generating vector smin/smax/umin/umax nodes, but
we were using vbsl to generatate the code. This adds the vmin/vmax
patterns and a test to check that we are now generating vmin/vmax
instructions.

Reviewers: rengolin, jmolloy

Subscribers: aemerson, rengolin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245439 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 14:11:27 +00:00
Joerg Sonnenberger
ba54a70bf3 Map %fprs to %asr6 in the Sparc assembler parser.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245437 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 13:55:14 +00:00
Daniel Sanders
c457f1e27b Emit <regmask R1 R2 R3 ...> instead of just <regmask> in IR dumps.
Reviewers: qcolombet

Subscribers: kparzysz, qcolombet, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245433 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 12:03:04 +00:00
Tobias Grosser
ab30763357 Revert "[X86] Widen the 'AND' mask if doing so shrinks the encoding size"
This reverts commit 245169 which miscompiles MultiSource/Applications/siod
from LNT.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245432 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 11:35:10 +00:00
Michael Kuperstein
e8a6608a75 [X86] Do not lower scalar sdiv/udiv to a shifts + mul sequence when optimizing for minsize
There are some cases where the mul sequence is smaller, but for the most part,
using a div is preferable. This does not apply to vectors, since x86 doesn't
have vector idiv, and a vector mul/shifts sequence ought to be smaller than a
scalarized division.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245431 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 11:21:43 +00:00
Michael Kuperstein
a4fe29414d [TLI] Refactor "is integer division cheap" queries.
This removes the isPow2SDivCheap() query, as it is not currently used in
any meaningful way. isIntDivCheap() no longer relies on a state variable
(as all in-tree target set it to false), but the interface allows querying
based on the type optimization level.

NFC.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245430 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 11:17:59 +00:00
Alexander Kornienko
d1c298190e Remove an empty directory left after r245318.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245426 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 09:00:21 +00:00
Nick Lewycky
691fcff337 More clean up, still NFC. Remove dead variables now that the casts are gone.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245420 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 06:25:30 +00:00
Nick Lewycky
b3796f64a4 Clean up this file a little. Remove dead casts, casting Values to Values. Adjust some comments for typos and whitespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245419 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 06:22:33 +00:00
Ashutosh Nema
21ea9ddf4a Exposed findDefsUsedOutsideOfLoop as a loop utility function
Exposed findDefsUsedOutsideOfLoop as a loop utility function by moving 
it from LoopDistribute to LoopUtils.

Reviewed By: anemet


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245416 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 05:40:42 +00:00
Chandler Carruth
8545f7f946 [LPM] Teach the legacy pass manager to support *using* an analysis
without *requiring* it.

This allows a pass indicate that it will use an analysis if available
(through getAnalysisIfAvailable). When the pass manager knows this, it
will refrain from deleting that analysis if it can. Naturally, it will
still get invalidated at the correct time. These passes are not
considered when scheduling the pass pipeline, so typically they will
require manual scheduling, but this may also allow passes with
getAnalysisIfAvailable to find the analysis more often if nothing after
them requires that analysis and it wasn't invalidated.

I don't have a particular use case with the current passes, but with my
new structure for alias analyses, this will be very useful. We want to
allow people to customize the set of AAs available by scheduling
additional passes. These's aren't ever *required* for obvious reasons.
So we need some way to mark in the legacy pass manager that they will
still be used if available.

This is essentially how analysis groups already work. But this makes the
feature generally available and more explicit. It should allow the AA
change to not impact how people trigger a custom alias analysis being
available at a certain point in compilation.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245409 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 03:02:12 +00:00
Hal Finkel
dd7ef64b29 Fix how DependenceAnalysis calls delinearization
Fix how DependenceAnalysis calls delinearization, mirroring what is done in
Delinearization.cpp (mostly by making sure to call getSCEVAtScope before
delinearizing, and by removing the unnecessary 'Pairs == 1' check).

Patch by Vaivaswatha Nagaraj!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245408 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 02:56:36 +00:00
Eric Christopher
d5369c945d Revert "Fix PR24469 resulting from r245025 and re-enable dead store elimination across basicblocks."
This is causing bootstrap problems, e.g.: http://bb.pgr.jp/builders/clang-3stage-i686-linux/builds/2960

This reverts r245195.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245402 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 02:15:13 +00:00
Hal Finkel
25fa0d406c Make ScalarEvolution::isKnownPredicate a little smarter
Here we make ScalarEvolution::isKnownPredicate, indirectly, a little smarter.
Given some relational comparison operator OP, and two AddRec SCEVs, {I,+,S} OP
{J,+,T}, we can reduce this to the comparison I OP J when S == T, both AddRecs
are for the same loop, and both are known not to wrap.

As it turns out, because of the way that backedge-guard expressions can be
leveraged when computing known predicates, this allows indvars to simplify the
if-statement comparison in this loop:

  void foo (int *a, int *b, int n) {
    for (int i = 0; i < n; ++i) {
      if (i > n)
        a[i] = b[i] + 1;
    }
  }

which, somewhat surprisingly, we were not previously optimizing away.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245400 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 01:51:51 +00:00
Chih-Hung Hsieh
b5d75790a5 Split ARM and AArch64 emutls.ll test
Differential Revision: http://reviews.llvm.org/D12127



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245399 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 01:44:51 +00:00
Alex Lorenz
a80c044041 MIR Serialization: Serialize MMI's variable debug information.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245396 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 00:13:25 +00:00
Quentin Colombet
0f33e74711 [BasicAA] Add a test for PR24468 to be sure we won't regress
when we finally get the GEP aliasing right.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245395 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 00:08:26 +00:00
Quentin Colombet
71f1967057 [BasicAA] Revert r221876 because it can produce incorrect aliasing
information: see PR24468.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245394 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 00:07:20 +00:00
Steve King
3b9cfa1eb0 Fix backward operands in call to isTruncateFree() and improve comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245385 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 23:02:41 +00:00
Alex Lorenz
b081f06745 MIR Parser: Return true on error when parsing standalone registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245384 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 22:57:36 +00:00
Alex Lorenz
6f3cafb93e MIR Serialization: Serialize the operand's bit mask target flags.
This commit adds support for bit mask target flag serialization to the MIR
printer and the MIR parser. It also adds support for the machine operand's
target flag serialization to the AArch64 target.

Reviewers: Duncan P. N. Exon Smith


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245383 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 22:52:15 +00:00
Sanjay Patel
85826bebec use TLI.allowsMemoryAccess() to check if memory accesses are fast; NFCI
This consolidates use of isUnalignedMem32Slow() in one place.
There is a slight change in logic although I'm not sure that it would ever
come up in the real world: we were assuming that an alignment of the type 
size is always fast; now, we actually check the data layout to confirm that.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245382 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 22:48:12 +00:00
Nick Lewycky
cca41d362f Fix three typos in comments; "easilly" -> "easily".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245379 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 22:41:58 +00:00
Peter Collingbourne
bf5dca5930 Support: Clean up TSan annotations.
Remove support for Valgrind-based TSan, which hasn't been maintained for a
few years. We now use the TSan annotations only if LLVM is compiled with
-fsanitize=thread. We no longer need the weak function definitions as we
are guaranteed that our program is linked directly with the TSan runtime.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245374 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 22:31:24 +00:00
Alex Lorenz
07c6bd8492 MIR Serialization: Serialize the frame information's stack protector index.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245372 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 22:26:26 +00:00
Alex Lorenz
0a39c58503 MIR Parser: Extract the code that parses stack object references into a new
method.

This commit extracts the code that parses the stack object references into a
new method named 'parseStackFrameIndex', so that it can be reused when
parsing standalone stack object references.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245370 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 22:18:52 +00:00
David Majnemer
53ff0bbb0a [InstSimplify] Remove unused variable
No functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245369 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 22:18:22 +00:00
David Majnemer
d00bdb627b [InstSimplify] Don't assume getAggregateElement will succeed
It isn't always possible to get a value from getAggregateElement.
This fixes PR24488.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245365 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 22:07:25 +00:00
David Majnemer
72b408fadc [VectorUtils] Replace 'llvm::' qualification with 'using llvm'
No funcitonal change is intended, this just makes the file look more
like the rest of LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245364 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 22:07:20 +00:00
Joerg Sonnenberger
6774e25ec6 Load/store instructions for floating points with address space require SparcV9.
To properly handle this, define the *a instructions as separate
instruction classes by refactoring the LoadA and StoreA multiclasses.
Move the instruction tests into the sparcv9 file to test the difference.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245360 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 21:31:46 +00:00
Simon Pilgrim
c5181355d9 [X86] Refreshed sign extension tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245358 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 21:21:35 +00:00
Hans Wennborg
c7879234e8 Release script: correctly symlink clang-tools-extra into the build (PR22765)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245355 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 21:10:17 +00:00
Simon Pilgrim
b6d43abb7c [X86][AVX] Added shuffle concatenation tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245351 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 20:51:15 +00:00