Commit Graph

18012 Commits

Author SHA1 Message Date
Daniel Jasper
bbaf4fd14c During PHI elimination, split critical edges that move copies out of loops.
This prevents the behavior observed in llvm.org/PR22369. I am not sure
whether I am reading the code correctly, but the early exit based on
isLiveOutPastPHIs() seems to make the wrong assumption that
RegisterCoalescer won't be able to coalesce those copies later.

This change hides the new behavior behind -no-phi-elim-live-out-early-exit
as it currently breaks four tests:
 * Assertion in:
     CodeGen/Hexagon/hwloop-cleanup.ll
 * Worse code in:
     CodeGen/X86/coalescer-commute4.ll
     CodeGen/X86/phys_subreg_coalesce-2.ll
     CodeGen/X86/zlib-longest-match.ll
   The root cause here seems to be that the heuristic that determines
   the visitation order in RegisterCoalescer gets less lucky.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231064 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-03 10:23:11 +00:00
Andrew Kaylor
f89c6af16b Remap arguments and non-alloca values used by outlined C++ exception handlers.
Differential Revision: http://reviews.llvm.org/D7844



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231042 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-03 00:41:03 +00:00
Adrian Prantl
e4ffd28ade Revert "Revert "For the dwarf expression code get the subtarget off of the current""
This reapplies r230990 without modifications.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231024 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-02 22:02:36 +00:00
Adrian Prantl
994176ad7c Refactor DebugLocDWARFExpression so it doesn't require access to the
TargetRegisterInfo. DebugLocEntry now holds a buffer with the raw bytes
of the pre-calculated DWARF expression.

Ought to be NFC, but it does slightly alter the output format of the
textual assembly.

This reapplies 230930 without the assertion in DebugLocEntry::finalize()
because not all Machine registers can be lowered into DWARF register
numbers and floating point constants cannot be expressed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231023 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-02 22:02:33 +00:00
Rui Ueyama
4d1d4bad13 Use read{16,32,64}{le,be}() instead of *reinterpret_cast<u{little,big}{16,32,64}_t>().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231016 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-02 21:19:12 +00:00
Adrian Prantl
a2e69c9c58 Revert "Refactor DebugLocDWARFExpression so it doesn't require access to the"
This reverts commit 230975 to investigate buildbot breakage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231004 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-02 20:01:54 +00:00
Adrian Prantl
db52ec3ae9 Revert "For the dwarf expression code get the subtarget off of the current"
This reverts commit 230990 because also reverting 230975.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231003 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-02 20:01:47 +00:00
Eric Christopher
45ba21c4a3 For the dwarf expression code get the subtarget off of the current
MachineFunction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230990 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-02 19:01:47 +00:00
Adrian Prantl
9680c9c1a8 Refactor DebugLocDWARFExpression so it doesn't require access to the
TargetRegisterInfo. DebugLocEntry now holds a buffer with the raw bytes
of the pre-calculated DWARF expression.

Ought to be NFC, but it does slightly alter the output format of the
textual assembly.

This reapplies 230930 with a relaxed assertion in DebugLocEntry::finalize()
that allows for empty DWARF expressions for constant FP values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230975 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-02 17:21:06 +00:00
Benjamin Kramer
2271bfcd9c Accidentaly inverted the condition again. Sorry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230973 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-02 16:45:08 +00:00
Benjamin Kramer
8bbe122af2 Avoid assertion in MSVC 2013 debug builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230972 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-02 16:42:56 +00:00
Benjamin Kramer
f94a2935ee Simplify code. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230948 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-02 11:57:04 +00:00
Nico Weber
5e871d0b9c Revert r230930, it caused PR22747.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230932 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-02 04:37:11 +00:00
Adrian Prantl
d21acaf6a1 Refactor DebugLocDWARFExpression so it doesn't require access to the
TargetRegisterInfo. DebugLocEntry now holds a buffer with the raw bytes
of the pre-calculated DWARF expression.

Ought to be NFC, but it does slightly alter the output format of the
textual assembly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230930 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-02 02:38:18 +00:00
Arnaud A. de Grandmaison
502bb4cfeb [PBQP] Address post-commit style comment for r230904. NFC.
Thanks David !

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230908 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-01 21:22:50 +00:00
Arnaud A. de Grandmaison
e2557d9bd1 [PBQP] Do not add an edge between nodes with totally disjoint allowed registers
Such edges are zero matrix, and they bring no additional info to the
allocation problem, apart from contributing to nodes' degree. Removing
those edges is expected to improve allocation time.

Tune the spill cost comparison, as this gives better average performances
now that the nodes' degrees has changed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230904 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-01 20:39:34 +00:00
Sanjay Patel
821bba7fda avoid infinite looping when folding vector multiplies of constants (PR22698)
We were missing a check for the following fold in DAGCombiner:

// fold (fmul (fmul x, c1), c2) -> (fmul x, (fmul c1, c2))

If 'x' is also a constant, then we shouldn't do anything. Otherwise, we could end up swapping the operands back and forth forever.

This should fix:
http://llvm.org/bugs/show_bug.cgi?id=22698

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230884 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-01 00:09:35 +00:00
Benjamin Kramer
f4cff31d3c DwarfAccelTable: We know how many hashes we have in the output, just reserve the precise number
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230865 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-28 20:15:00 +00:00
Benjamin Kramer
cdef9818bc StackColoring: Move set instead of copying. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230864 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-28 20:14:38 +00:00
Benjamin Kramer
2bcfcc1c65 LiveRange: Replace a creative vector erase loop with std::remove_if.
I didn't see this so far because it scans backwards, but that doesn't
make it any less quadratic. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230863 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-28 20:14:27 +00:00
Mehdi Amini
8d25e3a832 Fixup for recent -fast-isel-abort change: code didn't match description
Level 1 should abort for all instructions but call/terminators/args.
Instead it was aborting only if the level was > 2

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230861 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-28 19:34:54 +00:00
Benjamin Kramer
bac8d0ec70 Convert push_back loops into append calls.
No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230849 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-28 13:20:15 +00:00
Benjamin Kramer
b22e2f9f2a ArrayRefize memory operand folding. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230846 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-28 12:04:00 +00:00
Benjamin Kramer
31fbd9f7b0 Replace std::copy with a back inserter with vector append where feasible
All of the cases were just appending from random access iterators to a
vector. Using insert/append can grow the vector to the perfect size
directly and moves the growing out of the loop. No intended functionalty
change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230845 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-28 10:11:12 +00:00
Benjamin Kramer
0a7ed28ea6 MachineDominators: Move applySplitCriticalEdges into the cpp file.
It's too big for inlining anyways. Also clean it up slightly. No functionality
change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230806 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 23:13:13 +00:00
Benjamin Kramer
9f9dcf8046 Reduce double set lookups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230798 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 21:43:14 +00:00
Eric Christopher
930da21265 Remove the Forward Control Flow Integrity pass and its dependencies.
This work is currently being rethought along different lines and
if this work is needed it can be resurrected out of svn. Remove it
for now as no current work in ongoing on it and it's unused. Verified
with the authors before removal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230780 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 19:03:38 +00:00
Mehdi Amini
26d628d6ce Change the fast-isel-abort option from bool to int to enable "levels"
Summary:
Currently fast-isel-abort will only abort for regular instructions,
and just warn for function calls, terminators, function arguments.
There is already fast-isel-abort-args but nothing for calls and
terminators.

This change turns the fast-isel-abort options into an integer option,
so that multiple levels of strictness can be defined.
This will help no being surprised when the "abort" option indeed does
not abort, and enables the possibility to write test that verifies
that no intrinsics are forgotten by fast-isel.

Reviewers: resistor, echristo

Subscribers: jfb, llvm-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230775 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 18:32:11 +00:00
Rafael Espindola
150233c378 Centralize handling of the eh_begin and eh_end labels.
This removes a bit of duplicated code and more importantly, remembers the
labels so that they don't need to be looked up by name.

This in turn allows for any name to be used and avoids a crash if the name
we wanted was already taken.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230772 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 18:18:39 +00:00
Sanjoy Das
791a501266 Don't modify the DenseMap being iterated over from within the loop
that is iterating over it

Inserting elements into a `DenseMap` invalidated iterators pointing
into the `DenseMap` instance.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230719 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 02:24:16 +00:00
Eric Christopher
9656d2d2bc Rewrite MachineOperand::print and MachineInstr::print to avoid
uses of TM->getSubtargetImpl and propagate to all calls.

This could be a debugging regression in places where we had a
TargetMachine and/or MachineFunction but don't have it as part
of the MachineInstr. Fixing this would require passing a
MachineFunction/Function down through the print operator, but
none of the existing uses in tree seem to do this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230710 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 00:11:34 +00:00
Rafael Espindola
fc0ad8d28d Put jump tables in distinct sections if -ffunction-sections is used.
A small regression in r230411 was that we were basing the decision on
-fdata-sections.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230707 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-26 23:55:11 +00:00
Eric Christopher
98b2dc263c Remove DebugLoc::print(LLVMContext, raw_ostream), it was just
forwarding to the one that didn't take a context.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230700 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-26 23:32:17 +00:00
Eric Christopher
acdd4442cb getRegForInlineAsmConstraint wants to use TargetRegisterInfo for
a lookup, pass that in rather than use a naked call to getSubtargetImpl.
This involved passing down and around either a TargetMachine or
TargetRegisterInfo. Update all callers/definitions around the targets
and SelectionDAG.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230699 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-26 22:38:43 +00:00
Eric Christopher
28ebf3f112 Add a TargetMachine argument to the AddressingModeMatcher, we'll
need this shortly to get a TargetRegisterInfo from the subtarget
for TargetLowering routines.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230698 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-26 22:38:34 +00:00
Rafael Espindola
4b2e78ecac Simplify arange output.
Move SectionMap to its only user (emitDebugARanges) and
reorder to save a call to sort.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230693 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-26 22:02:02 +00:00
Paul Robinson
b2f521b647 When the source has a series of assignments, users reasonably want to
have the debugger step through each one individually. Turn off the
combine for adjacent stores at -O0 so we get this behavior.

Possibly, DAGCombine shouldn't run at all at -O0, but that's for
another day; see PR22346.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230659 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-26 18:47:57 +00:00
Eric Christopher
a01bc6a59f Remove an argument-less call to getSubtargetImpl from TargetLoweringBase.
This required plumbing a TargetRegisterInfo through computeRegisterProperties
and into findRepresentativeClass which uses it for register class
iteration. This required passing a subtarget into a few target specific
initializations of TargetLowering.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230583 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-26 00:00:24 +00:00
Eric Christopher
b97b892db1 Move TargetLoweringBase::getTypeConversion to the .cpp file from
the .h file. It's used in only one place (other than recursively)
and there's no need to include it everywhere.

Saves almost 900k from total llvm object file size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230561 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-25 22:41:30 +00:00
Andrew Kaylor
88c74bffbf Fixing a problem with insert location in WinEH outlining
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230535 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-25 20:12:49 +00:00
Rafael Espindola
76bdd01e0e Support SHF_MERGE sections in COMDATs.
This patch unifies the comdat and non-comdat code paths. By doing this
it add missing features to the comdat side and removes the fixed
section assumptions from the non-comdat side.

In ELF there is no one true section for "4 byte mergeable" constants.
We are better off computing the required properties of the section
and asking the context for it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230411 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-25 00:52:15 +00:00
David Majnemer
af91a06d0f PrologEpilogInserter: Clean up math in calculateFrameObjectOffsets
There is no need to open-code the alignment calculation, we have a
handy RoundUpToAlignment function which "Does The Right Thing (TM)".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230392 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-24 23:08:13 +00:00
Simon Pilgrim
41cda40157 Reapplied D7816 & rL230177 & rL230278 - with an additional fix toensure that the smallest build vector input scalar type is always used. Additional (crash) test cases already committed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230388 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-24 22:08:56 +00:00
Andrew Kaylor
8f475e9d77 Fixing eol-style
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230378 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-24 20:49:35 +00:00
Eric Christopher
7c611d59cc Revert:
Author: Simon Pilgrim <llvm-dev@redking.me.uk>
Date:   Mon Feb 23 23:04:28 2015 +0000

    Fix based on post-commit comment on D7816 & rL230177 - BUILD_VECTOR operand truncation was using the the BV's output scalar type instead of the input type.

and

Author: Simon Pilgrim <llvm-dev@redking.me.uk>
Date:   Sun Feb 22 18:17:28 2015 +0000

    [DagCombiner] Generalized BuildVector Vector Concatenation

    The CONCAT_VECTORS combiner pass can transform the concat of two BUILD_VECTOR nodes into a single BUILD_VECTOR node.

    This patch generalises this to support any number of BUILD_VECTOR nodes, and also permits UNDEF nodes to be included as well.

    This was noticed as AVX vec128 -> vec256 canonicalization sometimes creates a CONCAT_VECTOR with a real vec128 lower and an vec128 UNDEF upper.

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

as the root cause of PR22678 which is causing an assertion inside the DAG combiner.

I'll follow up to the main thread as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230358 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-24 19:11:00 +00:00
Eric Christopher
f8c57a105e Rename UpdateRegAllocHint to match style guidelines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230357 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-24 19:10:57 +00:00
Matthias Braun
8b1add3c13 DAGCombiner: Move variable definitions closer to use; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230354 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-24 18:52:01 +00:00
Matthias Braun
5f146de042 DAGCombiner: Move variable declaration closer to definiion; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230353 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-24 18:51:59 +00:00
Tim Northover
5530ac99e6 ARM: treat [N x i32] and [N x i64] as AAPCS composite types
The logic is almost there already, with our special homogeneous aggregate
handling. Tweaking it like this allows front-ends to emit AAPCS compliant code
without ever having to count registers or add discarded padding arguments.

Only arrays of i32 and i64 are needed to model AAPCS rules, but I decided to
apply the logic to all integer arrays for more consistency.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230348 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-24 17:22:34 +00:00
Hal Finkel
cccfe54933 [SDAG] Handle LowerOperation returning its input consistently
For almost all node types, if the target requested custom lowering, and
LowerOperation returned its input, we'd treat the original node as legal. This
did not work, however, for many loads and stores, because they follow
slightly different code paths, and we did not account for the possibility of
LowerOperation returning its input at those call sites.

I think that we now handle this consistently everywhere. At the call sites in
LegalizeDAG, we used to assert in this case, so there's no functional change
for any existing code there. For the call sites in LegalizeVectorOps, this
really only affects whether or not we set Changed = true, but I think makes the
semantics clearer.

No test case here, but it will be covered by an upcoming PowerPC commit adding
QPX support.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230332 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-24 12:59:47 +00:00