[llvm-commits] [llvm] r114798 - in /llvm/trunk/lib/CodeGen: InlineSpiller.cpp PreAllocSplitting.cpp SimpleRegisterCoalescing.cpp
Lang Hames
lhames at gmail.com
Sat Sep 25 20:37:09 PDT 2010
Author: lhames
Date: Sat Sep 25 22:37:09 2010
New Revision: 114798
URL: http://llvm.org/viewvc/llvm-project?rev=114798&view=rev
Log:
Fixed some tests to avoid LiveIntervals::getInstructionFromIndex(..) overhead where possible. Thanks to Jakob for the suggestions.
Modified:
llvm/trunk/lib/CodeGen/InlineSpiller.cpp
llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp
llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
Modified: llvm/trunk/lib/CodeGen/InlineSpiller.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/InlineSpiller.cpp?rev=114798&r1=114797&r2=114798&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/InlineSpiller.cpp (original)
+++ llvm/trunk/lib/CodeGen/InlineSpiller.cpp Sat Sep 25 22:37:09 2010
@@ -282,7 +282,7 @@
lis_.RemoveMachineInstrFromMaps(DefMI);
vrm_.RemoveMachineInstrFromMaps(DefMI);
DefMI->eraseFromParent();
- VNI->def = lis_.getZeroIndex();
+ VNI->def = SlotIndex();
anyRemoved = true;
}
Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=114798&r1=114797&r2=114798&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original)
+++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Sat Sep 25 22:37:09 2010
@@ -807,8 +807,7 @@
MachineBasicBlock& MBB = *RestorePt->getParent();
MachineBasicBlock::iterator KillPt = BarrierMBB->end();
- if (LIs->getInstructionFromIndex(ValNo->def) == 0 ||
- DefMI->getParent() == BarrierMBB)
+ if (!DefMI || DefMI->getParent() == BarrierMBB)
KillPt = findSpillPoint(BarrierMBB, Barrier, NULL, RefsInMBB);
else
KillPt = llvm::next(MachineBasicBlock::iterator(DefMI));
@@ -1005,7 +1004,7 @@
SlotIndex SpillIndex;
MachineInstr *SpillMI = NULL;
int SS = -1;
- if (LIs->getInstructionFromIndex(ValNo->def) == 0) {
+ if (!DefMI) {
// If we don't know where the def is we must split just before the barrier.
if ((SpillMI = FoldSpill(LI->reg, RC, 0, Barrier,
BarrierMBB, SS, RefsInMBB))) {
Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=114798&r1=114797&r2=114798&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Sat Sep 25 22:37:09 2010
@@ -349,10 +349,9 @@
VNInfo *AValNo = ALR->valno;
// If other defs can reach uses of this def, then it's not safe to perform
// the optimization.
- MachineInstr *DefMI = li_->getInstructionFromIndex(AValNo->def);
- if (AValNo->isPHIDef() || DefMI == 0 || AValNo->isUnused() ||
- AValNo->hasPHIKill())
+ if (AValNo->isPHIDef() || AValNo->isUnused() || AValNo->hasPHIKill())
return false;
+ MachineInstr *DefMI = li_->getInstructionFromIndex(AValNo->def);
if (!DefMI)
return false;
const TargetInstrDesc &TID = DefMI->getDesc();
@@ -649,10 +648,11 @@
VNInfo *ValNo = SrcLR->valno;
// If other defs can reach uses of this def, then it's not safe to perform
// the optimization.
- if (ValNo->isPHIDef() || li_->getInstructionFromIndex(ValNo->def)==0 ||
- ValNo->isUnused() || ValNo->hasPHIKill())
+ if (ValNo->isPHIDef() || ValNo->isUnused() || ValNo->hasPHIKill())
return false;
MachineInstr *DefMI = li_->getInstructionFromIndex(ValNo->def);
+ if (!DefMI)
+ return false;
assert(DefMI && "Defining instruction disappeared");
const TargetInstrDesc &TID = DefMI->getDesc();
if (!TID.isAsCheapAsAMove())
More information about the llvm-commits
mailing list