summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveRangeCalc.cpp
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2014-12-24 02:11:51 +0000
committerMatthias Braun <matze@braunis.de>2014-12-24 02:11:51 +0000
commitdbcca0dbb412de554c92a7cf91568b6986999eac (patch)
tree1f5b9ba72469b4e844f102f8cde46e16d68f1261 /llvm/lib/CodeGen/LiveRangeCalc.cpp
parent7030dda8d5c680534a8a1bbfb371db69025e40cb (diff)
downloadbcm5719-llvm-dbcca0dbb412de554c92a7cf91568b6986999eac.tar.gz
bcm5719-llvm-dbcca0dbb412de554c92a7cf91568b6986999eac.zip
LiveInterval: Introduce createMainRangeFromSubranges().
This function constructs the main liverange by merging all subranges if subregister liveness tracking is available. This should be slightly faster to compute instead of performing the liveness calculation again for the main range. More importantly it avoids cases where the main liverange would cover positions where no subrange was live. These cases happened for partial definitions where the actual defined part was dead and only the undefined parts used later. The register coalescing requires that every part covered by the main live range has at least one subrange live. I also expect this function to become usefull later for places where the subranges are modified in a way that it is hard to correctly fix the main liverange in the machine scheduler, we can simply reconstruct it from subranges then. llvm-svn: 224806
Diffstat (limited to 'llvm/lib/CodeGen/LiveRangeCalc.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveRangeCalc.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/LiveRangeCalc.cpp b/llvm/lib/CodeGen/LiveRangeCalc.cpp
index e449b240d70..1d46161ad71 100644
--- a/llvm/lib/CodeGen/LiveRangeCalc.cpp
+++ b/llvm/lib/CodeGen/LiveRangeCalc.cpp
@@ -105,8 +105,9 @@ void LiveRangeCalc::calculate(LiveInterval &LI) {
}
}
- // Create the def in the main liverange.
- if (MO.isDef())
+ // Create the def in the main liverange. We do not have to do this if
+ // subranges are tracked as we recreate the main range later in this case.
+ if (MO.isDef() && !LI.hasSubRanges())
createDeadDef(*Indexes, *Alloc, LI, MO);
}
@@ -116,13 +117,17 @@ void LiveRangeCalc::calculate(LiveInterval &LI) {
// Step 2: Extend live segments to all uses, constructing SSA form as
// necessary.
- for (LiveInterval::SubRange &S : LI.subranges()) {
+ if (LI.hasSubRanges()) {
+ for (LiveInterval::SubRange &S : LI.subranges()) {
+ resetLiveOutMap();
+ extendToUses(S, Reg, S.LaneMask);
+ }
+ LI.clear();
+ LI.constructMainRangeFromSubranges(*Indexes, *Alloc);
+ } else {
resetLiveOutMap();
- extendToUses(S, Reg, S.LaneMask);
+ extendToUses(LI, Reg, ~0u);
}
-
- resetLiveOutMap();
- extendToUses(LI, Reg, ~0u);
}
OpenPOWER on IntegriCloud