Changes in directory llvm/lib/CodeGen:
VirtRegMap.cpp updated: 1.49 -> 1.50 --- Log message: Remove move copies and dead stuff by not clobbering the result reg of a noop copy. --- Diffs of the changes: (+21 -12) VirtRegMap.cpp | 33 +++++++++++++++++++++------------ 1 files changed, 21 insertions(+), 12 deletions(-) Index: llvm/lib/CodeGen/VirtRegMap.cpp diff -u llvm/lib/CodeGen/VirtRegMap.cpp:1.49 llvm/lib/CodeGen/VirtRegMap.cpp:1.50 --- llvm/lib/CodeGen/VirtRegMap.cpp:1.49 Thu Feb 2 21:06:49 2006 +++ llvm/lib/CodeGen/VirtRegMap.cpp Thu Feb 2 21:16:14 2006 @@ -607,6 +607,15 @@ } if (!OpTakenCareOf) { + // Check to see if this is a noop copy. If so, eliminate the + // instruction before considering the dest reg to be changed. + unsigned Src, Dst; + if (TII->isMoveInstr(MI, Src, Dst) && Src == Dst) { + ++NumDCE; + DEBUG(std::cerr << "Removing now-noop copy: " << MI); + MBB.erase(&MI); + goto ProcessNextInst; + } ClobberPhysReg(VirtReg, SpillSlotsAvailable, PhysRegsAvailable); continue; } @@ -631,6 +640,18 @@ DEBUG(std::cerr << "Store:\t" << *next(MII)); MI.SetMachineOperandReg(i, PhysReg); + // Check to see if this is a noop copy. If so, eliminate the + // instruction before considering the dest reg to be changed. + { + unsigned Src, Dst; + if (TII->isMoveInstr(MI, Src, Dst) && Src == Dst) { + ++NumDCE; + DEBUG(std::cerr << "Removing now-noop copy: " << MI); + MBB.erase(&MI); + goto ProcessNextInst; + } + } + // If there is a dead store to this stack slot, nuke it now. MachineInstr *&LastStore = MaybeDeadStores[StackSlot]; if (LastStore) { @@ -654,18 +675,6 @@ ++NumStores; } } - - // Okay, the instruction has been completely processed, input and output - // registers have been added. As a final sanity check, make sure this is - // not a noop-copy. If it is, nuke it. - { - unsigned Src, Dst; - if (TII->isMoveInstr(MI, Src, Dst) && Src == Dst) { - ++NumDCE; - DEBUG(std::cerr << "Removing now-noop copy: " << MI); - MBB.erase(&MI); - } - } ProcessNextInst: MII = NextMII; } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits