mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 21:18:19 +00:00
MergeValueInto is too smart: it might choose to do the merge the opposite direction.
Live interval reconstruction needs to account for this, and scour its maps to prevent dangling references. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63558 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -654,8 +654,24 @@ PreAllocSplitting::PerformPHIConstructionFallBack(MachineBasicBlock::iterator Us
|
||||
}
|
||||
|
||||
if (MBB->pred_size() == 1 && !RetVNI->hasPHIKill) {
|
||||
LI->MergeValueNumberInto(RetVNI, IncomingVNs.begin()->second);
|
||||
Phis[MBB] = RetVNI = IncomingVNs.begin()->second;
|
||||
VNInfo* OldVN = RetVNI;
|
||||
VNInfo* NewVN = IncomingVNs.begin()->second;
|
||||
VNInfo* MergedVN = LI->MergeValueNumberInto(OldVN, NewVN);
|
||||
if (MergedVN == OldVN) std::swap(OldVN, NewVN);
|
||||
|
||||
for (DenseMap<MachineBasicBlock*, VNInfo*>::iterator LOI = LiveOut.begin(),
|
||||
LOE = LiveOut.end(); LOI != LOE; ++LOI)
|
||||
if (LOI->second == OldVN)
|
||||
LOI->second = MergedVN;
|
||||
for (DenseMap<MachineInstr*, VNInfo*>::iterator NVI = NewVNs.begin(),
|
||||
NVE = NewVNs.end(); NVI != NVE; ++NVI)
|
||||
if (NVI->second == OldVN)
|
||||
NVI->second = MergedVN;
|
||||
for (DenseMap<MachineBasicBlock*, VNInfo*>::iterator PI = Phis.begin(),
|
||||
PE = Phis.end(); PI != PE; ++PI)
|
||||
if (PI->second == OldVN)
|
||||
PI->second = MergedVN;
|
||||
RetVNI = MergedVN;
|
||||
} else {
|
||||
// Otherwise, merge the incoming VNInfos with a phi join. Create a new
|
||||
// VNInfo to represent the joined value.
|
||||
|
||||
Reference in New Issue
Block a user