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

115101 Commits

Author SHA1 Message Date
Eric Christopher
c777d8d845 Remove the target independent TargetMachine::getSubtarget and
TargetMachine::getSubtargetImpl routines.

This keeps the target independent code free of bare subtarget
calls while the remainder of the backends are migrated, or not
if they don't wish to support per-function subtargets as would
be needed for function multiversioning or LTO of disparate
cpu subarchitecture types, e.g.

clang -msse4.2 -c foo.c -emit-llvm -o foo.bc
clang -c bar.c -emit-llvm -o bar.bc
llvm-link foo.bc bar.bc -o baz.bc
llc baz.bc

and get appropriate code for what the command lines requested.

llvm-svn: 232885
2015-03-21 04:22:23 +00:00
Eric Christopher
e8e68a5117 Remove the bare getSubtargetImpl call from the AArch64 port. As part
of this add a test that shows we can generate code for functions
that specifically enable a subtarget feature.

llvm-svn: 232884
2015-03-21 04:04:50 +00:00
Eric Christopher
496632fcd2 Remove the bare getSubtargetImpl call from the PPC port. As part
of this add a test that shows we can generate code with
for functions that differ by subtarget feature.

llvm-svn: 232882
2015-03-21 03:36:02 +00:00
Eric Christopher
ef90fb9647 Forward the Function based getSubtarget call to the appropriate Impl
call.

llvm-svn: 232881
2015-03-21 03:32:45 +00:00
Eric Christopher
61a041c2a0 Grab a subtarget off of an AMDGPUTargetMachine rather than a
bare target machine in preparation for the TargetMachine bare
getSubtarget/getSubtargetImpl calls going away.

llvm-svn: 232880
2015-03-21 03:17:25 +00:00
Eric Christopher
3d3373d3e2 Cache the Function dependent subtarget on the MachineFunction.
As preparation for removing the getSubtargetImpl() call from
TargetMachine go ahead and flip the switch on caching the function
dependent subtarget and remove the bare getSubtargetImpl call
from the X86 port. As part of this add a few tests that show we
can generate code and assemble on X86 based on features/cpu on
the Function.

llvm-svn: 232879
2015-03-21 03:13:10 +00:00
Eric Christopher
3e8e6fb933 Grab the cached subtarget off of the MachineFunction.
llvm-svn: 232878
2015-03-21 03:13:07 +00:00
Eric Christopher
c3a21ce588 Grab a subtarget off of a MipsTargetMachine rather than a
bare target machine in preparation for the TargetMachine bare
getSubtarget/getSubtargetImpl calls going away.

llvm-svn: 232877
2015-03-21 03:13:05 +00:00
Eric Christopher
310e3fc262 Simplify the query for a subtarget in the NVPTX pass manager.
llvm-svn: 232876
2015-03-21 03:13:03 +00:00
Eric Christopher
95f92de138 Change getISAEncoding to use the target triple to determine
thumb-ness similar to the rest of the Module level asm printing
infrastructure as debug info finalization happens after the function
may be missing.

llvm-svn: 232875
2015-03-21 03:13:01 +00:00
Eric Christopher
5edce2db85 Make the Hexagon ISelDAGToDAG pass set the subtarget dynamically
on each runOnMachineFunction invocation.

llvm-svn: 232874
2015-03-21 03:12:59 +00:00
Kostya Serebryany
55ec403858 [sanitizer] experimental tracing for cmp instructions
llvm-svn: 232873
2015-03-21 01:29:36 +00:00
Ahmed Bougacha
3337019a5f [CodeGen][IfCvt] Don't re-ifcvt blocks with unanalyzable terminators.
If we couldn't analyze its terminator (i.e., it's an indirectbr, or some
other weirdness), we can't safely re-if-convert a predicated block,
because we can't tell whether the predicated terminator can
fallthrough (it does).

Currently, we would completely ignore the fallthrough successor. In
the added testcase, this means we used to generate:

    ...
  @ %entry:
    cmp   r5, #21
    ittt  ne
  @ %cc1f:
    cmpne r7, #42
  @ %cc2t:
    strne.w       r5, [r8]
    movne pc, r10
  @ %cc1t:
    ...

Whereas the successor of %cc1f was originally %bb1.
With the fix, we get the correct:

    ...
  @ %entry:
    cmp   r5, #21
    itt   eq
  @ %cc1t:
    streq.w       r5, [r11]
    moveq pc, r0
  @ %cc1f:
    cmp   r7, #42
    itt   ne
  @ %cc2t:
    strne.w       r5, [r8]
    movne pc, r10
  @ %bb1:
    ...

rdar://20192768
Differential Revision: http://reviews.llvm.org/D8509

llvm-svn: 232872
2015-03-21 01:23:15 +00:00
Ahmed Bougacha
6bc0aa2395 [AArch64] Prefer UZP for concat_vector of illegal truncs.
Follow-up to r232459: prefer a UZP shuffle to the intermediate truncs.

llvm-svn: 232871
2015-03-21 01:08:39 +00:00
Filipe Cabecinhas
5860032280 Make getLastArgNoClaim work for up to 4 arguments.
Summary:
This is needed for http://reviews.llvm.org/D8507
I have no idea what stand-alone tests could be done, if needed.

Reviewers: Bigcheese, craig.topper, samsonov

Subscribers: llvm-commits

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

llvm-svn: 232859
2015-03-20 23:32:58 +00:00
Yunzhong Gao
130199c4c2 Tell lit.cfg about more Windows triples.
For example, the host triple on my 64-bit PC is x86_64-pc-windows-msvc.

llvm-svn: 232854
2015-03-20 22:08:40 +00:00
Sanjay Patel
cf8a53f502 [X86, AVX] instcombine common cases of vperm2* intrinsics into shuffles
vperm2* intrinsics are just shuffles. 
In a few special cases, they're not even shuffles.

Optimizing intrinsics in InstCombine is better than
handling this in the front-end for at least two reasons:

1. Optimizing custom-written SSE intrinsic code at -O0 makes vector coders
   really angry (and so I have regrets about some patches from last week).

2. Doing mask conversion logic in header files is hard to write and 
   subsequently read.

There are a couple of TODOs in this patch to complete this optimization.

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

llvm-svn: 232852
2015-03-20 21:47:56 +00:00
Andrew Kaylor
7b78ee54b5 Fixing a bug with WinEH PHI handling
llvm-svn: 232851
2015-03-20 21:42:54 +00:00
Sanjay Patel
34ad366455 [X86] Prefer blendps over insertps codegen for one special case
With this patch, for this one exact case, we'll generate:

  blendps %xmm0, %xmm1, $1

instead of:

  insertps %xmm0, %xmm1, $0

If there's a memory operand available for load folding and we're
optimizing for size, we'll still generate the insertps.

The detailed performance data motivation for this may be found in D7866; 
in summary, blendps has 2-3x throughput vs. insertps on widely used chips.

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

llvm-svn: 232850
2015-03-20 21:19:52 +00:00
Benjamin Kramer
370163f28b X86: Make helper functions static. NFC.
llvm-svn: 232848
2015-03-20 21:07:30 +00:00
Eric Christopher
3aef531a8e Remove dead calls and function arguments dealing with TRI in StackMaps.
llvm-svn: 232847
2015-03-20 21:05:18 +00:00
Duncan P. N. Exon Smith
ffe7164bfa DebugInfo: Require valid DIDescriptors
As part of PR22777, switch from `dyn_cast_or_null<>` to `cast<>` in most
`DIDescriptor` accessors.  These classes are lightweight wrappers around
pointers, so the users should check for valid pointers before using
them.

This survives a Darwin clang -g bootstrap (after fixing testcases), but
it's possible the bots will complain about other configurations.  I'll
fix any fallout as quickly as I can!  Once this bakes for a bit I'll
remove the macros.

Note that `DebugLoc` implicitly gets stricter with this change as well,
since it forward to `DILocation`.  Any code that's using `DebugLoc`
accessors should check `DebugLoc::isUnknown()` first.  (BTW, I'm also
partway through a cleanup of the `DebugLoc` API to make it more obvious
what it is (a glorified pointer wrapper) and remove cruft from before
the Metadata/Value split.  I'll commit soon.)

llvm-svn: 232844
2015-03-20 20:17:07 +00:00
Rafael Espindola
06353319f0 Don't declare all text sections at the start of the .s
The code this patch removes was there to make sure the text sections went
before the dwarf sections. That is necessary because MachO uses offsets
relative to the start of the file, so adding a section can change relaxations.

The dwarf sections were being printed at the start just to produce symbols
pointing at the start of those sections.

The underlying issue was fixed in r231898. The dwarf sections are now printed
when they are about to be used, which is after we printed the text sections.

To make sure we don't regress, the patch makes the MachO streamer assert
if CodeGen puts anything unexpected after the DWARF sections.

llvm-svn: 232842
2015-03-20 20:00:01 +00:00
Duncan P. N. Exon Smith
c43bda0d54 Bugpoint: Fix invalid 'inlinedAt:' references in testcase
These are causing crashes in `DebugInfoFinder` after a WIP patch to
increase strictness of `DIDescriptor` accessors.

llvm-svn: 232839
2015-03-20 19:51:34 +00:00
Duncan P. N. Exon Smith
12f98cf159 AsmPrinter: Check subprogram before using it
Check return of `getDISubprogram()` before using it.  A WIP patch makes
`DIDescriptor` accessors more strict (and would crash on this).

llvm-svn: 232838
2015-03-20 19:50:00 +00:00
Rafael Espindola
2ca5cf8fba Reorganize the x86 ELF relocation selection logic.
The main differences are:

* Split in 32 and 64 bit functions.
* First switch on the Modifier so that we have only one non fully covered
  switch.
* Map the fixup kind first to a x86_64 (or i386) specific enum, to make
  it easy to handle cases like X86::reloc_riprel_4byte_movq_load.
* Switch on IsPCRel last, which reduces code duplication.

Fixes pr22308.

llvm-svn: 232837
2015-03-20 19:48:54 +00:00
Duncan P. N. Exon Smith
f95d5746ef DwarfDebug: Check for null DebugLocs
`DL` might be null, so check for that before using accessors.  A WIP
patch to make `DIDescriptors` more strict fails otherwise.

As a bonus, I think the logic is easier to follow now (despite the extra
nesting depth).

llvm-svn: 232836
2015-03-20 19:37:03 +00:00
Duncan P. N. Exon Smith
502d48a1fb Verifier: Check that !dbg attachments have the right type
A WIP patch makes `DIDescriptor` accessors more strict, which in turn
causes the `DebugInfoFinder` to crash on wrongly typed `!dbg`
attachments.  Catch that error up front in
`Verifier::visitInstruction()`.

Also remove a test that we "handle" invalid `!dbg` attachments, added
back in r99938.  We don't want to handle those anymore.

Note: I'm *not* recursing and verifying the debug info graph reachable
from this node; that work is already done by `verifyDebugInfo()`.

llvm-svn: 232834
2015-03-20 19:26:58 +00:00
Duncan P. N. Exon Smith
30d6519660 DebugInfoFinder: Check for null imported entities
Don't use the accessors in `DIImportedEntity` on a null pointer.  (A WIP
patch to make `DIDescriptor` accessors more strict crashes here
otherwise.)

llvm-svn: 232833
2015-03-20 19:13:53 +00:00
Duncan P. N. Exon Smith
c31f1b0224 SanitizerCoverage: Check for null DebugLocs
After a WIP patch to make `DIDescriptor` accessors more strict, this
started asserting.

llvm-svn: 232832
2015-03-20 18:48:45 +00:00
Hans Wennborg
0ad4b0624b SelectionDAGBuilder: Rangeify a loop. NFC.
llvm-svn: 232831
2015-03-20 18:48:40 +00:00
Hans Wennborg
c133d4c52c SelectionDAGBuilder::handleJTSwitchCase, simplify loop; NFC
llvm-svn: 232830
2015-03-20 18:48:31 +00:00
Duncan P. N. Exon Smith
dc84e375a3 Rewrite test/Feature/md_on_instruction.ll
This test is supposed to be testing whether metadata attachments to
instructions work, but it was using invalid debug info to do so.  (This
was causing assertion failures in the `DebugInfoFinder` with a WIP patch
to be more strict about `DIDescriptor` accessors.)

Rather than fix the debug info -- which is better tested elsewhere --
just test the IR feature directly.

llvm-svn: 232828
2015-03-20 18:34:53 +00:00
Wei Mi
2edc60752a Correctly estimate SROA savings for store operands in inline cost analysis.
When estimating SROA savings, we want to see if an address is derived
off an alloca in the caller. For store instructions, operand 1 is the
address operand, but the current code uses operand 0.  Use
getPointerOperand for loads and stores to fix this.

Patch by Easwaran Raman.
http://reviews.llvm.org/D8425

llvm-svn: 232827
2015-03-20 18:33:12 +00:00
Daniel Berlin
a59519abd4 Small optimization to avoid getting pass info when we will not run loop
llvm-svn: 232826
2015-03-20 18:05:49 +00:00
John Brawn
2e601255af [ARM] Fix handling of thumb1 out-of-range frame offsets
LocalStackSlotPass assumes that isFrameOffsetLegal doesn't change its
answer when the base register changes. Unfortunately this isn't true
in thumb1, where SP-based loads allow a larger offset than
non-SP-based loads, and this causes the base register reuse code to
generate instructions that are unencodable, causing an assertion
failure. 

Solve this by adding a BaseReg parameter to isFrameOffsetLegal, which
ARMBaseRegisterInfo can then make use of to give the correct answer. 

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

llvm-svn: 232825
2015-03-20 17:20:07 +00:00
Simon Pilgrim
2633b0d5ef Stripped trailing whitespace. NFC.
llvm-svn: 232822
2015-03-20 16:08:17 +00:00
Eric Christopher
0e8997ccf4 Rewrite StackMap location handling to pre-compute the dwarf register
numbers before emission.

This removes a dependency on being able to access TRI at the module
level and is similar to the DwarfExpression handling. I've modified
the debug support into print/dump routines that'll do the same dumping
but is now callable anywhere and if TRI isn't available will go ahead
and just print out raw register numbers.

llvm-svn: 232821
2015-03-20 16:03:42 +00:00
Eric Christopher
a0feb0852f At the beginning of doFinalization set the MachineFunction to
nullptr so that users get an earlier dereferencing error and
so that we can use it to conditionalize access to MachineFunction
specific data.

llvm-svn: 232820
2015-03-20 16:03:39 +00:00
Chad Rosier
9ba26d734c Typo.
llvm-svn: 232819
2015-03-20 15:45:14 +00:00
Tom Stellard
e5b57151c3 R600/SI: Refactor VOP2 instruction defs
llvm-svn: 232817
2015-03-20 15:14:23 +00:00
Tom Stellard
dffdd3993e R600/SI: Refactor VOP1 instruction defs
llvm-svn: 232816
2015-03-20 15:14:21 +00:00
Rafael Espindola
3b034bc8b6 Reduce indentation after return. NFC.
llvm-svn: 232814
2015-03-20 14:33:25 +00:00
Rafael Espindola
c8d031b1da Use early returns. NFC.
llvm-svn: 232813
2015-03-20 14:23:46 +00:00
Rafael Espindola
2aacc6b69e Fold a llvm_unreachable into an assert. NFC.
llvm-svn: 232811
2015-03-20 13:50:15 +00:00
Rafael Espindola
28d3ba7bcc clang-format a function. NFC.
llvm-svn: 232810
2015-03-20 13:47:40 +00:00
Daniel Jasper
86b4584e4b [MBP] Don't outline short optional branches
With the option -outline-optional-branches, LLVM will place optional
branches out of line (more details on r231230).

With this patch, this is not done for short optional branches. A short
optional branch is a branch containing a single block with an
instruction count below a certain threshold (defaulting to 3). Still
everything is guarded under -outline-optional-branches).

Outlining a short branch can't significantly improve code locality. It
can however decrease performance because of the additional jmp and in
cases where the optional branch is hot. This fixes a compile time
regression I have observed in a benchmark.

Review: http://reviews.llvm.org/D8108
llvm-svn: 232802
2015-03-20 10:00:37 +00:00
Craig Topper
3db183f41f [Tablegen] Attempt to add support for patterns containing nodes with multiple results.
This is needed for AVX512 masked scatter/gather support.

The R600 change is necessary to remove a hack that was working around the lack of multiple results.

llvm-svn: 232798
2015-03-20 05:09:06 +00:00
Tom Stellard
1b70c0dfce R600/SI: Add missing CHECK-LABEL lines to a test
llvm-svn: 232797
2015-03-20 03:12:42 +00:00
Nick Lewycky
759d53ae2e Fix comment from r232794. NFC
llvm-svn: 232796
2015-03-20 02:52:23 +00:00