mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-23 02:29:18 +00:00
Don't recompute MachineRegisterInfo in the Optimize* method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116750 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9d28fdd722
commit
b41ee96d76
@ -600,6 +600,7 @@ public:
|
||||
/// *only* if a transformation took place.
|
||||
virtual bool OptimizeCompareInstr(MachineInstr *CmpInstr,
|
||||
unsigned SrcReg, int Mask, int Value,
|
||||
const MachineRegisterInfo *MRI,
|
||||
MachineBasicBlock::iterator &) const {
|
||||
return false;
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ bool PeepholeOptimizer::OptimizeCmpInstr(MachineInstr *MI,
|
||||
return false;
|
||||
|
||||
// Attempt to optimize the comparison instruction.
|
||||
if (TII->OptimizeCompareInstr(MI, SrcReg, CmpMask, CmpValue, NextIter)) {
|
||||
if (TII->OptimizeCompareInstr(MI, SrcReg, CmpMask, CmpValue, MRI, NextIter)) {
|
||||
++NumEliminated;
|
||||
return true;
|
||||
}
|
||||
|
@ -1490,13 +1490,13 @@ static bool isSuitableForMask(MachineInstr *&MI, unsigned SrcReg,
|
||||
/// iterator *only* if a transformation took place.
|
||||
bool ARMBaseInstrInfo::
|
||||
OptimizeCompareInstr(MachineInstr *CmpInstr, unsigned SrcReg, int CmpMask,
|
||||
int CmpValue, MachineBasicBlock::iterator &MII) const {
|
||||
int CmpValue, const MachineRegisterInfo *MRI,
|
||||
MachineBasicBlock::iterator &MII) const {
|
||||
if (CmpValue != 0)
|
||||
return false;
|
||||
|
||||
MachineRegisterInfo &MRI = CmpInstr->getParent()->getParent()->getRegInfo();
|
||||
MachineRegisterInfo::def_iterator DI = MRI.def_begin(SrcReg);
|
||||
if (llvm::next(DI) != MRI.def_end())
|
||||
MachineRegisterInfo::def_iterator DI = MRI->def_begin(SrcReg);
|
||||
if (llvm::next(DI) != MRI->def_end())
|
||||
// Only support one definition.
|
||||
return false;
|
||||
|
||||
@ -1506,8 +1506,8 @@ OptimizeCompareInstr(MachineInstr *CmpInstr, unsigned SrcReg, int CmpMask,
|
||||
if (CmpMask != ~0) {
|
||||
if (!isSuitableForMask(MI, SrcReg, CmpMask, false)) {
|
||||
MI = 0;
|
||||
for (MachineRegisterInfo::use_iterator UI = MRI.use_begin(SrcReg),
|
||||
UE = MRI.use_end(); UI != UE; ++UI) {
|
||||
for (MachineRegisterInfo::use_iterator UI = MRI->use_begin(SrcReg),
|
||||
UE = MRI->use_end(); UI != UE; ++UI) {
|
||||
if (UI->getParent() != CmpInstr->getParent()) continue;
|
||||
MachineInstr *PotentialAND = &*UI;
|
||||
if (!isSuitableForMask(PotentialAND, SrcReg, CmpMask, true))
|
||||
|
@ -341,6 +341,7 @@ public:
|
||||
/// that we can remove a "comparison with zero".
|
||||
virtual bool OptimizeCompareInstr(MachineInstr *CmpInstr, unsigned SrcReg,
|
||||
int CmpMask, int CmpValue,
|
||||
const MachineRegisterInfo *MRI,
|
||||
MachineBasicBlock::iterator &MII) const;
|
||||
|
||||
virtual unsigned getNumMicroOps(const MachineInstr *MI,
|
||||
|
Loading…
Reference in New Issue
Block a user