mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-18 18:42:46 +02:00
Be more verbose when detecting dominance problems.
Catch uses of undefined physregs that haven't been added to basic block live-in lists. Run the verifier to pinpoint the problem. Also run the verifier when a virtual register use is not jointly dominated by defs. llvm-svn: 160207
This commit is contained in:
parent
8030f89de4
commit
70ab9a6638
@ -95,7 +95,7 @@ void LiveRangeCalc::extendToUses(LiveInterval *LI, unsigned Reg) {
|
|||||||
Idx = Idx.getRegSlot(true);
|
Idx = Idx.getRegSlot(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
extend(LI, Idx);
|
extend(LI, Idx, Reg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +129,8 @@ void LiveRangeCalc::updateLiveIns(VNInfo *OverrideVNI) {
|
|||||||
|
|
||||||
|
|
||||||
void LiveRangeCalc::extend(LiveInterval *LI,
|
void LiveRangeCalc::extend(LiveInterval *LI,
|
||||||
SlotIndex Kill) {
|
SlotIndex Kill,
|
||||||
|
unsigned PhysReg) {
|
||||||
assert(LI && "Missing live range");
|
assert(LI && "Missing live range");
|
||||||
assert(Kill.isValid() && "Invalid SlotIndex");
|
assert(Kill.isValid() && "Invalid SlotIndex");
|
||||||
assert(Indexes && "Missing SlotIndexes");
|
assert(Indexes && "Missing SlotIndexes");
|
||||||
@ -146,7 +147,7 @@ void LiveRangeCalc::extend(LiveInterval *LI,
|
|||||||
// multiple values, and we may need to create even more phi-defs to preserve
|
// multiple values, and we may need to create even more phi-defs to preserve
|
||||||
// VNInfo SSA form. Perform a search for all predecessor blocks where we
|
// VNInfo SSA form. Perform a search for all predecessor blocks where we
|
||||||
// know the dominating VNInfo.
|
// know the dominating VNInfo.
|
||||||
VNInfo *VNI = findReachingDefs(LI, KillMBB, Kill);
|
VNInfo *VNI = findReachingDefs(LI, KillMBB, Kill, PhysReg);
|
||||||
|
|
||||||
// When there were multiple different values, we may need new PHIs.
|
// When there were multiple different values, we may need new PHIs.
|
||||||
if (!VNI)
|
if (!VNI)
|
||||||
@ -169,7 +170,8 @@ void LiveRangeCalc::calculateValues() {
|
|||||||
|
|
||||||
VNInfo *LiveRangeCalc::findReachingDefs(LiveInterval *LI,
|
VNInfo *LiveRangeCalc::findReachingDefs(LiveInterval *LI,
|
||||||
MachineBasicBlock *KillMBB,
|
MachineBasicBlock *KillMBB,
|
||||||
SlotIndex Kill) {
|
SlotIndex Kill,
|
||||||
|
unsigned PhysReg) {
|
||||||
// Blocks where LI should be live-in.
|
// Blocks where LI should be live-in.
|
||||||
SmallVector<MachineBasicBlock*, 16> WorkList(1, KillMBB);
|
SmallVector<MachineBasicBlock*, 16> WorkList(1, KillMBB);
|
||||||
|
|
||||||
@ -180,7 +182,22 @@ VNInfo *LiveRangeCalc::findReachingDefs(LiveInterval *LI,
|
|||||||
// Using Seen as a visited set, perform a BFS for all reaching defs.
|
// Using Seen as a visited set, perform a BFS for all reaching defs.
|
||||||
for (unsigned i = 0; i != WorkList.size(); ++i) {
|
for (unsigned i = 0; i != WorkList.size(); ++i) {
|
||||||
MachineBasicBlock *MBB = WorkList[i];
|
MachineBasicBlock *MBB = WorkList[i];
|
||||||
assert(!MBB->pred_empty() && "Value live-in to entry block?");
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
if (MBB->pred_empty()) {
|
||||||
|
MBB->getParent()->verify();
|
||||||
|
llvm_unreachable("Use not jointly dominated by defs.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TargetRegisterInfo::isPhysicalRegister(PhysReg) &&
|
||||||
|
!MBB->isLiveIn(PhysReg)) {
|
||||||
|
MBB->getParent()->verify();
|
||||||
|
errs() << "The register needs to be live in to BB#" << MBB->getNumber()
|
||||||
|
<< ", but is missing from the live-in list.\n";
|
||||||
|
llvm_unreachable("Invalid global physical register");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
for (MachineBasicBlock::pred_iterator PI = MBB->pred_begin(),
|
for (MachineBasicBlock::pred_iterator PI = MBB->pred_begin(),
|
||||||
PE = MBB->pred_end(); PI != PE; ++PI) {
|
PE = MBB->pred_end(); PI != PE; ++PI) {
|
||||||
MachineBasicBlock *Pred = *PI;
|
MachineBasicBlock *Pred = *PI;
|
||||||
|
@ -105,9 +105,12 @@ class LiveRangeCalc {
|
|||||||
/// to be live-in are added to LiveIn. If a unique reaching def is found,
|
/// to be live-in are added to LiveIn. If a unique reaching def is found,
|
||||||
/// its value is returned, if Kill is jointly dominated by multiple values,
|
/// its value is returned, if Kill is jointly dominated by multiple values,
|
||||||
/// NULL is returned.
|
/// NULL is returned.
|
||||||
|
///
|
||||||
|
/// PhysReg, when set, is used to verify live-in lists on basic blocks.
|
||||||
VNInfo *findReachingDefs(LiveInterval *LI,
|
VNInfo *findReachingDefs(LiveInterval *LI,
|
||||||
MachineBasicBlock *KillMBB,
|
MachineBasicBlock *KillMBB,
|
||||||
SlotIndex Kill);
|
SlotIndex Kill,
|
||||||
|
unsigned PhysReg);
|
||||||
|
|
||||||
/// updateSSA - Compute the values that will be live in to all requested
|
/// updateSSA - Compute the values that will be live in to all requested
|
||||||
/// blocks in LiveIn. Create PHI-def values as required to preserve SSA form.
|
/// blocks in LiveIn. Create PHI-def values as required to preserve SSA form.
|
||||||
@ -157,7 +160,9 @@ public:
|
|||||||
/// Kill is not dominated by a single existing value, PHI-defs are inserted
|
/// Kill is not dominated by a single existing value, PHI-defs are inserted
|
||||||
/// as required to preserve SSA form. If Kill is known to be dominated by a
|
/// as required to preserve SSA form. If Kill is known to be dominated by a
|
||||||
/// single existing value, Alloc may be null.
|
/// single existing value, Alloc may be null.
|
||||||
void extend(LiveInterval *LI, SlotIndex Kill);
|
///
|
||||||
|
/// PhysReg, when set, is used to verify live-in lists on basic blocks.
|
||||||
|
void extend(LiveInterval *LI, SlotIndex Kill, unsigned PhysReg = 0);
|
||||||
|
|
||||||
/// createDeadDefs - Create a dead def in LI for every def operand of Reg.
|
/// createDeadDefs - Create a dead def in LI for every def operand of Reg.
|
||||||
/// Each instruction defining Reg gets a new VNInfo with a corresponding
|
/// Each instruction defining Reg gets a new VNInfo with a corresponding
|
||||||
|
Loading…
Reference in New Issue
Block a user