Commit Graph

21353 Commits

Author SHA1 Message Date
Quentin Colombet
9b473140dd [RegisterBankInfo] Constify the member of the XXXMapping maps.
This makes it obvious that items in those maps behave like statically
created objects.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282327 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-24 04:54:03 +00:00
Quentin Colombet
d1ab103882 [RegisterBankInfo] Add statistics for dynamic value mappings.
Like partial mappings, as we move toward TableGen'ed information, the
number should reach zero eventually.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282325 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-24 04:53:55 +00:00
Quentin Colombet
9545266289 [RegisterBankInfo] Uniquely generate ValueMapping.
This is a step toward statically allocate ValueMapping. Like the
previous few commits, the goal is to move toward a TableGen'ed like
structure with no dynamic allocation at all.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282324 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-24 04:53:52 +00:00
Quentin Colombet
245edb6c14 [RegisterBankInfo] Keep valid pointers for PartialMappings.
Previously we were using the address of the unique instance of a partial
mapping in the related map to access this instance. However, when the
map grows, the whole set of instances may be moved elsewhere and the
previous addresses are not valid anymore.

Instead, keep the address of the unique heap allocated instance of a
partial mapping.

Note: I did not see any actual bugs for that problem as the number of
partial mappings dynamically allocated is small (<= 4).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282323 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-24 04:53:48 +00:00
Matthias Braun
a92ff23987 llc: Add -start-before/-stop-before options
Differential Revision: https://reviews.llvm.org/D23089

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282302 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-23 21:46:02 +00:00
Quentin Colombet
f8e3a5168e [ResetMachineFunction] Populate the comments in the header of the file.
NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282276 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-23 18:38:15 +00:00
Quentin Colombet
76cc1a9a56 [ResetMachineFunction] Add statistic on the number of reset functions.
As the development of GlobalISel move forward, this statistic should
strictly decrease until it reaches zero. At this point, it would mean
GlobalISel can replace SDISel (at least on the tested inputs :P).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282275 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-23 18:38:13 +00:00
Quentin Colombet
c81278e2a4 [RegisterBankInfo] Add statistics for dynamic partial mappings.
Collect statistics about the number of partial mappings dynamically
allocated and accessed. Ultimately, when the whole TableGen
infrastructure is set, those numbers should be zero.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282274 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-23 18:38:06 +00:00
Matthias Braun
abd02b3ad6 ScheduleDAG: Match enum names when printing sdep kinds
It is less confusing to have the same names in the debug print as the
enum members.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282273 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-23 18:28:31 +00:00
Quentin Colombet
4151a976fe [RegBankSelect] Use DEBUG_TYPE instead of repeating the name of the pass
NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282267 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-23 17:50:06 +00:00
Quentin Colombet
f8d0897068 [RegisterBank] Mark the dump method with LLVM_DUMP_METHOD.
NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282266 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-23 17:50:03 +00:00
Quentin Colombet
a750e553b1 [RegisterBankInfo] Mark the dump methods with LLVM_DUMP_METHOD.
NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282221 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-23 00:59:12 +00:00
Quentin Colombet
04905d75e7 [RegisterBankInfo] Check that the mapping covers the interesting bits.
In the verify method of the ValueMapping class we used to check that the
mapping exactly matches the bits of the input value. This is problematic
for statically allocated mappings because we would need a different
mapping for each different size of the value that maps on one
instruction. For instance, with such scheme, we would need a different
mapping for a value of size 1, 5, 23 whereas they all end up on a 32-bit
wide instruction.

Therefore, change the verifier to check that the meaningful bits are
covered by the mapping instead of matching them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282214 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-23 00:14:34 +00:00
Quentin Colombet
45c56aeee1 [RegisterBankInfo] Use array instead of SmallVector for BreakDown.
This is another step toward TableGen'ed like structures. The BreakDown of
the mapping of the value will be statically computed by TableGen, thus
we only have to point to the right entry in the table instead of
dynamically allocate the mapping for each instruction.

We still support the dynamic allocation through a factory of
PartialMapping to ease the bring-up of the targets while the TableGen
backend is not available.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282213 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-23 00:14:30 +00:00
Matthias Braun
a86d297ba3 MachineScheduler: Slightly simplify release node
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282201 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 21:39:56 +00:00
Matthias Braun
c3e16a5807 MachineScheduler: Remove ineffective heuristic; NFC
Currently all nodes get added to the NextSU list when they are released,
so any candidate must be in that list, making the heuristic ineffective.
Remove it for now, we can add it back later in a working fashion if
necessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282200 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 21:39:52 +00:00
Hans Wennborg
ba9e1e6b25 Win64: Don't emit unwind info for "leaf" functions (PR30337)
According to MSDN (see the PR), functions which don't touch any callee-saved
registers (including %rsp) don't need any unwind info.

This patch makes LLVM not emit unwind info for such functions, to save
binary size.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282185 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 19:50:05 +00:00
Nirav Dave
489cfe73c2 [DAG] Fix incorrect alignment of ext load.
Correctly use alignment size from loaded size not output value size.

Reviewers: jyknight, tstellarAMD, arsenm

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282177 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 17:28:43 +00:00
Tim Northover
c63e7f7506 GlobalISel: handle stack-based parameters on AArch64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282153 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 13:49:25 +00:00
Quentin Colombet
e6b78fd6c5 [RegisterBankInfo] Move to statically allocated RegisterBank.
This commit is basically the first step toward what will
RegisterBankInfo look when it gets TableGen'ed.

It introduces a XXXGenRegisterBankInfo.def file that is what TableGen
will issue at some point. Moreover, the RegBanks field in
RegisterBankInfo changed to reflect the static (compile time) aspect of
the information.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282131 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 02:10:37 +00:00
Quentin Colombet
22bb41e797 [RegisterBankInfo] Take advantage of the extra argument of SmallVector::resize.
When initializing an instance of OperandsMapper, instead of using
SmallVector::resize followed by std::fill, use the function that
directly does that in SmallVector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282130 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 02:10:32 +00:00
Davide Italiano
648d6ac61e [MIRParser] Delete dead code. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282098 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 18:26:08 +00:00
Arnold Schwaighofer
ad6572b3dd Disable tail calls if there is an swifterror argument
ISel does not handle them correctly yet i.e we crash trying to emit tail call
code.

radar://28407842

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282088 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 16:53:36 +00:00
Tim Northover
c297159d2f GlobalISel: produce correct code for signext/zeroext ABI flags.
We still don't really have an equivalent of "AssertXExt" in DAG, so we don't
exploit the guarantees on the receiving side yet, but this should produce
conservatively correct code on iOS ABIs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282069 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 12:57:45 +00:00
Tim Northover
d79f714b0b GlobalISel: pass Function to lowerFormalArguments directly (NFC).
The only implementation that exists immediately looks it up anyway, and the
information is needed to handle various parameter attributes (stored on the
function itself).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282068 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 12:57:35 +00:00
Eric Christopher
768be7b1ba Revert "Remove extra argument used once on
TargetMachine::getNameWithPrefix and inline the result into the singular
caller." and "Remove more guts of TargetMachine::getNameWithPrefix and
migrate one check to the TLOF mach-o version." temporarily until I can
get the whole call migrated out of the TargetMachine as we could hit
places where TLOF isn't valid.

This reverts commits r281981 and r281983.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282028 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-20 22:03:28 +00:00
George Burgess IV
452ae8c3eb [CodeGen] stop short-circuiting the SSP code for sspstrong.
This check caused us to skip adding layout information for calls to
alloca in sspreq/sspstrong mode. We check properly for sspstrong later
on (and add the correct layout info when doing so), so removing this
shouldn't hurt.

No test is included, since testing this using lit seems to require
checking for exact offsets in asm, which is something that the lit tests
for this avoid. If someone cares deeply, I'm happy to write a unittest
or something to cover this, but that feels like overkill.

Patch by Daniel Micay.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282022 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-20 21:30:01 +00:00
Petr Hosek
38ea316607 Mark ELF sections whose name start with .note as note
Previously, such section would be marked as SHT_PROGBITS which
makes it impossible to use an initialized C variable declaration
to emit an (allocated) ELF note. The new behavior is also consistent
with ELF assembly parser.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282010 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-20 20:21:13 +00:00
Adrian McCarthy
864e0ffb0e Fix syntactical nit from r281990.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281991 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-20 17:42:13 +00:00
Adrian McCarthy
f5f252d099 Emit S_COMPILE3 CodeView record
CodeView has an S_COMPILE3 record to identify the compiler and source language of the compiland.  This record comes first in the debug$S section for the compiland. The debuggers rely on this record to know the source language of the code.

There was a little test fallout from introducing a new record into the symbols subsection.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281990 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-20 17:20:51 +00:00
Eric Christopher
663e1b0cfc Remove more guts of TargetMachine::getNameWithPrefix and migrate one check to the TLOF mach-o version.
NFC intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281983 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-20 16:05:02 +00:00
Eric Christopher
a61998926f Remove extra argument used once on TargetMachine::getNameWithPrefix and inline the result into the singular caller.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281981 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-20 16:04:50 +00:00
Keith Walker
4e09440dd5 Improve the -debug output for Debug Range Extension (NFC)
Include header messages and remove unnecessary blank lines.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281980 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-20 16:04:31 +00:00
Tim Northover
a93f61a2c3 GlobalISel: split aggregates for PCS lowering
This should match the existing behaviour for passing complicated struct and
array types, in particular HFAs come through like that from Clang.

For C & C++ we still need to somehow support all the weird ABI flags, or at
least those that are present in the IR (signext, byval, ...), and stack-based
parameter passing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281977 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-20 15:20:36 +00:00
Matthias Braun
b72235f318 BranchFolder: Fix invalid undef flags after merge.
It is legal to merge instructions with different undef flags; However we
must drop the undef flag from the merged instruction if it isn't present
everywhere.

This fixes http://llvm.org/PR30199

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281957 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-20 01:14:42 +00:00
Quentin Colombet
3d21d847db [RegisterBankInfo] Adapt call to std::fill due to use of SmallVector.
This was meant to be commited with my previous commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281948 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-19 23:18:47 +00:00
Quentin Colombet
d809745696 [RegisterBankInfo] Avoid heap allocation in most cases.
The OperandsMapper class is used heavy in RegBankSelect and each
instantiation triggered a heap allocation for the array of operands.
Instead, use a SmallVector with a big enough size such that most of the
cases do not have to use dynamically allocated memory.

This improves the compile time of the RegBankSelect pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281916 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-19 17:33:55 +00:00
Matthias Braun
b0731963da LiveRangeCalc: Fix reporting of invalid vreg usage in liveness calculation
Machine programs need a definition of each vreg before reaching a use
(the definition may come from an IMPLICIT_DEF instruction). This class
of errors is not detected by the MachineVerifier because of efficiency
concerns. LiveRangeCalc used to report these problems, make it do that
again (followup to r279625).

Also use report_fatal_error() instead of llvm_unreachable() as the error
reporting is only present in asserts build anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281914 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-19 16:49:45 +00:00
Dean Michael Berris
916b3667a3 [XRay] ARM 32-bit no-Thumb support in LLVM
This is a port of XRay to ARM 32-bit, without Thumb support yet. The XRay instrumentation support is moving up to AsmPrinter.
This is one of 3 commits to different repositories of XRay ARM port. The other 2 are:

https://reviews.llvm.org/D23932 (Clang test)
https://reviews.llvm.org/D23933 (compiler-rt)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281878 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-19 00:54:35 +00:00
Craig Topper
1b68ca9a47 [AVX-512] Don't lower CVTPD2PS intrinsics to ISD::FP_ROUND with an X86 rounding mode encoding in the second operand. This immediate should only be 0 or 1 and indicates if the truncation loses precision.
Also enhance an assert in SelectionDAG::getNode to flag this sort of problem in the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281868 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-18 21:49:32 +00:00
Simon Pilgrim
428ba8ee90 [X86][SSE] Improve recognition of uitofp conversions that can be performed as sitofp
With D24253 we can now use SelectionDAG::SignBitIsZero with vector operations.

This patch uses SelectionDAG::SignBitIsZero to recognise that a zero sign bit means that we can use a sitofp instead of a uitofp (which is not directly support on pre-AVX512 hardware).

While AVX512 does provide support for uitofp, the conversion to sitofp should not cause any regressions.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281852 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-18 12:45:23 +00:00
Wei Mi
f54e133dd2 Change the order of the splitted store from high - low to low - high.
It is a trivial change which could make the testcase easier to be reused
for the store splitting in CodeGenPrepare.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281846 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-18 06:10:32 +00:00
Mehdi Amini
d1e3c5aaec Don't create a SymbolTable in Function when the LLVMContext discards value names (NFC)
The ValueSymbolTable is used to detect name conflict and rename
instructions automatically. This is not needed when the value
names are automatically discarded by the LLVMContext.
No functional change intended, just saving a little bit of memory.

This is a recommit of r281806 after fixing the accessor to return
a pointer instead of a reference and updating all the call-sites.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281813 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-17 06:00:02 +00:00
Mehdi Amini
f3f34d6443 [MIR Parser] Fix Build!
Last-second refactoring before push was bad idea...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281812 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-17 05:41:02 +00:00
Mehdi Amini
5f16c76bd0 MIR Parser: issue an error when the Context discard value names.
This is in line with the LLParser behavior

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281811 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-17 05:33:58 +00:00
Evgeniy Stepanov
df9dcaf1ee [safestack] Fix assertion failure in stack coloring.
This is a fix for PR30318.

Clang may generate IR where an alloca is already live when entering a
BB with lifetime.start. In this case, conservatively extend the
alloca lifetime all the way back to the block entry.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281784 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-16 22:04:10 +00:00
Quentin Colombet
005bfb8238 [RegAllocGreedy] Fix the list of NewVRegs for last chance recoloring.
When trying to recolor a register we may split live-ranges in the
process. When we create new live-ranges we will have to process them,
but when we move a register from Assign to Split, the allocation is not
changed until the whole recoloring session is successful.
Therefore, only push the live-ranges that changed from Assign to
Split when the recoloring is successful.

Same as the previous commit, I was not able to produce a test case that
reproduce the problem with in-tree targets.

Note: The bug has been here since the recoloring scheme has been added
back in r200883 (Feb 2014).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281783 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-16 22:00:50 +00:00
Quentin Colombet
12bac3e6a2 [RegAllocGreedy] Fix an assertion and condition when last chance recoloring is used.
When last chance recoloring is used, the list of NewVRegs may not be
empty when calling selectOrSplitImpl. Indeed, another coloring may have
taken place with splitting/spilling in the same recoloring session.

Relax an assertion to take this into account and adapt a condition to
act as if the NewVRegs were local to this selectOrSplitImpl instance.

Unfortunately I am unable to produce a test case for this, I was only
able to reproduce the conditions on an out-of-tree target.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281782 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-16 22:00:42 +00:00
Ahmed Bougacha
07ca84e98a [AArch64][GlobalISel] Test default regbank mapping for G_ICMP.
Also relax a RegisterBankInfo verifier check that's incompatible with
1-bit mappings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281735 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-16 14:44:54 +00:00
Keith Walker
7435b28542 Place the lowered phi instruction(s) before the DEBUG_VALUE entry
When a phi node is finally lowered to a machine instruction it is
important that the lowered "load" instruction is placed before the
associated DEBUG_VALUE entry describing the value loaded.

Renamed the existing SkipPHIsAndLabels to SkipPHIsLabelsAndDebug to
more fully describe that it also skips debug entries. Then used the
"new" function SkipPHIsAndLabels when the debug information should not
be skipped when placing the lowered "load" instructions so that it is
placed before the debug entries.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281727 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-16 14:07:29 +00:00