diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2011-07-01 04:15:02 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2011-07-01 04:15:02 +0000 |
commit | 8f1bdac3eba0e065c8ebe2a9c671e299c1fc6797 (patch) | |
tree | 27ef68d79c2bc8fbc55b46b237933d1bd84aa57e | |
parent | fe11caaa73782e3182a4d4840ee00336dab9490a (diff) | |
download | external_llvm-8f1bdac3eba0e065c8ebe2a9c671e299c1fc6797.tar.gz external_llvm-8f1bdac3eba0e065c8ebe2a9c671e299c1fc6797.tar.bz2 external_llvm-8f1bdac3eba0e065c8ebe2a9c671e299c1fc6797.zip |
Avoid DenseMap lookup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134231 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/RegisterCoalescer.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/CodeGen/RegisterCoalescer.cpp b/lib/CodeGen/RegisterCoalescer.cpp index f525ccd211..3b982d67e7 100644 --- a/lib/CodeGen/RegisterCoalescer.cpp +++ b/lib/CodeGen/RegisterCoalescer.cpp @@ -1195,16 +1195,19 @@ static unsigned ComputeUltimateVN(VNInfo *VNI, // A = X // B = A // which allows us to coalesce A and B. -// MI is the definition of B. LR is the life range of A that includes +// VNI is the definition of B. LR is the life range of A that includes // the slot just before B. If we return true, we add "B = X" to DupCopies. static bool RegistersDefinedFromSameValue(LiveIntervals &li, const TargetRegisterInfo &tri, - CoalescerPair &CP, MachineInstr *MI, + CoalescerPair &CP, + VNInfo *VNI, LiveRange *LR, SmallVector<MachineInstr*, 8> &DupCopies) { // FIXME: This is very conservative. For example, we don't handle // physical registers. + MachineInstr *MI = VNI->getCopy(); + if (!MI->isFullCopy() || CP.isPartial() || CP.isPhys()) return false; @@ -1213,9 +1216,8 @@ static bool RegistersDefinedFromSameValue(LiveIntervals &li, // FIXME: If "B = X" kills X, we have to move the kill back to its // previous use. For now we just avoid the optimization in that case. - SlotIndex CopyIdx = li.getInstructionIndex(MI).getDefIndex(); LiveInterval &SrcInt = li.getInterval(Src); - if (SrcInt.killedAt(CopyIdx)) + if (SrcInt.killedAt(VNI->def)) return false; if (!TargetRegisterInfo::isVirtualRegister(Src) || @@ -1335,7 +1337,7 @@ bool RegisterCoalescer::JoinIntervals(CoalescerPair &CP) { // from the RHS interval, we can use its value #. MachineInstr *MI = VNI->getCopy(); if (!CP.isCoalescable(MI) && - !RegistersDefinedFromSameValue(*li_, *tri_, CP, MI, lr, DupCopies)) + !RegistersDefinedFromSameValue(*li_, *tri_, CP, VNI, lr, DupCopies)) continue; LHSValsDefinedFromRHS[VNI] = lr->valno; @@ -1362,7 +1364,7 @@ bool RegisterCoalescer::JoinIntervals(CoalescerPair &CP) { // from the LHS interval, we can use its value #. MachineInstr *MI = VNI->getCopy(); if (!CP.isCoalescable(MI) && - !RegistersDefinedFromSameValue(*li_, *tri_, CP, MI, lr, DupCopies)) + !RegistersDefinedFromSameValue(*li_, *tri_, CP, VNI, lr, DupCopies)) continue; RHSValsDefinedFromLHS[VNI] = lr->valno; |