[llvm-commits] [llvm] r158831 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/LiveIntervalAnalysis.cpp test/CodeGen/X86/misched-new.ll
Jakob Stoklund Olesen
stoklund at 2pi.dk
Wed Jun 20 11:00:57 PDT 2012
Author: stoklund
Date: Wed Jun 20 13:00:57 2012
New Revision: 158831
URL: http://llvm.org/viewvc/llvm-project?rev=158831&view=rev
Log:
Only update regunit live ranges that have been precomputed.
Regunit live ranges are computed on demand, so when mi-sched calls
handleMove, some regunits may not have live ranges yet.
That makes updating them easier: Just skip the non-existing ranges. They
will be computed correctly from the rescheduled machine code when they
are needed.
Modified:
llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
llvm/trunk/test/CodeGen/X86/misched-new.ll
Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=158831&r1=158830&r2=158831&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Wed Jun 20 13:00:57 2012
@@ -347,6 +347,12 @@
return *LI;
}
+ /// getCachedRegUnit - Return the live range for Unit if it has already
+ /// been computed, or NULL if it hasn't been computed yet.
+ LiveInterval *getCachedRegUnit(unsigned Unit) {
+ return RegUnitIntervals[Unit];
+ }
+
/// trackingRegUnits - Does LiveIntervals curently track register units?
/// This function will be removed when regunit tracking is permanently
/// enabled.
Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=158831&r1=158830&r2=158831&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Jun 20 13:00:57 2012
@@ -1196,11 +1196,15 @@
if (TargetRegisterInfo::isPhysicalRegister(Reg) && LIS.isReserved(Reg))
continue;
+ // Collect ranges for register units. These live ranges are computed on
+ // demand, so just skip any that haven't been computed yet.
if (TargetRegisterInfo::isPhysicalRegister(Reg) && LIS.trackingRegUnits())
- for (MCRegUnitIterator Units(Reg, &TRI); Units.isValid(); ++Units)
- collectRanges(MO, &LIS.getRegUnit(*Units),
- Entering, Internal, Exiting, OldIdx);
- else if (LIS.hasInterval(Reg))
+ for (MCRegUnitIterator Units(Reg, &TRI); Units.isValid(); ++Units)
+ if (LiveInterval *LI = LIS.getCachedRegUnit(*Units))
+ collectRanges(MO, LI, Entering, Internal, Exiting, OldIdx);
+
+ // Collect ranges for individual registers.
+ if (LIS.hasInterval(Reg))
collectRanges(MO, &LIS.getInterval(Reg),
Entering, Internal, Exiting, OldIdx);
}
Modified: llvm/trunk/test/CodeGen/X86/misched-new.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/misched-new.ll?rev=158831&r1=158830&r2=158831&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/misched-new.ll (original)
+++ llvm/trunk/test/CodeGen/X86/misched-new.ll Wed Jun 20 13:00:57 2012
@@ -1,4 +1,5 @@
; RUN: llc -march=x86-64 -mcpu=core2 -enable-misched -misched=shuffle -misched-bottomup < %s
+; RUN: llc -march=x86-64 -mcpu=core2 -enable-misched -misched=shuffle -misched-bottomup -live-regunits < %s
; REQUIRES: asserts
;
; Interesting MachineScheduler cases.
More information about the llvm-commits
mailing list