[llvm] r276678 - LiveIntervals: Return index from replaceMachineInstrInMaps
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 25 12:39:04 PDT 2016
Author: arsenm
Date: Mon Jul 25 14:39:04 2016
New Revision: 276678
URL: http://llvm.org/viewvc/llvm-project?rev=276678&view=rev
Log:
LiveIntervals: Return index from replaceMachineInstrInMaps
Fixes weird asymmetry with insertion
Modified:
llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
llvm/trunk/include/llvm/CodeGen/SlotIndexes.h
Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=276678&r1=276677&r2=276678&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Mon Jul 25 14:39:04 2016
@@ -253,8 +253,8 @@ extern cl::opt<bool> UseSegmentSetForPhy
Indexes->removeMachineInstrFromMaps(MI);
}
- void ReplaceMachineInstrInMaps(MachineInstr &MI, MachineInstr &NewMI) {
- Indexes->replaceMachineInstrInMaps(MI, NewMI);
+ SlotIndex ReplaceMachineInstrInMaps(MachineInstr &MI, MachineInstr &NewMI) {
+ return Indexes->replaceMachineInstrInMaps(MI, NewMI);
}
VNInfo::Allocator& getVNInfoAllocator() { return VNInfoAllocator; }
Modified: llvm/trunk/include/llvm/CodeGen/SlotIndexes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SlotIndexes.h?rev=276678&r1=276677&r2=276678&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SlotIndexes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SlotIndexes.h Mon Jul 25 14:39:04 2016
@@ -632,11 +632,12 @@ namespace llvm {
}
/// ReplaceMachineInstrInMaps - Replacing a machine instr with a new one in
- /// maps used by register allocator.
- void replaceMachineInstrInMaps(MachineInstr &MI, MachineInstr &NewMI) {
+ /// maps used by register allocator. \returns the index where the new
+ /// instruction was inserted.
+ SlotIndex replaceMachineInstrInMaps(MachineInstr &MI, MachineInstr &NewMI) {
Mi2IndexMap::iterator mi2iItr = mi2iMap.find(&MI);
if (mi2iItr == mi2iMap.end())
- return;
+ return SlotIndex();
SlotIndex replaceBaseIndex = mi2iItr->second;
IndexListEntry *miEntry(replaceBaseIndex.listEntry());
assert(miEntry->getInstr() == &MI &&
@@ -644,6 +645,7 @@ namespace llvm {
miEntry->setInstr(&NewMI);
mi2iMap.erase(mi2iItr);
mi2iMap.insert(std::make_pair(&NewMI, replaceBaseIndex));
+ return replaceBaseIndex;
}
/// Add the given MachineBasicBlock into the maps.
More information about the llvm-commits
mailing list