Commit Graph

129927 Commits

Author SHA1 Message Date
Quentin Colombet
cea52301d3 [RegisterBankInfo] Add a way to record what register bank covers a
specific type.

This will be used to find the default mapping of the instruction.
Also, this information is recorded, instead of computed, because it is
expensive from a type to know which register bank maps it.
Indeed, we need to iterate through all the register classes of all the
register banks to find the one that maps the given type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265736 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 22:45:42 +00:00
Quentin Colombet
15fb12b7eb [RegisterBankInfo] Introduce getRegBankFromConstraints as an helper
method.

NFC.

The refactoring intends to make the code more readable and expose
more features to potential derived classes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265735 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 22:35:03 +00:00
Quentin Colombet
4bb9de38d4 [TargetRegisterInfo] Refactor the code to use BitMaskClassIterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265734 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 22:16:56 +00:00
Quentin Colombet
83d385d6dd [RegisterBankInfo] Refactor the code to use BitMaskClassIterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265733 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 22:08:56 +00:00
Mehdi Amini
ca358261f0 Const correctness for BranchProbabilityInfo (NFC)
From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265731 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 21:59:28 +00:00
Quentin Colombet
12c70ede2c [TargetRegisterInfo] Introduce a helper class, BitMaskClassIterator, to
iterate over register class bitmask.

Thanks to this helper class, it would not require for each user of the
register classes bitmask to actually know how they are represents.
Moreover, it will make the code much easier to read.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265730 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 21:55:21 +00:00
Mehdi Amini
33f3a04a6b Rename parameter I to Index for WriteCombinedGlobalValueSummary() (NFC)
From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265729 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 21:49:31 +00:00
Quentin Colombet
7880f4315b [RegBankSelect] Reuse RegisterBankInfo logic to get to the register bank
from a register.
On top of duplicating the logic, it was buggy! It would assert on
physical registers, since MachineRegisterInfo does not have any
information regarding register classes/banks for them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265727 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 21:32:23 +00:00
Amaury Sechet
a5bbcb54ad Do not select EhPad BB in MachineBlockPlacement when there is regular BB to schedule
Summary:
EHPad BB are not entered the classic way and therefor do not need to be placed after their predecessors. This patch make sure EHPad BB are not chosen amongst successors to form chains, and are selected as last resort when selecting the best candidate.

EHPad are scheduled in reverse probability order in order to have them flow into each others naturally.

Reviewers: chandlerc, majnemer, rafael, MatzeB, escha, silvas

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265726 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 21:29:39 +00:00
Quentin Colombet
a8e98ebec4 [AArch64] Get rid of some GlobalISel ifdefs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265725 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 21:24:40 +00:00
Quentin Colombet
cdc46058f6 [TargetRegisterInfo] Fix the comment of SuperRegClassIterator::getMask.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265721 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 21:04:30 +00:00
Quentin Colombet
4216f714b3 [AArch64] gcc does not like litteral without quotes even on preprocessor macros.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265720 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 20:49:15 +00:00
Quentin Colombet
4db7b50b8e [AArch64][CallLowering] Do not build the API if GlobalISel is not built.
This gets rid of some ifdefs and dummy implementations that were here
just to fill the blanks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265719 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 20:47:51 +00:00
Quentin Colombet
e8aba9ba83 [GlobalISel] Add RegBankSelect hooks into the pass pipeline.
Now, RegBankSelect will happen after the IRTranslation and the target
may optionally add additional passes in between.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265716 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 20:27:33 +00:00
Jan Vesely
62aa62a6e9 AMDGPU/SI: Implement atomic load/store for i32 and i64
Standard load/store instructions with GLC bit set.

Reviewers: tstellardAMD, arsenm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265709 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 19:23:11 +00:00
Tom Stellard
f313dae6f3 AMDGPU/SI: Add latency for export instructions
Reviewers: arsenm, nhaehnle

Subscribers: nhaehnle, arsenm, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265708 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 18:30:05 +00:00
Quentin Colombet
13588d8354 [RegBankSelect] Initial implementation for non-optimized output.
The pass walk through the machine function and assign the register banks
using the default mapping. In other words, there is no attempt to reduce
cross register copies.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265707 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 18:19:27 +00:00
Quentin Colombet
f1b763c695 [RegisterBankInfo] Add more details on the expectation of
getInstrMapping.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265704 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 18:07:07 +00:00
Quentin Colombet
f9b131188b [RegisterBankInfo] Provide a target independent helper function to guess
the mapping of an instruction on register bank.

For most instructions, it is possible to guess the mapping of the
instruciton by using the encoding constraints.
It remains instructions without encoding constraints.
For copy-like instructions, we try to propagate the information we get
from the other operands. Otherwise, the target has to give this
information.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265703 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 18:01:19 +00:00
Quentin Colombet
83fadc56a6 [RegisterBankInfo] Change the signature of getSizeInBits to factor out
the access to MRI and TRI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265701 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 17:44:54 +00:00
Quentin Colombet
f77a6ecd34 [RegisterBankInfo] Provide a default constructor for InstructionMapping
helper class.

The default constructor creates invalid (isValid() == false) instances
and may be used to communicate that a mapping was not found.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265699 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 17:30:18 +00:00
Simon Pilgrim
594f22bf1e [X86][SSE] Added bitmask pattern shuffle tests
Based on OR(AND(MASK,V0),AND(~MASK,V1)) style patterns

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265697 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 17:23:55 +00:00
Quentin Colombet
b92870665f [MachineRegisterInfo] Track register bank for virtual registers.
A virtual register may have either a register bank or a register class.
This is represented by a PointerUnion between the related classes.

Typically, a virtual register went through the following states
regarding register class and register bank:

1. Creation: None is set. Virtual registers are fully generic.
2. Register bank assignment: Register bank is set. Virtual registers
live into a register bank, but we do not know the constraints they need
to fulfil.
3. Instruction selection: Register class is set. Virtual registers are
bound by encoding constraints.

To map these states to GlobalISel, the IRTranslator implements #1,
RegBankSelect #2, and Select #3.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265696 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 17:20:29 +00:00
Quentin Colombet
8074e6007a [RegisterBank] Rename RegisterBank::contains into RegisterBank::covers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265695 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 17:09:39 +00:00
Ehsan Amiri
8a6b9f2987 [PPC] Added a note to release notes
A draft line added to release notes for PPC, to keep a record of changes.
This is just a draft and will be rewritten towards the end of release.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265694 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 16:47:35 +00:00
Ulrich Weigand
78886ec7e2 [SystemZ] Fix build break from r265689
Fix build error seen on some build bots due to:
error: default label in switch which covers all enumeration values



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265693 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 16:33:25 +00:00
Kevin B. Smith
d39343242f [X86]: Fix for PR27251.
Differential Revision: http://reviews.llvm.org/D18850


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265690 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 16:15:34 +00:00
Ulrich Weigand
05fbbee99e [SystemZ] Implement conditional returns
Return is now considered a predicable instruction, and is converted
to a newly-added CondReturn (which maps to BCR to %r14) instruction by
the if conversion pass.

Also, fused compare-and-branch transform knows about conditional
returns, emitting the proper fused instructions for them.

This transform triggers on a *lot* of tests, hence the huge diffstat.
The changes are mostly jX to br %r14 -> bXr %r14.

Author: koriakin

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265689 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 16:11:44 +00:00
Davide Italiano
a2a5c796cb [IR/Verifier] Merge two ifs into one. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265688 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 15:55:28 +00:00
Ulrich Weigand
ff889a6bac [GVN] Address review comments for D18662
As suggested by Chandler in his review comments for D18662, this
follow-on patch renames some variables in GetLoadValueForLoad and
CoerceAvailableValueToLoadType to hopefully make it more obvious
which variables hold value sizes and which hold load/store sizes.

No functional change intended.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265687 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 15:55:11 +00:00
JF Bastien
fb9ead0bd9 NFC: disallow comparison of AtomicOrdering
Follow-up to D18775 and related clang change. AtomicOrdering is a lattice, 'stronger' is the right thing to do, direct comparison is fraught with peril.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265685 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 15:50:05 +00:00
Ulrich Weigand
d04d5a974e [GVN] Fix handling of sub-byte types in big-endian mode
When GVN wants to re-interpret an already available value in a smaller
type, it needs to right-shift the value on big-endian systems to ensure
the correct bytes are accessed.  The shift value is the difference of
the sizes of the two types.

This is correct as long as both types occupy multiples of full bytes.
However, when one of them is a sub-byte type like i1, this no longer
holds true: we still need to shift, but only to access the correct
*byte*.  Accessing bits within the byte requires no shift in either
endianness; e.g. an i1 resides in the least-significant bit of its
containing byte on both big- and little-endian systems.

Therefore, the appropriate shift value to be used is the difference of
the *storage* sizes of the two types.  This is already handled correctly
in one place where such a shift takes place (GetStoreValueForLoad), but
is incorrect in two other places: GetLoadValueForLoad and
CoerceAvailableValueToLoadType.

This patch changes both places to use the storage size as well.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265684 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 15:45:02 +00:00
Ehsan Amiri
6ff814c730 [PPC] Enable transformations in PPCPassConfig::addIRPasses at O2
http://reviews.llvm.org/D18562

A large number of testcases has been modified so they pass after this test.
One testcase is deleted, because I realized even after undoing the original
change that was committed with this testcase, the testcase still passes. So
I removed it. The change to one other testcase (test/CodeGen/PowerPC/pr25802.ll)
is an arbitrary change to keep it passing. Given the original intention of the
testcase, and the fact that fixing it will require some time to change the testcase,
we concluded that this quick change will be enough.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265683 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 15:30:55 +00:00
Tom Stellard
c2d9280e43 AMDGPU/SI: Add MachineBasicBlock parameter to SIInstrInfo::insertWaitStates
Summary: This makes it possible to insert nops at the end of blocks.

Reviewers: arsenm

Subscribers: arsenm, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265678 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 14:47:07 +00:00
Valery Pykhtin
30c5dec16c [AMDGPU] fix readlane/readfirstlane src vgpr operand type.
For VGPR_32 operand disassembler expects a VGPR register encoded as 0..255 (enum8 src operand).
readfirstlane/readline actually has enum9 operand and this change fixes VGPR_32 to VS_32 (enum9 encoding).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265670 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 13:41:51 +00:00
Dmitry Polukhin
bf5cff26fe Fix test/Assembler/ifunc-asm.ll test on hexagon-elf bots
Temporary disable llc test, it seems that such test should be in some
other directory.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265669 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 13:18:43 +00:00
Dmitry Polukhin
ba4922356c [GCC] Attribute ifunc support in llvm
This patch add support for GCC attribute((ifunc("resolver"))) for
targets that use ELF as object file format. In general ifunc is a
special kind of function alias with type @gnu_indirect_function. Patch
for Clang http://reviews.llvm.org/D15524

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265667 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 12:32:19 +00:00
NAKAMURA Takumi
719a4bd1ab InlineSpiller.cpp: Escap \@ in r265547. [-Wdocumentation]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265657 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 11:30:06 +00:00
Benjamin Kramer
47d60da931 Make helper functions static. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265653 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 10:10:09 +00:00
Valery Pykhtin
393a60e73a fix r265645: target dependent printf formatting flags.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265649 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 08:38:20 +00:00
Jeroen Ketema
e6557575bb [CMake] Check for sys/types.h in config-ix.cmake
`sys/types.h` has a related define in `config.h.cmake`, but was never
checked for in CMake. Sync this.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265648 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 08:36:13 +00:00
Simon Pilgrim
405e645cb1 [X86][SSE] Add support for VZEXT constant folding
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265646 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 07:52:45 +00:00
Valery Pykhtin
514b0038dd [AMDGPU] llvm-objdump: Minimal HSA Code Object disassembler support.
Reenable reverted r265550 with endianness issue fixed. Variables of
endian-aware types such as ulittle32_t should be explicitly casted
to their natural equivalent types before passing it as vararg to
printf like functions (format in my case). Added lit config file
depending on AMDGPU target as the testcase uses assembler.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265645 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 07:24:01 +00:00
Amaury Sechet
3b594eaf52 [BlockPlacement] Remove an unnecessary continue
NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265643 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 06:35:00 +00:00
Amaury Sechet
b178818193 [MBP] Remove an unused function parameter
NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265642 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 06:34:47 +00:00
Amaury Sechet
e31b14487a Do some refactoring in the LLVM C API echo test to remove duplication. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265641 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 05:56:20 +00:00
Wei Mi
e0762dfa97 Fix the sanitizer bootstrap error in r265547.
The iterators of SmallPtrSet SpillsInSubTreeMap[Child].first may be
invalidated when SpillsInSubTreeMap grows. Rearrange the code to
ensure the grow of SpillsInSubTreeMap only happens before getting
the iterators of the SmallPtrSet.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265639 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 05:27:17 +00:00
Amaury Sechet
928c8dac1c Revert "[BlockPlacement] Remove an unnecessary continue" and "[MBP] Remove an unused function parameter"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265638 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 04:28:40 +00:00
Duncan P. N. Exon Smith
fcdd17bc64 Revert "ValueMapper: Make LocalAsMetadata match function-local Values"
This reverts commit r265631, since it caused bot failures:
http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/3256
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/7272

Looks like something is depending on the old behaviour.  I'll try to
track it down and recommit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265637 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 02:10:50 +00:00
Ahmed Bougacha
8465c13741 [X86] Reuse EFLAGS and form LOCKed ops when only user is SETCC.
Re-apply r265450 which caused PR27245 and was reverted in r265559
because of a wrong generalization: the fetch_and_add->add_and_fetch
combine only works in specific, but pretty common, cases:
  (icmp slt x, 0) -> (icmp sle (add x, 1), 0)
  (icmp sge x, 0) -> (icmp sgt (add x, 1), 0)
  (icmp sle x, 0) -> (icmp slt (sub x, 1), 0)
  (icmp sgt x, 0) -> (icmp sge (sub x, 1), 0)

Original Message:

We only generate LOCKed versions of add/sub when the result is unused.
It often happens that the result is used, but only by a comparison. We
can optimize those out by reusing EFLAGS, which lets us use the proper
instructions, instead of having to fallback to LXADD.

Instead of doing this as an MI peephole (as we do for the other
non-LOCKed (really, non-MR) forms), do it in ISel. It becomes quite
tricky later.

This also makes it eventually possible to stop expanding and/or/xor
if the only user is an icmp (also see D18141).

This uses the LOCK ISD opcodes added by r262244.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265636 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 02:07:10 +00:00