Skip to content

Commit

Permalink
Avoid caching the MachineFunction, we don't use it outside of
Browse files Browse the repository at this point in the history
runOnMachineFunction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219847 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
echristo committed Oct 15, 2014
1 parent 0a72d8b commit 55751ba
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions lib/CodeGen/PeepholeOptimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ STATISTIC(NumRewrittenCopies, "Number of copies rewritten");

namespace {
class PeepholeOptimizer : public MachineFunctionPass {
MachineFunction *MF;
const TargetInstrInfo *TII;
const TargetRegisterInfo *TRI;
MachineRegisterInfo *MRI;
Expand Down Expand Up @@ -1052,25 +1051,24 @@ bool PeepholeOptimizer::foldImmediate(MachineInstr *MI, MachineBasicBlock *MBB,
return false;
}

bool PeepholeOptimizer::runOnMachineFunction(MachineFunction &mf) {
if (skipOptnoneFunction(*mf.getFunction()))
bool PeepholeOptimizer::runOnMachineFunction(MachineFunction &MF) {
if (skipOptnoneFunction(*MF.getFunction()))
return false;

DEBUG(dbgs() << "********** PEEPHOLE OPTIMIZER **********\n");
DEBUG(dbgs() << "********** Function: " << mf.getName() << '\n');
DEBUG(dbgs() << "********** Function: " << MF.getName() << '\n');

if (DisablePeephole)
return false;

MF = &mf;
TII = MF->getSubtarget().getInstrInfo();
TRI = MF->getSubtarget().getRegisterInfo();
MRI = &MF->getRegInfo();
TII = MF.getSubtarget().getInstrInfo();
TRI = MF.getSubtarget().getRegisterInfo();
MRI = &MF.getRegInfo();
DT = Aggressive ? &getAnalysis<MachineDominatorTree>() : nullptr;

bool Changed = false;

for (MachineFunction::iterator I = MF->begin(), E = MF->end(); I != E; ++I) {
for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) {
MachineBasicBlock *MBB = &*I;

bool SeenMoveImm = false;
Expand Down

0 comments on commit 55751ba

Please sign in to comment.