SmallPtrSet<MachineInstr *, 4> Predicated;
MachineBasicBlock *Header = ML.getHeader();
+ LLVM_DEBUG(dbgs() << "ARM Loops: Validating Live outs\n");
+
for (auto &MI : *Header) {
if (!shouldInspect(MI))
continue;
FalseLanesZero.insert(&MI);
else if (MI.getNumDefs() == 0)
continue;
- else if (!isPredicated && retainsOrReduces)
+ else if (!isPredicated && retainsOrReduces) {
+ LLVM_DEBUG(dbgs() << " Unpredicated instruction that retainsOrReduces: " << MI);
return false;
+ }
else if (!isPredicated)
FalseLanesUnknown.insert(&MI);
}
+ LLVM_DEBUG({
+ dbgs() << " Predicated:\n";
+ for (auto *I : Predicated)
+ dbgs() << " " << *I;
+ dbgs() << " FalseLanesZero:\n";
+ for (auto *I : FalseLanesZero)
+ dbgs() << " " << *I;
+ dbgs() << " FalseLanesUnknown:\n";
+ for (auto *I : FalseLanesUnknown)
+ dbgs() << " " << *I;
+ });
+
auto HasPredicatedUsers = [this](MachineInstr *MI, const MachineOperand &MO,
SmallPtrSetImpl<MachineInstr *> &Predicated) {
SmallPtrSet<MachineInstr *, 2> Uses;
if (!isRegInClass(MO, QPRs) || !MO.isDef())
continue;
if (!HasPredicatedUsers(MI, MO, Predicated)) {
- LLVM_DEBUG(dbgs() << "ARM Loops: Found an unknown def of : "
+ LLVM_DEBUG(dbgs() << " Found an unknown def of : "
<< TRI.getRegAsmName(MO.getReg()) << " at " << *MI);
NonPredicated.insert(MI);
break;
for (const MachineBasicBlock::RegisterMaskPair &RegMask : ExitBB->liveins()) {
// TODO: Instead of blocking predication, we could move the vctp to the exit
// block and calculate it's operand there in or the preheader.
- if (RegMask.PhysReg == ARM::VPR)
+ if (RegMask.PhysReg == ARM::VPR) {
+ LLVM_DEBUG(dbgs() << " VPR is live in to the exit block.");
return false;
+ }
// Check Q-regs that are live in the exit blocks. We don't collect scalars
// because they won't be affected by lane predication.
if (QPRs->contains(RegMask.PhysReg))
// legality.
for (auto *MI : LiveOutMIs) {
if (NonPredicated.count(MI) && FalseLanesUnknown.contains(MI)) {
- LLVM_DEBUG(dbgs() << "ARM Loops: Unable to handle live out: " << *MI);
+ LLVM_DEBUG(dbgs() << " Unable to handle live out: " << *MI);
return false;
}
}