diff options
author | Lang Hames <lhames@gmail.com> | 2010-09-26 03:37:09 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2010-09-26 03:37:09 +0000 |
commit | cec2945f3092c4d087716eb96062d7c7ef6fe60c (patch) | |
tree | b49566e95f0f1e30d989e324cf72d260af433a4d /lib/CodeGen/SimpleRegisterCoalescing.cpp | |
parent | a6c1dbd541d93359a7dd8fbcba3d7f0bf77e60c5 (diff) |
Fixed some tests to avoid LiveIntervals::getInstructionFromIndex(..) overhead where possible. Thanks to Jakob for the suggestions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114798 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SimpleRegisterCoalescing.cpp')
-rw-r--r-- | lib/CodeGen/SimpleRegisterCoalescing.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/CodeGen/SimpleRegisterCoalescing.cpp b/lib/CodeGen/SimpleRegisterCoalescing.cpp index a839edd6f4..c111261acf 100644 --- a/lib/CodeGen/SimpleRegisterCoalescing.cpp +++ b/lib/CodeGen/SimpleRegisterCoalescing.cpp @@ -349,10 +349,9 @@ bool SimpleRegisterCoalescing::RemoveCopyByCommutingDef(const CoalescerPair &CP, 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 @@ bool SimpleRegisterCoalescing::ReMaterializeTrivialDef(LiveInterval &SrcInt, 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()) |