Commit Graph

832 Commits

Author SHA1 Message Date
Chandler Carruth
e3e43d9d57 Sort the remaining #include lines in include/... and lib/....
I did this a long time ago with a janky python script, but now
clang-format has built-in support for this. I fed clang-format every
line with a #include and let it re-sort things according to the precise
LLVM rules for include ordering baked into clang-format these days.

I've reverted a number of files where the results of sorting includes
isn't healthy. Either places where we have legacy code relying on
particular include ordering (where possible, I'll fix these separately)
or where we have particular formatting around #include lines that
I didn't want to disturb in this patch.

This patch is *entirely* mechanical. If you get merge conflicts or
anything, just ignore the changes in this patch and run clang-format
over your #include lines in the files.

Sorry for any noise here, but it is important to keep these things
stable. I was seeing an increasing number of patches with irrelevant
re-ordering of #include lines because clang-format was used. This patch
at least isolates that churn, makes it easy to skip when resolving
conflicts, and gets us to a clean baseline (again).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304787 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-06 11:49:48 +00:00
Eugene Zelenko
6463296227 [CodeGen] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303820 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-24 23:10:29 +00:00
Stanislav Mekhanoshin
f99709a2df Fix subreg value numbers in handleMoveUp
The problem can occur in presence of subregs. If we are swapping two
instructions defining different subregs of the same register we will
get a new liveout from a block. We need to preserve value number for
block's liveout for successor block's livein to match.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297534 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-11 00:14:52 +00:00
Matthias Braun
88d207542b Cleanup dump() functions.
We had various variants of defining dump() functions in LLVM. Normalize
them (this should just consistently implement the things discussed in
http://lists.llvm.org/pipermail/cfe-dev/2014-January/034323.html

For reference:
- Public headers should just declare the dump() method but not use
  LLVM_DUMP_METHOD or #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
- The definition of a dump method should look like this:
  #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
  LLVM_DUMP_METHOD void MyClass::dump() {
    // print stuff to dbgs()...
  }
  #endif

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293359 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-28 02:02:38 +00:00
Matthias Braun
5862c98d09 LiveIntervalAnalysis: Calculate liveness even if a superreg is reserved.
A register unit may be allocatable and non-reserved but some of the
register(tuples) built with it are reserved. We still need to calculate
liveness in this case.

Note to out of tree targets: If you start seeing machine verifier errors
with this commit, it probably means that you do not properly mark super
registers of reserved register as reserved. See for example r292836 or
r292870 for example on how to fix that.

rdar://29996737

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292871 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-24 01:12:58 +00:00
Matthias Braun
95a36003ff LiveIntervalAnalysis: Cleanup; NFC
- Fix doxygen comments: Do not repeat name, remove duplicated doxygen
  comment (on declaration + implementation), etc.
- Use more range based for

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292455 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-19 00:32:13 +00:00
Krzysztof Parzyszek
308c60d0cb Implement LaneBitmask::any(), use it to replace !none(), NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289974 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-16 19:11:56 +00:00
Krzysztof Parzyszek
d6ca3f019d Extract LaneBitmask into a separate type
Specifically avoid implicit conversions from/to integral types to
avoid potential errors when changing the underlying type. For example,
a typical initialization of a "full" mask was "LaneMask = ~0u", which
would result in a value of 0x00000000FFFFFFFF if the type was extended
to uint64_t.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289820 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-15 14:36:06 +00:00
David Callahan
8be61a8c7e Modify df_iterator to support post-order actions
Summary: This makes a change to the state used to maintain visited information for depth first iterator. We know assume a method "completed(...)" which is called after all children of a node have been visited. In all existing cases, this method does nothing so this patch has no functional changes.  It will however allow a client to distinguish back from cross edges in a DFS tree.

Reviewers: nadav, mehdi_amini, dberlin

Subscribers: MatzeB, mzolotukhin, twoh, freik, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283391 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 21:36:16 +00:00
Krzysztof Parzyszek
57c58d3969 Do not consider subreg defs as reads when computing subrange liveness
Subregister definitions are considered uses for the purpose of tracking
liveness of the whole register. At the same time, when calculating live
interval subranges, subregister defs should not be treated as uses.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280532 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-02 19:48:55 +00:00
Krzysztof Parzyszek
e0daa1e6fe Add an optional parameter with a list of undefs to extendToIndices
Reapply r280268, hopefully in a version that MSVC likes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280358 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-01 12:10:36 +00:00
Reid Kleckner
27e101d577 Revert "Add an optional parameter with a list of undefs to extendToIndices"
This reverts commit r280268, it causes all MSVC 2013 to ICE. This
appears to have been fixed in a later MSVC 2013 update, because I cannot
reproduce it locally. That said, all upstream LLVM bots are broken right
now, so I am reverting.

Also reverts dependent change r280275, "[Hexagon] Deal with undefs when
extending live intervals".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280301 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-31 22:36:02 +00:00
Krzysztof Parzyszek
ae9896ff51 Add an optional parameter with a list of undefs to extendToIndices
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280268 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-31 18:02:19 +00:00
Matthias Braun
da04ce1480 MachineRegisterInfo/MIR: Initialize tracksSubRegLiveness early, do not print/parser it
tracksSubRegLiveness only depends on the Subtarget and a cl::opt, there
is not need to change it or save/parse it in a .mir file.
Make the field const and move the initialization LiveIntervalAnalysis to the
MachineRegisterInfo constructor. Also cleanup some code and fix some
instances which better use MachineRegisterInfo::subRegLivenessEnabled() instead
of TargetSubtargetInfo::enableSubRegLiveness().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279676 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-24 22:17:45 +00:00
Krzysztof Parzyszek
31a5f885bf Create subranges for new intervals resulting from live interval splitting
The register allocator can split a live interval of a register into a set
of smaller intervals. After the allocation of registers is complete, the
rewriter will modify the IR to replace virtual registers with the corres-
ponding physical registers. At this stage, if a register corresponding
to a subregister of a virtual register is used, the rewriter will check
if that subregister is undefined, and if so, it will add the <undef> flag
to the machine operand. The function verifying liveness of the subregis-
ter would assume that it is undefined, unless any of the subranges of the
live interval proves otherwise.
The problem is that the live intervals created during splitting do not
have any subranges, even if the original parent interval did. This could
result in the <undef> flag placed on a register that is actually defined.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279625 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-24 13:37:55 +00:00
Nicolai Haehnle
be7124c9bf LiveIntervalAnalysis: fix a crash in repairOldRegInRange
Summary:
See the new test case for one that was (non-deterministically) crashing
on trunk and deterministically hit the assertion that I added in D23302.
Basically, the machine function contains a sequence

     DS_WRITE_B32 %vreg4, %vreg14:sub0, ...
     DS_WRITE_B32 %vreg4, %vreg14:sub0, ...
     %vreg14:sub1<def> = COPY %vreg14:sub0

and SILoadStoreOptimizer::mergeWrite2Pair merges the two DS_WRITE_B32
instructions into one before calling repairIntervalsInRange.

Now repairIntervalsInRange wants to repair %vreg14, in particular, and
ends up trying to repair %vreg14:sub1 as well, but that only becomes
active _after_ the range that is to be repaired, hence the crash due
to LR.find(...) == LR.begin() at the start of repairOldRegInRange.

I believe that just skipping those subrange is fine, but again, not too
familiar with that code.

Reviewers: MatzeB, kparzysz, tstellarAMD

Subscribers: llvm-commits, MatzeB

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278268 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 18:51:14 +00:00
Matthias Braun
bb936d2a6e LiveIntervalAnalysis: Fix handleMoveDown() problem
If we move a last-use register read to a later position we may skip
intermediate segments. This may require us to not only extend the
segment before the NewIdx, but also extend the segment live-in to
OldIdx.

This switches LiveIntervalTest to use AMDGPU so we can test subregister
liveness.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276724 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-26 03:57:45 +00:00
Krzysztof Parzyszek
bbfa7fe14f Fix printing of debugging information in LiveIntervals::shrinkToUses
Print VNI->def before calling VNI->markUnused(), since markUnused makes
the def invalid.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275196 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-12 17:55:28 +00:00
Matthias Braun
b788f1eeba LiveIntervalAnalysis: findLastUseBefore() must ignore undef uses.
undef uses are no real uses of a register and must be ignored by
findLastUseBefore() so that handleMove() does not produce invalid live
intervals in some cases.

This fixed http://llvm.org/PR28083

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272446 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-11 00:31:28 +00:00
Matthias Braun
1cd242fe11 CodeGen: Refactor renameDisconnectedComponents() as a pass
Refactor LiveIntervals::renameDisconnectedComponents() to be a pass.
Also change the name to "RenameIndependentSubregs":

- renameDisconnectedComponents() worked on a MachineFunction at a time
  so it is a natural candidate for a machine function pass.

- The algorithm is testable with a .mir test now.

- This also fixes a problem where the lazy renaming as part of the
  MachineScheduler introduced IMPLICIT_DEF instructions after the number
  of a nodes in a region were counted leading to a mismatch.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271345 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-31 22:38:06 +00:00
Matthias Braun
6063d9d32c LiveIntervalAnalysis: Fix handleMove() re-using the wrong value number
This fixes http://llvm.org/PR27856

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270619 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-24 21:54:01 +00:00
Hal Finkel
8fdeacc0ca [LiveIntervalAnalysis] Don't dereference an end iterator in repairIntervalsInRange
This fixes a bug introduced in:

  r262115 - CodeGen: Take MachineInstr& in SlotIndexes and LiveIntervals, NFC

The iterator End here might == MBB->end(), and so we can't unconditionally
dereference it. This often goes unnoticed (I don't have a test case that always
crashes, and ASAN does not catch it either) because the function call arguments are
turned right back into iterators. MachineInstrBundleIterator's constructor,
however, does have an assert which might randomly fire.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270323 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-21 16:03:50 +00:00
Matthias Braun
6054e84d82 LiveIntervalAnalysis: Rework constructMainRangeFromSubranges()
We now use LiveRangeCalc::extendToUses() instead of a specially designed
algorithm in constructMainRangeFromSubranges():
- The original motivation for constructMainRangeFromSubranges() were
  differences between the main liverange and subranges because of hidden
  dead definitions. This case however cannot happen anymore with the
  DetectDeadLaneMasks pass in place.
- It simplifies the code.
- This fixes a longstanding bug where we did not properly create new SSA
  values on merging control flow (the MachineVerifier missed most of
  these cases).
- Move constructMainRangeFromSubranges() to LiveIntervalAnalysis and
  LiveRangeCalc to better match the implementation/available helper
  functions.

This re-applies r269016. The fixes from r270290 and r270259 should avoid
the machine verifier problems this time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270291 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-20 23:14:56 +00:00
Matthias Braun
2a73788c72 LiveIntervalAnalysis: Fix missing defs in renameDisconnectedComponents().
Fix renameDisconnectedComponents() creating vreg uses that can be
reached from function begin withouthaving a definition (or explicit
live-in). Fix this by inserting IMPLICIT_DEF instruction before
control-flow joins as necessary.

Removes an assert from MachineScheduler because we may now get
additional IMPLICIT_DEF when preparing the scheduling policy.

This fixes the underlying problem of http://llvm.org/PR27705

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270259 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-20 19:46:13 +00:00
Tom Stellard
c37b54dfc5 Revert "LiveIntervalAnalysis: Rework constructMainRangeFromSubranges()"
This reverts commit r269016 and also the follow-up commit r269020.

This patch caused PR27705.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269344 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 20:27:40 +00:00
Matthias Braun
e607e01664 LiveIntervalAnalysis: Rework constructMainRangeFromSubranges()
We now use LiveRangeCalc::extendToUses() instead of a specially designed
algorithm in constructMainRangeFromSubranges():
- The original motivation for constructMainRangeFromSubranges() were
  differences between the main liverange and subranges because of hidden
  dead definitions. This case however cannot happen anymore with the
  DetectDeadLaneMasks pass in place.
- It simplifies the code.
- This fixes a longstanding bug where we did not properly create new SSA
  values on merging control flow (the MachineVerifier missed most of
  these cases).
- Move constructMainRangeFromSubranges() to LiveIntervalAnalysis and
  LiveRangeCalc to better match the implementation/available helper
  functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269016 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-10 04:51:14 +00:00
Matthias Braun
3783c29658 LiveIntervalAnalysis: Fix handleMove() extending liverange for undef inputs
Fix handleMove() incorrectly extending liveranges when an undef input of
a vreg was moved past the (current) end of the liverange.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268805 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 21:47:41 +00:00
Matthias Braun
66bbcee0a9 LiveIntervalAnalysis: Remove LiveVariables requirement
This requirement was a huge hack to keep LiveVariables alive because it
was optionally used by TwoAddressInstructionPass and PHIElimination.
However we have AnalysisUsage::addUsedIfAvailable() which we can use in
those passes.

This re-applies r260806 with LiveVariables manually added to PowerPC to
hopefully not break the stage 2 bots this time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267954 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28 23:42:51 +00:00
Matthias Braun
277501abff LiveIntervalAnalysis: No need to deal with dead subregister defs anymore.
The DetectDeadLaneMask already ensures that we have no dead subregister
definitions making the special handling in LiveIntervalAnalysis
unnecessary. This reverts most of r248335.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267937 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28 20:35:26 +00:00
Matthias Braun
289718f19c LiveIntervalAnalysis: Fix handleMove() using wrong value numbers
handleMove() was incorrectly swapping two value numbers. This was missed
before because the problem only occured when moving subregister definitions
and needed -verify-machineinstrs to be detected.

I cannot add a testcase as long as I cannot reapply r260905/r260806.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267840 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28 02:11:49 +00:00
Mehdi Amini
f6071e14c5 [NFC] Header cleanup
Removed some unused headers, replaced some headers with forward class declarations.

Found using simple scripts like this one:
clear && ack --cpp -l '#include "llvm/ADT/IndexedMap.h"' | xargs grep -L 'IndexedMap[<]' | xargs grep -n --color=auto 'IndexedMap'

Patch by Eugene Kosov <claprix@yandex.ru>

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266595 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-18 09:17:29 +00:00
Duncan P. N. Exon Smith
5144d3546c CodeGen: Update LiveIntervalAnalysis API to use MachineInstr&, NFC
These parameters aren't expected to be null, so take them by reference.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262151 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-27 20:14:29 +00:00
Duncan P. N. Exon Smith
63ec7f0445 WIP: CodeGen: Use MachineInstr& in MachineInstrBundle.h, NFC
Update APIs in MachineInstrBundle.h to take and return MachineInstr&
instead of MachineInstr* when the instruction cannot be null.  Besides
being a nice cleanup, this is tacking toward a fix for PR26753.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262141 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-27 17:05:33 +00:00
Duncan P. N. Exon Smith
42e18357c5 CodeGen: Take MachineInstr& in SlotIndexes and LiveIntervals, NFC
Take MachineInstr by reference instead of by pointer in SlotIndexes and
the SlotIndex wrappers in LiveIntervals.  The MachineInstrs here are
never null, so this cleans up the API a bit.  It also incidentally
removes a few implicit conversions from MachineInstrBundleIterator to
MachineInstr* (see PR26753).

At a couple of call sites it was convenient to convert to a range-based
for loop over MachineBasicBlock::instr_begin/instr_end, so I added
MachineBasicBlock::instrs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262115 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-27 06:40:41 +00:00
Reid Kleckner
0e6b04c2c0 [WinEH] Fix funclet return block clobber mask placement
MBB slot index intervals are half open, not closed. getMBBEndIndex()
returns the slot index of the start of the next block in layout order.
Placing a register mask there is incorrect if the successor of the
funclet return is not laid out after the return. Clang generates IR for
catch bodies before generating the following normal code, so we never
noticed this issue until the D frontend authors filed a bug about it.

Instead, we can put the clobber mask on the last instruction of the
funclet return block. We still aren't using a register mask operand on
the CATCHRET instruction because it would cause PEI to spill all CSRs,
including XMM regs, in the prologue.

Fixes PR26679.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262035 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26 16:53:19 +00:00
Matthias Braun
5270f4212b Revert "LiveIntervalAnalysis: Remove LiveVariables requirement" and LiveIntervalTest
The commit breaks stage2 compilation on PowerPC. Reverting for now while
this is analyzed. I also have to revert the LiveIntervalTest for now as
that depends on this commit.

Revert "LiveIntervalAnalysis: Remove LiveVariables requirement"
This reverts commit r260806.
Revert "Remove an unnecessary std::move to fix -Wpessimizing-move warning."
This reverts commit r260931.
Revert "Fix typo in LiveIntervalTest"
This reverts commit r260907.
Revert "Add unittest for LiveIntervalAnalysis::handleMove()"
This reverts commit r260905.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261189 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-18 05:21:43 +00:00
Matthias Braun
372250bdfb LiveIntervalAnalysis: Support moving of subregister defs in handleMove
This is an updated version which fixes a bug that happened with
uses tied to an earlyclobber operand which end at an unusual slotindex.

If two definitions write to independent subregisters then they can be
put in any order. LiveIntervalAnalysis::handleMove() did not support
this previously because it looks like moving a definition of a vreg past
another one.

This is a modified version of a patch proposed (two years ago) by
Vincent Lejeune! This version does not touch the read-undef flags and is
extended for the case of moving a subregister def behind all uses - this
can happen for subregister defs that are completely unused.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260906 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-15 19:25:36 +00:00
Matthias Braun
7eaa93aa2b LiveIntervalAnalysis: Remove LiveVariables requirement
This requirement was a huge hack to keep LiveVariables alive because it
was optionally used by TwoAddressInstructionPass and PHIElimination.
However we have AnalysisUsage::addUsedIfAvailable() which we can use in
those passes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260806 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-13 04:35:31 +00:00
Matthias Braun
e7d57e326e Revert "LiveIntervalAnalysis: Support moving of subregister defs in handleMove"
This is broke a bot:

http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/4703/steps/test-suite/logs/test.log

Reverting while I investigate.

This reverts commit r260565.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260586 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 21:07:44 +00:00
Matthias Braun
07b147db30 LiveIntervalAnalysis: Support moving of subregister defs in handleMove
If two definitions write to independent subregisters then they can be
put in any order. LiveIntervalAnalysis::handleMove() did not support
this previously because it looks like moving a definition of a vreg past
another one.

This is a modified version of a patch proposed (two years ago) by
Vincent Lejeune! This version does not touch the read-undef flags and is
extended for the case of moving a subregister def behind all uses - this
can happen for subregister defs that are completely unused.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260565 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 19:03:53 +00:00
Matthias Braun
632580f369 LiveIntervalAnalysis: Improve some comments
As recommended by Justin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258771 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 01:40:48 +00:00
Matthias Braun
1b9e9d8523 LiveIntervalAnalysis: Cleanup handleMove{Down|Up}() functions, NFC
These two functions are hard to reason about. This commit makes the code
more comprehensible:

- Use four distinct variables (OldIdxIn, OldIdxOut, NewIdxIn, NewIdxOut)
  with a fixed value instead of a changing iterator I that points to
  different things during the function.
- Remove the early explanation before the function in favor of more
  detailed comments inside the function. Should have more/clearer comments now
  stating which conditions are tested and which invariants hold at
  different points in the functions.

The behaviour of the code was not changed.

I hope that this will make it easier to review the changes in
http://reviews.llvm.org/D9067 which I will adapt next.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258756 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 00:43:50 +00:00
Matthias Braun
1c6737efbc LiveInterval: Add utility class to rename independent subregister usage
This renaming is necessary to avoid a subregister aware scheduler
accidentally creating liveness "holes" which are rejected by the
MachineVerifier.

Explanation as found in this patch:

Helper class that can divide MachineOperands of a virtual register into
equivalence classes of connected components.
MachineOperands belong to the same equivalence class when they are part of
the same SubRange segment or adjacent segments (adjacent in control
flow); Different subranges affected by the same MachineOperand belong to
the same equivalence class.

Example:
  vreg0:sub0 = ...
  vreg0:sub1 = ...
  vreg0:sub2 = ...
  ...
  xxx        = op vreg0:sub1
  vreg0:sub1 = ...
  store vreg0:sub0_sub1

The example contains 3 different equivalence classes:
  - One for the (dead) vreg0:sub2 definition
  - One containing the first vreg0:sub1 definition and its use,
    but not the second definition!
  - The remaining class contains all other operands involving vreg0.

We provide a utility function here to rename disjunct classes to different
virtual registers.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258257 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 00:23:21 +00:00
Matthias Braun
dcaeedf3f4 LiveInterval: A LiveRange is enough for ConnectedVNInfoEqClasses::Classify()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257129 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-08 01:16:35 +00:00
Matthias Braun
f98fd35fa9 MachineInstr: addRegisterDefReadUndef() => setRegisterDefReadUndef()
This way we can not only add but also remove read undef flags.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252678 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11 00:41:58 +00:00
Reid Kleckner
f0a04c06ab [WinEH] Mark funclet entries and exits as clobbering all registers
Summary:
In this implementation, LiveIntervalAnalysis invents a few register
masks on basic block boundaries that preserve no registers. The nice
thing about this is that it prevents the prologue inserter from thinking
it needs to spill all XMM CSRs, because it doesn't see any explicit
physreg defs in the MI.

Reviewers: MatzeB, qcolombet, JosephTremoulet, majnemer

Subscribers: MatzeB, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252318 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-06 17:06:38 +00:00
Reid Kleckner
baea4d9d8f Range-for some LiveIntervals code under review
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252267 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-06 02:01:02 +00:00
Duncan P. N. Exon Smith
3f2c43f3c5 CodeGen: Remove more ilist iterator implicit conversions, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249879 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-09 19:13:58 +00:00
Matthias Braun
86ac1df594 TargetRegisterInfo: Introduce PrintLaneMask.
This makes it more convenient to print lane masks and lead to more
uniform printing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248624 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-25 21:51:24 +00:00
Matthias Braun
dfc5b65a74 TargetRegisterInfo: Add typedef unsigned LaneBitmask and use it where apropriate; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248623 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-25 21:51:14 +00:00