}
private:
- void lowerCopiesFromI1();
- void lowerPhis();
- void lowerCopiesToI1();
+ bool lowerCopiesFromI1();
+ bool lowerPhis();
+ bool lowerCopiesToI1();
bool isConstantLaneMask(Register Reg, bool &Val) const;
void buildMergeLaneMasks(MachineBasicBlock &MBB,
MachineBasicBlock::iterator I, const DebugLoc &DL,
OrN2Op = AMDGPU::S_ORN2_B64;
}
- lowerCopiesFromI1();
- lowerPhis();
- lowerCopiesToI1();
+ bool Changed = false;
+ Changed |= lowerCopiesFromI1();
+ Changed |= lowerPhis();
+ Changed |= lowerCopiesToI1();
+ assert(Changed || ConstrainRegs.empty());
for (unsigned Reg : ConstrainRegs)
MRI->constrainRegClass(Reg, &AMDGPU::SReg_1_XEXECRegClass);
ConstrainRegs.clear();
- return true;
+ return Changed;
}
#ifndef NDEBUG
}
#endif
-void SILowerI1Copies::lowerCopiesFromI1() {
+bool SILowerI1Copies::lowerCopiesFromI1() {
+ bool Changed = false;
SmallVector<MachineInstr *, 4> DeadCopies;
for (MachineBasicBlock &MBB : *MF) {
if (isLaneMaskReg(DstReg) || isVreg1(DstReg))
continue;
+ Changed = true;
+
// Copy into a 32-bit vector register.
LLVM_DEBUG(dbgs() << "Lower copy from i1: " << MI);
DebugLoc DL = MI.getDebugLoc();
MI->eraseFromParent();
DeadCopies.clear();
}
+ return Changed;
}
-void SILowerI1Copies::lowerPhis() {
+bool SILowerI1Copies::lowerPhis() {
MachineSSAUpdater SSAUpdater(*MF);
LoopFinder LF(*DT, *PDT);
PhiIncomingAnalysis PIA(*PDT);
Vreg1Phis.push_back(&MI);
}
}
+ if (Vreg1Phis.empty())
+ return false;
MachineBasicBlock *PrevMBB = nullptr;
for (MachineInstr *MI : Vreg1Phis) {
IncomingRegs.clear();
IncomingUpdated.clear();
}
+ return true;
}
-void SILowerI1Copies::lowerCopiesToI1() {
+bool SILowerI1Copies::lowerCopiesToI1() {
+ bool Changed = false;
MachineSSAUpdater SSAUpdater(*MF);
LoopFinder LF(*DT, *PDT);
SmallVector<MachineInstr *, 4> DeadCopies;
if (!isVreg1(DstReg))
continue;
+ Changed = true;
+
if (MRI->use_empty(DstReg)) {
DeadCopies.push_back(&MI);
continue;
MI->eraseFromParent();
DeadCopies.clear();
}
+ return Changed;
}
bool SILowerI1Copies::isConstantLaneMask(Register Reg, bool &Val) const {