1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
Commit Graph

111413 Commits

Author SHA1 Message Date
Eric Christopher
7ba53595a5 Update include - this class doesn't use the target machine, but
only the subtarget.

llvm-svn: 225458
2015-01-08 18:18:54 +00:00
Eric Christopher
869afdf741 Fix a couple of odd formatting issues.
llvm-svn: 225457
2015-01-08 18:18:53 +00:00
Eric Christopher
a742bd4264 This routine is in InstrInfo, there's no need to access it again.
llvm-svn: 225456
2015-01-08 18:18:50 +00:00
Ahmed Bougacha
e6d430dea6 [X86] Reflow comment. NFC.
llvm-svn: 225455
2015-01-08 17:49:48 +00:00
Rafael Espindola
840bf08831 clang-format. NFC.
llvm-svn: 225454
2015-01-08 16:25:01 +00:00
Rafael Espindola
198d2d6974 Make this test a bit stricter.
It now checks for the end of the line or the opening '{'.
While at it, remove empty comments.

llvm-svn: 225451
2015-01-08 16:11:18 +00:00
Justin Hibbits
68fee020d6 Add saving and restoring of r30 to the prologue and epilogue, respectively
Summary: The PIC additions didn't update the prologue and epilogue code to save and restore r30 (PIC base register).  This does that.

Test Plan: Tests updated.

Reviewers: hfinkel

Reviewed By: hfinkel

Subscribers: llvm-commits

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

llvm-svn: 225450
2015-01-08 15:47:19 +00:00
Rafael Espindola
57f926ac5f Explicitly handle LinkOnceODRAutoHideLinkage. NFC. We already have a test.
llvm-svn: 225449
2015-01-08 15:39:50 +00:00
Rafael Espindola
bb02cc2a6b Update naming style and clang-format. NFC.
llvm-svn: 225448
2015-01-08 15:36:32 +00:00
Kristof Beyls
53a9880dcd Fix large stack alignment codegen for ARM and Thumb2 targets
This partially fixes PR13007 (ARM CodeGen fails with large stack
alignment): for ARM and Thumb2 targets, but not for Thumb1, as it
seems stack alignment for Thumb1 targets hasn't been supported at
all.

Producing an aligned stack pointer is done by zero-ing out the lower
bits of the stack pointer. The BIC instruction was used for this.
However, the immediate field of the BIC instruction only allows to
encode an immediate that can zero out up to a maximum of the 8 lower
bits. When a larger alignment is requested, a BIC instruction cannot
be used; llvm was silently producing incorrect code in this case.

This commit fixes code generation for large stack aligments by
using the BFC instruction instead, when the BFC instruction is
available.  When not, it uses 2 instructions: a right shift,
followed by a left shift to zero out the lower bits.

The lowering of ARM::Int_eh_sjlj_dispatchsetup still has code
that unconditionally uses BIC to realign the stack pointer, so it
very likely has the same problem. However, I wasn't able to
produce a test case for that. This commit adds an assert so that
the compiler will fail the assert instead of silently generating
wrong code if this is ever reached.

llvm-svn: 225446
2015-01-08 15:09:14 +00:00
Tom Stellard
d8d9d6ab95 R600/SI: Remove SIISelLowering::legalizeOperands()
Its functionality has been replaced by calling
SIInstrInfo::legalizeOperands() from
SIISelLowering::AdjstInstrPostInstrSelection() and running the
SIFoldOperands and SIShrinkInstructions passes.

llvm-svn: 225445
2015-01-08 15:08:17 +00:00
Elena Demikhovsky
9ab7f6e415 Masked Load/Store - fixed a bug in type legalization.
llvm-svn: 225441
2015-01-08 12:29:19 +00:00
Michael Kuperstein
f9bd4536d2 Fix a think-o in the test for r225438.
llvm-svn: 225440
2015-01-08 12:05:02 +00:00
Michael Kuperstein
30c32cf185 Fix include ordering, NFC.
llvm-svn: 225439
2015-01-08 11:59:43 +00:00
Michael Kuperstein
f890489bdb [X86] Don't try to generate direct calls to TLS globals
The call lowering assumes that if the callee is a global, we want to emit a direct call.
This is correct for regular globals, but not for TLS ones.

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

llvm-svn: 225438
2015-01-08 11:50:58 +00:00
Michael Kuperstein
9e2bd83569 Move SPAdj logic from PEI into the targets (NFC)
PEI tries to keep track of how much starting or ending a call sequence adjusts the stack pointer by, so that it can resolve frame-index references. Currently, it takes a very simplistic view of how SP adjustments are done - both FrameStartOpcode and FrameDestroyOpcode adjust it exactly by the amount written in its first argument.

This view is in fact incorrect for some targets (e.g. due to stack re-alignment, or because it may want to adjust the stack pointer in multiple steps). However, that doesn't cause breakage, because most targets (the only in-tree exception appears to be 32-bit ARM) rely on being able to simplify the call frame pseudo-instructions earlier, so this code is never hit. 

Moving the computation into TargetInstrInfo allows targets to override the way the adjustment is computed if they need to have a non-zero SPAdj.

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

llvm-svn: 225437
2015-01-08 11:04:38 +00:00
Craig Topper
057e795d39 Fix test case I missed in r225432.
llvm-svn: 225434
2015-01-08 07:57:27 +00:00
Craig Topper
ac00edab84 [X86] Don't print 'dword ptr' or 'qword ptr' on the operand to some of the LEA variants in Intel syntax. The memory operand is inherently unsized.
llvm-svn: 225432
2015-01-08 07:41:30 +00:00
Adrian Prantl
d3017f3565 Revert "Reapply: Teach SROA how to update debug info for fragmented variables."
This reverts commit r225379 while investigating an assertion failure reported
by Alexey.

llvm-svn: 225424
2015-01-08 02:02:00 +00:00
Quentin Colombet
41c4d5ee6c [RegAllocGreedy] Introduce a late pass to repair broken hints.
A broken hint is a copy where both ends are assigned different colors. When a
variable gets evicted in the neighborhood of such copies, it is likely we can
reconcile some of them.


** Context **

Copies are inserted during the register allocation via splitting. These split
points are required to relax the constraints on the allocation problem. When
such a point is inserted, both ends of the copy would not share the same color
with respect to the current allocation problem. When variables get evicted,
the allocation problem becomes different and some split point may not be
required anymore. However, the related variables may already have been colored.

This usually shows up in the assembly with pattern like this:
def A
...
save A to B
def A
use A
restore A from B
...
use B

Whereas we could simply have done:
def B
...
def A
use A
...
use B


** Proposed Solution **

A variable having a broken hint is marked for late recoloring if and only if
selecting a register for it evict another variable. Indeed, if no eviction
happens this is pointless to look for recoloring opportunities as it means the
situation was the same as the initial allocation problem where we had to break
the hint.

Finally, when everything has been allocated, we look for recoloring
opportunities for all the identified candidates.
The recoloring is performed very late to rely on accurate copy cost (all
involved variables are allocated).
The recoloring is simple unlike the last change recoloring. It propagates the
color of the broken hint to all its copy-related variables. If the color is
available for them, the recoloring uses it, otherwise it gives up on that hint
even if a more complex coloring would have worked.

The recoloring happens only if it is profitable. The profitability is evaluated
using the expected frequency of the copies of the currently recolored variable
with a) its current color and b) with the target color. If a) is greater or
equal than b), then it is profitable and the recoloring happen.


** Example **

Consider the following example:
BB1:
  a =
  b =
BB2:
  ...
   = b
   = a
Let us assume b gets split:
BB1:
  a =
  b =
BB2:
  c = b
  ...
  d = c
  = d
  = a
Because of how the allocation work, b, c, and d may be assigned different
colors. Now, if a gets evicted to make room for c, assuming b and d were
assigned to something different than a.
We end up with:
BB1:
  a =
  st a, SpillSlot
  b =
BB2:
  c = b
  ...
  d = c
  = d
  e = ld SpillSlot
  = e
This is likely that we can assign the same register for b, c, and d,
getting rid of 2 copies.


** Performances **

Both ARM64 and x86_64 show performance improvements of up to 3% for the
llvm-testsuite + externals with Os and O3. There are a few regressions too that
comes from the (in)accuracy of the block frequency estimate.

<rdar://problem/18312047>

llvm-svn: 225422
2015-01-08 01:16:39 +00:00
Ahmed Bougacha
4150499cd1 [SelectionDAG] Allow targets to specify legality of extloads' result
type (in addition to the memory type).

The *LoadExt* legalization handling used to only have one type, the
memory type.  This forced users to assume that as long as the extload
for the memory type was declared legal, and the result type was legal,
the whole extload was legal.

However, this isn't always the case.  For instance, on X86, with AVX,
this is legal:
    v4i32 load, zext from v4i8
but this isn't:
    v4i64 load, zext from v4i8
Whereas v4i64 is (arguably) legal, even without AVX2.

Note that the same thing was done a while ago for truncstores (r46140),
but I assume no one needed it yet for extloads, so here we go.

Calls to getLoadExtAction were changed to add the value type, found
manually in the surrounding code.

Calls to setLoadExtAction were mechanically changed, by wrapping the
call in a loop, to match previous behavior.  The loop iterates over
the MVT subrange corresponding to the memory type (FP vectors, etc...).
I also pulled neighboring setTruncStoreActions into some of the loops;
those shouldn't make a difference, as the additional types are illegal.
(e.g., i128->i1 truncstores on PPC.)

No functional change intended.

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

llvm-svn: 225421
2015-01-08 00:51:32 +00:00
Nick Lewycky
fd6bc23403 Remove empty statement. No functionality change.
llvm-svn: 225420
2015-01-08 00:47:03 +00:00
Matthias Braun
1a761c5db4 X86: VZeroUpperInserter: shortcut should not trigger if we have any function live-ins.
llvm-svn: 225419
2015-01-08 00:33:48 +00:00
Kevin Enderby
82a2b4ceec Run clang-format on tools/llvm-objdump/MachODump.cpp again as some of my
previous changes got in with incorrect formatting. No functional change.

llvm-svn: 225417
2015-01-08 00:25:24 +00:00
Matthias Braun
9501aa7207 RegisterCoalescer: Do not remove IMPLICIT_DEFS if they are required for subranges.
The register coalescer used to remove implicit_defs when they are
covered by the main range anyway. With subreg liveness tracking we can't
do that anymore in places where the IMPLICIT_DEF is required as begin of
a subregister liverange.

llvm-svn: 225416
2015-01-08 00:21:23 +00:00
Matthias Braun
22b8fb521f RegisterCoalescer: Fix valuesIdentical() in some subrange merge cases.
I got confused and assumed SrcIdx/DstIdx of the CoalescerPair is a
subregister index in SrcReg/DstReg, but they are actually subregister
indices of the coalesced register that get you back to SrcReg/DstReg
when applied.

Fixed the bug, improved comments and simplified code accordingly.

Testcase by Tom Stellard!

llvm-svn: 225415
2015-01-07 23:58:38 +00:00
Matthias Braun
8e4dd54b28 LiveInterval: Implement feedback by Quentin Colombet.
llvm-svn: 225413
2015-01-07 23:35:11 +00:00
Philip Reames
2ad347b060 [GC] improve testing around gc.relocate and fix a test
Patch by: Ramkumar Ramachandra <artagnon@gmail.com>

"This patch started out as an exploration of gc.relocate, and an attempt
to write a simple test in call-lowering. I then noticed that the
arguments of gc.relocate were not checked fully, so I went in and fixed
a few things. Finally, the most important outcome of this patch is that
my new error handling code caught a bug in a callsite in
stackmap-format."

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

llvm-svn: 225412
2015-01-07 22:48:01 +00:00
Ahmed Bougacha
f6939ea7ca [CodeGen] Add MVT::isValid to replace manual validity checks. NFC.
Now that we have MVT::FIRST_VALUETYPE (r225362), we can provide a method
checking that the MVT is valid, that is, it's in
  [FIRST_VALUETYPE, LAST_VALUETYPE[.
This commit also uses it in a few asserts, that would previously accept
invalid MVTs, such as the default constructed -1.  In that case,
the code following those asserts would do an out-of-bounds array access.
Using MVT::isValid, those assertions fail as expected when passed
invalid MVTs.
It feels clunky to have such a validity checking function, but it's
at least better than the alternative of broken manual checks.

llvm-svn: 225411
2015-01-07 22:47:46 +00:00
Tom Stellard
1e2b9bc41b R600/SI: Commute instructions to enable more folding opportunities
llvm-svn: 225410
2015-01-07 22:44:19 +00:00
Duncan P. N. Exon Smith
72fe04b84c IR: Add MDNode::getDistinct()
Allow distinct `MDNode`s to be explicitly created.  There's no way (yet)
of representing their distinctness in assembly/bitcode, however, so this
still isn't first-class.

Part of PR22111.

llvm-svn: 225406
2015-01-07 22:24:46 +00:00
Tom Stellard
8d2d692413 R600/SI: Only fold immediates that have one use
Folding the same immediate into multiple instruction will increase
program size, which can hurt performance.

llvm-svn: 225405
2015-01-07 22:18:27 +00:00
Sean Silva
ed263f9777 Test commit.
Hopefully this one won't kill the git mirror...

llvm-svn: 225404
2015-01-07 22:07:33 +00:00
Duncan P. N. Exon Smith
60c042ccb4 IR: Add MDNode::isDistinct()
Add API to indicate whether an `MDNode` is distinct.  A distinct node is
not stored in the MDNode uniquing tables, and will never be returned by
`MDNode::get()`.

Although distinct nodes are only currently created by uniquing
collisions (when operands change), PR22111 will allow these nodes to be
explicitly created.

llvm-svn: 225401
2015-01-07 21:35:38 +00:00
Sean Silva
b85a13e7a0 [LangRef] PR22118: Hyphen is allowed in IR identifiers.
E.g. %-foo and %fo-o.

Thanks to eagle-eyed reporter Tomas Brukner.

llvm-svn: 225400
2015-01-07 21:35:14 +00:00
Adrian Prantl
4ac7d9a954 Update a comment.
llvm-svn: 225399
2015-01-07 21:35:13 +00:00
Duncan P. N. Exon Smith
0d2cbb7da2 Linker: Don't use MDNode::replaceOperandWith()
`MDNode::replaceOperandWith()` changes all instances of metadata.  Stop
using it when linking module flags, since (due to uniquing) the flag
values could be used by other metadata.

Instead, use new API `NamedMDNode::setOperand()` to update the reference
directly.

llvm-svn: 225397
2015-01-07 21:32:27 +00:00
Alexey Samsonov
823c2375cf XFAIL several MCJIT EH tests under ASan and MSan bootstrap.
llvm-svn: 225393
2015-01-07 21:27:26 +00:00
Ahmed Bougacha
4a6cab694b [CodeGen] Use MVT iterator_ranges in legality loops. NFC intended.
A few loops do trickier things than just iterating on an MVT subset,
so I'll leave them be for now.
Follow-up of r225387.

llvm-svn: 225392
2015-01-07 21:27:10 +00:00
Ahmed Bougacha
b2dd8c04fd [CodeGen] Add iterator_range for the MVT::SimpleValueType enum.
This commit adds a simple iterator over that enum, and a few
functions to create iterator ranges over the most common types.

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

llvm-svn: 225387
2015-01-07 21:15:38 +00:00
Alexey Samsonov
421932bbc2 Fix uninitialized memory read in llvm-dsymutil for the second time.
This was already fixed by r224481, but apparently was accidentally
reverted in r225207.

llvm-svn: 225386
2015-01-07 21:13:30 +00:00
Rafael Espindola
537f09c5f7 Add a test that would have found the issue in r224935.
llvm-svn: 225385
2015-01-07 21:10:25 +00:00
Chandler Carruth
162faa8934 [git] Mark the llgo directory in the LLVM gitignore.
llvm-svn: 225384
2015-01-07 21:08:54 +00:00
Kevin Enderby
ab9fa91a6e Slightly refactor things for llvm-objdump and the -macho option so it can be used with
options other than just -disassemble so that universal files can be used with other
options combined with -arch options.

No functional change to existing options and use.  One test case added for the
additional functionality with a universal file an a -arch option.

llvm-svn: 225383
2015-01-07 21:02:18 +00:00
Tom Stellard
fcbdffa536 R600/SI: Remove VReg_32 register class
Use VGPR_32 register class instead.  These two register classes were
identical and having separate classes was causing
SIInstrInfo::isLegalOperands() to be overly conservative in some cases.

This change is necessary to prevent future paches from missing a folding
opportunity in fneg-fabs.ll.

llvm-svn: 225382
2015-01-07 20:59:25 +00:00
Olivier Sallenave
82830c0d30 More FMA folding opportunities.
llvm-svn: 225380
2015-01-07 20:54:17 +00:00
Adrian Prantl
f59b4b4d08 Reapply: Teach SROA how to update debug info for fragmented variables.
The two buildbot failures were addressed in LLVM r225378 and CFE r225359.

This rapplies commit 225272 without modifications.

llvm-svn: 225379
2015-01-07 20:52:22 +00:00
Adrian Prantl
fec7723d82 Debug info: Allow aggregate types to be described by constants.
llvm-svn: 225378
2015-01-07 20:48:58 +00:00
Colin LeMahieu
3a3e6ac2f6 [Hexagon] Fix 225372 USR register is not fully complete. Removing Uses = [USR] maintains existing functionality to old instructions without encodings.
llvm-svn: 225377
2015-01-07 20:43:38 +00:00
Colin LeMahieu
113d011e38 [Hexagon] Adding floating point classification and creation.
llvm-svn: 225374
2015-01-07 20:28:57 +00:00