mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-21 03:53:04 +02:00
* Cannot safely commute an instruction there are other defs which can reach its uses.
* Ignore copy instructions which have already been coalesced. llvm-svn: 47056
This commit is contained in:
parent
cf6273d015
commit
e0cad13e5e
@ -237,7 +237,9 @@ bool SimpleRegisterCoalescing::RemoveCopyByCommutingDef(LiveInterval &IntA,
|
||||
// AValNo is the value number in A that defines the copy, A3 in the example.
|
||||
LiveInterval::iterator ALR = IntA.FindLiveRangeContaining(CopyIdx-1);
|
||||
VNInfo *AValNo = ALR->valno;
|
||||
if (AValNo->def == ~0U || AValNo->def == ~1U)
|
||||
// If other defs can reach uses of this def, then it's not safe to perform
|
||||
// the optimization.
|
||||
if (AValNo->def == ~0U || AValNo->def == ~1U || AValNo->hasPHIKill)
|
||||
return false;
|
||||
MachineInstr *DefMI = li_->getInstructionFromIndex(AValNo->def);
|
||||
const TargetInstrDesc &TID = DefMI->getDesc();
|
||||
@ -312,6 +314,8 @@ bool SimpleRegisterCoalescing::RemoveCopyByCommutingDef(LiveInterval &IntA,
|
||||
MachineOperand &UseMO = UI.getOperand();
|
||||
++UI;
|
||||
MachineInstr *UseMI = UseMO.getParent();
|
||||
if (JoinedCopies.count(UseMI))
|
||||
continue;
|
||||
unsigned UseIdx = li_->getInstructionIndex(UseMI);
|
||||
LiveInterval::iterator ULR = IntA.FindLiveRangeContaining(UseIdx);
|
||||
if (ULR->valno != AValNo)
|
||||
|
Loading…
Reference in New Issue
Block a user